From 67073a463b299ce80a471a79d765fc399add5cca Mon Sep 17 00:00:00 2001 From: luke metz Date: Wed, 12 Aug 2015 23:48:40 -0700 Subject: [PATCH] none checking on owl + removal of compiled pyx files --- owl/owl/.gitignore | 1 + owl/owl/libowl.cpp | 23122 ------------------------------------------- owl/owl/libowl.pyx | 86 +- 3 files changed, 57 insertions(+), 23152 deletions(-) create mode 100644 owl/owl/.gitignore delete mode 100644 owl/owl/libowl.cpp diff --git a/owl/owl/.gitignore b/owl/owl/.gitignore new file mode 100644 index 00000000..ce1da4c5 --- /dev/null +++ b/owl/owl/.gitignore @@ -0,0 +1 @@ +*.cpp diff --git a/owl/owl/libowl.cpp b/owl/owl/libowl.cpp deleted file mode 100644 index dc27ab2c..00000000 --- a/owl/owl/libowl.cpp +++ /dev/null @@ -1,23122 +0,0 @@ -/* Generated by Cython 0.22.1 */ - -/* BEGIN: Cython Metadata -{ - "distutils": { - "depends": [ - "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ufuncobject.h", - "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/arrayobject.h" - ], - "extra_compile_args": [ - "-std=c++11", - "-Wall", - "-O2", - "-g" - ], - "include_dirs": [ - "minerva", - "/usr/lib/python2.7/dist-packages/numpy/core/include", - "release/third_party/include" - ], - "language": "c++", - "libraries": [ - "minerva" - ], - "library_dirs": [ - "release/lib" - ], - "runtime_library_dirs": [ - "/home/minjie/athena/athena/release/lib" - ] - } -} -END: Cython Metadata */ - -#define PY_SSIZE_T_CLEAN -#ifndef CYTHON_USE_PYLONG_INTERNALS -#ifdef PYLONG_BITS_IN_DIGIT -#define CYTHON_USE_PYLONG_INTERNALS 0 -#else -#include "pyconfig.h" -#ifdef PYLONG_BITS_IN_DIGIT -#define CYTHON_USE_PYLONG_INTERNALS 1 -#else -#define CYTHON_USE_PYLONG_INTERNALS 0 -#endif -#endif -#endif -#include "Python.h" -#ifndef Py_PYTHON_H - #error Python headers needed to compile C extensions, please install development version of Python. -#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000) - #error Cython requires Python 2.6+ or Python 3.2+. -#else -#define CYTHON_ABI "0_22_1" -#include -#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 -#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_CPYTHON 0 -#else -#define CYTHON_COMPILING_IN_PYPY 0 -#define CYTHON_COMPILING_IN_CPYTHON 1 -#endif -#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 > 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_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) -#else - #define CYTHON_PEP393_ENABLED 0 - #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_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])) -#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) - #define __Pyx_PyFrozenSet_Size(s) PyObject_Size(s) -#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)) - #define __Pyx_PyFrozenSet_Size(s) PySet_Size(s) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains) - #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) -#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 - #define PyBaseString_Type PyUnicode_Type - #define PyStringObject PyUnicodeObject - #define PyString_Type PyUnicode_Type - #define PyString_Check PyUnicode_Check - #define PyString_CheckExact PyUnicode_CheckExact -#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 -#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) -#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) : PyInstanceMethod_New(func)) -#else - #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) -#endif -#ifndef CYTHON_INLINE - #if defined(__GNUC__) - #define CYTHON_INLINE __inline__ - #elif defined(_MSC_VER) - #define CYTHON_INLINE __inline - #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define CYTHON_INLINE inline - #else - #define CYTHON_INLINE - #endif -#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 -#ifdef NAN -#define __PYX_NAN() ((float) NAN) -#else -static CYTHON_INLINE float __PYX_NAN() { - /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and - a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is - a quiet NaN. */ - float value; - memset(&value, 0xFF, sizeof(value)); - return value; -} -#endif -#define __Pyx_void_to_None(void_result) (void_result, Py_INCREF(Py_None), Py_None) -#ifdef __cplusplus -template -void __Pyx_call_destructor(T* x) { - x->~T(); -} -template -class __Pyx_FakeReference { - public: - __Pyx_FakeReference() : ptr(NULL) { } - __Pyx_FakeReference(T& ref) : ptr(&ref) { } - T *operator->() { return ptr; } - operator T&() { return *ptr; } - private: - T *ptr; -}; -#endif - - -#if PY_MAJOR_VERSION >= 3 - #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 - -#ifndef __PYX_EXTERN_C - #ifdef __cplusplus - #define __PYX_EXTERN_C extern "C" - #else - #define __PYX_EXTERN_C extern - #endif -#endif - -#if defined(WIN32) || defined(MS_WINDOWS) -#define _USE_MATH_DEFINES -#endif -#include -#define __PYX_HAVE__owl__libowl -#define __PYX_HAVE_API__owl__libowl -#include "string.h" -#include "stdlib.h" -#include -#include "ios" -#include "new" -#include "stdexcept" -#include "typeinfo" -#include "stdio.h" -#include "numpy/arrayobject.h" -#include "numpy/ufuncobject.h" -#include "stdint.h" -#include "./minerva_utils.h" -#include "../minerva/minerva.h" -#ifdef _OPENMP -#include -#endif /* _OPENMP */ - -#ifdef PYREX_WITHOUT_ASSERTIONS -#define CYTHON_WITHOUT_ASSERTIONS -#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_NCP_UNUSED -# if CYTHON_COMPILING_IN_CPYTHON -# define CYTHON_NCP_UNUSED -# else -# define CYTHON_NCP_UNUSED CYTHON_UNUSED -# endif -#endif -typedef struct {PyObject **p; 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_fits_Py_ssize_t(v, type, is_signed) ( \ - (sizeof(type) < sizeof(Py_ssize_t)) || \ - (sizeof(type) > sizeof(Py_ssize_t) && \ - likely(v < (type)PY_SSIZE_T_MAX || \ - v == (type)PY_SSIZE_T_MAX) && \ - (!is_signed || likely(v > (type)PY_SSIZE_T_MIN || \ - v == (type)PY_SSIZE_T_MIN))) || \ - (sizeof(type) == sizeof(Py_ssize_t) && \ - (is_signed || likely(v < (type)PY_SSIZE_T_MAX || \ - v == (type)PY_SSIZE_T_MAX))) ) -static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*); -static CYTHON_INLINE 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_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsUString(s) ((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) -#if PY_MAJOR_VERSION < 3 -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); -} -#else -#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen -#endif -#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_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) -#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) -static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); -static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); -static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); -static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); -#if CYTHON_COMPILING_IN_CPYTHON -#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 && __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 PyObject *__pyx_m; -static PyObject *__pyx_d; -static PyObject *__pyx_b; -static PyObject *__pyx_empty_tuple; -static PyObject *__pyx_empty_bytes; -static int __pyx_lineno; -static int __pyx_clineno = 0; -static const char * __pyx_cfilenm= __FILE__; -static const char *__pyx_filename; - -#if !defined(CYTHON_CCOMPLEX) - #if defined(__cplusplus) - #define CYTHON_CCOMPLEX 1 - #elif defined(_Complex_I) - #define CYTHON_CCOMPLEX 1 - #else - #define CYTHON_CCOMPLEX 0 - #endif -#endif -#if CYTHON_CCOMPLEX - #ifdef __cplusplus - #include - #else - #include - #endif -#endif -#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) - #undef _Complex_I - #define _Complex_I 1.0fj -#endif - - -static const char *__pyx_f[] = { - "owl/owl/libowl.pyx", - "__init__.pxd", - "stringsource", - "type.pxd", -}; -#define IS_UNSIGNED(type) (((type) -1) > 0) -struct __Pyx_StructField_; -#define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0) -typedef struct { - const char* name; - struct __Pyx_StructField_* fields; - size_t size; - size_t arraysize[8]; - int ndim; - char typegroup; - char is_unsigned; - int flags; -} __Pyx_TypeInfo; -typedef struct __Pyx_StructField_ { - __Pyx_TypeInfo* type; - const char* name; - size_t offset; -} __Pyx_StructField; -typedef struct { - __Pyx_StructField* field; - size_t parent_offset; -} __Pyx_BufFmt_StackElem; -typedef struct { - __Pyx_StructField root; - __Pyx_BufFmt_StackElem* head; - size_t fmt_offset; - size_t new_count, enc_count; - size_t struct_alignment; - int is_complex; - char enc_type; - char new_packmode; - char enc_packmode; - char is_valid_array; -} __Pyx_BufFmt_Context; - - -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":726 - * # in Cython to enable them only on the right systems. - * - * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< - * ctypedef npy_int16 int16_t - * ctypedef npy_int32 int32_t - */ -typedef npy_int8 __pyx_t_5numpy_int8_t; - -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":727 - * - * ctypedef npy_int8 int8_t - * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< - * ctypedef npy_int32 int32_t - * ctypedef npy_int64 int64_t - */ -typedef npy_int16 __pyx_t_5numpy_int16_t; - -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":728 - * ctypedef npy_int8 int8_t - * ctypedef npy_int16 int16_t - * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< - * ctypedef npy_int64 int64_t - * #ctypedef npy_int96 int96_t - */ -typedef npy_int32 __pyx_t_5numpy_int32_t; - -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":729 - * ctypedef npy_int16 int16_t - * ctypedef npy_int32 int32_t - * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< - * #ctypedef npy_int96 int96_t - * #ctypedef npy_int128 int128_t - */ -typedef npy_int64 __pyx_t_5numpy_int64_t; - -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":733 - * #ctypedef npy_int128 int128_t - * - * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< - * ctypedef npy_uint16 uint16_t - * ctypedef npy_uint32 uint32_t - */ -typedef npy_uint8 __pyx_t_5numpy_uint8_t; - -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":734 - * - * ctypedef npy_uint8 uint8_t - * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< - * ctypedef npy_uint32 uint32_t - * ctypedef npy_uint64 uint64_t - */ -typedef npy_uint16 __pyx_t_5numpy_uint16_t; - -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":735 - * ctypedef npy_uint8 uint8_t - * ctypedef npy_uint16 uint16_t - * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< - * ctypedef npy_uint64 uint64_t - * #ctypedef npy_uint96 uint96_t - */ -typedef npy_uint32 __pyx_t_5numpy_uint32_t; - -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":736 - * ctypedef npy_uint16 uint16_t - * ctypedef npy_uint32 uint32_t - * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< - * #ctypedef npy_uint96 uint96_t - * #ctypedef npy_uint128 uint128_t - */ -typedef npy_uint64 __pyx_t_5numpy_uint64_t; - -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":740 - * #ctypedef npy_uint128 uint128_t - * - * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< - * ctypedef npy_float64 float64_t - * #ctypedef npy_float80 float80_t - */ -typedef npy_float32 __pyx_t_5numpy_float32_t; - -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":741 - * - * ctypedef npy_float32 float32_t - * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< - * #ctypedef npy_float80 float80_t - * #ctypedef npy_float128 float128_t - */ -typedef npy_float64 __pyx_t_5numpy_float64_t; - -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":750 - * # The int types are mapped a bit surprising -- - * # numpy.int corresponds to 'l' and numpy.long to 'q' - * ctypedef npy_long int_t # <<<<<<<<<<<<<< - * ctypedef npy_longlong long_t - * ctypedef npy_longlong longlong_t - */ -typedef npy_long __pyx_t_5numpy_int_t; - -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":751 - * # numpy.int corresponds to 'l' and numpy.long to 'q' - * ctypedef npy_long int_t - * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< - * ctypedef npy_longlong longlong_t - * - */ -typedef npy_longlong __pyx_t_5numpy_long_t; - -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":752 - * ctypedef npy_long int_t - * ctypedef npy_longlong long_t - * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< - * - * ctypedef npy_ulong uint_t - */ -typedef npy_longlong __pyx_t_5numpy_longlong_t; - -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":754 - * ctypedef npy_longlong longlong_t - * - * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< - * ctypedef npy_ulonglong ulong_t - * ctypedef npy_ulonglong ulonglong_t - */ -typedef npy_ulong __pyx_t_5numpy_uint_t; - -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":755 - * - * ctypedef npy_ulong uint_t - * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< - * ctypedef npy_ulonglong ulonglong_t - * - */ -typedef npy_ulonglong __pyx_t_5numpy_ulong_t; - -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":756 - * ctypedef npy_ulong uint_t - * ctypedef npy_ulonglong ulong_t - * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< - * - * ctypedef npy_intp intp_t - */ -typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; - -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":758 - * ctypedef npy_ulonglong ulonglong_t - * - * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< - * ctypedef npy_uintp uintp_t - * - */ -typedef npy_intp __pyx_t_5numpy_intp_t; - -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":759 - * - * ctypedef npy_intp intp_t - * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< - * - * ctypedef npy_double float_t - */ -typedef npy_uintp __pyx_t_5numpy_uintp_t; - -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":761 - * ctypedef npy_uintp uintp_t - * - * ctypedef npy_double float_t # <<<<<<<<<<<<<< - * ctypedef npy_double double_t - * ctypedef npy_longdouble longdouble_t - */ -typedef npy_double __pyx_t_5numpy_float_t; - -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":762 - * - * ctypedef npy_double float_t - * ctypedef npy_double double_t # <<<<<<<<<<<<<< - * ctypedef npy_longdouble longdouble_t - * - */ -typedef npy_double __pyx_t_5numpy_double_t; - -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":763 - * ctypedef npy_double float_t - * ctypedef npy_double double_t - * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< - * - * ctypedef npy_cfloat cfloat_t - */ -typedef npy_longdouble __pyx_t_5numpy_longdouble_t; -#if CYTHON_CCOMPLEX - #ifdef __cplusplus - typedef ::std::complex< float > __pyx_t_float_complex; - #else - typedef float _Complex __pyx_t_float_complex; - #endif -#else - typedef struct { float real, imag; } __pyx_t_float_complex; -#endif - -#if CYTHON_CCOMPLEX - #ifdef __cplusplus - typedef ::std::complex< double > __pyx_t_double_complex; - #else - typedef double _Complex __pyx_t_double_complex; - #endif -#else - typedef struct { double real, imag; } __pyx_t_double_complex; -#endif - - -/*--- Type declarations ---*/ -struct __pyx_obj_3owl_6libowl_NArray; -struct __pyx_obj_3owl_6libowl_PoolingAlgorithmWrapper; -struct __pyx_obj_3owl_6libowl_SoftmaxAlgorithmWrapper; -struct __pyx_obj_3owl_6libowl_ActivationAlgorithmWrapper; -struct __pyx_obj_3owl_6libowl_ConvInfo; -struct __pyx_obj_3owl_6libowl_PoolingInfo; - -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":765 - * ctypedef npy_longdouble longdouble_t - * - * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< - * ctypedef npy_cdouble cdouble_t - * ctypedef npy_clongdouble clongdouble_t - */ -typedef npy_cfloat __pyx_t_5numpy_cfloat_t; - -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":766 - * - * ctypedef npy_cfloat cfloat_t - * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< - * ctypedef npy_clongdouble clongdouble_t - * - */ -typedef npy_cdouble __pyx_t_5numpy_cdouble_t; - -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":767 - * ctypedef npy_cfloat cfloat_t - * ctypedef npy_cdouble cdouble_t - * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< - * - * ctypedef npy_cdouble complex_t - */ -typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; - -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":769 - * ctypedef npy_clongdouble clongdouble_t - * - * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< - * - * cdef inline object PyArray_MultiIterNew1(a): - */ -typedef npy_cdouble __pyx_t_5numpy_complex_t; - -/* "owl/libowl.pyx":51 - * return m.has_cuda_ - * - * cdef class NArray(object): # <<<<<<<<<<<<<< - * cdef m.NArray* _d - * - */ -struct __pyx_obj_3owl_6libowl_NArray { - PyObject_HEAD - minerva::NArray *_d; -}; - - -/* "owl/libowl.pyx":446 - * return dest.reshape(tuple(reversed(self.shape))) - * - * cdef class PoolingAlgorithmWrapper(object): # <<<<<<<<<<<<<< - * cdef int _d - * - */ -struct __pyx_obj_3owl_6libowl_PoolingAlgorithmWrapper { - PyObject_HEAD - int _d; -}; - - -/* "owl/libowl.pyx":480 - * pooling_algo = _PoolingAlgorithms() - * - * cdef class SoftmaxAlgorithmWrapper(object): # <<<<<<<<<<<<<< - * cdef int _d - * - */ -struct __pyx_obj_3owl_6libowl_SoftmaxAlgorithmWrapper { - PyObject_HEAD - int _d; -}; - - -/* "owl/libowl.pyx":514 - * softmax_algo = _SoftmaxAlgorithms() - * - * cdef class ActivationAlgorithmWrapper(object): # <<<<<<<<<<<<<< - * cdef int _d - * - */ -struct __pyx_obj_3owl_6libowl_ActivationAlgorithmWrapper { - PyObject_HEAD - int _d; -}; - - -/* "owl/libowl.pyx":556 - * activation_algo = _ActivationAlgorithms() - * - * cdef class ConvInfo(object): # <<<<<<<<<<<<<< - * cdef m.ConvInfo* _d - * - */ -struct __pyx_obj_3owl_6libowl_ConvInfo { - PyObject_HEAD - minerva::ConvInfo *_d; -}; - - -/* "owl/libowl.pyx":598 - * return self._d.stride_horizontal - * - * cdef class PoolingInfo(object): # <<<<<<<<<<<<<< - * cdef m.PoolingInfo* _d - * - */ -struct __pyx_obj_3owl_6libowl_PoolingInfo { - PyObject_HEAD - minerva::PoolingInfo *_d; -}; - - -/* --- Runtime support code (head) --- */ -#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) - -#if CYTHON_COMPILING_IN_CPYTHON -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); -} -#else -#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) -#endif - -static PyObject *__Pyx_GetBuiltinName(PyObject *name); - -static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); -static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); - -static void __Pyx_WriteUnraisable(const char *name, int clineno, - int lineno, const char *filename, - int full_traceback, int nogil); - -#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 - -static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); - -#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 CYTHON_INLINE 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); - -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); - -static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed); - -static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); - -static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); - -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \ - PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \ - const char* function_name); - -static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, - const char *name, int exact); - -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); -#endif - -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); - -#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 - -static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, - __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); -static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); - -#define __Pyx_BufPtrCContig1d(type, buf, i0, s0) ((type)buf + i0) -static void __Pyx_RaiseBufferFallbackError(void); - -static void __Pyx_RaiseBufferIndexError(int axis); - -#if CYTHON_COMPILING_IN_CPYTHON -#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) { - 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); -} -#else -#define __Pyx_PyObject_DelAttrStr(o,n) PyObject_DelAttr(o,n) -#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v) -#endif - -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); - -#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY -static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { - PyObject *value; - value = PyDict_GetItemWithError(d, key); - if (unlikely(!value)) { - if (!PyErr_Occurred()) { - PyObject* args = PyTuple_Pack(1, key); - if (likely(args)) - PyErr_SetObject(PyExc_KeyError, args); - Py_XDECREF(args); - } - return NULL; - } - Py_INCREF(value); - return value; -} -#else - #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key) -#endif - -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); - -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); - -static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); - -#if CYTHON_COMPILING_IN_CPYTHON -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 - -static PyObject *__Pyx_GetNameInClass(PyObject *nmspace, PyObject *name); - -static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases); - -static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type); - -#define __Pyx_CyFunction_USED 1 -#include -#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); - -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); - -typedef struct { - int code_line; - PyCodeObject* code_object; -} __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); - -static void __Pyx_AddTraceback(const char *funcname, int c_line, - int py_line, const char *filename); - -typedef struct { - Py_ssize_t shape, strides, suboffsets; -} __Pyx_Buf_DimInfo; -typedef struct { - size_t refcount; - Py_buffer pybuffer; -} __Pyx_Buffer; -typedef struct { - __Pyx_Buffer *rcbuffer; - char *data; - __Pyx_Buf_DimInfo diminfo[8]; -} __Pyx_LocalBuf_ND; - -#if PY_MAJOR_VERSION < 3 - static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags); - static void __Pyx_ReleaseBuffer(Py_buffer *view); -#else - #define __Pyx_GetBuffer PyObject_GetBuffer - #define __Pyx_ReleaseBuffer PyBuffer_Release -#endif - - -static Py_ssize_t __Pyx_zeros[] = {0, 0, 0, 0, 0, 0, 0, 0}; -static Py_ssize_t __Pyx_minusones[] = {-1, -1, -1, -1, -1, -1, -1, -1}; - -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); - -static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); - -#ifndef __Pyx_CppExn2PyErr -#include -#include -#include -#include -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::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 - -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint64_t(uint64_t value); - -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); - -static CYTHON_INLINE uint64_t __Pyx_PyInt_As_uint64_t(PyObject *); - -#if CYTHON_CCOMPLEX - #ifdef __cplusplus - #define __Pyx_CREAL(z) ((z).real()) - #define __Pyx_CIMAG(z) ((z).imag()) - #else - #define __Pyx_CREAL(z) (__real__(z)) - #define __Pyx_CIMAG(z) (__imag__(z)) - #endif -#else - #define __Pyx_CREAL(z) ((z).real) - #define __Pyx_CIMAG(z) ((z).imag) -#endif -#if (defined(_WIN32) || defined(__clang__)) && defined(__cplusplus) && CYTHON_CCOMPLEX - #define __Pyx_SET_CREAL(z,x) ((z).real(x)) - #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) -#else - #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) - #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) -#endif - -static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); - -#if CYTHON_CCOMPLEX - #define __Pyx_c_eqf(a, b) ((a)==(b)) - #define __Pyx_c_sumf(a, b) ((a)+(b)) - #define __Pyx_c_difff(a, b) ((a)-(b)) - #define __Pyx_c_prodf(a, b) ((a)*(b)) - #define __Pyx_c_quotf(a, b) ((a)/(b)) - #define __Pyx_c_negf(a) (-(a)) - #ifdef __cplusplus - #define __Pyx_c_is_zerof(z) ((z)==(float)0) - #define __Pyx_c_conjf(z) (::std::conj(z)) - #if 1 - #define __Pyx_c_absf(z) (::std::abs(z)) - #define __Pyx_c_powf(a, b) (::std::pow(a, b)) - #endif - #else - #define __Pyx_c_is_zerof(z) ((z)==0) - #define __Pyx_c_conjf(z) (conjf(z)) - #if 1 - #define __Pyx_c_absf(z) (cabsf(z)) - #define __Pyx_c_powf(a, b) (cpowf(a, b)) - #endif - #endif -#else - static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex); - static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex); - #if 1 - static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex, __pyx_t_float_complex); - #endif -#endif - -static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); - -#if CYTHON_CCOMPLEX - #define __Pyx_c_eq(a, b) ((a)==(b)) - #define __Pyx_c_sum(a, b) ((a)+(b)) - #define __Pyx_c_diff(a, b) ((a)-(b)) - #define __Pyx_c_prod(a, b) ((a)*(b)) - #define __Pyx_c_quot(a, b) ((a)/(b)) - #define __Pyx_c_neg(a) (-(a)) - #ifdef __cplusplus - #define __Pyx_c_is_zero(z) ((z)==(double)0) - #define __Pyx_c_conj(z) (::std::conj(z)) - #if 1 - #define __Pyx_c_abs(z) (::std::abs(z)) - #define __Pyx_c_pow(a, b) (::std::pow(a, b)) - #endif - #else - #define __Pyx_c_is_zero(z) ((z)==0) - #define __Pyx_c_conj(z) (conj(z)) - #if 1 - #define __Pyx_c_abs(z) (cabs(z)) - #define __Pyx_c_pow(a, b) (cpow(a, b)) - #endif - #endif -#else - static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); - static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); - #if 1 - static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex, __pyx_t_double_complex); - #endif -#endif - -static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *); - -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); - -static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); - -static int __Pyx_check_binary_version(void); - -#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 - -static PyObject *__Pyx_ImportModule(const char *name); - -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); - -static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); - - -/* Module declarations from 'cython' */ - -/* Module declarations from 'libc.string' */ - -/* Module declarations from 'libc.stdlib' */ - -/* Module declarations from 'libcpp.vector' */ - -/* Module declarations from 'cpython.buffer' */ - -/* Module declarations from 'cpython.ref' */ - -/* Module declarations from 'libc.stdio' */ - -/* Module declarations from 'cpython.object' */ - -/* Module declarations from '__builtin__' */ - -/* Module declarations from 'cpython.type' */ -static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; - -/* Module declarations from 'numpy' */ - -/* Module declarations from 'numpy' */ -static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; -static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; -static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; -static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; -static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; -static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ - -/* Module declarations from 'libc.stdint' */ - -/* Module declarations from 'libcpp' */ - -/* Module declarations from 'owl.minerva' */ - -/* Module declarations from 'owl.libowl' */ -static PyTypeObject *__pyx_ptype_3owl_6libowl_NArray = 0; -static PyTypeObject *__pyx_ptype_3owl_6libowl_PoolingAlgorithmWrapper = 0; -static PyTypeObject *__pyx_ptype_3owl_6libowl_SoftmaxAlgorithmWrapper = 0; -static PyTypeObject *__pyx_ptype_3owl_6libowl_ActivationAlgorithmWrapper = 0; -static PyTypeObject *__pyx_ptype_3owl_6libowl_ConvInfo = 0; -static PyTypeObject *__pyx_ptype_3owl_6libowl_PoolingInfo = 0; -static std::vector __pyx_f_3owl_6libowl__list_to_vector(PyObject *); /*proto*/ -static struct __pyx_obj_3owl_6libowl_NArray *__pyx_f_3owl_6libowl__wrap_cpp_narray(minerva::NArray); /*proto*/ -static PyObject *__pyx_convert_vector_to_py_int(const std::vector &); /*proto*/ -static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t = { "float32_t", NULL, sizeof(__pyx_t_5numpy_float32_t), { 0 }, 0, 'R', 0, 0 }; -#define __Pyx_MODULE_NAME "owl.libowl" -int __pyx_module_is_main_owl__libowl = 0; - -/* Implementation of 'owl.libowl' */ -static PyObject *__pyx_builtin_staticmethod; -static PyObject *__pyx_builtin_object; -static PyObject *__pyx_builtin_property; -static PyObject *__pyx_builtin_range; -static PyObject *__pyx_builtin_reversed; -static PyObject *__pyx_builtin_TypeError; -static PyObject *__pyx_builtin_ValueError; -static PyObject *__pyx_builtin_RuntimeError; -static PyObject *__pyx_pf_3owl_6libowl_create_cpu_device(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_2create_gpu_device(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_i); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_4get_gpu_device_count(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_6wait_for_all(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_8set_device(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_i); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_10initialize(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_12has_cuda(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ -static int __pyx_pf_3owl_6libowl_6NArray___cinit__(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_self); /* proto */ -static void __pyx_pf_3owl_6libowl_6NArray_2__dealloc__(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_6NArray_4__add__(PyObject *__pyx_v_self, PyObject *__pyx_v_rhs); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_6NArray_6__iadd__(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_self, PyObject *__pyx_v_rhs); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_6NArray_8__sub__(PyObject *__pyx_v_self, PyObject *__pyx_v_rhs); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_6NArray_10__isub__(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_self, PyObject *__pyx_v_rhs); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_6NArray_12__mul__(PyObject *__pyx_v_self, PyObject *__pyx_v_rhs); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_6NArray_14__imul__(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_self, PyObject *__pyx_v_rhs); /* proto */ -#if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY -static PyObject *__pyx_pf_3owl_6libowl_6NArray_16__div__(PyObject *__pyx_v_self, PyObject *__pyx_v_rhs); /* proto */ -#endif -#if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY -static PyObject *__pyx_pf_3owl_6libowl_6NArray_18__idiv__(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_self, PyObject *__pyx_v_rhs); /* proto */ -#endif -static PyObject *__pyx_pf_3owl_6libowl_6NArray_20mult(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_lhs, struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_rhs); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_6NArray_22exp(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_lhs); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_6NArray_24ln(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_lhs); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_6NArray_26sigm(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_lhs); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_6NArray_28sigm_back(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_diff, struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_top, struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_bottom); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_6NArray_30relu(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_lhs); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_6NArray_32relu_back(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_diff, struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_top, struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_bottom); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_6NArray_34tanh(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_lhs); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_6NArray_36tanh_back(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_diff, struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_top, struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_bottom); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_6NArray_38conv_forward(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_src, struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_filter, struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_bias, struct __pyx_obj_3owl_6libowl_ConvInfo *__pyx_v_info); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_6NArray_40conv_backward_data(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_diff, struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_bottom, struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_filter, struct __pyx_obj_3owl_6libowl_ConvInfo *__pyx_v_info); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_6NArray_42conv_backward_filter(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_diff, struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_bottom, struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_filter, struct __pyx_obj_3owl_6libowl_ConvInfo *__pyx_v_info); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_6NArray_44conv_backward_bias(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_diff); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_6NArray_46softmax_forward(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_src, struct __pyx_obj_3owl_6libowl_SoftmaxAlgorithmWrapper *__pyx_v_algo); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_6NArray_48softmax_backward(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_diff, struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_top, struct __pyx_obj_3owl_6libowl_SoftmaxAlgorithmWrapper *__pyx_v_algo); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_6NArray_50activation_forward(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_src, struct __pyx_obj_3owl_6libowl_ActivationAlgorithmWrapper *__pyx_v_algo); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_6NArray_52activation_backward(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_diff, struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_top, struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_bottom, struct __pyx_obj_3owl_6libowl_ActivationAlgorithmWrapper *__pyx_v_algo); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_6NArray_54pooling_forward(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_src, struct __pyx_obj_3owl_6libowl_PoolingInfo *__pyx_v_algo); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_6NArray_56pooling_backward(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_diff, struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_top, struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_bottom, struct __pyx_obj_3owl_6libowl_PoolingInfo *__pyx_v_algo); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_6NArray_58lrn_forward(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_src, struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_scale, int __pyx_v_local_size, float __pyx_v_a, float __pyx_v_b); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_6NArray_60lrn_backward(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_bottom_data, struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_top_data, struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_scale, struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_top_diff, int __pyx_v_local_size, float __pyx_v_a, float __pyx_v_b); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_6NArray_62sum(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_self, PyObject *__pyx_v_rhs); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_6NArray_64max(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_self, PyObject *__pyx_v_rhs); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_6NArray_66max_index(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_self, int __pyx_v_rhs); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_6NArray_68count_zero(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_6NArray_70trans(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_6NArray_72reshape(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_self, PyObject *__pyx_v_s); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_6NArray_74wait_for_eval(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_6NArray_5shape___get__(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_6NArray_76zeros(PyObject *__pyx_v_s); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_6NArray_78ones(PyObject *__pyx_v_s); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_6NArray_80randn(PyObject *__pyx_v_s, float __pyx_v_mean, float __pyx_v_var); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_6NArray_82randb(PyObject *__pyx_v_s, float __pyx_v_p); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_6NArray_84concat(PyObject *__pyx_v_arrays, int __pyx_v_dim); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_6NArray_86slice(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_n, int __pyx_v_slice_dim, int __pyx_v_st_off, int __pyx_v_slice_count); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_6NArray_88from_numpy(PyArrayObject *__pyx_v_n); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_6NArray_90_from_numpy(PyArrayObject *__pyx_v_n, PyObject *__pyx_v_s); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_6NArray_92to_numpy(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_self); /* proto */ -static int __pyx_pf_3owl_6libowl_23PoolingAlgorithmWrapper___cinit__(struct __pyx_obj_3owl_6libowl_PoolingAlgorithmWrapper *__pyx_v_self, int __pyx_v_d); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_23PoolingAlgorithmWrapper_2is_same(struct __pyx_obj_3owl_6libowl_PoolingAlgorithmWrapper *__pyx_v_self, struct __pyx_obj_3owl_6libowl_PoolingAlgorithmWrapper *__pyx_v_rhs); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_18_PoolingAlgorithms___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_18_PoolingAlgorithms_2find(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_a); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_18_PoolingAlgorithms_4max(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_18_PoolingAlgorithms_6average(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static int __pyx_pf_3owl_6libowl_23SoftmaxAlgorithmWrapper___cinit__(struct __pyx_obj_3owl_6libowl_SoftmaxAlgorithmWrapper *__pyx_v_self, int __pyx_v_d); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_23SoftmaxAlgorithmWrapper_2is_same(struct __pyx_obj_3owl_6libowl_SoftmaxAlgorithmWrapper *__pyx_v_self, struct __pyx_obj_3owl_6libowl_SoftmaxAlgorithmWrapper *__pyx_v_rhs); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_18_SoftmaxAlgorithms___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_18_SoftmaxAlgorithms_2find(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_a); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_18_SoftmaxAlgorithms_4instance(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_18_SoftmaxAlgorithms_6channel(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static int __pyx_pf_3owl_6libowl_26ActivationAlgorithmWrapper___cinit__(struct __pyx_obj_3owl_6libowl_ActivationAlgorithmWrapper *__pyx_v_self, int __pyx_v_d); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_26ActivationAlgorithmWrapper_2is_same(struct __pyx_obj_3owl_6libowl_ActivationAlgorithmWrapper *__pyx_v_self, struct __pyx_obj_3owl_6libowl_ActivationAlgorithmWrapper *__pyx_v_rhs); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_21_ActivationAlgorithms___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_21_ActivationAlgorithms_2find(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_a); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_21_ActivationAlgorithms_4sigmoid(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_21_ActivationAlgorithms_6relu(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_21_ActivationAlgorithms_8tanh(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static int __pyx_pf_3owl_6libowl_8ConvInfo___cinit__(struct __pyx_obj_3owl_6libowl_ConvInfo *__pyx_v_self, int __pyx_v_ph, int __pyx_v_pw, int __pyx_v_sv, int __pyx_v_sh); /* proto */ -static void __pyx_pf_3owl_6libowl_8ConvInfo_2__dealloc__(struct __pyx_obj_3owl_6libowl_ConvInfo *__pyx_v_self); /* proto */ -static int __pyx_pf_3owl_6libowl_8ConvInfo_10pad_height___set__(struct __pyx_obj_3owl_6libowl_ConvInfo *__pyx_v_self, PyObject *__pyx_v_ph); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_8ConvInfo_10pad_height_2__get__(struct __pyx_obj_3owl_6libowl_ConvInfo *__pyx_v_self); /* proto */ -static int __pyx_pf_3owl_6libowl_8ConvInfo_9pad_width___set__(struct __pyx_obj_3owl_6libowl_ConvInfo *__pyx_v_self, PyObject *__pyx_v_pw); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_8ConvInfo_9pad_width_2__get__(struct __pyx_obj_3owl_6libowl_ConvInfo *__pyx_v_self); /* proto */ -static int __pyx_pf_3owl_6libowl_8ConvInfo_15stride_vertical___set__(struct __pyx_obj_3owl_6libowl_ConvInfo *__pyx_v_self, PyObject *__pyx_v_sv); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_8ConvInfo_15stride_vertical_2__get__(struct __pyx_obj_3owl_6libowl_ConvInfo *__pyx_v_self); /* proto */ -static int __pyx_pf_3owl_6libowl_8ConvInfo_17stride_horizontal___set__(struct __pyx_obj_3owl_6libowl_ConvInfo *__pyx_v_self, PyObject *__pyx_v_sh); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_8ConvInfo_17stride_horizontal_2__get__(struct __pyx_obj_3owl_6libowl_ConvInfo *__pyx_v_self); /* proto */ -static int __pyx_pf_3owl_6libowl_11PoolingInfo___cinit__(struct __pyx_obj_3owl_6libowl_PoolingInfo *__pyx_v_self, struct __pyx_obj_3owl_6libowl_PoolingAlgorithmWrapper *__pyx_v_a, int __pyx_v_h, int __pyx_v_w, int __pyx_v_sv, int __pyx_v_sh, int __pyx_v_ph, int __pyx_v_pw); /* proto */ -static void __pyx_pf_3owl_6libowl_11PoolingInfo_2__dealloc__(struct __pyx_obj_3owl_6libowl_PoolingInfo *__pyx_v_self); /* proto */ -static int __pyx_pf_3owl_6libowl_11PoolingInfo_9algorithm___set__(struct __pyx_obj_3owl_6libowl_PoolingInfo *__pyx_v_self, struct __pyx_obj_3owl_6libowl_PoolingAlgorithmWrapper *__pyx_v_a); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_11PoolingInfo_9algorithm_2__get__(struct __pyx_obj_3owl_6libowl_PoolingInfo *__pyx_v_self); /* proto */ -static int __pyx_pf_3owl_6libowl_11PoolingInfo_6height___set__(struct __pyx_obj_3owl_6libowl_PoolingInfo *__pyx_v_self, PyObject *__pyx_v_h); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_11PoolingInfo_6height_2__get__(struct __pyx_obj_3owl_6libowl_PoolingInfo *__pyx_v_self); /* proto */ -static int __pyx_pf_3owl_6libowl_11PoolingInfo_5width___set__(struct __pyx_obj_3owl_6libowl_PoolingInfo *__pyx_v_self, PyObject *__pyx_v_w); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_11PoolingInfo_5width_2__get__(struct __pyx_obj_3owl_6libowl_PoolingInfo *__pyx_v_self); /* proto */ -static int __pyx_pf_3owl_6libowl_11PoolingInfo_15stride_vertical___set__(struct __pyx_obj_3owl_6libowl_PoolingInfo *__pyx_v_self, PyObject *__pyx_v_sv); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_11PoolingInfo_15stride_vertical_2__get__(struct __pyx_obj_3owl_6libowl_PoolingInfo *__pyx_v_self); /* proto */ -static int __pyx_pf_3owl_6libowl_11PoolingInfo_17stride_horizontal___set__(struct __pyx_obj_3owl_6libowl_PoolingInfo *__pyx_v_self, PyObject *__pyx_v_sh); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_11PoolingInfo_17stride_horizontal_2__get__(struct __pyx_obj_3owl_6libowl_PoolingInfo *__pyx_v_self); /* proto */ -static int __pyx_pf_3owl_6libowl_11PoolingInfo_10pad_height___set__(struct __pyx_obj_3owl_6libowl_PoolingInfo *__pyx_v_self, PyObject *__pyx_v_ph); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_11PoolingInfo_10pad_height_2__get__(struct __pyx_obj_3owl_6libowl_PoolingInfo *__pyx_v_self); /* proto */ -static int __pyx_pf_3owl_6libowl_11PoolingInfo_9pad_width___set__(struct __pyx_obj_3owl_6libowl_PoolingInfo *__pyx_v_self, PyObject *__pyx_v_pw); /* proto */ -static PyObject *__pyx_pf_3owl_6libowl_11PoolingInfo_9pad_width_2__get__(struct __pyx_obj_3owl_6libowl_PoolingInfo *__pyx_v_self); /* proto */ -static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ -static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ -static PyObject *__pyx_tp_new_3owl_6libowl_NArray(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_3owl_6libowl_PoolingAlgorithmWrapper(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_3owl_6libowl_SoftmaxAlgorithmWrapper(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_3owl_6libowl_ActivationAlgorithmWrapper(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_3owl_6libowl_ConvInfo(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_3owl_6libowl_PoolingInfo(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static char __pyx_k_B[] = "B"; -static char __pyx_k_H[] = "H"; -static char __pyx_k_I[] = "I"; -static char __pyx_k_L[] = "L"; -static char __pyx_k_O[] = "O"; -static char __pyx_k_Q[] = "Q"; -static char __pyx_k_a[] = "a"; -static char __pyx_k_b[] = "b"; -static char __pyx_k_c[] = "c"; -static char __pyx_k_d[] = "d"; -static char __pyx_k_f[] = "f"; -static char __pyx_k_g[] = "g"; -static char __pyx_k_h[] = "h"; -static char __pyx_k_i[] = "i"; -static char __pyx_k_l[] = "l"; -static char __pyx_k_n[] = "n"; -static char __pyx_k_p[] = "p"; -static char __pyx_k_q[] = "q"; -static char __pyx_k_s[] = "s"; -static char __pyx_k_v[] = "v"; -static char __pyx_k_w[] = "w"; -static char __pyx_k_Zd[] = "Zd"; -static char __pyx_k_Zf[] = "Zf"; -static char __pyx_k_Zg[] = "Zg"; -static char __pyx_k_ln[] = "ln"; -static char __pyx_k_np[] = "np"; -static char __pyx_k_ph[] = "ph"; -static char __pyx_k_pw[] = "pw"; -static char __pyx_k_sh[] = "sh"; -static char __pyx_k_sv[] = "sv"; -static char __pyx_k_dim[] = "dim"; -static char __pyx_k_doc[] = "__doc__"; -static char __pyx_k_exp[] = "exp"; -static char __pyx_k_lhs[] = "lhs"; -static char __pyx_k_max[] = "_max"; -static char __pyx_k_rhs[] = "rhs"; -static char __pyx_k_src[] = "src"; -static char __pyx_k_sys[] = "sys"; -static char __pyx_k_top[] = "top"; -static char __pyx_k_var[] = "var"; -static char __pyx_k_algo[] = "algo"; -static char __pyx_k_argc[] = "argc"; -static char __pyx_k_argv[] = "argv"; -static char __pyx_k_bias[] = "bias"; -static char __pyx_k_diff[] = "diff"; -static char __pyx_k_find[] = "find"; -static char __pyx_k_info[] = "info"; -static char __pyx_k_init[] = "__init__"; -static char __pyx_k_main[] = "__main__"; -static char __pyx_k_mean[] = "mean"; -static char __pyx_k_mult[] = "mult"; -static char __pyx_k_ones[] = "ones"; -static char __pyx_k_relu[] = "_relu"; -static char __pyx_k_self[] = "self"; -static char __pyx_k_sigm[] = "sigm"; -static char __pyx_k_tanh[] = "_tanh"; -static char __pyx_k_test[] = "__test__"; -static char __pyx_k_dtype[] = "dtype"; -static char __pyx_k_empty[] = "empty"; -static char __pyx_k_max_2[] = "max"; -static char __pyx_k_numpy[] = "numpy"; -static char __pyx_k_order[] = "order"; -static char __pyx_k_randb[] = "randb"; -static char __pyx_k_randn[] = "randn"; -static char __pyx_k_range[] = "range"; -static char __pyx_k_scale[] = "scale"; -static char __pyx_k_shape[] = "shape"; -static char __pyx_k_slice[] = "slice"; -static char __pyx_k_zeros[] = "zeros"; -static char __pyx_k_arrays[] = "arrays"; -static char __pyx_k_astype[] = "astype"; -static char __pyx_k_bottom[] = "bottom"; -static char __pyx_k_concat[] = "concat"; -static char __pyx_k_filter[] = "filter"; -static char __pyx_k_import[] = "__import__"; -static char __pyx_k_module[] = "__module__"; -static char __pyx_k_object[] = "object"; -static char __pyx_k_relu_2[] = "relu"; -static char __pyx_k_st_off[] = "st_off"; -static char __pyx_k_tanh_2[] = "tanh"; -static char __pyx_k_average[] = "_average"; -static char __pyx_k_channel[] = "_channel"; -static char __pyx_k_flatten[] = "flatten"; -static char __pyx_k_float32[] = "float32"; -static char __pyx_k_is_same[] = "is_same"; -static char __pyx_k_prepare[] = "__prepare__"; -static char __pyx_k_reshape[] = "reshape"; -static char __pyx_k_sigmoid[] = "_sigmoid"; -static char __pyx_k_has_cuda[] = "has_cuda"; -static char __pyx_k_instance[] = "_instance"; -static char __pyx_k_property[] = "property"; -static char __pyx_k_qualname[] = "__qualname__"; -static char __pyx_k_reversed[] = "reversed"; -static char __pyx_k_top_data[] = "top_data"; -static char __pyx_k_top_diff[] = "top_diff"; -static char __pyx_k_TypeError[] = "TypeError"; -static char __pyx_k_average_2[] = "average"; -static char __pyx_k_channel_2[] = "channel"; -static char __pyx_k_metaclass[] = "__metaclass__"; -static char __pyx_k_relu_back[] = "relu_back"; -static char __pyx_k_sigm_back[] = "sigm_back"; -static char __pyx_k_sigmoid_2[] = "sigmoid"; -static char __pyx_k_slice_dim[] = "slice_dim"; -static char __pyx_k_tanh_back[] = "tanh_back"; -static char __pyx_k_ValueError[] = "ValueError"; -static char __pyx_k_from_numpy[] = "_from_numpy"; -static char __pyx_k_initialize[] = "initialize"; -static char __pyx_k_instance_2[] = "instance"; -static char __pyx_k_local_size[] = "local_size"; -static char __pyx_k_owl_libowl[] = "owl.libowl"; -static char __pyx_k_set_device[] = "set_device"; -static char __pyx_k_bottom_data[] = "bottom_data"; -static char __pyx_k_lrn_forward[] = "lrn_forward"; -static char __pyx_k_slice_count[] = "slice_count"; -static char __pyx_k_RuntimeError[] = "RuntimeError"; -static char __pyx_k_conv_forward[] = "conv_forward"; -static char __pyx_k_from_numpy_2[] = "from_numpy"; -static char __pyx_k_lrn_backward[] = "lrn_backward"; -static char __pyx_k_pooling_algo[] = "pooling_algo"; -static char __pyx_k_softmax_algo[] = "softmax_algo"; -static char __pyx_k_staticmethod[] = "staticmethod"; -static char __pyx_k_wait_for_all[] = "wait_for_all"; -static char __pyx_k_activation_algo[] = "activation_algo"; -static char __pyx_k_pooling_forward[] = "pooling_forward"; -static char __pyx_k_softmax_forward[] = "softmax_forward"; -static char __pyx_k_pooling_backward[] = "pooling_backward"; -static char __pyx_k_softmax_backward[] = "softmax_backward"; -static char __pyx_k_PoolingAlgorithms[] = "_PoolingAlgorithms"; -static char __pyx_k_SoftmaxAlgorithms[] = "_SoftmaxAlgorithms"; -static char __pyx_k_create_cpu_device[] = "create_cpu_device"; -static char __pyx_k_create_gpu_device[] = "create_gpu_device"; -static char __pyx_k_activation_forward[] = "activation_forward"; -static char __pyx_k_conv_backward_bias[] = "conv_backward_bias"; -static char __pyx_k_conv_backward_data[] = "conv_backward_data"; -static char __pyx_k_activation_backward[] = "activation_backward"; -static char __pyx_k_ActivationAlgorithms[] = "_ActivationAlgorithms"; -static char __pyx_k_conv_backward_filter[] = "conv_backward_filter"; -static char __pyx_k_get_gpu_device_count[] = "get_gpu_device_count"; -static char __pyx_k_PoolingAlgorithms_max[] = "_PoolingAlgorithms.max"; -static char __pyx_k_PoolingAlgorithms_find[] = "_PoolingAlgorithms.find"; -static char __pyx_k_SoftmaxAlgorithms_find[] = "_SoftmaxAlgorithms.find"; -static char __pyx_k_PoolingAlgorithms___init[] = "_PoolingAlgorithms.__init__"; -static char __pyx_k_SoftmaxAlgorithms___init[] = "_SoftmaxAlgorithms.__init__"; -static char __pyx_k_ActivationAlgorithms_find[] = "_ActivationAlgorithms.find"; -static char __pyx_k_ActivationAlgorithms_relu[] = "_ActivationAlgorithms.relu"; -static char __pyx_k_ActivationAlgorithms_tanh[] = "_ActivationAlgorithms.tanh"; -static char __pyx_k_PoolingAlgorithms_average[] = "_PoolingAlgorithms.average"; -static char __pyx_k_SoftmaxAlgorithms_channel[] = "_SoftmaxAlgorithms.channel"; -static char __pyx_k_invalid_pooling_algorithm[] = "invalid pooling algorithm"; -static char __pyx_k_invalid_softmax_algorithm[] = "invalid softmax algorithm"; -static char __pyx_k_SoftmaxAlgorithms_instance[] = "_SoftmaxAlgorithms.instance"; -static char __pyx_k_ActivationAlgorithms___init[] = "_ActivationAlgorithms.__init__"; -static char __pyx_k_ndarray_is_not_C_contiguous[] = "ndarray is not C contiguous"; -static char __pyx_k_ActivationAlgorithms_sigmoid[] = "_ActivationAlgorithms.sigmoid"; -static char __pyx_k_invalid_activation_algorithm[] = "invalid activation algorithm"; -static char __pyx_k_home_minjie_athena_athena_owl_o[] = "/home/minjie/athena/athena/owl/owl/libowl.pyx"; -static char __pyx_k_unknown_dtype_code_in_numpy_pxd[] = "unknown dtype code in numpy.pxd (%d)"; -static char __pyx_k_Format_string_allocated_too_shor[] = "Format string allocated too short, see comment in numpy.pxd"; -static char __pyx_k_Non_native_byte_order_not_suppor[] = "Non-native byte order not supported"; -static char __pyx_k_ndarray_is_not_Fortran_contiguou[] = "ndarray is not Fortran contiguous"; -static char __pyx_k_Format_string_allocated_too_shor_2[] = "Format string allocated too short."; -static PyObject *__pyx_n_s_ActivationAlgorithms; -static PyObject *__pyx_n_s_ActivationAlgorithms___init; -static PyObject *__pyx_n_s_ActivationAlgorithms_find; -static PyObject *__pyx_n_s_ActivationAlgorithms_relu; -static PyObject *__pyx_n_s_ActivationAlgorithms_sigmoid; -static PyObject *__pyx_n_s_ActivationAlgorithms_tanh; -static PyObject *__pyx_kp_u_Format_string_allocated_too_shor; -static PyObject *__pyx_kp_u_Format_string_allocated_too_shor_2; -static PyObject *__pyx_kp_u_Non_native_byte_order_not_suppor; -static PyObject *__pyx_n_s_PoolingAlgorithms; -static PyObject *__pyx_n_s_PoolingAlgorithms___init; -static PyObject *__pyx_n_s_PoolingAlgorithms_average; -static PyObject *__pyx_n_s_PoolingAlgorithms_find; -static PyObject *__pyx_n_s_PoolingAlgorithms_max; -static PyObject *__pyx_n_s_RuntimeError; -static PyObject *__pyx_n_s_SoftmaxAlgorithms; -static PyObject *__pyx_n_s_SoftmaxAlgorithms___init; -static PyObject *__pyx_n_s_SoftmaxAlgorithms_channel; -static PyObject *__pyx_n_s_SoftmaxAlgorithms_find; -static PyObject *__pyx_n_s_SoftmaxAlgorithms_instance; -static PyObject *__pyx_n_s_TypeError; -static PyObject *__pyx_n_s_ValueError; -static PyObject *__pyx_n_s_a; -static PyObject *__pyx_n_s_activation_algo; -static PyObject *__pyx_n_s_activation_backward; -static PyObject *__pyx_n_s_activation_forward; -static PyObject *__pyx_n_s_algo; -static PyObject *__pyx_n_s_argc; -static PyObject *__pyx_n_s_argv; -static PyObject *__pyx_n_s_arrays; -static PyObject *__pyx_n_s_astype; -static PyObject *__pyx_n_s_average; -static PyObject *__pyx_n_s_average_2; -static PyObject *__pyx_n_s_b; -static PyObject *__pyx_n_s_bias; -static PyObject *__pyx_n_s_bottom; -static PyObject *__pyx_n_s_bottom_data; -static PyObject *__pyx_n_s_c; -static PyObject *__pyx_n_s_channel; -static PyObject *__pyx_n_s_channel_2; -static PyObject *__pyx_n_s_concat; -static PyObject *__pyx_n_s_conv_backward_bias; -static PyObject *__pyx_n_s_conv_backward_data; -static PyObject *__pyx_n_s_conv_backward_filter; -static PyObject *__pyx_n_s_conv_forward; -static PyObject *__pyx_n_s_create_cpu_device; -static PyObject *__pyx_n_s_create_gpu_device; -static PyObject *__pyx_n_s_d; -static PyObject *__pyx_n_s_diff; -static PyObject *__pyx_n_s_dim; -static PyObject *__pyx_n_s_doc; -static PyObject *__pyx_n_s_dtype; -static PyObject *__pyx_n_s_empty; -static PyObject *__pyx_n_s_exp; -static PyObject *__pyx_n_s_filter; -static PyObject *__pyx_n_s_find; -static PyObject *__pyx_n_s_flatten; -static PyObject *__pyx_n_s_float32; -static PyObject *__pyx_n_s_from_numpy; -static PyObject *__pyx_n_s_from_numpy_2; -static PyObject *__pyx_n_s_get_gpu_device_count; -static PyObject *__pyx_n_s_h; -static PyObject *__pyx_n_s_has_cuda; -static PyObject *__pyx_kp_s_home_minjie_athena_athena_owl_o; -static PyObject *__pyx_n_s_i; -static PyObject *__pyx_n_s_import; -static PyObject *__pyx_n_s_info; -static PyObject *__pyx_n_s_init; -static PyObject *__pyx_n_s_initialize; -static PyObject *__pyx_n_s_instance; -static PyObject *__pyx_n_s_instance_2; -static PyObject *__pyx_kp_s_invalid_activation_algorithm; -static PyObject *__pyx_kp_s_invalid_pooling_algorithm; -static PyObject *__pyx_kp_s_invalid_softmax_algorithm; -static PyObject *__pyx_n_s_is_same; -static PyObject *__pyx_n_s_lhs; -static PyObject *__pyx_n_s_ln; -static PyObject *__pyx_n_s_local_size; -static PyObject *__pyx_n_s_lrn_backward; -static PyObject *__pyx_n_s_lrn_forward; -static PyObject *__pyx_n_s_main; -static PyObject *__pyx_n_s_max; -static PyObject *__pyx_n_s_max_2; -static PyObject *__pyx_n_s_mean; -static PyObject *__pyx_n_s_metaclass; -static PyObject *__pyx_n_s_module; -static PyObject *__pyx_n_s_mult; -static PyObject *__pyx_n_s_n; -static PyObject *__pyx_kp_u_ndarray_is_not_C_contiguous; -static PyObject *__pyx_kp_u_ndarray_is_not_Fortran_contiguou; -static PyObject *__pyx_n_s_np; -static PyObject *__pyx_n_s_numpy; -static PyObject *__pyx_n_s_object; -static PyObject *__pyx_n_s_ones; -static PyObject *__pyx_n_s_order; -static PyObject *__pyx_n_s_owl_libowl; -static PyObject *__pyx_n_s_p; -static PyObject *__pyx_n_s_ph; -static PyObject *__pyx_n_s_pooling_algo; -static PyObject *__pyx_n_s_pooling_backward; -static PyObject *__pyx_n_s_pooling_forward; -static PyObject *__pyx_n_s_prepare; -static PyObject *__pyx_n_s_property; -static PyObject *__pyx_n_s_pw; -static PyObject *__pyx_n_s_qualname; -static PyObject *__pyx_n_s_randb; -static PyObject *__pyx_n_s_randn; -static PyObject *__pyx_n_s_range; -static PyObject *__pyx_n_s_relu; -static PyObject *__pyx_n_s_relu_2; -static PyObject *__pyx_n_s_relu_back; -static PyObject *__pyx_n_s_reshape; -static PyObject *__pyx_n_s_reversed; -static PyObject *__pyx_n_s_rhs; -static PyObject *__pyx_n_s_s; -static PyObject *__pyx_n_s_scale; -static PyObject *__pyx_n_s_self; -static PyObject *__pyx_n_s_set_device; -static PyObject *__pyx_n_s_sh; -static PyObject *__pyx_n_s_shape; -static PyObject *__pyx_n_s_sigm; -static PyObject *__pyx_n_s_sigm_back; -static PyObject *__pyx_n_s_sigmoid; -static PyObject *__pyx_n_s_sigmoid_2; -static PyObject *__pyx_n_s_slice; -static PyObject *__pyx_n_s_slice_count; -static PyObject *__pyx_n_s_slice_dim; -static PyObject *__pyx_n_s_softmax_algo; -static PyObject *__pyx_n_s_softmax_backward; -static PyObject *__pyx_n_s_softmax_forward; -static PyObject *__pyx_n_s_src; -static PyObject *__pyx_n_s_st_off; -static PyObject *__pyx_n_s_staticmethod; -static PyObject *__pyx_n_s_sv; -static PyObject *__pyx_n_s_sys; -static PyObject *__pyx_n_s_tanh; -static PyObject *__pyx_n_s_tanh_2; -static PyObject *__pyx_n_s_tanh_back; -static PyObject *__pyx_n_s_test; -static PyObject *__pyx_n_s_top; -static PyObject *__pyx_n_s_top_data; -static PyObject *__pyx_n_s_top_diff; -static PyObject *__pyx_kp_u_unknown_dtype_code_in_numpy_pxd; -static PyObject *__pyx_n_s_v; -static PyObject *__pyx_n_s_var; -static PyObject *__pyx_n_s_w; -static PyObject *__pyx_n_s_wait_for_all; -static PyObject *__pyx_n_s_zeros; -static struct __pyx_obj_3owl_6libowl_PoolingAlgorithmWrapper *__pyx_k__4; -static PyObject *__pyx_tuple_; -static PyObject *__pyx_tuple__2; -static PyObject *__pyx_tuple__3; -static PyObject *__pyx_tuple__5; -static PyObject *__pyx_tuple__6; -static PyObject *__pyx_tuple__7; -static PyObject *__pyx_tuple__8; -static PyObject *__pyx_tuple__9; -static PyObject *__pyx_tuple__10; -static PyObject *__pyx_tuple__12; -static PyObject *__pyx_tuple__16; -static PyObject *__pyx_tuple__18; -static PyObject *__pyx_tuple__21; -static PyObject *__pyx_tuple__23; -static PyObject *__pyx_tuple__25; -static PyObject *__pyx_tuple__27; -static PyObject *__pyx_tuple__29; -static PyObject *__pyx_tuple__31; -static PyObject *__pyx_tuple__33; -static PyObject *__pyx_tuple__35; -static PyObject *__pyx_tuple__37; -static PyObject *__pyx_tuple__39; -static PyObject *__pyx_tuple__41; -static PyObject *__pyx_tuple__43; -static PyObject *__pyx_tuple__45; -static PyObject *__pyx_tuple__47; -static PyObject *__pyx_tuple__49; -static PyObject *__pyx_tuple__51; -static PyObject *__pyx_tuple__53; -static PyObject *__pyx_tuple__55; -static PyObject *__pyx_tuple__57; -static PyObject *__pyx_tuple__59; -static PyObject *__pyx_tuple__61; -static PyObject *__pyx_tuple__63; -static PyObject *__pyx_tuple__65; -static PyObject *__pyx_tuple__67; -static PyObject *__pyx_tuple__69; -static PyObject *__pyx_tuple__71; -static PyObject *__pyx_tuple__73; -static PyObject *__pyx_tuple__75; -static PyObject *__pyx_tuple__77; -static PyObject *__pyx_tuple__79; -static PyObject *__pyx_tuple__81; -static PyObject *__pyx_tuple__83; -static PyObject *__pyx_tuple__85; -static PyObject *__pyx_tuple__87; -static PyObject *__pyx_tuple__89; -static PyObject *__pyx_tuple__91; -static PyObject *__pyx_tuple__93; -static PyObject *__pyx_tuple__95; -static PyObject *__pyx_tuple__97; -static PyObject *__pyx_tuple__99; -static PyObject *__pyx_tuple__101; -static PyObject *__pyx_tuple__103; -static PyObject *__pyx_codeobj__11; -static PyObject *__pyx_codeobj__13; -static PyObject *__pyx_codeobj__14; -static PyObject *__pyx_codeobj__15; -static PyObject *__pyx_codeobj__17; -static PyObject *__pyx_codeobj__19; -static PyObject *__pyx_codeobj__20; -static PyObject *__pyx_codeobj__22; -static PyObject *__pyx_codeobj__24; -static PyObject *__pyx_codeobj__26; -static PyObject *__pyx_codeobj__28; -static PyObject *__pyx_codeobj__30; -static PyObject *__pyx_codeobj__32; -static PyObject *__pyx_codeobj__34; -static PyObject *__pyx_codeobj__36; -static PyObject *__pyx_codeobj__38; -static PyObject *__pyx_codeobj__40; -static PyObject *__pyx_codeobj__42; -static PyObject *__pyx_codeobj__44; -static PyObject *__pyx_codeobj__46; -static PyObject *__pyx_codeobj__48; -static PyObject *__pyx_codeobj__50; -static PyObject *__pyx_codeobj__52; -static PyObject *__pyx_codeobj__54; -static PyObject *__pyx_codeobj__56; -static PyObject *__pyx_codeobj__58; -static PyObject *__pyx_codeobj__60; -static PyObject *__pyx_codeobj__62; -static PyObject *__pyx_codeobj__64; -static PyObject *__pyx_codeobj__66; -static PyObject *__pyx_codeobj__68; -static PyObject *__pyx_codeobj__70; -static PyObject *__pyx_codeobj__72; -static PyObject *__pyx_codeobj__74; -static PyObject *__pyx_codeobj__76; -static PyObject *__pyx_codeobj__78; -static PyObject *__pyx_codeobj__80; -static PyObject *__pyx_codeobj__82; -static PyObject *__pyx_codeobj__84; -static PyObject *__pyx_codeobj__86; -static PyObject *__pyx_codeobj__88; -static PyObject *__pyx_codeobj__90; -static PyObject *__pyx_codeobj__92; -static PyObject *__pyx_codeobj__94; -static PyObject *__pyx_codeobj__96; -static PyObject *__pyx_codeobj__98; -static PyObject *__pyx_codeobj__100; -static PyObject *__pyx_codeobj__102; -static PyObject *__pyx_codeobj__104; - -/* "owl/libowl.pyx":11 - * cimport minerva as m - * - * cdef vector[int] _list_to_vector(l): # <<<<<<<<<<<<<< - * cdef vector[int] ret - * for i in l: - */ - -static std::vector __pyx_f_3owl_6libowl__list_to_vector(PyObject *__pyx_v_l) { - std::vector __pyx_v_ret; - PyObject *__pyx_v_i = NULL; - std::vector __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *(*__pyx_t_3)(PyObject *); - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_list_to_vector", 0); - - /* "owl/libowl.pyx":13 - * cdef vector[int] _list_to_vector(l): - * cdef vector[int] ret - * for i in l: # <<<<<<<<<<<<<< - * ret.push_back(i) - * return ret - */ - if (likely(PyList_CheckExact(__pyx_v_l)) || PyTuple_CheckExact(__pyx_v_l)) { - __pyx_t_1 = __pyx_v_l; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; - __pyx_t_3 = NULL; - } else { - __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_l); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - for (;;) { - if (likely(!__pyx_t_3)) { - if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - #endif - } else { - if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - #endif - } - } else { - __pyx_t_4 = __pyx_t_3(__pyx_t_1); - if (unlikely(!__pyx_t_4)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4); - __pyx_t_4 = 0; - - /* "owl/libowl.pyx":14 - * cdef vector[int] ret - * for i in l: - * ret.push_back(i) # <<<<<<<<<<<<<< - * return ret - * - */ - __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_i); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - try { - __pyx_v_ret.push_back(__pyx_t_5); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "owl/libowl.pyx":13 - * cdef vector[int] _list_to_vector(l): - * cdef vector[int] ret - * for i in l: # <<<<<<<<<<<<<< - * ret.push_back(i) - * return ret - */ - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "owl/libowl.pyx":15 - * for i in l: - * ret.push_back(i) - * return ret # <<<<<<<<<<<<<< - * - * cdef NArray _wrap_cpp_narray(m.NArray n): - */ - __pyx_r = __pyx_v_ret; - goto __pyx_L0; - - /* "owl/libowl.pyx":11 - * cimport minerva as m - * - * cdef vector[int] _list_to_vector(l): # <<<<<<<<<<<<<< - * cdef vector[int] ret - * for i in l: - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_WriteUnraisable("owl.libowl._list_to_vector", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0); - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_i); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":17 - * return ret - * - * cdef NArray _wrap_cpp_narray(m.NArray n): # <<<<<<<<<<<<<< - * ret = NArray() - * ret._d.assign(n) - */ - -static struct __pyx_obj_3owl_6libowl_NArray *__pyx_f_3owl_6libowl__wrap_cpp_narray(minerva::NArray __pyx_v_n) { - struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_ret = NULL; - struct __pyx_obj_3owl_6libowl_NArray *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_wrap_cpp_narray", 0); - - /* "owl/libowl.pyx":18 - * - * cdef NArray _wrap_cpp_narray(m.NArray n): - * ret = NArray() # <<<<<<<<<<<<<< - * ret._d.assign(n) - * return ret - */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3owl_6libowl_NArray)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_ret = ((struct __pyx_obj_3owl_6libowl_NArray *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "owl/libowl.pyx":19 - * cdef NArray _wrap_cpp_narray(m.NArray n): - * ret = NArray() - * ret._d.assign(n) # <<<<<<<<<<<<<< - * return ret - * - */ - try { - __pyx_v_ret->_d->operator=(__pyx_v_n); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "owl/libowl.pyx":20 - * ret = NArray() - * ret._d.assign(n) - * return ret # <<<<<<<<<<<<<< - * - * def create_cpu_device(): - */ - __Pyx_XDECREF(((PyObject *)__pyx_r)); - __Pyx_INCREF(((PyObject *)__pyx_v_ret)); - __pyx_r = __pyx_v_ret; - goto __pyx_L0; - - /* "owl/libowl.pyx":17 - * return ret - * - * cdef NArray _wrap_cpp_narray(m.NArray n): # <<<<<<<<<<<<<< - * ret = NArray() - * ret._d.assign(n) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("owl.libowl._wrap_cpp_narray", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_ret); - __Pyx_XGIVEREF((PyObject *)__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":22 - * return ret - * - * def create_cpu_device(): # <<<<<<<<<<<<<< - * return m.CreateCpuDevice() - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_1create_cpu_device(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyMethodDef __pyx_mdef_3owl_6libowl_1create_cpu_device = {"create_cpu_device", (PyCFunction)__pyx_pw_3owl_6libowl_1create_cpu_device, METH_NOARGS, 0}; -static PyObject *__pyx_pw_3owl_6libowl_1create_cpu_device(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("create_cpu_device (wrapper)", 0); - __pyx_r = __pyx_pf_3owl_6libowl_create_cpu_device(__pyx_self); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_create_cpu_device(CYTHON_UNUSED PyObject *__pyx_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - uint64_t __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("create_cpu_device", 0); - - /* "owl/libowl.pyx":23 - * - * def create_cpu_device(): - * return m.CreateCpuDevice() # <<<<<<<<<<<<<< - * - * def create_gpu_device(i): - */ - __Pyx_XDECREF(__pyx_r); - try { - __pyx_t_1 = libowl::CreateCpuDevice(); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_2 = __Pyx_PyInt_From_uint64_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":22 - * return ret - * - * def create_cpu_device(): # <<<<<<<<<<<<<< - * return m.CreateCpuDevice() - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("owl.libowl.create_cpu_device", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":25 - * return m.CreateCpuDevice() - * - * def create_gpu_device(i): # <<<<<<<<<<<<<< - * return m.CreateGpuDevice(i) - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_3create_gpu_device(PyObject *__pyx_self, PyObject *__pyx_v_i); /*proto*/ -static PyMethodDef __pyx_mdef_3owl_6libowl_3create_gpu_device = {"create_gpu_device", (PyCFunction)__pyx_pw_3owl_6libowl_3create_gpu_device, METH_O, 0}; -static PyObject *__pyx_pw_3owl_6libowl_3create_gpu_device(PyObject *__pyx_self, PyObject *__pyx_v_i) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("create_gpu_device (wrapper)", 0); - __pyx_r = __pyx_pf_3owl_6libowl_2create_gpu_device(__pyx_self, ((PyObject *)__pyx_v_i)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_2create_gpu_device(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_i) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - uint64_t __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("create_gpu_device", 0); - - /* "owl/libowl.pyx":26 - * - * def create_gpu_device(i): - * return m.CreateGpuDevice(i) # <<<<<<<<<<<<<< - * - * def get_gpu_device_count(): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_i); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - try { - __pyx_t_2 = libowl::CreateGpuDevice(__pyx_t_1); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_3 = __Pyx_PyInt_From_uint64_t(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":25 - * return m.CreateCpuDevice() - * - * def create_gpu_device(i): # <<<<<<<<<<<<<< - * return m.CreateGpuDevice(i) - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("owl.libowl.create_gpu_device", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":28 - * return m.CreateGpuDevice(i) - * - * def get_gpu_device_count(): # <<<<<<<<<<<<<< - * return m.GetGpuDeviceCount() - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_5get_gpu_device_count(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyMethodDef __pyx_mdef_3owl_6libowl_5get_gpu_device_count = {"get_gpu_device_count", (PyCFunction)__pyx_pw_3owl_6libowl_5get_gpu_device_count, METH_NOARGS, 0}; -static PyObject *__pyx_pw_3owl_6libowl_5get_gpu_device_count(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_gpu_device_count (wrapper)", 0); - __pyx_r = __pyx_pf_3owl_6libowl_4get_gpu_device_count(__pyx_self); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_4get_gpu_device_count(CYTHON_UNUSED PyObject *__pyx_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_gpu_device_count", 0); - - /* "owl/libowl.pyx":29 - * - * def get_gpu_device_count(): - * return m.GetGpuDeviceCount() # <<<<<<<<<<<<<< - * - * def wait_for_all(): - */ - __Pyx_XDECREF(__pyx_r); - try { - __pyx_t_1 = libowl::GetGpuDeviceCount(); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":28 - * return m.CreateGpuDevice(i) - * - * def get_gpu_device_count(): # <<<<<<<<<<<<<< - * return m.GetGpuDeviceCount() - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("owl.libowl.get_gpu_device_count", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":31 - * return m.GetGpuDeviceCount() - * - * def wait_for_all(): # <<<<<<<<<<<<<< - * m.WaitForAll() - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_7wait_for_all(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyMethodDef __pyx_mdef_3owl_6libowl_7wait_for_all = {"wait_for_all", (PyCFunction)__pyx_pw_3owl_6libowl_7wait_for_all, METH_NOARGS, 0}; -static PyObject *__pyx_pw_3owl_6libowl_7wait_for_all(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("wait_for_all (wrapper)", 0); - __pyx_r = __pyx_pf_3owl_6libowl_6wait_for_all(__pyx_self); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_6wait_for_all(CYTHON_UNUSED PyObject *__pyx_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("wait_for_all", 0); - - /* "owl/libowl.pyx":32 - * - * def wait_for_all(): - * m.WaitForAll() # <<<<<<<<<<<<<< - * - * def set_device(i): - */ - try { - libowl::WaitForAll(); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "owl/libowl.pyx":31 - * return m.GetGpuDeviceCount() - * - * def wait_for_all(): # <<<<<<<<<<<<<< - * m.WaitForAll() - * - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("owl.libowl.wait_for_all", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":34 - * m.WaitForAll() - * - * def set_device(i): # <<<<<<<<<<<<<< - * m.SetDevice(i) - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_9set_device(PyObject *__pyx_self, PyObject *__pyx_v_i); /*proto*/ -static PyMethodDef __pyx_mdef_3owl_6libowl_9set_device = {"set_device", (PyCFunction)__pyx_pw_3owl_6libowl_9set_device, METH_O, 0}; -static PyObject *__pyx_pw_3owl_6libowl_9set_device(PyObject *__pyx_self, PyObject *__pyx_v_i) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set_device (wrapper)", 0); - __pyx_r = __pyx_pf_3owl_6libowl_8set_device(__pyx_self, ((PyObject *)__pyx_v_i)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_8set_device(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_i) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - uint64_t __pyx_t_1; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("set_device", 0); - - /* "owl/libowl.pyx":35 - * - * def set_device(i): - * m.SetDevice(i) # <<<<<<<<<<<<<< - * - * def initialize(): - */ - __pyx_t_1 = __Pyx_PyInt_As_uint64_t(__pyx_v_i); if (unlikely((__pyx_t_1 == (uint64_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - try { - libowl::SetDevice(__pyx_t_1); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "owl/libowl.pyx":34 - * m.WaitForAll() - * - * def set_device(i): # <<<<<<<<<<<<<< - * m.SetDevice(i) - * - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("owl.libowl.set_device", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":37 - * m.SetDevice(i) - * - * def initialize(): # <<<<<<<<<<<<<< - * cdef int argc = len(sys.argv) - * cdef char** argv = (calloc(argc, sizeof(char*))) - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_11initialize(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyMethodDef __pyx_mdef_3owl_6libowl_11initialize = {"initialize", (PyCFunction)__pyx_pw_3owl_6libowl_11initialize, METH_NOARGS, 0}; -static PyObject *__pyx_pw_3owl_6libowl_11initialize(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("initialize (wrapper)", 0); - __pyx_r = __pyx_pf_3owl_6libowl_10initialize(__pyx_self); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_10initialize(CYTHON_UNUSED PyObject *__pyx_self) { - int __pyx_v_argc; - char **__pyx_v_argv; - int __pyx_v_i; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - Py_ssize_t __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - char const *__pyx_t_6; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("initialize", 0); - - /* "owl/libowl.pyx":38 - * - * def initialize(): - * cdef int argc = len(sys.argv) # <<<<<<<<<<<<<< - * cdef char** argv = (calloc(argc, sizeof(char*))) - * for i in range(argc): - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_argv); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_argc = __pyx_t_3; - - /* "owl/libowl.pyx":39 - * def initialize(): - * cdef int argc = len(sys.argv) - * cdef char** argv = (calloc(argc, sizeof(char*))) # <<<<<<<<<<<<<< - * for i in range(argc): - * argv[i] = (calloc(len(sys.argv[i]) + 1, sizeof(char))) - */ - __pyx_v_argv = ((char **)calloc(__pyx_v_argc, (sizeof(char *)))); - - /* "owl/libowl.pyx":40 - * cdef int argc = len(sys.argv) - * cdef char** argv = (calloc(argc, sizeof(char*))) - * for i in range(argc): # <<<<<<<<<<<<<< - * argv[i] = (calloc(len(sys.argv[i]) + 1, sizeof(char))) - * strcpy(argv[i], sys.argv[i]) - */ - __pyx_t_4 = __pyx_v_argc; - for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { - __pyx_v_i = __pyx_t_5; - - /* "owl/libowl.pyx":41 - * cdef char** argv = (calloc(argc, sizeof(char*))) - * for i in range(argc): - * argv[i] = (calloc(len(sys.argv[i]) + 1, sizeof(char))) # <<<<<<<<<<<<<< - * strcpy(argv[i], sys.argv[i]) - * m.Initialize(&argc, &argv) - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_argv); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - (__pyx_v_argv[__pyx_v_i]) = ((char *)calloc((__pyx_t_3 + 1), (sizeof(char)))); - - /* "owl/libowl.pyx":42 - * for i in range(argc): - * argv[i] = (calloc(len(sys.argv[i]) + 1, sizeof(char))) - * strcpy(argv[i], sys.argv[i]) # <<<<<<<<<<<<<< - * m.Initialize(&argc, &argv) - * for i in range(argc): - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_argv); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_6 = __Pyx_PyObject_AsString(__pyx_t_2); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - strcpy((__pyx_v_argv[__pyx_v_i]), __pyx_t_6); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - - /* "owl/libowl.pyx":43 - * argv[i] = (calloc(len(sys.argv[i]) + 1, sizeof(char))) - * strcpy(argv[i], sys.argv[i]) - * m.Initialize(&argc, &argv) # <<<<<<<<<<<<<< - * for i in range(argc): - * free(argv[i]) - */ - try { - minerva::MinervaSystem::Initialize((&__pyx_v_argc), (&__pyx_v_argv)); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "owl/libowl.pyx":44 - * strcpy(argv[i], sys.argv[i]) - * m.Initialize(&argc, &argv) - * for i in range(argc): # <<<<<<<<<<<<<< - * free(argv[i]) - * free(argv) - */ - __pyx_t_4 = __pyx_v_argc; - for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { - __pyx_v_i = __pyx_t_5; - - /* "owl/libowl.pyx":45 - * m.Initialize(&argc, &argv) - * for i in range(argc): - * free(argv[i]) # <<<<<<<<<<<<<< - * free(argv) - * - */ - free((__pyx_v_argv[__pyx_v_i])); - } - - /* "owl/libowl.pyx":46 - * for i in range(argc): - * free(argv[i]) - * free(argv) # <<<<<<<<<<<<<< - * - * def has_cuda(): - */ - free(__pyx_v_argv); - - /* "owl/libowl.pyx":37 - * m.SetDevice(i) - * - * def initialize(): # <<<<<<<<<<<<<< - * cdef int argc = len(sys.argv) - * cdef char** argv = (calloc(argc, sizeof(char*))) - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("owl.libowl.initialize", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":48 - * free(argv) - * - * def has_cuda(): # <<<<<<<<<<<<<< - * return m.has_cuda_ - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_13has_cuda(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyMethodDef __pyx_mdef_3owl_6libowl_13has_cuda = {"has_cuda", (PyCFunction)__pyx_pw_3owl_6libowl_13has_cuda, METH_NOARGS, 0}; -static PyObject *__pyx_pw_3owl_6libowl_13has_cuda(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("has_cuda (wrapper)", 0); - __pyx_r = __pyx_pf_3owl_6libowl_12has_cuda(__pyx_self); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_12has_cuda(CYTHON_UNUSED PyObject *__pyx_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("has_cuda", 0); - - /* "owl/libowl.pyx":49 - * - * def has_cuda(): - * return m.has_cuda_ # <<<<<<<<<<<<<< - * - * cdef class NArray(object): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(minerva::MinervaSystem::has_cuda_); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":48 - * free(argv) - * - * def has_cuda(): # <<<<<<<<<<<<<< - * return m.has_cuda_ - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("owl.libowl.has_cuda", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":54 - * cdef m.NArray* _d - * - * def __cinit__(self): # <<<<<<<<<<<<<< - * self._d = new m.NArray() - * - */ - -/* Python wrapper */ -static int __pyx_pw_3owl_6libowl_6NArray_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_3owl_6libowl_6NArray_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); - if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} - if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1; - __pyx_r = __pyx_pf_3owl_6libowl_6NArray___cinit__(((struct __pyx_obj_3owl_6libowl_NArray *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_3owl_6libowl_6NArray___cinit__(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannyDeclarations - minerva::NArray *__pyx_t_1; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__cinit__", 0); - - /* "owl/libowl.pyx":55 - * - * def __cinit__(self): - * self._d = new m.NArray() # <<<<<<<<<<<<<< - * - * def __dealloc__(self): - */ - try { - __pyx_t_1 = new minerva::NArray(); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_self->_d = __pyx_t_1; - - /* "owl/libowl.pyx":54 - * cdef m.NArray* _d - * - * def __cinit__(self): # <<<<<<<<<<<<<< - * self._d = new m.NArray() - * - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("owl.libowl.NArray.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":57 - * self._d = new m.NArray() - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * del self._d - * - */ - -/* Python wrapper */ -static void __pyx_pw_3owl_6libowl_6NArray_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_3owl_6libowl_6NArray_3__dealloc__(PyObject *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_pf_3owl_6libowl_6NArray_2__dealloc__(((struct __pyx_obj_3owl_6libowl_NArray *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -static void __pyx_pf_3owl_6libowl_6NArray_2__dealloc__(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__", 0); - - /* "owl/libowl.pyx":58 - * - * def __dealloc__(self): - * del self._d # <<<<<<<<<<<<<< - * - * def __add__(self, rhs): - */ - delete __pyx_v_self->_d; - - /* "owl/libowl.pyx":57 - * self._d = new m.NArray() - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * del self._d - * - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "owl/libowl.pyx":60 - * del self._d - * - * def __add__(self, rhs): # <<<<<<<<<<<<<< - * cdef NArray l - * cdef NArray r - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_5__add__(PyObject *__pyx_v_self, PyObject *__pyx_v_rhs); /*proto*/ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_5__add__(PyObject *__pyx_v_self, PyObject *__pyx_v_rhs) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__add__ (wrapper)", 0); - __pyx_r = __pyx_pf_3owl_6libowl_6NArray_4__add__(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_rhs)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_6NArray_4__add__(PyObject *__pyx_v_self, PyObject *__pyx_v_rhs) { - struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_l = 0; - struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_r = 0; - float __pyx_v_f; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - minerva::NArray __pyx_t_4; - float __pyx_t_5; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__add__", 0); - - /* "owl/libowl.pyx":64 - * cdef NArray r - * cdef float f - * if isinstance(self, NArray): # <<<<<<<<<<<<<< - * l = self - * if isinstance(rhs, NArray): - */ - __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_self, ((PyObject*)__pyx_ptype_3owl_6libowl_NArray)); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - - /* "owl/libowl.pyx":65 - * cdef float f - * if isinstance(self, NArray): - * l = self # <<<<<<<<<<<<<< - * if isinstance(rhs, NArray): - * r = rhs - */ - if (!(likely(((__pyx_v_self) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_self, __pyx_ptype_3owl_6libowl_NArray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = __pyx_v_self; - __Pyx_INCREF(__pyx_t_3); - __pyx_v_l = ((struct __pyx_obj_3owl_6libowl_NArray *)__pyx_t_3); - __pyx_t_3 = 0; - - /* "owl/libowl.pyx":66 - * if isinstance(self, NArray): - * l = self - * if isinstance(rhs, NArray): # <<<<<<<<<<<<<< - * r = rhs - * return _wrap_cpp_narray( - */ - __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_rhs, ((PyObject*)__pyx_ptype_3owl_6libowl_NArray)); - __pyx_t_1 = (__pyx_t_2 != 0); - if (__pyx_t_1) { - - /* "owl/libowl.pyx":67 - * l = self - * if isinstance(rhs, NArray): - * r = rhs # <<<<<<<<<<<<<< - * return _wrap_cpp_narray( - * m.NArrayAddNArray(deref(l._d), deref(r._d))) - */ - if (!(likely(((__pyx_v_rhs) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_rhs, __pyx_ptype_3owl_6libowl_NArray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = __pyx_v_rhs; - __Pyx_INCREF(__pyx_t_3); - __pyx_v_r = ((struct __pyx_obj_3owl_6libowl_NArray *)__pyx_t_3); - __pyx_t_3 = 0; - - /* "owl/libowl.pyx":68 - * if isinstance(rhs, NArray): - * r = rhs - * return _wrap_cpp_narray( # <<<<<<<<<<<<<< - * m.NArrayAddNArray(deref(l._d), deref(r._d))) - * else: - */ - __Pyx_XDECREF(__pyx_r); - - /* "owl/libowl.pyx":69 - * r = rhs - * return _wrap_cpp_narray( - * m.NArrayAddNArray(deref(l._d), deref(r._d))) # <<<<<<<<<<<<<< - * else: - * f = rhs - */ - try { - __pyx_t_4 = operator+((*__pyx_v_l->_d), (*__pyx_v_r->_d)); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "owl/libowl.pyx":68 - * if isinstance(rhs, NArray): - * r = rhs - * return _wrap_cpp_narray( # <<<<<<<<<<<<<< - * m.NArrayAddNArray(deref(l._d), deref(r._d))) - * else: - */ - __pyx_t_3 = ((PyObject *)__pyx_f_3owl_6libowl__wrap_cpp_narray(__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - } - /*else*/ { - - /* "owl/libowl.pyx":71 - * m.NArrayAddNArray(deref(l._d), deref(r._d))) - * else: - * f = rhs # <<<<<<<<<<<<<< - * return _wrap_cpp_narray( - * (m.NArrayAddNum(deref(l._d), f))) - */ - __pyx_t_5 = __pyx_PyFloat_AsFloat(__pyx_v_rhs); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_f = __pyx_t_5; - - /* "owl/libowl.pyx":72 - * else: - * f = rhs - * return _wrap_cpp_narray( # <<<<<<<<<<<<<< - * (m.NArrayAddNum(deref(l._d), f))) - * else: - */ - __Pyx_XDECREF(__pyx_r); - - /* "owl/libowl.pyx":73 - * f = rhs - * return _wrap_cpp_narray( - * (m.NArrayAddNum(deref(l._d), f))) # <<<<<<<<<<<<<< - * else: - * f = self - */ - try { - __pyx_t_4 = operator+((*__pyx_v_l->_d), __pyx_v_f); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "owl/libowl.pyx":72 - * else: - * f = rhs - * return _wrap_cpp_narray( # <<<<<<<<<<<<<< - * (m.NArrayAddNum(deref(l._d), f))) - * else: - */ - __pyx_t_3 = ((PyObject *)__pyx_f_3owl_6libowl__wrap_cpp_narray(__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - } - } - /*else*/ { - - /* "owl/libowl.pyx":75 - * (m.NArrayAddNum(deref(l._d), f))) - * else: - * f = self # <<<<<<<<<<<<<< - * r = rhs - * return _wrap_cpp_narray(m.NumAddNArray(f, deref(r._d))) - */ - __pyx_t_5 = __pyx_PyFloat_AsFloat(__pyx_v_self); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_f = __pyx_t_5; - - /* "owl/libowl.pyx":76 - * else: - * f = self - * r = rhs # <<<<<<<<<<<<<< - * return _wrap_cpp_narray(m.NumAddNArray(f, deref(r._d))) - * - */ - if (!(likely(((__pyx_v_rhs) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_rhs, __pyx_ptype_3owl_6libowl_NArray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = __pyx_v_rhs; - __Pyx_INCREF(__pyx_t_3); - __pyx_v_r = ((struct __pyx_obj_3owl_6libowl_NArray *)__pyx_t_3); - __pyx_t_3 = 0; - - /* "owl/libowl.pyx":77 - * f = self - * r = rhs - * return _wrap_cpp_narray(m.NumAddNArray(f, deref(r._d))) # <<<<<<<<<<<<<< - * - * def __iadd__(self, rhs): - */ - __Pyx_XDECREF(__pyx_r); - try { - __pyx_t_4 = operator+(__pyx_v_f, (*__pyx_v_r->_d)); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_3 = ((PyObject *)__pyx_f_3owl_6libowl__wrap_cpp_narray(__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - } - - /* "owl/libowl.pyx":60 - * del self._d - * - * def __add__(self, rhs): # <<<<<<<<<<<<<< - * cdef NArray l - * cdef NArray r - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("owl.libowl.NArray.__add__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_l); - __Pyx_XDECREF((PyObject *)__pyx_v_r); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":79 - * return _wrap_cpp_narray(m.NumAddNArray(f, deref(r._d))) - * - * def __iadd__(self, rhs): # <<<<<<<<<<<<<< - * cdef NArray r - * cdef float f - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_7__iadd__(PyObject *__pyx_v_self, PyObject *__pyx_v_rhs); /*proto*/ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_7__iadd__(PyObject *__pyx_v_self, PyObject *__pyx_v_rhs) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__iadd__ (wrapper)", 0); - __pyx_r = __pyx_pf_3owl_6libowl_6NArray_6__iadd__(((struct __pyx_obj_3owl_6libowl_NArray *)__pyx_v_self), ((PyObject *)__pyx_v_rhs)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_6NArray_6__iadd__(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_self, PyObject *__pyx_v_rhs) { - struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_r = 0; - float __pyx_v_f; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - float __pyx_t_4; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__iadd__", 0); - - /* "owl/libowl.pyx":82 - * cdef NArray r - * cdef float f - * if isinstance(rhs, NArray): # <<<<<<<<<<<<<< - * r = rhs - * self._d.AddAssignNArray(deref(r._d)) - */ - __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_rhs, ((PyObject*)__pyx_ptype_3owl_6libowl_NArray)); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - - /* "owl/libowl.pyx":83 - * cdef float f - * if isinstance(rhs, NArray): - * r = rhs # <<<<<<<<<<<<<< - * self._d.AddAssignNArray(deref(r._d)) - * else: - */ - if (!(likely(((__pyx_v_rhs) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_rhs, __pyx_ptype_3owl_6libowl_NArray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = __pyx_v_rhs; - __Pyx_INCREF(__pyx_t_3); - __pyx_v_r = ((struct __pyx_obj_3owl_6libowl_NArray *)__pyx_t_3); - __pyx_t_3 = 0; - - /* "owl/libowl.pyx":84 - * if isinstance(rhs, NArray): - * r = rhs - * self._d.AddAssignNArray(deref(r._d)) # <<<<<<<<<<<<<< - * else: - * f = rhs - */ - try { - __pyx_v_self->_d->operator+=((*__pyx_v_r->_d)); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - goto __pyx_L3; - } - /*else*/ { - - /* "owl/libowl.pyx":86 - * self._d.AddAssignNArray(deref(r._d)) - * else: - * f = rhs # <<<<<<<<<<<<<< - * self._d.AddAssignNum(f) - * return self - */ - __pyx_t_4 = __pyx_PyFloat_AsFloat(__pyx_v_rhs); if (unlikely((__pyx_t_4 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_f = __pyx_t_4; - - /* "owl/libowl.pyx":87 - * else: - * f = rhs - * self._d.AddAssignNum(f) # <<<<<<<<<<<<<< - * return self - * - */ - try { - __pyx_v_self->_d->operator+=(__pyx_v_f); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - } - __pyx_L3:; - - /* "owl/libowl.pyx":88 - * f = rhs - * self._d.AddAssignNum(f) - * return self # <<<<<<<<<<<<<< - * - * def __sub__(self, rhs): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __pyx_r = ((PyObject *)__pyx_v_self); - goto __pyx_L0; - - /* "owl/libowl.pyx":79 - * return _wrap_cpp_narray(m.NumAddNArray(f, deref(r._d))) - * - * def __iadd__(self, rhs): # <<<<<<<<<<<<<< - * cdef NArray r - * cdef float f - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("owl.libowl.NArray.__iadd__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_r); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":90 - * return self - * - * def __sub__(self, rhs): # <<<<<<<<<<<<<< - * cdef NArray l - * cdef NArray r - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_9__sub__(PyObject *__pyx_v_self, PyObject *__pyx_v_rhs); /*proto*/ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_9__sub__(PyObject *__pyx_v_self, PyObject *__pyx_v_rhs) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__sub__ (wrapper)", 0); - __pyx_r = __pyx_pf_3owl_6libowl_6NArray_8__sub__(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_rhs)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_6NArray_8__sub__(PyObject *__pyx_v_self, PyObject *__pyx_v_rhs) { - struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_l = 0; - struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_r = 0; - float __pyx_v_f; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - minerva::NArray __pyx_t_4; - float __pyx_t_5; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__sub__", 0); - - /* "owl/libowl.pyx":94 - * cdef NArray r - * cdef float f - * if isinstance(self, NArray): # <<<<<<<<<<<<<< - * l = self - * if isinstance(rhs, NArray): - */ - __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_self, ((PyObject*)__pyx_ptype_3owl_6libowl_NArray)); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - - /* "owl/libowl.pyx":95 - * cdef float f - * if isinstance(self, NArray): - * l = self # <<<<<<<<<<<<<< - * if isinstance(rhs, NArray): - * r = rhs - */ - if (!(likely(((__pyx_v_self) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_self, __pyx_ptype_3owl_6libowl_NArray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = __pyx_v_self; - __Pyx_INCREF(__pyx_t_3); - __pyx_v_l = ((struct __pyx_obj_3owl_6libowl_NArray *)__pyx_t_3); - __pyx_t_3 = 0; - - /* "owl/libowl.pyx":96 - * if isinstance(self, NArray): - * l = self - * if isinstance(rhs, NArray): # <<<<<<<<<<<<<< - * r = rhs - * return _wrap_cpp_narray( - */ - __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_rhs, ((PyObject*)__pyx_ptype_3owl_6libowl_NArray)); - __pyx_t_1 = (__pyx_t_2 != 0); - if (__pyx_t_1) { - - /* "owl/libowl.pyx":97 - * l = self - * if isinstance(rhs, NArray): - * r = rhs # <<<<<<<<<<<<<< - * return _wrap_cpp_narray( - * m.NArraySubNArray(deref(l._d), deref(r._d))) - */ - if (!(likely(((__pyx_v_rhs) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_rhs, __pyx_ptype_3owl_6libowl_NArray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = __pyx_v_rhs; - __Pyx_INCREF(__pyx_t_3); - __pyx_v_r = ((struct __pyx_obj_3owl_6libowl_NArray *)__pyx_t_3); - __pyx_t_3 = 0; - - /* "owl/libowl.pyx":98 - * if isinstance(rhs, NArray): - * r = rhs - * return _wrap_cpp_narray( # <<<<<<<<<<<<<< - * m.NArraySubNArray(deref(l._d), deref(r._d))) - * else: - */ - __Pyx_XDECREF(__pyx_r); - - /* "owl/libowl.pyx":99 - * r = rhs - * return _wrap_cpp_narray( - * m.NArraySubNArray(deref(l._d), deref(r._d))) # <<<<<<<<<<<<<< - * else: - * f = rhs - */ - try { - __pyx_t_4 = operator-((*__pyx_v_l->_d), (*__pyx_v_r->_d)); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "owl/libowl.pyx":98 - * if isinstance(rhs, NArray): - * r = rhs - * return _wrap_cpp_narray( # <<<<<<<<<<<<<< - * m.NArraySubNArray(deref(l._d), deref(r._d))) - * else: - */ - __pyx_t_3 = ((PyObject *)__pyx_f_3owl_6libowl__wrap_cpp_narray(__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - } - /*else*/ { - - /* "owl/libowl.pyx":101 - * m.NArraySubNArray(deref(l._d), deref(r._d))) - * else: - * f = rhs # <<<<<<<<<<<<<< - * return _wrap_cpp_narray( - * m.NArraySubNum(deref(l._d), f)) - */ - __pyx_t_5 = __pyx_PyFloat_AsFloat(__pyx_v_rhs); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_f = __pyx_t_5; - - /* "owl/libowl.pyx":102 - * else: - * f = rhs - * return _wrap_cpp_narray( # <<<<<<<<<<<<<< - * m.NArraySubNum(deref(l._d), f)) - * else: - */ - __Pyx_XDECREF(__pyx_r); - - /* "owl/libowl.pyx":103 - * f = rhs - * return _wrap_cpp_narray( - * m.NArraySubNum(deref(l._d), f)) # <<<<<<<<<<<<<< - * else: - * f = self - */ - try { - __pyx_t_4 = operator-((*__pyx_v_l->_d), __pyx_v_f); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "owl/libowl.pyx":102 - * else: - * f = rhs - * return _wrap_cpp_narray( # <<<<<<<<<<<<<< - * m.NArraySubNum(deref(l._d), f)) - * else: - */ - __pyx_t_3 = ((PyObject *)__pyx_f_3owl_6libowl__wrap_cpp_narray(__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - } - } - /*else*/ { - - /* "owl/libowl.pyx":105 - * m.NArraySubNum(deref(l._d), f)) - * else: - * f = self # <<<<<<<<<<<<<< - * r = rhs - * return _wrap_cpp_narray(m.NumSubNArray(f, deref(r._d))) - */ - __pyx_t_5 = __pyx_PyFloat_AsFloat(__pyx_v_self); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_f = __pyx_t_5; - - /* "owl/libowl.pyx":106 - * else: - * f = self - * r = rhs # <<<<<<<<<<<<<< - * return _wrap_cpp_narray(m.NumSubNArray(f, deref(r._d))) - * - */ - if (!(likely(((__pyx_v_rhs) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_rhs, __pyx_ptype_3owl_6libowl_NArray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = __pyx_v_rhs; - __Pyx_INCREF(__pyx_t_3); - __pyx_v_r = ((struct __pyx_obj_3owl_6libowl_NArray *)__pyx_t_3); - __pyx_t_3 = 0; - - /* "owl/libowl.pyx":107 - * f = self - * r = rhs - * return _wrap_cpp_narray(m.NumSubNArray(f, deref(r._d))) # <<<<<<<<<<<<<< - * - * def __isub__(self, rhs): - */ - __Pyx_XDECREF(__pyx_r); - try { - __pyx_t_4 = operator-(__pyx_v_f, (*__pyx_v_r->_d)); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_3 = ((PyObject *)__pyx_f_3owl_6libowl__wrap_cpp_narray(__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - } - - /* "owl/libowl.pyx":90 - * return self - * - * def __sub__(self, rhs): # <<<<<<<<<<<<<< - * cdef NArray l - * cdef NArray r - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("owl.libowl.NArray.__sub__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_l); - __Pyx_XDECREF((PyObject *)__pyx_v_r); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":109 - * return _wrap_cpp_narray(m.NumSubNArray(f, deref(r._d))) - * - * def __isub__(self, rhs): # <<<<<<<<<<<<<< - * cdef NArray r - * cdef float f - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_11__isub__(PyObject *__pyx_v_self, PyObject *__pyx_v_rhs); /*proto*/ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_11__isub__(PyObject *__pyx_v_self, PyObject *__pyx_v_rhs) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__isub__ (wrapper)", 0); - __pyx_r = __pyx_pf_3owl_6libowl_6NArray_10__isub__(((struct __pyx_obj_3owl_6libowl_NArray *)__pyx_v_self), ((PyObject *)__pyx_v_rhs)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_6NArray_10__isub__(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_self, PyObject *__pyx_v_rhs) { - struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_r = 0; - float __pyx_v_f; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - float __pyx_t_4; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__isub__", 0); - - /* "owl/libowl.pyx":112 - * cdef NArray r - * cdef float f - * if isinstance(rhs, NArray): # <<<<<<<<<<<<<< - * r = rhs - * self._d.SubAssignNArray(deref(r._d)) - */ - __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_rhs, ((PyObject*)__pyx_ptype_3owl_6libowl_NArray)); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - - /* "owl/libowl.pyx":113 - * cdef float f - * if isinstance(rhs, NArray): - * r = rhs # <<<<<<<<<<<<<< - * self._d.SubAssignNArray(deref(r._d)) - * else: - */ - if (!(likely(((__pyx_v_rhs) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_rhs, __pyx_ptype_3owl_6libowl_NArray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = __pyx_v_rhs; - __Pyx_INCREF(__pyx_t_3); - __pyx_v_r = ((struct __pyx_obj_3owl_6libowl_NArray *)__pyx_t_3); - __pyx_t_3 = 0; - - /* "owl/libowl.pyx":114 - * if isinstance(rhs, NArray): - * r = rhs - * self._d.SubAssignNArray(deref(r._d)) # <<<<<<<<<<<<<< - * else: - * f = rhs - */ - try { - __pyx_v_self->_d->operator-=((*__pyx_v_r->_d)); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - goto __pyx_L3; - } - /*else*/ { - - /* "owl/libowl.pyx":116 - * self._d.SubAssignNArray(deref(r._d)) - * else: - * f = rhs # <<<<<<<<<<<<<< - * self._d.SubAssignNum(f) - * return self - */ - __pyx_t_4 = __pyx_PyFloat_AsFloat(__pyx_v_rhs); if (unlikely((__pyx_t_4 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_f = __pyx_t_4; - - /* "owl/libowl.pyx":117 - * else: - * f = rhs - * self._d.SubAssignNum(f) # <<<<<<<<<<<<<< - * return self - * - */ - try { - __pyx_v_self->_d->operator-=(__pyx_v_f); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - } - __pyx_L3:; - - /* "owl/libowl.pyx":118 - * f = rhs - * self._d.SubAssignNum(f) - * return self # <<<<<<<<<<<<<< - * - * def __mul__(self, rhs): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __pyx_r = ((PyObject *)__pyx_v_self); - goto __pyx_L0; - - /* "owl/libowl.pyx":109 - * return _wrap_cpp_narray(m.NumSubNArray(f, deref(r._d))) - * - * def __isub__(self, rhs): # <<<<<<<<<<<<<< - * cdef NArray r - * cdef float f - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("owl.libowl.NArray.__isub__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_r); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":120 - * return self - * - * def __mul__(self, rhs): # <<<<<<<<<<<<<< - * cdef NArray l - * cdef NArray r - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_13__mul__(PyObject *__pyx_v_self, PyObject *__pyx_v_rhs); /*proto*/ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_13__mul__(PyObject *__pyx_v_self, PyObject *__pyx_v_rhs) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__mul__ (wrapper)", 0); - __pyx_r = __pyx_pf_3owl_6libowl_6NArray_12__mul__(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_rhs)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_6NArray_12__mul__(PyObject *__pyx_v_self, PyObject *__pyx_v_rhs) { - struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_l = 0; - struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_r = 0; - float __pyx_v_f; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - minerva::NArray __pyx_t_4; - float __pyx_t_5; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__mul__", 0); - - /* "owl/libowl.pyx":124 - * cdef NArray r - * cdef float f - * if isinstance(self, NArray): # <<<<<<<<<<<<<< - * l = self - * if isinstance(rhs, NArray): - */ - __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_self, ((PyObject*)__pyx_ptype_3owl_6libowl_NArray)); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - - /* "owl/libowl.pyx":125 - * cdef float f - * if isinstance(self, NArray): - * l = self # <<<<<<<<<<<<<< - * if isinstance(rhs, NArray): - * r = rhs - */ - if (!(likely(((__pyx_v_self) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_self, __pyx_ptype_3owl_6libowl_NArray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = __pyx_v_self; - __Pyx_INCREF(__pyx_t_3); - __pyx_v_l = ((struct __pyx_obj_3owl_6libowl_NArray *)__pyx_t_3); - __pyx_t_3 = 0; - - /* "owl/libowl.pyx":126 - * if isinstance(self, NArray): - * l = self - * if isinstance(rhs, NArray): # <<<<<<<<<<<<<< - * r = rhs - * return _wrap_cpp_narray( - */ - __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_rhs, ((PyObject*)__pyx_ptype_3owl_6libowl_NArray)); - __pyx_t_1 = (__pyx_t_2 != 0); - if (__pyx_t_1) { - - /* "owl/libowl.pyx":127 - * l = self - * if isinstance(rhs, NArray): - * r = rhs # <<<<<<<<<<<<<< - * return _wrap_cpp_narray( - * m.NArrayMulNArray(deref(l._d), deref(r._d))) - */ - if (!(likely(((__pyx_v_rhs) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_rhs, __pyx_ptype_3owl_6libowl_NArray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = __pyx_v_rhs; - __Pyx_INCREF(__pyx_t_3); - __pyx_v_r = ((struct __pyx_obj_3owl_6libowl_NArray *)__pyx_t_3); - __pyx_t_3 = 0; - - /* "owl/libowl.pyx":128 - * if isinstance(rhs, NArray): - * r = rhs - * return _wrap_cpp_narray( # <<<<<<<<<<<<<< - * m.NArrayMulNArray(deref(l._d), deref(r._d))) - * else: - */ - __Pyx_XDECREF(__pyx_r); - - /* "owl/libowl.pyx":129 - * r = rhs - * return _wrap_cpp_narray( - * m.NArrayMulNArray(deref(l._d), deref(r._d))) # <<<<<<<<<<<<<< - * else: - * f = rhs - */ - try { - __pyx_t_4 = operator*((*__pyx_v_l->_d), (*__pyx_v_r->_d)); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "owl/libowl.pyx":128 - * if isinstance(rhs, NArray): - * r = rhs - * return _wrap_cpp_narray( # <<<<<<<<<<<<<< - * m.NArrayMulNArray(deref(l._d), deref(r._d))) - * else: - */ - __pyx_t_3 = ((PyObject *)__pyx_f_3owl_6libowl__wrap_cpp_narray(__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - } - /*else*/ { - - /* "owl/libowl.pyx":131 - * m.NArrayMulNArray(deref(l._d), deref(r._d))) - * else: - * f = rhs # <<<<<<<<<<<<<< - * return _wrap_cpp_narray( - * m.NArrayMulNum(deref(l._d), f)) - */ - __pyx_t_5 = __pyx_PyFloat_AsFloat(__pyx_v_rhs); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_f = __pyx_t_5; - - /* "owl/libowl.pyx":132 - * else: - * f = rhs - * return _wrap_cpp_narray( # <<<<<<<<<<<<<< - * m.NArrayMulNum(deref(l._d), f)) - * else: - */ - __Pyx_XDECREF(__pyx_r); - - /* "owl/libowl.pyx":133 - * f = rhs - * return _wrap_cpp_narray( - * m.NArrayMulNum(deref(l._d), f)) # <<<<<<<<<<<<<< - * else: - * f = self - */ - try { - __pyx_t_4 = operator*((*__pyx_v_l->_d), __pyx_v_f); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "owl/libowl.pyx":132 - * else: - * f = rhs - * return _wrap_cpp_narray( # <<<<<<<<<<<<<< - * m.NArrayMulNum(deref(l._d), f)) - * else: - */ - __pyx_t_3 = ((PyObject *)__pyx_f_3owl_6libowl__wrap_cpp_narray(__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - } - } - /*else*/ { - - /* "owl/libowl.pyx":135 - * m.NArrayMulNum(deref(l._d), f)) - * else: - * f = self # <<<<<<<<<<<<<< - * r = rhs - * return _wrap_cpp_narray(m.NumMulNArray(f, deref(r._d))) - */ - __pyx_t_5 = __pyx_PyFloat_AsFloat(__pyx_v_self); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_f = __pyx_t_5; - - /* "owl/libowl.pyx":136 - * else: - * f = self - * r = rhs # <<<<<<<<<<<<<< - * return _wrap_cpp_narray(m.NumMulNArray(f, deref(r._d))) - * - */ - if (!(likely(((__pyx_v_rhs) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_rhs, __pyx_ptype_3owl_6libowl_NArray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = __pyx_v_rhs; - __Pyx_INCREF(__pyx_t_3); - __pyx_v_r = ((struct __pyx_obj_3owl_6libowl_NArray *)__pyx_t_3); - __pyx_t_3 = 0; - - /* "owl/libowl.pyx":137 - * f = self - * r = rhs - * return _wrap_cpp_narray(m.NumMulNArray(f, deref(r._d))) # <<<<<<<<<<<<<< - * - * def __imul__(self, rhs): - */ - __Pyx_XDECREF(__pyx_r); - try { - __pyx_t_4 = operator*(__pyx_v_f, (*__pyx_v_r->_d)); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_3 = ((PyObject *)__pyx_f_3owl_6libowl__wrap_cpp_narray(__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - } - - /* "owl/libowl.pyx":120 - * return self - * - * def __mul__(self, rhs): # <<<<<<<<<<<<<< - * cdef NArray l - * cdef NArray r - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("owl.libowl.NArray.__mul__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_l); - __Pyx_XDECREF((PyObject *)__pyx_v_r); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":139 - * return _wrap_cpp_narray(m.NumMulNArray(f, deref(r._d))) - * - * def __imul__(self, rhs): # <<<<<<<<<<<<<< - * cdef NArray r - * cdef float f - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_15__imul__(PyObject *__pyx_v_self, PyObject *__pyx_v_rhs); /*proto*/ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_15__imul__(PyObject *__pyx_v_self, PyObject *__pyx_v_rhs) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__imul__ (wrapper)", 0); - __pyx_r = __pyx_pf_3owl_6libowl_6NArray_14__imul__(((struct __pyx_obj_3owl_6libowl_NArray *)__pyx_v_self), ((PyObject *)__pyx_v_rhs)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_6NArray_14__imul__(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_self, PyObject *__pyx_v_rhs) { - struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_r = 0; - float __pyx_v_f; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - float __pyx_t_4; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__imul__", 0); - - /* "owl/libowl.pyx":142 - * cdef NArray r - * cdef float f - * if isinstance(rhs, NArray): # <<<<<<<<<<<<<< - * r = rhs - * self._d.MulAssignNArray(deref(r._d)) - */ - __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_rhs, ((PyObject*)__pyx_ptype_3owl_6libowl_NArray)); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - - /* "owl/libowl.pyx":143 - * cdef float f - * if isinstance(rhs, NArray): - * r = rhs # <<<<<<<<<<<<<< - * self._d.MulAssignNArray(deref(r._d)) - * else: - */ - if (!(likely(((__pyx_v_rhs) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_rhs, __pyx_ptype_3owl_6libowl_NArray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = __pyx_v_rhs; - __Pyx_INCREF(__pyx_t_3); - __pyx_v_r = ((struct __pyx_obj_3owl_6libowl_NArray *)__pyx_t_3); - __pyx_t_3 = 0; - - /* "owl/libowl.pyx":144 - * if isinstance(rhs, NArray): - * r = rhs - * self._d.MulAssignNArray(deref(r._d)) # <<<<<<<<<<<<<< - * else: - * f = rhs - */ - try { - __pyx_v_self->_d->operator*=((*__pyx_v_r->_d)); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - goto __pyx_L3; - } - /*else*/ { - - /* "owl/libowl.pyx":146 - * self._d.MulAssignNArray(deref(r._d)) - * else: - * f = rhs # <<<<<<<<<<<<<< - * self._d.MulAssignNum(f) - * return self - */ - __pyx_t_4 = __pyx_PyFloat_AsFloat(__pyx_v_rhs); if (unlikely((__pyx_t_4 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_f = __pyx_t_4; - - /* "owl/libowl.pyx":147 - * else: - * f = rhs - * self._d.MulAssignNum(f) # <<<<<<<<<<<<<< - * return self - * - */ - try { - __pyx_v_self->_d->operator*=(__pyx_v_f); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - } - __pyx_L3:; - - /* "owl/libowl.pyx":148 - * f = rhs - * self._d.MulAssignNum(f) - * return self # <<<<<<<<<<<<<< - * - * def __div__(self, rhs): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __pyx_r = ((PyObject *)__pyx_v_self); - goto __pyx_L0; - - /* "owl/libowl.pyx":139 - * return _wrap_cpp_narray(m.NumMulNArray(f, deref(r._d))) - * - * def __imul__(self, rhs): # <<<<<<<<<<<<<< - * cdef NArray r - * cdef float f - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("owl.libowl.NArray.__imul__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_r); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":150 - * return self - * - * def __div__(self, rhs): # <<<<<<<<<<<<<< - * cdef NArray l - * cdef NArray r - */ - -/* Python wrapper */ -#if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY -static PyObject *__pyx_pw_3owl_6libowl_6NArray_17__div__(PyObject *__pyx_v_self, PyObject *__pyx_v_rhs); /*proto*/ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_17__div__(PyObject *__pyx_v_self, PyObject *__pyx_v_rhs) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__div__ (wrapper)", 0); - __pyx_r = __pyx_pf_3owl_6libowl_6NArray_16__div__(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_rhs)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} -#endif /*!(#if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY)*/ - -#if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY -static PyObject *__pyx_pf_3owl_6libowl_6NArray_16__div__(PyObject *__pyx_v_self, PyObject *__pyx_v_rhs) { - struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_l = 0; - struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_r = 0; - float __pyx_v_f; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - minerva::NArray __pyx_t_4; - float __pyx_t_5; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__div__", 0); - - /* "owl/libowl.pyx":154 - * cdef NArray r - * cdef float f - * if isinstance(self, NArray): # <<<<<<<<<<<<<< - * l = self - * if isinstance(rhs, NArray): - */ - __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_self, ((PyObject*)__pyx_ptype_3owl_6libowl_NArray)); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - - /* "owl/libowl.pyx":155 - * cdef float f - * if isinstance(self, NArray): - * l = self # <<<<<<<<<<<<<< - * if isinstance(rhs, NArray): - * r = rhs - */ - if (!(likely(((__pyx_v_self) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_self, __pyx_ptype_3owl_6libowl_NArray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = __pyx_v_self; - __Pyx_INCREF(__pyx_t_3); - __pyx_v_l = ((struct __pyx_obj_3owl_6libowl_NArray *)__pyx_t_3); - __pyx_t_3 = 0; - - /* "owl/libowl.pyx":156 - * if isinstance(self, NArray): - * l = self - * if isinstance(rhs, NArray): # <<<<<<<<<<<<<< - * r = rhs - * return _wrap_cpp_narray( - */ - __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_rhs, ((PyObject*)__pyx_ptype_3owl_6libowl_NArray)); - __pyx_t_1 = (__pyx_t_2 != 0); - if (__pyx_t_1) { - - /* "owl/libowl.pyx":157 - * l = self - * if isinstance(rhs, NArray): - * r = rhs # <<<<<<<<<<<<<< - * return _wrap_cpp_narray( - * m.NArrayDivNArray(deref(l._d), deref(r._d))) - */ - if (!(likely(((__pyx_v_rhs) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_rhs, __pyx_ptype_3owl_6libowl_NArray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = __pyx_v_rhs; - __Pyx_INCREF(__pyx_t_3); - __pyx_v_r = ((struct __pyx_obj_3owl_6libowl_NArray *)__pyx_t_3); - __pyx_t_3 = 0; - - /* "owl/libowl.pyx":158 - * if isinstance(rhs, NArray): - * r = rhs - * return _wrap_cpp_narray( # <<<<<<<<<<<<<< - * m.NArrayDivNArray(deref(l._d), deref(r._d))) - * else: - */ - __Pyx_XDECREF(__pyx_r); - - /* "owl/libowl.pyx":159 - * r = rhs - * return _wrap_cpp_narray( - * m.NArrayDivNArray(deref(l._d), deref(r._d))) # <<<<<<<<<<<<<< - * else: - * f = rhs - */ - try { - __pyx_t_4 = operator/((*__pyx_v_l->_d), (*__pyx_v_r->_d)); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "owl/libowl.pyx":158 - * if isinstance(rhs, NArray): - * r = rhs - * return _wrap_cpp_narray( # <<<<<<<<<<<<<< - * m.NArrayDivNArray(deref(l._d), deref(r._d))) - * else: - */ - __pyx_t_3 = ((PyObject *)__pyx_f_3owl_6libowl__wrap_cpp_narray(__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - } - /*else*/ { - - /* "owl/libowl.pyx":161 - * m.NArrayDivNArray(deref(l._d), deref(r._d))) - * else: - * f = rhs # <<<<<<<<<<<<<< - * return _wrap_cpp_narray( - * m.NArrayDivNum(deref(l._d), f)) - */ - __pyx_t_5 = __pyx_PyFloat_AsFloat(__pyx_v_rhs); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_f = __pyx_t_5; - - /* "owl/libowl.pyx":162 - * else: - * f = rhs - * return _wrap_cpp_narray( # <<<<<<<<<<<<<< - * m.NArrayDivNum(deref(l._d), f)) - * else: - */ - __Pyx_XDECREF(__pyx_r); - - /* "owl/libowl.pyx":163 - * f = rhs - * return _wrap_cpp_narray( - * m.NArrayDivNum(deref(l._d), f)) # <<<<<<<<<<<<<< - * else: - * f = self - */ - try { - __pyx_t_4 = operator/((*__pyx_v_l->_d), __pyx_v_f); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "owl/libowl.pyx":162 - * else: - * f = rhs - * return _wrap_cpp_narray( # <<<<<<<<<<<<<< - * m.NArrayDivNum(deref(l._d), f)) - * else: - */ - __pyx_t_3 = ((PyObject *)__pyx_f_3owl_6libowl__wrap_cpp_narray(__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - } - } - /*else*/ { - - /* "owl/libowl.pyx":165 - * m.NArrayDivNum(deref(l._d), f)) - * else: - * f = self # <<<<<<<<<<<<<< - * r = rhs - * return _wrap_cpp_narray(m.NumDivNArray(f, deref(r._d))) - */ - __pyx_t_5 = __pyx_PyFloat_AsFloat(__pyx_v_self); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_f = __pyx_t_5; - - /* "owl/libowl.pyx":166 - * else: - * f = self - * r = rhs # <<<<<<<<<<<<<< - * return _wrap_cpp_narray(m.NumDivNArray(f, deref(r._d))) - * - */ - if (!(likely(((__pyx_v_rhs) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_rhs, __pyx_ptype_3owl_6libowl_NArray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = __pyx_v_rhs; - __Pyx_INCREF(__pyx_t_3); - __pyx_v_r = ((struct __pyx_obj_3owl_6libowl_NArray *)__pyx_t_3); - __pyx_t_3 = 0; - - /* "owl/libowl.pyx":167 - * f = self - * r = rhs - * return _wrap_cpp_narray(m.NumDivNArray(f, deref(r._d))) # <<<<<<<<<<<<<< - * - * def __idiv__(self, rhs): - */ - __Pyx_XDECREF(__pyx_r); - try { - __pyx_t_4 = operator/(__pyx_v_f, (*__pyx_v_r->_d)); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_3 = ((PyObject *)__pyx_f_3owl_6libowl__wrap_cpp_narray(__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - } - - /* "owl/libowl.pyx":150 - * return self - * - * def __div__(self, rhs): # <<<<<<<<<<<<<< - * cdef NArray l - * cdef NArray r - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("owl.libowl.NArray.__div__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_l); - __Pyx_XDECREF((PyObject *)__pyx_v_r); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} -#endif /*!(#if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY)*/ - -/* "owl/libowl.pyx":169 - * return _wrap_cpp_narray(m.NumDivNArray(f, deref(r._d))) - * - * def __idiv__(self, rhs): # <<<<<<<<<<<<<< - * cdef NArray r - * cdef float f - */ - -/* Python wrapper */ -#if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY -static PyObject *__pyx_pw_3owl_6libowl_6NArray_19__idiv__(PyObject *__pyx_v_self, PyObject *__pyx_v_rhs); /*proto*/ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_19__idiv__(PyObject *__pyx_v_self, PyObject *__pyx_v_rhs) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__idiv__ (wrapper)", 0); - __pyx_r = __pyx_pf_3owl_6libowl_6NArray_18__idiv__(((struct __pyx_obj_3owl_6libowl_NArray *)__pyx_v_self), ((PyObject *)__pyx_v_rhs)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} -#endif /*!(#if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY)*/ - -#if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY -static PyObject *__pyx_pf_3owl_6libowl_6NArray_18__idiv__(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_self, PyObject *__pyx_v_rhs) { - struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_r = 0; - float __pyx_v_f; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - float __pyx_t_4; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__idiv__", 0); - - /* "owl/libowl.pyx":172 - * cdef NArray r - * cdef float f - * if isinstance(rhs, NArray): # <<<<<<<<<<<<<< - * r = rhs - * self._d.DivAssignNArray(deref(r._d)) - */ - __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_rhs, ((PyObject*)__pyx_ptype_3owl_6libowl_NArray)); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - - /* "owl/libowl.pyx":173 - * cdef float f - * if isinstance(rhs, NArray): - * r = rhs # <<<<<<<<<<<<<< - * self._d.DivAssignNArray(deref(r._d)) - * else: - */ - if (!(likely(((__pyx_v_rhs) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_rhs, __pyx_ptype_3owl_6libowl_NArray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = __pyx_v_rhs; - __Pyx_INCREF(__pyx_t_3); - __pyx_v_r = ((struct __pyx_obj_3owl_6libowl_NArray *)__pyx_t_3); - __pyx_t_3 = 0; - - /* "owl/libowl.pyx":174 - * if isinstance(rhs, NArray): - * r = rhs - * self._d.DivAssignNArray(deref(r._d)) # <<<<<<<<<<<<<< - * else: - * f = rhs - */ - try { - __pyx_v_self->_d->operator/=((*__pyx_v_r->_d)); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - goto __pyx_L3; - } - /*else*/ { - - /* "owl/libowl.pyx":176 - * self._d.DivAssignNArray(deref(r._d)) - * else: - * f = rhs # <<<<<<<<<<<<<< - * self._d.DivAssignNum(f) - * return self - */ - __pyx_t_4 = __pyx_PyFloat_AsFloat(__pyx_v_rhs); if (unlikely((__pyx_t_4 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_f = __pyx_t_4; - - /* "owl/libowl.pyx":177 - * else: - * f = rhs - * self._d.DivAssignNum(f) # <<<<<<<<<<<<<< - * return self - * - */ - try { - __pyx_v_self->_d->operator/=(__pyx_v_f); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - } - __pyx_L3:; - - /* "owl/libowl.pyx":178 - * f = rhs - * self._d.DivAssignNum(f) - * return self # <<<<<<<<<<<<<< - * - * @staticmethod - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __pyx_r = ((PyObject *)__pyx_v_self); - goto __pyx_L0; - - /* "owl/libowl.pyx":169 - * return _wrap_cpp_narray(m.NumDivNArray(f, deref(r._d))) - * - * def __idiv__(self, rhs): # <<<<<<<<<<<<<< - * cdef NArray r - * cdef float f - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("owl.libowl.NArray.__idiv__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_r); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} -#endif /*!(#if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY)*/ - -/* "owl/libowl.pyx":181 - * - * @staticmethod - * def mult(NArray lhs, NArray rhs): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray(m.Mult(deref(lhs._d), deref(rhs._d))) - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_21mult(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_3owl_6libowl_6NArray_21mult = {"mult", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_21mult, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_3owl_6libowl_6NArray_21mult(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_lhs = 0; - struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_rhs = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("mult (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_lhs,&__pyx_n_s_rhs,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); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_lhs)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_rhs)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("mult", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mult") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __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_lhs = ((struct __pyx_obj_3owl_6libowl_NArray *)values[0]); - __pyx_v_rhs = ((struct __pyx_obj_3owl_6libowl_NArray *)values[1]); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("mult", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("owl.libowl.NArray.mult", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lhs), __pyx_ptype_3owl_6libowl_NArray, 1, "lhs", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_rhs), __pyx_ptype_3owl_6libowl_NArray, 1, "rhs", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_3owl_6libowl_6NArray_20mult(__pyx_v_lhs, __pyx_v_rhs); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_6NArray_20mult(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_lhs, struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_rhs) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - minerva::NArray __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("mult", 0); - - /* "owl/libowl.pyx":182 - * @staticmethod - * def mult(NArray lhs, NArray rhs): - * return _wrap_cpp_narray(m.Mult(deref(lhs._d), deref(rhs._d))) # <<<<<<<<<<<<<< - * - * @staticmethod - */ - __Pyx_XDECREF(__pyx_r); - try { - __pyx_t_1 = minerva::Elewise::Mult((*__pyx_v_lhs->_d), (*__pyx_v_rhs->_d)); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_2 = ((PyObject *)__pyx_f_3owl_6libowl__wrap_cpp_narray(__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":181 - * - * @staticmethod - * def mult(NArray lhs, NArray rhs): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray(m.Mult(deref(lhs._d), deref(rhs._d))) - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("owl.libowl.NArray.mult", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":185 - * - * @staticmethod - * def exp(NArray lhs): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray(m.Exp(deref(lhs._d))) - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_23exp(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_3owl_6libowl_6NArray_23exp = {"exp", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_23exp, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_3owl_6libowl_6NArray_23exp(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_lhs = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("exp (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_lhs,0}; - PyObject* values[1] = {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 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_lhs)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "exp") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - } - __pyx_v_lhs = ((struct __pyx_obj_3owl_6libowl_NArray *)values[0]); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("exp", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("owl.libowl.NArray.exp", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lhs), __pyx_ptype_3owl_6libowl_NArray, 1, "lhs", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_3owl_6libowl_6NArray_22exp(__pyx_v_lhs); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_6NArray_22exp(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_lhs) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - minerva::NArray __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("exp", 0); - - /* "owl/libowl.pyx":186 - * @staticmethod - * def exp(NArray lhs): - * return _wrap_cpp_narray(m.Exp(deref(lhs._d))) # <<<<<<<<<<<<<< - * - * @staticmethod - */ - __Pyx_XDECREF(__pyx_r); - try { - __pyx_t_1 = minerva::Elewise::Exp((*__pyx_v_lhs->_d)); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_2 = ((PyObject *)__pyx_f_3owl_6libowl__wrap_cpp_narray(__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":185 - * - * @staticmethod - * def exp(NArray lhs): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray(m.Exp(deref(lhs._d))) - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("owl.libowl.NArray.exp", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":189 - * - * @staticmethod - * def ln(NArray lhs): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray(m.Ln(deref(lhs._d))) - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_25ln(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_3owl_6libowl_6NArray_25ln = {"ln", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_25ln, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_3owl_6libowl_6NArray_25ln(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_lhs = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("ln (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_lhs,0}; - PyObject* values[1] = {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 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_lhs)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ln") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - } - __pyx_v_lhs = ((struct __pyx_obj_3owl_6libowl_NArray *)values[0]); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("ln", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("owl.libowl.NArray.ln", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lhs), __pyx_ptype_3owl_6libowl_NArray, 1, "lhs", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_3owl_6libowl_6NArray_24ln(__pyx_v_lhs); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_6NArray_24ln(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_lhs) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - minerva::NArray __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("ln", 0); - - /* "owl/libowl.pyx":190 - * @staticmethod - * def ln(NArray lhs): - * return _wrap_cpp_narray(m.Ln(deref(lhs._d))) # <<<<<<<<<<<<<< - * - * @staticmethod - */ - __Pyx_XDECREF(__pyx_r); - try { - __pyx_t_1 = minerva::Elewise::Ln((*__pyx_v_lhs->_d)); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_2 = ((PyObject *)__pyx_f_3owl_6libowl__wrap_cpp_narray(__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":189 - * - * @staticmethod - * def ln(NArray lhs): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray(m.Ln(deref(lhs._d))) - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("owl.libowl.NArray.ln", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":193 - * - * @staticmethod - * def sigm(NArray lhs): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray(m.SigmoidForward(deref(lhs._d))) - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_27sigm(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_3owl_6libowl_6NArray_27sigm = {"sigm", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_27sigm, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_3owl_6libowl_6NArray_27sigm(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_lhs = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("sigm (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_lhs,0}; - PyObject* values[1] = {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 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_lhs)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sigm") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - } - __pyx_v_lhs = ((struct __pyx_obj_3owl_6libowl_NArray *)values[0]); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("sigm", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("owl.libowl.NArray.sigm", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lhs), __pyx_ptype_3owl_6libowl_NArray, 1, "lhs", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_3owl_6libowl_6NArray_26sigm(__pyx_v_lhs); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_6NArray_26sigm(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_lhs) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - minerva::NArray __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("sigm", 0); - - /* "owl/libowl.pyx":194 - * @staticmethod - * def sigm(NArray lhs): - * return _wrap_cpp_narray(m.SigmoidForward(deref(lhs._d))) # <<<<<<<<<<<<<< - * - * @staticmethod - */ - __Pyx_XDECREF(__pyx_r); - try { - __pyx_t_1 = minerva::Elewise::SigmoidForward((*__pyx_v_lhs->_d)); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_2 = ((PyObject *)__pyx_f_3owl_6libowl__wrap_cpp_narray(__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":193 - * - * @staticmethod - * def sigm(NArray lhs): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray(m.SigmoidForward(deref(lhs._d))) - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("owl.libowl.NArray.sigm", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":197 - * - * @staticmethod - * def sigm_back(NArray diff, NArray top, NArray bottom): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray( - * m.SigmoidBackward( - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_29sigm_back(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_3owl_6libowl_6NArray_29sigm_back = {"sigm_back", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_29sigm_back, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_3owl_6libowl_6NArray_29sigm_back(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_diff = 0; - struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_top = 0; - struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_bottom = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("sigm_back (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_diff,&__pyx_n_s_top,&__pyx_n_s_bottom,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); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_diff)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_top)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sigm_back", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_bottom)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sigm_back", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sigm_back") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __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_diff = ((struct __pyx_obj_3owl_6libowl_NArray *)values[0]); - __pyx_v_top = ((struct __pyx_obj_3owl_6libowl_NArray *)values[1]); - __pyx_v_bottom = ((struct __pyx_obj_3owl_6libowl_NArray *)values[2]); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("sigm_back", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("owl.libowl.NArray.sigm_back", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_diff), __pyx_ptype_3owl_6libowl_NArray, 1, "diff", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_top), __pyx_ptype_3owl_6libowl_NArray, 1, "top", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_bottom), __pyx_ptype_3owl_6libowl_NArray, 1, "bottom", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_3owl_6libowl_6NArray_28sigm_back(__pyx_v_diff, __pyx_v_top, __pyx_v_bottom); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_6NArray_28sigm_back(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_diff, struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_top, struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_bottom) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - minerva::NArray __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("sigm_back", 0); - - /* "owl/libowl.pyx":198 - * @staticmethod - * def sigm_back(NArray diff, NArray top, NArray bottom): - * return _wrap_cpp_narray( # <<<<<<<<<<<<<< - * m.SigmoidBackward( - * deref(diff._d) - */ - __Pyx_XDECREF(__pyx_r); - - /* "owl/libowl.pyx":199 - * def sigm_back(NArray diff, NArray top, NArray bottom): - * return _wrap_cpp_narray( - * m.SigmoidBackward( # <<<<<<<<<<<<<< - * deref(diff._d) - * , deref(top._d) - */ - try { - __pyx_t_1 = minerva::Elewise::SigmoidBackward((*__pyx_v_diff->_d), (*__pyx_v_top->_d), (*__pyx_v_bottom->_d)); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "owl/libowl.pyx":198 - * @staticmethod - * def sigm_back(NArray diff, NArray top, NArray bottom): - * return _wrap_cpp_narray( # <<<<<<<<<<<<<< - * m.SigmoidBackward( - * deref(diff._d) - */ - __pyx_t_2 = ((PyObject *)__pyx_f_3owl_6libowl__wrap_cpp_narray(__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":197 - * - * @staticmethod - * def sigm_back(NArray diff, NArray top, NArray bottom): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray( - * m.SigmoidBackward( - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("owl.libowl.NArray.sigm_back", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":205 - * - * @staticmethod - * def relu(NArray lhs): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray(m.ReluForward(deref(lhs._d))) - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_31relu(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_3owl_6libowl_6NArray_31relu = {"relu", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_31relu, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_3owl_6libowl_6NArray_31relu(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_lhs = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("relu (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_lhs,0}; - PyObject* values[1] = {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 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_lhs)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "relu") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - } - __pyx_v_lhs = ((struct __pyx_obj_3owl_6libowl_NArray *)values[0]); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("relu", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("owl.libowl.NArray.relu", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lhs), __pyx_ptype_3owl_6libowl_NArray, 1, "lhs", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_3owl_6libowl_6NArray_30relu(__pyx_v_lhs); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_6NArray_30relu(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_lhs) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - minerva::NArray __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("relu", 0); - - /* "owl/libowl.pyx":206 - * @staticmethod - * def relu(NArray lhs): - * return _wrap_cpp_narray(m.ReluForward(deref(lhs._d))) # <<<<<<<<<<<<<< - * - * @staticmethod - */ - __Pyx_XDECREF(__pyx_r); - try { - __pyx_t_1 = minerva::Elewise::ReluForward((*__pyx_v_lhs->_d)); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_2 = ((PyObject *)__pyx_f_3owl_6libowl__wrap_cpp_narray(__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":205 - * - * @staticmethod - * def relu(NArray lhs): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray(m.ReluForward(deref(lhs._d))) - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("owl.libowl.NArray.relu", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":209 - * - * @staticmethod - * def relu_back(NArray diff, NArray top, NArray bottom): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray( - * m.ReluBackward( - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_33relu_back(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_3owl_6libowl_6NArray_33relu_back = {"relu_back", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_33relu_back, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_3owl_6libowl_6NArray_33relu_back(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_diff = 0; - struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_top = 0; - struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_bottom = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("relu_back (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_diff,&__pyx_n_s_top,&__pyx_n_s_bottom,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); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_diff)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_top)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("relu_back", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_bottom)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("relu_back", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "relu_back") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __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_diff = ((struct __pyx_obj_3owl_6libowl_NArray *)values[0]); - __pyx_v_top = ((struct __pyx_obj_3owl_6libowl_NArray *)values[1]); - __pyx_v_bottom = ((struct __pyx_obj_3owl_6libowl_NArray *)values[2]); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("relu_back", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("owl.libowl.NArray.relu_back", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_diff), __pyx_ptype_3owl_6libowl_NArray, 1, "diff", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_top), __pyx_ptype_3owl_6libowl_NArray, 1, "top", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_bottom), __pyx_ptype_3owl_6libowl_NArray, 1, "bottom", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_3owl_6libowl_6NArray_32relu_back(__pyx_v_diff, __pyx_v_top, __pyx_v_bottom); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_6NArray_32relu_back(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_diff, struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_top, struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_bottom) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - minerva::NArray __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("relu_back", 0); - - /* "owl/libowl.pyx":210 - * @staticmethod - * def relu_back(NArray diff, NArray top, NArray bottom): - * return _wrap_cpp_narray( # <<<<<<<<<<<<<< - * m.ReluBackward( - * deref(diff._d) - */ - __Pyx_XDECREF(__pyx_r); - - /* "owl/libowl.pyx":211 - * def relu_back(NArray diff, NArray top, NArray bottom): - * return _wrap_cpp_narray( - * m.ReluBackward( # <<<<<<<<<<<<<< - * deref(diff._d) - * , deref(top._d) - */ - try { - __pyx_t_1 = minerva::Elewise::ReluBackward((*__pyx_v_diff->_d), (*__pyx_v_top->_d), (*__pyx_v_bottom->_d)); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "owl/libowl.pyx":210 - * @staticmethod - * def relu_back(NArray diff, NArray top, NArray bottom): - * return _wrap_cpp_narray( # <<<<<<<<<<<<<< - * m.ReluBackward( - * deref(diff._d) - */ - __pyx_t_2 = ((PyObject *)__pyx_f_3owl_6libowl__wrap_cpp_narray(__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":209 - * - * @staticmethod - * def relu_back(NArray diff, NArray top, NArray bottom): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray( - * m.ReluBackward( - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("owl.libowl.NArray.relu_back", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":217 - * - * @staticmethod - * def tanh(NArray lhs): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray(m.TanhForward(deref(lhs._d))) - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_35tanh(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_3owl_6libowl_6NArray_35tanh = {"tanh", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_35tanh, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_3owl_6libowl_6NArray_35tanh(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_lhs = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("tanh (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_lhs,0}; - PyObject* values[1] = {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 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_lhs)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "tanh") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - } - __pyx_v_lhs = ((struct __pyx_obj_3owl_6libowl_NArray *)values[0]); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("tanh", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("owl.libowl.NArray.tanh", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lhs), __pyx_ptype_3owl_6libowl_NArray, 1, "lhs", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_3owl_6libowl_6NArray_34tanh(__pyx_v_lhs); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_6NArray_34tanh(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_lhs) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - minerva::NArray __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("tanh", 0); - - /* "owl/libowl.pyx":218 - * @staticmethod - * def tanh(NArray lhs): - * return _wrap_cpp_narray(m.TanhForward(deref(lhs._d))) # <<<<<<<<<<<<<< - * - * @staticmethod - */ - __Pyx_XDECREF(__pyx_r); - try { - __pyx_t_1 = minerva::Elewise::TanhForward((*__pyx_v_lhs->_d)); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_2 = ((PyObject *)__pyx_f_3owl_6libowl__wrap_cpp_narray(__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":217 - * - * @staticmethod - * def tanh(NArray lhs): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray(m.TanhForward(deref(lhs._d))) - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("owl.libowl.NArray.tanh", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":221 - * - * @staticmethod - * def tanh_back(NArray diff, NArray top, NArray bottom): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray( - * m.TanhBackward( - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_37tanh_back(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_3owl_6libowl_6NArray_37tanh_back = {"tanh_back", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_37tanh_back, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_3owl_6libowl_6NArray_37tanh_back(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_diff = 0; - struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_top = 0; - struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_bottom = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("tanh_back (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_diff,&__pyx_n_s_top,&__pyx_n_s_bottom,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); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_diff)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_top)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("tanh_back", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_bottom)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("tanh_back", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "tanh_back") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __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_diff = ((struct __pyx_obj_3owl_6libowl_NArray *)values[0]); - __pyx_v_top = ((struct __pyx_obj_3owl_6libowl_NArray *)values[1]); - __pyx_v_bottom = ((struct __pyx_obj_3owl_6libowl_NArray *)values[2]); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("tanh_back", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("owl.libowl.NArray.tanh_back", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_diff), __pyx_ptype_3owl_6libowl_NArray, 1, "diff", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_top), __pyx_ptype_3owl_6libowl_NArray, 1, "top", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_bottom), __pyx_ptype_3owl_6libowl_NArray, 1, "bottom", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_3owl_6libowl_6NArray_36tanh_back(__pyx_v_diff, __pyx_v_top, __pyx_v_bottom); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_6NArray_36tanh_back(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_diff, struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_top, struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_bottom) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - minerva::NArray __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("tanh_back", 0); - - /* "owl/libowl.pyx":222 - * @staticmethod - * def tanh_back(NArray diff, NArray top, NArray bottom): - * return _wrap_cpp_narray( # <<<<<<<<<<<<<< - * m.TanhBackward( - * deref(diff._d) - */ - __Pyx_XDECREF(__pyx_r); - - /* "owl/libowl.pyx":223 - * def tanh_back(NArray diff, NArray top, NArray bottom): - * return _wrap_cpp_narray( - * m.TanhBackward( # <<<<<<<<<<<<<< - * deref(diff._d) - * , deref(top._d) - */ - try { - __pyx_t_1 = minerva::Elewise::TanhBackward((*__pyx_v_diff->_d), (*__pyx_v_top->_d), (*__pyx_v_bottom->_d)); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "owl/libowl.pyx":222 - * @staticmethod - * def tanh_back(NArray diff, NArray top, NArray bottom): - * return _wrap_cpp_narray( # <<<<<<<<<<<<<< - * m.TanhBackward( - * deref(diff._d) - */ - __pyx_t_2 = ((PyObject *)__pyx_f_3owl_6libowl__wrap_cpp_narray(__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":221 - * - * @staticmethod - * def tanh_back(NArray diff, NArray top, NArray bottom): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray( - * m.TanhBackward( - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("owl.libowl.NArray.tanh_back", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":229 - * - * @staticmethod - * def conv_forward(NArray src, NArray filter, NArray bias, ConvInfo info): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray( - * m.ConvForward( - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_39conv_forward(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_3owl_6libowl_6NArray_39conv_forward = {"conv_forward", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_39conv_forward, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_3owl_6libowl_6NArray_39conv_forward(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_src = 0; - struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_filter = 0; - struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_bias = 0; - struct __pyx_obj_3owl_6libowl_ConvInfo *__pyx_v_info = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("conv_forward (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_src,&__pyx_n_s_filter,&__pyx_n_s_bias,&__pyx_n_s_info,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); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_src)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_filter)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("conv_forward", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_bias)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("conv_forward", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_info)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("conv_forward", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "conv_forward") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __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_src = ((struct __pyx_obj_3owl_6libowl_NArray *)values[0]); - __pyx_v_filter = ((struct __pyx_obj_3owl_6libowl_NArray *)values[1]); - __pyx_v_bias = ((struct __pyx_obj_3owl_6libowl_NArray *)values[2]); - __pyx_v_info = ((struct __pyx_obj_3owl_6libowl_ConvInfo *)values[3]); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("conv_forward", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("owl.libowl.NArray.conv_forward", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_src), __pyx_ptype_3owl_6libowl_NArray, 1, "src", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filter), __pyx_ptype_3owl_6libowl_NArray, 1, "filter", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_bias), __pyx_ptype_3owl_6libowl_NArray, 1, "bias", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_info), __pyx_ptype_3owl_6libowl_ConvInfo, 1, "info", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_3owl_6libowl_6NArray_38conv_forward(__pyx_v_src, __pyx_v_filter, __pyx_v_bias, __pyx_v_info); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_6NArray_38conv_forward(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_src, struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_filter, struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_bias, struct __pyx_obj_3owl_6libowl_ConvInfo *__pyx_v_info) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - minerva::NArray __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("conv_forward", 0); - - /* "owl/libowl.pyx":230 - * @staticmethod - * def conv_forward(NArray src, NArray filter, NArray bias, ConvInfo info): - * return _wrap_cpp_narray( # <<<<<<<<<<<<<< - * m.ConvForward( - * deref(src._d) - */ - __Pyx_XDECREF(__pyx_r); - - /* "owl/libowl.pyx":231 - * def conv_forward(NArray src, NArray filter, NArray bias, ConvInfo info): - * return _wrap_cpp_narray( - * m.ConvForward( # <<<<<<<<<<<<<< - * deref(src._d) - * , deref(filter._d) - */ - try { - __pyx_t_1 = minerva::Convolution::ConvForward((*__pyx_v_src->_d), (*__pyx_v_filter->_d), (*__pyx_v_bias->_d), (*__pyx_v_info->_d)); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "owl/libowl.pyx":230 - * @staticmethod - * def conv_forward(NArray src, NArray filter, NArray bias, ConvInfo info): - * return _wrap_cpp_narray( # <<<<<<<<<<<<<< - * m.ConvForward( - * deref(src._d) - */ - __pyx_t_2 = ((PyObject *)__pyx_f_3owl_6libowl__wrap_cpp_narray(__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":229 - * - * @staticmethod - * def conv_forward(NArray src, NArray filter, NArray bias, ConvInfo info): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray( - * m.ConvForward( - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("owl.libowl.NArray.conv_forward", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":238 - * - * @staticmethod - * def conv_backward_data( # <<<<<<<<<<<<<< - * NArray diff, NArray bottom, NArray filter, ConvInfo info): - * return _wrap_cpp_narray( - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_41conv_backward_data(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_3owl_6libowl_6NArray_41conv_backward_data = {"conv_backward_data", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_41conv_backward_data, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_3owl_6libowl_6NArray_41conv_backward_data(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_diff = 0; - struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_bottom = 0; - struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_filter = 0; - struct __pyx_obj_3owl_6libowl_ConvInfo *__pyx_v_info = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("conv_backward_data (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_diff,&__pyx_n_s_bottom,&__pyx_n_s_filter,&__pyx_n_s_info,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); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_diff)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_bottom)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("conv_backward_data", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_filter)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("conv_backward_data", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_info)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("conv_backward_data", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "conv_backward_data") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __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_diff = ((struct __pyx_obj_3owl_6libowl_NArray *)values[0]); - __pyx_v_bottom = ((struct __pyx_obj_3owl_6libowl_NArray *)values[1]); - __pyx_v_filter = ((struct __pyx_obj_3owl_6libowl_NArray *)values[2]); - __pyx_v_info = ((struct __pyx_obj_3owl_6libowl_ConvInfo *)values[3]); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("conv_backward_data", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("owl.libowl.NArray.conv_backward_data", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_diff), __pyx_ptype_3owl_6libowl_NArray, 1, "diff", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_bottom), __pyx_ptype_3owl_6libowl_NArray, 1, "bottom", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filter), __pyx_ptype_3owl_6libowl_NArray, 1, "filter", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_info), __pyx_ptype_3owl_6libowl_ConvInfo, 1, "info", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_3owl_6libowl_6NArray_40conv_backward_data(__pyx_v_diff, __pyx_v_bottom, __pyx_v_filter, __pyx_v_info); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_6NArray_40conv_backward_data(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_diff, struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_bottom, struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_filter, struct __pyx_obj_3owl_6libowl_ConvInfo *__pyx_v_info) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - minerva::NArray __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("conv_backward_data", 0); - - /* "owl/libowl.pyx":240 - * def conv_backward_data( - * NArray diff, NArray bottom, NArray filter, ConvInfo info): - * return _wrap_cpp_narray( # <<<<<<<<<<<<<< - * m.ConvBackwardData( - * deref(diff._d) - */ - __Pyx_XDECREF(__pyx_r); - - /* "owl/libowl.pyx":241 - * NArray diff, NArray bottom, NArray filter, ConvInfo info): - * return _wrap_cpp_narray( - * m.ConvBackwardData( # <<<<<<<<<<<<<< - * deref(diff._d) - * , deref(bottom._d) - */ - try { - __pyx_t_1 = minerva::Convolution::ConvBackwardData((*__pyx_v_diff->_d), (*__pyx_v_bottom->_d), (*__pyx_v_filter->_d), (*__pyx_v_info->_d)); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "owl/libowl.pyx":240 - * def conv_backward_data( - * NArray diff, NArray bottom, NArray filter, ConvInfo info): - * return _wrap_cpp_narray( # <<<<<<<<<<<<<< - * m.ConvBackwardData( - * deref(diff._d) - */ - __pyx_t_2 = ((PyObject *)__pyx_f_3owl_6libowl__wrap_cpp_narray(__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":238 - * - * @staticmethod - * def conv_backward_data( # <<<<<<<<<<<<<< - * NArray diff, NArray bottom, NArray filter, ConvInfo info): - * return _wrap_cpp_narray( - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("owl.libowl.NArray.conv_backward_data", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":248 - * - * @staticmethod - * def conv_backward_filter( # <<<<<<<<<<<<<< - * NArray diff, NArray bottom, NArray filter, ConvInfo info): - * return _wrap_cpp_narray( - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_43conv_backward_filter(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_3owl_6libowl_6NArray_43conv_backward_filter = {"conv_backward_filter", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_43conv_backward_filter, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_3owl_6libowl_6NArray_43conv_backward_filter(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_diff = 0; - struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_bottom = 0; - struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_filter = 0; - struct __pyx_obj_3owl_6libowl_ConvInfo *__pyx_v_info = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("conv_backward_filter (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_diff,&__pyx_n_s_bottom,&__pyx_n_s_filter,&__pyx_n_s_info,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); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_diff)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_bottom)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("conv_backward_filter", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_filter)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("conv_backward_filter", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_info)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("conv_backward_filter", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "conv_backward_filter") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __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_diff = ((struct __pyx_obj_3owl_6libowl_NArray *)values[0]); - __pyx_v_bottom = ((struct __pyx_obj_3owl_6libowl_NArray *)values[1]); - __pyx_v_filter = ((struct __pyx_obj_3owl_6libowl_NArray *)values[2]); - __pyx_v_info = ((struct __pyx_obj_3owl_6libowl_ConvInfo *)values[3]); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("conv_backward_filter", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("owl.libowl.NArray.conv_backward_filter", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_diff), __pyx_ptype_3owl_6libowl_NArray, 1, "diff", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_bottom), __pyx_ptype_3owl_6libowl_NArray, 1, "bottom", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filter), __pyx_ptype_3owl_6libowl_NArray, 1, "filter", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_info), __pyx_ptype_3owl_6libowl_ConvInfo, 1, "info", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_3owl_6libowl_6NArray_42conv_backward_filter(__pyx_v_diff, __pyx_v_bottom, __pyx_v_filter, __pyx_v_info); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_6NArray_42conv_backward_filter(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_diff, struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_bottom, struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_filter, struct __pyx_obj_3owl_6libowl_ConvInfo *__pyx_v_info) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - minerva::NArray __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("conv_backward_filter", 0); - - /* "owl/libowl.pyx":250 - * def conv_backward_filter( - * NArray diff, NArray bottom, NArray filter, ConvInfo info): - * return _wrap_cpp_narray( # <<<<<<<<<<<<<< - * m.ConvBackwardFilter( - * deref(diff._d) - */ - __Pyx_XDECREF(__pyx_r); - - /* "owl/libowl.pyx":251 - * NArray diff, NArray bottom, NArray filter, ConvInfo info): - * return _wrap_cpp_narray( - * m.ConvBackwardFilter( # <<<<<<<<<<<<<< - * deref(diff._d) - * , deref(bottom._d) - */ - try { - __pyx_t_1 = minerva::Convolution::ConvBackwardFilter((*__pyx_v_diff->_d), (*__pyx_v_bottom->_d), (*__pyx_v_filter->_d), (*__pyx_v_info->_d)); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "owl/libowl.pyx":250 - * def conv_backward_filter( - * NArray diff, NArray bottom, NArray filter, ConvInfo info): - * return _wrap_cpp_narray( # <<<<<<<<<<<<<< - * m.ConvBackwardFilter( - * deref(diff._d) - */ - __pyx_t_2 = ((PyObject *)__pyx_f_3owl_6libowl__wrap_cpp_narray(__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":248 - * - * @staticmethod - * def conv_backward_filter( # <<<<<<<<<<<<<< - * NArray diff, NArray bottom, NArray filter, ConvInfo info): - * return _wrap_cpp_narray( - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("owl.libowl.NArray.conv_backward_filter", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":258 - * - * @staticmethod - * def conv_backward_bias(NArray diff): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray(m.ConvBackwardBias(deref(diff._d))); - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_45conv_backward_bias(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_3owl_6libowl_6NArray_45conv_backward_bias = {"conv_backward_bias", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_45conv_backward_bias, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_3owl_6libowl_6NArray_45conv_backward_bias(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_diff = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("conv_backward_bias (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_diff,0}; - PyObject* values[1] = {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 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_diff)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "conv_backward_bias") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - } - __pyx_v_diff = ((struct __pyx_obj_3owl_6libowl_NArray *)values[0]); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("conv_backward_bias", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("owl.libowl.NArray.conv_backward_bias", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_diff), __pyx_ptype_3owl_6libowl_NArray, 1, "diff", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_3owl_6libowl_6NArray_44conv_backward_bias(__pyx_v_diff); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_6NArray_44conv_backward_bias(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_diff) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - minerva::NArray __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("conv_backward_bias", 0); - - /* "owl/libowl.pyx":259 - * @staticmethod - * def conv_backward_bias(NArray diff): - * return _wrap_cpp_narray(m.ConvBackwardBias(deref(diff._d))); # <<<<<<<<<<<<<< - * - * @staticmethod - */ - __Pyx_XDECREF(__pyx_r); - try { - __pyx_t_1 = minerva::Convolution::ConvBackwardBias((*__pyx_v_diff->_d)); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_2 = ((PyObject *)__pyx_f_3owl_6libowl__wrap_cpp_narray(__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":258 - * - * @staticmethod - * def conv_backward_bias(NArray diff): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray(m.ConvBackwardBias(deref(diff._d))); - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("owl.libowl.NArray.conv_backward_bias", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":262 - * - * @staticmethod - * def softmax_forward(NArray src, SoftmaxAlgorithmWrapper algo): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray( - * m.SoftmaxForward( - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_47softmax_forward(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_3owl_6libowl_6NArray_47softmax_forward = {"softmax_forward", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_47softmax_forward, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_3owl_6libowl_6NArray_47softmax_forward(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_src = 0; - struct __pyx_obj_3owl_6libowl_SoftmaxAlgorithmWrapper *__pyx_v_algo = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("softmax_forward (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_src,&__pyx_n_s_algo,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); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_src)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_algo)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("softmax_forward", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "softmax_forward") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __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_src = ((struct __pyx_obj_3owl_6libowl_NArray *)values[0]); - __pyx_v_algo = ((struct __pyx_obj_3owl_6libowl_SoftmaxAlgorithmWrapper *)values[1]); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("softmax_forward", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("owl.libowl.NArray.softmax_forward", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_src), __pyx_ptype_3owl_6libowl_NArray, 1, "src", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_algo), __pyx_ptype_3owl_6libowl_SoftmaxAlgorithmWrapper, 1, "algo", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_3owl_6libowl_6NArray_46softmax_forward(__pyx_v_src, __pyx_v_algo); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_6NArray_46softmax_forward(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_src, struct __pyx_obj_3owl_6libowl_SoftmaxAlgorithmWrapper *__pyx_v_algo) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - minerva::SoftmaxAlgorithm __pyx_t_1; - minerva::NArray __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("softmax_forward", 0); - - /* "owl/libowl.pyx":263 - * @staticmethod - * def softmax_forward(NArray src, SoftmaxAlgorithmWrapper algo): - * return _wrap_cpp_narray( # <<<<<<<<<<<<<< - * m.SoftmaxForward( - * deref(src._d) - */ - __Pyx_XDECREF(__pyx_r); - - /* "owl/libowl.pyx":266 - * m.SoftmaxForward( - * deref(src._d) - * , m.ToSoftmaxAlgorithm(algo._d))); # <<<<<<<<<<<<<< - * - * @staticmethod - */ - try { - __pyx_t_1 = libowl::ToEvilEnumClass(__pyx_v_algo->_d); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "owl/libowl.pyx":264 - * def softmax_forward(NArray src, SoftmaxAlgorithmWrapper algo): - * return _wrap_cpp_narray( - * m.SoftmaxForward( # <<<<<<<<<<<<<< - * deref(src._d) - * , m.ToSoftmaxAlgorithm(algo._d))); - */ - try { - __pyx_t_2 = minerva::Convolution::SoftmaxForward((*__pyx_v_src->_d), __pyx_t_1); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "owl/libowl.pyx":263 - * @staticmethod - * def softmax_forward(NArray src, SoftmaxAlgorithmWrapper algo): - * return _wrap_cpp_narray( # <<<<<<<<<<<<<< - * m.SoftmaxForward( - * deref(src._d) - */ - __pyx_t_3 = ((PyObject *)__pyx_f_3owl_6libowl__wrap_cpp_narray(__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":262 - * - * @staticmethod - * def softmax_forward(NArray src, SoftmaxAlgorithmWrapper algo): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray( - * m.SoftmaxForward( - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("owl.libowl.NArray.softmax_forward", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":269 - * - * @staticmethod - * def softmax_backward(NArray diff, NArray top, SoftmaxAlgorithmWrapper algo): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray( - * m.SoftmaxBackward( - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_49softmax_backward(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_3owl_6libowl_6NArray_49softmax_backward = {"softmax_backward", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_49softmax_backward, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_3owl_6libowl_6NArray_49softmax_backward(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_diff = 0; - struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_top = 0; - struct __pyx_obj_3owl_6libowl_SoftmaxAlgorithmWrapper *__pyx_v_algo = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("softmax_backward (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_diff,&__pyx_n_s_top,&__pyx_n_s_algo,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); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_diff)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_top)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("softmax_backward", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_algo)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("softmax_backward", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "softmax_backward") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __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_diff = ((struct __pyx_obj_3owl_6libowl_NArray *)values[0]); - __pyx_v_top = ((struct __pyx_obj_3owl_6libowl_NArray *)values[1]); - __pyx_v_algo = ((struct __pyx_obj_3owl_6libowl_SoftmaxAlgorithmWrapper *)values[2]); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("softmax_backward", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("owl.libowl.NArray.softmax_backward", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_diff), __pyx_ptype_3owl_6libowl_NArray, 1, "diff", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_top), __pyx_ptype_3owl_6libowl_NArray, 1, "top", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_algo), __pyx_ptype_3owl_6libowl_SoftmaxAlgorithmWrapper, 1, "algo", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_3owl_6libowl_6NArray_48softmax_backward(__pyx_v_diff, __pyx_v_top, __pyx_v_algo); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_6NArray_48softmax_backward(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_diff, struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_top, struct __pyx_obj_3owl_6libowl_SoftmaxAlgorithmWrapper *__pyx_v_algo) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - minerva::SoftmaxAlgorithm __pyx_t_1; - minerva::NArray __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("softmax_backward", 0); - - /* "owl/libowl.pyx":270 - * @staticmethod - * def softmax_backward(NArray diff, NArray top, SoftmaxAlgorithmWrapper algo): - * return _wrap_cpp_narray( # <<<<<<<<<<<<<< - * m.SoftmaxBackward( - * deref(diff._d) - */ - __Pyx_XDECREF(__pyx_r); - - /* "owl/libowl.pyx":274 - * deref(diff._d) - * , deref(top._d) - * , m.ToSoftmaxAlgorithm(algo._d))); # <<<<<<<<<<<<<< - * - * @staticmethod - */ - try { - __pyx_t_1 = libowl::ToEvilEnumClass(__pyx_v_algo->_d); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "owl/libowl.pyx":271 - * def softmax_backward(NArray diff, NArray top, SoftmaxAlgorithmWrapper algo): - * return _wrap_cpp_narray( - * m.SoftmaxBackward( # <<<<<<<<<<<<<< - * deref(diff._d) - * , deref(top._d) - */ - try { - __pyx_t_2 = minerva::Convolution::SoftmaxBackward((*__pyx_v_diff->_d), (*__pyx_v_top->_d), __pyx_t_1); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "owl/libowl.pyx":270 - * @staticmethod - * def softmax_backward(NArray diff, NArray top, SoftmaxAlgorithmWrapper algo): - * return _wrap_cpp_narray( # <<<<<<<<<<<<<< - * m.SoftmaxBackward( - * deref(diff._d) - */ - __pyx_t_3 = ((PyObject *)__pyx_f_3owl_6libowl__wrap_cpp_narray(__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":269 - * - * @staticmethod - * def softmax_backward(NArray diff, NArray top, SoftmaxAlgorithmWrapper algo): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray( - * m.SoftmaxBackward( - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("owl.libowl.NArray.softmax_backward", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":277 - * - * @staticmethod - * def activation_forward(NArray src, ActivationAlgorithmWrapper algo): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray( - * m.ActivationForward( - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_51activation_forward(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_3owl_6libowl_6NArray_51activation_forward = {"activation_forward", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_51activation_forward, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_3owl_6libowl_6NArray_51activation_forward(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_src = 0; - struct __pyx_obj_3owl_6libowl_ActivationAlgorithmWrapper *__pyx_v_algo = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("activation_forward (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_src,&__pyx_n_s_algo,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); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_src)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_algo)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("activation_forward", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "activation_forward") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __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_src = ((struct __pyx_obj_3owl_6libowl_NArray *)values[0]); - __pyx_v_algo = ((struct __pyx_obj_3owl_6libowl_ActivationAlgorithmWrapper *)values[1]); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("activation_forward", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("owl.libowl.NArray.activation_forward", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_src), __pyx_ptype_3owl_6libowl_NArray, 1, "src", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_algo), __pyx_ptype_3owl_6libowl_ActivationAlgorithmWrapper, 1, "algo", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_3owl_6libowl_6NArray_50activation_forward(__pyx_v_src, __pyx_v_algo); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_6NArray_50activation_forward(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_src, struct __pyx_obj_3owl_6libowl_ActivationAlgorithmWrapper *__pyx_v_algo) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - minerva::ActivationAlgorithm __pyx_t_1; - minerva::NArray __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("activation_forward", 0); - - /* "owl/libowl.pyx":278 - * @staticmethod - * def activation_forward(NArray src, ActivationAlgorithmWrapper algo): - * return _wrap_cpp_narray( # <<<<<<<<<<<<<< - * m.ActivationForward( - * deref(src._d) - */ - __Pyx_XDECREF(__pyx_r); - - /* "owl/libowl.pyx":281 - * m.ActivationForward( - * deref(src._d) - * , m.ToActivationAlgorithm(algo._d))); # <<<<<<<<<<<<<< - * - * @staticmethod - */ - try { - __pyx_t_1 = libowl::ToEvilEnumClass(__pyx_v_algo->_d); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "owl/libowl.pyx":279 - * def activation_forward(NArray src, ActivationAlgorithmWrapper algo): - * return _wrap_cpp_narray( - * m.ActivationForward( # <<<<<<<<<<<<<< - * deref(src._d) - * , m.ToActivationAlgorithm(algo._d))); - */ - try { - __pyx_t_2 = minerva::Convolution::ActivationForward((*__pyx_v_src->_d), __pyx_t_1); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "owl/libowl.pyx":278 - * @staticmethod - * def activation_forward(NArray src, ActivationAlgorithmWrapper algo): - * return _wrap_cpp_narray( # <<<<<<<<<<<<<< - * m.ActivationForward( - * deref(src._d) - */ - __pyx_t_3 = ((PyObject *)__pyx_f_3owl_6libowl__wrap_cpp_narray(__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":277 - * - * @staticmethod - * def activation_forward(NArray src, ActivationAlgorithmWrapper algo): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray( - * m.ActivationForward( - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("owl.libowl.NArray.activation_forward", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":284 - * - * @staticmethod - * def activation_backward( # <<<<<<<<<<<<<< - * NArray diff - * , NArray top - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_53activation_backward(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_3owl_6libowl_6NArray_53activation_backward = {"activation_backward", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_53activation_backward, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_3owl_6libowl_6NArray_53activation_backward(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_diff = 0; - struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_top = 0; - struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_bottom = 0; - struct __pyx_obj_3owl_6libowl_ActivationAlgorithmWrapper *__pyx_v_algo = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("activation_backward (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_diff,&__pyx_n_s_top,&__pyx_n_s_bottom,&__pyx_n_s_algo,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); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_diff)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_top)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("activation_backward", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_bottom)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("activation_backward", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_algo)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("activation_backward", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "activation_backward") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __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_diff = ((struct __pyx_obj_3owl_6libowl_NArray *)values[0]); - __pyx_v_top = ((struct __pyx_obj_3owl_6libowl_NArray *)values[1]); - __pyx_v_bottom = ((struct __pyx_obj_3owl_6libowl_NArray *)values[2]); - __pyx_v_algo = ((struct __pyx_obj_3owl_6libowl_ActivationAlgorithmWrapper *)values[3]); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("activation_backward", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("owl.libowl.NArray.activation_backward", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_diff), __pyx_ptype_3owl_6libowl_NArray, 1, "diff", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_top), __pyx_ptype_3owl_6libowl_NArray, 1, "top", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_bottom), __pyx_ptype_3owl_6libowl_NArray, 1, "bottom", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_algo), __pyx_ptype_3owl_6libowl_ActivationAlgorithmWrapper, 1, "algo", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_3owl_6libowl_6NArray_52activation_backward(__pyx_v_diff, __pyx_v_top, __pyx_v_bottom, __pyx_v_algo); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_6NArray_52activation_backward(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_diff, struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_top, struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_bottom, struct __pyx_obj_3owl_6libowl_ActivationAlgorithmWrapper *__pyx_v_algo) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - minerva::ActivationAlgorithm __pyx_t_1; - minerva::NArray __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("activation_backward", 0); - - /* "owl/libowl.pyx":289 - * , NArray bottom - * , ActivationAlgorithmWrapper algo): - * return _wrap_cpp_narray( # <<<<<<<<<<<<<< - * m.ActivationBackward( - * deref(diff._d) - */ - __Pyx_XDECREF(__pyx_r); - - /* "owl/libowl.pyx":294 - * , deref(top._d) - * , deref(bottom._d) - * , m.ToActivationAlgorithm(algo._d))); # <<<<<<<<<<<<<< - * - * @staticmethod - */ - try { - __pyx_t_1 = libowl::ToEvilEnumClass(__pyx_v_algo->_d); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "owl/libowl.pyx":290 - * , ActivationAlgorithmWrapper algo): - * return _wrap_cpp_narray( - * m.ActivationBackward( # <<<<<<<<<<<<<< - * deref(diff._d) - * , deref(top._d) - */ - try { - __pyx_t_2 = minerva::Convolution::ActivationBackward((*__pyx_v_diff->_d), (*__pyx_v_top->_d), (*__pyx_v_bottom->_d), __pyx_t_1); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "owl/libowl.pyx":289 - * , NArray bottom - * , ActivationAlgorithmWrapper algo): - * return _wrap_cpp_narray( # <<<<<<<<<<<<<< - * m.ActivationBackward( - * deref(diff._d) - */ - __pyx_t_3 = ((PyObject *)__pyx_f_3owl_6libowl__wrap_cpp_narray(__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":284 - * - * @staticmethod - * def activation_backward( # <<<<<<<<<<<<<< - * NArray diff - * , NArray top - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("owl.libowl.NArray.activation_backward", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":297 - * - * @staticmethod - * def pooling_forward(NArray src, PoolingInfo algo): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray( - * m.PoolingForward( - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_55pooling_forward(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_3owl_6libowl_6NArray_55pooling_forward = {"pooling_forward", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_55pooling_forward, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_3owl_6libowl_6NArray_55pooling_forward(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_src = 0; - struct __pyx_obj_3owl_6libowl_PoolingInfo *__pyx_v_algo = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("pooling_forward (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_src,&__pyx_n_s_algo,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); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_src)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_algo)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("pooling_forward", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pooling_forward") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __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_src = ((struct __pyx_obj_3owl_6libowl_NArray *)values[0]); - __pyx_v_algo = ((struct __pyx_obj_3owl_6libowl_PoolingInfo *)values[1]); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("pooling_forward", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("owl.libowl.NArray.pooling_forward", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_src), __pyx_ptype_3owl_6libowl_NArray, 1, "src", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_algo), __pyx_ptype_3owl_6libowl_PoolingInfo, 1, "algo", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_3owl_6libowl_6NArray_54pooling_forward(__pyx_v_src, __pyx_v_algo); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_6NArray_54pooling_forward(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_src, struct __pyx_obj_3owl_6libowl_PoolingInfo *__pyx_v_algo) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - minerva::NArray __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("pooling_forward", 0); - - /* "owl/libowl.pyx":298 - * @staticmethod - * def pooling_forward(NArray src, PoolingInfo algo): - * return _wrap_cpp_narray( # <<<<<<<<<<<<<< - * m.PoolingForward( - * deref(src._d) - */ - __Pyx_XDECREF(__pyx_r); - - /* "owl/libowl.pyx":299 - * def pooling_forward(NArray src, PoolingInfo algo): - * return _wrap_cpp_narray( - * m.PoolingForward( # <<<<<<<<<<<<<< - * deref(src._d) - * , deref(algo._d))); - */ - try { - __pyx_t_1 = minerva::Convolution::PoolingForward((*__pyx_v_src->_d), (*__pyx_v_algo->_d)); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "owl/libowl.pyx":298 - * @staticmethod - * def pooling_forward(NArray src, PoolingInfo algo): - * return _wrap_cpp_narray( # <<<<<<<<<<<<<< - * m.PoolingForward( - * deref(src._d) - */ - __pyx_t_2 = ((PyObject *)__pyx_f_3owl_6libowl__wrap_cpp_narray(__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":297 - * - * @staticmethod - * def pooling_forward(NArray src, PoolingInfo algo): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray( - * m.PoolingForward( - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("owl.libowl.NArray.pooling_forward", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":304 - * - * @staticmethod - * def pooling_backward( # <<<<<<<<<<<<<< - * NArray diff - * , NArray top - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_57pooling_backward(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_3owl_6libowl_6NArray_57pooling_backward = {"pooling_backward", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_57pooling_backward, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_3owl_6libowl_6NArray_57pooling_backward(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_diff = 0; - struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_top = 0; - struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_bottom = 0; - struct __pyx_obj_3owl_6libowl_PoolingInfo *__pyx_v_algo = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("pooling_backward (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_diff,&__pyx_n_s_top,&__pyx_n_s_bottom,&__pyx_n_s_algo,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); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_diff)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_top)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("pooling_backward", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_bottom)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("pooling_backward", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_algo)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("pooling_backward", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pooling_backward") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __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_diff = ((struct __pyx_obj_3owl_6libowl_NArray *)values[0]); - __pyx_v_top = ((struct __pyx_obj_3owl_6libowl_NArray *)values[1]); - __pyx_v_bottom = ((struct __pyx_obj_3owl_6libowl_NArray *)values[2]); - __pyx_v_algo = ((struct __pyx_obj_3owl_6libowl_PoolingInfo *)values[3]); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("pooling_backward", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("owl.libowl.NArray.pooling_backward", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_diff), __pyx_ptype_3owl_6libowl_NArray, 1, "diff", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_top), __pyx_ptype_3owl_6libowl_NArray, 1, "top", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_bottom), __pyx_ptype_3owl_6libowl_NArray, 1, "bottom", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_algo), __pyx_ptype_3owl_6libowl_PoolingInfo, 1, "algo", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_3owl_6libowl_6NArray_56pooling_backward(__pyx_v_diff, __pyx_v_top, __pyx_v_bottom, __pyx_v_algo); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_6NArray_56pooling_backward(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_diff, struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_top, struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_bottom, struct __pyx_obj_3owl_6libowl_PoolingInfo *__pyx_v_algo) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - minerva::NArray __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("pooling_backward", 0); - - /* "owl/libowl.pyx":309 - * , NArray bottom - * , PoolingInfo algo): - * return _wrap_cpp_narray( # <<<<<<<<<<<<<< - * m.PoolingBackward( - * deref(diff._d) - */ - __Pyx_XDECREF(__pyx_r); - - /* "owl/libowl.pyx":310 - * , PoolingInfo algo): - * return _wrap_cpp_narray( - * m.PoolingBackward( # <<<<<<<<<<<<<< - * deref(diff._d) - * , deref(top._d) - */ - try { - __pyx_t_1 = minerva::Convolution::PoolingBackward((*__pyx_v_diff->_d), (*__pyx_v_top->_d), (*__pyx_v_bottom->_d), (*__pyx_v_algo->_d)); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "owl/libowl.pyx":309 - * , NArray bottom - * , PoolingInfo algo): - * return _wrap_cpp_narray( # <<<<<<<<<<<<<< - * m.PoolingBackward( - * deref(diff._d) - */ - __pyx_t_2 = ((PyObject *)__pyx_f_3owl_6libowl__wrap_cpp_narray(__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":304 - * - * @staticmethod - * def pooling_backward( # <<<<<<<<<<<<<< - * NArray diff - * , NArray top - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("owl.libowl.NArray.pooling_backward", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":317 - * - * @staticmethod - * def lrn_forward(NArray src, NArray scale, int local_size, float a, float b): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray( - * m.LRNForward( - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_59lrn_forward(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_3owl_6libowl_6NArray_59lrn_forward = {"lrn_forward", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_59lrn_forward, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_3owl_6libowl_6NArray_59lrn_forward(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_src = 0; - struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_scale = 0; - int __pyx_v_local_size; - float __pyx_v_a; - float __pyx_v_b; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("lrn_forward (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_src,&__pyx_n_s_scale,&__pyx_n_s_local_size,&__pyx_n_s_a,&__pyx_n_s_b,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); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_src)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_scale)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("lrn_forward", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_local_size)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("lrn_forward", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_a)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("lrn_forward", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 4: - if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_b)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("lrn_forward", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lrn_forward") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __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_src = ((struct __pyx_obj_3owl_6libowl_NArray *)values[0]); - __pyx_v_scale = ((struct __pyx_obj_3owl_6libowl_NArray *)values[1]); - __pyx_v_local_size = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_local_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_a = __pyx_PyFloat_AsFloat(values[3]); if (unlikely((__pyx_v_a == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_b = __pyx_PyFloat_AsFloat(values[4]); if (unlikely((__pyx_v_b == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("lrn_forward", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("owl.libowl.NArray.lrn_forward", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_src), __pyx_ptype_3owl_6libowl_NArray, 1, "src", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_scale), __pyx_ptype_3owl_6libowl_NArray, 1, "scale", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_3owl_6libowl_6NArray_58lrn_forward(__pyx_v_src, __pyx_v_scale, __pyx_v_local_size, __pyx_v_a, __pyx_v_b); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_6NArray_58lrn_forward(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_src, struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_scale, int __pyx_v_local_size, float __pyx_v_a, float __pyx_v_b) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - minerva::NArray __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("lrn_forward", 0); - - /* "owl/libowl.pyx":318 - * @staticmethod - * def lrn_forward(NArray src, NArray scale, int local_size, float a, float b): - * return _wrap_cpp_narray( # <<<<<<<<<<<<<< - * m.LRNForward( - * deref(src._d) - */ - __Pyx_XDECREF(__pyx_r); - - /* "owl/libowl.pyx":319 - * def lrn_forward(NArray src, NArray scale, int local_size, float a, float b): - * return _wrap_cpp_narray( - * m.LRNForward( # <<<<<<<<<<<<<< - * deref(src._d) - * , deref(scale._d) - */ - try { - __pyx_t_1 = minerva::Convolution::LRNForward((*__pyx_v_src->_d), (*__pyx_v_scale->_d), __pyx_v_local_size, __pyx_v_a, __pyx_v_b); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "owl/libowl.pyx":318 - * @staticmethod - * def lrn_forward(NArray src, NArray scale, int local_size, float a, float b): - * return _wrap_cpp_narray( # <<<<<<<<<<<<<< - * m.LRNForward( - * deref(src._d) - */ - __pyx_t_2 = ((PyObject *)__pyx_f_3owl_6libowl__wrap_cpp_narray(__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":317 - * - * @staticmethod - * def lrn_forward(NArray src, NArray scale, int local_size, float a, float b): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray( - * m.LRNForward( - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("owl.libowl.NArray.lrn_forward", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":327 - * - * @staticmethod - * def lrn_backward( # <<<<<<<<<<<<<< - * NArray bottom_data - * , NArray top_data - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_61lrn_backward(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_3owl_6libowl_6NArray_61lrn_backward = {"lrn_backward", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_61lrn_backward, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_3owl_6libowl_6NArray_61lrn_backward(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_bottom_data = 0; - struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_top_data = 0; - struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_scale = 0; - struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_top_diff = 0; - int __pyx_v_local_size; - float __pyx_v_a; - float __pyx_v_b; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("lrn_backward (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_bottom_data,&__pyx_n_s_top_data,&__pyx_n_s_scale,&__pyx_n_s_top_diff,&__pyx_n_s_local_size,&__pyx_n_s_a,&__pyx_n_s_b,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); - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_bottom_data)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_top_data)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("lrn_backward", 1, 7, 7, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_scale)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("lrn_backward", 1, 7, 7, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_top_diff)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("lrn_backward", 1, 7, 7, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 4: - if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_local_size)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("lrn_backward", 1, 7, 7, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 5: - if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_a)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("lrn_backward", 1, 7, 7, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 6: - if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_b)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("lrn_backward", 1, 7, 7, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lrn_backward") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __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_bottom_data = ((struct __pyx_obj_3owl_6libowl_NArray *)values[0]); - __pyx_v_top_data = ((struct __pyx_obj_3owl_6libowl_NArray *)values[1]); - __pyx_v_scale = ((struct __pyx_obj_3owl_6libowl_NArray *)values[2]); - __pyx_v_top_diff = ((struct __pyx_obj_3owl_6libowl_NArray *)values[3]); - __pyx_v_local_size = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_local_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_a = __pyx_PyFloat_AsFloat(values[5]); if (unlikely((__pyx_v_a == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_b = __pyx_PyFloat_AsFloat(values[6]); if (unlikely((__pyx_v_b == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("lrn_backward", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("owl.libowl.NArray.lrn_backward", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_bottom_data), __pyx_ptype_3owl_6libowl_NArray, 1, "bottom_data", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_top_data), __pyx_ptype_3owl_6libowl_NArray, 1, "top_data", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_scale), __pyx_ptype_3owl_6libowl_NArray, 1, "scale", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_top_diff), __pyx_ptype_3owl_6libowl_NArray, 1, "top_diff", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_3owl_6libowl_6NArray_60lrn_backward(__pyx_v_bottom_data, __pyx_v_top_data, __pyx_v_scale, __pyx_v_top_diff, __pyx_v_local_size, __pyx_v_a, __pyx_v_b); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_6NArray_60lrn_backward(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_bottom_data, struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_top_data, struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_scale, struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_top_diff, int __pyx_v_local_size, float __pyx_v_a, float __pyx_v_b) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - minerva::NArray __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("lrn_backward", 0); - - /* "owl/libowl.pyx":335 - * , float a - * , float b): - * return _wrap_cpp_narray( # <<<<<<<<<<<<<< - * m.LRNBackward( - * deref(bottom_data._d) - */ - __Pyx_XDECREF(__pyx_r); - - /* "owl/libowl.pyx":336 - * , float b): - * return _wrap_cpp_narray( - * m.LRNBackward( # <<<<<<<<<<<<<< - * deref(bottom_data._d) - * , deref(top_data._d) - */ - try { - __pyx_t_1 = minerva::Convolution::LRNBackward((*__pyx_v_bottom_data->_d), (*__pyx_v_top_data->_d), (*__pyx_v_scale->_d), (*__pyx_v_top_diff->_d), __pyx_v_local_size, __pyx_v_a, __pyx_v_b); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "owl/libowl.pyx":335 - * , float a - * , float b): - * return _wrap_cpp_narray( # <<<<<<<<<<<<<< - * m.LRNBackward( - * deref(bottom_data._d) - */ - __pyx_t_2 = ((PyObject *)__pyx_f_3owl_6libowl__wrap_cpp_narray(__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":327 - * - * @staticmethod - * def lrn_backward( # <<<<<<<<<<<<<< - * NArray bottom_data - * , NArray top_data - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("owl.libowl.NArray.lrn_backward", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":345 - * , b)); - * - * def sum(self, rhs): # <<<<<<<<<<<<<< - * cdef int i - * cdef vector[int] v - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_63sum(PyObject *__pyx_v_self, PyObject *__pyx_v_rhs); /*proto*/ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_63sum(PyObject *__pyx_v_self, PyObject *__pyx_v_rhs) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("sum (wrapper)", 0); - __pyx_r = __pyx_pf_3owl_6libowl_6NArray_62sum(((struct __pyx_obj_3owl_6libowl_NArray *)__pyx_v_self), ((PyObject *)__pyx_v_rhs)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_6NArray_62sum(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_self, PyObject *__pyx_v_rhs) { - int __pyx_v_i; - std::vector __pyx_v_v; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - minerva::NArray __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - minerva::Scale __pyx_t_6; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("sum", 0); - - /* "owl/libowl.pyx":349 - * cdef vector[int] v - * # TODO yutian: use try catch to do type conversion - * if isinstance(rhs, int): # <<<<<<<<<<<<<< - * i = rhs - * return _wrap_cpp_narray(self._d.Sum(i)) - */ - __pyx_t_1 = PyInt_Check(__pyx_v_rhs); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - - /* "owl/libowl.pyx":350 - * # TODO yutian: use try catch to do type conversion - * if isinstance(rhs, int): - * i = rhs # <<<<<<<<<<<<<< - * return _wrap_cpp_narray(self._d.Sum(i)) - * else: - */ - __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_v_rhs); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_i = __pyx_t_3; - - /* "owl/libowl.pyx":351 - * if isinstance(rhs, int): - * i = rhs - * return _wrap_cpp_narray(self._d.Sum(i)) # <<<<<<<<<<<<<< - * else: - * v = _list_to_vector(rhs) - */ - __Pyx_XDECREF(__pyx_r); - try { - __pyx_t_4 = __pyx_v_self->_d->Sum(__pyx_v_i); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_5 = ((PyObject *)__pyx_f_3owl_6libowl__wrap_cpp_narray(__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - goto __pyx_L0; - } - /*else*/ { - - /* "owl/libowl.pyx":353 - * return _wrap_cpp_narray(self._d.Sum(i)) - * else: - * v = _list_to_vector(rhs) # <<<<<<<<<<<<<< - * return _wrap_cpp_narray(self._d.Sum(m.ToScale(&v))) - * - */ - __pyx_v_v = __pyx_f_3owl_6libowl__list_to_vector(__pyx_v_rhs); - - /* "owl/libowl.pyx":354 - * else: - * v = _list_to_vector(rhs) - * return _wrap_cpp_narray(self._d.Sum(m.ToScale(&v))) # <<<<<<<<<<<<<< - * - * def max(self, rhs): - */ - __Pyx_XDECREF(__pyx_r); - try { - __pyx_t_6 = libowl::ToScale((&__pyx_v_v)); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - try { - __pyx_t_4 = __pyx_v_self->_d->Sum(__pyx_t_6); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_5 = ((PyObject *)__pyx_f_3owl_6libowl__wrap_cpp_narray(__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - goto __pyx_L0; - } - - /* "owl/libowl.pyx":345 - * , b)); - * - * def sum(self, rhs): # <<<<<<<<<<<<<< - * cdef int i - * cdef vector[int] v - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("owl.libowl.NArray.sum", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":356 - * return _wrap_cpp_narray(self._d.Sum(m.ToScale(&v))) - * - * def max(self, rhs): # <<<<<<<<<<<<<< - * cdef int i - * cdef vector[int] v - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_65max(PyObject *__pyx_v_self, PyObject *__pyx_v_rhs); /*proto*/ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_65max(PyObject *__pyx_v_self, PyObject *__pyx_v_rhs) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("max (wrapper)", 0); - __pyx_r = __pyx_pf_3owl_6libowl_6NArray_64max(((struct __pyx_obj_3owl_6libowl_NArray *)__pyx_v_self), ((PyObject *)__pyx_v_rhs)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_6NArray_64max(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_self, PyObject *__pyx_v_rhs) { - int __pyx_v_i; - std::vector __pyx_v_v; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - minerva::NArray __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - minerva::Scale __pyx_t_6; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("max", 0); - - /* "owl/libowl.pyx":360 - * cdef vector[int] v - * # TODO yutian: use try catch to do type conversion - * if isinstance(rhs, int): # <<<<<<<<<<<<<< - * i = rhs - * return _wrap_cpp_narray(self._d.Max(i)) - */ - __pyx_t_1 = PyInt_Check(__pyx_v_rhs); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - - /* "owl/libowl.pyx":361 - * # TODO yutian: use try catch to do type conversion - * if isinstance(rhs, int): - * i = rhs # <<<<<<<<<<<<<< - * return _wrap_cpp_narray(self._d.Max(i)) - * else: - */ - __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_v_rhs); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_i = __pyx_t_3; - - /* "owl/libowl.pyx":362 - * if isinstance(rhs, int): - * i = rhs - * return _wrap_cpp_narray(self._d.Max(i)) # <<<<<<<<<<<<<< - * else: - * v = _list_to_vector(rhs) - */ - __Pyx_XDECREF(__pyx_r); - try { - __pyx_t_4 = __pyx_v_self->_d->Max(__pyx_v_i); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_5 = ((PyObject *)__pyx_f_3owl_6libowl__wrap_cpp_narray(__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - goto __pyx_L0; - } - /*else*/ { - - /* "owl/libowl.pyx":364 - * return _wrap_cpp_narray(self._d.Max(i)) - * else: - * v = _list_to_vector(rhs) # <<<<<<<<<<<<<< - * return _wrap_cpp_narray(self._d.Max(m.ToScale(&v))) - * - */ - __pyx_v_v = __pyx_f_3owl_6libowl__list_to_vector(__pyx_v_rhs); - - /* "owl/libowl.pyx":365 - * else: - * v = _list_to_vector(rhs) - * return _wrap_cpp_narray(self._d.Max(m.ToScale(&v))) # <<<<<<<<<<<<<< - * - * def max_index(self, int rhs): - */ - __Pyx_XDECREF(__pyx_r); - try { - __pyx_t_6 = libowl::ToScale((&__pyx_v_v)); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - try { - __pyx_t_4 = __pyx_v_self->_d->Max(__pyx_t_6); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_5 = ((PyObject *)__pyx_f_3owl_6libowl__wrap_cpp_narray(__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - goto __pyx_L0; - } - - /* "owl/libowl.pyx":356 - * return _wrap_cpp_narray(self._d.Sum(m.ToScale(&v))) - * - * def max(self, rhs): # <<<<<<<<<<<<<< - * cdef int i - * cdef vector[int] v - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("owl.libowl.NArray.max", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":367 - * return _wrap_cpp_narray(self._d.Max(m.ToScale(&v))) - * - * def max_index(self, int rhs): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray(self._d.MaxIndex(rhs)) - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_67max_index(PyObject *__pyx_v_self, PyObject *__pyx_arg_rhs); /*proto*/ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_67max_index(PyObject *__pyx_v_self, PyObject *__pyx_arg_rhs) { - int __pyx_v_rhs; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("max_index (wrapper)", 0); - assert(__pyx_arg_rhs); { - __pyx_v_rhs = __Pyx_PyInt_As_int(__pyx_arg_rhs); if (unlikely((__pyx_v_rhs == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("owl.libowl.NArray.max_index", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3owl_6libowl_6NArray_66max_index(((struct __pyx_obj_3owl_6libowl_NArray *)__pyx_v_self), ((int)__pyx_v_rhs)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_6NArray_66max_index(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_self, int __pyx_v_rhs) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - minerva::NArray __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("max_index", 0); - - /* "owl/libowl.pyx":368 - * - * def max_index(self, int rhs): - * return _wrap_cpp_narray(self._d.MaxIndex(rhs)) # <<<<<<<<<<<<<< - * - * def count_zero(self): - */ - __Pyx_XDECREF(__pyx_r); - try { - __pyx_t_1 = __pyx_v_self->_d->MaxIndex(__pyx_v_rhs); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_2 = ((PyObject *)__pyx_f_3owl_6libowl__wrap_cpp_narray(__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":367 - * return _wrap_cpp_narray(self._d.Max(m.ToScale(&v))) - * - * def max_index(self, int rhs): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray(self._d.MaxIndex(rhs)) - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("owl.libowl.NArray.max_index", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":370 - * return _wrap_cpp_narray(self._d.MaxIndex(rhs)) - * - * def count_zero(self): # <<<<<<<<<<<<<< - * return self._d.CountZero() - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_69count_zero(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_69count_zero(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("count_zero (wrapper)", 0); - __pyx_r = __pyx_pf_3owl_6libowl_6NArray_68count_zero(((struct __pyx_obj_3owl_6libowl_NArray *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_6NArray_68count_zero(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("count_zero", 0); - - /* "owl/libowl.pyx":371 - * - * def count_zero(self): - * return self._d.CountZero() # <<<<<<<<<<<<<< - * - * def trans(self): - */ - __Pyx_XDECREF(__pyx_r); - try { - __pyx_t_1 = __pyx_v_self->_d->CountZero(); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":370 - * return _wrap_cpp_narray(self._d.MaxIndex(rhs)) - * - * def count_zero(self): # <<<<<<<<<<<<<< - * return self._d.CountZero() - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("owl.libowl.NArray.count_zero", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":373 - * return self._d.CountZero() - * - * def trans(self): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray(self._d.Trans()) - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_71trans(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_71trans(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("trans (wrapper)", 0); - __pyx_r = __pyx_pf_3owl_6libowl_6NArray_70trans(((struct __pyx_obj_3owl_6libowl_NArray *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_6NArray_70trans(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - minerva::NArray __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("trans", 0); - - /* "owl/libowl.pyx":374 - * - * def trans(self): - * return _wrap_cpp_narray(self._d.Trans()) # <<<<<<<<<<<<<< - * - * def reshape(self, s): - */ - __Pyx_XDECREF(__pyx_r); - try { - __pyx_t_1 = __pyx_v_self->_d->Trans(); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_2 = ((PyObject *)__pyx_f_3owl_6libowl__wrap_cpp_narray(__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":373 - * return self._d.CountZero() - * - * def trans(self): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray(self._d.Trans()) - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("owl.libowl.NArray.trans", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":376 - * return _wrap_cpp_narray(self._d.Trans()) - * - * def reshape(self, s): # <<<<<<<<<<<<<< - * cdef vector[int] v = _list_to_vector(s) - * return _wrap_cpp_narray(self._d.Reshape(m.ToScale(&v))) - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_73reshape(PyObject *__pyx_v_self, PyObject *__pyx_v_s); /*proto*/ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_73reshape(PyObject *__pyx_v_self, PyObject *__pyx_v_s) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("reshape (wrapper)", 0); - __pyx_r = __pyx_pf_3owl_6libowl_6NArray_72reshape(((struct __pyx_obj_3owl_6libowl_NArray *)__pyx_v_self), ((PyObject *)__pyx_v_s)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_6NArray_72reshape(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_self, PyObject *__pyx_v_s) { - std::vector __pyx_v_v; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - minerva::Scale __pyx_t_1; - minerva::NArray __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("reshape", 0); - - /* "owl/libowl.pyx":377 - * - * def reshape(self, s): - * cdef vector[int] v = _list_to_vector(s) # <<<<<<<<<<<<<< - * return _wrap_cpp_narray(self._d.Reshape(m.ToScale(&v))) - * - */ - __pyx_v_v = __pyx_f_3owl_6libowl__list_to_vector(__pyx_v_s); - - /* "owl/libowl.pyx":378 - * def reshape(self, s): - * cdef vector[int] v = _list_to_vector(s) - * return _wrap_cpp_narray(self._d.Reshape(m.ToScale(&v))) # <<<<<<<<<<<<<< - * - * def wait_for_eval(self): - */ - __Pyx_XDECREF(__pyx_r); - try { - __pyx_t_1 = libowl::ToScale((&__pyx_v_v)); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - try { - __pyx_t_2 = __pyx_v_self->_d->Reshape(__pyx_t_1); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_3 = ((PyObject *)__pyx_f_3owl_6libowl__wrap_cpp_narray(__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":376 - * return _wrap_cpp_narray(self._d.Trans()) - * - * def reshape(self, s): # <<<<<<<<<<<<<< - * cdef vector[int] v = _list_to_vector(s) - * return _wrap_cpp_narray(self._d.Reshape(m.ToScale(&v))) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("owl.libowl.NArray.reshape", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":380 - * return _wrap_cpp_narray(self._d.Reshape(m.ToScale(&v))) - * - * def wait_for_eval(self): # <<<<<<<<<<<<<< - * self._d.Wait() - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_75wait_for_eval(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_75wait_for_eval(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("wait_for_eval (wrapper)", 0); - __pyx_r = __pyx_pf_3owl_6libowl_6NArray_74wait_for_eval(((struct __pyx_obj_3owl_6libowl_NArray *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_6NArray_74wait_for_eval(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("wait_for_eval", 0); - - /* "owl/libowl.pyx":381 - * - * def wait_for_eval(self): - * self._d.Wait() # <<<<<<<<<<<<<< - * - * property shape: - */ - try { - __pyx_v_self->_d->Wait(); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "owl/libowl.pyx":380 - * return _wrap_cpp_narray(self._d.Reshape(m.ToScale(&v))) - * - * def wait_for_eval(self): # <<<<<<<<<<<<<< - * self._d.Wait() - * - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("owl.libowl.NArray.wait_for_eval", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":384 - * - * property shape: - * def __get__(self): # <<<<<<<<<<<<<< - * cdef vector[int] scale = m.OfScale(self._d.Size()) - * return list(scale) - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_5shape_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_5shape_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_3owl_6libowl_6NArray_5shape___get__(((struct __pyx_obj_3owl_6libowl_NArray *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_6NArray_5shape___get__(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_self) { - std::vector __pyx_v_scale; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - minerva::Scale __pyx_t_1; - std::vector __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "owl/libowl.pyx":385 - * property shape: - * def __get__(self): - * cdef vector[int] scale = m.OfScale(self._d.Size()) # <<<<<<<<<<<<<< - * return list(scale) - * - */ - try { - __pyx_t_1 = __pyx_v_self->_d->Size(); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - try { - __pyx_t_2 = libowl::OfScale(__pyx_t_1); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_scale = __pyx_t_2; - - /* "owl/libowl.pyx":386 - * def __get__(self): - * cdef vector[int] scale = m.OfScale(self._d.Size()) - * return list(scale) # <<<<<<<<<<<<<< - * - * @staticmethod - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __pyx_convert_vector_to_py_int(__pyx_v_scale); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PySequence_List(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":384 - * - * property shape: - * def __get__(self): # <<<<<<<<<<<<<< - * cdef vector[int] scale = m.OfScale(self._d.Size()) - * return list(scale) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("owl.libowl.NArray.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":389 - * - * @staticmethod - * def zeros(s): # <<<<<<<<<<<<<< - * cdef vector[int] v = _list_to_vector(s) - * return _wrap_cpp_narray(m.NArray.Zeros(m.ToScale(&v))) - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_77zeros(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_3owl_6libowl_6NArray_77zeros = {"zeros", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_77zeros, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_3owl_6libowl_6NArray_77zeros(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_s = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("zeros (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_s,0}; - PyObject* values[1] = {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 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_s)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "zeros") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - } - __pyx_v_s = values[0]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("zeros", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("owl.libowl.NArray.zeros", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3owl_6libowl_6NArray_76zeros(__pyx_v_s); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_6NArray_76zeros(PyObject *__pyx_v_s) { - std::vector __pyx_v_v; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - minerva::Scale __pyx_t_1; - minerva::NArray __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("zeros", 0); - - /* "owl/libowl.pyx":390 - * @staticmethod - * def zeros(s): - * cdef vector[int] v = _list_to_vector(s) # <<<<<<<<<<<<<< - * return _wrap_cpp_narray(m.NArray.Zeros(m.ToScale(&v))) - * - */ - __pyx_v_v = __pyx_f_3owl_6libowl__list_to_vector(__pyx_v_s); - - /* "owl/libowl.pyx":391 - * def zeros(s): - * cdef vector[int] v = _list_to_vector(s) - * return _wrap_cpp_narray(m.NArray.Zeros(m.ToScale(&v))) # <<<<<<<<<<<<<< - * - * @staticmethod - */ - __Pyx_XDECREF(__pyx_r); - try { - __pyx_t_1 = libowl::ToScale((&__pyx_v_v)); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - try { - __pyx_t_2 = minerva::NArray::Zeros(__pyx_t_1); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_3 = ((PyObject *)__pyx_f_3owl_6libowl__wrap_cpp_narray(__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":389 - * - * @staticmethod - * def zeros(s): # <<<<<<<<<<<<<< - * cdef vector[int] v = _list_to_vector(s) - * return _wrap_cpp_narray(m.NArray.Zeros(m.ToScale(&v))) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("owl.libowl.NArray.zeros", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":394 - * - * @staticmethod - * def ones(s): # <<<<<<<<<<<<<< - * cdef vector[int] v = _list_to_vector(s) - * return _wrap_cpp_narray(m.NArray.Ones(m.ToScale(&v))) - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_79ones(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_3owl_6libowl_6NArray_79ones = {"ones", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_79ones, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_3owl_6libowl_6NArray_79ones(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_s = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("ones (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_s,0}; - PyObject* values[1] = {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 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_s)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ones") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - } - __pyx_v_s = values[0]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("ones", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("owl.libowl.NArray.ones", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3owl_6libowl_6NArray_78ones(__pyx_v_s); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_6NArray_78ones(PyObject *__pyx_v_s) { - std::vector __pyx_v_v; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - minerva::Scale __pyx_t_1; - minerva::NArray __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("ones", 0); - - /* "owl/libowl.pyx":395 - * @staticmethod - * def ones(s): - * cdef vector[int] v = _list_to_vector(s) # <<<<<<<<<<<<<< - * return _wrap_cpp_narray(m.NArray.Ones(m.ToScale(&v))) - * - */ - __pyx_v_v = __pyx_f_3owl_6libowl__list_to_vector(__pyx_v_s); - - /* "owl/libowl.pyx":396 - * def ones(s): - * cdef vector[int] v = _list_to_vector(s) - * return _wrap_cpp_narray(m.NArray.Ones(m.ToScale(&v))) # <<<<<<<<<<<<<< - * - * @staticmethod - */ - __Pyx_XDECREF(__pyx_r); - try { - __pyx_t_1 = libowl::ToScale((&__pyx_v_v)); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - try { - __pyx_t_2 = minerva::NArray::Ones(__pyx_t_1); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_3 = ((PyObject *)__pyx_f_3owl_6libowl__wrap_cpp_narray(__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":394 - * - * @staticmethod - * def ones(s): # <<<<<<<<<<<<<< - * cdef vector[int] v = _list_to_vector(s) - * return _wrap_cpp_narray(m.NArray.Ones(m.ToScale(&v))) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("owl.libowl.NArray.ones", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":399 - * - * @staticmethod - * def randn(s, float mean, float var): # <<<<<<<<<<<<<< - * cdef vector[int] v = _list_to_vector(s) - * return _wrap_cpp_narray(m.NArray.Randn(m.ToScale(&v), mean, var)) - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_81randn(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_3owl_6libowl_6NArray_81randn = {"randn", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_81randn, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_3owl_6libowl_6NArray_81randn(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_s = 0; - float __pyx_v_mean; - float __pyx_v_var; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("randn (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_s,&__pyx_n_s_mean,&__pyx_n_s_var,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); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_s)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mean)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("randn", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_var)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("randn", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "randn") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __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_s = values[0]; - __pyx_v_mean = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_mean == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_var = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_var == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("randn", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("owl.libowl.NArray.randn", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3owl_6libowl_6NArray_80randn(__pyx_v_s, __pyx_v_mean, __pyx_v_var); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_6NArray_80randn(PyObject *__pyx_v_s, float __pyx_v_mean, float __pyx_v_var) { - std::vector __pyx_v_v; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - minerva::Scale __pyx_t_1; - minerva::NArray __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("randn", 0); - - /* "owl/libowl.pyx":400 - * @staticmethod - * def randn(s, float mean, float var): - * cdef vector[int] v = _list_to_vector(s) # <<<<<<<<<<<<<< - * return _wrap_cpp_narray(m.NArray.Randn(m.ToScale(&v), mean, var)) - * - */ - __pyx_v_v = __pyx_f_3owl_6libowl__list_to_vector(__pyx_v_s); - - /* "owl/libowl.pyx":401 - * def randn(s, float mean, float var): - * cdef vector[int] v = _list_to_vector(s) - * return _wrap_cpp_narray(m.NArray.Randn(m.ToScale(&v), mean, var)) # <<<<<<<<<<<<<< - * - * @staticmethod - */ - __Pyx_XDECREF(__pyx_r); - try { - __pyx_t_1 = libowl::ToScale((&__pyx_v_v)); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - try { - __pyx_t_2 = minerva::NArray::Randn(__pyx_t_1, __pyx_v_mean, __pyx_v_var); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_3 = ((PyObject *)__pyx_f_3owl_6libowl__wrap_cpp_narray(__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":399 - * - * @staticmethod - * def randn(s, float mean, float var): # <<<<<<<<<<<<<< - * cdef vector[int] v = _list_to_vector(s) - * return _wrap_cpp_narray(m.NArray.Randn(m.ToScale(&v), mean, var)) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("owl.libowl.NArray.randn", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":404 - * - * @staticmethod - * def randb(s, float p): # <<<<<<<<<<<<<< - * cdef vector[int] v = _list_to_vector(s) - * return _wrap_cpp_narray(m.NArray.RandBernoulli(m.ToScale(&v), p)) - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_83randb(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_3owl_6libowl_6NArray_83randb = {"randb", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_83randb, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_3owl_6libowl_6NArray_83randb(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_s = 0; - float __pyx_v_p; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("randb (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_s,&__pyx_n_s_p,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); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_s)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_p)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("randb", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "randb") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __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_s = values[0]; - __pyx_v_p = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_p == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("randb", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("owl.libowl.NArray.randb", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3owl_6libowl_6NArray_82randb(__pyx_v_s, __pyx_v_p); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_6NArray_82randb(PyObject *__pyx_v_s, float __pyx_v_p) { - std::vector __pyx_v_v; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - minerva::Scale __pyx_t_1; - minerva::NArray __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("randb", 0); - - /* "owl/libowl.pyx":405 - * @staticmethod - * def randb(s, float p): - * cdef vector[int] v = _list_to_vector(s) # <<<<<<<<<<<<<< - * return _wrap_cpp_narray(m.NArray.RandBernoulli(m.ToScale(&v), p)) - * - */ - __pyx_v_v = __pyx_f_3owl_6libowl__list_to_vector(__pyx_v_s); - - /* "owl/libowl.pyx":406 - * def randb(s, float p): - * cdef vector[int] v = _list_to_vector(s) - * return _wrap_cpp_narray(m.NArray.RandBernoulli(m.ToScale(&v), p)) # <<<<<<<<<<<<<< - * - * @staticmethod - */ - __Pyx_XDECREF(__pyx_r); - try { - __pyx_t_1 = libowl::ToScale((&__pyx_v_v)); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - try { - __pyx_t_2 = minerva::NArray::RandBernoulli(__pyx_t_1, __pyx_v_p); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_3 = ((PyObject *)__pyx_f_3owl_6libowl__wrap_cpp_narray(__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":404 - * - * @staticmethod - * def randb(s, float p): # <<<<<<<<<<<<<< - * cdef vector[int] v = _list_to_vector(s) - * return _wrap_cpp_narray(m.NArray.RandBernoulli(m.ToScale(&v), p)) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("owl.libowl.NArray.randb", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":409 - * - * @staticmethod - * def concat(arrays, int dim): # <<<<<<<<<<<<<< - * cdef vector[m.NArray] v - * cdef NArray n - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_85concat(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_3owl_6libowl_6NArray_85concat = {"concat", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_85concat, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_3owl_6libowl_6NArray_85concat(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_arrays = 0; - int __pyx_v_dim; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("concat (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_arrays,&__pyx_n_s_dim,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); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_arrays)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dim)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("concat", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "concat") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __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_arrays = values[0]; - __pyx_v_dim = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_dim == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("concat", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("owl.libowl.NArray.concat", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3owl_6libowl_6NArray_84concat(__pyx_v_arrays, __pyx_v_dim); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_6NArray_84concat(PyObject *__pyx_v_arrays, int __pyx_v_dim) { - std::vector __pyx_v_v; - struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_n = 0; - PyObject *__pyx_v_i = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *(*__pyx_t_3)(PyObject *); - PyObject *__pyx_t_4 = NULL; - minerva::NArray __pyx_t_5; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("concat", 0); - - /* "owl/libowl.pyx":412 - * cdef vector[m.NArray] v - * cdef NArray n - * for i in arrays: # <<<<<<<<<<<<<< - * n = i - * v.push_back(deref(n._d)) - */ - if (likely(PyList_CheckExact(__pyx_v_arrays)) || PyTuple_CheckExact(__pyx_v_arrays)) { - __pyx_t_1 = __pyx_v_arrays; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; - __pyx_t_3 = NULL; - } else { - __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_arrays); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - for (;;) { - if (likely(!__pyx_t_3)) { - if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - #endif - } else { - if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - #endif - } - } else { - __pyx_t_4 = __pyx_t_3(__pyx_t_1); - if (unlikely(!__pyx_t_4)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4); - __pyx_t_4 = 0; - - /* "owl/libowl.pyx":413 - * cdef NArray n - * for i in arrays: - * n = i # <<<<<<<<<<<<<< - * v.push_back(deref(n._d)) - * return _wrap_cpp_narray(m.Concat(v, dim)) - */ - if (!(likely(((__pyx_v_i) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_i, __pyx_ptype_3owl_6libowl_NArray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = __pyx_v_i; - __Pyx_INCREF(__pyx_t_4); - __Pyx_XDECREF_SET(__pyx_v_n, ((struct __pyx_obj_3owl_6libowl_NArray *)__pyx_t_4)); - __pyx_t_4 = 0; - - /* "owl/libowl.pyx":414 - * for i in arrays: - * n = i - * v.push_back(deref(n._d)) # <<<<<<<<<<<<<< - * return _wrap_cpp_narray(m.Concat(v, dim)) - * - */ - try { - __pyx_v_v.push_back((*__pyx_v_n->_d)); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "owl/libowl.pyx":412 - * cdef vector[m.NArray] v - * cdef NArray n - * for i in arrays: # <<<<<<<<<<<<<< - * n = i - * v.push_back(deref(n._d)) - */ - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "owl/libowl.pyx":415 - * n = i - * v.push_back(deref(n._d)) - * return _wrap_cpp_narray(m.Concat(v, dim)) # <<<<<<<<<<<<<< - * - * @staticmethod - */ - __Pyx_XDECREF(__pyx_r); - try { - __pyx_t_5 = minerva::Concat(__pyx_v_v, __pyx_v_dim); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_1 = ((PyObject *)__pyx_f_3owl_6libowl__wrap_cpp_narray(__pyx_t_5)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":409 - * - * @staticmethod - * def concat(arrays, int dim): # <<<<<<<<<<<<<< - * cdef vector[m.NArray] v - * cdef NArray n - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("owl.libowl.NArray.concat", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_n); - __Pyx_XDECREF(__pyx_v_i); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":418 - * - * @staticmethod - * def slice(NArray n, int slice_dim, int st_off, int slice_count): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray( - * m.Slice(deref(n._d), slice_dim, st_off, slice_count)) - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_87slice(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_3owl_6libowl_6NArray_87slice = {"slice", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_87slice, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_3owl_6libowl_6NArray_87slice(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_n = 0; - int __pyx_v_slice_dim; - int __pyx_v_st_off; - int __pyx_v_slice_count; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("slice (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,&__pyx_n_s_slice_dim,&__pyx_n_s_st_off,&__pyx_n_s_slice_count,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); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_slice_dim)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("slice", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_st_off)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("slice", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_slice_count)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("slice", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "slice") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __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_n = ((struct __pyx_obj_3owl_6libowl_NArray *)values[0]); - __pyx_v_slice_dim = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_slice_dim == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_st_off = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_st_off == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_slice_count = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_slice_count == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("slice", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("owl.libowl.NArray.slice", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_n), __pyx_ptype_3owl_6libowl_NArray, 1, "n", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_3owl_6libowl_6NArray_86slice(__pyx_v_n, __pyx_v_slice_dim, __pyx_v_st_off, __pyx_v_slice_count); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_6NArray_86slice(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_n, int __pyx_v_slice_dim, int __pyx_v_st_off, int __pyx_v_slice_count) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - minerva::NArray __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("slice", 0); - - /* "owl/libowl.pyx":419 - * @staticmethod - * def slice(NArray n, int slice_dim, int st_off, int slice_count): - * return _wrap_cpp_narray( # <<<<<<<<<<<<<< - * m.Slice(deref(n._d), slice_dim, st_off, slice_count)) - * - */ - __Pyx_XDECREF(__pyx_r); - - /* "owl/libowl.pyx":420 - * def slice(NArray n, int slice_dim, int st_off, int slice_count): - * return _wrap_cpp_narray( - * m.Slice(deref(n._d), slice_dim, st_off, slice_count)) # <<<<<<<<<<<<<< - * - * @staticmethod - */ - try { - __pyx_t_1 = minerva::Slice((*__pyx_v_n->_d), __pyx_v_slice_dim, __pyx_v_st_off, __pyx_v_slice_count); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "owl/libowl.pyx":419 - * @staticmethod - * def slice(NArray n, int slice_dim, int st_off, int slice_count): - * return _wrap_cpp_narray( # <<<<<<<<<<<<<< - * m.Slice(deref(n._d), slice_dim, st_off, slice_count)) - * - */ - __pyx_t_2 = ((PyObject *)__pyx_f_3owl_6libowl__wrap_cpp_narray(__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":418 - * - * @staticmethod - * def slice(NArray n, int slice_dim, int st_off, int slice_count): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray( - * m.Slice(deref(n._d), slice_dim, st_off, slice_count)) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("owl.libowl.NArray.slice", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":425 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * def from_numpy(np.ndarray n): # <<<<<<<<<<<<<< - * s = list(np.shape(n)) - * n = n.astype(np.float32) - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_89from_numpy(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_3owl_6libowl_6NArray_89from_numpy = {"from_numpy", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_89from_numpy, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_3owl_6libowl_6NArray_89from_numpy(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_n = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("from_numpy (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,0}; - PyObject* values[1] = {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 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "from_numpy") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - } - __pyx_v_n = ((PyArrayObject *)values[0]); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("from_numpy", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("owl.libowl.NArray.from_numpy", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_n), __pyx_ptype_5numpy_ndarray, 1, "n", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_3owl_6libowl_6NArray_88from_numpy(__pyx_v_n); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_6NArray_88from_numpy(PyArrayObject *__pyx_v_n) { - PyObject *__pyx_v_s = 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; - Py_ssize_t __pyx_t_6; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("from_numpy", 0); - __Pyx_INCREF((PyObject *)__pyx_v_n); - - /* "owl/libowl.pyx":426 - * @cython.wraparound(False) - * def from_numpy(np.ndarray n): - * s = list(np.shape(n)) # <<<<<<<<<<<<<< - * n = n.astype(np.float32) - * return NArray._from_numpy(n.flatten(), s) - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && unlikely(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, ((PyObject *)__pyx_v_n)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - } else { - __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL; - __Pyx_INCREF(((PyObject *)__pyx_v_n)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_n)); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, ((PyObject *)__pyx_v_n)); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PySequence_List(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_s = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; - - /* "owl/libowl.pyx":427 - * def from_numpy(np.ndarray n): - * s = list(np.shape(n)) - * n = n.astype(np.float32) # <<<<<<<<<<<<<< - * return NArray._from_numpy(n.flatten(), s) - * - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_n), __pyx_n_s_astype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_float32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - if (!__pyx_t_4) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else { - __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL; - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF_SET(__pyx_v_n, ((PyArrayObject *)__pyx_t_3)); - __pyx_t_3 = 0; - - /* "owl/libowl.pyx":428 - * s = list(np.shape(n)) - * n = n.astype(np.float32) - * return NArray._from_numpy(n.flatten(), s) # <<<<<<<<<<<<<< - * - * @staticmethod - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)((PyObject*)__pyx_ptype_3owl_6libowl_NArray)), __pyx_n_s_from_numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_n), __pyx_n_s_flatten); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_4) { - __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else { - __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - __pyx_t_6 = 0; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - __pyx_t_6 = 1; - } - } - __pyx_t_4 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - if (__pyx_t_2) { - __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL; - } - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_6, __pyx_t_5); - __Pyx_INCREF(__pyx_v_s); - __Pyx_GIVEREF(__pyx_v_s); - PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_6, __pyx_v_s); - __pyx_t_5 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":425 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * def from_numpy(np.ndarray n): # <<<<<<<<<<<<<< - * s = list(np.shape(n)) - * n = n.astype(np.float32) - */ - - /* 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("owl.libowl.NArray.from_numpy", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_s); - __Pyx_XDECREF((PyObject *)__pyx_v_n); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":433 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * def _from_numpy(np.ndarray[np.float32_t, ndim=1, mode='c'] n, list s): # <<<<<<<<<<<<<< - * cdef vector[int] shape = _list_to_vector(reversed(s)) - * return _wrap_cpp_narray(m.FromNumpy(&n[0], m.ToScale(&shape))) - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_91_from_numpy(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_3owl_6libowl_6NArray_91_from_numpy = {"_from_numpy", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_91_from_numpy, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_3owl_6libowl_6NArray_91_from_numpy(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_n = 0; - PyObject *__pyx_v_s = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_from_numpy (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,&__pyx_n_s_s,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); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_s)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("_from_numpy", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_from_numpy") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __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_n = ((PyArrayObject *)values[0]); - __pyx_v_s = ((PyObject*)values[1]); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_from_numpy", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("owl.libowl.NArray._from_numpy", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_n), __pyx_ptype_5numpy_ndarray, 1, "n", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_s), (&PyList_Type), 1, "s", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_3owl_6libowl_6NArray_90_from_numpy(__pyx_v_n, __pyx_v_s); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_6NArray_90_from_numpy(PyArrayObject *__pyx_v_n, PyObject *__pyx_v_s) { - std::vector __pyx_v_shape; - __Pyx_LocalBuf_ND __pyx_pybuffernd_n; - __Pyx_Buffer __pyx_pybuffer_n; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - long __pyx_t_3; - minerva::Scale __pyx_t_4; - minerva::NArray __pyx_t_5; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_from_numpy", 0); - __pyx_pybuffer_n.pybuffer.buf = NULL; - __pyx_pybuffer_n.refcount = 0; - __pyx_pybuffernd_n.data = NULL; - __pyx_pybuffernd_n.rcbuffer = &__pyx_pybuffer_n; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_n.rcbuffer->pybuffer, (PyObject*)__pyx_v_n, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_pybuffernd_n.diminfo[0].strides = __pyx_pybuffernd_n.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_n.diminfo[0].shape = __pyx_pybuffernd_n.rcbuffer->pybuffer.shape[0]; - - /* "owl/libowl.pyx":434 - * @cython.wraparound(False) - * def _from_numpy(np.ndarray[np.float32_t, ndim=1, mode='c'] n, list s): - * cdef vector[int] shape = _list_to_vector(reversed(s)) # <<<<<<<<<<<<<< - * return _wrap_cpp_narray(m.FromNumpy(&n[0], m.ToScale(&shape))) - * - */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_s); - __Pyx_GIVEREF(__pyx_v_s); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_s); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_reversed, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_shape = __pyx_f_3owl_6libowl__list_to_vector(__pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "owl/libowl.pyx":435 - * def _from_numpy(np.ndarray[np.float32_t, ndim=1, mode='c'] n, list s): - * cdef vector[int] shape = _list_to_vector(reversed(s)) - * return _wrap_cpp_narray(m.FromNumpy(&n[0], m.ToScale(&shape))) # <<<<<<<<<<<<<< - * - * def to_numpy(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = 0; - try { - __pyx_t_4 = libowl::ToScale((&__pyx_v_shape)); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - try { - __pyx_t_5 = libowl::FromNumpy((&(*__Pyx_BufPtrCContig1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_n.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_n.diminfo[0].strides))), __pyx_t_4); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_2 = ((PyObject *)__pyx_f_3owl_6libowl__wrap_cpp_narray(__pyx_t_5)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":433 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * def _from_numpy(np.ndarray[np.float32_t, ndim=1, mode='c'] n, list s): # <<<<<<<<<<<<<< - * cdef vector[int] shape = _list_to_vector(reversed(s)) - * return _wrap_cpp_narray(m.FromNumpy(&n[0], m.ToScale(&shape))) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_n.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("owl.libowl.NArray._from_numpy", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_n.rcbuffer->pybuffer); - __pyx_L2:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":437 - * return _wrap_cpp_narray(m.FromNumpy(&n[0], m.ToScale(&shape))) - * - * def to_numpy(self): # <<<<<<<<<<<<<< - * cdef int size = 1 - * for i in self.shape: - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_93to_numpy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_3owl_6libowl_6NArray_93to_numpy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("to_numpy (wrapper)", 0); - __pyx_r = __pyx_pf_3owl_6libowl_6NArray_92to_numpy(((struct __pyx_obj_3owl_6libowl_NArray *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_6NArray_92to_numpy(struct __pyx_obj_3owl_6libowl_NArray *__pyx_v_self) { - int __pyx_v_size; - PyObject *__pyx_v_i = NULL; - PyArrayObject *__pyx_v_dest = 0; - __Pyx_LocalBuf_ND __pyx_pybuffernd_dest; - __Pyx_Buffer __pyx_pybuffer_dest; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - Py_ssize_t __pyx_t_3; - PyObject *(*__pyx_t_4)(PyObject *); - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyArrayObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; - PyObject *__pyx_t_12 = NULL; - long __pyx_t_13; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("to_numpy", 0); - __pyx_pybuffer_dest.pybuffer.buf = NULL; - __pyx_pybuffer_dest.refcount = 0; - __pyx_pybuffernd_dest.data = NULL; - __pyx_pybuffernd_dest.rcbuffer = &__pyx_pybuffer_dest; - - /* "owl/libowl.pyx":438 - * - * def to_numpy(self): - * cdef int size = 1 # <<<<<<<<<<<<<< - * for i in self.shape: - * size *= i - */ - __pyx_v_size = 1; - - /* "owl/libowl.pyx":439 - * def to_numpy(self): - * cdef int size = 1 - * for i in self.shape: # <<<<<<<<<<<<<< - * size *= i - * cdef np.ndarray[np.float32_t, ndim=1, mode='c'] dest - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __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_COMPILING_IN_CPYTHON - __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_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - #endif - } else { - if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __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_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __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(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1); - __pyx_t_1 = 0; - - /* "owl/libowl.pyx":440 - * cdef int size = 1 - * for i in self.shape: - * size *= i # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float32_t, ndim=1, mode='c'] dest - * dest = np.empty(size, dtype=np.float32, order='c') - */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyNumber_InPlaceMultiply(__pyx_t_1, __pyx_v_i); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_size = __pyx_t_6; - - /* "owl/libowl.pyx":439 - * def to_numpy(self): - * cdef int size = 1 - * for i in self.shape: # <<<<<<<<<<<<<< - * size *= i - * cdef np.ndarray[np.float32_t, ndim=1, mode='c'] dest - */ - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "owl/libowl.pyx":442 - * size *= i - * cdef np.ndarray[np.float32_t, ndim=1, mode='c'] dest - * dest = np.empty(size, dtype=np.float32, order='c') # <<<<<<<<<<<<<< - * m.ToNumpy(&dest[0], deref(self._d)) - * return dest.reshape(tuple(reversed(self.shape))) - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_float32); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_order, __pyx_n_s_c) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_9 = ((PyArrayObject *)__pyx_t_8); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dest.rcbuffer->pybuffer); - __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dest.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_6 < 0)) { - PyErr_Fetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dest.rcbuffer->pybuffer, (PyObject*)__pyx_v_dest, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_10, __pyx_t_11, __pyx_t_12); - } - } - __pyx_pybuffernd_dest.diminfo[0].strides = __pyx_pybuffernd_dest.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dest.diminfo[0].shape = __pyx_pybuffernd_dest.rcbuffer->pybuffer.shape[0]; - if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_9 = 0; - __pyx_v_dest = ((PyArrayObject *)__pyx_t_8); - __pyx_t_8 = 0; - - /* "owl/libowl.pyx":443 - * cdef np.ndarray[np.float32_t, ndim=1, mode='c'] dest - * dest = np.empty(size, dtype=np.float32, order='c') - * m.ToNumpy(&dest[0], deref(self._d)) # <<<<<<<<<<<<<< - * return dest.reshape(tuple(reversed(self.shape))) - * - */ - __pyx_t_13 = 0; - __pyx_t_6 = -1; - if (__pyx_t_13 < 0) { - __pyx_t_13 += __pyx_pybuffernd_dest.diminfo[0].shape; - if (unlikely(__pyx_t_13 < 0)) __pyx_t_6 = 0; - } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_dest.diminfo[0].shape)) __pyx_t_6 = 0; - if (unlikely(__pyx_t_6 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_6); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - try { - libowl::ToNumpy((&(*__Pyx_BufPtrCContig1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_dest.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_dest.diminfo[0].strides))), (*__pyx_v_self->_d)); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "owl/libowl.pyx":444 - * dest = np.empty(size, dtype=np.float32, order='c') - * m.ToNumpy(&dest[0], deref(self._d)) - * return dest.reshape(tuple(reversed(self.shape))) # <<<<<<<<<<<<<< - * - * cdef class PoolingAlgorithmWrapper(object): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_dest), __pyx_n_s_reshape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_reversed, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PySequence_Tuple(__pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (!__pyx_t_1) { - __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_8); - } else { - __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1); __pyx_t_1 = NULL; - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_8; - __pyx_t_8 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":437 - * return _wrap_cpp_narray(m.FromNumpy(&n[0], m.ToScale(&shape))) - * - * def to_numpy(self): # <<<<<<<<<<<<<< - * cdef int size = 1 - * for i in self.shape: - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dest.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("owl.libowl.NArray.to_numpy", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dest.rcbuffer->pybuffer); - __pyx_L2:; - __Pyx_XDECREF(__pyx_v_i); - __Pyx_XDECREF((PyObject *)__pyx_v_dest); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":449 - * cdef int _d - * - * def __cinit__(self, int d): # <<<<<<<<<<<<<< - * self._d = d - * - */ - -/* Python wrapper */ -static int __pyx_pw_3owl_6libowl_23PoolingAlgorithmWrapper_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_3owl_6libowl_23PoolingAlgorithmWrapper_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - int __pyx_v_d; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_d,0}; - PyObject* values[1] = {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 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_d)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - } - __pyx_v_d = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_d == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("owl.libowl.PoolingAlgorithmWrapper.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3owl_6libowl_23PoolingAlgorithmWrapper___cinit__(((struct __pyx_obj_3owl_6libowl_PoolingAlgorithmWrapper *)__pyx_v_self), __pyx_v_d); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_3owl_6libowl_23PoolingAlgorithmWrapper___cinit__(struct __pyx_obj_3owl_6libowl_PoolingAlgorithmWrapper *__pyx_v_self, int __pyx_v_d) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__", 0); - - /* "owl/libowl.pyx":450 - * - * def __cinit__(self, int d): - * self._d = d # <<<<<<<<<<<<<< - * - * def is_same(self, PoolingAlgorithmWrapper rhs): - */ - __pyx_v_self->_d = __pyx_v_d; - - /* "owl/libowl.pyx":449 - * cdef int _d - * - * def __cinit__(self, int d): # <<<<<<<<<<<<<< - * self._d = d - * - */ - - /* function exit code */ - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":452 - * self._d = d - * - * def is_same(self, PoolingAlgorithmWrapper rhs): # <<<<<<<<<<<<<< - * return self._d == rhs._d - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_23PoolingAlgorithmWrapper_3is_same(PyObject *__pyx_v_self, PyObject *__pyx_v_rhs); /*proto*/ -static PyObject *__pyx_pw_3owl_6libowl_23PoolingAlgorithmWrapper_3is_same(PyObject *__pyx_v_self, PyObject *__pyx_v_rhs) { - CYTHON_UNUSED int __pyx_lineno = 0; - CYTHON_UNUSED const char *__pyx_filename = NULL; - CYTHON_UNUSED int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("is_same (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_rhs), __pyx_ptype_3owl_6libowl_PoolingAlgorithmWrapper, 1, "rhs", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_3owl_6libowl_23PoolingAlgorithmWrapper_2is_same(((struct __pyx_obj_3owl_6libowl_PoolingAlgorithmWrapper *)__pyx_v_self), ((struct __pyx_obj_3owl_6libowl_PoolingAlgorithmWrapper *)__pyx_v_rhs)); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_23PoolingAlgorithmWrapper_2is_same(struct __pyx_obj_3owl_6libowl_PoolingAlgorithmWrapper *__pyx_v_self, struct __pyx_obj_3owl_6libowl_PoolingAlgorithmWrapper *__pyx_v_rhs) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("is_same", 0); - - /* "owl/libowl.pyx":453 - * - * def is_same(self, PoolingAlgorithmWrapper rhs): - * return self._d == rhs._d # <<<<<<<<<<<<<< - * - * class _PoolingAlgorithms(object): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_self->_d == __pyx_v_rhs->_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":452 - * self._d = d - * - * def is_same(self, PoolingAlgorithmWrapper rhs): # <<<<<<<<<<<<<< - * return self._d == rhs._d - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("owl.libowl.PoolingAlgorithmWrapper.is_same", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":456 - * - * class _PoolingAlgorithms(object): - * def __init__(self): # <<<<<<<<<<<<<< - * self._max = PoolingAlgorithmWrapper( - * m.OfPoolingAlgorithm(m.kPoolingAlgorithmMax)) - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_18_PoolingAlgorithms_1__init__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_3owl_6libowl_18_PoolingAlgorithms_1__init__ = {"__init__", (PyCFunction)__pyx_pw_3owl_6libowl_18_PoolingAlgorithms_1__init__, METH_O, 0}; -static PyObject *__pyx_pw_3owl_6libowl_18_PoolingAlgorithms_1__init__(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); - __pyx_r = __pyx_pf_3owl_6libowl_18_PoolingAlgorithms___init__(__pyx_self, ((PyObject *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_18_PoolingAlgorithms___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__init__", 0); - - /* "owl/libowl.pyx":458 - * def __init__(self): - * self._max = PoolingAlgorithmWrapper( - * m.OfPoolingAlgorithm(m.kPoolingAlgorithmMax)) # <<<<<<<<<<<<<< - * self._average = PoolingAlgorithmWrapper( - * m.OfPoolingAlgorithm(m.kPoolingAlgorithmAverage)) - */ - try { - __pyx_t_1 = libowl::OfEvilEnumClass(minerva::PoolingInfo::Algorithm::kMax); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - - /* "owl/libowl.pyx":457 - * class _PoolingAlgorithms(object): - * def __init__(self): - * self._max = PoolingAlgorithmWrapper( # <<<<<<<<<<<<<< - * m.OfPoolingAlgorithm(m.kPoolingAlgorithmMax)) - * self._average = PoolingAlgorithmWrapper( - */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3owl_6libowl_PoolingAlgorithmWrapper)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_max, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "owl/libowl.pyx":460 - * m.OfPoolingAlgorithm(m.kPoolingAlgorithmMax)) - * self._average = PoolingAlgorithmWrapper( - * m.OfPoolingAlgorithm(m.kPoolingAlgorithmAverage)) # <<<<<<<<<<<<<< - * - * def find(self, a): - */ - try { - __pyx_t_1 = libowl::OfEvilEnumClass(minerva::PoolingInfo::Algorithm::kAverage); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - - /* "owl/libowl.pyx":459 - * self._max = PoolingAlgorithmWrapper( - * m.OfPoolingAlgorithm(m.kPoolingAlgorithmMax)) - * self._average = PoolingAlgorithmWrapper( # <<<<<<<<<<<<<< - * m.OfPoolingAlgorithm(m.kPoolingAlgorithmAverage)) - * - */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3owl_6libowl_PoolingAlgorithmWrapper)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_average, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "owl/libowl.pyx":456 - * - * class _PoolingAlgorithms(object): - * def __init__(self): # <<<<<<<<<<<<<< - * self._max = PoolingAlgorithmWrapper( - * m.OfPoolingAlgorithm(m.kPoolingAlgorithmMax)) - */ - - /* 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_AddTraceback("owl.libowl._PoolingAlgorithms.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":462 - * m.OfPoolingAlgorithm(m.kPoolingAlgorithmAverage)) - * - * def find(self, a): # <<<<<<<<<<<<<< - * if self._max.is_same(a): - * return self._max - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_18_PoolingAlgorithms_3find(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_3owl_6libowl_18_PoolingAlgorithms_3find = {"find", (PyCFunction)__pyx_pw_3owl_6libowl_18_PoolingAlgorithms_3find, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_3owl_6libowl_18_PoolingAlgorithms_3find(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_self = 0; - PyObject *__pyx_v_a = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("find (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_a,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); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_a)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("find", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "find") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __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_a = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("find", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("owl.libowl._PoolingAlgorithms.find", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3owl_6libowl_18_PoolingAlgorithms_2find(__pyx_self, __pyx_v_self, __pyx_v_a); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_18_PoolingAlgorithms_2find(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_a) { - 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; - int __pyx_t_5; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("find", 0); - - /* "owl/libowl.pyx":463 - * - * def find(self, a): - * if self._max.is_same(a): # <<<<<<<<<<<<<< - * return self._max - * elif self._average.is_same(a): - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_max); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_is_same); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && 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_v_a); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - } else { - __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL; - __Pyx_INCREF(__pyx_v_a); - __Pyx_GIVEREF(__pyx_v_a); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_a); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_5) { - - /* "owl/libowl.pyx":464 - * def find(self, a): - * if self._max.is_same(a): - * return self._max # <<<<<<<<<<<<<< - * elif self._average.is_same(a): - * return self._average - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_max); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - } - - /* "owl/libowl.pyx":465 - * if self._max.is_same(a): - * return self._max - * elif self._average.is_same(a): # <<<<<<<<<<<<<< - * return self._average - * else: - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_average); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_is_same); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && 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_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_a); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - } else { - __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __pyx_t_3 = NULL; - __Pyx_INCREF(__pyx_v_a); - __Pyx_GIVEREF(__pyx_v_a); - PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_v_a); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_5) { - - /* "owl/libowl.pyx":466 - * return self._max - * elif self._average.is_same(a): - * return self._average # <<<<<<<<<<<<<< - * else: - * raise TypeError('invalid pooling algorithm') - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_average); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - } - /*else*/ { - - /* "owl/libowl.pyx":468 - * return self._average - * else: - * raise TypeError('invalid pooling algorithm') # <<<<<<<<<<<<<< - * - * @property - */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "owl/libowl.pyx":462 - * m.OfPoolingAlgorithm(m.kPoolingAlgorithmAverage)) - * - * def find(self, a): # <<<<<<<<<<<<<< - * if self._max.is_same(a): - * return self._max - */ - - /* 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("owl.libowl._PoolingAlgorithms.find", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":471 - * - * @property - * def max(self): # <<<<<<<<<<<<<< - * return self._max - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_18_PoolingAlgorithms_5max(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_3owl_6libowl_18_PoolingAlgorithms_5max = {"max", (PyCFunction)__pyx_pw_3owl_6libowl_18_PoolingAlgorithms_5max, METH_O, 0}; -static PyObject *__pyx_pw_3owl_6libowl_18_PoolingAlgorithms_5max(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("max (wrapper)", 0); - __pyx_r = __pyx_pf_3owl_6libowl_18_PoolingAlgorithms_4max(__pyx_self, ((PyObject *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_18_PoolingAlgorithms_4max(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("max", 0); - - /* "owl/libowl.pyx":472 - * @property - * def max(self): - * return self._max # <<<<<<<<<<<<<< - * - * @property - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_max); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":471 - * - * @property - * def max(self): # <<<<<<<<<<<<<< - * return self._max - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("owl.libowl._PoolingAlgorithms.max", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":475 - * - * @property - * def average(self): # <<<<<<<<<<<<<< - * return self._average - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_18_PoolingAlgorithms_7average(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_3owl_6libowl_18_PoolingAlgorithms_7average = {"average", (PyCFunction)__pyx_pw_3owl_6libowl_18_PoolingAlgorithms_7average, METH_O, 0}; -static PyObject *__pyx_pw_3owl_6libowl_18_PoolingAlgorithms_7average(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("average (wrapper)", 0); - __pyx_r = __pyx_pf_3owl_6libowl_18_PoolingAlgorithms_6average(__pyx_self, ((PyObject *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_18_PoolingAlgorithms_6average(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("average", 0); - - /* "owl/libowl.pyx":476 - * @property - * def average(self): - * return self._average # <<<<<<<<<<<<<< - * - * pooling_algo = _PoolingAlgorithms() - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_average); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":475 - * - * @property - * def average(self): # <<<<<<<<<<<<<< - * return self._average - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("owl.libowl._PoolingAlgorithms.average", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":483 - * cdef int _d - * - * def __cinit__(self, int d): # <<<<<<<<<<<<<< - * self._d = d - * - */ - -/* Python wrapper */ -static int __pyx_pw_3owl_6libowl_23SoftmaxAlgorithmWrapper_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_3owl_6libowl_23SoftmaxAlgorithmWrapper_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - int __pyx_v_d; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_d,0}; - PyObject* values[1] = {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 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_d)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - } - __pyx_v_d = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_d == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("owl.libowl.SoftmaxAlgorithmWrapper.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3owl_6libowl_23SoftmaxAlgorithmWrapper___cinit__(((struct __pyx_obj_3owl_6libowl_SoftmaxAlgorithmWrapper *)__pyx_v_self), __pyx_v_d); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_3owl_6libowl_23SoftmaxAlgorithmWrapper___cinit__(struct __pyx_obj_3owl_6libowl_SoftmaxAlgorithmWrapper *__pyx_v_self, int __pyx_v_d) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__", 0); - - /* "owl/libowl.pyx":484 - * - * def __cinit__(self, int d): - * self._d = d # <<<<<<<<<<<<<< - * - * def is_same(self, SoftmaxAlgorithmWrapper rhs): - */ - __pyx_v_self->_d = __pyx_v_d; - - /* "owl/libowl.pyx":483 - * cdef int _d - * - * def __cinit__(self, int d): # <<<<<<<<<<<<<< - * self._d = d - * - */ - - /* function exit code */ - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":486 - * self._d = d - * - * def is_same(self, SoftmaxAlgorithmWrapper rhs): # <<<<<<<<<<<<<< - * return self._d == rhs._d - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_23SoftmaxAlgorithmWrapper_3is_same(PyObject *__pyx_v_self, PyObject *__pyx_v_rhs); /*proto*/ -static PyObject *__pyx_pw_3owl_6libowl_23SoftmaxAlgorithmWrapper_3is_same(PyObject *__pyx_v_self, PyObject *__pyx_v_rhs) { - CYTHON_UNUSED int __pyx_lineno = 0; - CYTHON_UNUSED const char *__pyx_filename = NULL; - CYTHON_UNUSED int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("is_same (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_rhs), __pyx_ptype_3owl_6libowl_SoftmaxAlgorithmWrapper, 1, "rhs", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_3owl_6libowl_23SoftmaxAlgorithmWrapper_2is_same(((struct __pyx_obj_3owl_6libowl_SoftmaxAlgorithmWrapper *)__pyx_v_self), ((struct __pyx_obj_3owl_6libowl_SoftmaxAlgorithmWrapper *)__pyx_v_rhs)); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_23SoftmaxAlgorithmWrapper_2is_same(struct __pyx_obj_3owl_6libowl_SoftmaxAlgorithmWrapper *__pyx_v_self, struct __pyx_obj_3owl_6libowl_SoftmaxAlgorithmWrapper *__pyx_v_rhs) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("is_same", 0); - - /* "owl/libowl.pyx":487 - * - * def is_same(self, SoftmaxAlgorithmWrapper rhs): - * return self._d == rhs._d # <<<<<<<<<<<<<< - * - * class _SoftmaxAlgorithms(object): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_self->_d == __pyx_v_rhs->_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":486 - * self._d = d - * - * def is_same(self, SoftmaxAlgorithmWrapper rhs): # <<<<<<<<<<<<<< - * return self._d == rhs._d - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("owl.libowl.SoftmaxAlgorithmWrapper.is_same", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":490 - * - * class _SoftmaxAlgorithms(object): - * def __init__(self): # <<<<<<<<<<<<<< - * self._instance = SoftmaxAlgorithmWrapper( - * m.OfSoftmaxAlgorithm(m.kSoftmaxAlgorithmInstance)) - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_18_SoftmaxAlgorithms_1__init__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_3owl_6libowl_18_SoftmaxAlgorithms_1__init__ = {"__init__", (PyCFunction)__pyx_pw_3owl_6libowl_18_SoftmaxAlgorithms_1__init__, METH_O, 0}; -static PyObject *__pyx_pw_3owl_6libowl_18_SoftmaxAlgorithms_1__init__(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); - __pyx_r = __pyx_pf_3owl_6libowl_18_SoftmaxAlgorithms___init__(__pyx_self, ((PyObject *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_18_SoftmaxAlgorithms___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__init__", 0); - - /* "owl/libowl.pyx":492 - * def __init__(self): - * self._instance = SoftmaxAlgorithmWrapper( - * m.OfSoftmaxAlgorithm(m.kSoftmaxAlgorithmInstance)) # <<<<<<<<<<<<<< - * self._channel = SoftmaxAlgorithmWrapper( - * m.OfSoftmaxAlgorithm(m.kSoftmaxAlgorithmChannel)) - */ - try { - __pyx_t_1 = libowl::OfEvilEnumClass(minerva::SoftmaxAlgorithm::kInstance); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - - /* "owl/libowl.pyx":491 - * class _SoftmaxAlgorithms(object): - * def __init__(self): - * self._instance = SoftmaxAlgorithmWrapper( # <<<<<<<<<<<<<< - * m.OfSoftmaxAlgorithm(m.kSoftmaxAlgorithmInstance)) - * self._channel = SoftmaxAlgorithmWrapper( - */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3owl_6libowl_SoftmaxAlgorithmWrapper)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_instance, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "owl/libowl.pyx":494 - * m.OfSoftmaxAlgorithm(m.kSoftmaxAlgorithmInstance)) - * self._channel = SoftmaxAlgorithmWrapper( - * m.OfSoftmaxAlgorithm(m.kSoftmaxAlgorithmChannel)) # <<<<<<<<<<<<<< - * - * def find(self, a): - */ - try { - __pyx_t_1 = libowl::OfEvilEnumClass(minerva::SoftmaxAlgorithm::kChannel); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - - /* "owl/libowl.pyx":493 - * self._instance = SoftmaxAlgorithmWrapper( - * m.OfSoftmaxAlgorithm(m.kSoftmaxAlgorithmInstance)) - * self._channel = SoftmaxAlgorithmWrapper( # <<<<<<<<<<<<<< - * m.OfSoftmaxAlgorithm(m.kSoftmaxAlgorithmChannel)) - * - */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3owl_6libowl_SoftmaxAlgorithmWrapper)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_channel, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "owl/libowl.pyx":490 - * - * class _SoftmaxAlgorithms(object): - * def __init__(self): # <<<<<<<<<<<<<< - * self._instance = SoftmaxAlgorithmWrapper( - * m.OfSoftmaxAlgorithm(m.kSoftmaxAlgorithmInstance)) - */ - - /* 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_AddTraceback("owl.libowl._SoftmaxAlgorithms.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":496 - * m.OfSoftmaxAlgorithm(m.kSoftmaxAlgorithmChannel)) - * - * def find(self, a): # <<<<<<<<<<<<<< - * if self._instance.is_same(a): - * return self._instance - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_18_SoftmaxAlgorithms_3find(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_3owl_6libowl_18_SoftmaxAlgorithms_3find = {"find", (PyCFunction)__pyx_pw_3owl_6libowl_18_SoftmaxAlgorithms_3find, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_3owl_6libowl_18_SoftmaxAlgorithms_3find(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_self = 0; - PyObject *__pyx_v_a = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("find (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_a,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); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_a)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("find", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "find") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __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_a = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("find", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("owl.libowl._SoftmaxAlgorithms.find", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3owl_6libowl_18_SoftmaxAlgorithms_2find(__pyx_self, __pyx_v_self, __pyx_v_a); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_18_SoftmaxAlgorithms_2find(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_a) { - 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; - int __pyx_t_5; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("find", 0); - - /* "owl/libowl.pyx":497 - * - * def find(self, a): - * if self._instance.is_same(a): # <<<<<<<<<<<<<< - * return self._instance - * elif self._channel.is_same(a): - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_instance); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_is_same); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && 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_v_a); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - } else { - __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL; - __Pyx_INCREF(__pyx_v_a); - __Pyx_GIVEREF(__pyx_v_a); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_a); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_5) { - - /* "owl/libowl.pyx":498 - * def find(self, a): - * if self._instance.is_same(a): - * return self._instance # <<<<<<<<<<<<<< - * elif self._channel.is_same(a): - * return self._channel - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_instance); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - } - - /* "owl/libowl.pyx":499 - * if self._instance.is_same(a): - * return self._instance - * elif self._channel.is_same(a): # <<<<<<<<<<<<<< - * return self._channel - * else: - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_channel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_is_same); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && 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_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_a); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - } else { - __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __pyx_t_3 = NULL; - __Pyx_INCREF(__pyx_v_a); - __Pyx_GIVEREF(__pyx_v_a); - PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_v_a); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_5) { - - /* "owl/libowl.pyx":500 - * return self._instance - * elif self._channel.is_same(a): - * return self._channel # <<<<<<<<<<<<<< - * else: - * raise TypeError('invalid softmax algorithm') - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_channel); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - } - /*else*/ { - - /* "owl/libowl.pyx":502 - * return self._channel - * else: - * raise TypeError('invalid softmax algorithm') # <<<<<<<<<<<<<< - * - * @property - */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "owl/libowl.pyx":496 - * m.OfSoftmaxAlgorithm(m.kSoftmaxAlgorithmChannel)) - * - * def find(self, a): # <<<<<<<<<<<<<< - * if self._instance.is_same(a): - * return self._instance - */ - - /* 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("owl.libowl._SoftmaxAlgorithms.find", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":505 - * - * @property - * def instance(self): # <<<<<<<<<<<<<< - * return self._instance - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_18_SoftmaxAlgorithms_5instance(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_3owl_6libowl_18_SoftmaxAlgorithms_5instance = {"instance", (PyCFunction)__pyx_pw_3owl_6libowl_18_SoftmaxAlgorithms_5instance, METH_O, 0}; -static PyObject *__pyx_pw_3owl_6libowl_18_SoftmaxAlgorithms_5instance(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("instance (wrapper)", 0); - __pyx_r = __pyx_pf_3owl_6libowl_18_SoftmaxAlgorithms_4instance(__pyx_self, ((PyObject *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_18_SoftmaxAlgorithms_4instance(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("instance", 0); - - /* "owl/libowl.pyx":506 - * @property - * def instance(self): - * return self._instance # <<<<<<<<<<<<<< - * - * @property - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_instance); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":505 - * - * @property - * def instance(self): # <<<<<<<<<<<<<< - * return self._instance - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("owl.libowl._SoftmaxAlgorithms.instance", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":509 - * - * @property - * def channel(self): # <<<<<<<<<<<<<< - * return self._channel - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_18_SoftmaxAlgorithms_7channel(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_3owl_6libowl_18_SoftmaxAlgorithms_7channel = {"channel", (PyCFunction)__pyx_pw_3owl_6libowl_18_SoftmaxAlgorithms_7channel, METH_O, 0}; -static PyObject *__pyx_pw_3owl_6libowl_18_SoftmaxAlgorithms_7channel(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("channel (wrapper)", 0); - __pyx_r = __pyx_pf_3owl_6libowl_18_SoftmaxAlgorithms_6channel(__pyx_self, ((PyObject *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_18_SoftmaxAlgorithms_6channel(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("channel", 0); - - /* "owl/libowl.pyx":510 - * @property - * def channel(self): - * return self._channel # <<<<<<<<<<<<<< - * - * softmax_algo = _SoftmaxAlgorithms() - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_channel); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":509 - * - * @property - * def channel(self): # <<<<<<<<<<<<<< - * return self._channel - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("owl.libowl._SoftmaxAlgorithms.channel", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":517 - * cdef int _d - * - * def __cinit__(self, int d): # <<<<<<<<<<<<<< - * self._d = d - * - */ - -/* Python wrapper */ -static int __pyx_pw_3owl_6libowl_26ActivationAlgorithmWrapper_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_3owl_6libowl_26ActivationAlgorithmWrapper_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - int __pyx_v_d; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_d,0}; - PyObject* values[1] = {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 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_d)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - } - __pyx_v_d = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_d == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("owl.libowl.ActivationAlgorithmWrapper.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3owl_6libowl_26ActivationAlgorithmWrapper___cinit__(((struct __pyx_obj_3owl_6libowl_ActivationAlgorithmWrapper *)__pyx_v_self), __pyx_v_d); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_3owl_6libowl_26ActivationAlgorithmWrapper___cinit__(struct __pyx_obj_3owl_6libowl_ActivationAlgorithmWrapper *__pyx_v_self, int __pyx_v_d) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__", 0); - - /* "owl/libowl.pyx":518 - * - * def __cinit__(self, int d): - * self._d = d # <<<<<<<<<<<<<< - * - * def is_same(self, ActivationAlgorithmWrapper rhs): - */ - __pyx_v_self->_d = __pyx_v_d; - - /* "owl/libowl.pyx":517 - * cdef int _d - * - * def __cinit__(self, int d): # <<<<<<<<<<<<<< - * self._d = d - * - */ - - /* function exit code */ - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":520 - * self._d = d - * - * def is_same(self, ActivationAlgorithmWrapper rhs): # <<<<<<<<<<<<<< - * return self._d == rhs._d - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_26ActivationAlgorithmWrapper_3is_same(PyObject *__pyx_v_self, PyObject *__pyx_v_rhs); /*proto*/ -static PyObject *__pyx_pw_3owl_6libowl_26ActivationAlgorithmWrapper_3is_same(PyObject *__pyx_v_self, PyObject *__pyx_v_rhs) { - CYTHON_UNUSED int __pyx_lineno = 0; - CYTHON_UNUSED const char *__pyx_filename = NULL; - CYTHON_UNUSED int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("is_same (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_rhs), __pyx_ptype_3owl_6libowl_ActivationAlgorithmWrapper, 1, "rhs", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_3owl_6libowl_26ActivationAlgorithmWrapper_2is_same(((struct __pyx_obj_3owl_6libowl_ActivationAlgorithmWrapper *)__pyx_v_self), ((struct __pyx_obj_3owl_6libowl_ActivationAlgorithmWrapper *)__pyx_v_rhs)); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_26ActivationAlgorithmWrapper_2is_same(struct __pyx_obj_3owl_6libowl_ActivationAlgorithmWrapper *__pyx_v_self, struct __pyx_obj_3owl_6libowl_ActivationAlgorithmWrapper *__pyx_v_rhs) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("is_same", 0); - - /* "owl/libowl.pyx":521 - * - * def is_same(self, ActivationAlgorithmWrapper rhs): - * return self._d == rhs._d # <<<<<<<<<<<<<< - * - * class _ActivationAlgorithms(object): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_self->_d == __pyx_v_rhs->_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":520 - * self._d = d - * - * def is_same(self, ActivationAlgorithmWrapper rhs): # <<<<<<<<<<<<<< - * return self._d == rhs._d - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("owl.libowl.ActivationAlgorithmWrapper.is_same", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":524 - * - * class _ActivationAlgorithms(object): - * def __init__(self): # <<<<<<<<<<<<<< - * self._sigmoid = ActivationAlgorithmWrapper( - * m.OfActivationAlgorithm(m.kActivationAlgorithmSigmoid)) - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_21_ActivationAlgorithms_1__init__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_3owl_6libowl_21_ActivationAlgorithms_1__init__ = {"__init__", (PyCFunction)__pyx_pw_3owl_6libowl_21_ActivationAlgorithms_1__init__, METH_O, 0}; -static PyObject *__pyx_pw_3owl_6libowl_21_ActivationAlgorithms_1__init__(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); - __pyx_r = __pyx_pf_3owl_6libowl_21_ActivationAlgorithms___init__(__pyx_self, ((PyObject *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_21_ActivationAlgorithms___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__init__", 0); - - /* "owl/libowl.pyx":526 - * def __init__(self): - * self._sigmoid = ActivationAlgorithmWrapper( - * m.OfActivationAlgorithm(m.kActivationAlgorithmSigmoid)) # <<<<<<<<<<<<<< - * self._relu = ActivationAlgorithmWrapper( - * m.OfActivationAlgorithm(m.kActivationAlgorithmRelu)) - */ - try { - __pyx_t_1 = libowl::OfEvilEnumClass(minerva::ActivationAlgorithm::kSigmoid); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - - /* "owl/libowl.pyx":525 - * class _ActivationAlgorithms(object): - * def __init__(self): - * self._sigmoid = ActivationAlgorithmWrapper( # <<<<<<<<<<<<<< - * m.OfActivationAlgorithm(m.kActivationAlgorithmSigmoid)) - * self._relu = ActivationAlgorithmWrapper( - */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3owl_6libowl_ActivationAlgorithmWrapper)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_sigmoid, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "owl/libowl.pyx":528 - * m.OfActivationAlgorithm(m.kActivationAlgorithmSigmoid)) - * self._relu = ActivationAlgorithmWrapper( - * m.OfActivationAlgorithm(m.kActivationAlgorithmRelu)) # <<<<<<<<<<<<<< - * self._tanh = ActivationAlgorithmWrapper( - * m.OfActivationAlgorithm(m.kActivationAlgorithmTanh)) - */ - try { - __pyx_t_1 = libowl::OfEvilEnumClass(minerva::ActivationAlgorithm::kRelu); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - - /* "owl/libowl.pyx":527 - * self._sigmoid = ActivationAlgorithmWrapper( - * m.OfActivationAlgorithm(m.kActivationAlgorithmSigmoid)) - * self._relu = ActivationAlgorithmWrapper( # <<<<<<<<<<<<<< - * m.OfActivationAlgorithm(m.kActivationAlgorithmRelu)) - * self._tanh = ActivationAlgorithmWrapper( - */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3owl_6libowl_ActivationAlgorithmWrapper)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_relu, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "owl/libowl.pyx":530 - * m.OfActivationAlgorithm(m.kActivationAlgorithmRelu)) - * self._tanh = ActivationAlgorithmWrapper( - * m.OfActivationAlgorithm(m.kActivationAlgorithmTanh)) # <<<<<<<<<<<<<< - * - * def find(self, a): - */ - try { - __pyx_t_1 = libowl::OfEvilEnumClass(minerva::ActivationAlgorithm::kTanh); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - - /* "owl/libowl.pyx":529 - * self._relu = ActivationAlgorithmWrapper( - * m.OfActivationAlgorithm(m.kActivationAlgorithmRelu)) - * self._tanh = ActivationAlgorithmWrapper( # <<<<<<<<<<<<<< - * m.OfActivationAlgorithm(m.kActivationAlgorithmTanh)) - * - */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3owl_6libowl_ActivationAlgorithmWrapper)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_tanh, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "owl/libowl.pyx":524 - * - * class _ActivationAlgorithms(object): - * def __init__(self): # <<<<<<<<<<<<<< - * self._sigmoid = ActivationAlgorithmWrapper( - * m.OfActivationAlgorithm(m.kActivationAlgorithmSigmoid)) - */ - - /* 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_AddTraceback("owl.libowl._ActivationAlgorithms.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":532 - * m.OfActivationAlgorithm(m.kActivationAlgorithmTanh)) - * - * def find(self, a): # <<<<<<<<<<<<<< - * if self._sigmoid.is_same(a): - * return self._sigmoid - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_21_ActivationAlgorithms_3find(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_3owl_6libowl_21_ActivationAlgorithms_3find = {"find", (PyCFunction)__pyx_pw_3owl_6libowl_21_ActivationAlgorithms_3find, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_3owl_6libowl_21_ActivationAlgorithms_3find(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_self = 0; - PyObject *__pyx_v_a = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("find (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_a,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); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_a)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("find", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "find") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __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_a = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("find", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("owl.libowl._ActivationAlgorithms.find", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3owl_6libowl_21_ActivationAlgorithms_2find(__pyx_self, __pyx_v_self, __pyx_v_a); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_21_ActivationAlgorithms_2find(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_a) { - 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; - int __pyx_t_5; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("find", 0); - - /* "owl/libowl.pyx":533 - * - * def find(self, a): - * if self._sigmoid.is_same(a): # <<<<<<<<<<<<<< - * return self._sigmoid - * elif self._relu.is_same(a): - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_sigmoid); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_is_same); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && 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_v_a); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - } else { - __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL; - __Pyx_INCREF(__pyx_v_a); - __Pyx_GIVEREF(__pyx_v_a); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_a); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_5) { - - /* "owl/libowl.pyx":534 - * def find(self, a): - * if self._sigmoid.is_same(a): - * return self._sigmoid # <<<<<<<<<<<<<< - * elif self._relu.is_same(a): - * return self._relu - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_sigmoid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 534; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - } - - /* "owl/libowl.pyx":535 - * if self._sigmoid.is_same(a): - * return self._sigmoid - * elif self._relu.is_same(a): # <<<<<<<<<<<<<< - * return self._relu - * elif self._relu.is_same(a): - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_relu); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_is_same); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && 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_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_a); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - } else { - __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __pyx_t_3 = NULL; - __Pyx_INCREF(__pyx_v_a); - __Pyx_GIVEREF(__pyx_v_a); - PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_v_a); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_5) { - - /* "owl/libowl.pyx":536 - * return self._sigmoid - * elif self._relu.is_same(a): - * return self._relu # <<<<<<<<<<<<<< - * elif self._relu.is_same(a): - * return self._tanh - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_relu); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - } - - /* "owl/libowl.pyx":537 - * elif self._relu.is_same(a): - * return self._relu - * elif self._relu.is_same(a): # <<<<<<<<<<<<<< - * return self._tanh - * else: - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_relu); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_is_same); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (!__pyx_t_4) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_a); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - } else { - __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __pyx_t_4 = NULL; - __Pyx_INCREF(__pyx_v_a); - __Pyx_GIVEREF(__pyx_v_a); - PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_a); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_5) { - - /* "owl/libowl.pyx":538 - * return self._relu - * elif self._relu.is_same(a): - * return self._tanh # <<<<<<<<<<<<<< - * else: - * raise TypeError('invalid activation algorithm') - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_tanh); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - } - /*else*/ { - - /* "owl/libowl.pyx":540 - * return self._tanh - * else: - * raise TypeError('invalid activation algorithm') # <<<<<<<<<<<<<< - * - * @property - */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "owl/libowl.pyx":532 - * m.OfActivationAlgorithm(m.kActivationAlgorithmTanh)) - * - * def find(self, a): # <<<<<<<<<<<<<< - * if self._sigmoid.is_same(a): - * return self._sigmoid - */ - - /* 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("owl.libowl._ActivationAlgorithms.find", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":543 - * - * @property - * def sigmoid(self): # <<<<<<<<<<<<<< - * return self._sigmoid - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_21_ActivationAlgorithms_5sigmoid(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_3owl_6libowl_21_ActivationAlgorithms_5sigmoid = {"sigmoid", (PyCFunction)__pyx_pw_3owl_6libowl_21_ActivationAlgorithms_5sigmoid, METH_O, 0}; -static PyObject *__pyx_pw_3owl_6libowl_21_ActivationAlgorithms_5sigmoid(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("sigmoid (wrapper)", 0); - __pyx_r = __pyx_pf_3owl_6libowl_21_ActivationAlgorithms_4sigmoid(__pyx_self, ((PyObject *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_21_ActivationAlgorithms_4sigmoid(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("sigmoid", 0); - - /* "owl/libowl.pyx":544 - * @property - * def sigmoid(self): - * return self._sigmoid # <<<<<<<<<<<<<< - * - * @property - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_sigmoid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":543 - * - * @property - * def sigmoid(self): # <<<<<<<<<<<<<< - * return self._sigmoid - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("owl.libowl._ActivationAlgorithms.sigmoid", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":547 - * - * @property - * def relu(self): # <<<<<<<<<<<<<< - * return self._relu - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_21_ActivationAlgorithms_7relu(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_3owl_6libowl_21_ActivationAlgorithms_7relu = {"relu", (PyCFunction)__pyx_pw_3owl_6libowl_21_ActivationAlgorithms_7relu, METH_O, 0}; -static PyObject *__pyx_pw_3owl_6libowl_21_ActivationAlgorithms_7relu(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("relu (wrapper)", 0); - __pyx_r = __pyx_pf_3owl_6libowl_21_ActivationAlgorithms_6relu(__pyx_self, ((PyObject *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_21_ActivationAlgorithms_6relu(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("relu", 0); - - /* "owl/libowl.pyx":548 - * @property - * def relu(self): - * return self._relu # <<<<<<<<<<<<<< - * - * @property - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_relu); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":547 - * - * @property - * def relu(self): # <<<<<<<<<<<<<< - * return self._relu - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("owl.libowl._ActivationAlgorithms.relu", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":551 - * - * @property - * def tanh(self): # <<<<<<<<<<<<<< - * return self._tanh - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_21_ActivationAlgorithms_9tanh(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_3owl_6libowl_21_ActivationAlgorithms_9tanh = {"tanh", (PyCFunction)__pyx_pw_3owl_6libowl_21_ActivationAlgorithms_9tanh, METH_O, 0}; -static PyObject *__pyx_pw_3owl_6libowl_21_ActivationAlgorithms_9tanh(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("tanh (wrapper)", 0); - __pyx_r = __pyx_pf_3owl_6libowl_21_ActivationAlgorithms_8tanh(__pyx_self, ((PyObject *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_21_ActivationAlgorithms_8tanh(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("tanh", 0); - - /* "owl/libowl.pyx":552 - * @property - * def tanh(self): - * return self._tanh # <<<<<<<<<<<<<< - * - * activation_algo = _ActivationAlgorithms() - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_tanh); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":551 - * - * @property - * def tanh(self): # <<<<<<<<<<<<<< - * return self._tanh - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("owl.libowl._ActivationAlgorithms.tanh", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":559 - * cdef m.ConvInfo* _d - * - * def __cinit__( # <<<<<<<<<<<<<< - * self - * , int ph=0 - */ - -/* Python wrapper */ -static int __pyx_pw_3owl_6libowl_8ConvInfo_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_3owl_6libowl_8ConvInfo_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - int __pyx_v_ph; - int __pyx_v_pw; - int __pyx_v_sv; - int __pyx_v_sh; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ph,&__pyx_n_s_pw,&__pyx_n_s_sv,&__pyx_n_s_sh,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); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ph); - if (value) { values[0] = value; kw_args--; } - } - case 1: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pw); - if (value) { values[1] = value; kw_args--; } - } - case 2: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_sv); - if (value) { values[2] = value; kw_args--; } - } - case 3: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_sh); - if (value) { values[3] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - } - if (values[0]) { - __pyx_v_ph = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_ph == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - __pyx_v_ph = ((int)0); - } - if (values[1]) { - __pyx_v_pw = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_pw == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - __pyx_v_pw = ((int)0); - } - if (values[2]) { - __pyx_v_sv = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_sv == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - __pyx_v_sv = ((int)1); - } - if (values[3]) { - __pyx_v_sh = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_sh == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - __pyx_v_sh = ((int)1); - } - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("owl.libowl.ConvInfo.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3owl_6libowl_8ConvInfo___cinit__(((struct __pyx_obj_3owl_6libowl_ConvInfo *)__pyx_v_self), __pyx_v_ph, __pyx_v_pw, __pyx_v_sv, __pyx_v_sh); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_3owl_6libowl_8ConvInfo___cinit__(struct __pyx_obj_3owl_6libowl_ConvInfo *__pyx_v_self, int __pyx_v_ph, int __pyx_v_pw, int __pyx_v_sv, int __pyx_v_sh) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__", 0); - - /* "owl/libowl.pyx":565 - * , int sv=1 - * , int sh=1): - * self._d = new m.ConvInfo(ph, pw, sv, sh) # <<<<<<<<<<<<<< - * - * def __dealloc__(self): - */ - __pyx_v_self->_d = new minerva::ConvInfo(__pyx_v_ph, __pyx_v_pw, __pyx_v_sv, __pyx_v_sh); - - /* "owl/libowl.pyx":559 - * cdef m.ConvInfo* _d - * - * def __cinit__( # <<<<<<<<<<<<<< - * self - * , int ph=0 - */ - - /* function exit code */ - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":567 - * self._d = new m.ConvInfo(ph, pw, sv, sh) - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * del self._d - * - */ - -/* Python wrapper */ -static void __pyx_pw_3owl_6libowl_8ConvInfo_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_3owl_6libowl_8ConvInfo_3__dealloc__(PyObject *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_pf_3owl_6libowl_8ConvInfo_2__dealloc__(((struct __pyx_obj_3owl_6libowl_ConvInfo *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -static void __pyx_pf_3owl_6libowl_8ConvInfo_2__dealloc__(struct __pyx_obj_3owl_6libowl_ConvInfo *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__", 0); - - /* "owl/libowl.pyx":568 - * - * def __dealloc__(self): - * del self._d # <<<<<<<<<<<<<< - * - * property pad_height: - */ - delete __pyx_v_self->_d; - - /* "owl/libowl.pyx":567 - * self._d = new m.ConvInfo(ph, pw, sv, sh) - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * del self._d - * - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "owl/libowl.pyx":571 - * - * property pad_height: - * def __set__(self, ph): # <<<<<<<<<<<<<< - * self._d.pad_height = ph - * - */ - -/* Python wrapper */ -static int __pyx_pw_3owl_6libowl_8ConvInfo_10pad_height_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_ph); /*proto*/ -static int __pyx_pw_3owl_6libowl_8ConvInfo_10pad_height_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_ph) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_3owl_6libowl_8ConvInfo_10pad_height___set__(((struct __pyx_obj_3owl_6libowl_ConvInfo *)__pyx_v_self), ((PyObject *)__pyx_v_ph)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_3owl_6libowl_8ConvInfo_10pad_height___set__(struct __pyx_obj_3owl_6libowl_ConvInfo *__pyx_v_self, PyObject *__pyx_v_ph) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__set__", 0); - - /* "owl/libowl.pyx":572 - * property pad_height: - * def __set__(self, ph): - * self._d.pad_height = ph # <<<<<<<<<<<<<< - * - * def __get__(self): - */ - __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_ph); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_self->_d->pad_height = __pyx_t_1; - - /* "owl/libowl.pyx":571 - * - * property pad_height: - * def __set__(self, ph): # <<<<<<<<<<<<<< - * self._d.pad_height = ph - * - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("owl.libowl.ConvInfo.pad_height.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":574 - * self._d.pad_height = ph - * - * def __get__(self): # <<<<<<<<<<<<<< - * return self._d.pad_height - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_8ConvInfo_10pad_height_3__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_3owl_6libowl_8ConvInfo_10pad_height_3__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_3owl_6libowl_8ConvInfo_10pad_height_2__get__(((struct __pyx_obj_3owl_6libowl_ConvInfo *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_8ConvInfo_10pad_height_2__get__(struct __pyx_obj_3owl_6libowl_ConvInfo *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "owl/libowl.pyx":575 - * - * def __get__(self): - * return self._d.pad_height # <<<<<<<<<<<<<< - * - * property pad_width: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->_d->pad_height); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":574 - * self._d.pad_height = ph - * - * def __get__(self): # <<<<<<<<<<<<<< - * return self._d.pad_height - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("owl.libowl.ConvInfo.pad_height.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":578 - * - * property pad_width: - * def __set__(self, pw): # <<<<<<<<<<<<<< - * self._d.pad_width = pw - * - */ - -/* Python wrapper */ -static int __pyx_pw_3owl_6libowl_8ConvInfo_9pad_width_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_pw); /*proto*/ -static int __pyx_pw_3owl_6libowl_8ConvInfo_9pad_width_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_pw) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_3owl_6libowl_8ConvInfo_9pad_width___set__(((struct __pyx_obj_3owl_6libowl_ConvInfo *)__pyx_v_self), ((PyObject *)__pyx_v_pw)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_3owl_6libowl_8ConvInfo_9pad_width___set__(struct __pyx_obj_3owl_6libowl_ConvInfo *__pyx_v_self, PyObject *__pyx_v_pw) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__set__", 0); - - /* "owl/libowl.pyx":579 - * property pad_width: - * def __set__(self, pw): - * self._d.pad_width = pw # <<<<<<<<<<<<<< - * - * def __get__(self): - */ - __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_pw); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_self->_d->pad_width = __pyx_t_1; - - /* "owl/libowl.pyx":578 - * - * property pad_width: - * def __set__(self, pw): # <<<<<<<<<<<<<< - * self._d.pad_width = pw - * - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("owl.libowl.ConvInfo.pad_width.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":581 - * self._d.pad_width = pw - * - * def __get__(self): # <<<<<<<<<<<<<< - * return self._d.pad_width - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_8ConvInfo_9pad_width_3__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_3owl_6libowl_8ConvInfo_9pad_width_3__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_3owl_6libowl_8ConvInfo_9pad_width_2__get__(((struct __pyx_obj_3owl_6libowl_ConvInfo *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_8ConvInfo_9pad_width_2__get__(struct __pyx_obj_3owl_6libowl_ConvInfo *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "owl/libowl.pyx":582 - * - * def __get__(self): - * return self._d.pad_width # <<<<<<<<<<<<<< - * - * property stride_vertical: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->_d->pad_width); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":581 - * self._d.pad_width = pw - * - * def __get__(self): # <<<<<<<<<<<<<< - * return self._d.pad_width - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("owl.libowl.ConvInfo.pad_width.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":585 - * - * property stride_vertical: - * def __set__(self, sv): # <<<<<<<<<<<<<< - * self._d.stride_vertical = sv - * - */ - -/* Python wrapper */ -static int __pyx_pw_3owl_6libowl_8ConvInfo_15stride_vertical_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_sv); /*proto*/ -static int __pyx_pw_3owl_6libowl_8ConvInfo_15stride_vertical_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_sv) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_3owl_6libowl_8ConvInfo_15stride_vertical___set__(((struct __pyx_obj_3owl_6libowl_ConvInfo *)__pyx_v_self), ((PyObject *)__pyx_v_sv)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_3owl_6libowl_8ConvInfo_15stride_vertical___set__(struct __pyx_obj_3owl_6libowl_ConvInfo *__pyx_v_self, PyObject *__pyx_v_sv) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__set__", 0); - - /* "owl/libowl.pyx":586 - * property stride_vertical: - * def __set__(self, sv): - * self._d.stride_vertical = sv # <<<<<<<<<<<<<< - * - * def __get__(self): - */ - __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_sv); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_self->_d->stride_vertical = __pyx_t_1; - - /* "owl/libowl.pyx":585 - * - * property stride_vertical: - * def __set__(self, sv): # <<<<<<<<<<<<<< - * self._d.stride_vertical = sv - * - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("owl.libowl.ConvInfo.stride_vertical.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":588 - * self._d.stride_vertical = sv - * - * def __get__(self): # <<<<<<<<<<<<<< - * return self._d.stride_vertical - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_8ConvInfo_15stride_vertical_3__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_3owl_6libowl_8ConvInfo_15stride_vertical_3__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_3owl_6libowl_8ConvInfo_15stride_vertical_2__get__(((struct __pyx_obj_3owl_6libowl_ConvInfo *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_8ConvInfo_15stride_vertical_2__get__(struct __pyx_obj_3owl_6libowl_ConvInfo *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "owl/libowl.pyx":589 - * - * def __get__(self): - * return self._d.stride_vertical # <<<<<<<<<<<<<< - * - * property stride_horizontal: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->_d->stride_vertical); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":588 - * self._d.stride_vertical = sv - * - * def __get__(self): # <<<<<<<<<<<<<< - * return self._d.stride_vertical - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("owl.libowl.ConvInfo.stride_vertical.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":592 - * - * property stride_horizontal: - * def __set__(self, sh): # <<<<<<<<<<<<<< - * self._d.stride_horizontal = sh - * - */ - -/* Python wrapper */ -static int __pyx_pw_3owl_6libowl_8ConvInfo_17stride_horizontal_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_sh); /*proto*/ -static int __pyx_pw_3owl_6libowl_8ConvInfo_17stride_horizontal_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_sh) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_3owl_6libowl_8ConvInfo_17stride_horizontal___set__(((struct __pyx_obj_3owl_6libowl_ConvInfo *)__pyx_v_self), ((PyObject *)__pyx_v_sh)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_3owl_6libowl_8ConvInfo_17stride_horizontal___set__(struct __pyx_obj_3owl_6libowl_ConvInfo *__pyx_v_self, PyObject *__pyx_v_sh) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__set__", 0); - - /* "owl/libowl.pyx":593 - * property stride_horizontal: - * def __set__(self, sh): - * self._d.stride_horizontal = sh # <<<<<<<<<<<<<< - * - * def __get__(self): - */ - __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_sh); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_self->_d->stride_horizontal = __pyx_t_1; - - /* "owl/libowl.pyx":592 - * - * property stride_horizontal: - * def __set__(self, sh): # <<<<<<<<<<<<<< - * self._d.stride_horizontal = sh - * - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("owl.libowl.ConvInfo.stride_horizontal.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":595 - * self._d.stride_horizontal = sh - * - * def __get__(self): # <<<<<<<<<<<<<< - * return self._d.stride_horizontal - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_8ConvInfo_17stride_horizontal_3__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_3owl_6libowl_8ConvInfo_17stride_horizontal_3__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_3owl_6libowl_8ConvInfo_17stride_horizontal_2__get__(((struct __pyx_obj_3owl_6libowl_ConvInfo *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_8ConvInfo_17stride_horizontal_2__get__(struct __pyx_obj_3owl_6libowl_ConvInfo *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "owl/libowl.pyx":596 - * - * def __get__(self): - * return self._d.stride_horizontal # <<<<<<<<<<<<<< - * - * cdef class PoolingInfo(object): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->_d->stride_horizontal); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":595 - * self._d.stride_horizontal = sh - * - * def __get__(self): # <<<<<<<<<<<<<< - * return self._d.stride_horizontal - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("owl.libowl.ConvInfo.stride_horizontal.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":601 - * cdef m.PoolingInfo* _d - * - * def __cinit__( # <<<<<<<<<<<<<< - * self - * , PoolingAlgorithmWrapper a=pooling_algo.max - */ - -/* Python wrapper */ -static int __pyx_pw_3owl_6libowl_11PoolingInfo_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_3owl_6libowl_11PoolingInfo_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - struct __pyx_obj_3owl_6libowl_PoolingAlgorithmWrapper *__pyx_v_a = 0; - int __pyx_v_h; - int __pyx_v_w; - int __pyx_v_sv; - int __pyx_v_sh; - int __pyx_v_ph; - int __pyx_v_pw; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_a,&__pyx_n_s_h,&__pyx_n_s_w,&__pyx_n_s_sv,&__pyx_n_s_sh,&__pyx_n_s_ph,&__pyx_n_s_pw,0}; - PyObject* values[7] = {0,0,0,0,0,0,0}; - values[0] = (PyObject *)__pyx_k__4; - 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); - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_a); - if (value) { values[0] = value; kw_args--; } - } - case 1: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_h); - if (value) { values[1] = value; kw_args--; } - } - case 2: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_w); - if (value) { values[2] = value; kw_args--; } - } - case 3: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_sv); - if (value) { values[3] = value; kw_args--; } - } - case 4: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_sh); - if (value) { values[4] = value; kw_args--; } - } - case 5: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ph); - if (value) { values[5] = value; kw_args--; } - } - case 6: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pw); - if (value) { values[6] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_a = ((struct __pyx_obj_3owl_6libowl_PoolingAlgorithmWrapper *)values[0]); - if (values[1]) { - __pyx_v_h = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_h == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - __pyx_v_h = ((int)0); - } - if (values[2]) { - __pyx_v_w = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_w == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - __pyx_v_w = ((int)0); - } - if (values[3]) { - __pyx_v_sv = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_sv == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - __pyx_v_sv = ((int)0); - } - if (values[4]) { - __pyx_v_sh = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_sh == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - __pyx_v_sh = ((int)0); - } - if (values[5]) { - __pyx_v_ph = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_ph == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - __pyx_v_ph = ((int)0); - } - if (values[6]) { - __pyx_v_pw = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_pw == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - __pyx_v_pw = ((int)0); - } - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 7, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("owl.libowl.PoolingInfo.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_a), __pyx_ptype_3owl_6libowl_PoolingAlgorithmWrapper, 1, "a", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_3owl_6libowl_11PoolingInfo___cinit__(((struct __pyx_obj_3owl_6libowl_PoolingInfo *)__pyx_v_self), __pyx_v_a, __pyx_v_h, __pyx_v_w, __pyx_v_sv, __pyx_v_sh, __pyx_v_ph, __pyx_v_pw); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_3owl_6libowl_11PoolingInfo___cinit__(struct __pyx_obj_3owl_6libowl_PoolingInfo *__pyx_v_self, struct __pyx_obj_3owl_6libowl_PoolingAlgorithmWrapper *__pyx_v_a, int __pyx_v_h, int __pyx_v_w, int __pyx_v_sv, int __pyx_v_sh, int __pyx_v_ph, int __pyx_v_pw) { - minerva::PoolingInfo::Algorithm __pyx_v_algo; - int __pyx_r; - __Pyx_RefNannyDeclarations - minerva::PoolingInfo::Algorithm __pyx_t_1; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__cinit__", 0); - - /* "owl/libowl.pyx":611 - * , int pw=0): - * cdef m.PoolingAlgorithm algo - * algo = m.ToPoolingAlgorithm(a._d) # <<<<<<<<<<<<<< - * self._d = new m.PoolingInfo(algo, h, w, sv, sh, ph, pw) - * - */ - try { - __pyx_t_1 = libowl::ToEvilEnumClass(__pyx_v_a->_d); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_algo = __pyx_t_1; - - /* "owl/libowl.pyx":612 - * cdef m.PoolingAlgorithm algo - * algo = m.ToPoolingAlgorithm(a._d) - * self._d = new m.PoolingInfo(algo, h, w, sv, sh, ph, pw) # <<<<<<<<<<<<<< - * - * def __dealloc__(self): - */ - __pyx_v_self->_d = new minerva::PoolingInfo(__pyx_v_algo, __pyx_v_h, __pyx_v_w, __pyx_v_sv, __pyx_v_sh, __pyx_v_ph, __pyx_v_pw); - - /* "owl/libowl.pyx":601 - * cdef m.PoolingInfo* _d - * - * def __cinit__( # <<<<<<<<<<<<<< - * self - * , PoolingAlgorithmWrapper a=pooling_algo.max - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("owl.libowl.PoolingInfo.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":614 - * self._d = new m.PoolingInfo(algo, h, w, sv, sh, ph, pw) - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * del self._d - * - */ - -/* Python wrapper */ -static void __pyx_pw_3owl_6libowl_11PoolingInfo_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_3owl_6libowl_11PoolingInfo_3__dealloc__(PyObject *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_pf_3owl_6libowl_11PoolingInfo_2__dealloc__(((struct __pyx_obj_3owl_6libowl_PoolingInfo *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -static void __pyx_pf_3owl_6libowl_11PoolingInfo_2__dealloc__(struct __pyx_obj_3owl_6libowl_PoolingInfo *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__", 0); - - /* "owl/libowl.pyx":615 - * - * def __dealloc__(self): - * del self._d # <<<<<<<<<<<<<< - * - * property algorithm: - */ - delete __pyx_v_self->_d; - - /* "owl/libowl.pyx":614 - * self._d = new m.PoolingInfo(algo, h, w, sv, sh, ph, pw) - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * del self._d - * - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "owl/libowl.pyx":618 - * - * property algorithm: - * def __set__(self, PoolingAlgorithmWrapper a): # <<<<<<<<<<<<<< - * cdef m.PoolingAlgorithm algo - * algo = m.ToPoolingAlgorithm(a._d) - */ - -/* Python wrapper */ -static int __pyx_pw_3owl_6libowl_11PoolingInfo_9algorithm_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_a); /*proto*/ -static int __pyx_pw_3owl_6libowl_11PoolingInfo_9algorithm_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_a) { - CYTHON_UNUSED int __pyx_lineno = 0; - CYTHON_UNUSED const char *__pyx_filename = NULL; - CYTHON_UNUSED int __pyx_clineno = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_a), __pyx_ptype_3owl_6libowl_PoolingAlgorithmWrapper, 1, "a", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_3owl_6libowl_11PoolingInfo_9algorithm___set__(((struct __pyx_obj_3owl_6libowl_PoolingInfo *)__pyx_v_self), ((struct __pyx_obj_3owl_6libowl_PoolingAlgorithmWrapper *)__pyx_v_a)); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_3owl_6libowl_11PoolingInfo_9algorithm___set__(struct __pyx_obj_3owl_6libowl_PoolingInfo *__pyx_v_self, struct __pyx_obj_3owl_6libowl_PoolingAlgorithmWrapper *__pyx_v_a) { - minerva::PoolingInfo::Algorithm __pyx_v_algo; - int __pyx_r; - __Pyx_RefNannyDeclarations - minerva::PoolingInfo::Algorithm __pyx_t_1; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__set__", 0); - - /* "owl/libowl.pyx":620 - * def __set__(self, PoolingAlgorithmWrapper a): - * cdef m.PoolingAlgorithm algo - * algo = m.ToPoolingAlgorithm(a._d) # <<<<<<<<<<<<<< - * self._d.algorithm = algo - * - */ - try { - __pyx_t_1 = libowl::ToEvilEnumClass(__pyx_v_a->_d); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 620; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_algo = __pyx_t_1; - - /* "owl/libowl.pyx":621 - * cdef m.PoolingAlgorithm algo - * algo = m.ToPoolingAlgorithm(a._d) - * self._d.algorithm = algo # <<<<<<<<<<<<<< - * - * def __get__(self): - */ - __pyx_v_self->_d->algorithm = __pyx_v_algo; - - /* "owl/libowl.pyx":618 - * - * property algorithm: - * def __set__(self, PoolingAlgorithmWrapper a): # <<<<<<<<<<<<<< - * cdef m.PoolingAlgorithm algo - * algo = m.ToPoolingAlgorithm(a._d) - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("owl.libowl.PoolingInfo.algorithm.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":623 - * self._d.algorithm = algo - * - * def __get__(self): # <<<<<<<<<<<<<< - * return pooling_algo.find(PoolingAlgorithmWrapper( - * m.OfPoolingAlgorithm(self._d.algorithm))) - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_11PoolingInfo_9algorithm_3__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_3owl_6libowl_11PoolingInfo_9algorithm_3__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_3owl_6libowl_11PoolingInfo_9algorithm_2__get__(((struct __pyx_obj_3owl_6libowl_PoolingInfo *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_11PoolingInfo_9algorithm_2__get__(struct __pyx_obj_3owl_6libowl_PoolingInfo *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "owl/libowl.pyx":624 - * - * def __get__(self): - * return pooling_algo.find(PoolingAlgorithmWrapper( # <<<<<<<<<<<<<< - * m.OfPoolingAlgorithm(self._d.algorithm))) - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_pooling_algo); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_find); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "owl/libowl.pyx":625 - * def __get__(self): - * return pooling_algo.find(PoolingAlgorithmWrapper( - * m.OfPoolingAlgorithm(self._d.algorithm))) # <<<<<<<<<<<<<< - * - * property height: - */ - try { - __pyx_t_4 = libowl::OfEvilEnumClass(__pyx_v_self->_d->algorithm); - } catch(...) { - __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - - /* "owl/libowl.pyx":624 - * - * def __get__(self): - * return pooling_algo.find(PoolingAlgorithmWrapper( # <<<<<<<<<<<<<< - * m.OfPoolingAlgorithm(self._d.algorithm))) - * - */ - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3owl_6libowl_PoolingAlgorithmWrapper)), __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && 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_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else { - __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __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_2); - PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":623 - * self._d.algorithm = algo - * - * def __get__(self): # <<<<<<<<<<<<<< - * return pooling_algo.find(PoolingAlgorithmWrapper( - * m.OfPoolingAlgorithm(self._d.algorithm))) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("owl.libowl.PoolingInfo.algorithm.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":628 - * - * property height: - * def __set__(self, h): # <<<<<<<<<<<<<< - * self._d.height = h - * - */ - -/* Python wrapper */ -static int __pyx_pw_3owl_6libowl_11PoolingInfo_6height_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_h); /*proto*/ -static int __pyx_pw_3owl_6libowl_11PoolingInfo_6height_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_h) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_3owl_6libowl_11PoolingInfo_6height___set__(((struct __pyx_obj_3owl_6libowl_PoolingInfo *)__pyx_v_self), ((PyObject *)__pyx_v_h)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_3owl_6libowl_11PoolingInfo_6height___set__(struct __pyx_obj_3owl_6libowl_PoolingInfo *__pyx_v_self, PyObject *__pyx_v_h) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__set__", 0); - - /* "owl/libowl.pyx":629 - * property height: - * def __set__(self, h): - * self._d.height = h # <<<<<<<<<<<<<< - * - * def __get__(self): - */ - __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_h); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_self->_d->height = __pyx_t_1; - - /* "owl/libowl.pyx":628 - * - * property height: - * def __set__(self, h): # <<<<<<<<<<<<<< - * self._d.height = h - * - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("owl.libowl.PoolingInfo.height.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":631 - * self._d.height = h - * - * def __get__(self): # <<<<<<<<<<<<<< - * return self._d.height - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_11PoolingInfo_6height_3__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_3owl_6libowl_11PoolingInfo_6height_3__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_3owl_6libowl_11PoolingInfo_6height_2__get__(((struct __pyx_obj_3owl_6libowl_PoolingInfo *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_11PoolingInfo_6height_2__get__(struct __pyx_obj_3owl_6libowl_PoolingInfo *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "owl/libowl.pyx":632 - * - * def __get__(self): - * return self._d.height # <<<<<<<<<<<<<< - * - * property width: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->_d->height); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":631 - * self._d.height = h - * - * def __get__(self): # <<<<<<<<<<<<<< - * return self._d.height - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("owl.libowl.PoolingInfo.height.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":635 - * - * property width: - * def __set__(self, w): # <<<<<<<<<<<<<< - * self._d.width = w - * - */ - -/* Python wrapper */ -static int __pyx_pw_3owl_6libowl_11PoolingInfo_5width_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_w); /*proto*/ -static int __pyx_pw_3owl_6libowl_11PoolingInfo_5width_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_w) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_3owl_6libowl_11PoolingInfo_5width___set__(((struct __pyx_obj_3owl_6libowl_PoolingInfo *)__pyx_v_self), ((PyObject *)__pyx_v_w)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_3owl_6libowl_11PoolingInfo_5width___set__(struct __pyx_obj_3owl_6libowl_PoolingInfo *__pyx_v_self, PyObject *__pyx_v_w) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__set__", 0); - - /* "owl/libowl.pyx":636 - * property width: - * def __set__(self, w): - * self._d.width = w # <<<<<<<<<<<<<< - * - * def __get__(self): - */ - __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_w); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_self->_d->width = __pyx_t_1; - - /* "owl/libowl.pyx":635 - * - * property width: - * def __set__(self, w): # <<<<<<<<<<<<<< - * self._d.width = w - * - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("owl.libowl.PoolingInfo.width.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":638 - * self._d.width = w - * - * def __get__(self): # <<<<<<<<<<<<<< - * return self._d.width - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_11PoolingInfo_5width_3__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_3owl_6libowl_11PoolingInfo_5width_3__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_3owl_6libowl_11PoolingInfo_5width_2__get__(((struct __pyx_obj_3owl_6libowl_PoolingInfo *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_11PoolingInfo_5width_2__get__(struct __pyx_obj_3owl_6libowl_PoolingInfo *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "owl/libowl.pyx":639 - * - * def __get__(self): - * return self._d.width # <<<<<<<<<<<<<< - * - * property stride_vertical: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->_d->width); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":638 - * self._d.width = w - * - * def __get__(self): # <<<<<<<<<<<<<< - * return self._d.width - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("owl.libowl.PoolingInfo.width.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":642 - * - * property stride_vertical: - * def __set__(self, sv): # <<<<<<<<<<<<<< - * self._d.stride_vertical = sv - * - */ - -/* Python wrapper */ -static int __pyx_pw_3owl_6libowl_11PoolingInfo_15stride_vertical_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_sv); /*proto*/ -static int __pyx_pw_3owl_6libowl_11PoolingInfo_15stride_vertical_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_sv) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_3owl_6libowl_11PoolingInfo_15stride_vertical___set__(((struct __pyx_obj_3owl_6libowl_PoolingInfo *)__pyx_v_self), ((PyObject *)__pyx_v_sv)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_3owl_6libowl_11PoolingInfo_15stride_vertical___set__(struct __pyx_obj_3owl_6libowl_PoolingInfo *__pyx_v_self, PyObject *__pyx_v_sv) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__set__", 0); - - /* "owl/libowl.pyx":643 - * property stride_vertical: - * def __set__(self, sv): - * self._d.stride_vertical = sv # <<<<<<<<<<<<<< - * - * def __get__(self): - */ - __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_sv); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_self->_d->stride_vertical = __pyx_t_1; - - /* "owl/libowl.pyx":642 - * - * property stride_vertical: - * def __set__(self, sv): # <<<<<<<<<<<<<< - * self._d.stride_vertical = sv - * - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("owl.libowl.PoolingInfo.stride_vertical.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":645 - * self._d.stride_vertical = sv - * - * def __get__(self): # <<<<<<<<<<<<<< - * return self._d.stride_vertical - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_11PoolingInfo_15stride_vertical_3__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_3owl_6libowl_11PoolingInfo_15stride_vertical_3__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_3owl_6libowl_11PoolingInfo_15stride_vertical_2__get__(((struct __pyx_obj_3owl_6libowl_PoolingInfo *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_11PoolingInfo_15stride_vertical_2__get__(struct __pyx_obj_3owl_6libowl_PoolingInfo *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "owl/libowl.pyx":646 - * - * def __get__(self): - * return self._d.stride_vertical # <<<<<<<<<<<<<< - * - * property stride_horizontal: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->_d->stride_vertical); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":645 - * self._d.stride_vertical = sv - * - * def __get__(self): # <<<<<<<<<<<<<< - * return self._d.stride_vertical - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("owl.libowl.PoolingInfo.stride_vertical.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":649 - * - * property stride_horizontal: - * def __set__(self, sh): # <<<<<<<<<<<<<< - * self._d.stride_horizontal = sh - * - */ - -/* Python wrapper */ -static int __pyx_pw_3owl_6libowl_11PoolingInfo_17stride_horizontal_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_sh); /*proto*/ -static int __pyx_pw_3owl_6libowl_11PoolingInfo_17stride_horizontal_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_sh) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_3owl_6libowl_11PoolingInfo_17stride_horizontal___set__(((struct __pyx_obj_3owl_6libowl_PoolingInfo *)__pyx_v_self), ((PyObject *)__pyx_v_sh)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_3owl_6libowl_11PoolingInfo_17stride_horizontal___set__(struct __pyx_obj_3owl_6libowl_PoolingInfo *__pyx_v_self, PyObject *__pyx_v_sh) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__set__", 0); - - /* "owl/libowl.pyx":650 - * property stride_horizontal: - * def __set__(self, sh): - * self._d.stride_horizontal = sh # <<<<<<<<<<<<<< - * - * def __get__(self): - */ - __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_sh); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_self->_d->stride_horizontal = __pyx_t_1; - - /* "owl/libowl.pyx":649 - * - * property stride_horizontal: - * def __set__(self, sh): # <<<<<<<<<<<<<< - * self._d.stride_horizontal = sh - * - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("owl.libowl.PoolingInfo.stride_horizontal.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":652 - * self._d.stride_horizontal = sh - * - * def __get__(self): # <<<<<<<<<<<<<< - * return self._d.stride_horizontal - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_11PoolingInfo_17stride_horizontal_3__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_3owl_6libowl_11PoolingInfo_17stride_horizontal_3__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_3owl_6libowl_11PoolingInfo_17stride_horizontal_2__get__(((struct __pyx_obj_3owl_6libowl_PoolingInfo *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_11PoolingInfo_17stride_horizontal_2__get__(struct __pyx_obj_3owl_6libowl_PoolingInfo *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "owl/libowl.pyx":653 - * - * def __get__(self): - * return self._d.stride_horizontal # <<<<<<<<<<<<<< - * - * property pad_height: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->_d->stride_horizontal); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":652 - * self._d.stride_horizontal = sh - * - * def __get__(self): # <<<<<<<<<<<<<< - * return self._d.stride_horizontal - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("owl.libowl.PoolingInfo.stride_horizontal.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":656 - * - * property pad_height: - * def __set__(self, ph): # <<<<<<<<<<<<<< - * self._d.pad_height = ph - * - */ - -/* Python wrapper */ -static int __pyx_pw_3owl_6libowl_11PoolingInfo_10pad_height_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_ph); /*proto*/ -static int __pyx_pw_3owl_6libowl_11PoolingInfo_10pad_height_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_ph) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_3owl_6libowl_11PoolingInfo_10pad_height___set__(((struct __pyx_obj_3owl_6libowl_PoolingInfo *)__pyx_v_self), ((PyObject *)__pyx_v_ph)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_3owl_6libowl_11PoolingInfo_10pad_height___set__(struct __pyx_obj_3owl_6libowl_PoolingInfo *__pyx_v_self, PyObject *__pyx_v_ph) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__set__", 0); - - /* "owl/libowl.pyx":657 - * property pad_height: - * def __set__(self, ph): - * self._d.pad_height = ph # <<<<<<<<<<<<<< - * - * def __get__(self): - */ - __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_ph); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_self->_d->pad_height = __pyx_t_1; - - /* "owl/libowl.pyx":656 - * - * property pad_height: - * def __set__(self, ph): # <<<<<<<<<<<<<< - * self._d.pad_height = ph - * - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("owl.libowl.PoolingInfo.pad_height.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":659 - * self._d.pad_height = ph - * - * def __get__(self): # <<<<<<<<<<<<<< - * return self._d.pad_height - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_11PoolingInfo_10pad_height_3__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_3owl_6libowl_11PoolingInfo_10pad_height_3__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_3owl_6libowl_11PoolingInfo_10pad_height_2__get__(((struct __pyx_obj_3owl_6libowl_PoolingInfo *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_11PoolingInfo_10pad_height_2__get__(struct __pyx_obj_3owl_6libowl_PoolingInfo *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "owl/libowl.pyx":660 - * - * def __get__(self): - * return self._d.pad_height # <<<<<<<<<<<<<< - * - * property pad_width: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->_d->pad_height); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":659 - * self._d.pad_height = ph - * - * def __get__(self): # <<<<<<<<<<<<<< - * return self._d.pad_height - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("owl.libowl.PoolingInfo.pad_height.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":663 - * - * property pad_width: - * def __set__(self, pw): # <<<<<<<<<<<<<< - * self._d.pad_width = pw - * - */ - -/* Python wrapper */ -static int __pyx_pw_3owl_6libowl_11PoolingInfo_9pad_width_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_pw); /*proto*/ -static int __pyx_pw_3owl_6libowl_11PoolingInfo_9pad_width_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_pw) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_3owl_6libowl_11PoolingInfo_9pad_width___set__(((struct __pyx_obj_3owl_6libowl_PoolingInfo *)__pyx_v_self), ((PyObject *)__pyx_v_pw)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_3owl_6libowl_11PoolingInfo_9pad_width___set__(struct __pyx_obj_3owl_6libowl_PoolingInfo *__pyx_v_self, PyObject *__pyx_v_pw) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__set__", 0); - - /* "owl/libowl.pyx":664 - * property pad_width: - * def __set__(self, pw): - * self._d.pad_width = pw # <<<<<<<<<<<<<< - * - * def __get__(self): - */ - __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_pw); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_self->_d->pad_width = __pyx_t_1; - - /* "owl/libowl.pyx":663 - * - * property pad_width: - * def __set__(self, pw): # <<<<<<<<<<<<<< - * self._d.pad_width = pw - * - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("owl.libowl.PoolingInfo.pad_width.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "owl/libowl.pyx":666 - * self._d.pad_width = pw - * - * def __get__(self): # <<<<<<<<<<<<<< - * return self._d.pad_width - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_3owl_6libowl_11PoolingInfo_9pad_width_3__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_3owl_6libowl_11PoolingInfo_9pad_width_3__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_3owl_6libowl_11PoolingInfo_9pad_width_2__get__(((struct __pyx_obj_3owl_6libowl_PoolingInfo *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3owl_6libowl_11PoolingInfo_9pad_width_2__get__(struct __pyx_obj_3owl_6libowl_PoolingInfo *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "owl/libowl.pyx":667 - * - * def __get__(self): - * return self._d.pad_width # <<<<<<<<<<<<<< - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->_d->pad_width); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "owl/libowl.pyx":666 - * self._d.pad_width = pw - * - * def __get__(self): # <<<<<<<<<<<<<< - * return self._d.pad_width - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("owl.libowl.PoolingInfo.pad_width.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":197 - * # experimental exception made for __getbuffer__ and __releasebuffer__ - * # -- the details of this may change. - * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< - * # This implementation of getbuffer is geared towards Cython - * # requirements, and does not yet fullfill the PEP. - */ - -/* Python wrapper */ -static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); - __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { - int __pyx_v_copy_shape; - int __pyx_v_i; - int __pyx_v_ndim; - int __pyx_v_endian_detector; - int __pyx_v_little_endian; - int __pyx_v_t; - char *__pyx_v_f; - PyArray_Descr *__pyx_v_descr = 0; - int __pyx_v_offset; - int __pyx_v_hasfields; - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - char *__pyx_t_7; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__getbuffer__", 0); - if (__pyx_v_info != NULL) { - __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(__pyx_v_info->obj); - } - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":203 - * # of flags - * - * if info == NULL: return # <<<<<<<<<<<<<< - * - * cdef int copy_shape, i, ndim - */ - __pyx_t_1 = ((__pyx_v_info == NULL) != 0); - if (__pyx_t_1) { - __pyx_r = 0; - goto __pyx_L0; - } - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":206 - * - * cdef int copy_shape, i, ndim - * cdef int endian_detector = 1 # <<<<<<<<<<<<<< - * cdef bint little_endian = ((&endian_detector)[0] != 0) - * - */ - __pyx_v_endian_detector = 1; - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":207 - * cdef int copy_shape, i, ndim - * cdef int endian_detector = 1 - * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< - * - * ndim = PyArray_NDIM(self) - */ - __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":209 - * cdef bint little_endian = ((&endian_detector)[0] != 0) - * - * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< - * - * if sizeof(npy_intp) != sizeof(Py_ssize_t): - */ - __pyx_v_ndim = PyArray_NDIM(__pyx_v_self); - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":211 - * ndim = PyArray_NDIM(self) - * - * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< - * copy_shape = 1 - * else: - */ - __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0); - if (__pyx_t_1) { - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":212 - * - * if sizeof(npy_intp) != sizeof(Py_ssize_t): - * copy_shape = 1 # <<<<<<<<<<<<<< - * else: - * copy_shape = 0 - */ - __pyx_v_copy_shape = 1; - goto __pyx_L4; - } - /*else*/ { - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":214 - * copy_shape = 1 - * else: - * copy_shape = 0 # <<<<<<<<<<<<<< - * - * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) - */ - __pyx_v_copy_shape = 0; - } - __pyx_L4:; - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":216 - * copy_shape = 0 - * - * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< - * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): - * raise ValueError(u"ndarray is not C contiguous") - */ - __pyx_t_2 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L6_bool_binop_done; - } - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":217 - * - * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) - * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< - * raise ValueError(u"ndarray is not C contiguous") - * - */ - __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS) != 0)) != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L6_bool_binop_done:; - if (__pyx_t_1) { - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":218 - * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) - * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): - * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< - * - * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) - */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":220 - * raise ValueError(u"ndarray is not C contiguous") - * - * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< - * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): - * raise ValueError(u"ndarray is not Fortran contiguous") - */ - __pyx_t_2 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L9_bool_binop_done; - } - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":221 - * - * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) - * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< - * raise ValueError(u"ndarray is not Fortran contiguous") - * - */ - __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS) != 0)) != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L9_bool_binop_done:; - if (__pyx_t_1) { - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":222 - * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) - * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): - * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< - * - * info.buf = PyArray_DATA(self) - */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":224 - * raise ValueError(u"ndarray is not Fortran contiguous") - * - * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< - * info.ndim = ndim - * if copy_shape: - */ - __pyx_v_info->buf = PyArray_DATA(__pyx_v_self); - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":225 - * - * info.buf = PyArray_DATA(self) - * info.ndim = ndim # <<<<<<<<<<<<<< - * if copy_shape: - * # Allocate new buffer for strides and shape info. - */ - __pyx_v_info->ndim = __pyx_v_ndim; - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":226 - * info.buf = PyArray_DATA(self) - * info.ndim = ndim - * if copy_shape: # <<<<<<<<<<<<<< - * # Allocate new buffer for strides and shape info. - * # This is allocated as one block, strides first. - */ - __pyx_t_1 = (__pyx_v_copy_shape != 0); - if (__pyx_t_1) { - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":229 - * # Allocate new buffer for strides and shape info. - * # This is allocated as one block, strides first. - * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< - * info.shape = info.strides + ndim - * for i in range(ndim): - */ - __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2))); - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":230 - * # This is allocated as one block, strides first. - * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) - * info.shape = info.strides + ndim # <<<<<<<<<<<<<< - * for i in range(ndim): - * info.strides[i] = PyArray_STRIDES(self)[i] - */ - __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":231 - * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) - * info.shape = info.strides + ndim - * for i in range(ndim): # <<<<<<<<<<<<<< - * info.strides[i] = PyArray_STRIDES(self)[i] - * info.shape[i] = PyArray_DIMS(self)[i] - */ - __pyx_t_4 = __pyx_v_ndim; - for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { - __pyx_v_i = __pyx_t_5; - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":232 - * info.shape = info.strides + ndim - * for i in range(ndim): - * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< - * info.shape[i] = PyArray_DIMS(self)[i] - * else: - */ - (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]); - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":233 - * for i in range(ndim): - * info.strides[i] = PyArray_STRIDES(self)[i] - * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< - * else: - * info.strides = PyArray_STRIDES(self) - */ - (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]); - } - goto __pyx_L11; - } - /*else*/ { - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":235 - * info.shape[i] = PyArray_DIMS(self)[i] - * else: - * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< - * info.shape = PyArray_DIMS(self) - * info.suboffsets = NULL - */ - __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self)); - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":236 - * else: - * info.strides = PyArray_STRIDES(self) - * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< - * info.suboffsets = NULL - * info.itemsize = PyArray_ITEMSIZE(self) - */ - __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self)); - } - __pyx_L11:; - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":237 - * info.strides = PyArray_STRIDES(self) - * info.shape = PyArray_DIMS(self) - * info.suboffsets = NULL # <<<<<<<<<<<<<< - * info.itemsize = PyArray_ITEMSIZE(self) - * info.readonly = not PyArray_ISWRITEABLE(self) - */ - __pyx_v_info->suboffsets = NULL; - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":238 - * info.shape = PyArray_DIMS(self) - * info.suboffsets = NULL - * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< - * info.readonly = not PyArray_ISWRITEABLE(self) - * - */ - __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self); - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":239 - * info.suboffsets = NULL - * info.itemsize = PyArray_ITEMSIZE(self) - * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< - * - * cdef int t - */ - __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0)); - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":242 - * - * cdef int t - * cdef char* f = NULL # <<<<<<<<<<<<<< - * cdef dtype descr = self.descr - * cdef list stack - */ - __pyx_v_f = NULL; - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":243 - * cdef int t - * cdef char* f = NULL - * cdef dtype descr = self.descr # <<<<<<<<<<<<<< - * cdef list stack - * cdef int offset - */ - __pyx_t_3 = ((PyObject *)__pyx_v_self->descr); - __Pyx_INCREF(__pyx_t_3); - __pyx_v_descr = ((PyArray_Descr *)__pyx_t_3); - __pyx_t_3 = 0; - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":247 - * cdef int offset - * - * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< - * - * if not hasfields and not copy_shape: - */ - __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":249 - * cdef bint hasfields = PyDataType_HASFIELDS(descr) - * - * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< - * # do not call releasebuffer - * info.obj = None - */ - __pyx_t_2 = ((!(__pyx_v_hasfields != 0)) != 0); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L15_bool_binop_done; - } - __pyx_t_2 = ((!(__pyx_v_copy_shape != 0)) != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L15_bool_binop_done:; - if (__pyx_t_1) { - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":251 - * if not hasfields and not copy_shape: - * # do not call releasebuffer - * info.obj = None # <<<<<<<<<<<<<< - * else: - * # need to call releasebuffer - */ - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); - __pyx_v_info->obj = Py_None; - goto __pyx_L14; - } - /*else*/ { - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":254 - * else: - * # need to call releasebuffer - * info.obj = self # <<<<<<<<<<<<<< - * - * if not hasfields: - */ - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); - __pyx_v_info->obj = ((PyObject *)__pyx_v_self); - } - __pyx_L14:; - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":256 - * info.obj = self - * - * if not hasfields: # <<<<<<<<<<<<<< - * t = descr.type_num - * if ((descr.byteorder == c'>' and little_endian) or - */ - __pyx_t_1 = ((!(__pyx_v_hasfields != 0)) != 0); - if (__pyx_t_1) { - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":257 - * - * if not hasfields: - * t = descr.type_num # <<<<<<<<<<<<<< - * if ((descr.byteorder == c'>' and little_endian) or - * (descr.byteorder == c'<' and not little_endian)): - */ - __pyx_t_4 = __pyx_v_descr->type_num; - __pyx_v_t = __pyx_t_4; - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":258 - * if not hasfields: - * t = descr.type_num - * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< - * (descr.byteorder == c'<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") - */ - __pyx_t_2 = ((__pyx_v_descr->byteorder == '>') != 0); - if (!__pyx_t_2) { - goto __pyx_L20_next_or; - } else { - } - __pyx_t_2 = (__pyx_v_little_endian != 0); - if (!__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L19_bool_binop_done; - } - __pyx_L20_next_or:; - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":259 - * t = descr.type_num - * if ((descr.byteorder == c'>' and little_endian) or - * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< - * raise ValueError(u"Non-native byte order not supported") - * if t == NPY_BYTE: f = "b" - */ - __pyx_t_2 = ((__pyx_v_descr->byteorder == '<') != 0); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L19_bool_binop_done; - } - __pyx_t_2 = ((!(__pyx_v_little_endian != 0)) != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L19_bool_binop_done:; - if (__pyx_t_1) { - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":260 - * if ((descr.byteorder == c'>' and little_endian) or - * (descr.byteorder == c'<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< - * if t == NPY_BYTE: f = "b" - * elif t == NPY_UBYTE: f = "B" - */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":277 - * elif t == NPY_CDOUBLE: f = "Zd" - * elif t == NPY_CLONGDOUBLE: f = "Zg" - * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< - * else: - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) - */ - switch (__pyx_v_t) { - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":261 - * (descr.byteorder == c'<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") - * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< - * elif t == NPY_UBYTE: f = "B" - * elif t == NPY_SHORT: f = "h" - */ - case NPY_BYTE: - __pyx_v_f = __pyx_k_b; - break; - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":262 - * raise ValueError(u"Non-native byte order not supported") - * if t == NPY_BYTE: f = "b" - * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< - * elif t == NPY_SHORT: f = "h" - * elif t == NPY_USHORT: f = "H" - */ - case NPY_UBYTE: - __pyx_v_f = __pyx_k_B; - break; - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":263 - * if t == NPY_BYTE: f = "b" - * elif t == NPY_UBYTE: f = "B" - * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< - * elif t == NPY_USHORT: f = "H" - * elif t == NPY_INT: f = "i" - */ - case NPY_SHORT: - __pyx_v_f = __pyx_k_h; - break; - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":264 - * elif t == NPY_UBYTE: f = "B" - * elif t == NPY_SHORT: f = "h" - * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< - * elif t == NPY_INT: f = "i" - * elif t == NPY_UINT: f = "I" - */ - case NPY_USHORT: - __pyx_v_f = __pyx_k_H; - break; - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":265 - * elif t == NPY_SHORT: f = "h" - * elif t == NPY_USHORT: f = "H" - * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< - * elif t == NPY_UINT: f = "I" - * elif t == NPY_LONG: f = "l" - */ - case NPY_INT: - __pyx_v_f = __pyx_k_i; - break; - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":266 - * elif t == NPY_USHORT: f = "H" - * elif t == NPY_INT: f = "i" - * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< - * elif t == NPY_LONG: f = "l" - * elif t == NPY_ULONG: f = "L" - */ - case NPY_UINT: - __pyx_v_f = __pyx_k_I; - break; - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":267 - * elif t == NPY_INT: f = "i" - * elif t == NPY_UINT: f = "I" - * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< - * elif t == NPY_ULONG: f = "L" - * elif t == NPY_LONGLONG: f = "q" - */ - case NPY_LONG: - __pyx_v_f = __pyx_k_l; - break; - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":268 - * elif t == NPY_UINT: f = "I" - * elif t == NPY_LONG: f = "l" - * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< - * elif t == NPY_LONGLONG: f = "q" - * elif t == NPY_ULONGLONG: f = "Q" - */ - case NPY_ULONG: - __pyx_v_f = __pyx_k_L; - break; - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":269 - * elif t == NPY_LONG: f = "l" - * elif t == NPY_ULONG: f = "L" - * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< - * elif t == NPY_ULONGLONG: f = "Q" - * elif t == NPY_FLOAT: f = "f" - */ - case NPY_LONGLONG: - __pyx_v_f = __pyx_k_q; - break; - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":270 - * elif t == NPY_ULONG: f = "L" - * elif t == NPY_LONGLONG: f = "q" - * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< - * elif t == NPY_FLOAT: f = "f" - * elif t == NPY_DOUBLE: f = "d" - */ - case NPY_ULONGLONG: - __pyx_v_f = __pyx_k_Q; - break; - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":271 - * elif t == NPY_LONGLONG: f = "q" - * elif t == NPY_ULONGLONG: f = "Q" - * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< - * elif t == NPY_DOUBLE: f = "d" - * elif t == NPY_LONGDOUBLE: f = "g" - */ - case NPY_FLOAT: - __pyx_v_f = __pyx_k_f; - break; - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":272 - * elif t == NPY_ULONGLONG: f = "Q" - * elif t == NPY_FLOAT: f = "f" - * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< - * elif t == NPY_LONGDOUBLE: f = "g" - * elif t == NPY_CFLOAT: f = "Zf" - */ - case NPY_DOUBLE: - __pyx_v_f = __pyx_k_d; - break; - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":273 - * elif t == NPY_FLOAT: f = "f" - * elif t == NPY_DOUBLE: f = "d" - * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< - * elif t == NPY_CFLOAT: f = "Zf" - * elif t == NPY_CDOUBLE: f = "Zd" - */ - case NPY_LONGDOUBLE: - __pyx_v_f = __pyx_k_g; - break; - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":274 - * elif t == NPY_DOUBLE: f = "d" - * elif t == NPY_LONGDOUBLE: f = "g" - * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< - * elif t == NPY_CDOUBLE: f = "Zd" - * elif t == NPY_CLONGDOUBLE: f = "Zg" - */ - case NPY_CFLOAT: - __pyx_v_f = __pyx_k_Zf; - break; - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":275 - * elif t == NPY_LONGDOUBLE: f = "g" - * elif t == NPY_CFLOAT: f = "Zf" - * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< - * elif t == NPY_CLONGDOUBLE: f = "Zg" - * elif t == NPY_OBJECT: f = "O" - */ - case NPY_CDOUBLE: - __pyx_v_f = __pyx_k_Zd; - break; - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":276 - * elif t == NPY_CFLOAT: f = "Zf" - * elif t == NPY_CDOUBLE: f = "Zd" - * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< - * elif t == NPY_OBJECT: f = "O" - * else: - */ - case NPY_CLONGDOUBLE: - __pyx_v_f = __pyx_k_Zg; - break; - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":277 - * elif t == NPY_CDOUBLE: f = "Zd" - * elif t == NPY_CLONGDOUBLE: f = "Zg" - * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< - * else: - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) - */ - case NPY_OBJECT: - __pyx_v_f = __pyx_k_O; - break; - default: - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":279 - * elif t == NPY_OBJECT: f = "O" - * else: - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< - * info.format = f - * return - */ - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_6, 0, 0, 0); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - break; - } - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":280 - * else: - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) - * info.format = f # <<<<<<<<<<<<<< - * return - * else: - */ - __pyx_v_info->format = __pyx_v_f; - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":281 - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) - * info.format = f - * return # <<<<<<<<<<<<<< - * else: - * info.format = stdlib.malloc(_buffer_format_string_len) - */ - __pyx_r = 0; - goto __pyx_L0; - } - /*else*/ { - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":283 - * return - * else: - * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< - * info.format[0] = c'^' # Native data types, manual alignment - * offset = 0 - */ - __pyx_v_info->format = ((char *)malloc(255)); - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":284 - * else: - * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<< - * offset = 0 - * f = _util_dtypestring(descr, info.format + 1, - */ - (__pyx_v_info->format[0]) = '^'; - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":285 - * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = c'^' # Native data types, manual alignment - * offset = 0 # <<<<<<<<<<<<<< - * f = _util_dtypestring(descr, info.format + 1, - * info.format + _buffer_format_string_len, - */ - __pyx_v_offset = 0; - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":286 - * info.format[0] = c'^' # Native data types, manual alignment - * offset = 0 - * f = _util_dtypestring(descr, info.format + 1, # <<<<<<<<<<<<<< - * info.format + _buffer_format_string_len, - * &offset) - */ - __pyx_t_7 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_f = __pyx_t_7; - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":289 - * info.format + _buffer_format_string_len, - * &offset) - * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<< - * - * def __releasebuffer__(ndarray self, Py_buffer* info): - */ - (__pyx_v_f[0]) = '\x00'; - } - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":197 - * # experimental exception made for __getbuffer__ and __releasebuffer__ - * # -- the details of this may change. - * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< - * # This implementation of getbuffer is geared towards Cython - * # requirements, and does not yet fullfill the PEP. - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) { - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; - } - goto __pyx_L2; - __pyx_L0:; - if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) { - __Pyx_GOTREF(Py_None); - __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL; - } - __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_descr); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":291 - * f[0] = c'\0' # Terminate format string - * - * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< - * if PyArray_HASFIELDS(self): - * stdlib.free(info.format) - */ - -/* Python wrapper */ -static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ -static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0); - __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) { - __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("__releasebuffer__", 0); - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":292 - * - * def __releasebuffer__(ndarray self, Py_buffer* info): - * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< - * stdlib.free(info.format) - * if sizeof(npy_intp) != sizeof(Py_ssize_t): - */ - __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0); - if (__pyx_t_1) { - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":293 - * def __releasebuffer__(ndarray self, Py_buffer* info): - * if PyArray_HASFIELDS(self): - * stdlib.free(info.format) # <<<<<<<<<<<<<< - * if sizeof(npy_intp) != sizeof(Py_ssize_t): - * stdlib.free(info.strides) - */ - free(__pyx_v_info->format); - goto __pyx_L3; - } - __pyx_L3:; - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":294 - * if PyArray_HASFIELDS(self): - * stdlib.free(info.format) - * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< - * stdlib.free(info.strides) - * # info.shape was stored after info.strides in the same block - */ - __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0); - if (__pyx_t_1) { - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":295 - * stdlib.free(info.format) - * if sizeof(npy_intp) != sizeof(Py_ssize_t): - * stdlib.free(info.strides) # <<<<<<<<<<<<<< - * # info.shape was stored after info.strides in the same block - * - */ - free(__pyx_v_info->strides); - goto __pyx_L4; - } - __pyx_L4:; - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":291 - * f[0] = c'\0' # Terminate format string - * - * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< - * if PyArray_HASFIELDS(self): - * stdlib.free(info.format) - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":771 - * ctypedef npy_cdouble complex_t - * - * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(1, a) - * - */ - -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":772 - * - * cdef inline object PyArray_MultiIterNew1(a): - * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< - * - * cdef inline object PyArray_MultiIterNew2(a, b): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":771 - * ctypedef npy_cdouble complex_t - * - * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(1, a) - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":774 - * return PyArray_MultiIterNew(1, a) - * - * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(2, a, b) - * - */ - -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":775 - * - * cdef inline object PyArray_MultiIterNew2(a, b): - * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< - * - * cdef inline object PyArray_MultiIterNew3(a, b, c): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":774 - * return PyArray_MultiIterNew(1, a) - * - * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(2, a, b) - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":777 - * return PyArray_MultiIterNew(2, a, b) - * - * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(3, a, b, c) - * - */ - -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":778 - * - * cdef inline object PyArray_MultiIterNew3(a, b, c): - * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< - * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":777 - * return PyArray_MultiIterNew(2, a, b) - * - * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(3, a, b, c) - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":780 - * return PyArray_MultiIterNew(3, a, b, c) - * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(4, a, b, c, d) - * - */ - -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":781 - * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): - * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< - * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":780 - * return PyArray_MultiIterNew(3, a, b, c) - * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(4, a, b, c, d) - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":783 - * return PyArray_MultiIterNew(4, a, b, c, d) - * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(5, a, b, c, d, e) - * - */ - -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":784 - * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): - * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< - * - * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":783 - * return PyArray_MultiIterNew(4, a, b, c, d) - * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(5, a, b, c, d, e) - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":786 - * return PyArray_MultiIterNew(5, a, b, c, d, e) - * - * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< - * # Recursive utility function used in __getbuffer__ to get format - * # string. The new location in the format string is returned. - */ - -static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { - PyArray_Descr *__pyx_v_child = 0; - int __pyx_v_endian_detector; - int __pyx_v_little_endian; - PyObject *__pyx_v_fields = 0; - PyObject *__pyx_v_childname = NULL; - PyObject *__pyx_v_new_offset = NULL; - PyObject *__pyx_v_t = NULL; - char *__pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - long __pyx_t_8; - char *__pyx_t_9; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_util_dtypestring", 0); - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":793 - * cdef int delta_offset - * cdef tuple i - * cdef int endian_detector = 1 # <<<<<<<<<<<<<< - * cdef bint little_endian = ((&endian_detector)[0] != 0) - * cdef tuple fields - */ - __pyx_v_endian_detector = 1; - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":794 - * cdef tuple i - * cdef int endian_detector = 1 - * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< - * cdef tuple fields - * - */ - __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":797 - * cdef tuple fields - * - * for childname in descr.names: # <<<<<<<<<<<<<< - * fields = descr.fields[childname] - * child, new_offset = fields - */ - if (unlikely(__pyx_v_descr->names == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_1 = __pyx_v_descr->names; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; - for (;;) { - if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - #endif - __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3); - __pyx_t_3 = 0; - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":798 - * - * for childname in descr.names: - * fields = descr.fields[childname] # <<<<<<<<<<<<<< - * child, new_offset = fields - * - */ - if (unlikely(__pyx_v_descr->fields == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __Pyx_GOTREF(__pyx_t_3); - if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3)); - __pyx_t_3 = 0; - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":799 - * for childname in descr.names: - * fields = descr.fields[childname] - * child, new_offset = fields # <<<<<<<<<<<<<< - * - * if (end - f) - (new_offset - offset[0]) < 15: - */ - if (likely(__pyx_v_fields != Py_None)) { - PyObject* sequence = __pyx_v_fields; - #if CYTHON_COMPILING_IN_CPYTHON - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - #else - __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - #endif - } else { - __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3)); - __pyx_t_3 = 0; - __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4); - __pyx_t_4 = 0; - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":801 - * child, new_offset = fields - * - * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< - * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") - * - */ - __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = ((((__pyx_v_end - __pyx_v_f) - ((int)__pyx_t_5)) < 15) != 0); - if (__pyx_t_6) { - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":802 - * - * if (end - f) - (new_offset - offset[0]) < 15: - * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< - * - * if ((child.byteorder == c'>' and little_endian) or - */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":804 - * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") - * - * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< - * (child.byteorder == c'<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") - */ - __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0); - if (!__pyx_t_7) { - goto __pyx_L8_next_or; - } else { - } - __pyx_t_7 = (__pyx_v_little_endian != 0); - if (!__pyx_t_7) { - } else { - __pyx_t_6 = __pyx_t_7; - goto __pyx_L7_bool_binop_done; - } - __pyx_L8_next_or:; - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":805 - * - * if ((child.byteorder == c'>' and little_endian) or - * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< - * raise ValueError(u"Non-native byte order not supported") - * # One could encode it in the format string and have Cython - */ - __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0); - if (__pyx_t_7) { - } else { - __pyx_t_6 = __pyx_t_7; - goto __pyx_L7_bool_binop_done; - } - __pyx_t_7 = ((!(__pyx_v_little_endian != 0)) != 0); - __pyx_t_6 = __pyx_t_7; - __pyx_L7_bool_binop_done:; - if (__pyx_t_6) { - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":806 - * if ((child.byteorder == c'>' and little_endian) or - * (child.byteorder == c'<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< - * # One could encode it in the format string and have Cython - * # complain instead, BUT: < and > in format strings also imply - */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":816 - * - * # Output padding bytes - * while offset[0] < new_offset: # <<<<<<<<<<<<<< - * f[0] = 120 # "x"; pad byte - * f += 1 - */ - while (1) { - __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!__pyx_t_6) break; - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":817 - * # Output padding bytes - * while offset[0] < new_offset: - * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< - * f += 1 - * offset[0] += 1 - */ - (__pyx_v_f[0]) = 120; - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":818 - * while offset[0] < new_offset: - * f[0] = 120 # "x"; pad byte - * f += 1 # <<<<<<<<<<<<<< - * offset[0] += 1 - * - */ - __pyx_v_f = (__pyx_v_f + 1); - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":819 - * f[0] = 120 # "x"; pad byte - * f += 1 - * offset[0] += 1 # <<<<<<<<<<<<<< - * - * offset[0] += child.itemsize - */ - __pyx_t_8 = 0; - (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + 1); - } - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":821 - * offset[0] += 1 - * - * offset[0] += child.itemsize # <<<<<<<<<<<<<< - * - * if not PyDataType_HASFIELDS(child): - */ - __pyx_t_8 = 0; - (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + __pyx_v_child->elsize); - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":823 - * offset[0] += child.itemsize - * - * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< - * t = child.type_num - * if end - f < 5: - */ - __pyx_t_6 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0); - if (__pyx_t_6) { - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":824 - * - * if not PyDataType_HASFIELDS(child): - * t = child.type_num # <<<<<<<<<<<<<< - * if end - f < 5: - * raise RuntimeError(u"Format string allocated too short.") - */ - __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4); - __pyx_t_4 = 0; - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":825 - * if not PyDataType_HASFIELDS(child): - * t = child.type_num - * if end - f < 5: # <<<<<<<<<<<<<< - * raise RuntimeError(u"Format string allocated too short.") - * - */ - __pyx_t_6 = (((__pyx_v_end - __pyx_v_f) < 5) != 0); - if (__pyx_t_6) { - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":826 - * t = child.type_num - * if end - f < 5: - * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< - * - * # Until ticket #99 is fixed, use integers to avoid warnings - */ - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":829 - * - * # Until ticket #99 is fixed, use integers to avoid warnings - * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< - * elif t == NPY_UBYTE: f[0] = 66 #"B" - * elif t == NPY_SHORT: f[0] = 104 #"h" - */ - __pyx_t_4 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 98; - goto __pyx_L15; - } - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":830 - * # Until ticket #99 is fixed, use integers to avoid warnings - * if t == NPY_BYTE: f[0] = 98 #"b" - * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< - * elif t == NPY_SHORT: f[0] = 104 #"h" - * elif t == NPY_USHORT: f[0] = 72 #"H" - */ - __pyx_t_3 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 66; - goto __pyx_L15; - } - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":831 - * if t == NPY_BYTE: f[0] = 98 #"b" - * elif t == NPY_UBYTE: f[0] = 66 #"B" - * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< - * elif t == NPY_USHORT: f[0] = 72 #"H" - * elif t == NPY_INT: f[0] = 105 #"i" - */ - __pyx_t_4 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 104; - goto __pyx_L15; - } - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":832 - * elif t == NPY_UBYTE: f[0] = 66 #"B" - * elif t == NPY_SHORT: f[0] = 104 #"h" - * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< - * elif t == NPY_INT: f[0] = 105 #"i" - * elif t == NPY_UINT: f[0] = 73 #"I" - */ - __pyx_t_3 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 72; - goto __pyx_L15; - } - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":833 - * elif t == NPY_SHORT: f[0] = 104 #"h" - * elif t == NPY_USHORT: f[0] = 72 #"H" - * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< - * elif t == NPY_UINT: f[0] = 73 #"I" - * elif t == NPY_LONG: f[0] = 108 #"l" - */ - __pyx_t_4 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 105; - goto __pyx_L15; - } - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":834 - * elif t == NPY_USHORT: f[0] = 72 #"H" - * elif t == NPY_INT: f[0] = 105 #"i" - * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< - * elif t == NPY_LONG: f[0] = 108 #"l" - * elif t == NPY_ULONG: f[0] = 76 #"L" - */ - __pyx_t_3 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 73; - goto __pyx_L15; - } - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":835 - * elif t == NPY_INT: f[0] = 105 #"i" - * elif t == NPY_UINT: f[0] = 73 #"I" - * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< - * elif t == NPY_ULONG: f[0] = 76 #"L" - * elif t == NPY_LONGLONG: f[0] = 113 #"q" - */ - __pyx_t_4 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 108; - goto __pyx_L15; - } - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":836 - * elif t == NPY_UINT: f[0] = 73 #"I" - * elif t == NPY_LONG: f[0] = 108 #"l" - * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< - * elif t == NPY_LONGLONG: f[0] = 113 #"q" - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" - */ - __pyx_t_3 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 76; - goto __pyx_L15; - } - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":837 - * elif t == NPY_LONG: f[0] = 108 #"l" - * elif t == NPY_ULONG: f[0] = 76 #"L" - * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" - * elif t == NPY_FLOAT: f[0] = 102 #"f" - */ - __pyx_t_4 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 113; - goto __pyx_L15; - } - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":838 - * elif t == NPY_ULONG: f[0] = 76 #"L" - * elif t == NPY_LONGLONG: f[0] = 113 #"q" - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< - * elif t == NPY_FLOAT: f[0] = 102 #"f" - * elif t == NPY_DOUBLE: f[0] = 100 #"d" - */ - __pyx_t_3 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 81; - goto __pyx_L15; - } - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":839 - * elif t == NPY_LONGLONG: f[0] = 113 #"q" - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" - * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< - * elif t == NPY_DOUBLE: f[0] = 100 #"d" - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" - */ - __pyx_t_4 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 102; - goto __pyx_L15; - } - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":840 - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" - * elif t == NPY_FLOAT: f[0] = 102 #"f" - * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf - */ - __pyx_t_3 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 100; - goto __pyx_L15; - } - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":841 - * elif t == NPY_FLOAT: f[0] = 102 #"f" - * elif t == NPY_DOUBLE: f[0] = 100 #"d" - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd - */ - __pyx_t_4 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 103; - goto __pyx_L15; - } - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":842 - * elif t == NPY_DOUBLE: f[0] = 100 #"d" - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd - * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg - */ - __pyx_t_3 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 90; - (__pyx_v_f[1]) = 102; - __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L15; - } - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":843 - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< - * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg - * elif t == NPY_OBJECT: f[0] = 79 #"O" - */ - __pyx_t_4 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 90; - (__pyx_v_f[1]) = 100; - __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L15; - } - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":844 - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd - * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< - * elif t == NPY_OBJECT: f[0] = 79 #"O" - * else: - */ - __pyx_t_3 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 90; - (__pyx_v_f[1]) = 103; - __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L15; - } - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":845 - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd - * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg - * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< - * else: - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) - */ - __pyx_t_4 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 79; - goto __pyx_L15; - } - /*else*/ { - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":847 - * elif t == NPY_OBJECT: f[0] = 79 #"O" - * else: - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< - * f += 1 - * else: - */ - __pyx_t_3 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_v_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_L15:; - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":848 - * else: - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) - * f += 1 # <<<<<<<<<<<<<< - * else: - * # Cython ignores struct boundary information ("T{...}"), - */ - __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L13; - } - /*else*/ { - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":852 - * # Cython ignores struct boundary information ("T{...}"), - * # so don't output it - * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< - * return f - * - */ - __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_f = __pyx_t_9; - } - __pyx_L13:; - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":797 - * cdef tuple fields - * - * for childname in descr.names: # <<<<<<<<<<<<<< - * fields = descr.fields[childname] - * child, new_offset = fields - */ - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":853 - * # so don't output it - * f = _util_dtypestring(child, f, end, offset) - * return f # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = __pyx_v_f; - goto __pyx_L0; - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":786 - * return PyArray_MultiIterNew(5, a, b, c, d, e) - * - * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< - * # Recursive utility function used in __getbuffer__ to get format - * # string. The new location in the format string is returned. - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_child); - __Pyx_XDECREF(__pyx_v_fields); - __Pyx_XDECREF(__pyx_v_childname); - __Pyx_XDECREF(__pyx_v_new_offset); - __Pyx_XDECREF(__pyx_v_t); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":969 - * - * - * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< - * cdef PyObject* baseptr - * if base is None: - */ - -static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { - PyObject *__pyx_v_baseptr; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - __Pyx_RefNannySetupContext("set_array_base", 0); - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":971 - * cdef inline void set_array_base(ndarray arr, object base): - * cdef PyObject* baseptr - * if base is None: # <<<<<<<<<<<<<< - * baseptr = NULL - * else: - */ - __pyx_t_1 = (__pyx_v_base == Py_None); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":972 - * cdef PyObject* baseptr - * if base is None: - * baseptr = NULL # <<<<<<<<<<<<<< - * else: - * Py_INCREF(base) # important to do this before decref below! - */ - __pyx_v_baseptr = NULL; - goto __pyx_L3; - } - /*else*/ { - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":974 - * baseptr = NULL - * else: - * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< - * baseptr = base - * Py_XDECREF(arr.base) - */ - Py_INCREF(__pyx_v_base); - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":975 - * else: - * Py_INCREF(base) # important to do this before decref below! - * baseptr = base # <<<<<<<<<<<<<< - * Py_XDECREF(arr.base) - * arr.base = baseptr - */ - __pyx_v_baseptr = ((PyObject *)__pyx_v_base); - } - __pyx_L3:; - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":976 - * Py_INCREF(base) # important to do this before decref below! - * baseptr = base - * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< - * arr.base = baseptr - * - */ - Py_XDECREF(__pyx_v_arr->base); - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":977 - * baseptr = base - * Py_XDECREF(arr.base) - * arr.base = baseptr # <<<<<<<<<<<<<< - * - * cdef inline object get_array_base(ndarray arr): - */ - __pyx_v_arr->base = __pyx_v_baseptr; - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":969 - * - * - * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< - * cdef PyObject* baseptr - * if base is None: - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":979 - * arr.base = baseptr - * - * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< - * if arr.base is NULL: - * return None - */ - -static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("get_array_base", 0); - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":980 - * - * cdef inline object get_array_base(ndarray arr): - * if arr.base is NULL: # <<<<<<<<<<<<<< - * return None - * else: - */ - __pyx_t_1 = ((__pyx_v_arr->base == NULL) != 0); - if (__pyx_t_1) { - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":981 - * cdef inline object get_array_base(ndarray arr): - * if arr.base is NULL: - * return None # <<<<<<<<<<<<<< - * else: - * return arr.base - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(Py_None); - __pyx_r = Py_None; - goto __pyx_L0; - } - /*else*/ { - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":983 - * return None - * else: - * return arr.base # <<<<<<<<<<<<<< - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_arr->base)); - __pyx_r = ((PyObject *)__pyx_v_arr->base); - goto __pyx_L0; - } - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":979 - * arr.base = baseptr - * - * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< - * if arr.base is NULL: - * return None - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "vector.to_py":67 - * - * @cname("__pyx_convert_vector_to_py_int") - * cdef object __pyx_convert_vector_to_py_int(vector[X]& v): # <<<<<<<<<<<<<< - * return [X_to_py(v[i]) for i in range(v.size())] - * - */ - -static PyObject *__pyx_convert_vector_to_py_int(const std::vector &__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; - PyObject *__pyx_t_4 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_int", 0); - - /* "vector.to_py":68 - * @cname("__pyx_convert_vector_to_py_int") - * cdef object __pyx_convert_vector_to_py_int(vector[X]& v): - * return [X_to_py(v[i]) for i in range(v.size())] # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __pyx_v_v.size(); - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_i = __pyx_t_3; - __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "vector.to_py":67 - * - * @cname("__pyx_convert_vector_to_py_int") - * cdef object __pyx_convert_vector_to_py_int(vector[X]& v): # <<<<<<<<<<<<<< - * return [X_to_py(v[i]) for i in range(v.size())] - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __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_tp_new_3owl_6libowl_NArray(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; - if (unlikely(__pyx_pw_3owl_6libowl_6NArray_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) { - Py_DECREF(o); o = 0; - } - return o; -} - -static void __pyx_tp_dealloc_3owl_6libowl_NArray(PyObject *o) { - #if PY_VERSION_HEX >= 0x030400a1 - if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { - if (PyObject_CallFinalizerFromDealloc(o)) return; - } - #endif - { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - ++Py_REFCNT(o); - __pyx_pw_3owl_6libowl_6NArray_3__dealloc__(o); - --Py_REFCNT(o); - PyErr_Restore(etype, eval, etb); - } - (*Py_TYPE(o)->tp_free)(o); -} - -static PyObject *__pyx_getprop_3owl_6libowl_6NArray_shape(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_3owl_6libowl_6NArray_5shape_1__get__(o); -} - -static PyMethodDef __pyx_methods_3owl_6libowl_NArray[] = { - {"mult", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_21mult, METH_VARARGS|METH_KEYWORDS, 0}, - {"exp", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_23exp, METH_VARARGS|METH_KEYWORDS, 0}, - {"ln", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_25ln, METH_VARARGS|METH_KEYWORDS, 0}, - {"sigm", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_27sigm, METH_VARARGS|METH_KEYWORDS, 0}, - {"sigm_back", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_29sigm_back, METH_VARARGS|METH_KEYWORDS, 0}, - {"relu", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_31relu, METH_VARARGS|METH_KEYWORDS, 0}, - {"relu_back", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_33relu_back, METH_VARARGS|METH_KEYWORDS, 0}, - {"tanh", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_35tanh, METH_VARARGS|METH_KEYWORDS, 0}, - {"tanh_back", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_37tanh_back, METH_VARARGS|METH_KEYWORDS, 0}, - {"conv_forward", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_39conv_forward, METH_VARARGS|METH_KEYWORDS, 0}, - {"conv_backward_data", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_41conv_backward_data, METH_VARARGS|METH_KEYWORDS, 0}, - {"conv_backward_filter", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_43conv_backward_filter, METH_VARARGS|METH_KEYWORDS, 0}, - {"conv_backward_bias", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_45conv_backward_bias, METH_VARARGS|METH_KEYWORDS, 0}, - {"softmax_forward", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_47softmax_forward, METH_VARARGS|METH_KEYWORDS, 0}, - {"softmax_backward", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_49softmax_backward, METH_VARARGS|METH_KEYWORDS, 0}, - {"activation_forward", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_51activation_forward, METH_VARARGS|METH_KEYWORDS, 0}, - {"activation_backward", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_53activation_backward, METH_VARARGS|METH_KEYWORDS, 0}, - {"pooling_forward", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_55pooling_forward, METH_VARARGS|METH_KEYWORDS, 0}, - {"pooling_backward", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_57pooling_backward, METH_VARARGS|METH_KEYWORDS, 0}, - {"lrn_forward", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_59lrn_forward, METH_VARARGS|METH_KEYWORDS, 0}, - {"lrn_backward", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_61lrn_backward, METH_VARARGS|METH_KEYWORDS, 0}, - {"sum", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_63sum, METH_O, 0}, - {"max", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_65max, METH_O, 0}, - {"max_index", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_67max_index, METH_O, 0}, - {"count_zero", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_69count_zero, METH_NOARGS, 0}, - {"trans", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_71trans, METH_NOARGS, 0}, - {"reshape", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_73reshape, METH_O, 0}, - {"wait_for_eval", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_75wait_for_eval, METH_NOARGS, 0}, - {"zeros", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_77zeros, METH_VARARGS|METH_KEYWORDS, 0}, - {"ones", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_79ones, METH_VARARGS|METH_KEYWORDS, 0}, - {"randn", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_81randn, METH_VARARGS|METH_KEYWORDS, 0}, - {"randb", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_83randb, METH_VARARGS|METH_KEYWORDS, 0}, - {"concat", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_85concat, METH_VARARGS|METH_KEYWORDS, 0}, - {"slice", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_87slice, METH_VARARGS|METH_KEYWORDS, 0}, - {"from_numpy", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_89from_numpy, METH_VARARGS|METH_KEYWORDS, 0}, - {"_from_numpy", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_91_from_numpy, METH_VARARGS|METH_KEYWORDS, 0}, - {"to_numpy", (PyCFunction)__pyx_pw_3owl_6libowl_6NArray_93to_numpy, METH_NOARGS, 0}, - {0, 0, 0, 0} -}; - -static struct PyGetSetDef __pyx_getsets_3owl_6libowl_NArray[] = { - {(char *)"shape", __pyx_getprop_3owl_6libowl_6NArray_shape, 0, 0, 0}, - {0, 0, 0, 0, 0} -}; - -static PyNumberMethods __pyx_tp_as_number_NArray = { - __pyx_pw_3owl_6libowl_6NArray_5__add__, /*nb_add*/ - __pyx_pw_3owl_6libowl_6NArray_9__sub__, /*nb_subtract*/ - __pyx_pw_3owl_6libowl_6NArray_13__mul__, /*nb_multiply*/ - #if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY - __pyx_pw_3owl_6libowl_6NArray_17__div__, /*nb_divide*/ - #endif - 0, /*nb_remainder*/ - 0, /*nb_divmod*/ - 0, /*nb_power*/ - 0, /*nb_negative*/ - 0, /*nb_positive*/ - 0, /*nb_absolute*/ - 0, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ - #if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY - 0, /*nb_coerce*/ - #endif - 0, /*nb_int*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_long*/ - #else - 0, /*reserved*/ - #endif - 0, /*nb_float*/ - #if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY - 0, /*nb_oct*/ - #endif - #if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY - 0, /*nb_hex*/ - #endif - __pyx_pw_3owl_6libowl_6NArray_7__iadd__, /*nb_inplace_add*/ - __pyx_pw_3owl_6libowl_6NArray_11__isub__, /*nb_inplace_subtract*/ - __pyx_pw_3owl_6libowl_6NArray_15__imul__, /*nb_inplace_multiply*/ - #if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY - __pyx_pw_3owl_6libowl_6NArray_19__idiv__, /*nb_inplace_divide*/ - #endif - 0, /*nb_inplace_remainder*/ - 0, /*nb_inplace_power*/ - 0, /*nb_inplace_lshift*/ - 0, /*nb_inplace_rshift*/ - 0, /*nb_inplace_and*/ - 0, /*nb_inplace_xor*/ - 0, /*nb_inplace_or*/ - 0, /*nb_floor_divide*/ - 0, /*nb_true_divide*/ - 0, /*nb_inplace_floor_divide*/ - 0, /*nb_inplace_true_divide*/ - 0, /*nb_index*/ - #if PY_VERSION_HEX >= 0x03050000 - 0, /*nb_matrix_multiply*/ - #endif - #if PY_VERSION_HEX >= 0x03050000 - 0, /*nb_inplace_matrix_multiply*/ - #endif -}; - -static PyTypeObject __pyx_type_3owl_6libowl_NArray = { - PyVarObject_HEAD_INIT(0, 0) - "owl.libowl.NArray", /*tp_name*/ - sizeof(struct __pyx_obj_3owl_6libowl_NArray), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3owl_6libowl_NArray, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #else - 0, /*reserved*/ - #endif - 0, /*tp_repr*/ - &__pyx_tp_as_number_NArray, /*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*/ - 0, /*tp_doc*/ - 0, /*tp_traverse*/ - 0, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_3owl_6libowl_NArray, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets_3owl_6libowl_NArray, /*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_3owl_6libowl_NArray, /*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 PyObject *__pyx_tp_new_3owl_6libowl_PoolingAlgorithmWrapper(PyTypeObject *t, PyObject *a, 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; - if (unlikely(__pyx_pw_3owl_6libowl_23PoolingAlgorithmWrapper_1__cinit__(o, a, k) < 0)) { - Py_DECREF(o); o = 0; - } - return o; -} - -static void __pyx_tp_dealloc_3owl_6libowl_PoolingAlgorithmWrapper(PyObject *o) { - #if PY_VERSION_HEX >= 0x030400a1 - if (unlikely(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_3owl_6libowl_PoolingAlgorithmWrapper[] = { - {"is_same", (PyCFunction)__pyx_pw_3owl_6libowl_23PoolingAlgorithmWrapper_3is_same, METH_O, 0}, - {0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_3owl_6libowl_PoolingAlgorithmWrapper = { - PyVarObject_HEAD_INIT(0, 0) - "owl.libowl.PoolingAlgorithmWrapper", /*tp_name*/ - sizeof(struct __pyx_obj_3owl_6libowl_PoolingAlgorithmWrapper), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3owl_6libowl_PoolingAlgorithmWrapper, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #else - 0, /*reserved*/ - #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*/ - 0, /*tp_doc*/ - 0, /*tp_traverse*/ - 0, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_3owl_6libowl_PoolingAlgorithmWrapper, /*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_3owl_6libowl_PoolingAlgorithmWrapper, /*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 PyObject *__pyx_tp_new_3owl_6libowl_SoftmaxAlgorithmWrapper(PyTypeObject *t, PyObject *a, 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; - if (unlikely(__pyx_pw_3owl_6libowl_23SoftmaxAlgorithmWrapper_1__cinit__(o, a, k) < 0)) { - Py_DECREF(o); o = 0; - } - return o; -} - -static void __pyx_tp_dealloc_3owl_6libowl_SoftmaxAlgorithmWrapper(PyObject *o) { - #if PY_VERSION_HEX >= 0x030400a1 - if (unlikely(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_3owl_6libowl_SoftmaxAlgorithmWrapper[] = { - {"is_same", (PyCFunction)__pyx_pw_3owl_6libowl_23SoftmaxAlgorithmWrapper_3is_same, METH_O, 0}, - {0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_3owl_6libowl_SoftmaxAlgorithmWrapper = { - PyVarObject_HEAD_INIT(0, 0) - "owl.libowl.SoftmaxAlgorithmWrapper", /*tp_name*/ - sizeof(struct __pyx_obj_3owl_6libowl_SoftmaxAlgorithmWrapper), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3owl_6libowl_SoftmaxAlgorithmWrapper, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #else - 0, /*reserved*/ - #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*/ - 0, /*tp_doc*/ - 0, /*tp_traverse*/ - 0, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_3owl_6libowl_SoftmaxAlgorithmWrapper, /*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_3owl_6libowl_SoftmaxAlgorithmWrapper, /*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 PyObject *__pyx_tp_new_3owl_6libowl_ActivationAlgorithmWrapper(PyTypeObject *t, PyObject *a, 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; - if (unlikely(__pyx_pw_3owl_6libowl_26ActivationAlgorithmWrapper_1__cinit__(o, a, k) < 0)) { - Py_DECREF(o); o = 0; - } - return o; -} - -static void __pyx_tp_dealloc_3owl_6libowl_ActivationAlgorithmWrapper(PyObject *o) { - #if PY_VERSION_HEX >= 0x030400a1 - if (unlikely(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_3owl_6libowl_ActivationAlgorithmWrapper[] = { - {"is_same", (PyCFunction)__pyx_pw_3owl_6libowl_26ActivationAlgorithmWrapper_3is_same, METH_O, 0}, - {0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_3owl_6libowl_ActivationAlgorithmWrapper = { - PyVarObject_HEAD_INIT(0, 0) - "owl.libowl.ActivationAlgorithmWrapper", /*tp_name*/ - sizeof(struct __pyx_obj_3owl_6libowl_ActivationAlgorithmWrapper), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3owl_6libowl_ActivationAlgorithmWrapper, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #else - 0, /*reserved*/ - #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*/ - 0, /*tp_doc*/ - 0, /*tp_traverse*/ - 0, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_3owl_6libowl_ActivationAlgorithmWrapper, /*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_3owl_6libowl_ActivationAlgorithmWrapper, /*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 PyObject *__pyx_tp_new_3owl_6libowl_ConvInfo(PyTypeObject *t, PyObject *a, 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; - if (unlikely(__pyx_pw_3owl_6libowl_8ConvInfo_1__cinit__(o, a, k) < 0)) { - Py_DECREF(o); o = 0; - } - return o; -} - -static void __pyx_tp_dealloc_3owl_6libowl_ConvInfo(PyObject *o) { - #if PY_VERSION_HEX >= 0x030400a1 - if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { - if (PyObject_CallFinalizerFromDealloc(o)) return; - } - #endif - { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - ++Py_REFCNT(o); - __pyx_pw_3owl_6libowl_8ConvInfo_3__dealloc__(o); - --Py_REFCNT(o); - PyErr_Restore(etype, eval, etb); - } - (*Py_TYPE(o)->tp_free)(o); -} - -static PyObject *__pyx_getprop_3owl_6libowl_8ConvInfo_pad_height(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_3owl_6libowl_8ConvInfo_10pad_height_3__get__(o); -} - -static int __pyx_setprop_3owl_6libowl_8ConvInfo_pad_height(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { - if (v) { - return __pyx_pw_3owl_6libowl_8ConvInfo_10pad_height_1__set__(o, v); - } - else { - PyErr_SetString(PyExc_NotImplementedError, "__del__"); - return -1; - } -} - -static PyObject *__pyx_getprop_3owl_6libowl_8ConvInfo_pad_width(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_3owl_6libowl_8ConvInfo_9pad_width_3__get__(o); -} - -static int __pyx_setprop_3owl_6libowl_8ConvInfo_pad_width(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { - if (v) { - return __pyx_pw_3owl_6libowl_8ConvInfo_9pad_width_1__set__(o, v); - } - else { - PyErr_SetString(PyExc_NotImplementedError, "__del__"); - return -1; - } -} - -static PyObject *__pyx_getprop_3owl_6libowl_8ConvInfo_stride_vertical(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_3owl_6libowl_8ConvInfo_15stride_vertical_3__get__(o); -} - -static int __pyx_setprop_3owl_6libowl_8ConvInfo_stride_vertical(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { - if (v) { - return __pyx_pw_3owl_6libowl_8ConvInfo_15stride_vertical_1__set__(o, v); - } - else { - PyErr_SetString(PyExc_NotImplementedError, "__del__"); - return -1; - } -} - -static PyObject *__pyx_getprop_3owl_6libowl_8ConvInfo_stride_horizontal(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_3owl_6libowl_8ConvInfo_17stride_horizontal_3__get__(o); -} - -static int __pyx_setprop_3owl_6libowl_8ConvInfo_stride_horizontal(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { - if (v) { - return __pyx_pw_3owl_6libowl_8ConvInfo_17stride_horizontal_1__set__(o, v); - } - else { - PyErr_SetString(PyExc_NotImplementedError, "__del__"); - return -1; - } -} - -static PyMethodDef __pyx_methods_3owl_6libowl_ConvInfo[] = { - {0, 0, 0, 0} -}; - -static struct PyGetSetDef __pyx_getsets_3owl_6libowl_ConvInfo[] = { - {(char *)"pad_height", __pyx_getprop_3owl_6libowl_8ConvInfo_pad_height, __pyx_setprop_3owl_6libowl_8ConvInfo_pad_height, 0, 0}, - {(char *)"pad_width", __pyx_getprop_3owl_6libowl_8ConvInfo_pad_width, __pyx_setprop_3owl_6libowl_8ConvInfo_pad_width, 0, 0}, - {(char *)"stride_vertical", __pyx_getprop_3owl_6libowl_8ConvInfo_stride_vertical, __pyx_setprop_3owl_6libowl_8ConvInfo_stride_vertical, 0, 0}, - {(char *)"stride_horizontal", __pyx_getprop_3owl_6libowl_8ConvInfo_stride_horizontal, __pyx_setprop_3owl_6libowl_8ConvInfo_stride_horizontal, 0, 0}, - {0, 0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_3owl_6libowl_ConvInfo = { - PyVarObject_HEAD_INIT(0, 0) - "owl.libowl.ConvInfo", /*tp_name*/ - sizeof(struct __pyx_obj_3owl_6libowl_ConvInfo), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3owl_6libowl_ConvInfo, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #else - 0, /*reserved*/ - #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*/ - 0, /*tp_doc*/ - 0, /*tp_traverse*/ - 0, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_3owl_6libowl_ConvInfo, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets_3owl_6libowl_ConvInfo, /*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_3owl_6libowl_ConvInfo, /*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 PyObject *__pyx_tp_new_3owl_6libowl_PoolingInfo(PyTypeObject *t, PyObject *a, 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; - if (unlikely(__pyx_pw_3owl_6libowl_11PoolingInfo_1__cinit__(o, a, k) < 0)) { - Py_DECREF(o); o = 0; - } - return o; -} - -static void __pyx_tp_dealloc_3owl_6libowl_PoolingInfo(PyObject *o) { - #if PY_VERSION_HEX >= 0x030400a1 - if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { - if (PyObject_CallFinalizerFromDealloc(o)) return; - } - #endif - { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - ++Py_REFCNT(o); - __pyx_pw_3owl_6libowl_11PoolingInfo_3__dealloc__(o); - --Py_REFCNT(o); - PyErr_Restore(etype, eval, etb); - } - (*Py_TYPE(o)->tp_free)(o); -} - -static PyObject *__pyx_getprop_3owl_6libowl_11PoolingInfo_algorithm(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_3owl_6libowl_11PoolingInfo_9algorithm_3__get__(o); -} - -static int __pyx_setprop_3owl_6libowl_11PoolingInfo_algorithm(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { - if (v) { - return __pyx_pw_3owl_6libowl_11PoolingInfo_9algorithm_1__set__(o, v); - } - else { - PyErr_SetString(PyExc_NotImplementedError, "__del__"); - return -1; - } -} - -static PyObject *__pyx_getprop_3owl_6libowl_11PoolingInfo_height(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_3owl_6libowl_11PoolingInfo_6height_3__get__(o); -} - -static int __pyx_setprop_3owl_6libowl_11PoolingInfo_height(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { - if (v) { - return __pyx_pw_3owl_6libowl_11PoolingInfo_6height_1__set__(o, v); - } - else { - PyErr_SetString(PyExc_NotImplementedError, "__del__"); - return -1; - } -} - -static PyObject *__pyx_getprop_3owl_6libowl_11PoolingInfo_width(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_3owl_6libowl_11PoolingInfo_5width_3__get__(o); -} - -static int __pyx_setprop_3owl_6libowl_11PoolingInfo_width(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { - if (v) { - return __pyx_pw_3owl_6libowl_11PoolingInfo_5width_1__set__(o, v); - } - else { - PyErr_SetString(PyExc_NotImplementedError, "__del__"); - return -1; - } -} - -static PyObject *__pyx_getprop_3owl_6libowl_11PoolingInfo_stride_vertical(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_3owl_6libowl_11PoolingInfo_15stride_vertical_3__get__(o); -} - -static int __pyx_setprop_3owl_6libowl_11PoolingInfo_stride_vertical(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { - if (v) { - return __pyx_pw_3owl_6libowl_11PoolingInfo_15stride_vertical_1__set__(o, v); - } - else { - PyErr_SetString(PyExc_NotImplementedError, "__del__"); - return -1; - } -} - -static PyObject *__pyx_getprop_3owl_6libowl_11PoolingInfo_stride_horizontal(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_3owl_6libowl_11PoolingInfo_17stride_horizontal_3__get__(o); -} - -static int __pyx_setprop_3owl_6libowl_11PoolingInfo_stride_horizontal(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { - if (v) { - return __pyx_pw_3owl_6libowl_11PoolingInfo_17stride_horizontal_1__set__(o, v); - } - else { - PyErr_SetString(PyExc_NotImplementedError, "__del__"); - return -1; - } -} - -static PyObject *__pyx_getprop_3owl_6libowl_11PoolingInfo_pad_height(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_3owl_6libowl_11PoolingInfo_10pad_height_3__get__(o); -} - -static int __pyx_setprop_3owl_6libowl_11PoolingInfo_pad_height(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { - if (v) { - return __pyx_pw_3owl_6libowl_11PoolingInfo_10pad_height_1__set__(o, v); - } - else { - PyErr_SetString(PyExc_NotImplementedError, "__del__"); - return -1; - } -} - -static PyObject *__pyx_getprop_3owl_6libowl_11PoolingInfo_pad_width(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_3owl_6libowl_11PoolingInfo_9pad_width_3__get__(o); -} - -static int __pyx_setprop_3owl_6libowl_11PoolingInfo_pad_width(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { - if (v) { - return __pyx_pw_3owl_6libowl_11PoolingInfo_9pad_width_1__set__(o, v); - } - else { - PyErr_SetString(PyExc_NotImplementedError, "__del__"); - return -1; - } -} - -static PyMethodDef __pyx_methods_3owl_6libowl_PoolingInfo[] = { - {0, 0, 0, 0} -}; - -static struct PyGetSetDef __pyx_getsets_3owl_6libowl_PoolingInfo[] = { - {(char *)"algorithm", __pyx_getprop_3owl_6libowl_11PoolingInfo_algorithm, __pyx_setprop_3owl_6libowl_11PoolingInfo_algorithm, 0, 0}, - {(char *)"height", __pyx_getprop_3owl_6libowl_11PoolingInfo_height, __pyx_setprop_3owl_6libowl_11PoolingInfo_height, 0, 0}, - {(char *)"width", __pyx_getprop_3owl_6libowl_11PoolingInfo_width, __pyx_setprop_3owl_6libowl_11PoolingInfo_width, 0, 0}, - {(char *)"stride_vertical", __pyx_getprop_3owl_6libowl_11PoolingInfo_stride_vertical, __pyx_setprop_3owl_6libowl_11PoolingInfo_stride_vertical, 0, 0}, - {(char *)"stride_horizontal", __pyx_getprop_3owl_6libowl_11PoolingInfo_stride_horizontal, __pyx_setprop_3owl_6libowl_11PoolingInfo_stride_horizontal, 0, 0}, - {(char *)"pad_height", __pyx_getprop_3owl_6libowl_11PoolingInfo_pad_height, __pyx_setprop_3owl_6libowl_11PoolingInfo_pad_height, 0, 0}, - {(char *)"pad_width", __pyx_getprop_3owl_6libowl_11PoolingInfo_pad_width, __pyx_setprop_3owl_6libowl_11PoolingInfo_pad_width, 0, 0}, - {0, 0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_3owl_6libowl_PoolingInfo = { - PyVarObject_HEAD_INIT(0, 0) - "owl.libowl.PoolingInfo", /*tp_name*/ - sizeof(struct __pyx_obj_3owl_6libowl_PoolingInfo), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3owl_6libowl_PoolingInfo, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #else - 0, /*reserved*/ - #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*/ - 0, /*tp_doc*/ - 0, /*tp_traverse*/ - 0, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_3owl_6libowl_PoolingInfo, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets_3owl_6libowl_PoolingInfo, /*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_3owl_6libowl_PoolingInfo, /*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[] = { - {0, 0, 0, 0} -}; - -#if PY_MAJOR_VERSION >= 3 -static struct PyModuleDef __pyx_moduledef = { - #if PY_VERSION_HEX < 0x03020000 - { PyObject_HEAD_INIT(NULL) NULL, 0, NULL }, - #else - PyModuleDef_HEAD_INIT, - #endif - "libowl", - 0, /* m_doc */ - -1, /* m_size */ - __pyx_methods /* m_methods */, - NULL, /* m_reload */ - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL /* m_free */ -}; -#endif - -static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_n_s_ActivationAlgorithms, __pyx_k_ActivationAlgorithms, sizeof(__pyx_k_ActivationAlgorithms), 0, 0, 1, 1}, - {&__pyx_n_s_ActivationAlgorithms___init, __pyx_k_ActivationAlgorithms___init, sizeof(__pyx_k_ActivationAlgorithms___init), 0, 0, 1, 1}, - {&__pyx_n_s_ActivationAlgorithms_find, __pyx_k_ActivationAlgorithms_find, sizeof(__pyx_k_ActivationAlgorithms_find), 0, 0, 1, 1}, - {&__pyx_n_s_ActivationAlgorithms_relu, __pyx_k_ActivationAlgorithms_relu, sizeof(__pyx_k_ActivationAlgorithms_relu), 0, 0, 1, 1}, - {&__pyx_n_s_ActivationAlgorithms_sigmoid, __pyx_k_ActivationAlgorithms_sigmoid, sizeof(__pyx_k_ActivationAlgorithms_sigmoid), 0, 0, 1, 1}, - {&__pyx_n_s_ActivationAlgorithms_tanh, __pyx_k_ActivationAlgorithms_tanh, sizeof(__pyx_k_ActivationAlgorithms_tanh), 0, 0, 1, 1}, - {&__pyx_kp_u_Format_string_allocated_too_shor, __pyx_k_Format_string_allocated_too_shor, sizeof(__pyx_k_Format_string_allocated_too_shor), 0, 1, 0, 0}, - {&__pyx_kp_u_Format_string_allocated_too_shor_2, __pyx_k_Format_string_allocated_too_shor_2, sizeof(__pyx_k_Format_string_allocated_too_shor_2), 0, 1, 0, 0}, - {&__pyx_kp_u_Non_native_byte_order_not_suppor, __pyx_k_Non_native_byte_order_not_suppor, sizeof(__pyx_k_Non_native_byte_order_not_suppor), 0, 1, 0, 0}, - {&__pyx_n_s_PoolingAlgorithms, __pyx_k_PoolingAlgorithms, sizeof(__pyx_k_PoolingAlgorithms), 0, 0, 1, 1}, - {&__pyx_n_s_PoolingAlgorithms___init, __pyx_k_PoolingAlgorithms___init, sizeof(__pyx_k_PoolingAlgorithms___init), 0, 0, 1, 1}, - {&__pyx_n_s_PoolingAlgorithms_average, __pyx_k_PoolingAlgorithms_average, sizeof(__pyx_k_PoolingAlgorithms_average), 0, 0, 1, 1}, - {&__pyx_n_s_PoolingAlgorithms_find, __pyx_k_PoolingAlgorithms_find, sizeof(__pyx_k_PoolingAlgorithms_find), 0, 0, 1, 1}, - {&__pyx_n_s_PoolingAlgorithms_max, __pyx_k_PoolingAlgorithms_max, sizeof(__pyx_k_PoolingAlgorithms_max), 0, 0, 1, 1}, - {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1}, - {&__pyx_n_s_SoftmaxAlgorithms, __pyx_k_SoftmaxAlgorithms, sizeof(__pyx_k_SoftmaxAlgorithms), 0, 0, 1, 1}, - {&__pyx_n_s_SoftmaxAlgorithms___init, __pyx_k_SoftmaxAlgorithms___init, sizeof(__pyx_k_SoftmaxAlgorithms___init), 0, 0, 1, 1}, - {&__pyx_n_s_SoftmaxAlgorithms_channel, __pyx_k_SoftmaxAlgorithms_channel, sizeof(__pyx_k_SoftmaxAlgorithms_channel), 0, 0, 1, 1}, - {&__pyx_n_s_SoftmaxAlgorithms_find, __pyx_k_SoftmaxAlgorithms_find, sizeof(__pyx_k_SoftmaxAlgorithms_find), 0, 0, 1, 1}, - {&__pyx_n_s_SoftmaxAlgorithms_instance, __pyx_k_SoftmaxAlgorithms_instance, sizeof(__pyx_k_SoftmaxAlgorithms_instance), 0, 0, 1, 1}, - {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1}, - {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1}, - {&__pyx_n_s_a, __pyx_k_a, sizeof(__pyx_k_a), 0, 0, 1, 1}, - {&__pyx_n_s_activation_algo, __pyx_k_activation_algo, sizeof(__pyx_k_activation_algo), 0, 0, 1, 1}, - {&__pyx_n_s_activation_backward, __pyx_k_activation_backward, sizeof(__pyx_k_activation_backward), 0, 0, 1, 1}, - {&__pyx_n_s_activation_forward, __pyx_k_activation_forward, sizeof(__pyx_k_activation_forward), 0, 0, 1, 1}, - {&__pyx_n_s_algo, __pyx_k_algo, sizeof(__pyx_k_algo), 0, 0, 1, 1}, - {&__pyx_n_s_argc, __pyx_k_argc, sizeof(__pyx_k_argc), 0, 0, 1, 1}, - {&__pyx_n_s_argv, __pyx_k_argv, sizeof(__pyx_k_argv), 0, 0, 1, 1}, - {&__pyx_n_s_arrays, __pyx_k_arrays, sizeof(__pyx_k_arrays), 0, 0, 1, 1}, - {&__pyx_n_s_astype, __pyx_k_astype, sizeof(__pyx_k_astype), 0, 0, 1, 1}, - {&__pyx_n_s_average, __pyx_k_average, sizeof(__pyx_k_average), 0, 0, 1, 1}, - {&__pyx_n_s_average_2, __pyx_k_average_2, sizeof(__pyx_k_average_2), 0, 0, 1, 1}, - {&__pyx_n_s_b, __pyx_k_b, sizeof(__pyx_k_b), 0, 0, 1, 1}, - {&__pyx_n_s_bias, __pyx_k_bias, sizeof(__pyx_k_bias), 0, 0, 1, 1}, - {&__pyx_n_s_bottom, __pyx_k_bottom, sizeof(__pyx_k_bottom), 0, 0, 1, 1}, - {&__pyx_n_s_bottom_data, __pyx_k_bottom_data, sizeof(__pyx_k_bottom_data), 0, 0, 1, 1}, - {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1}, - {&__pyx_n_s_channel, __pyx_k_channel, sizeof(__pyx_k_channel), 0, 0, 1, 1}, - {&__pyx_n_s_channel_2, __pyx_k_channel_2, sizeof(__pyx_k_channel_2), 0, 0, 1, 1}, - {&__pyx_n_s_concat, __pyx_k_concat, sizeof(__pyx_k_concat), 0, 0, 1, 1}, - {&__pyx_n_s_conv_backward_bias, __pyx_k_conv_backward_bias, sizeof(__pyx_k_conv_backward_bias), 0, 0, 1, 1}, - {&__pyx_n_s_conv_backward_data, __pyx_k_conv_backward_data, sizeof(__pyx_k_conv_backward_data), 0, 0, 1, 1}, - {&__pyx_n_s_conv_backward_filter, __pyx_k_conv_backward_filter, sizeof(__pyx_k_conv_backward_filter), 0, 0, 1, 1}, - {&__pyx_n_s_conv_forward, __pyx_k_conv_forward, sizeof(__pyx_k_conv_forward), 0, 0, 1, 1}, - {&__pyx_n_s_create_cpu_device, __pyx_k_create_cpu_device, sizeof(__pyx_k_create_cpu_device), 0, 0, 1, 1}, - {&__pyx_n_s_create_gpu_device, __pyx_k_create_gpu_device, sizeof(__pyx_k_create_gpu_device), 0, 0, 1, 1}, - {&__pyx_n_s_d, __pyx_k_d, sizeof(__pyx_k_d), 0, 0, 1, 1}, - {&__pyx_n_s_diff, __pyx_k_diff, sizeof(__pyx_k_diff), 0, 0, 1, 1}, - {&__pyx_n_s_dim, __pyx_k_dim, sizeof(__pyx_k_dim), 0, 0, 1, 1}, - {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1}, - {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1}, - {&__pyx_n_s_empty, __pyx_k_empty, sizeof(__pyx_k_empty), 0, 0, 1, 1}, - {&__pyx_n_s_exp, __pyx_k_exp, sizeof(__pyx_k_exp), 0, 0, 1, 1}, - {&__pyx_n_s_filter, __pyx_k_filter, sizeof(__pyx_k_filter), 0, 0, 1, 1}, - {&__pyx_n_s_find, __pyx_k_find, sizeof(__pyx_k_find), 0, 0, 1, 1}, - {&__pyx_n_s_flatten, __pyx_k_flatten, sizeof(__pyx_k_flatten), 0, 0, 1, 1}, - {&__pyx_n_s_float32, __pyx_k_float32, sizeof(__pyx_k_float32), 0, 0, 1, 1}, - {&__pyx_n_s_from_numpy, __pyx_k_from_numpy, sizeof(__pyx_k_from_numpy), 0, 0, 1, 1}, - {&__pyx_n_s_from_numpy_2, __pyx_k_from_numpy_2, sizeof(__pyx_k_from_numpy_2), 0, 0, 1, 1}, - {&__pyx_n_s_get_gpu_device_count, __pyx_k_get_gpu_device_count, sizeof(__pyx_k_get_gpu_device_count), 0, 0, 1, 1}, - {&__pyx_n_s_h, __pyx_k_h, sizeof(__pyx_k_h), 0, 0, 1, 1}, - {&__pyx_n_s_has_cuda, __pyx_k_has_cuda, sizeof(__pyx_k_has_cuda), 0, 0, 1, 1}, - {&__pyx_kp_s_home_minjie_athena_athena_owl_o, __pyx_k_home_minjie_athena_athena_owl_o, sizeof(__pyx_k_home_minjie_athena_athena_owl_o), 0, 0, 1, 0}, - {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1}, - {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, - {&__pyx_n_s_info, __pyx_k_info, sizeof(__pyx_k_info), 0, 0, 1, 1}, - {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1}, - {&__pyx_n_s_initialize, __pyx_k_initialize, sizeof(__pyx_k_initialize), 0, 0, 1, 1}, - {&__pyx_n_s_instance, __pyx_k_instance, sizeof(__pyx_k_instance), 0, 0, 1, 1}, - {&__pyx_n_s_instance_2, __pyx_k_instance_2, sizeof(__pyx_k_instance_2), 0, 0, 1, 1}, - {&__pyx_kp_s_invalid_activation_algorithm, __pyx_k_invalid_activation_algorithm, sizeof(__pyx_k_invalid_activation_algorithm), 0, 0, 1, 0}, - {&__pyx_kp_s_invalid_pooling_algorithm, __pyx_k_invalid_pooling_algorithm, sizeof(__pyx_k_invalid_pooling_algorithm), 0, 0, 1, 0}, - {&__pyx_kp_s_invalid_softmax_algorithm, __pyx_k_invalid_softmax_algorithm, sizeof(__pyx_k_invalid_softmax_algorithm), 0, 0, 1, 0}, - {&__pyx_n_s_is_same, __pyx_k_is_same, sizeof(__pyx_k_is_same), 0, 0, 1, 1}, - {&__pyx_n_s_lhs, __pyx_k_lhs, sizeof(__pyx_k_lhs), 0, 0, 1, 1}, - {&__pyx_n_s_ln, __pyx_k_ln, sizeof(__pyx_k_ln), 0, 0, 1, 1}, - {&__pyx_n_s_local_size, __pyx_k_local_size, sizeof(__pyx_k_local_size), 0, 0, 1, 1}, - {&__pyx_n_s_lrn_backward, __pyx_k_lrn_backward, sizeof(__pyx_k_lrn_backward), 0, 0, 1, 1}, - {&__pyx_n_s_lrn_forward, __pyx_k_lrn_forward, sizeof(__pyx_k_lrn_forward), 0, 0, 1, 1}, - {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, - {&__pyx_n_s_max, __pyx_k_max, sizeof(__pyx_k_max), 0, 0, 1, 1}, - {&__pyx_n_s_max_2, __pyx_k_max_2, sizeof(__pyx_k_max_2), 0, 0, 1, 1}, - {&__pyx_n_s_mean, __pyx_k_mean, sizeof(__pyx_k_mean), 0, 0, 1, 1}, - {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1}, - {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1}, - {&__pyx_n_s_mult, __pyx_k_mult, sizeof(__pyx_k_mult), 0, 0, 1, 1}, - {&__pyx_n_s_n, __pyx_k_n, sizeof(__pyx_k_n), 0, 0, 1, 1}, - {&__pyx_kp_u_ndarray_is_not_C_contiguous, __pyx_k_ndarray_is_not_C_contiguous, sizeof(__pyx_k_ndarray_is_not_C_contiguous), 0, 1, 0, 0}, - {&__pyx_kp_u_ndarray_is_not_Fortran_contiguou, __pyx_k_ndarray_is_not_Fortran_contiguou, sizeof(__pyx_k_ndarray_is_not_Fortran_contiguou), 0, 1, 0, 0}, - {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1}, - {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1}, - {&__pyx_n_s_object, __pyx_k_object, sizeof(__pyx_k_object), 0, 0, 1, 1}, - {&__pyx_n_s_ones, __pyx_k_ones, sizeof(__pyx_k_ones), 0, 0, 1, 1}, - {&__pyx_n_s_order, __pyx_k_order, sizeof(__pyx_k_order), 0, 0, 1, 1}, - {&__pyx_n_s_owl_libowl, __pyx_k_owl_libowl, sizeof(__pyx_k_owl_libowl), 0, 0, 1, 1}, - {&__pyx_n_s_p, __pyx_k_p, sizeof(__pyx_k_p), 0, 0, 1, 1}, - {&__pyx_n_s_ph, __pyx_k_ph, sizeof(__pyx_k_ph), 0, 0, 1, 1}, - {&__pyx_n_s_pooling_algo, __pyx_k_pooling_algo, sizeof(__pyx_k_pooling_algo), 0, 0, 1, 1}, - {&__pyx_n_s_pooling_backward, __pyx_k_pooling_backward, sizeof(__pyx_k_pooling_backward), 0, 0, 1, 1}, - {&__pyx_n_s_pooling_forward, __pyx_k_pooling_forward, sizeof(__pyx_k_pooling_forward), 0, 0, 1, 1}, - {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1}, - {&__pyx_n_s_property, __pyx_k_property, sizeof(__pyx_k_property), 0, 0, 1, 1}, - {&__pyx_n_s_pw, __pyx_k_pw, sizeof(__pyx_k_pw), 0, 0, 1, 1}, - {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1}, - {&__pyx_n_s_randb, __pyx_k_randb, sizeof(__pyx_k_randb), 0, 0, 1, 1}, - {&__pyx_n_s_randn, __pyx_k_randn, sizeof(__pyx_k_randn), 0, 0, 1, 1}, - {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, - {&__pyx_n_s_relu, __pyx_k_relu, sizeof(__pyx_k_relu), 0, 0, 1, 1}, - {&__pyx_n_s_relu_2, __pyx_k_relu_2, sizeof(__pyx_k_relu_2), 0, 0, 1, 1}, - {&__pyx_n_s_relu_back, __pyx_k_relu_back, sizeof(__pyx_k_relu_back), 0, 0, 1, 1}, - {&__pyx_n_s_reshape, __pyx_k_reshape, sizeof(__pyx_k_reshape), 0, 0, 1, 1}, - {&__pyx_n_s_reversed, __pyx_k_reversed, sizeof(__pyx_k_reversed), 0, 0, 1, 1}, - {&__pyx_n_s_rhs, __pyx_k_rhs, sizeof(__pyx_k_rhs), 0, 0, 1, 1}, - {&__pyx_n_s_s, __pyx_k_s, sizeof(__pyx_k_s), 0, 0, 1, 1}, - {&__pyx_n_s_scale, __pyx_k_scale, sizeof(__pyx_k_scale), 0, 0, 1, 1}, - {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1}, - {&__pyx_n_s_set_device, __pyx_k_set_device, sizeof(__pyx_k_set_device), 0, 0, 1, 1}, - {&__pyx_n_s_sh, __pyx_k_sh, sizeof(__pyx_k_sh), 0, 0, 1, 1}, - {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1}, - {&__pyx_n_s_sigm, __pyx_k_sigm, sizeof(__pyx_k_sigm), 0, 0, 1, 1}, - {&__pyx_n_s_sigm_back, __pyx_k_sigm_back, sizeof(__pyx_k_sigm_back), 0, 0, 1, 1}, - {&__pyx_n_s_sigmoid, __pyx_k_sigmoid, sizeof(__pyx_k_sigmoid), 0, 0, 1, 1}, - {&__pyx_n_s_sigmoid_2, __pyx_k_sigmoid_2, sizeof(__pyx_k_sigmoid_2), 0, 0, 1, 1}, - {&__pyx_n_s_slice, __pyx_k_slice, sizeof(__pyx_k_slice), 0, 0, 1, 1}, - {&__pyx_n_s_slice_count, __pyx_k_slice_count, sizeof(__pyx_k_slice_count), 0, 0, 1, 1}, - {&__pyx_n_s_slice_dim, __pyx_k_slice_dim, sizeof(__pyx_k_slice_dim), 0, 0, 1, 1}, - {&__pyx_n_s_softmax_algo, __pyx_k_softmax_algo, sizeof(__pyx_k_softmax_algo), 0, 0, 1, 1}, - {&__pyx_n_s_softmax_backward, __pyx_k_softmax_backward, sizeof(__pyx_k_softmax_backward), 0, 0, 1, 1}, - {&__pyx_n_s_softmax_forward, __pyx_k_softmax_forward, sizeof(__pyx_k_softmax_forward), 0, 0, 1, 1}, - {&__pyx_n_s_src, __pyx_k_src, sizeof(__pyx_k_src), 0, 0, 1, 1}, - {&__pyx_n_s_st_off, __pyx_k_st_off, sizeof(__pyx_k_st_off), 0, 0, 1, 1}, - {&__pyx_n_s_staticmethod, __pyx_k_staticmethod, sizeof(__pyx_k_staticmethod), 0, 0, 1, 1}, - {&__pyx_n_s_sv, __pyx_k_sv, sizeof(__pyx_k_sv), 0, 0, 1, 1}, - {&__pyx_n_s_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 0, 0, 1, 1}, - {&__pyx_n_s_tanh, __pyx_k_tanh, sizeof(__pyx_k_tanh), 0, 0, 1, 1}, - {&__pyx_n_s_tanh_2, __pyx_k_tanh_2, sizeof(__pyx_k_tanh_2), 0, 0, 1, 1}, - {&__pyx_n_s_tanh_back, __pyx_k_tanh_back, sizeof(__pyx_k_tanh_back), 0, 0, 1, 1}, - {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, - {&__pyx_n_s_top, __pyx_k_top, sizeof(__pyx_k_top), 0, 0, 1, 1}, - {&__pyx_n_s_top_data, __pyx_k_top_data, sizeof(__pyx_k_top_data), 0, 0, 1, 1}, - {&__pyx_n_s_top_diff, __pyx_k_top_diff, sizeof(__pyx_k_top_diff), 0, 0, 1, 1}, - {&__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_k_unknown_dtype_code_in_numpy_pxd, sizeof(__pyx_k_unknown_dtype_code_in_numpy_pxd), 0, 1, 0, 0}, - {&__pyx_n_s_v, __pyx_k_v, sizeof(__pyx_k_v), 0, 0, 1, 1}, - {&__pyx_n_s_var, __pyx_k_var, sizeof(__pyx_k_var), 0, 0, 1, 1}, - {&__pyx_n_s_w, __pyx_k_w, sizeof(__pyx_k_w), 0, 0, 1, 1}, - {&__pyx_n_s_wait_for_all, __pyx_k_wait_for_all, sizeof(__pyx_k_wait_for_all), 0, 0, 1, 1}, - {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1}, - {0, 0, 0, 0, 0, 0, 0} -}; -static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_staticmethod = __Pyx_GetBuiltinName(__pyx_n_s_staticmethod); if (!__pyx_builtin_staticmethod) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_object = __Pyx_GetBuiltinName(__pyx_n_s_object); if (!__pyx_builtin_object) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_property = __Pyx_GetBuiltinName(__pyx_n_s_property); if (!__pyx_builtin_property) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_reversed = __Pyx_GetBuiltinName(__pyx_n_s_reversed); if (!__pyx_builtin_reversed) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - return 0; - __pyx_L1_error:; - return -1; -} - -static int __Pyx_InitCachedConstants(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - - /* "owl/libowl.pyx":468 - * return self._average - * else: - * raise TypeError('invalid pooling algorithm') # <<<<<<<<<<<<<< - * - * @property - */ - __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_invalid_pooling_algorithm); if (unlikely(!__pyx_tuple_)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_tuple_); - __Pyx_GIVEREF(__pyx_tuple_); - - /* "owl/libowl.pyx":502 - * return self._channel - * else: - * raise TypeError('invalid softmax algorithm') # <<<<<<<<<<<<<< - * - * @property - */ - __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_invalid_softmax_algorithm); if (unlikely(!__pyx_tuple__2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_tuple__2); - __Pyx_GIVEREF(__pyx_tuple__2); - - /* "owl/libowl.pyx":540 - * return self._tanh - * else: - * raise TypeError('invalid activation algorithm') # <<<<<<<<<<<<<< - * - * @property - */ - __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_invalid_activation_algorithm); if (unlikely(!__pyx_tuple__3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_tuple__3); - __Pyx_GIVEREF(__pyx_tuple__3); - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":218 - * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) - * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): - * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< - * - * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) - */ - __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_C_contiguous); if (unlikely(!__pyx_tuple__5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_tuple__5); - __Pyx_GIVEREF(__pyx_tuple__5); - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":222 - * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) - * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): - * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< - * - * info.buf = PyArray_DATA(self) - */ - __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_Fortran_contiguou); if (unlikely(!__pyx_tuple__6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_tuple__6); - __Pyx_GIVEREF(__pyx_tuple__6); - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":260 - * if ((descr.byteorder == c'>' and little_endian) or - * (descr.byteorder == c'<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< - * if t == NPY_BYTE: f = "b" - * elif t == NPY_UBYTE: f = "B" - */ - __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_tuple__7); - __Pyx_GIVEREF(__pyx_tuple__7); - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":802 - * - * if (end - f) - (new_offset - offset[0]) < 15: - * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< - * - * if ((child.byteorder == c'>' and little_endian) or - */ - __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor); if (unlikely(!__pyx_tuple__8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_tuple__8); - __Pyx_GIVEREF(__pyx_tuple__8); - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":806 - * if ((child.byteorder == c'>' and little_endian) or - * (child.byteorder == c'<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< - * # One could encode it in the format string and have Cython - * # complain instead, BUT: < and > in format strings also imply - */ - __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_tuple__9); - __Pyx_GIVEREF(__pyx_tuple__9); - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":826 - * t = child.type_num - * if end - f < 5: - * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< - * - * # Until ticket #99 is fixed, use integers to avoid warnings - */ - __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor_2); if (unlikely(!__pyx_tuple__10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_tuple__10); - __Pyx_GIVEREF(__pyx_tuple__10); - - /* "owl/libowl.pyx":22 - * return ret - * - * def create_cpu_device(): # <<<<<<<<<<<<<< - * return m.CreateCpuDevice() - * - */ - __pyx_codeobj__11 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_minjie_athena_athena_owl_o, __pyx_n_s_create_cpu_device, 22, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "owl/libowl.pyx":25 - * return m.CreateCpuDevice() - * - * def create_gpu_device(i): # <<<<<<<<<<<<<< - * return m.CreateGpuDevice(i) - * - */ - __pyx_tuple__12 = PyTuple_Pack(1, __pyx_n_s_i); if (unlikely(!__pyx_tuple__12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_tuple__12); - __Pyx_GIVEREF(__pyx_tuple__12); - __pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__12, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_minjie_athena_athena_owl_o, __pyx_n_s_create_gpu_device, 25, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "owl/libowl.pyx":28 - * return m.CreateGpuDevice(i) - * - * def get_gpu_device_count(): # <<<<<<<<<<<<<< - * return m.GetGpuDeviceCount() - * - */ - __pyx_codeobj__14 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_minjie_athena_athena_owl_o, __pyx_n_s_get_gpu_device_count, 28, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "owl/libowl.pyx":31 - * return m.GetGpuDeviceCount() - * - * def wait_for_all(): # <<<<<<<<<<<<<< - * m.WaitForAll() - * - */ - __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_minjie_athena_athena_owl_o, __pyx_n_s_wait_for_all, 31, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "owl/libowl.pyx":34 - * m.WaitForAll() - * - * def set_device(i): # <<<<<<<<<<<<<< - * m.SetDevice(i) - * - */ - __pyx_tuple__16 = PyTuple_Pack(1, __pyx_n_s_i); if (unlikely(!__pyx_tuple__16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_tuple__16); - __Pyx_GIVEREF(__pyx_tuple__16); - __pyx_codeobj__17 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__16, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_minjie_athena_athena_owl_o, __pyx_n_s_set_device, 34, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "owl/libowl.pyx":37 - * m.SetDevice(i) - * - * def initialize(): # <<<<<<<<<<<<<< - * cdef int argc = len(sys.argv) - * cdef char** argv = (calloc(argc, sizeof(char*))) - */ - __pyx_tuple__18 = PyTuple_Pack(3, __pyx_n_s_argc, __pyx_n_s_argv, __pyx_n_s_i); if (unlikely(!__pyx_tuple__18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_tuple__18); - __Pyx_GIVEREF(__pyx_tuple__18); - __pyx_codeobj__19 = (PyObject*)__Pyx_PyCode_New(0, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__18, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_minjie_athena_athena_owl_o, __pyx_n_s_initialize, 37, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "owl/libowl.pyx":48 - * free(argv) - * - * def has_cuda(): # <<<<<<<<<<<<<< - * return m.has_cuda_ - * - */ - __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_minjie_athena_athena_owl_o, __pyx_n_s_has_cuda, 48, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "owl/libowl.pyx":181 - * - * @staticmethod - * def mult(NArray lhs, NArray rhs): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray(m.Mult(deref(lhs._d), deref(rhs._d))) - * - */ - __pyx_tuple__21 = PyTuple_Pack(2, __pyx_n_s_lhs, __pyx_n_s_rhs); if (unlikely(!__pyx_tuple__21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_tuple__21); - __Pyx_GIVEREF(__pyx_tuple__21); - __pyx_codeobj__22 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_minjie_athena_athena_owl_o, __pyx_n_s_mult, 181, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "owl/libowl.pyx":185 - * - * @staticmethod - * def exp(NArray lhs): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray(m.Exp(deref(lhs._d))) - * - */ - __pyx_tuple__23 = PyTuple_Pack(1, __pyx_n_s_lhs); if (unlikely(!__pyx_tuple__23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_tuple__23); - __Pyx_GIVEREF(__pyx_tuple__23); - __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_minjie_athena_athena_owl_o, __pyx_n_s_exp, 185, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "owl/libowl.pyx":189 - * - * @staticmethod - * def ln(NArray lhs): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray(m.Ln(deref(lhs._d))) - * - */ - __pyx_tuple__25 = PyTuple_Pack(1, __pyx_n_s_lhs); if (unlikely(!__pyx_tuple__25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_tuple__25); - __Pyx_GIVEREF(__pyx_tuple__25); - __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__25, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_minjie_athena_athena_owl_o, __pyx_n_s_ln, 189, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "owl/libowl.pyx":193 - * - * @staticmethod - * def sigm(NArray lhs): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray(m.SigmoidForward(deref(lhs._d))) - * - */ - __pyx_tuple__27 = PyTuple_Pack(1, __pyx_n_s_lhs); if (unlikely(!__pyx_tuple__27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_tuple__27); - __Pyx_GIVEREF(__pyx_tuple__27); - __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_minjie_athena_athena_owl_o, __pyx_n_s_sigm, 193, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "owl/libowl.pyx":197 - * - * @staticmethod - * def sigm_back(NArray diff, NArray top, NArray bottom): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray( - * m.SigmoidBackward( - */ - __pyx_tuple__29 = PyTuple_Pack(3, __pyx_n_s_diff, __pyx_n_s_top, __pyx_n_s_bottom); if (unlikely(!__pyx_tuple__29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_tuple__29); - __Pyx_GIVEREF(__pyx_tuple__29); - __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_minjie_athena_athena_owl_o, __pyx_n_s_sigm_back, 197, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "owl/libowl.pyx":205 - * - * @staticmethod - * def relu(NArray lhs): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray(m.ReluForward(deref(lhs._d))) - * - */ - __pyx_tuple__31 = PyTuple_Pack(1, __pyx_n_s_lhs); if (unlikely(!__pyx_tuple__31)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_tuple__31); - __Pyx_GIVEREF(__pyx_tuple__31); - __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_minjie_athena_athena_owl_o, __pyx_n_s_relu_2, 205, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "owl/libowl.pyx":209 - * - * @staticmethod - * def relu_back(NArray diff, NArray top, NArray bottom): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray( - * m.ReluBackward( - */ - __pyx_tuple__33 = PyTuple_Pack(3, __pyx_n_s_diff, __pyx_n_s_top, __pyx_n_s_bottom); if (unlikely(!__pyx_tuple__33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_tuple__33); - __Pyx_GIVEREF(__pyx_tuple__33); - __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_minjie_athena_athena_owl_o, __pyx_n_s_relu_back, 209, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "owl/libowl.pyx":217 - * - * @staticmethod - * def tanh(NArray lhs): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray(m.TanhForward(deref(lhs._d))) - * - */ - __pyx_tuple__35 = PyTuple_Pack(1, __pyx_n_s_lhs); if (unlikely(!__pyx_tuple__35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_tuple__35); - __Pyx_GIVEREF(__pyx_tuple__35); - __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_minjie_athena_athena_owl_o, __pyx_n_s_tanh_2, 217, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "owl/libowl.pyx":221 - * - * @staticmethod - * def tanh_back(NArray diff, NArray top, NArray bottom): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray( - * m.TanhBackward( - */ - __pyx_tuple__37 = PyTuple_Pack(3, __pyx_n_s_diff, __pyx_n_s_top, __pyx_n_s_bottom); if (unlikely(!__pyx_tuple__37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_tuple__37); - __Pyx_GIVEREF(__pyx_tuple__37); - __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_minjie_athena_athena_owl_o, __pyx_n_s_tanh_back, 221, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "owl/libowl.pyx":229 - * - * @staticmethod - * def conv_forward(NArray src, NArray filter, NArray bias, ConvInfo info): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray( - * m.ConvForward( - */ - __pyx_tuple__39 = PyTuple_Pack(4, __pyx_n_s_src, __pyx_n_s_filter, __pyx_n_s_bias, __pyx_n_s_info); if (unlikely(!__pyx_tuple__39)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_tuple__39); - __Pyx_GIVEREF(__pyx_tuple__39); - __pyx_codeobj__40 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_minjie_athena_athena_owl_o, __pyx_n_s_conv_forward, 229, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__40)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "owl/libowl.pyx":238 - * - * @staticmethod - * def conv_backward_data( # <<<<<<<<<<<<<< - * NArray diff, NArray bottom, NArray filter, ConvInfo info): - * return _wrap_cpp_narray( - */ - __pyx_tuple__41 = PyTuple_Pack(4, __pyx_n_s_diff, __pyx_n_s_bottom, __pyx_n_s_filter, __pyx_n_s_info); if (unlikely(!__pyx_tuple__41)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_tuple__41); - __Pyx_GIVEREF(__pyx_tuple__41); - __pyx_codeobj__42 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__41, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_minjie_athena_athena_owl_o, __pyx_n_s_conv_backward_data, 238, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__42)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "owl/libowl.pyx":248 - * - * @staticmethod - * def conv_backward_filter( # <<<<<<<<<<<<<< - * NArray diff, NArray bottom, NArray filter, ConvInfo info): - * return _wrap_cpp_narray( - */ - __pyx_tuple__43 = PyTuple_Pack(4, __pyx_n_s_diff, __pyx_n_s_bottom, __pyx_n_s_filter, __pyx_n_s_info); if (unlikely(!__pyx_tuple__43)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_tuple__43); - __Pyx_GIVEREF(__pyx_tuple__43); - __pyx_codeobj__44 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__43, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_minjie_athena_athena_owl_o, __pyx_n_s_conv_backward_filter, 248, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__44)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "owl/libowl.pyx":258 - * - * @staticmethod - * def conv_backward_bias(NArray diff): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray(m.ConvBackwardBias(deref(diff._d))); - * - */ - __pyx_tuple__45 = PyTuple_Pack(1, __pyx_n_s_diff); if (unlikely(!__pyx_tuple__45)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_tuple__45); - __Pyx_GIVEREF(__pyx_tuple__45); - __pyx_codeobj__46 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__45, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_minjie_athena_athena_owl_o, __pyx_n_s_conv_backward_bias, 258, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__46)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "owl/libowl.pyx":262 - * - * @staticmethod - * def softmax_forward(NArray src, SoftmaxAlgorithmWrapper algo): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray( - * m.SoftmaxForward( - */ - __pyx_tuple__47 = PyTuple_Pack(2, __pyx_n_s_src, __pyx_n_s_algo); if (unlikely(!__pyx_tuple__47)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_tuple__47); - __Pyx_GIVEREF(__pyx_tuple__47); - __pyx_codeobj__48 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__47, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_minjie_athena_athena_owl_o, __pyx_n_s_softmax_forward, 262, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__48)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "owl/libowl.pyx":269 - * - * @staticmethod - * def softmax_backward(NArray diff, NArray top, SoftmaxAlgorithmWrapper algo): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray( - * m.SoftmaxBackward( - */ - __pyx_tuple__49 = PyTuple_Pack(3, __pyx_n_s_diff, __pyx_n_s_top, __pyx_n_s_algo); if (unlikely(!__pyx_tuple__49)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_tuple__49); - __Pyx_GIVEREF(__pyx_tuple__49); - __pyx_codeobj__50 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__49, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_minjie_athena_athena_owl_o, __pyx_n_s_softmax_backward, 269, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__50)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "owl/libowl.pyx":277 - * - * @staticmethod - * def activation_forward(NArray src, ActivationAlgorithmWrapper algo): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray( - * m.ActivationForward( - */ - __pyx_tuple__51 = PyTuple_Pack(2, __pyx_n_s_src, __pyx_n_s_algo); if (unlikely(!__pyx_tuple__51)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_tuple__51); - __Pyx_GIVEREF(__pyx_tuple__51); - __pyx_codeobj__52 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__51, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_minjie_athena_athena_owl_o, __pyx_n_s_activation_forward, 277, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__52)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "owl/libowl.pyx":284 - * - * @staticmethod - * def activation_backward( # <<<<<<<<<<<<<< - * NArray diff - * , NArray top - */ - __pyx_tuple__53 = PyTuple_Pack(4, __pyx_n_s_diff, __pyx_n_s_top, __pyx_n_s_bottom, __pyx_n_s_algo); if (unlikely(!__pyx_tuple__53)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_tuple__53); - __Pyx_GIVEREF(__pyx_tuple__53); - __pyx_codeobj__54 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__53, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_minjie_athena_athena_owl_o, __pyx_n_s_activation_backward, 284, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__54)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "owl/libowl.pyx":297 - * - * @staticmethod - * def pooling_forward(NArray src, PoolingInfo algo): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray( - * m.PoolingForward( - */ - __pyx_tuple__55 = PyTuple_Pack(2, __pyx_n_s_src, __pyx_n_s_algo); if (unlikely(!__pyx_tuple__55)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_tuple__55); - __Pyx_GIVEREF(__pyx_tuple__55); - __pyx_codeobj__56 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__55, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_minjie_athena_athena_owl_o, __pyx_n_s_pooling_forward, 297, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__56)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "owl/libowl.pyx":304 - * - * @staticmethod - * def pooling_backward( # <<<<<<<<<<<<<< - * NArray diff - * , NArray top - */ - __pyx_tuple__57 = PyTuple_Pack(4, __pyx_n_s_diff, __pyx_n_s_top, __pyx_n_s_bottom, __pyx_n_s_algo); if (unlikely(!__pyx_tuple__57)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_tuple__57); - __Pyx_GIVEREF(__pyx_tuple__57); - __pyx_codeobj__58 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__57, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_minjie_athena_athena_owl_o, __pyx_n_s_pooling_backward, 304, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__58)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "owl/libowl.pyx":317 - * - * @staticmethod - * def lrn_forward(NArray src, NArray scale, int local_size, float a, float b): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray( - * m.LRNForward( - */ - __pyx_tuple__59 = PyTuple_Pack(5, __pyx_n_s_src, __pyx_n_s_scale, __pyx_n_s_local_size, __pyx_n_s_a, __pyx_n_s_b); if (unlikely(!__pyx_tuple__59)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_tuple__59); - __Pyx_GIVEREF(__pyx_tuple__59); - __pyx_codeobj__60 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__59, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_minjie_athena_athena_owl_o, __pyx_n_s_lrn_forward, 317, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__60)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "owl/libowl.pyx":327 - * - * @staticmethod - * def lrn_backward( # <<<<<<<<<<<<<< - * NArray bottom_data - * , NArray top_data - */ - __pyx_tuple__61 = PyTuple_Pack(7, __pyx_n_s_bottom_data, __pyx_n_s_top_data, __pyx_n_s_scale, __pyx_n_s_top_diff, __pyx_n_s_local_size, __pyx_n_s_a, __pyx_n_s_b); if (unlikely(!__pyx_tuple__61)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_tuple__61); - __Pyx_GIVEREF(__pyx_tuple__61); - __pyx_codeobj__62 = (PyObject*)__Pyx_PyCode_New(7, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__61, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_minjie_athena_athena_owl_o, __pyx_n_s_lrn_backward, 327, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__62)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "owl/libowl.pyx":389 - * - * @staticmethod - * def zeros(s): # <<<<<<<<<<<<<< - * cdef vector[int] v = _list_to_vector(s) - * return _wrap_cpp_narray(m.NArray.Zeros(m.ToScale(&v))) - */ - __pyx_tuple__63 = PyTuple_Pack(2, __pyx_n_s_s, __pyx_n_s_v); if (unlikely(!__pyx_tuple__63)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_tuple__63); - __Pyx_GIVEREF(__pyx_tuple__63); - __pyx_codeobj__64 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__63, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_minjie_athena_athena_owl_o, __pyx_n_s_zeros, 389, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__64)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "owl/libowl.pyx":394 - * - * @staticmethod - * def ones(s): # <<<<<<<<<<<<<< - * cdef vector[int] v = _list_to_vector(s) - * return _wrap_cpp_narray(m.NArray.Ones(m.ToScale(&v))) - */ - __pyx_tuple__65 = PyTuple_Pack(2, __pyx_n_s_s, __pyx_n_s_v); if (unlikely(!__pyx_tuple__65)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_tuple__65); - __Pyx_GIVEREF(__pyx_tuple__65); - __pyx_codeobj__66 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__65, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_minjie_athena_athena_owl_o, __pyx_n_s_ones, 394, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__66)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "owl/libowl.pyx":399 - * - * @staticmethod - * def randn(s, float mean, float var): # <<<<<<<<<<<<<< - * cdef vector[int] v = _list_to_vector(s) - * return _wrap_cpp_narray(m.NArray.Randn(m.ToScale(&v), mean, var)) - */ - __pyx_tuple__67 = PyTuple_Pack(4, __pyx_n_s_s, __pyx_n_s_mean, __pyx_n_s_var, __pyx_n_s_v); if (unlikely(!__pyx_tuple__67)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_tuple__67); - __Pyx_GIVEREF(__pyx_tuple__67); - __pyx_codeobj__68 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__67, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_minjie_athena_athena_owl_o, __pyx_n_s_randn, 399, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__68)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "owl/libowl.pyx":404 - * - * @staticmethod - * def randb(s, float p): # <<<<<<<<<<<<<< - * cdef vector[int] v = _list_to_vector(s) - * return _wrap_cpp_narray(m.NArray.RandBernoulli(m.ToScale(&v), p)) - */ - __pyx_tuple__69 = PyTuple_Pack(3, __pyx_n_s_s, __pyx_n_s_p, __pyx_n_s_v); if (unlikely(!__pyx_tuple__69)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_tuple__69); - __Pyx_GIVEREF(__pyx_tuple__69); - __pyx_codeobj__70 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__69, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_minjie_athena_athena_owl_o, __pyx_n_s_randb, 404, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__70)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "owl/libowl.pyx":409 - * - * @staticmethod - * def concat(arrays, int dim): # <<<<<<<<<<<<<< - * cdef vector[m.NArray] v - * cdef NArray n - */ - __pyx_tuple__71 = PyTuple_Pack(5, __pyx_n_s_arrays, __pyx_n_s_dim, __pyx_n_s_v, __pyx_n_s_n, __pyx_n_s_i); if (unlikely(!__pyx_tuple__71)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_tuple__71); - __Pyx_GIVEREF(__pyx_tuple__71); - __pyx_codeobj__72 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__71, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_minjie_athena_athena_owl_o, __pyx_n_s_concat, 409, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__72)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "owl/libowl.pyx":418 - * - * @staticmethod - * def slice(NArray n, int slice_dim, int st_off, int slice_count): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray( - * m.Slice(deref(n._d), slice_dim, st_off, slice_count)) - */ - __pyx_tuple__73 = PyTuple_Pack(4, __pyx_n_s_n, __pyx_n_s_slice_dim, __pyx_n_s_st_off, __pyx_n_s_slice_count); if (unlikely(!__pyx_tuple__73)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_tuple__73); - __Pyx_GIVEREF(__pyx_tuple__73); - __pyx_codeobj__74 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__73, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_minjie_athena_athena_owl_o, __pyx_n_s_slice, 418, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__74)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "owl/libowl.pyx":425 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * def from_numpy(np.ndarray n): # <<<<<<<<<<<<<< - * s = list(np.shape(n)) - * n = n.astype(np.float32) - */ - __pyx_tuple__75 = PyTuple_Pack(2, __pyx_n_s_n, __pyx_n_s_s); if (unlikely(!__pyx_tuple__75)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_tuple__75); - __Pyx_GIVEREF(__pyx_tuple__75); - __pyx_codeobj__76 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__75, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_minjie_athena_athena_owl_o, __pyx_n_s_from_numpy_2, 425, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__76)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "owl/libowl.pyx":433 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * def _from_numpy(np.ndarray[np.float32_t, ndim=1, mode='c'] n, list s): # <<<<<<<<<<<<<< - * cdef vector[int] shape = _list_to_vector(reversed(s)) - * return _wrap_cpp_narray(m.FromNumpy(&n[0], m.ToScale(&shape))) - */ - __pyx_tuple__77 = PyTuple_Pack(3, __pyx_n_s_n, __pyx_n_s_s, __pyx_n_s_shape); if (unlikely(!__pyx_tuple__77)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_tuple__77); - __Pyx_GIVEREF(__pyx_tuple__77); - __pyx_codeobj__78 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__77, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_minjie_athena_athena_owl_o, __pyx_n_s_from_numpy, 433, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__78)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "owl/libowl.pyx":456 - * - * class _PoolingAlgorithms(object): - * def __init__(self): # <<<<<<<<<<<<<< - * self._max = PoolingAlgorithmWrapper( - * m.OfPoolingAlgorithm(m.kPoolingAlgorithmMax)) - */ - __pyx_tuple__79 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__79)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_tuple__79); - __Pyx_GIVEREF(__pyx_tuple__79); - __pyx_codeobj__80 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__79, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_minjie_athena_athena_owl_o, __pyx_n_s_init, 456, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__80)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "owl/libowl.pyx":462 - * m.OfPoolingAlgorithm(m.kPoolingAlgorithmAverage)) - * - * def find(self, a): # <<<<<<<<<<<<<< - * if self._max.is_same(a): - * return self._max - */ - __pyx_tuple__81 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_a); if (unlikely(!__pyx_tuple__81)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_tuple__81); - __Pyx_GIVEREF(__pyx_tuple__81); - __pyx_codeobj__82 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__81, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_minjie_athena_athena_owl_o, __pyx_n_s_find, 462, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__82)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "owl/libowl.pyx":471 - * - * @property - * def max(self): # <<<<<<<<<<<<<< - * return self._max - * - */ - __pyx_tuple__83 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__83)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_tuple__83); - __Pyx_GIVEREF(__pyx_tuple__83); - __pyx_codeobj__84 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__83, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_minjie_athena_athena_owl_o, __pyx_n_s_max_2, 471, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__84)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "owl/libowl.pyx":475 - * - * @property - * def average(self): # <<<<<<<<<<<<<< - * return self._average - * - */ - __pyx_tuple__85 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__85)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_tuple__85); - __Pyx_GIVEREF(__pyx_tuple__85); - __pyx_codeobj__86 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__85, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_minjie_athena_athena_owl_o, __pyx_n_s_average_2, 475, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__86)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "owl/libowl.pyx":490 - * - * class _SoftmaxAlgorithms(object): - * def __init__(self): # <<<<<<<<<<<<<< - * self._instance = SoftmaxAlgorithmWrapper( - * m.OfSoftmaxAlgorithm(m.kSoftmaxAlgorithmInstance)) - */ - __pyx_tuple__87 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__87)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_tuple__87); - __Pyx_GIVEREF(__pyx_tuple__87); - __pyx_codeobj__88 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__87, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_minjie_athena_athena_owl_o, __pyx_n_s_init, 490, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__88)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "owl/libowl.pyx":496 - * m.OfSoftmaxAlgorithm(m.kSoftmaxAlgorithmChannel)) - * - * def find(self, a): # <<<<<<<<<<<<<< - * if self._instance.is_same(a): - * return self._instance - */ - __pyx_tuple__89 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_a); if (unlikely(!__pyx_tuple__89)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_tuple__89); - __Pyx_GIVEREF(__pyx_tuple__89); - __pyx_codeobj__90 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__89, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_minjie_athena_athena_owl_o, __pyx_n_s_find, 496, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__90)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "owl/libowl.pyx":505 - * - * @property - * def instance(self): # <<<<<<<<<<<<<< - * return self._instance - * - */ - __pyx_tuple__91 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__91)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_tuple__91); - __Pyx_GIVEREF(__pyx_tuple__91); - __pyx_codeobj__92 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__91, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_minjie_athena_athena_owl_o, __pyx_n_s_instance_2, 505, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__92)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "owl/libowl.pyx":509 - * - * @property - * def channel(self): # <<<<<<<<<<<<<< - * return self._channel - * - */ - __pyx_tuple__93 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__93)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_tuple__93); - __Pyx_GIVEREF(__pyx_tuple__93); - __pyx_codeobj__94 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__93, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_minjie_athena_athena_owl_o, __pyx_n_s_channel_2, 509, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__94)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "owl/libowl.pyx":524 - * - * class _ActivationAlgorithms(object): - * def __init__(self): # <<<<<<<<<<<<<< - * self._sigmoid = ActivationAlgorithmWrapper( - * m.OfActivationAlgorithm(m.kActivationAlgorithmSigmoid)) - */ - __pyx_tuple__95 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__95)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_tuple__95); - __Pyx_GIVEREF(__pyx_tuple__95); - __pyx_codeobj__96 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__95, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_minjie_athena_athena_owl_o, __pyx_n_s_init, 524, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__96)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "owl/libowl.pyx":532 - * m.OfActivationAlgorithm(m.kActivationAlgorithmTanh)) - * - * def find(self, a): # <<<<<<<<<<<<<< - * if self._sigmoid.is_same(a): - * return self._sigmoid - */ - __pyx_tuple__97 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_a); if (unlikely(!__pyx_tuple__97)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_tuple__97); - __Pyx_GIVEREF(__pyx_tuple__97); - __pyx_codeobj__98 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__97, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_minjie_athena_athena_owl_o, __pyx_n_s_find, 532, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__98)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "owl/libowl.pyx":543 - * - * @property - * def sigmoid(self): # <<<<<<<<<<<<<< - * return self._sigmoid - * - */ - __pyx_tuple__99 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__99)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_tuple__99); - __Pyx_GIVEREF(__pyx_tuple__99); - __pyx_codeobj__100 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__99, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_minjie_athena_athena_owl_o, __pyx_n_s_sigmoid_2, 543, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__100)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "owl/libowl.pyx":547 - * - * @property - * def relu(self): # <<<<<<<<<<<<<< - * return self._relu - * - */ - __pyx_tuple__101 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__101)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_tuple__101); - __Pyx_GIVEREF(__pyx_tuple__101); - __pyx_codeobj__102 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__101, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_minjie_athena_athena_owl_o, __pyx_n_s_relu_2, 547, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__102)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "owl/libowl.pyx":551 - * - * @property - * def tanh(self): # <<<<<<<<<<<<<< - * return self._tanh - * - */ - __pyx_tuple__103 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__103)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_tuple__103); - __Pyx_GIVEREF(__pyx_tuple__103); - __pyx_codeobj__104 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__103, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_minjie_athena_athena_owl_o, __pyx_n_s_tanh_2, 551, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__104)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - return 0; - __pyx_L1_error:; - return -1; -} - -#if PY_MAJOR_VERSION < 3 -PyMODINIT_FUNC initlibowl(void); /*proto*/ -PyMODINIT_FUNC initlibowl(void) -#else -PyMODINIT_FUNC PyInit_libowl(void); /*proto*/ -PyMODINIT_FUNC PyInit_libowl(void) -#endif -{ - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannyDeclarations - #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("PyMODINIT_FUNC PyInit_libowl(void)", 0); - if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #ifdef __Pyx_CyFunction_USED - if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - #ifdef __Pyx_FusedFunction_USED - if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - #ifdef __Pyx_Generator_USED - if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __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 PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4("libowl", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); - #else - __pyx_m = PyModule_Create(&__pyx_moduledef); - #endif - if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_d); - __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #if CYTHON_COMPILING_IN_PYPY - Py_INCREF(__pyx_b); - #endif - if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - /*--- Initialize various global constants etc. ---*/ - if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - if (__pyx_module_is_main_owl__libowl) { - if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - } - #if PY_MAJOR_VERSION >= 3 - { - PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (!PyDict_GetItemString(modules, "owl.libowl")) { - if (unlikely(PyDict_SetItemString(modules, "owl.libowl", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - } - #endif - /*--- Builtin init code ---*/ - if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /*--- Constants init code ---*/ - if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /*--- Global init code ---*/ - /*--- Variable export code ---*/ - /*--- Function export code ---*/ - /*--- Type init code ---*/ - if (PyType_Ready(&__pyx_type_3owl_6libowl_NArray) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_type_3owl_6libowl_NArray.tp_print = 0; - if (PyObject_SetAttrString(__pyx_m, "NArray", (PyObject *)&__pyx_type_3owl_6libowl_NArray) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3owl_6libowl_NArray = &__pyx_type_3owl_6libowl_NArray; - if (PyType_Ready(&__pyx_type_3owl_6libowl_PoolingAlgorithmWrapper) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_type_3owl_6libowl_PoolingAlgorithmWrapper.tp_print = 0; - if (PyObject_SetAttrString(__pyx_m, "PoolingAlgorithmWrapper", (PyObject *)&__pyx_type_3owl_6libowl_PoolingAlgorithmWrapper) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3owl_6libowl_PoolingAlgorithmWrapper = &__pyx_type_3owl_6libowl_PoolingAlgorithmWrapper; - if (PyType_Ready(&__pyx_type_3owl_6libowl_SoftmaxAlgorithmWrapper) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_type_3owl_6libowl_SoftmaxAlgorithmWrapper.tp_print = 0; - if (PyObject_SetAttrString(__pyx_m, "SoftmaxAlgorithmWrapper", (PyObject *)&__pyx_type_3owl_6libowl_SoftmaxAlgorithmWrapper) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3owl_6libowl_SoftmaxAlgorithmWrapper = &__pyx_type_3owl_6libowl_SoftmaxAlgorithmWrapper; - if (PyType_Ready(&__pyx_type_3owl_6libowl_ActivationAlgorithmWrapper) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_type_3owl_6libowl_ActivationAlgorithmWrapper.tp_print = 0; - if (PyObject_SetAttrString(__pyx_m, "ActivationAlgorithmWrapper", (PyObject *)&__pyx_type_3owl_6libowl_ActivationAlgorithmWrapper) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3owl_6libowl_ActivationAlgorithmWrapper = &__pyx_type_3owl_6libowl_ActivationAlgorithmWrapper; - if (PyType_Ready(&__pyx_type_3owl_6libowl_ConvInfo) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_type_3owl_6libowl_ConvInfo.tp_print = 0; - if (PyObject_SetAttrString(__pyx_m, "ConvInfo", (PyObject *)&__pyx_type_3owl_6libowl_ConvInfo) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3owl_6libowl_ConvInfo = &__pyx_type_3owl_6libowl_ConvInfo; - if (PyType_Ready(&__pyx_type_3owl_6libowl_PoolingInfo) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_type_3owl_6libowl_PoolingInfo.tp_print = 0; - if (PyObject_SetAttrString(__pyx_m, "PoolingInfo", (PyObject *)&__pyx_type_3owl_6libowl_PoolingInfo) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3owl_6libowl_PoolingInfo = &__pyx_type_3owl_6libowl_PoolingInfo; - /*--- Type import code ---*/ - __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", - #if CYTHON_COMPILING_IN_PYPY - sizeof(PyTypeObject), - #else - sizeof(PyHeapTypeObject), - #endif - 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /*--- Variable import code ---*/ - /*--- Function import code ---*/ - /*--- Execution code ---*/ - - /* "owl/libowl.pyx":1 - * import sys # <<<<<<<<<<<<<< - * from cython.operator cimport dereference as deref - * import cython - */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_sys, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "owl/libowl.pyx":7 - * from libc.string cimport strcpy - * from libcpp.vector cimport vector - * import numpy as np # <<<<<<<<<<<<<< - * cimport numpy as np - * cimport minerva as m - */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "owl/libowl.pyx":22 - * return ret - * - * def create_cpu_device(): # <<<<<<<<<<<<<< - * return m.CreateCpuDevice() - * - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3owl_6libowl_1create_cpu_device, NULL, __pyx_n_s_owl_libowl); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_create_cpu_device, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "owl/libowl.pyx":25 - * return m.CreateCpuDevice() - * - * def create_gpu_device(i): # <<<<<<<<<<<<<< - * return m.CreateGpuDevice(i) - * - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3owl_6libowl_3create_gpu_device, NULL, __pyx_n_s_owl_libowl); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_create_gpu_device, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "owl/libowl.pyx":28 - * return m.CreateGpuDevice(i) - * - * def get_gpu_device_count(): # <<<<<<<<<<<<<< - * return m.GetGpuDeviceCount() - * - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3owl_6libowl_5get_gpu_device_count, NULL, __pyx_n_s_owl_libowl); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_gpu_device_count, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "owl/libowl.pyx":31 - * return m.GetGpuDeviceCount() - * - * def wait_for_all(): # <<<<<<<<<<<<<< - * m.WaitForAll() - * - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3owl_6libowl_7wait_for_all, NULL, __pyx_n_s_owl_libowl); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_wait_for_all, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "owl/libowl.pyx":34 - * m.WaitForAll() - * - * def set_device(i): # <<<<<<<<<<<<<< - * m.SetDevice(i) - * - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3owl_6libowl_9set_device, NULL, __pyx_n_s_owl_libowl); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_device, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "owl/libowl.pyx":37 - * m.SetDevice(i) - * - * def initialize(): # <<<<<<<<<<<<<< - * cdef int argc = len(sys.argv) - * cdef char** argv = (calloc(argc, sizeof(char*))) - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3owl_6libowl_11initialize, NULL, __pyx_n_s_owl_libowl); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_initialize, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "owl/libowl.pyx":48 - * free(argv) - * - * def has_cuda(): # <<<<<<<<<<<<<< - * return m.has_cuda_ - * - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3owl_6libowl_13has_cuda, NULL, __pyx_n_s_owl_libowl); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_has_cuda, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "owl/libowl.pyx":181 - * - * @staticmethod - * def mult(NArray lhs, NArray rhs): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray(m.Mult(deref(lhs._d), deref(rhs._d))) - * - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3owl_6libowl_6NArray_21mult, NULL, __pyx_n_s_owl_libowl); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "owl/libowl.pyx":180 - * return self - * - * @staticmethod # <<<<<<<<<<<<<< - * def mult(NArray lhs, NArray rhs): - * return _wrap_cpp_narray(m.Mult(deref(lhs._d), deref(rhs._d))) - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __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 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_3owl_6libowl_NArray->tp_dict, __pyx_n_s_mult, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_3owl_6libowl_NArray); - - /* "owl/libowl.pyx":181 - * - * @staticmethod - * def mult(NArray lhs, NArray rhs): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray(m.Mult(deref(lhs._d), deref(rhs._d))) - * - */ - __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_3owl_6libowl_NArray, __pyx_n_s_mult); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "owl/libowl.pyx":180 - * return self - * - * @staticmethod # <<<<<<<<<<<<<< - * def mult(NArray lhs, NArray rhs): - * return _wrap_cpp_narray(m.Mult(deref(lhs._d), deref(rhs._d))) - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __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 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_3owl_6libowl_NArray->tp_dict, __pyx_n_s_mult, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_3owl_6libowl_NArray); - - /* "owl/libowl.pyx":185 - * - * @staticmethod - * def exp(NArray lhs): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray(m.Exp(deref(lhs._d))) - * - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3owl_6libowl_6NArray_23exp, NULL, __pyx_n_s_owl_libowl); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "owl/libowl.pyx":184 - * return _wrap_cpp_narray(m.Mult(deref(lhs._d), deref(rhs._d))) - * - * @staticmethod # <<<<<<<<<<<<<< - * def exp(NArray lhs): - * return _wrap_cpp_narray(m.Exp(deref(lhs._d))) - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __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 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_3owl_6libowl_NArray->tp_dict, __pyx_n_s_exp, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_3owl_6libowl_NArray); - - /* "owl/libowl.pyx":185 - * - * @staticmethod - * def exp(NArray lhs): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray(m.Exp(deref(lhs._d))) - * - */ - __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_3owl_6libowl_NArray, __pyx_n_s_exp); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "owl/libowl.pyx":184 - * return _wrap_cpp_narray(m.Mult(deref(lhs._d), deref(rhs._d))) - * - * @staticmethod # <<<<<<<<<<<<<< - * def exp(NArray lhs): - * return _wrap_cpp_narray(m.Exp(deref(lhs._d))) - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __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 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_3owl_6libowl_NArray->tp_dict, __pyx_n_s_exp, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_3owl_6libowl_NArray); - - /* "owl/libowl.pyx":189 - * - * @staticmethod - * def ln(NArray lhs): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray(m.Ln(deref(lhs._d))) - * - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3owl_6libowl_6NArray_25ln, NULL, __pyx_n_s_owl_libowl); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "owl/libowl.pyx":188 - * return _wrap_cpp_narray(m.Exp(deref(lhs._d))) - * - * @staticmethod # <<<<<<<<<<<<<< - * def ln(NArray lhs): - * return _wrap_cpp_narray(m.Ln(deref(lhs._d))) - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __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 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_3owl_6libowl_NArray->tp_dict, __pyx_n_s_ln, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_3owl_6libowl_NArray); - - /* "owl/libowl.pyx":189 - * - * @staticmethod - * def ln(NArray lhs): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray(m.Ln(deref(lhs._d))) - * - */ - __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_3owl_6libowl_NArray, __pyx_n_s_ln); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "owl/libowl.pyx":188 - * return _wrap_cpp_narray(m.Exp(deref(lhs._d))) - * - * @staticmethod # <<<<<<<<<<<<<< - * def ln(NArray lhs): - * return _wrap_cpp_narray(m.Ln(deref(lhs._d))) - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __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 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_3owl_6libowl_NArray->tp_dict, __pyx_n_s_ln, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_3owl_6libowl_NArray); - - /* "owl/libowl.pyx":193 - * - * @staticmethod - * def sigm(NArray lhs): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray(m.SigmoidForward(deref(lhs._d))) - * - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3owl_6libowl_6NArray_27sigm, NULL, __pyx_n_s_owl_libowl); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "owl/libowl.pyx":192 - * return _wrap_cpp_narray(m.Ln(deref(lhs._d))) - * - * @staticmethod # <<<<<<<<<<<<<< - * def sigm(NArray lhs): - * return _wrap_cpp_narray(m.SigmoidForward(deref(lhs._d))) - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __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 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_3owl_6libowl_NArray->tp_dict, __pyx_n_s_sigm, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_3owl_6libowl_NArray); - - /* "owl/libowl.pyx":193 - * - * @staticmethod - * def sigm(NArray lhs): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray(m.SigmoidForward(deref(lhs._d))) - * - */ - __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_3owl_6libowl_NArray, __pyx_n_s_sigm); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "owl/libowl.pyx":192 - * return _wrap_cpp_narray(m.Ln(deref(lhs._d))) - * - * @staticmethod # <<<<<<<<<<<<<< - * def sigm(NArray lhs): - * return _wrap_cpp_narray(m.SigmoidForward(deref(lhs._d))) - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __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 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_3owl_6libowl_NArray->tp_dict, __pyx_n_s_sigm, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_3owl_6libowl_NArray); - - /* "owl/libowl.pyx":197 - * - * @staticmethod - * def sigm_back(NArray diff, NArray top, NArray bottom): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray( - * m.SigmoidBackward( - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3owl_6libowl_6NArray_29sigm_back, NULL, __pyx_n_s_owl_libowl); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "owl/libowl.pyx":196 - * return _wrap_cpp_narray(m.SigmoidForward(deref(lhs._d))) - * - * @staticmethod # <<<<<<<<<<<<<< - * def sigm_back(NArray diff, NArray top, NArray bottom): - * return _wrap_cpp_narray( - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __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 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_3owl_6libowl_NArray->tp_dict, __pyx_n_s_sigm_back, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_3owl_6libowl_NArray); - - /* "owl/libowl.pyx":197 - * - * @staticmethod - * def sigm_back(NArray diff, NArray top, NArray bottom): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray( - * m.SigmoidBackward( - */ - __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_3owl_6libowl_NArray, __pyx_n_s_sigm_back); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "owl/libowl.pyx":196 - * return _wrap_cpp_narray(m.SigmoidForward(deref(lhs._d))) - * - * @staticmethod # <<<<<<<<<<<<<< - * def sigm_back(NArray diff, NArray top, NArray bottom): - * return _wrap_cpp_narray( - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __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 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_3owl_6libowl_NArray->tp_dict, __pyx_n_s_sigm_back, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_3owl_6libowl_NArray); - - /* "owl/libowl.pyx":205 - * - * @staticmethod - * def relu(NArray lhs): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray(m.ReluForward(deref(lhs._d))) - * - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3owl_6libowl_6NArray_31relu, NULL, __pyx_n_s_owl_libowl); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "owl/libowl.pyx":204 - * , deref(bottom._d))) - * - * @staticmethod # <<<<<<<<<<<<<< - * def relu(NArray lhs): - * return _wrap_cpp_narray(m.ReluForward(deref(lhs._d))) - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __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 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_3owl_6libowl_NArray->tp_dict, __pyx_n_s_relu_2, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_3owl_6libowl_NArray); - - /* "owl/libowl.pyx":205 - * - * @staticmethod - * def relu(NArray lhs): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray(m.ReluForward(deref(lhs._d))) - * - */ - __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_3owl_6libowl_NArray, __pyx_n_s_relu_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "owl/libowl.pyx":204 - * , deref(bottom._d))) - * - * @staticmethod # <<<<<<<<<<<<<< - * def relu(NArray lhs): - * return _wrap_cpp_narray(m.ReluForward(deref(lhs._d))) - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __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 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_3owl_6libowl_NArray->tp_dict, __pyx_n_s_relu_2, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_3owl_6libowl_NArray); - - /* "owl/libowl.pyx":209 - * - * @staticmethod - * def relu_back(NArray diff, NArray top, NArray bottom): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray( - * m.ReluBackward( - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3owl_6libowl_6NArray_33relu_back, NULL, __pyx_n_s_owl_libowl); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "owl/libowl.pyx":208 - * return _wrap_cpp_narray(m.ReluForward(deref(lhs._d))) - * - * @staticmethod # <<<<<<<<<<<<<< - * def relu_back(NArray diff, NArray top, NArray bottom): - * return _wrap_cpp_narray( - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __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 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_3owl_6libowl_NArray->tp_dict, __pyx_n_s_relu_back, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_3owl_6libowl_NArray); - - /* "owl/libowl.pyx":209 - * - * @staticmethod - * def relu_back(NArray diff, NArray top, NArray bottom): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray( - * m.ReluBackward( - */ - __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_3owl_6libowl_NArray, __pyx_n_s_relu_back); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "owl/libowl.pyx":208 - * return _wrap_cpp_narray(m.ReluForward(deref(lhs._d))) - * - * @staticmethod # <<<<<<<<<<<<<< - * def relu_back(NArray diff, NArray top, NArray bottom): - * return _wrap_cpp_narray( - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __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 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_3owl_6libowl_NArray->tp_dict, __pyx_n_s_relu_back, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_3owl_6libowl_NArray); - - /* "owl/libowl.pyx":217 - * - * @staticmethod - * def tanh(NArray lhs): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray(m.TanhForward(deref(lhs._d))) - * - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3owl_6libowl_6NArray_35tanh, NULL, __pyx_n_s_owl_libowl); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "owl/libowl.pyx":216 - * , deref(bottom._d))) - * - * @staticmethod # <<<<<<<<<<<<<< - * def tanh(NArray lhs): - * return _wrap_cpp_narray(m.TanhForward(deref(lhs._d))) - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __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 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_3owl_6libowl_NArray->tp_dict, __pyx_n_s_tanh_2, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_3owl_6libowl_NArray); - - /* "owl/libowl.pyx":217 - * - * @staticmethod - * def tanh(NArray lhs): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray(m.TanhForward(deref(lhs._d))) - * - */ - __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_3owl_6libowl_NArray, __pyx_n_s_tanh_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "owl/libowl.pyx":216 - * , deref(bottom._d))) - * - * @staticmethod # <<<<<<<<<<<<<< - * def tanh(NArray lhs): - * return _wrap_cpp_narray(m.TanhForward(deref(lhs._d))) - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __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 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_3owl_6libowl_NArray->tp_dict, __pyx_n_s_tanh_2, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_3owl_6libowl_NArray); - - /* "owl/libowl.pyx":221 - * - * @staticmethod - * def tanh_back(NArray diff, NArray top, NArray bottom): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray( - * m.TanhBackward( - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3owl_6libowl_6NArray_37tanh_back, NULL, __pyx_n_s_owl_libowl); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "owl/libowl.pyx":220 - * return _wrap_cpp_narray(m.TanhForward(deref(lhs._d))) - * - * @staticmethod # <<<<<<<<<<<<<< - * def tanh_back(NArray diff, NArray top, NArray bottom): - * return _wrap_cpp_narray( - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __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 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_3owl_6libowl_NArray->tp_dict, __pyx_n_s_tanh_back, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_3owl_6libowl_NArray); - - /* "owl/libowl.pyx":221 - * - * @staticmethod - * def tanh_back(NArray diff, NArray top, NArray bottom): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray( - * m.TanhBackward( - */ - __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_3owl_6libowl_NArray, __pyx_n_s_tanh_back); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "owl/libowl.pyx":220 - * return _wrap_cpp_narray(m.TanhForward(deref(lhs._d))) - * - * @staticmethod # <<<<<<<<<<<<<< - * def tanh_back(NArray diff, NArray top, NArray bottom): - * return _wrap_cpp_narray( - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __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 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_3owl_6libowl_NArray->tp_dict, __pyx_n_s_tanh_back, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_3owl_6libowl_NArray); - - /* "owl/libowl.pyx":229 - * - * @staticmethod - * def conv_forward(NArray src, NArray filter, NArray bias, ConvInfo info): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray( - * m.ConvForward( - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3owl_6libowl_6NArray_39conv_forward, NULL, __pyx_n_s_owl_libowl); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "owl/libowl.pyx":228 - * , deref(bottom._d))) - * - * @staticmethod # <<<<<<<<<<<<<< - * def conv_forward(NArray src, NArray filter, NArray bias, ConvInfo info): - * return _wrap_cpp_narray( - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __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 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_3owl_6libowl_NArray->tp_dict, __pyx_n_s_conv_forward, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_3owl_6libowl_NArray); - - /* "owl/libowl.pyx":229 - * - * @staticmethod - * def conv_forward(NArray src, NArray filter, NArray bias, ConvInfo info): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray( - * m.ConvForward( - */ - __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_3owl_6libowl_NArray, __pyx_n_s_conv_forward); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "owl/libowl.pyx":228 - * , deref(bottom._d))) - * - * @staticmethod # <<<<<<<<<<<<<< - * def conv_forward(NArray src, NArray filter, NArray bias, ConvInfo info): - * return _wrap_cpp_narray( - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __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 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_3owl_6libowl_NArray->tp_dict, __pyx_n_s_conv_forward, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_3owl_6libowl_NArray); - - /* "owl/libowl.pyx":238 - * - * @staticmethod - * def conv_backward_data( # <<<<<<<<<<<<<< - * NArray diff, NArray bottom, NArray filter, ConvInfo info): - * return _wrap_cpp_narray( - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3owl_6libowl_6NArray_41conv_backward_data, NULL, __pyx_n_s_owl_libowl); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "owl/libowl.pyx":237 - * , deref(info._d))); - * - * @staticmethod # <<<<<<<<<<<<<< - * def conv_backward_data( - * NArray diff, NArray bottom, NArray filter, ConvInfo info): - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __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 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_3owl_6libowl_NArray->tp_dict, __pyx_n_s_conv_backward_data, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_3owl_6libowl_NArray); - - /* "owl/libowl.pyx":238 - * - * @staticmethod - * def conv_backward_data( # <<<<<<<<<<<<<< - * NArray diff, NArray bottom, NArray filter, ConvInfo info): - * return _wrap_cpp_narray( - */ - __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_3owl_6libowl_NArray, __pyx_n_s_conv_backward_data); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "owl/libowl.pyx":237 - * , deref(info._d))); - * - * @staticmethod # <<<<<<<<<<<<<< - * def conv_backward_data( - * NArray diff, NArray bottom, NArray filter, ConvInfo info): - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __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 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_3owl_6libowl_NArray->tp_dict, __pyx_n_s_conv_backward_data, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_3owl_6libowl_NArray); - - /* "owl/libowl.pyx":248 - * - * @staticmethod - * def conv_backward_filter( # <<<<<<<<<<<<<< - * NArray diff, NArray bottom, NArray filter, ConvInfo info): - * return _wrap_cpp_narray( - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3owl_6libowl_6NArray_43conv_backward_filter, NULL, __pyx_n_s_owl_libowl); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "owl/libowl.pyx":247 - * , deref(info._d))); - * - * @staticmethod # <<<<<<<<<<<<<< - * def conv_backward_filter( - * NArray diff, NArray bottom, NArray filter, ConvInfo info): - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __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 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_3owl_6libowl_NArray->tp_dict, __pyx_n_s_conv_backward_filter, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_3owl_6libowl_NArray); - - /* "owl/libowl.pyx":248 - * - * @staticmethod - * def conv_backward_filter( # <<<<<<<<<<<<<< - * NArray diff, NArray bottom, NArray filter, ConvInfo info): - * return _wrap_cpp_narray( - */ - __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_3owl_6libowl_NArray, __pyx_n_s_conv_backward_filter); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "owl/libowl.pyx":247 - * , deref(info._d))); - * - * @staticmethod # <<<<<<<<<<<<<< - * def conv_backward_filter( - * NArray diff, NArray bottom, NArray filter, ConvInfo info): - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __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 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_3owl_6libowl_NArray->tp_dict, __pyx_n_s_conv_backward_filter, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_3owl_6libowl_NArray); - - /* "owl/libowl.pyx":258 - * - * @staticmethod - * def conv_backward_bias(NArray diff): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray(m.ConvBackwardBias(deref(diff._d))); - * - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3owl_6libowl_6NArray_45conv_backward_bias, NULL, __pyx_n_s_owl_libowl); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "owl/libowl.pyx":257 - * , deref(info._d))); - * - * @staticmethod # <<<<<<<<<<<<<< - * def conv_backward_bias(NArray diff): - * return _wrap_cpp_narray(m.ConvBackwardBias(deref(diff._d))); - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __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 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_3owl_6libowl_NArray->tp_dict, __pyx_n_s_conv_backward_bias, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_3owl_6libowl_NArray); - - /* "owl/libowl.pyx":258 - * - * @staticmethod - * def conv_backward_bias(NArray diff): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray(m.ConvBackwardBias(deref(diff._d))); - * - */ - __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_3owl_6libowl_NArray, __pyx_n_s_conv_backward_bias); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "owl/libowl.pyx":257 - * , deref(info._d))); - * - * @staticmethod # <<<<<<<<<<<<<< - * def conv_backward_bias(NArray diff): - * return _wrap_cpp_narray(m.ConvBackwardBias(deref(diff._d))); - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __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 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_3owl_6libowl_NArray->tp_dict, __pyx_n_s_conv_backward_bias, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_3owl_6libowl_NArray); - - /* "owl/libowl.pyx":262 - * - * @staticmethod - * def softmax_forward(NArray src, SoftmaxAlgorithmWrapper algo): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray( - * m.SoftmaxForward( - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3owl_6libowl_6NArray_47softmax_forward, NULL, __pyx_n_s_owl_libowl); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "owl/libowl.pyx":261 - * return _wrap_cpp_narray(m.ConvBackwardBias(deref(diff._d))); - * - * @staticmethod # <<<<<<<<<<<<<< - * def softmax_forward(NArray src, SoftmaxAlgorithmWrapper algo): - * return _wrap_cpp_narray( - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __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 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_3owl_6libowl_NArray->tp_dict, __pyx_n_s_softmax_forward, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_3owl_6libowl_NArray); - - /* "owl/libowl.pyx":262 - * - * @staticmethod - * def softmax_forward(NArray src, SoftmaxAlgorithmWrapper algo): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray( - * m.SoftmaxForward( - */ - __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_3owl_6libowl_NArray, __pyx_n_s_softmax_forward); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "owl/libowl.pyx":261 - * return _wrap_cpp_narray(m.ConvBackwardBias(deref(diff._d))); - * - * @staticmethod # <<<<<<<<<<<<<< - * def softmax_forward(NArray src, SoftmaxAlgorithmWrapper algo): - * return _wrap_cpp_narray( - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __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 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_3owl_6libowl_NArray->tp_dict, __pyx_n_s_softmax_forward, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_3owl_6libowl_NArray); - - /* "owl/libowl.pyx":269 - * - * @staticmethod - * def softmax_backward(NArray diff, NArray top, SoftmaxAlgorithmWrapper algo): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray( - * m.SoftmaxBackward( - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3owl_6libowl_6NArray_49softmax_backward, NULL, __pyx_n_s_owl_libowl); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "owl/libowl.pyx":268 - * , m.ToSoftmaxAlgorithm(algo._d))); - * - * @staticmethod # <<<<<<<<<<<<<< - * def softmax_backward(NArray diff, NArray top, SoftmaxAlgorithmWrapper algo): - * return _wrap_cpp_narray( - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __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 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_3owl_6libowl_NArray->tp_dict, __pyx_n_s_softmax_backward, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_3owl_6libowl_NArray); - - /* "owl/libowl.pyx":269 - * - * @staticmethod - * def softmax_backward(NArray diff, NArray top, SoftmaxAlgorithmWrapper algo): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray( - * m.SoftmaxBackward( - */ - __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_3owl_6libowl_NArray, __pyx_n_s_softmax_backward); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "owl/libowl.pyx":268 - * , m.ToSoftmaxAlgorithm(algo._d))); - * - * @staticmethod # <<<<<<<<<<<<<< - * def softmax_backward(NArray diff, NArray top, SoftmaxAlgorithmWrapper algo): - * return _wrap_cpp_narray( - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __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 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_3owl_6libowl_NArray->tp_dict, __pyx_n_s_softmax_backward, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_3owl_6libowl_NArray); - - /* "owl/libowl.pyx":277 - * - * @staticmethod - * def activation_forward(NArray src, ActivationAlgorithmWrapper algo): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray( - * m.ActivationForward( - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3owl_6libowl_6NArray_51activation_forward, NULL, __pyx_n_s_owl_libowl); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "owl/libowl.pyx":276 - * , m.ToSoftmaxAlgorithm(algo._d))); - * - * @staticmethod # <<<<<<<<<<<<<< - * def activation_forward(NArray src, ActivationAlgorithmWrapper algo): - * return _wrap_cpp_narray( - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __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 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_3owl_6libowl_NArray->tp_dict, __pyx_n_s_activation_forward, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_3owl_6libowl_NArray); - - /* "owl/libowl.pyx":277 - * - * @staticmethod - * def activation_forward(NArray src, ActivationAlgorithmWrapper algo): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray( - * m.ActivationForward( - */ - __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_3owl_6libowl_NArray, __pyx_n_s_activation_forward); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "owl/libowl.pyx":276 - * , m.ToSoftmaxAlgorithm(algo._d))); - * - * @staticmethod # <<<<<<<<<<<<<< - * def activation_forward(NArray src, ActivationAlgorithmWrapper algo): - * return _wrap_cpp_narray( - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __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 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_3owl_6libowl_NArray->tp_dict, __pyx_n_s_activation_forward, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_3owl_6libowl_NArray); - - /* "owl/libowl.pyx":284 - * - * @staticmethod - * def activation_backward( # <<<<<<<<<<<<<< - * NArray diff - * , NArray top - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3owl_6libowl_6NArray_53activation_backward, NULL, __pyx_n_s_owl_libowl); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "owl/libowl.pyx":283 - * , m.ToActivationAlgorithm(algo._d))); - * - * @staticmethod # <<<<<<<<<<<<<< - * def activation_backward( - * NArray diff - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __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 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_3owl_6libowl_NArray->tp_dict, __pyx_n_s_activation_backward, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_3owl_6libowl_NArray); - - /* "owl/libowl.pyx":284 - * - * @staticmethod - * def activation_backward( # <<<<<<<<<<<<<< - * NArray diff - * , NArray top - */ - __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_3owl_6libowl_NArray, __pyx_n_s_activation_backward); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "owl/libowl.pyx":283 - * , m.ToActivationAlgorithm(algo._d))); - * - * @staticmethod # <<<<<<<<<<<<<< - * def activation_backward( - * NArray diff - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __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 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_3owl_6libowl_NArray->tp_dict, __pyx_n_s_activation_backward, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_3owl_6libowl_NArray); - - /* "owl/libowl.pyx":297 - * - * @staticmethod - * def pooling_forward(NArray src, PoolingInfo algo): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray( - * m.PoolingForward( - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3owl_6libowl_6NArray_55pooling_forward, NULL, __pyx_n_s_owl_libowl); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "owl/libowl.pyx":296 - * , m.ToActivationAlgorithm(algo._d))); - * - * @staticmethod # <<<<<<<<<<<<<< - * def pooling_forward(NArray src, PoolingInfo algo): - * return _wrap_cpp_narray( - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __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 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_3owl_6libowl_NArray->tp_dict, __pyx_n_s_pooling_forward, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_3owl_6libowl_NArray); - - /* "owl/libowl.pyx":297 - * - * @staticmethod - * def pooling_forward(NArray src, PoolingInfo algo): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray( - * m.PoolingForward( - */ - __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_3owl_6libowl_NArray, __pyx_n_s_pooling_forward); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "owl/libowl.pyx":296 - * , m.ToActivationAlgorithm(algo._d))); - * - * @staticmethod # <<<<<<<<<<<<<< - * def pooling_forward(NArray src, PoolingInfo algo): - * return _wrap_cpp_narray( - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __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 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_3owl_6libowl_NArray->tp_dict, __pyx_n_s_pooling_forward, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_3owl_6libowl_NArray); - - /* "owl/libowl.pyx":304 - * - * @staticmethod - * def pooling_backward( # <<<<<<<<<<<<<< - * NArray diff - * , NArray top - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3owl_6libowl_6NArray_57pooling_backward, NULL, __pyx_n_s_owl_libowl); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "owl/libowl.pyx":303 - * , deref(algo._d))); - * - * @staticmethod # <<<<<<<<<<<<<< - * def pooling_backward( - * NArray diff - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __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 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_3owl_6libowl_NArray->tp_dict, __pyx_n_s_pooling_backward, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_3owl_6libowl_NArray); - - /* "owl/libowl.pyx":304 - * - * @staticmethod - * def pooling_backward( # <<<<<<<<<<<<<< - * NArray diff - * , NArray top - */ - __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_3owl_6libowl_NArray, __pyx_n_s_pooling_backward); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "owl/libowl.pyx":303 - * , deref(algo._d))); - * - * @staticmethod # <<<<<<<<<<<<<< - * def pooling_backward( - * NArray diff - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __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 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_3owl_6libowl_NArray->tp_dict, __pyx_n_s_pooling_backward, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_3owl_6libowl_NArray); - - /* "owl/libowl.pyx":317 - * - * @staticmethod - * def lrn_forward(NArray src, NArray scale, int local_size, float a, float b): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray( - * m.LRNForward( - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3owl_6libowl_6NArray_59lrn_forward, NULL, __pyx_n_s_owl_libowl); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "owl/libowl.pyx":316 - * , deref(algo._d))); - * - * @staticmethod # <<<<<<<<<<<<<< - * def lrn_forward(NArray src, NArray scale, int local_size, float a, float b): - * return _wrap_cpp_narray( - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __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 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_3owl_6libowl_NArray->tp_dict, __pyx_n_s_lrn_forward, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_3owl_6libowl_NArray); - - /* "owl/libowl.pyx":317 - * - * @staticmethod - * def lrn_forward(NArray src, NArray scale, int local_size, float a, float b): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray( - * m.LRNForward( - */ - __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_3owl_6libowl_NArray, __pyx_n_s_lrn_forward); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "owl/libowl.pyx":316 - * , deref(algo._d))); - * - * @staticmethod # <<<<<<<<<<<<<< - * def lrn_forward(NArray src, NArray scale, int local_size, float a, float b): - * return _wrap_cpp_narray( - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __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 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_3owl_6libowl_NArray->tp_dict, __pyx_n_s_lrn_forward, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_3owl_6libowl_NArray); - - /* "owl/libowl.pyx":327 - * - * @staticmethod - * def lrn_backward( # <<<<<<<<<<<<<< - * NArray bottom_data - * , NArray top_data - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3owl_6libowl_6NArray_61lrn_backward, NULL, __pyx_n_s_owl_libowl); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "owl/libowl.pyx":326 - * , b)); - * - * @staticmethod # <<<<<<<<<<<<<< - * def lrn_backward( - * NArray bottom_data - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __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 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_3owl_6libowl_NArray->tp_dict, __pyx_n_s_lrn_backward, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_3owl_6libowl_NArray); - - /* "owl/libowl.pyx":327 - * - * @staticmethod - * def lrn_backward( # <<<<<<<<<<<<<< - * NArray bottom_data - * , NArray top_data - */ - __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_3owl_6libowl_NArray, __pyx_n_s_lrn_backward); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "owl/libowl.pyx":326 - * , b)); - * - * @staticmethod # <<<<<<<<<<<<<< - * def lrn_backward( - * NArray bottom_data - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __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 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_3owl_6libowl_NArray->tp_dict, __pyx_n_s_lrn_backward, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_3owl_6libowl_NArray); - - /* "owl/libowl.pyx":389 - * - * @staticmethod - * def zeros(s): # <<<<<<<<<<<<<< - * cdef vector[int] v = _list_to_vector(s) - * return _wrap_cpp_narray(m.NArray.Zeros(m.ToScale(&v))) - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3owl_6libowl_6NArray_77zeros, NULL, __pyx_n_s_owl_libowl); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "owl/libowl.pyx":388 - * return list(scale) - * - * @staticmethod # <<<<<<<<<<<<<< - * def zeros(s): - * cdef vector[int] v = _list_to_vector(s) - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __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 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_3owl_6libowl_NArray->tp_dict, __pyx_n_s_zeros, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_3owl_6libowl_NArray); - - /* "owl/libowl.pyx":389 - * - * @staticmethod - * def zeros(s): # <<<<<<<<<<<<<< - * cdef vector[int] v = _list_to_vector(s) - * return _wrap_cpp_narray(m.NArray.Zeros(m.ToScale(&v))) - */ - __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_3owl_6libowl_NArray, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "owl/libowl.pyx":388 - * return list(scale) - * - * @staticmethod # <<<<<<<<<<<<<< - * def zeros(s): - * cdef vector[int] v = _list_to_vector(s) - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __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 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_3owl_6libowl_NArray->tp_dict, __pyx_n_s_zeros, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_3owl_6libowl_NArray); - - /* "owl/libowl.pyx":394 - * - * @staticmethod - * def ones(s): # <<<<<<<<<<<<<< - * cdef vector[int] v = _list_to_vector(s) - * return _wrap_cpp_narray(m.NArray.Ones(m.ToScale(&v))) - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3owl_6libowl_6NArray_79ones, NULL, __pyx_n_s_owl_libowl); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "owl/libowl.pyx":393 - * return _wrap_cpp_narray(m.NArray.Zeros(m.ToScale(&v))) - * - * @staticmethod # <<<<<<<<<<<<<< - * def ones(s): - * cdef vector[int] v = _list_to_vector(s) - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __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 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_3owl_6libowl_NArray->tp_dict, __pyx_n_s_ones, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_3owl_6libowl_NArray); - - /* "owl/libowl.pyx":394 - * - * @staticmethod - * def ones(s): # <<<<<<<<<<<<<< - * cdef vector[int] v = _list_to_vector(s) - * return _wrap_cpp_narray(m.NArray.Ones(m.ToScale(&v))) - */ - __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_3owl_6libowl_NArray, __pyx_n_s_ones); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "owl/libowl.pyx":393 - * return _wrap_cpp_narray(m.NArray.Zeros(m.ToScale(&v))) - * - * @staticmethod # <<<<<<<<<<<<<< - * def ones(s): - * cdef vector[int] v = _list_to_vector(s) - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __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 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_3owl_6libowl_NArray->tp_dict, __pyx_n_s_ones, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_3owl_6libowl_NArray); - - /* "owl/libowl.pyx":399 - * - * @staticmethod - * def randn(s, float mean, float var): # <<<<<<<<<<<<<< - * cdef vector[int] v = _list_to_vector(s) - * return _wrap_cpp_narray(m.NArray.Randn(m.ToScale(&v), mean, var)) - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3owl_6libowl_6NArray_81randn, NULL, __pyx_n_s_owl_libowl); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "owl/libowl.pyx":398 - * return _wrap_cpp_narray(m.NArray.Ones(m.ToScale(&v))) - * - * @staticmethod # <<<<<<<<<<<<<< - * def randn(s, float mean, float var): - * cdef vector[int] v = _list_to_vector(s) - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __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 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_3owl_6libowl_NArray->tp_dict, __pyx_n_s_randn, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_3owl_6libowl_NArray); - - /* "owl/libowl.pyx":399 - * - * @staticmethod - * def randn(s, float mean, float var): # <<<<<<<<<<<<<< - * cdef vector[int] v = _list_to_vector(s) - * return _wrap_cpp_narray(m.NArray.Randn(m.ToScale(&v), mean, var)) - */ - __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_3owl_6libowl_NArray, __pyx_n_s_randn); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "owl/libowl.pyx":398 - * return _wrap_cpp_narray(m.NArray.Ones(m.ToScale(&v))) - * - * @staticmethod # <<<<<<<<<<<<<< - * def randn(s, float mean, float var): - * cdef vector[int] v = _list_to_vector(s) - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __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 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_3owl_6libowl_NArray->tp_dict, __pyx_n_s_randn, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_3owl_6libowl_NArray); - - /* "owl/libowl.pyx":404 - * - * @staticmethod - * def randb(s, float p): # <<<<<<<<<<<<<< - * cdef vector[int] v = _list_to_vector(s) - * return _wrap_cpp_narray(m.NArray.RandBernoulli(m.ToScale(&v), p)) - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3owl_6libowl_6NArray_83randb, NULL, __pyx_n_s_owl_libowl); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "owl/libowl.pyx":403 - * return _wrap_cpp_narray(m.NArray.Randn(m.ToScale(&v), mean, var)) - * - * @staticmethod # <<<<<<<<<<<<<< - * def randb(s, float p): - * cdef vector[int] v = _list_to_vector(s) - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __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 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_3owl_6libowl_NArray->tp_dict, __pyx_n_s_randb, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_3owl_6libowl_NArray); - - /* "owl/libowl.pyx":404 - * - * @staticmethod - * def randb(s, float p): # <<<<<<<<<<<<<< - * cdef vector[int] v = _list_to_vector(s) - * return _wrap_cpp_narray(m.NArray.RandBernoulli(m.ToScale(&v), p)) - */ - __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_3owl_6libowl_NArray, __pyx_n_s_randb); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "owl/libowl.pyx":403 - * return _wrap_cpp_narray(m.NArray.Randn(m.ToScale(&v), mean, var)) - * - * @staticmethod # <<<<<<<<<<<<<< - * def randb(s, float p): - * cdef vector[int] v = _list_to_vector(s) - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __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 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_3owl_6libowl_NArray->tp_dict, __pyx_n_s_randb, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_3owl_6libowl_NArray); - - /* "owl/libowl.pyx":409 - * - * @staticmethod - * def concat(arrays, int dim): # <<<<<<<<<<<<<< - * cdef vector[m.NArray] v - * cdef NArray n - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3owl_6libowl_6NArray_85concat, NULL, __pyx_n_s_owl_libowl); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "owl/libowl.pyx":408 - * return _wrap_cpp_narray(m.NArray.RandBernoulli(m.ToScale(&v), p)) - * - * @staticmethod # <<<<<<<<<<<<<< - * def concat(arrays, int dim): - * cdef vector[m.NArray] v - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __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 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_3owl_6libowl_NArray->tp_dict, __pyx_n_s_concat, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_3owl_6libowl_NArray); - - /* "owl/libowl.pyx":409 - * - * @staticmethod - * def concat(arrays, int dim): # <<<<<<<<<<<<<< - * cdef vector[m.NArray] v - * cdef NArray n - */ - __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_3owl_6libowl_NArray, __pyx_n_s_concat); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "owl/libowl.pyx":408 - * return _wrap_cpp_narray(m.NArray.RandBernoulli(m.ToScale(&v), p)) - * - * @staticmethod # <<<<<<<<<<<<<< - * def concat(arrays, int dim): - * cdef vector[m.NArray] v - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __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 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_3owl_6libowl_NArray->tp_dict, __pyx_n_s_concat, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_3owl_6libowl_NArray); - - /* "owl/libowl.pyx":418 - * - * @staticmethod - * def slice(NArray n, int slice_dim, int st_off, int slice_count): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray( - * m.Slice(deref(n._d), slice_dim, st_off, slice_count)) - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3owl_6libowl_6NArray_87slice, NULL, __pyx_n_s_owl_libowl); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "owl/libowl.pyx":417 - * return _wrap_cpp_narray(m.Concat(v, dim)) - * - * @staticmethod # <<<<<<<<<<<<<< - * def slice(NArray n, int slice_dim, int st_off, int slice_count): - * return _wrap_cpp_narray( - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __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 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_3owl_6libowl_NArray->tp_dict, __pyx_n_s_slice, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_3owl_6libowl_NArray); - - /* "owl/libowl.pyx":418 - * - * @staticmethod - * def slice(NArray n, int slice_dim, int st_off, int slice_count): # <<<<<<<<<<<<<< - * return _wrap_cpp_narray( - * m.Slice(deref(n._d), slice_dim, st_off, slice_count)) - */ - __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_3owl_6libowl_NArray, __pyx_n_s_slice); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "owl/libowl.pyx":417 - * return _wrap_cpp_narray(m.Concat(v, dim)) - * - * @staticmethod # <<<<<<<<<<<<<< - * def slice(NArray n, int slice_dim, int st_off, int slice_count): - * return _wrap_cpp_narray( - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __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 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_3owl_6libowl_NArray->tp_dict, __pyx_n_s_slice, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_3owl_6libowl_NArray); - - /* "owl/libowl.pyx":425 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * def from_numpy(np.ndarray n): # <<<<<<<<<<<<<< - * s = list(np.shape(n)) - * n = n.astype(np.float32) - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3owl_6libowl_6NArray_89from_numpy, NULL, __pyx_n_s_owl_libowl); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "owl/libowl.pyx":422 - * m.Slice(deref(n._d), slice_dim, st_off, slice_count)) - * - * @staticmethod # <<<<<<<<<<<<<< - * @cython.boundscheck(False) - * @cython.wraparound(False) - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __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 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_3owl_6libowl_NArray->tp_dict, __pyx_n_s_from_numpy_2, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_3owl_6libowl_NArray); - - /* "owl/libowl.pyx":425 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * def from_numpy(np.ndarray n): # <<<<<<<<<<<<<< - * s = list(np.shape(n)) - * n = n.astype(np.float32) - */ - __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_3owl_6libowl_NArray, __pyx_n_s_from_numpy_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "owl/libowl.pyx":422 - * m.Slice(deref(n._d), slice_dim, st_off, slice_count)) - * - * @staticmethod # <<<<<<<<<<<<<< - * @cython.boundscheck(False) - * @cython.wraparound(False) - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __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 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_3owl_6libowl_NArray->tp_dict, __pyx_n_s_from_numpy_2, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_3owl_6libowl_NArray); - - /* "owl/libowl.pyx":433 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * def _from_numpy(np.ndarray[np.float32_t, ndim=1, mode='c'] n, list s): # <<<<<<<<<<<<<< - * cdef vector[int] shape = _list_to_vector(reversed(s)) - * return _wrap_cpp_narray(m.FromNumpy(&n[0], m.ToScale(&shape))) - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3owl_6libowl_6NArray_91_from_numpy, NULL, __pyx_n_s_owl_libowl); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "owl/libowl.pyx":430 - * return NArray._from_numpy(n.flatten(), s) - * - * @staticmethod # <<<<<<<<<<<<<< - * @cython.boundscheck(False) - * @cython.wraparound(False) - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __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 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_3owl_6libowl_NArray->tp_dict, __pyx_n_s_from_numpy, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_3owl_6libowl_NArray); - - /* "owl/libowl.pyx":433 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * def _from_numpy(np.ndarray[np.float32_t, ndim=1, mode='c'] n, list s): # <<<<<<<<<<<<<< - * cdef vector[int] shape = _list_to_vector(reversed(s)) - * return _wrap_cpp_narray(m.FromNumpy(&n[0], m.ToScale(&shape))) - */ - __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_3owl_6libowl_NArray, __pyx_n_s_from_numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "owl/libowl.pyx":430 - * return NArray._from_numpy(n.flatten(), s) - * - * @staticmethod # <<<<<<<<<<<<<< - * @cython.boundscheck(False) - * @cython.wraparound(False) - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __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 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_3owl_6libowl_NArray->tp_dict, __pyx_n_s_from_numpy, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_3owl_6libowl_NArray); - - /* "owl/libowl.pyx":455 - * return self._d == rhs._d - * - * class _PoolingAlgorithms(object): # <<<<<<<<<<<<<< - * def __init__(self): - * self._max = PoolingAlgorithmWrapper( - */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_builtin_object); - __Pyx_GIVEREF(__pyx_builtin_object); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_builtin_object); - __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_PoolingAlgorithms, __pyx_n_s_PoolingAlgorithms, (PyObject *) NULL, __pyx_n_s_owl_libowl, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - - /* "owl/libowl.pyx":456 - * - * class _PoolingAlgorithms(object): - * def __init__(self): # <<<<<<<<<<<<<< - * self._max = PoolingAlgorithmWrapper( - * m.OfPoolingAlgorithm(m.kPoolingAlgorithmMax)) - */ - __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_3owl_6libowl_18_PoolingAlgorithms_1__init__, 0, __pyx_n_s_PoolingAlgorithms___init, NULL, __pyx_n_s_owl_libowl, __pyx_d, ((PyObject *)__pyx_codeobj__80)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_init, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "owl/libowl.pyx":462 - * m.OfPoolingAlgorithm(m.kPoolingAlgorithmAverage)) - * - * def find(self, a): # <<<<<<<<<<<<<< - * if self._max.is_same(a): - * return self._max - */ - __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_3owl_6libowl_18_PoolingAlgorithms_3find, 0, __pyx_n_s_PoolingAlgorithms_find, NULL, __pyx_n_s_owl_libowl, __pyx_d, ((PyObject *)__pyx_codeobj__82)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_find, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "owl/libowl.pyx":471 - * - * @property - * def max(self): # <<<<<<<<<<<<<< - * return self._max - * - */ - __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_3owl_6libowl_18_PoolingAlgorithms_5max, 0, __pyx_n_s_PoolingAlgorithms_max, NULL, __pyx_n_s_owl_libowl, __pyx_d, ((PyObject *)__pyx_codeobj__84)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - - /* "owl/libowl.pyx":470 - * raise TypeError('invalid pooling algorithm') - * - * @property # <<<<<<<<<<<<<< - * def max(self): - * return self._max - */ - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_property, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_max_2, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "owl/libowl.pyx":475 - * - * @property - * def average(self): # <<<<<<<<<<<<<< - * return self._average - * - */ - __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_3owl_6libowl_18_PoolingAlgorithms_7average, 0, __pyx_n_s_PoolingAlgorithms_average, NULL, __pyx_n_s_owl_libowl, __pyx_d, ((PyObject *)__pyx_codeobj__86)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - - /* "owl/libowl.pyx":474 - * return self._max - * - * @property # <<<<<<<<<<<<<< - * def average(self): - * return self._average - */ - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_property, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_average_2, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "owl/libowl.pyx":455 - * return self._d == rhs._d - * - * class _PoolingAlgorithms(object): # <<<<<<<<<<<<<< - * def __init__(self): - * self._max = PoolingAlgorithmWrapper( - */ - __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_PoolingAlgorithms, __pyx_t_1, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_PoolingAlgorithms, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __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; - - /* "owl/libowl.pyx":478 - * return self._average - * - * pooling_algo = _PoolingAlgorithms() # <<<<<<<<<<<<<< - * - * cdef class SoftmaxAlgorithmWrapper(object): - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_PoolingAlgorithms); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_pooling_algo, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "owl/libowl.pyx":489 - * return self._d == rhs._d - * - * class _SoftmaxAlgorithms(object): # <<<<<<<<<<<<<< - * def __init__(self): - * self._instance = SoftmaxAlgorithmWrapper( - */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_builtin_object); - __Pyx_GIVEREF(__pyx_builtin_object); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_builtin_object); - __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_SoftmaxAlgorithms, __pyx_n_s_SoftmaxAlgorithms, (PyObject *) NULL, __pyx_n_s_owl_libowl, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - - /* "owl/libowl.pyx":490 - * - * class _SoftmaxAlgorithms(object): - * def __init__(self): # <<<<<<<<<<<<<< - * self._instance = SoftmaxAlgorithmWrapper( - * m.OfSoftmaxAlgorithm(m.kSoftmaxAlgorithmInstance)) - */ - __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_3owl_6libowl_18_SoftmaxAlgorithms_1__init__, 0, __pyx_n_s_SoftmaxAlgorithms___init, NULL, __pyx_n_s_owl_libowl, __pyx_d, ((PyObject *)__pyx_codeobj__88)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_init, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "owl/libowl.pyx":496 - * m.OfSoftmaxAlgorithm(m.kSoftmaxAlgorithmChannel)) - * - * def find(self, a): # <<<<<<<<<<<<<< - * if self._instance.is_same(a): - * return self._instance - */ - __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_3owl_6libowl_18_SoftmaxAlgorithms_3find, 0, __pyx_n_s_SoftmaxAlgorithms_find, NULL, __pyx_n_s_owl_libowl, __pyx_d, ((PyObject *)__pyx_codeobj__90)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_find, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "owl/libowl.pyx":505 - * - * @property - * def instance(self): # <<<<<<<<<<<<<< - * return self._instance - * - */ - __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_3owl_6libowl_18_SoftmaxAlgorithms_5instance, 0, __pyx_n_s_SoftmaxAlgorithms_instance, NULL, __pyx_n_s_owl_libowl, __pyx_d, ((PyObject *)__pyx_codeobj__92)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - - /* "owl/libowl.pyx":504 - * raise TypeError('invalid softmax algorithm') - * - * @property # <<<<<<<<<<<<<< - * def instance(self): - * return self._instance - */ - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_property, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_instance_2, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "owl/libowl.pyx":509 - * - * @property - * def channel(self): # <<<<<<<<<<<<<< - * return self._channel - * - */ - __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_3owl_6libowl_18_SoftmaxAlgorithms_7channel, 0, __pyx_n_s_SoftmaxAlgorithms_channel, NULL, __pyx_n_s_owl_libowl, __pyx_d, ((PyObject *)__pyx_codeobj__94)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - - /* "owl/libowl.pyx":508 - * return self._instance - * - * @property # <<<<<<<<<<<<<< - * def channel(self): - * return self._channel - */ - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_property, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_channel_2, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "owl/libowl.pyx":489 - * return self._d == rhs._d - * - * class _SoftmaxAlgorithms(object): # <<<<<<<<<<<<<< - * def __init__(self): - * self._instance = SoftmaxAlgorithmWrapper( - */ - __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_SoftmaxAlgorithms, __pyx_t_1, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_SoftmaxAlgorithms, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __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; - - /* "owl/libowl.pyx":512 - * return self._channel - * - * softmax_algo = _SoftmaxAlgorithms() # <<<<<<<<<<<<<< - * - * cdef class ActivationAlgorithmWrapper(object): - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_SoftmaxAlgorithms); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_softmax_algo, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "owl/libowl.pyx":523 - * return self._d == rhs._d - * - * class _ActivationAlgorithms(object): # <<<<<<<<<<<<<< - * def __init__(self): - * self._sigmoid = ActivationAlgorithmWrapper( - */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_builtin_object); - __Pyx_GIVEREF(__pyx_builtin_object); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_builtin_object); - __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_ActivationAlgorithms, __pyx_n_s_ActivationAlgorithms, (PyObject *) NULL, __pyx_n_s_owl_libowl, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - - /* "owl/libowl.pyx":524 - * - * class _ActivationAlgorithms(object): - * def __init__(self): # <<<<<<<<<<<<<< - * self._sigmoid = ActivationAlgorithmWrapper( - * m.OfActivationAlgorithm(m.kActivationAlgorithmSigmoid)) - */ - __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_3owl_6libowl_21_ActivationAlgorithms_1__init__, 0, __pyx_n_s_ActivationAlgorithms___init, NULL, __pyx_n_s_owl_libowl, __pyx_d, ((PyObject *)__pyx_codeobj__96)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_init, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "owl/libowl.pyx":532 - * m.OfActivationAlgorithm(m.kActivationAlgorithmTanh)) - * - * def find(self, a): # <<<<<<<<<<<<<< - * if self._sigmoid.is_same(a): - * return self._sigmoid - */ - __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_3owl_6libowl_21_ActivationAlgorithms_3find, 0, __pyx_n_s_ActivationAlgorithms_find, NULL, __pyx_n_s_owl_libowl, __pyx_d, ((PyObject *)__pyx_codeobj__98)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_find, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "owl/libowl.pyx":543 - * - * @property - * def sigmoid(self): # <<<<<<<<<<<<<< - * return self._sigmoid - * - */ - __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_3owl_6libowl_21_ActivationAlgorithms_5sigmoid, 0, __pyx_n_s_ActivationAlgorithms_sigmoid, NULL, __pyx_n_s_owl_libowl, __pyx_d, ((PyObject *)__pyx_codeobj__100)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - - /* "owl/libowl.pyx":542 - * raise TypeError('invalid activation algorithm') - * - * @property # <<<<<<<<<<<<<< - * def sigmoid(self): - * return self._sigmoid - */ - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_property, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_sigmoid_2, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "owl/libowl.pyx":547 - * - * @property - * def relu(self): # <<<<<<<<<<<<<< - * return self._relu - * - */ - __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_3owl_6libowl_21_ActivationAlgorithms_7relu, 0, __pyx_n_s_ActivationAlgorithms_relu, NULL, __pyx_n_s_owl_libowl, __pyx_d, ((PyObject *)__pyx_codeobj__102)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - - /* "owl/libowl.pyx":546 - * return self._sigmoid - * - * @property # <<<<<<<<<<<<<< - * def relu(self): - * return self._relu - */ - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_property, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_relu_2, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "owl/libowl.pyx":551 - * - * @property - * def tanh(self): # <<<<<<<<<<<<<< - * return self._tanh - * - */ - __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_3owl_6libowl_21_ActivationAlgorithms_9tanh, 0, __pyx_n_s_ActivationAlgorithms_tanh, NULL, __pyx_n_s_owl_libowl, __pyx_d, ((PyObject *)__pyx_codeobj__104)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - - /* "owl/libowl.pyx":550 - * return self._relu - * - * @property # <<<<<<<<<<<<<< - * def tanh(self): - * return self._tanh - */ - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_property, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_tanh_2, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "owl/libowl.pyx":523 - * return self._d == rhs._d - * - * class _ActivationAlgorithms(object): # <<<<<<<<<<<<<< - * def __init__(self): - * self._sigmoid = ActivationAlgorithmWrapper( - */ - __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_ActivationAlgorithms, __pyx_t_1, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_ActivationAlgorithms, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __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; - - /* "owl/libowl.pyx":554 - * return self._tanh - * - * activation_algo = _ActivationAlgorithms() # <<<<<<<<<<<<<< - * - * cdef class ConvInfo(object): - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_ActivationAlgorithms); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_activation_algo, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "owl/libowl.pyx":603 - * def __cinit__( - * self - * , PoolingAlgorithmWrapper a=pooling_algo.max # <<<<<<<<<<<<<< - * , int h=0 - * , int w=0 - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_pooling_algo); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_max_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_3owl_6libowl_PoolingAlgorithmWrapper))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_k__4 = ((struct __pyx_obj_3owl_6libowl_PoolingAlgorithmWrapper *)__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - - /* "owl/libowl.pyx":1 - * import sys # <<<<<<<<<<<<<< - * from cython.operator cimport dereference as deref - * import cython - */ - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "vector.to_py":67 - * - * @cname("__pyx_convert_vector_to_py_int") - * cdef object __pyx_convert_vector_to_py_int(vector[X]& v): # <<<<<<<<<<<<<< - * return [X_to_py(v[i]) for i in range(v.size())] - * - */ - - /*--- Wrapped vars code ---*/ - - 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); - if (__pyx_m) { - if (__pyx_d) { - __Pyx_AddTraceback("init owl.libowl", __pyx_clineno, __pyx_lineno, __pyx_filename); - } - Py_DECREF(__pyx_m); __pyx_m = 0; - } else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_ImportError, "init owl.libowl"); - } - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - #if PY_MAJOR_VERSION < 3 - return; - #else - return __pyx_m; - #endif -} - -/* --- Runtime support code --- */ -#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 - -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; -} - -static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { -#if CYTHON_COMPILING_IN_CPYTHON - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyThreadState *tstate = PyThreadState_GET(); - 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); -#else - PyErr_Restore(type, value, tb); -#endif -} -static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { -#if CYTHON_COMPILING_IN_CPYTHON - PyThreadState *tstate = PyThreadState_GET(); - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; -#else - PyErr_Fetch(type, value, tb); -#endif -} - -static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno, - CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename, - int full_traceback, CYTHON_UNUSED int nogil) { - PyObject *old_exc, *old_val, *old_tb; - PyObject *ctx; -#ifdef WITH_THREAD - PyGILState_STATE state; - if (nogil) - state = PyGILState_Ensure(); -#endif - __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); - if (full_traceback) { - Py_XINCREF(old_exc); - Py_XINCREF(old_val); - Py_XINCREF(old_tb); - __Pyx_ErrRestore(old_exc, old_val, old_tb); - PyErr_PrintEx(1); - } - #if PY_MAJOR_VERSION < 3 - ctx = PyString_FromString(name); - #else - ctx = PyUnicode_FromString(name); - #endif - __Pyx_ErrRestore(old_exc, old_val, old_tb); - if (!ctx) { - PyErr_WriteUnraisable(Py_None); - } else { - PyErr_WriteUnraisable(ctx); - Py_DECREF(ctx); - } -#ifdef WITH_THREAD - if (nogil) - PyGILState_Release(state); -#endif -} - -#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 - -static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) { - PyObject *result; -#if CYTHON_COMPILING_IN_CPYTHON - result = PyDict_GetItem(__pyx_d, name); - if (likely(result)) { - Py_INCREF(result); - } else { -#else - result = PyObject_GetItem(__pyx_d, name); - if (!result) { - PyErr_Clear(); -#endif - result = __Pyx_GetBuiltinName(name); - } - return result; -} - -static CYTHON_INLINE 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_COMPILING_IN_CPYTHON - if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o); - if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { - PyObject *r = PyList_GET_ITEM(o, 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_COMPILING_IN_CPYTHON - if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o); - if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { - PyObject *r = PyTuple_GET_ITEM(o, 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_COMPILING_IN_CPYTHON - 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)) - PyErr_Clear(); - else - return NULL; - } - } - 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)); -} - -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); -} - -static CYTHON_INLINE int __Pyx_CheckKeywordStrings( - PyObject *kwdict, - const char* function_name, - int kw_allowed) -{ - PyObject* key = 0; - Py_ssize_t pos = 0; -#if CYTHON_COMPILING_IN_PYPY - if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0)) - goto invalid_keyword; - return 1; -#else - while (PyDict_Next(kwdict, &pos, &key, 0)) { - #if PY_MAJOR_VERSION < 3 - if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) - #endif - if (unlikely(!PyUnicode_Check(key))) - goto invalid_keyword_type; - } - if ((!kw_allowed) && unlikely(key)) - goto invalid_keyword; - return 1; -invalid_keyword_type: - PyErr_Format(PyExc_TypeError, - "%.200s() keywords must be strings", function_name); - return 0; -#endif -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 - return 0; -} - -static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { - if (unlikely(!type)) { - PyErr_SetString(PyExc_SystemError, "Missing type object"); - return 0; - } - if (likely(PyObject_TypeCheck(obj, type))) - return 1; - PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", - Py_TYPE(obj)->tp_name, type->tp_name); - return 0; -} - -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 -} - -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; -} - -static void __Pyx_RaiseArgumentTypeInvalid(const char* name, PyObject *obj, PyTypeObject *type) { - PyErr_Format(PyExc_TypeError, - "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)", - name, type->tp_name, Py_TYPE(obj)->tp_name); -} -static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, - const char *name, int exact) -{ - if (unlikely(!type)) { - PyErr_SetString(PyExc_SystemError, "Missing type object"); - return 0; - } - if (none_allowed && obj == Py_None) return 1; - else if (exact) { - if (likely(Py_TYPE(obj) == type)) return 1; - #if PY_MAJOR_VERSION == 2 - else if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; - #endif - } - else { - if (likely(PyObject_TypeCheck(obj, type))) return 1; - } - __Pyx_RaiseArgumentTypeInvalid(name, obj, type); - return 0; -} - -#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 - -#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) { -#ifdef __Pyx_CyFunction_USED - if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) { -#else - if (likely(PyCFunction_Check(func))) { -#endif - if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { - return __Pyx_PyObject_CallMethO(func, arg); - } - } - return __Pyx__PyObject_CallOneArg(func, arg); -} -#else -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject* args = PyTuple_Pack(1, arg); - return (likely(args)) ? __Pyx_PyObject_Call(func, args, NULL) : NULL; -} -#endif - -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { -#ifdef __Pyx_CyFunction_USED - if (likely(PyCFunction_Check(func) || PyObject_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 - -static CYTHON_INLINE int __Pyx_IsLittleEndian(void) { - unsigned int n = 1; - return *(unsigned char*)(&n) != 0; -} -static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, - __Pyx_BufFmt_StackElem* stack, - __Pyx_TypeInfo* type) { - stack[0].field = &ctx->root; - stack[0].parent_offset = 0; - ctx->root.type = type; - ctx->root.name = "buffer dtype"; - ctx->root.offset = 0; - ctx->head = stack; - ctx->head->field = &ctx->root; - ctx->fmt_offset = 0; - ctx->head->parent_offset = 0; - ctx->new_packmode = '@'; - ctx->enc_packmode = '@'; - ctx->new_count = 1; - ctx->enc_count = 0; - ctx->enc_type = 0; - ctx->is_complex = 0; - ctx->is_valid_array = 0; - ctx->struct_alignment = 0; - while (type->typegroup == 'S') { - ++ctx->head; - ctx->head->field = type->fields; - ctx->head->parent_offset = 0; - type = type->fields->type; - } -} -static int __Pyx_BufFmt_ParseNumber(const char** ts) { - int count; - const char* t = *ts; - if (*t < '0' || *t > '9') { - return -1; - } else { - count = *t++ - '0'; - while (*t >= '0' && *t < '9') { - count *= 10; - count += *t++ - '0'; - } - } - *ts = t; - return count; -} -static int __Pyx_BufFmt_ExpectNumber(const char **ts) { - int number = __Pyx_BufFmt_ParseNumber(ts); - if (number == -1) - PyErr_Format(PyExc_ValueError,\ - "Does not understand character buffer dtype format string ('%c')", **ts); - return number; -} -static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) { - PyErr_Format(PyExc_ValueError, - "Unexpected format string character: '%c'", ch); -} -static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { - switch (ch) { - case 'c': return "'char'"; - case 'b': return "'signed char'"; - case 'B': return "'unsigned char'"; - case 'h': return "'short'"; - case 'H': return "'unsigned short'"; - case 'i': return "'int'"; - case 'I': return "'unsigned int'"; - case 'l': return "'long'"; - case 'L': return "'unsigned long'"; - case 'q': return "'long long'"; - case 'Q': return "'unsigned long long'"; - case 'f': return (is_complex ? "'complex float'" : "'float'"); - case 'd': return (is_complex ? "'complex double'" : "'double'"); - case 'g': return (is_complex ? "'complex long double'" : "'long double'"); - case 'T': return "a struct"; - case 'O': return "Python object"; - case 'P': return "a pointer"; - case 's': case 'p': return "a string"; - case 0: return "end"; - default: return "unparseable format string"; - } -} -static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { - switch (ch) { - case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; - case 'h': case 'H': return 2; - case 'i': case 'I': case 'l': case 'L': return 4; - case 'q': case 'Q': return 8; - case 'f': return (is_complex ? 8 : 4); - case 'd': return (is_complex ? 16 : 8); - case 'g': { - PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g').."); - return 0; - } - case 'O': case 'P': return sizeof(void*); - default: - __Pyx_BufFmt_RaiseUnexpectedChar(ch); - return 0; - } -} -static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) { - switch (ch) { - case 'c': case 'b': case 'B': case 's': case 'p': return 1; - case 'h': case 'H': return sizeof(short); - case 'i': case 'I': return sizeof(int); - case 'l': case 'L': return sizeof(long); - #ifdef HAVE_LONG_LONG - case 'q': case 'Q': return sizeof(PY_LONG_LONG); - #endif - case 'f': return sizeof(float) * (is_complex ? 2 : 1); - case 'd': return sizeof(double) * (is_complex ? 2 : 1); - case 'g': return sizeof(long double) * (is_complex ? 2 : 1); - case 'O': case 'P': return sizeof(void*); - default: { - __Pyx_BufFmt_RaiseUnexpectedChar(ch); - return 0; - } - } -} -typedef struct { char c; short x; } __Pyx_st_short; -typedef struct { char c; int x; } __Pyx_st_int; -typedef struct { char c; long x; } __Pyx_st_long; -typedef struct { char c; float x; } __Pyx_st_float; -typedef struct { char c; double x; } __Pyx_st_double; -typedef struct { char c; long double x; } __Pyx_st_longdouble; -typedef struct { char c; void *x; } __Pyx_st_void_p; -#ifdef HAVE_LONG_LONG -typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong; -#endif -static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) { - switch (ch) { - case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; - case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short); - case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int); - case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long); -#ifdef HAVE_LONG_LONG - case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG); -#endif - case 'f': return sizeof(__Pyx_st_float) - sizeof(float); - case 'd': return sizeof(__Pyx_st_double) - sizeof(double); - case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double); - case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*); - default: - __Pyx_BufFmt_RaiseUnexpectedChar(ch); - return 0; - } -} -/* These are for computing the padding at the end of the struct to align - on the first member of the struct. This will probably the same as above, - but we don't have any guarantees. - */ -typedef struct { short x; char c; } __Pyx_pad_short; -typedef struct { int x; char c; } __Pyx_pad_int; -typedef struct { long x; char c; } __Pyx_pad_long; -typedef struct { float x; char c; } __Pyx_pad_float; -typedef struct { double x; char c; } __Pyx_pad_double; -typedef struct { long double x; char c; } __Pyx_pad_longdouble; -typedef struct { void *x; char c; } __Pyx_pad_void_p; -#ifdef HAVE_LONG_LONG -typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong; -#endif -static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) { - switch (ch) { - case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; - case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short); - case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int); - case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long); -#ifdef HAVE_LONG_LONG - case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG); -#endif - case 'f': return sizeof(__Pyx_pad_float) - sizeof(float); - case 'd': return sizeof(__Pyx_pad_double) - sizeof(double); - case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double); - case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*); - default: - __Pyx_BufFmt_RaiseUnexpectedChar(ch); - return 0; - } -} -static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) { - switch (ch) { - case 'c': - return 'H'; - case 'b': case 'h': case 'i': - case 'l': case 'q': case 's': case 'p': - return 'I'; - case 'B': case 'H': case 'I': case 'L': case 'Q': - return 'U'; - case 'f': case 'd': case 'g': - return (is_complex ? 'C' : 'R'); - case 'O': - return 'O'; - case 'P': - return 'P'; - default: { - __Pyx_BufFmt_RaiseUnexpectedChar(ch); - return 0; - } - } -} -static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) { - if (ctx->head == NULL || ctx->head->field == &ctx->root) { - const char* expected; - const char* quote; - if (ctx->head == NULL) { - expected = "end"; - quote = ""; - } else { - expected = ctx->head->field->type->name; - quote = "'"; - } - PyErr_Format(PyExc_ValueError, - "Buffer dtype mismatch, expected %s%s%s but got %s", - quote, expected, quote, - __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex)); - } else { - __Pyx_StructField* field = ctx->head->field; - __Pyx_StructField* parent = (ctx->head - 1)->field; - PyErr_Format(PyExc_ValueError, - "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'", - field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex), - parent->type->name, field->name); - } -} -static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { - char group; - size_t size, offset, arraysize = 1; - if (ctx->enc_type == 0) return 0; - if (ctx->head->field->type->arraysize[0]) { - int i, ndim = 0; - if (ctx->enc_type == 's' || ctx->enc_type == 'p') { - ctx->is_valid_array = ctx->head->field->type->ndim == 1; - ndim = 1; - if (ctx->enc_count != ctx->head->field->type->arraysize[0]) { - PyErr_Format(PyExc_ValueError, - "Expected a dimension of size %zu, got %zu", - ctx->head->field->type->arraysize[0], ctx->enc_count); - return -1; - } - } - if (!ctx->is_valid_array) { - PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d", - ctx->head->field->type->ndim, ndim); - return -1; - } - for (i = 0; i < ctx->head->field->type->ndim; i++) { - arraysize *= ctx->head->field->type->arraysize[i]; - } - ctx->is_valid_array = 0; - ctx->enc_count = 1; - } - group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex); - do { - __Pyx_StructField* field = ctx->head->field; - __Pyx_TypeInfo* type = field->type; - if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') { - size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex); - } else { - size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex); - } - if (ctx->enc_packmode == '@') { - size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex); - size_t align_mod_offset; - if (align_at == 0) return -1; - align_mod_offset = ctx->fmt_offset % align_at; - if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset; - if (ctx->struct_alignment == 0) - ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type, - ctx->is_complex); - } - if (type->size != size || type->typegroup != group) { - if (type->typegroup == 'C' && type->fields != NULL) { - size_t parent_offset = ctx->head->parent_offset + field->offset; - ++ctx->head; - ctx->head->field = type->fields; - ctx->head->parent_offset = parent_offset; - continue; - } - if ((type->typegroup == 'H' || group == 'H') && type->size == size) { - } else { - __Pyx_BufFmt_RaiseExpected(ctx); - return -1; - } - } - offset = ctx->head->parent_offset + field->offset; - if (ctx->fmt_offset != offset) { - PyErr_Format(PyExc_ValueError, - "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected", - (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset); - return -1; - } - ctx->fmt_offset += size; - if (arraysize) - ctx->fmt_offset += (arraysize - 1) * size; - --ctx->enc_count; - while (1) { - if (field == &ctx->root) { - ctx->head = NULL; - if (ctx->enc_count != 0) { - __Pyx_BufFmt_RaiseExpected(ctx); - return -1; - } - break; - } - ctx->head->field = ++field; - if (field->type == NULL) { - --ctx->head; - field = ctx->head->field; - continue; - } else if (field->type->typegroup == 'S') { - size_t parent_offset = ctx->head->parent_offset + field->offset; - if (field->type->fields->type == NULL) continue; - field = field->type->fields; - ++ctx->head; - ctx->head->field = field; - ctx->head->parent_offset = parent_offset; - break; - } else { - break; - } - } - } while (ctx->enc_count); - ctx->enc_type = 0; - ctx->is_complex = 0; - return 0; -} -static CYTHON_INLINE PyObject * -__pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp) -{ - const char *ts = *tsp; - int i = 0, number; - int ndim = ctx->head->field->type->ndim; -; - ++ts; - if (ctx->new_count != 1) { - PyErr_SetString(PyExc_ValueError, - "Cannot handle repeated arrays in format string"); - return NULL; - } - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - while (*ts && *ts != ')') { - switch (*ts) { - case ' ': case '\f': case '\r': case '\n': case '\t': case '\v': continue; - default: break; - } - number = __Pyx_BufFmt_ExpectNumber(&ts); - if (number == -1) return NULL; - if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i]) - return PyErr_Format(PyExc_ValueError, - "Expected a dimension of size %zu, got %d", - ctx->head->field->type->arraysize[i], number); - if (*ts != ',' && *ts != ')') - return PyErr_Format(PyExc_ValueError, - "Expected a comma in format string, got '%c'", *ts); - if (*ts == ',') ts++; - i++; - } - if (i != ndim) - return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d", - ctx->head->field->type->ndim, i); - if (!*ts) { - PyErr_SetString(PyExc_ValueError, - "Unexpected end of format string, expected ')'"); - return NULL; - } - ctx->is_valid_array = 1; - ctx->new_count = 1; - *tsp = ++ts; - return Py_None; -} -static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) { - int got_Z = 0; - while (1) { - switch(*ts) { - case 0: - if (ctx->enc_type != 0 && ctx->head == NULL) { - __Pyx_BufFmt_RaiseExpected(ctx); - return NULL; - } - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - if (ctx->head != NULL) { - __Pyx_BufFmt_RaiseExpected(ctx); - return NULL; - } - return ts; - case ' ': - case '\r': - case '\n': - ++ts; - break; - case '<': - if (!__Pyx_IsLittleEndian()) { - PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler"); - return NULL; - } - ctx->new_packmode = '='; - ++ts; - break; - case '>': - case '!': - if (__Pyx_IsLittleEndian()) { - PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler"); - return NULL; - } - ctx->new_packmode = '='; - ++ts; - break; - case '=': - case '@': - case '^': - ctx->new_packmode = *ts++; - break; - case 'T': - { - const char* ts_after_sub; - size_t i, struct_count = ctx->new_count; - size_t struct_alignment = ctx->struct_alignment; - ctx->new_count = 1; - ++ts; - if (*ts != '{') { - PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'"); - return NULL; - } - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - ctx->enc_type = 0; - ctx->enc_count = 0; - ctx->struct_alignment = 0; - ++ts; - ts_after_sub = ts; - for (i = 0; i != struct_count; ++i) { - ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts); - if (!ts_after_sub) return NULL; - } - ts = ts_after_sub; - if (struct_alignment) ctx->struct_alignment = struct_alignment; - } - break; - case '}': - { - size_t alignment = ctx->struct_alignment; - ++ts; - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - ctx->enc_type = 0; - if (alignment && ctx->fmt_offset % alignment) { - ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment); - } - } - return ts; - case 'x': - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - ctx->fmt_offset += ctx->new_count; - ctx->new_count = 1; - ctx->enc_count = 0; - ctx->enc_type = 0; - ctx->enc_packmode = ctx->new_packmode; - ++ts; - break; - case 'Z': - got_Z = 1; - ++ts; - if (*ts != 'f' && *ts != 'd' && *ts != 'g') { - __Pyx_BufFmt_RaiseUnexpectedChar('Z'); - return NULL; - } - case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I': - case 'l': case 'L': case 'q': case 'Q': - case 'f': case 'd': case 'g': - case 'O': case 'p': - if (ctx->enc_type == *ts && got_Z == ctx->is_complex && - ctx->enc_packmode == ctx->new_packmode) { - ctx->enc_count += ctx->new_count; - ctx->new_count = 1; - got_Z = 0; - ++ts; - break; - } - case 's': - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - ctx->enc_count = ctx->new_count; - ctx->enc_packmode = ctx->new_packmode; - ctx->enc_type = *ts; - ctx->is_complex = got_Z; - ++ts; - ctx->new_count = 1; - got_Z = 0; - break; - case ':': - ++ts; - while(*ts != ':') ++ts; - ++ts; - break; - case '(': - if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL; - break; - default: - { - int number = __Pyx_BufFmt_ExpectNumber(&ts); - if (number == -1) return NULL; - ctx->new_count = (size_t)number; - } - } - } -} -static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) { - buf->buf = NULL; - buf->obj = NULL; - buf->strides = __Pyx_zeros; - buf->shape = __Pyx_zeros; - buf->suboffsets = __Pyx_minusones; -} -static CYTHON_INLINE int __Pyx_GetBufferAndValidate( - Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, - int nd, int cast, __Pyx_BufFmt_StackElem* stack) -{ - if (obj == Py_None || obj == NULL) { - __Pyx_ZeroBuffer(buf); - return 0; - } - buf->buf = NULL; - if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail; - if (buf->ndim != nd) { - PyErr_Format(PyExc_ValueError, - "Buffer has wrong number of dimensions (expected %d, got %d)", - nd, buf->ndim); - goto fail; - } - if (!cast) { - __Pyx_BufFmt_Context ctx; - __Pyx_BufFmt_Init(&ctx, stack, dtype); - if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail; - } - if ((unsigned)buf->itemsize != dtype->size) { - PyErr_Format(PyExc_ValueError, - "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)", - buf->itemsize, (buf->itemsize > 1) ? "s" : "", - dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : ""); - goto fail; - } - if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones; - return 0; -fail:; - __Pyx_ZeroBuffer(buf); - return -1; -} -static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { - if (info->buf == NULL) return; - if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL; - __Pyx_ReleaseBuffer(info); -} - -static void __Pyx_RaiseBufferFallbackError(void) { - PyErr_SetString(PyExc_ValueError, - "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!"); -} - -static void __Pyx_RaiseBufferIndexError(int axis) { - PyErr_Format(PyExc_IndexError, - "Out of bounds on buffer access (axis %d)", axis); -} - -#if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, - CYTHON_UNUSED PyObject *cause) { - 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_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 PY_VERSION_HEX >= 0x03030000 - if (cause) { -#else - if (cause && cause != Py_None) { -#endif - 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 = PyThreadState_GET(); - 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 - -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { - PyErr_Format(PyExc_ValueError, - "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); -} - -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { - PyErr_Format(PyExc_ValueError, - "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", - index, (index == 1) ? "" : "s"); -} - -static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); -} - -static PyObject *__Pyx_GetNameInClass(PyObject *nmspace, PyObject *name) { - PyObject *result; - result = __Pyx_PyObject_GetAttrStr(nmspace, name); - if (!result) - result = __Pyx_GetModuleGlobalName(name); - return result; -} - -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; -} - -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; -} - -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) { - PyObject *res = op->defaults_getter((PyObject *) op); - if (unlikely(!res)) - return -1; - 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); - Py_DECREF(res); - return 0; -} -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(__pyx_CyFunctionObject, func.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]); - PyMem_Free(m->defaults); - m->defaults = NULL; - } - return 0; -} -static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) -{ - PyObject_GC_UnTrack(m); - if (__Pyx_CyFunction_weakreflist(m) != NULL) - PyObject_ClearWeakRefs((PyObject *) m); - __Pyx_CyFunction_clear(m); - PyObject_GC_Del(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("", - op->func_qualname, (void *)op); -#else - return PyString_FromFormat("", - PyString_AsString(op->func_qualname), (void *)op); -#endif -} -#if CYTHON_COMPILING_IN_PYPY -static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { - PyCFunctionObject* f = (PyCFunctionObject*)func; - PyCFunction meth = PyCFunction_GET_FUNCTION(func); - PyObject *self = PyCFunction_GET_SELF(func); - Py_ssize_t size; - switch (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)) { - 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 (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 (size == 1) - return (*meth)(self, PyTuple_GET_ITEM(arg, 0)); - 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; -} -#else -static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { - return PyCFunction_Call(func, arg, kw); -} -#endif -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_Call, - 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) { -#if !CYTHON_COMPILING_IN_PYPY - __pyx_CyFunctionType_type.tp_call = PyCFunction_Call; -#endif - __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type); - if (__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 = PyMem_Malloc(size); - if (!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); -} - -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; -} - -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) / 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); -} - -#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; - 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( - PyThreadState_GET(), /*PyThreadState *tstate,*/ - py_code, /*PyCodeObject *code,*/ - __pyx_d, /*PyObject *globals,*/ - 0 /*PyObject *locals*/ - ); - if (!py_frame) goto bad; - py_frame->f_lineno = py_line; - PyTraceBack_Here(py_frame); -bad: - Py_XDECREF(py_code); - Py_XDECREF(py_frame); -} - -#if PY_MAJOR_VERSION < 3 -static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { - if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags); - if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags); - PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name); - return -1; -} -static void __Pyx_ReleaseBuffer(Py_buffer *view) { - PyObject *obj = view->obj; - if (!obj) return; - if (PyObject_CheckBuffer(obj)) { - PyBuffer_Release(view); - return; - } - if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) { __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view); return; } - Py_DECREF(obj); - view->obj = NULL; -} -#endif - - - 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_VERSION_HEX < 0x03030000 - 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, '.')) { - #if PY_VERSION_HEX < 0x03030000 - PyObject *py_level = PyInt_FromLong(1); - 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, 1); - #endif - if (!module) { - if (!PyErr_ExceptionMatches(PyExc_ImportError)) - goto bad; - PyErr_Clear(); - } - } - level = 0; - } - #endif - if (!module) { - #if PY_VERSION_HEX < 0x03030000 - 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_VERSION_HEX < 0x03030000 - Py_XDECREF(py_import); - #endif - Py_XDECREF(empty_list); - Py_XDECREF(empty_dict); - return module; -} - -#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value) \ - { \ - 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 (is_unsigned && unlikely(value < zero)) \ - goto raise_neg_overflow; \ - else \ - goto raise_overflow; \ - } \ - } \ - return (target_type) value; \ - } - -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 - #if CYTHON_USE_PYLONG_INTERNALS - #include "longintrepr.h" - #endif -#endif - -static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { - const int neg_one = (int) -1, const_zero = 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_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 - #if CYTHON_USE_PYLONG_INTERNALS - switch (Py_SIZE(x)) { - case 0: return 0; - case 1: __PYX_VERIFY_RETURN_INT(int, digit, ((PyLongObject*)x)->ob_digit[0]); - } - #endif -#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(int, unsigned long, PyLong_AsUnsignedLong(x)) - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) - } - } else { -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 - #if CYTHON_USE_PYLONG_INTERNALS - switch (Py_SIZE(x)) { - case 0: return 0; - case 1: __PYX_VERIFY_RETURN_INT(int, digit, +(((PyLongObject*)x)->ob_digit[0])); - case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]); - } - #endif -#endif - if (sizeof(int) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT(int, long, PyLong_AsLong(x)) - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT(int, PY_LONG_LONG, PyLong_AsLongLong(x)) - } - } - { -#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_Int(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_Int(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; -} - -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint64_t(uint64_t value) { - const uint64_t neg_one = (uint64_t) -1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(uint64_t) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(uint64_t) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); - } else if (sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); - } - } else { - if (sizeof(uint64_t) <= sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(uint64_t) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(uint64_t), - little, !is_unsigned); - } -} - -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { - const int neg_one = (int) -1, const_zero = 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); - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); - } - } else { - if (sizeof(int) <= sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(int), - little, !is_unsigned); - } -} - -static CYTHON_INLINE uint64_t __Pyx_PyInt_As_uint64_t(PyObject *x) { - const uint64_t neg_one = (uint64_t) -1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - if (sizeof(uint64_t) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(uint64_t, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (uint64_t) val; - } - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 - #if CYTHON_USE_PYLONG_INTERNALS - switch (Py_SIZE(x)) { - case 0: return 0; - case 1: __PYX_VERIFY_RETURN_INT(uint64_t, digit, ((PyLongObject*)x)->ob_digit[0]); - } - #endif -#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 (uint64_t) -1; - if (unlikely(result == 1)) - goto raise_neg_overflow; - } -#endif - if (sizeof(uint64_t) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, PyLong_AsUnsignedLong(x)) - } else if (sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT(uint64_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) - } - } else { -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 - #if CYTHON_USE_PYLONG_INTERNALS - switch (Py_SIZE(x)) { - case 0: return 0; - case 1: __PYX_VERIFY_RETURN_INT(uint64_t, digit, +(((PyLongObject*)x)->ob_digit[0])); - case -1: __PYX_VERIFY_RETURN_INT(uint64_t, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]); - } - #endif -#endif - if (sizeof(uint64_t) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT(uint64_t, long, PyLong_AsLong(x)) - } else if (sizeof(uint64_t) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT(uint64_t, PY_LONG_LONG, PyLong_AsLongLong(x)) - } - } - { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else - uint64_t val; - PyObject *v = __Pyx_PyNumber_Int(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 (uint64_t) -1; - } - } else { - uint64_t val; - PyObject *tmp = __Pyx_PyNumber_Int(x); - if (!tmp) return (uint64_t) -1; - val = __Pyx_PyInt_As_uint64_t(tmp); - Py_DECREF(tmp); - return val; - } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to uint64_t"); - return (uint64_t) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to uint64_t"); - return (uint64_t) -1; -} - -#if CYTHON_CCOMPLEX - #ifdef __cplusplus - static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { - return ::std::complex< float >(x, y); - } - #else - static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { - return x + y*(__pyx_t_float_complex)_Complex_I; - } - #endif -#else - static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { - __pyx_t_float_complex z; - z.real = x; - z.imag = y; - return z; - } -#endif - -#if CYTHON_CCOMPLEX -#else - static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) { - return (a.real == b.real) && (a.imag == b.imag); - } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) { - __pyx_t_float_complex z; - z.real = a.real + b.real; - z.imag = a.imag + b.imag; - return z; - } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) { - __pyx_t_float_complex z; - z.real = a.real - b.real; - z.imag = a.imag - b.imag; - return z; - } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) { - __pyx_t_float_complex z; - z.real = a.real * b.real - a.imag * b.imag; - z.imag = a.real * b.imag + a.imag * b.real; - return z; - } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) { - __pyx_t_float_complex z; - float denom = b.real * b.real + b.imag * b.imag; - z.real = (a.real * b.real + a.imag * b.imag) / denom; - z.imag = (a.imag * b.real - a.real * b.imag) / denom; - return z; - } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) { - __pyx_t_float_complex z; - z.real = -a.real; - z.imag = -a.imag; - return z; - } - static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) { - return (a.real == 0) && (a.imag == 0); - } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) { - __pyx_t_float_complex z; - z.real = a.real; - z.imag = -a.imag; - return z; - } - #if 1 - static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { - #if !defined(HAVE_HYPOT) || defined(_MSC_VER) - return sqrtf(z.real*z.real + z.imag*z.imag); - #else - return hypotf(z.real, z.imag); - #endif - } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex a, __pyx_t_float_complex b) { - __pyx_t_float_complex z; - float r, lnr, theta, z_r, z_theta; - if (b.imag == 0 && b.real == (int)b.real) { - if (b.real < 0) { - float denom = a.real * a.real + a.imag * a.imag; - a.real = a.real / denom; - a.imag = -a.imag / denom; - b.real = -b.real; - } - switch ((int)b.real) { - case 0: - z.real = 1; - z.imag = 0; - return z; - case 1: - return a; - case 2: - z = __Pyx_c_prodf(a, a); - return __Pyx_c_prodf(a, a); - case 3: - z = __Pyx_c_prodf(a, a); - return __Pyx_c_prodf(z, a); - case 4: - z = __Pyx_c_prodf(a, a); - return __Pyx_c_prodf(z, z); - } - } - if (a.imag == 0) { - if (a.real == 0) { - return a; - } - r = a.real; - theta = 0; - } else { - r = __Pyx_c_absf(a); - theta = atan2f(a.imag, a.real); - } - lnr = logf(r); - z_r = expf(lnr * b.real - theta * b.imag); - z_theta = theta * b.real + lnr * b.imag; - z.real = z_r * cosf(z_theta); - z.imag = z_r * sinf(z_theta); - return z; - } - #endif -#endif - -#if CYTHON_CCOMPLEX - #ifdef __cplusplus - static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { - return ::std::complex< double >(x, y); - } - #else - static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { - return x + y*(__pyx_t_double_complex)_Complex_I; - } - #endif -#else - static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { - __pyx_t_double_complex z; - z.real = x; - z.imag = y; - return z; - } -#endif - -#if CYTHON_CCOMPLEX -#else - static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) { - return (a.real == b.real) && (a.imag == b.imag); - } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) { - __pyx_t_double_complex z; - z.real = a.real + b.real; - z.imag = a.imag + b.imag; - return z; - } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) { - __pyx_t_double_complex z; - z.real = a.real - b.real; - z.imag = a.imag - b.imag; - return z; - } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) { - __pyx_t_double_complex z; - z.real = a.real * b.real - a.imag * b.imag; - z.imag = a.real * b.imag + a.imag * b.real; - return z; - } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) { - __pyx_t_double_complex z; - double denom = b.real * b.real + b.imag * b.imag; - z.real = (a.real * b.real + a.imag * b.imag) / denom; - z.imag = (a.imag * b.real - a.real * b.imag) / denom; - return z; - } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) { - __pyx_t_double_complex z; - z.real = -a.real; - z.imag = -a.imag; - return z; - } - static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) { - return (a.real == 0) && (a.imag == 0); - } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) { - __pyx_t_double_complex z; - z.real = a.real; - z.imag = -a.imag; - return z; - } - #if 1 - static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { - #if !defined(HAVE_HYPOT) || defined(_MSC_VER) - return sqrt(z.real*z.real + z.imag*z.imag); - #else - return hypot(z.real, z.imag); - #endif - } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex a, __pyx_t_double_complex b) { - __pyx_t_double_complex z; - double r, lnr, theta, z_r, z_theta; - if (b.imag == 0 && b.real == (int)b.real) { - if (b.real < 0) { - double denom = a.real * a.real + a.imag * a.imag; - a.real = a.real / denom; - a.imag = -a.imag / denom; - b.real = -b.real; - } - switch ((int)b.real) { - case 0: - z.real = 1; - z.imag = 0; - return z; - case 1: - return a; - case 2: - z = __Pyx_c_prod(a, a); - return __Pyx_c_prod(a, a); - case 3: - z = __Pyx_c_prod(a, a); - return __Pyx_c_prod(z, a); - case 4: - z = __Pyx_c_prod(a, a); - return __Pyx_c_prod(z, z); - } - } - if (a.imag == 0) { - if (a.real == 0) { - return a; - } - r = a.real; - theta = 0; - } else { - r = __Pyx_c_abs(a); - theta = atan2(a.imag, a.real); - } - lnr = log(r); - z_r = exp(lnr * b.real - theta * b.imag); - z_theta = theta * b.real + lnr * b.imag; - z.real = z_r * cos(z_theta); - z.imag = z_r * sin(z_theta); - return z; - } - #endif -#endif - -static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) { - const size_t neg_one = (size_t) -1, const_zero = 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_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 - #if CYTHON_USE_PYLONG_INTERNALS - switch (Py_SIZE(x)) { - case 0: return 0; - case 1: __PYX_VERIFY_RETURN_INT(size_t, digit, ((PyLongObject*)x)->ob_digit[0]); - } - #endif -#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(size_t, unsigned long, PyLong_AsUnsignedLong(x)) - } else if (sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) - } - } else { -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 - #if CYTHON_USE_PYLONG_INTERNALS - switch (Py_SIZE(x)) { - case 0: return 0; - case 1: __PYX_VERIFY_RETURN_INT(size_t, digit, +(((PyLongObject*)x)->ob_digit[0])); - case -1: __PYX_VERIFY_RETURN_INT(size_t, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]); - } - #endif -#endif - if (sizeof(size_t) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT(size_t, long, PyLong_AsLong(x)) - } else if (sizeof(size_t) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT(size_t, PY_LONG_LONG, PyLong_AsLongLong(x)) - } - } - { -#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_Int(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_Int(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; -} - -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { - const long neg_one = (long) -1, const_zero = 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); - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); - } - } else { - if (sizeof(long) <= sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(long), - little, !is_unsigned); - } -} - -static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { - const long neg_one = (long) -1, const_zero = 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_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 - #if CYTHON_USE_PYLONG_INTERNALS - switch (Py_SIZE(x)) { - case 0: return 0; - case 1: __PYX_VERIFY_RETURN_INT(long, digit, ((PyLongObject*)x)->ob_digit[0]); - } - #endif -#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(long, unsigned long, PyLong_AsUnsignedLong(x)) - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) - } - } else { -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 - #if CYTHON_USE_PYLONG_INTERNALS - switch (Py_SIZE(x)) { - case 0: return 0; - case 1: __PYX_VERIFY_RETURN_INT(long, digit, +(((PyLongObject*)x)->ob_digit[0])); - case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]); - } - #endif -#endif - if (sizeof(long) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT(long, long, PyLong_AsLong(x)) - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT(long, PY_LONG_LONG, PyLong_AsLongLong(x)) - } - } - { -#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_Int(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_Int(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; -} - -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; -} - -#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 - -#ifndef __PYX_HAVE_RT_ImportType -#define __PYX_HAVE_RT_ImportType -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, - size_t size, int strict) -{ - PyObject *py_module = 0; - PyObject *result = 0; - PyObject *py_name = 0; - char warning[200]; - Py_ssize_t basicsize; -#ifdef Py_LIMITED_API - PyObject *py_basicsize; -#endif - py_module = __Pyx_ImportModule(module_name); - if (!py_module) - goto bad; - py_name = __Pyx_PyIdentifier_FromString(class_name); - if (!py_name) - goto bad; - result = PyObject_GetAttr(py_module, py_name); - Py_DECREF(py_name); - py_name = 0; - Py_DECREF(py_module); - py_module = 0; - if (!result) - goto bad; - if (!PyType_Check(result)) { - PyErr_Format(PyExc_TypeError, - "%.200s.%.200s is not a type object", - module_name, class_name); - goto bad; - } -#ifndef Py_LIMITED_API - basicsize = ((PyTypeObject *)result)->tp_basicsize; -#else - py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); - if (!py_basicsize) - goto bad; - basicsize = PyLong_AsSsize_t(py_basicsize); - Py_DECREF(py_basicsize); - py_basicsize = 0; - if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) - goto bad; -#endif - if (!strict && (size_t)basicsize > size) { - PyOS_snprintf(warning, sizeof(warning), - "%s.%s size changed, may indicate binary incompatibility", - module_name, class_name); - if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; - } - else if ((size_t)basicsize != size) { - PyErr_Format(PyExc_ValueError, - "%.200s.%.200s has the wrong size, try recompiling", - module_name, class_name); - goto bad; - } - return (PyTypeObject *)result; -bad: - Py_XDECREF(py_module); - Py_XDECREF(result); - return NULL; -} -#endif - -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; - ++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 char* __Pyx_PyObject_AsString(PyObject* o) { - Py_ssize_t ignore; - return __Pyx_PyObject_AsStringAndSize(o, &ignore); -} -static CYTHON_INLINE 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)) { -#if PY_VERSION_HEX < 0x03030000 - 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 - if (__Pyx_PyUnicode_READY(o) == -1) return NULL; -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - if (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 - } else -#endif -#if !CYTHON_COMPILING_IN_PYPY - 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 CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { - PyNumberMethods *m; - const char *name = NULL; - PyObject *res = NULL; -#if PY_MAJOR_VERSION < 3 - if (PyInt_Check(x) || PyLong_Check(x)) -#else - if (PyLong_Check(x)) -#endif - return Py_INCREF(x), x; - m = Py_TYPE(x)->tp_as_number; -#if PY_MAJOR_VERSION < 3 - if (m && m->nb_int) { - name = "int"; - res = PyNumber_Int(x); - } - else if (m && m->nb_long) { - name = "long"; - res = PyNumber_Long(x); - } -#else - if (m && m->nb_int) { - name = "int"; - res = PyNumber_Long(x); - } -#endif - if (res) { -#if PY_MAJOR_VERSION < 3 - if (!PyInt_Check(res) && !PyLong_Check(res)) { -#else - if (!PyLong_Check(res)) { -#endif - PyErr_Format(PyExc_TypeError, - "__%.4s__ returned non-%.4s (type %.200s)", - name, name, Py_TYPE(res)->tp_name); - Py_DECREF(res); - return NULL; - } - } - 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))) - return PyInt_AS_LONG(b); -#endif - if (likely(PyLong_CheckExact(b))) { - #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 - #if CYTHON_USE_PYLONG_INTERNALS - switch (Py_SIZE(b)) { - case -1: return -(sdigit)((PyLongObject*)b)->ob_digit[0]; - case 0: return 0; - case 1: return ((PyLongObject*)b)->ob_digit[0]; - } - #endif - #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_PyInt_FromSize_t(size_t ival) { - return PyInt_FromSize_t(ival); -} - - -#endif /* Py_PYTHON_H */ diff --git a/owl/owl/libowl.pyx b/owl/owl/libowl.pyx index f7e3a78f..ce932ee5 100644 --- a/owl/owl/libowl.pyx +++ b/owl/owl/libowl.pyx @@ -178,23 +178,23 @@ cdef class NArray(object): return self @staticmethod - def mult(NArray lhs, NArray rhs): + def mult(NArray lhs not None, NArray rhs not None): return _wrap_cpp_narray(m.Mult(deref(lhs._d), deref(rhs._d))) @staticmethod - def exp(NArray lhs): + def exp(NArray lhs not None): return _wrap_cpp_narray(m.Exp(deref(lhs._d))) @staticmethod - def ln(NArray lhs): + def ln(NArray lhs not None): return _wrap_cpp_narray(m.Ln(deref(lhs._d))) @staticmethod - def sigm(NArray lhs): + def sigm(NArray lhs not None): return _wrap_cpp_narray(m.SigmoidForward(deref(lhs._d))) @staticmethod - def sigm_back(NArray diff, NArray top, NArray bottom): + def sigm_back(NArray diff not None, NArray top not None, NArray bottom not None): return _wrap_cpp_narray( m.SigmoidBackward( deref(diff._d) @@ -202,11 +202,14 @@ cdef class NArray(object): , deref(bottom._d))) @staticmethod - def relu(NArray lhs): + def relu(NArray lhs not None): return _wrap_cpp_narray(m.ReluForward(deref(lhs._d))) @staticmethod - def relu_back(NArray diff, NArray top, NArray bottom): + def relu_back( + NArray diff not None + , NArray top not None + , NArray bottom not None): return _wrap_cpp_narray( m.ReluBackward( deref(diff._d) @@ -214,11 +217,14 @@ cdef class NArray(object): , deref(bottom._d))) @staticmethod - def tanh(NArray lhs): + def tanh(NArray lhs not None): return _wrap_cpp_narray(m.TanhForward(deref(lhs._d))) @staticmethod - def tanh_back(NArray diff, NArray top, NArray bottom): + def tanh_back( + NArray diff not None + , NArray top not None + , NArray bottom not None): return _wrap_cpp_narray( m.TanhBackward( deref(diff._d) @@ -226,7 +232,11 @@ cdef class NArray(object): , deref(bottom._d))) @staticmethod - def conv_forward(NArray src, NArray filter, NArray bias, ConvInfo info): + def conv_forward( + NArray src not None + , NArray filter not None + , NArray bias not None + , ConvInfo info not None): return _wrap_cpp_narray( m.ConvForward( deref(src._d) @@ -236,7 +246,10 @@ cdef class NArray(object): @staticmethod def conv_backward_data( - NArray diff, NArray bottom, NArray filter, ConvInfo info): + NArray diff not None + , NArray bottom not None + , NArray filter not None + , ConvInfo info not None): return _wrap_cpp_narray( m.ConvBackwardData( deref(diff._d) @@ -246,7 +259,10 @@ cdef class NArray(object): @staticmethod def conv_backward_filter( - NArray diff, NArray bottom, NArray filter, ConvInfo info): + NArray diff not None + , NArray bottom not None + , NArray filter not None + , ConvInfo info not None): return _wrap_cpp_narray( m.ConvBackwardFilter( deref(diff._d) @@ -255,18 +271,22 @@ cdef class NArray(object): , deref(info._d))); @staticmethod - def conv_backward_bias(NArray diff): + def conv_backward_bias(NArray diff not None): return _wrap_cpp_narray(m.ConvBackwardBias(deref(diff._d))); @staticmethod - def softmax_forward(NArray src, SoftmaxAlgorithmWrapper algo): + def softmax_forward(NArray src not None, SoftmaxAlgorithmWrapper algo not None): return _wrap_cpp_narray( m.SoftmaxForward( deref(src._d) , m.ToSoftmaxAlgorithm(algo._d))); @staticmethod - def softmax_backward(NArray diff, NArray top, SoftmaxAlgorithmWrapper algo): + def softmax_backward( + NArray diff not None + , NArray top not None + , SoftmaxAlgorithmWrapper algo not None): + return _wrap_cpp_narray( m.SoftmaxBackward( deref(diff._d) @@ -274,7 +294,8 @@ cdef class NArray(object): , m.ToSoftmaxAlgorithm(algo._d))); @staticmethod - def activation_forward(NArray src, ActivationAlgorithmWrapper algo): + def activation_forward( + NArray src not None, ActivationAlgorithmWrapper algo not None): return _wrap_cpp_narray( m.ActivationForward( deref(src._d) @@ -282,10 +303,10 @@ cdef class NArray(object): @staticmethod def activation_backward( - NArray diff - , NArray top - , NArray bottom - , ActivationAlgorithmWrapper algo): + NArray diff not None + , NArray top not None + , NArray bottom not None + , ActivationAlgorithmWrapper algo not None): return _wrap_cpp_narray( m.ActivationBackward( deref(diff._d) @@ -294,7 +315,7 @@ cdef class NArray(object): , m.ToActivationAlgorithm(algo._d))); @staticmethod - def pooling_forward(NArray src, PoolingInfo algo): + def pooling_forward(NArray src not None, PoolingInfo algo not None): return _wrap_cpp_narray( m.PoolingForward( deref(src._d) @@ -302,10 +323,10 @@ cdef class NArray(object): @staticmethod def pooling_backward( - NArray diff - , NArray top - , NArray bottom - , PoolingInfo algo): + NArray diff not None + , NArray top not None + , NArray bottom not None + , PoolingInfo algo not None): return _wrap_cpp_narray( m.PoolingBackward( deref(diff._d) @@ -314,7 +335,12 @@ cdef class NArray(object): , deref(algo._d))); @staticmethod - def lrn_forward(NArray src, NArray scale, int local_size, float a, float b): + def lrn_forward( + NArray src not None + , NArray scale not None + , int local_size + , float a + , float b): return _wrap_cpp_narray( m.LRNForward( deref(src._d) @@ -325,10 +351,10 @@ cdef class NArray(object): @staticmethod def lrn_backward( - NArray bottom_data - , NArray top_data - , NArray scale - , NArray top_diff + NArray bottom_data not None + , NArray top_data not None + , NArray scale not None + , NArray top_diff not None , int local_size , float a , float b):