CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
hukaixuan19970627

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: hukaixuan19970627/yolov5_obb
Path: blob/master/DOTA_devkit/poly_nms_gpu/poly_nms.cpp
Views: 475
1
/* Generated by Cython 0.29.14 */
2
3
#define PY_SSIZE_T_CLEAN
4
#include "Python.h"
5
#ifndef Py_PYTHON_H
6
#error Python headers needed to compile C extensions, please install development version of Python.
7
#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
8
#error Cython requires Python 2.6+ or Python 3.3+.
9
#else
10
#define CYTHON_ABI "0_29_14"
11
#define CYTHON_HEX_VERSION 0x001D0EF0
12
#define CYTHON_FUTURE_DIVISION 0
13
#include <stddef.h>
14
#ifndef offsetof
15
#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
16
#endif
17
#if !defined(WIN32) && !defined(MS_WINDOWS)
18
#ifndef __stdcall
19
#define __stdcall
20
#endif
21
#ifndef __cdecl
22
#define __cdecl
23
#endif
24
#ifndef __fastcall
25
#define __fastcall
26
#endif
27
#endif
28
#ifndef DL_IMPORT
29
#define DL_IMPORT(t) t
30
#endif
31
#ifndef DL_EXPORT
32
#define DL_EXPORT(t) t
33
#endif
34
#define __PYX_COMMA ,
35
#ifndef HAVE_LONG_LONG
36
#if PY_VERSION_HEX >= 0x02070000
37
#define HAVE_LONG_LONG
38
#endif
39
#endif
40
#ifndef PY_LONG_LONG
41
#define PY_LONG_LONG LONG_LONG
42
#endif
43
#ifndef Py_HUGE_VAL
44
#define Py_HUGE_VAL HUGE_VAL
45
#endif
46
#ifdef PYPY_VERSION
47
#define CYTHON_COMPILING_IN_PYPY 1
48
#define CYTHON_COMPILING_IN_PYSTON 0
49
#define CYTHON_COMPILING_IN_CPYTHON 0
50
#undef CYTHON_USE_TYPE_SLOTS
51
#define CYTHON_USE_TYPE_SLOTS 0
52
#undef CYTHON_USE_PYTYPE_LOOKUP
53
#define CYTHON_USE_PYTYPE_LOOKUP 0
54
#if PY_VERSION_HEX < 0x03050000
55
#undef CYTHON_USE_ASYNC_SLOTS
56
#define CYTHON_USE_ASYNC_SLOTS 0
57
#elif !defined(CYTHON_USE_ASYNC_SLOTS)
58
#define CYTHON_USE_ASYNC_SLOTS 1
59
#endif
60
#undef CYTHON_USE_PYLIST_INTERNALS
61
#define CYTHON_USE_PYLIST_INTERNALS 0
62
#undef CYTHON_USE_UNICODE_INTERNALS
63
#define CYTHON_USE_UNICODE_INTERNALS 0
64
#undef CYTHON_USE_UNICODE_WRITER
65
#define CYTHON_USE_UNICODE_WRITER 0
66
#undef CYTHON_USE_PYLONG_INTERNALS
67
#define CYTHON_USE_PYLONG_INTERNALS 0
68
#undef CYTHON_AVOID_BORROWED_REFS
69
#define CYTHON_AVOID_BORROWED_REFS 1
70
#undef CYTHON_ASSUME_SAFE_MACROS
71
#define CYTHON_ASSUME_SAFE_MACROS 0
72
#undef CYTHON_UNPACK_METHODS
73
#define CYTHON_UNPACK_METHODS 0
74
#undef CYTHON_FAST_THREAD_STATE
75
#define CYTHON_FAST_THREAD_STATE 0
76
#undef CYTHON_FAST_PYCALL
77
#define CYTHON_FAST_PYCALL 0
78
#undef CYTHON_PEP489_MULTI_PHASE_INIT
79
#define CYTHON_PEP489_MULTI_PHASE_INIT 0
80
#undef CYTHON_USE_TP_FINALIZE
81
#define CYTHON_USE_TP_FINALIZE 0
82
#undef CYTHON_USE_DICT_VERSIONS
83
#define CYTHON_USE_DICT_VERSIONS 0
84
#undef CYTHON_USE_EXC_INFO_STACK
85
#define CYTHON_USE_EXC_INFO_STACK 0
86
#elif defined(PYSTON_VERSION)
87
#define CYTHON_COMPILING_IN_PYPY 0
88
#define CYTHON_COMPILING_IN_PYSTON 1
89
#define CYTHON_COMPILING_IN_CPYTHON 0
90
#ifndef CYTHON_USE_TYPE_SLOTS
91
#define CYTHON_USE_TYPE_SLOTS 1
92
#endif
93
#undef CYTHON_USE_PYTYPE_LOOKUP
94
#define CYTHON_USE_PYTYPE_LOOKUP 0
95
#undef CYTHON_USE_ASYNC_SLOTS
96
#define CYTHON_USE_ASYNC_SLOTS 0
97
#undef CYTHON_USE_PYLIST_INTERNALS
98
#define CYTHON_USE_PYLIST_INTERNALS 0
99
#ifndef CYTHON_USE_UNICODE_INTERNALS
100
#define CYTHON_USE_UNICODE_INTERNALS 1
101
#endif
102
#undef CYTHON_USE_UNICODE_WRITER
103
#define CYTHON_USE_UNICODE_WRITER 0
104
#undef CYTHON_USE_PYLONG_INTERNALS
105
#define CYTHON_USE_PYLONG_INTERNALS 0
106
#ifndef CYTHON_AVOID_BORROWED_REFS
107
#define CYTHON_AVOID_BORROWED_REFS 0
108
#endif
109
#ifndef CYTHON_ASSUME_SAFE_MACROS
110
#define CYTHON_ASSUME_SAFE_MACROS 1
111
#endif
112
#ifndef CYTHON_UNPACK_METHODS
113
#define CYTHON_UNPACK_METHODS 1
114
#endif
115
#undef CYTHON_FAST_THREAD_STATE
116
#define CYTHON_FAST_THREAD_STATE 0
117
#undef CYTHON_FAST_PYCALL
118
#define CYTHON_FAST_PYCALL 0
119
#undef CYTHON_PEP489_MULTI_PHASE_INIT
120
#define CYTHON_PEP489_MULTI_PHASE_INIT 0
121
#undef CYTHON_USE_TP_FINALIZE
122
#define CYTHON_USE_TP_FINALIZE 0
123
#undef CYTHON_USE_DICT_VERSIONS
124
#define CYTHON_USE_DICT_VERSIONS 0
125
#undef CYTHON_USE_EXC_INFO_STACK
126
#define CYTHON_USE_EXC_INFO_STACK 0
127
#else
128
#define CYTHON_COMPILING_IN_PYPY 0
129
#define CYTHON_COMPILING_IN_PYSTON 0
130
#define CYTHON_COMPILING_IN_CPYTHON 1
131
#ifndef CYTHON_USE_TYPE_SLOTS
132
#define CYTHON_USE_TYPE_SLOTS 1
133
#endif
134
#if PY_VERSION_HEX < 0x02070000
135
#undef CYTHON_USE_PYTYPE_LOOKUP
136
#define CYTHON_USE_PYTYPE_LOOKUP 0
137
#elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
138
#define CYTHON_USE_PYTYPE_LOOKUP 1
139
#endif
140
#if PY_MAJOR_VERSION < 3
141
#undef CYTHON_USE_ASYNC_SLOTS
142
#define CYTHON_USE_ASYNC_SLOTS 0
143
#elif !defined(CYTHON_USE_ASYNC_SLOTS)
144
#define CYTHON_USE_ASYNC_SLOTS 1
145
#endif
146
#if PY_VERSION_HEX < 0x02070000
147
#undef CYTHON_USE_PYLONG_INTERNALS
148
#define CYTHON_USE_PYLONG_INTERNALS 0
149
#elif !defined(CYTHON_USE_PYLONG_INTERNALS)
150
#define CYTHON_USE_PYLONG_INTERNALS 1
151
#endif
152
#ifndef CYTHON_USE_PYLIST_INTERNALS
153
#define CYTHON_USE_PYLIST_INTERNALS 1
154
#endif
155
#ifndef CYTHON_USE_UNICODE_INTERNALS
156
#define CYTHON_USE_UNICODE_INTERNALS 1
157
#endif
158
#if PY_VERSION_HEX < 0x030300F0
159
#undef CYTHON_USE_UNICODE_WRITER
160
#define CYTHON_USE_UNICODE_WRITER 0
161
#elif !defined(CYTHON_USE_UNICODE_WRITER)
162
#define CYTHON_USE_UNICODE_WRITER 1
163
#endif
164
#ifndef CYTHON_AVOID_BORROWED_REFS
165
#define CYTHON_AVOID_BORROWED_REFS 0
166
#endif
167
#ifndef CYTHON_ASSUME_SAFE_MACROS
168
#define CYTHON_ASSUME_SAFE_MACROS 1
169
#endif
170
#ifndef CYTHON_UNPACK_METHODS
171
#define CYTHON_UNPACK_METHODS 1
172
#endif
173
#ifndef CYTHON_FAST_THREAD_STATE
174
#define CYTHON_FAST_THREAD_STATE 1
175
#endif
176
#ifndef CYTHON_FAST_PYCALL
177
#define CYTHON_FAST_PYCALL 1
178
#endif
179
#ifndef CYTHON_PEP489_MULTI_PHASE_INIT
180
#define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
181
#endif
182
#ifndef CYTHON_USE_TP_FINALIZE
183
#define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
184
#endif
185
#ifndef CYTHON_USE_DICT_VERSIONS
186
#define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
187
#endif
188
#ifndef CYTHON_USE_EXC_INFO_STACK
189
#define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
190
#endif
191
#endif
192
#if !defined(CYTHON_FAST_PYCCALL)
193
#define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
194
#endif
195
#if CYTHON_USE_PYLONG_INTERNALS
196
#include "longintrepr.h"
197
#undef SHIFT
198
#undef BASE
199
#undef MASK
200
#ifdef SIZEOF_VOID_P
201
enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
202
#endif
203
#endif
204
#ifndef __has_attribute
205
#define __has_attribute(x) 0
206
#endif
207
#ifndef __has_cpp_attribute
208
#define __has_cpp_attribute(x) 0
209
#endif
210
#ifndef CYTHON_RESTRICT
211
#if defined(__GNUC__)
212
#define CYTHON_RESTRICT __restrict__
213
#elif defined(_MSC_VER) && _MSC_VER >= 1400
214
#define CYTHON_RESTRICT __restrict
215
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
216
#define CYTHON_RESTRICT restrict
217
#else
218
#define CYTHON_RESTRICT
219
#endif
220
#endif
221
#ifndef CYTHON_UNUSED
222
# if defined(__GNUC__)
223
# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
224
# define CYTHON_UNUSED __attribute__ ((__unused__))
225
# else
226
# define CYTHON_UNUSED
227
# endif
228
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
229
# define CYTHON_UNUSED __attribute__ ((__unused__))
230
# else
231
# define CYTHON_UNUSED
232
# endif
233
#endif
234
#ifndef CYTHON_MAYBE_UNUSED_VAR
235
# if defined(__cplusplus)
236
template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
237
# else
238
# define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
239
# endif
240
#endif
241
#ifndef CYTHON_NCP_UNUSED
242
# if CYTHON_COMPILING_IN_CPYTHON
243
# define CYTHON_NCP_UNUSED
244
# else
245
# define CYTHON_NCP_UNUSED CYTHON_UNUSED
246
# endif
247
#endif
248
#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
249
#ifdef _MSC_VER
250
#ifndef _MSC_STDINT_H_
251
#if _MSC_VER < 1300
252
typedef unsigned char uint8_t;
253
typedef unsigned int uint32_t;
254
#else
255
typedef unsigned __int8 uint8_t;
256
typedef unsigned __int32 uint32_t;
257
#endif
258
#endif
259
#else
260
#include <stdint.h>
261
#endif
262
#ifndef CYTHON_FALLTHROUGH
263
#if defined(__cplusplus) && __cplusplus >= 201103L
264
#if __has_cpp_attribute(fallthrough)
265
#define CYTHON_FALLTHROUGH [[fallthrough]]
266
#elif __has_cpp_attribute(clang::fallthrough)
267
#define CYTHON_FALLTHROUGH [[clang::fallthrough]]
268
#elif __has_cpp_attribute(gnu::fallthrough)
269
#define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
270
#endif
271
#endif
272
#ifndef CYTHON_FALLTHROUGH
273
#if __has_attribute(fallthrough)
274
#define CYTHON_FALLTHROUGH __attribute__((fallthrough))
275
#else
276
#define CYTHON_FALLTHROUGH
277
#endif
278
#endif
279
#if defined(__clang__ ) && defined(__apple_build_version__)
280
#if __apple_build_version__ < 7000000
281
#undef CYTHON_FALLTHROUGH
282
#define CYTHON_FALLTHROUGH
283
#endif
284
#endif
285
#endif
286
287
#ifndef __cplusplus
288
#error "Cython files generated with the C++ option must be compiled with a C++ compiler."
289
#endif
290
#ifndef CYTHON_INLINE
291
#if defined(__clang__)
292
#define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
293
#else
294
#define CYTHON_INLINE inline
295
#endif
296
#endif
297
template<typename T>
298
void __Pyx_call_destructor(T& x) {
299
x.~T();
300
}
301
template<typename T>
302
class __Pyx_FakeReference {
303
public:
304
__Pyx_FakeReference() : ptr(NULL) { }
305
__Pyx_FakeReference(const T& ref) : ptr(const_cast<T*>(&ref)) { }
306
T *operator->() { return ptr; }
307
T *operator&() { return ptr; }
308
operator T&() { return *ptr; }
309
template<typename U> bool operator ==(U other) { return *ptr == other; }
310
template<typename U> bool operator !=(U other) { return *ptr != other; }
311
private:
312
T *ptr;
313
};
314
315
#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
316
#define Py_OptimizeFlag 0
317
#endif
318
#define __PYX_BUILD_PY_SSIZE_T "n"
319
#define CYTHON_FORMAT_SSIZE_T "z"
320
#if PY_MAJOR_VERSION < 3
321
#define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
322
#define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
323
PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
324
#define __Pyx_DefaultClassType PyClass_Type
325
#else
326
#define __Pyx_BUILTIN_MODULE_NAME "builtins"
327
#if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
328
#define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
329
PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
330
#else
331
#define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
332
PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
333
#endif
334
#define __Pyx_DefaultClassType PyType_Type
335
#endif
336
#ifndef Py_TPFLAGS_CHECKTYPES
337
#define Py_TPFLAGS_CHECKTYPES 0
338
#endif
339
#ifndef Py_TPFLAGS_HAVE_INDEX
340
#define Py_TPFLAGS_HAVE_INDEX 0
341
#endif
342
#ifndef Py_TPFLAGS_HAVE_NEWBUFFER
343
#define Py_TPFLAGS_HAVE_NEWBUFFER 0
344
#endif
345
#ifndef Py_TPFLAGS_HAVE_FINALIZE
346
#define Py_TPFLAGS_HAVE_FINALIZE 0
347
#endif
348
#ifndef METH_STACKLESS
349
#define METH_STACKLESS 0
350
#endif
351
#if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
352
#ifndef METH_FASTCALL
353
#define METH_FASTCALL 0x80
354
#endif
355
typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
356
typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
357
Py_ssize_t nargs, PyObject *kwnames);
358
#else
359
#define __Pyx_PyCFunctionFast _PyCFunctionFast
360
#define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
361
#endif
362
#if CYTHON_FAST_PYCCALL
363
#define __Pyx_PyFastCFunction_Check(func)\
364
((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
365
#else
366
#define __Pyx_PyFastCFunction_Check(func) 0
367
#endif
368
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
369
#define PyObject_Malloc(s) PyMem_Malloc(s)
370
#define PyObject_Free(p) PyMem_Free(p)
371
#define PyObject_Realloc(p) PyMem_Realloc(p)
372
#endif
373
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
374
#define PyMem_RawMalloc(n) PyMem_Malloc(n)
375
#define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n)
376
#define PyMem_RawFree(p) PyMem_Free(p)
377
#endif
378
#if CYTHON_COMPILING_IN_PYSTON
379
#define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co)
380
#define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
381
#else
382
#define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
383
#define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
384
#endif
385
#if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
386
#define __Pyx_PyThreadState_Current PyThreadState_GET()
387
#elif PY_VERSION_HEX >= 0x03060000
388
#define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
389
#elif PY_VERSION_HEX >= 0x03000000
390
#define __Pyx_PyThreadState_Current PyThreadState_GET()
391
#else
392
#define __Pyx_PyThreadState_Current _PyThreadState_Current
393
#endif
394
#if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
395
#include "pythread.h"
396
#define Py_tss_NEEDS_INIT 0
397
typedef int Py_tss_t;
398
static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
399
*key = PyThread_create_key();
400
return 0;
401
}
402
static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
403
Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
404
*key = Py_tss_NEEDS_INIT;
405
return key;
406
}
407
static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
408
PyObject_Free(key);
409
}
410
static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
411
return *key != Py_tss_NEEDS_INIT;
412
}
413
static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
414
PyThread_delete_key(*key);
415
*key = Py_tss_NEEDS_INIT;
416
}
417
static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
418
return PyThread_set_key_value(*key, value);
419
}
420
static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
421
return PyThread_get_key_value(*key);
422
}
423
#endif
424
#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
425
#define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
426
#else
427
#define __Pyx_PyDict_NewPresized(n) PyDict_New()
428
#endif
429
#if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
430
#define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
431
#define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
432
#else
433
#define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
434
#define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
435
#endif
436
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
437
#define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
438
#else
439
#define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name)
440
#endif
441
#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
442
#define CYTHON_PEP393_ENABLED 1
443
#define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
444
0 : _PyUnicode_Ready((PyObject *)(op)))
445
#define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
446
#define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
447
#define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
448
#define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
449
#define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
450
#define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
451
#define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch)
452
#define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
453
#else
454
#define CYTHON_PEP393_ENABLED 0
455
#define PyUnicode_1BYTE_KIND 1
456
#define PyUnicode_2BYTE_KIND 2
457
#define PyUnicode_4BYTE_KIND 4
458
#define __Pyx_PyUnicode_READY(op) (0)
459
#define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
460
#define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
461
#define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
462
#define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
463
#define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
464
#define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
465
#define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
466
#define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
467
#endif
468
#if CYTHON_COMPILING_IN_PYPY
469
#define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
470
#define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
471
#else
472
#define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
473
#define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
474
PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
475
#endif
476
#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
477
#define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
478
#endif
479
#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
480
#define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
481
#endif
482
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
483
#define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
484
#endif
485
#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
486
#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
487
#if PY_MAJOR_VERSION >= 3
488
#define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
489
#else
490
#define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
491
#endif
492
#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
493
#define PyObject_ASCII(o) PyObject_Repr(o)
494
#endif
495
#if PY_MAJOR_VERSION >= 3
496
#define PyBaseString_Type PyUnicode_Type
497
#define PyStringObject PyUnicodeObject
498
#define PyString_Type PyUnicode_Type
499
#define PyString_Check PyUnicode_Check
500
#define PyString_CheckExact PyUnicode_CheckExact
501
#define PyObject_Unicode PyObject_Str
502
#endif
503
#if PY_MAJOR_VERSION >= 3
504
#define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
505
#define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
506
#else
507
#define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
508
#define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
509
#endif
510
#ifndef PySet_CheckExact
511
#define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
512
#endif
513
#if CYTHON_ASSUME_SAFE_MACROS
514
#define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
515
#else
516
#define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
517
#endif
518
#if PY_MAJOR_VERSION >= 3
519
#define PyIntObject PyLongObject
520
#define PyInt_Type PyLong_Type
521
#define PyInt_Check(op) PyLong_Check(op)
522
#define PyInt_CheckExact(op) PyLong_CheckExact(op)
523
#define PyInt_FromString PyLong_FromString
524
#define PyInt_FromUnicode PyLong_FromUnicode
525
#define PyInt_FromLong PyLong_FromLong
526
#define PyInt_FromSize_t PyLong_FromSize_t
527
#define PyInt_FromSsize_t PyLong_FromSsize_t
528
#define PyInt_AsLong PyLong_AsLong
529
#define PyInt_AS_LONG PyLong_AS_LONG
530
#define PyInt_AsSsize_t PyLong_AsSsize_t
531
#define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
532
#define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
533
#define PyNumber_Int PyNumber_Long
534
#endif
535
#if PY_MAJOR_VERSION >= 3
536
#define PyBoolObject PyLongObject
537
#endif
538
#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
539
#ifndef PyUnicode_InternFromString
540
#define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
541
#endif
542
#endif
543
#if PY_VERSION_HEX < 0x030200A4
544
typedef long Py_hash_t;
545
#define __Pyx_PyInt_FromHash_t PyInt_FromLong
546
#define __Pyx_PyInt_AsHash_t PyInt_AsLong
547
#else
548
#define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
549
#define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
550
#endif
551
#if PY_MAJOR_VERSION >= 3
552
#define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : (Py_INCREF(func), func))
553
#else
554
#define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
555
#endif
556
#if CYTHON_USE_ASYNC_SLOTS
557
#if PY_VERSION_HEX >= 0x030500B1
558
#define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
559
#define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
560
#else
561
#define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
562
#endif
563
#else
564
#define __Pyx_PyType_AsAsync(obj) NULL
565
#endif
566
#ifndef __Pyx_PyAsyncMethodsStruct
567
typedef struct {
568
unaryfunc am_await;
569
unaryfunc am_aiter;
570
unaryfunc am_anext;
571
} __Pyx_PyAsyncMethodsStruct;
572
#endif
573
574
#if defined(WIN32) || defined(MS_WINDOWS)
575
#define _USE_MATH_DEFINES
576
#endif
577
#include <math.h>
578
#ifdef NAN
579
#define __PYX_NAN() ((float) NAN)
580
#else
581
static CYTHON_INLINE float __PYX_NAN() {
582
float value;
583
memset(&value, 0xFF, sizeof(value));
584
return value;
585
}
586
#endif
587
#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
588
#define __Pyx_truncl trunc
589
#else
590
#define __Pyx_truncl truncl
591
#endif
592
593
594
#define __PYX_ERR(f_index, lineno, Ln_error) \
595
{ \
596
__pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \
597
}
598
599
#ifndef __PYX_EXTERN_C
600
#ifdef __cplusplus
601
#define __PYX_EXTERN_C extern "C"
602
#else
603
#define __PYX_EXTERN_C extern
604
#endif
605
#endif
606
607
#define __PYX_HAVE__poly_nms
608
#define __PYX_HAVE_API__poly_nms
609
/* Early includes */
610
#include <string.h>
611
#include <stdio.h>
612
#include "numpy/arrayobject.h"
613
#include "numpy/ufuncobject.h"
614
#include "poly_nms.hpp"
615
#ifdef _OPENMP
616
#include <omp.h>
617
#endif /* _OPENMP */
618
619
#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
620
#define CYTHON_WITHOUT_ASSERTIONS
621
#endif
622
623
typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
624
const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
625
626
#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
627
#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
628
#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
629
#define __PYX_DEFAULT_STRING_ENCODING ""
630
#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
631
#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
632
#define __Pyx_uchar_cast(c) ((unsigned char)c)
633
#define __Pyx_long_cast(x) ((long)x)
634
#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
635
(sizeof(type) < sizeof(Py_ssize_t)) ||\
636
(sizeof(type) > sizeof(Py_ssize_t) &&\
637
likely(v < (type)PY_SSIZE_T_MAX ||\
638
v == (type)PY_SSIZE_T_MAX) &&\
639
(!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
640
v == (type)PY_SSIZE_T_MIN))) ||\
641
(sizeof(type) == sizeof(Py_ssize_t) &&\
642
(is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
643
v == (type)PY_SSIZE_T_MAX))) )
644
static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
645
return (size_t) i < (size_t) limit;
646
}
647
#if defined (__cplusplus) && __cplusplus >= 201103L
648
#include <cstdlib>
649
#define __Pyx_sst_abs(value) std::abs(value)
650
#elif SIZEOF_INT >= SIZEOF_SIZE_T
651
#define __Pyx_sst_abs(value) abs(value)
652
#elif SIZEOF_LONG >= SIZEOF_SIZE_T
653
#define __Pyx_sst_abs(value) labs(value)
654
#elif defined (_MSC_VER)
655
#define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
656
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
657
#define __Pyx_sst_abs(value) llabs(value)
658
#elif defined (__GNUC__)
659
#define __Pyx_sst_abs(value) __builtin_llabs(value)
660
#else
661
#define __Pyx_sst_abs(value) ((value<0) ? -value : value)
662
#endif
663
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
664
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
665
#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
666
#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
667
#define __Pyx_PyBytes_FromString PyBytes_FromString
668
#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
669
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
670
#if PY_MAJOR_VERSION < 3
671
#define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
672
#define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
673
#else
674
#define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
675
#define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
676
#endif
677
#define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
678
#define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
679
#define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
680
#define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
681
#define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
682
#define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
683
#define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s))
684
#define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
685
#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
686
#define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
687
#define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
688
#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
689
#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
690
#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
691
#define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
692
#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
693
static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
694
const Py_UNICODE *u_end = u;
695
while (*u_end++) ;
696
return (size_t)(u_end - u - 1);
697
}
698
#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
699
#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
700
#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
701
#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
702
#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
703
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
704
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
705
static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
706
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
707
#define __Pyx_PySequence_Tuple(obj)\
708
(likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
709
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
710
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
711
#if CYTHON_ASSUME_SAFE_MACROS
712
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
713
#else
714
#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
715
#endif
716
#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
717
#if PY_MAJOR_VERSION >= 3
718
#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
719
#else
720
#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
721
#endif
722
#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
723
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
724
static int __Pyx_sys_getdefaultencoding_not_ascii;
725
static int __Pyx_init_sys_getdefaultencoding_params(void) {
726
PyObject* sys;
727
PyObject* default_encoding = NULL;
728
PyObject* ascii_chars_u = NULL;
729
PyObject* ascii_chars_b = NULL;
730
const char* default_encoding_c;
731
sys = PyImport_ImportModule("sys");
732
if (!sys) goto bad;
733
default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
734
Py_DECREF(sys);
735
if (!default_encoding) goto bad;
736
default_encoding_c = PyBytes_AsString(default_encoding);
737
if (!default_encoding_c) goto bad;
738
if (strcmp(default_encoding_c, "ascii") == 0) {
739
__Pyx_sys_getdefaultencoding_not_ascii = 0;
740
} else {
741
char ascii_chars[128];
742
int c;
743
for (c = 0; c < 128; c++) {
744
ascii_chars[c] = c;
745
}
746
__Pyx_sys_getdefaultencoding_not_ascii = 1;
747
ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
748
if (!ascii_chars_u) goto bad;
749
ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
750
if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
751
PyErr_Format(
752
PyExc_ValueError,
753
"This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
754
default_encoding_c);
755
goto bad;
756
}
757
Py_DECREF(ascii_chars_u);
758
Py_DECREF(ascii_chars_b);
759
}
760
Py_DECREF(default_encoding);
761
return 0;
762
bad:
763
Py_XDECREF(default_encoding);
764
Py_XDECREF(ascii_chars_u);
765
Py_XDECREF(ascii_chars_b);
766
return -1;
767
}
768
#endif
769
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
770
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
771
#else
772
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
773
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
774
static char* __PYX_DEFAULT_STRING_ENCODING;
775
static int __Pyx_init_sys_getdefaultencoding_params(void) {
776
PyObject* sys;
777
PyObject* default_encoding = NULL;
778
char* default_encoding_c;
779
sys = PyImport_ImportModule("sys");
780
if (!sys) goto bad;
781
default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
782
Py_DECREF(sys);
783
if (!default_encoding) goto bad;
784
default_encoding_c = PyBytes_AsString(default_encoding);
785
if (!default_encoding_c) goto bad;
786
__PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
787
if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
788
strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
789
Py_DECREF(default_encoding);
790
return 0;
791
bad:
792
Py_XDECREF(default_encoding);
793
return -1;
794
}
795
#endif
796
#endif
797
798
799
/* Test for GCC > 2.95 */
800
#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
801
#define likely(x) __builtin_expect(!!(x), 1)
802
#define unlikely(x) __builtin_expect(!!(x), 0)
803
#else /* !__GNUC__ or GCC < 2.95 */
804
#define likely(x) (x)
805
#define unlikely(x) (x)
806
#endif /* __GNUC__ */
807
static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
808
809
static PyObject *__pyx_m = NULL;
810
static PyObject *__pyx_d;
811
static PyObject *__pyx_b;
812
static PyObject *__pyx_cython_runtime = NULL;
813
static PyObject *__pyx_empty_tuple;
814
static PyObject *__pyx_empty_bytes;
815
static PyObject *__pyx_empty_unicode;
816
static int __pyx_lineno;
817
static int __pyx_clineno = 0;
818
static const char * __pyx_cfilenm= __FILE__;
819
static const char *__pyx_filename;
820
821
/* Header.proto */
822
#if !defined(CYTHON_CCOMPLEX)
823
#if defined(__cplusplus)
824
#define CYTHON_CCOMPLEX 1
825
#elif defined(_Complex_I)
826
#define CYTHON_CCOMPLEX 1
827
#else
828
#define CYTHON_CCOMPLEX 0
829
#endif
830
#endif
831
#if CYTHON_CCOMPLEX
832
#ifdef __cplusplus
833
#include <complex>
834
#else
835
#include <complex.h>
836
#endif
837
#endif
838
#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
839
#undef _Complex_I
840
#define _Complex_I 1.0fj
841
#endif
842
843
844
static const char *__pyx_f[] = {
845
"poly_nms.pyx",
846
"__init__.pxd",
847
"type.pxd",
848
};
849
/* BufferFormatStructs.proto */
850
#define IS_UNSIGNED(type) (((type) -1) > 0)
851
struct __Pyx_StructField_;
852
#define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
853
typedef struct {
854
const char* name;
855
struct __Pyx_StructField_* fields;
856
size_t size;
857
size_t arraysize[8];
858
int ndim;
859
char typegroup;
860
char is_unsigned;
861
int flags;
862
} __Pyx_TypeInfo;
863
typedef struct __Pyx_StructField_ {
864
__Pyx_TypeInfo* type;
865
const char* name;
866
size_t offset;
867
} __Pyx_StructField;
868
typedef struct {
869
__Pyx_StructField* field;
870
size_t parent_offset;
871
} __Pyx_BufFmt_StackElem;
872
typedef struct {
873
__Pyx_StructField root;
874
__Pyx_BufFmt_StackElem* head;
875
size_t fmt_offset;
876
size_t new_count, enc_count;
877
size_t struct_alignment;
878
int is_complex;
879
char enc_type;
880
char new_packmode;
881
char enc_packmode;
882
char is_valid_array;
883
} __Pyx_BufFmt_Context;
884
885
886
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":776
887
* # in Cython to enable them only on the right systems.
888
*
889
* ctypedef npy_int8 int8_t # <<<<<<<<<<<<<<
890
* ctypedef npy_int16 int16_t
891
* ctypedef npy_int32 int32_t
892
*/
893
typedef npy_int8 __pyx_t_5numpy_int8_t;
894
895
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":777
896
*
897
* ctypedef npy_int8 int8_t
898
* ctypedef npy_int16 int16_t # <<<<<<<<<<<<<<
899
* ctypedef npy_int32 int32_t
900
* ctypedef npy_int64 int64_t
901
*/
902
typedef npy_int16 __pyx_t_5numpy_int16_t;
903
904
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":778
905
* ctypedef npy_int8 int8_t
906
* ctypedef npy_int16 int16_t
907
* ctypedef npy_int32 int32_t # <<<<<<<<<<<<<<
908
* ctypedef npy_int64 int64_t
909
* #ctypedef npy_int96 int96_t
910
*/
911
typedef npy_int32 __pyx_t_5numpy_int32_t;
912
913
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":779
914
* ctypedef npy_int16 int16_t
915
* ctypedef npy_int32 int32_t
916
* ctypedef npy_int64 int64_t # <<<<<<<<<<<<<<
917
* #ctypedef npy_int96 int96_t
918
* #ctypedef npy_int128 int128_t
919
*/
920
typedef npy_int64 __pyx_t_5numpy_int64_t;
921
922
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":783
923
* #ctypedef npy_int128 int128_t
924
*
925
* ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<<
926
* ctypedef npy_uint16 uint16_t
927
* ctypedef npy_uint32 uint32_t
928
*/
929
typedef npy_uint8 __pyx_t_5numpy_uint8_t;
930
931
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":784
932
*
933
* ctypedef npy_uint8 uint8_t
934
* ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<<
935
* ctypedef npy_uint32 uint32_t
936
* ctypedef npy_uint64 uint64_t
937
*/
938
typedef npy_uint16 __pyx_t_5numpy_uint16_t;
939
940
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":785
941
* ctypedef npy_uint8 uint8_t
942
* ctypedef npy_uint16 uint16_t
943
* ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<<
944
* ctypedef npy_uint64 uint64_t
945
* #ctypedef npy_uint96 uint96_t
946
*/
947
typedef npy_uint32 __pyx_t_5numpy_uint32_t;
948
949
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":786
950
* ctypedef npy_uint16 uint16_t
951
* ctypedef npy_uint32 uint32_t
952
* ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<<
953
* #ctypedef npy_uint96 uint96_t
954
* #ctypedef npy_uint128 uint128_t
955
*/
956
typedef npy_uint64 __pyx_t_5numpy_uint64_t;
957
958
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":790
959
* #ctypedef npy_uint128 uint128_t
960
*
961
* ctypedef npy_float32 float32_t # <<<<<<<<<<<<<<
962
* ctypedef npy_float64 float64_t
963
* #ctypedef npy_float80 float80_t
964
*/
965
typedef npy_float32 __pyx_t_5numpy_float32_t;
966
967
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":791
968
*
969
* ctypedef npy_float32 float32_t
970
* ctypedef npy_float64 float64_t # <<<<<<<<<<<<<<
971
* #ctypedef npy_float80 float80_t
972
* #ctypedef npy_float128 float128_t
973
*/
974
typedef npy_float64 __pyx_t_5numpy_float64_t;
975
976
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":800
977
* # The int types are mapped a bit surprising --
978
* # numpy.int corresponds to 'l' and numpy.long to 'q'
979
* ctypedef npy_long int_t # <<<<<<<<<<<<<<
980
* ctypedef npy_longlong long_t
981
* ctypedef npy_longlong longlong_t
982
*/
983
typedef npy_long __pyx_t_5numpy_int_t;
984
985
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":801
986
* # numpy.int corresponds to 'l' and numpy.long to 'q'
987
* ctypedef npy_long int_t
988
* ctypedef npy_longlong long_t # <<<<<<<<<<<<<<
989
* ctypedef npy_longlong longlong_t
990
*
991
*/
992
typedef npy_longlong __pyx_t_5numpy_long_t;
993
994
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":802
995
* ctypedef npy_long int_t
996
* ctypedef npy_longlong long_t
997
* ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<<
998
*
999
* ctypedef npy_ulong uint_t
1000
*/
1001
typedef npy_longlong __pyx_t_5numpy_longlong_t;
1002
1003
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":804
1004
* ctypedef npy_longlong longlong_t
1005
*
1006
* ctypedef npy_ulong uint_t # <<<<<<<<<<<<<<
1007
* ctypedef npy_ulonglong ulong_t
1008
* ctypedef npy_ulonglong ulonglong_t
1009
*/
1010
typedef npy_ulong __pyx_t_5numpy_uint_t;
1011
1012
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":805
1013
*
1014
* ctypedef npy_ulong uint_t
1015
* ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<<
1016
* ctypedef npy_ulonglong ulonglong_t
1017
*
1018
*/
1019
typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
1020
1021
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":806
1022
* ctypedef npy_ulong uint_t
1023
* ctypedef npy_ulonglong ulong_t
1024
* ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<<
1025
*
1026
* ctypedef npy_intp intp_t
1027
*/
1028
typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;
1029
1030
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":808
1031
* ctypedef npy_ulonglong ulonglong_t
1032
*
1033
* ctypedef npy_intp intp_t # <<<<<<<<<<<<<<
1034
* ctypedef npy_uintp uintp_t
1035
*
1036
*/
1037
typedef npy_intp __pyx_t_5numpy_intp_t;
1038
1039
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":809
1040
*
1041
* ctypedef npy_intp intp_t
1042
* ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<<
1043
*
1044
* ctypedef npy_double float_t
1045
*/
1046
typedef npy_uintp __pyx_t_5numpy_uintp_t;
1047
1048
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":811
1049
* ctypedef npy_uintp uintp_t
1050
*
1051
* ctypedef npy_double float_t # <<<<<<<<<<<<<<
1052
* ctypedef npy_double double_t
1053
* ctypedef npy_longdouble longdouble_t
1054
*/
1055
typedef npy_double __pyx_t_5numpy_float_t;
1056
1057
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":812
1058
*
1059
* ctypedef npy_double float_t
1060
* ctypedef npy_double double_t # <<<<<<<<<<<<<<
1061
* ctypedef npy_longdouble longdouble_t
1062
*
1063
*/
1064
typedef npy_double __pyx_t_5numpy_double_t;
1065
1066
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":813
1067
* ctypedef npy_double float_t
1068
* ctypedef npy_double double_t
1069
* ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<<
1070
*
1071
* ctypedef npy_cfloat cfloat_t
1072
*/
1073
typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
1074
/* Declarations.proto */
1075
#if CYTHON_CCOMPLEX
1076
#ifdef __cplusplus
1077
typedef ::std::complex< float > __pyx_t_float_complex;
1078
#else
1079
typedef float _Complex __pyx_t_float_complex;
1080
#endif
1081
#else
1082
typedef struct { float real, imag; } __pyx_t_float_complex;
1083
#endif
1084
static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);
1085
1086
/* Declarations.proto */
1087
#if CYTHON_CCOMPLEX
1088
#ifdef __cplusplus
1089
typedef ::std::complex< double > __pyx_t_double_complex;
1090
#else
1091
typedef double _Complex __pyx_t_double_complex;
1092
#endif
1093
#else
1094
typedef struct { double real, imag; } __pyx_t_double_complex;
1095
#endif
1096
static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);
1097
1098
1099
/*--- Type declarations ---*/
1100
1101
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":815
1102
* ctypedef npy_longdouble longdouble_t
1103
*
1104
* ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<<
1105
* ctypedef npy_cdouble cdouble_t
1106
* ctypedef npy_clongdouble clongdouble_t
1107
*/
1108
typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
1109
1110
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":816
1111
*
1112
* ctypedef npy_cfloat cfloat_t
1113
* ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<<
1114
* ctypedef npy_clongdouble clongdouble_t
1115
*
1116
*/
1117
typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
1118
1119
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":817
1120
* ctypedef npy_cfloat cfloat_t
1121
* ctypedef npy_cdouble cdouble_t
1122
* ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<<
1123
*
1124
* ctypedef npy_cdouble complex_t
1125
*/
1126
typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
1127
1128
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":819
1129
* ctypedef npy_clongdouble clongdouble_t
1130
*
1131
* ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<<
1132
*
1133
* cdef inline object PyArray_MultiIterNew1(a):
1134
*/
1135
typedef npy_cdouble __pyx_t_5numpy_complex_t;
1136
1137
/* --- Runtime support code (head) --- */
1138
/* Refnanny.proto */
1139
#ifndef CYTHON_REFNANNY
1140
#define CYTHON_REFNANNY 0
1141
#endif
1142
#if CYTHON_REFNANNY
1143
typedef struct {
1144
void (*INCREF)(void*, PyObject*, int);
1145
void (*DECREF)(void*, PyObject*, int);
1146
void (*GOTREF)(void*, PyObject*, int);
1147
void (*GIVEREF)(void*, PyObject*, int);
1148
void* (*SetupContext)(const char*, int, const char*);
1149
void (*FinishContext)(void**);
1150
} __Pyx_RefNannyAPIStruct;
1151
static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1152
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
1153
#define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1154
#ifdef WITH_THREAD
1155
#define __Pyx_RefNannySetupContext(name, acquire_gil)\
1156
if (acquire_gil) {\
1157
PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1158
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1159
PyGILState_Release(__pyx_gilstate_save);\
1160
} else {\
1161
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1162
}
1163
#else
1164
#define __Pyx_RefNannySetupContext(name, acquire_gil)\
1165
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
1166
#endif
1167
#define __Pyx_RefNannyFinishContext()\
1168
__Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1169
#define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1170
#define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1171
#define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1172
#define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1173
#define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
1174
#define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
1175
#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
1176
#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
1177
#else
1178
#define __Pyx_RefNannyDeclarations
1179
#define __Pyx_RefNannySetupContext(name, acquire_gil)
1180
#define __Pyx_RefNannyFinishContext()
1181
#define __Pyx_INCREF(r) Py_INCREF(r)
1182
#define __Pyx_DECREF(r) Py_DECREF(r)
1183
#define __Pyx_GOTREF(r)
1184
#define __Pyx_GIVEREF(r)
1185
#define __Pyx_XINCREF(r) Py_XINCREF(r)
1186
#define __Pyx_XDECREF(r) Py_XDECREF(r)
1187
#define __Pyx_XGOTREF(r)
1188
#define __Pyx_XGIVEREF(r)
1189
#endif
1190
#define __Pyx_XDECREF_SET(r, v) do {\
1191
PyObject *tmp = (PyObject *) r;\
1192
r = v; __Pyx_XDECREF(tmp);\
1193
} while (0)
1194
#define __Pyx_DECREF_SET(r, v) do {\
1195
PyObject *tmp = (PyObject *) r;\
1196
r = v; __Pyx_DECREF(tmp);\
1197
} while (0)
1198
#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1199
#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1200
1201
/* RaiseArgTupleInvalid.proto */
1202
static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
1203
Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1204
1205
/* RaiseDoubleKeywords.proto */
1206
static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
1207
1208
/* ParseKeywords.proto */
1209
static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1210
PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1211
const char* function_name);
1212
1213
/* ArgTypeTest.proto */
1214
#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
1215
((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
1216
__Pyx__ArgTypeTest(obj, type, name, exact))
1217
static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);
1218
1219
/* IsLittleEndian.proto */
1220
static CYTHON_INLINE int __Pyx_Is_Little_Endian(void);
1221
1222
/* BufferFormatCheck.proto */
1223
static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts);
1224
static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
1225
__Pyx_BufFmt_StackElem* stack,
1226
__Pyx_TypeInfo* type);
1227
1228
/* BufferGetAndValidate.proto */
1229
#define __Pyx_GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack)\
1230
((obj == Py_None || obj == NULL) ?\
1231
(__Pyx_ZeroBuffer(buf), 0) :\
1232
__Pyx__GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack))
1233
static int __Pyx__GetBufferAndValidate(Py_buffer* buf, PyObject* obj,
1234
__Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack);
1235
static void __Pyx_ZeroBuffer(Py_buffer* buf);
1236
static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info);
1237
static Py_ssize_t __Pyx_minusones[] = { -1, -1, -1, -1, -1, -1, -1, -1 };
1238
static Py_ssize_t __Pyx_zeros[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
1239
1240
/* PyObjectGetAttrStr.proto */
1241
#if CYTHON_USE_TYPE_SLOTS
1242
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1243
#else
1244
#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1245
#endif
1246
1247
/* GetBuiltinName.proto */
1248
static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1249
1250
/* PyDictVersioning.proto */
1251
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1252
#define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
1253
#define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
1254
#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1255
(version_var) = __PYX_GET_DICT_VERSION(dict);\
1256
(cache_var) = (value);
1257
#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1258
static PY_UINT64_T __pyx_dict_version = 0;\
1259
static PyObject *__pyx_dict_cached_value = NULL;\
1260
if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1261
(VAR) = __pyx_dict_cached_value;\
1262
} else {\
1263
(VAR) = __pyx_dict_cached_value = (LOOKUP);\
1264
__pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1265
}\
1266
}
1267
static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1268
static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1269
static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1270
#else
1271
#define __PYX_GET_DICT_VERSION(dict) (0)
1272
#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1273
#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
1274
#endif
1275
1276
/* GetModuleGlobalName.proto */
1277
#if CYTHON_USE_DICT_VERSIONS
1278
#define __Pyx_GetModuleGlobalName(var, name) {\
1279
static PY_UINT64_T __pyx_dict_version = 0;\
1280
static PyObject *__pyx_dict_cached_value = NULL;\
1281
(var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1282
(likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1283
__Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1284
}
1285
#define __Pyx_GetModuleGlobalNameUncached(var, name) {\
1286
PY_UINT64_T __pyx_dict_version;\
1287
PyObject *__pyx_dict_cached_value;\
1288
(var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1289
}
1290
static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1291
#else
1292
#define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1293
#define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1294
static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1295
#endif
1296
1297
/* PyObjectCall.proto */
1298
#if CYTHON_COMPILING_IN_CPYTHON
1299
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1300
#else
1301
#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1302
#endif
1303
1304
/* ExtTypeTest.proto */
1305
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
1306
1307
/* GetItemInt.proto */
1308
#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1309
(__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1310
__Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
1311
(is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
1312
__Pyx_GetItemInt_Generic(o, to_py_func(i))))
1313
#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1314
(__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1315
__Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1316
(PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
1317
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
1318
int wraparound, int boundscheck);
1319
#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1320
(__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1321
__Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1322
(PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
1323
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
1324
int wraparound, int boundscheck);
1325
static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
1326
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
1327
int is_list, int wraparound, int boundscheck);
1328
1329
/* ObjectGetItem.proto */
1330
#if CYTHON_USE_TYPE_SLOTS
1331
static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
1332
#else
1333
#define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key)
1334
#endif
1335
1336
/* PyFunctionFastCall.proto */
1337
#if CYTHON_FAST_PYCALL
1338
#define __Pyx_PyFunction_FastCall(func, args, nargs)\
1339
__Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1340
#if 1 || PY_VERSION_HEX < 0x030600B1
1341
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1342
#else
1343
#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1344
#endif
1345
#define __Pyx_BUILD_ASSERT_EXPR(cond)\
1346
(sizeof(char [1 - 2*!(cond)]) - 1)
1347
#ifndef Py_MEMBER_SIZE
1348
#define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1349
#endif
1350
static size_t __pyx_pyframe_localsplus_offset = 0;
1351
#include "frameobject.h"
1352
#define __Pxy_PyFrame_Initialize_Offsets()\
1353
((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1354
(void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1355
#define __Pyx_PyFrame_GetLocalsplus(frame)\
1356
(assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1357
#endif
1358
1359
/* PyObjectCallMethO.proto */
1360
#if CYTHON_COMPILING_IN_CPYTHON
1361
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1362
#endif
1363
1364
/* PyObjectCallNoArg.proto */
1365
#if CYTHON_COMPILING_IN_CPYTHON
1366
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
1367
#else
1368
#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
1369
#endif
1370
1371
/* PyCFunctionFastCall.proto */
1372
#if CYTHON_FAST_PYCCALL
1373
static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1374
#else
1375
#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
1376
#endif
1377
1378
/* PyObjectCallOneArg.proto */
1379
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1380
1381
/* BufferIndexError.proto */
1382
static void __Pyx_RaiseBufferIndexError(int axis);
1383
1384
#define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0)
1385
#define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1)
1386
/* BufferFallbackError.proto */
1387
static void __Pyx_RaiseBufferFallbackError(void);
1388
1389
/* PyThreadStateGet.proto */
1390
#if CYTHON_FAST_THREAD_STATE
1391
#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
1392
#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
1393
#define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type
1394
#else
1395
#define __Pyx_PyThreadState_declare
1396
#define __Pyx_PyThreadState_assign
1397
#define __Pyx_PyErr_Occurred() PyErr_Occurred()
1398
#endif
1399
1400
/* PyErrFetchRestore.proto */
1401
#if CYTHON_FAST_THREAD_STATE
1402
#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1403
#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1404
#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1405
#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1406
#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1407
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1408
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1409
#if CYTHON_COMPILING_IN_CPYTHON
1410
#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1411
#else
1412
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1413
#endif
1414
#else
1415
#define __Pyx_PyErr_Clear() PyErr_Clear()
1416
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1417
#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
1418
#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
1419
#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
1420
#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
1421
#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
1422
#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
1423
#endif
1424
1425
/* RaiseException.proto */
1426
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1427
1428
/* DictGetItem.proto */
1429
#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
1430
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
1431
#define __Pyx_PyObject_Dict_GetItem(obj, name)\
1432
(likely(PyDict_CheckExact(obj)) ?\
1433
__Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
1434
#else
1435
#define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
1436
#define __Pyx_PyObject_Dict_GetItem(obj, name) PyObject_GetItem(obj, name)
1437
#endif
1438
1439
/* RaiseTooManyValuesToUnpack.proto */
1440
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
1441
1442
/* RaiseNeedMoreValuesToUnpack.proto */
1443
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
1444
1445
/* RaiseNoneIterError.proto */
1446
static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
1447
1448
/* GetTopmostException.proto */
1449
#if CYTHON_USE_EXC_INFO_STACK
1450
static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
1451
#endif
1452
1453
/* SaveResetException.proto */
1454
#if CYTHON_FAST_THREAD_STATE
1455
#define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1456
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1457
#define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1458
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1459
#else
1460
#define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
1461
#define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
1462
#endif
1463
1464
/* PyErrExceptionMatches.proto */
1465
#if CYTHON_FAST_THREAD_STATE
1466
#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1467
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1468
#else
1469
#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
1470
#endif
1471
1472
/* GetException.proto */
1473
#if CYTHON_FAST_THREAD_STATE
1474
#define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
1475
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1476
#else
1477
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1478
#endif
1479
1480
/* TypeImport.proto */
1481
#ifndef __PYX_HAVE_RT_ImportType_proto
1482
#define __PYX_HAVE_RT_ImportType_proto
1483
enum __Pyx_ImportType_CheckSize {
1484
__Pyx_ImportType_CheckSize_Error = 0,
1485
__Pyx_ImportType_CheckSize_Warn = 1,
1486
__Pyx_ImportType_CheckSize_Ignore = 2
1487
};
1488
static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
1489
#endif
1490
1491
/* Import.proto */
1492
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1493
1494
/* CLineInTraceback.proto */
1495
#ifdef CYTHON_CLINE_IN_TRACEBACK
1496
#define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1497
#else
1498
static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
1499
#endif
1500
1501
/* CodeObjectCache.proto */
1502
typedef struct {
1503
PyCodeObject* code_object;
1504
int code_line;
1505
} __Pyx_CodeObjectCacheEntry;
1506
struct __Pyx_CodeObjectCache {
1507
int count;
1508
int max_count;
1509
__Pyx_CodeObjectCacheEntry* entries;
1510
};
1511
static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1512
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
1513
static PyCodeObject *__pyx_find_code_object(int code_line);
1514
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
1515
1516
/* AddTraceback.proto */
1517
static void __Pyx_AddTraceback(const char *funcname, int c_line,
1518
int py_line, const char *filename);
1519
1520
/* BufferStructDeclare.proto */
1521
typedef struct {
1522
Py_ssize_t shape, strides, suboffsets;
1523
} __Pyx_Buf_DimInfo;
1524
typedef struct {
1525
size_t refcount;
1526
Py_buffer pybuffer;
1527
} __Pyx_Buffer;
1528
typedef struct {
1529
__Pyx_Buffer *rcbuffer;
1530
char *data;
1531
__Pyx_Buf_DimInfo diminfo[8];
1532
} __Pyx_LocalBuf_ND;
1533
1534
#if PY_MAJOR_VERSION < 3
1535
static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
1536
static void __Pyx_ReleaseBuffer(Py_buffer *view);
1537
#else
1538
#define __Pyx_GetBuffer PyObject_GetBuffer
1539
#define __Pyx_ReleaseBuffer PyBuffer_Release
1540
#endif
1541
1542
1543
/* CIntToPy.proto */
1544
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
1545
1546
/* RealImag.proto */
1547
#if CYTHON_CCOMPLEX
1548
#ifdef __cplusplus
1549
#define __Pyx_CREAL(z) ((z).real())
1550
#define __Pyx_CIMAG(z) ((z).imag())
1551
#else
1552
#define __Pyx_CREAL(z) (__real__(z))
1553
#define __Pyx_CIMAG(z) (__imag__(z))
1554
#endif
1555
#else
1556
#define __Pyx_CREAL(z) ((z).real)
1557
#define __Pyx_CIMAG(z) ((z).imag)
1558
#endif
1559
#if defined(__cplusplus) && CYTHON_CCOMPLEX\
1560
&& (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103)
1561
#define __Pyx_SET_CREAL(z,x) ((z).real(x))
1562
#define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
1563
#else
1564
#define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
1565
#define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
1566
#endif
1567
1568
/* Arithmetic.proto */
1569
#if CYTHON_CCOMPLEX
1570
#define __Pyx_c_eq_float(a, b) ((a)==(b))
1571
#define __Pyx_c_sum_float(a, b) ((a)+(b))
1572
#define __Pyx_c_diff_float(a, b) ((a)-(b))
1573
#define __Pyx_c_prod_float(a, b) ((a)*(b))
1574
#define __Pyx_c_quot_float(a, b) ((a)/(b))
1575
#define __Pyx_c_neg_float(a) (-(a))
1576
#ifdef __cplusplus
1577
#define __Pyx_c_is_zero_float(z) ((z)==(float)0)
1578
#define __Pyx_c_conj_float(z) (::std::conj(z))
1579
#if 1
1580
#define __Pyx_c_abs_float(z) (::std::abs(z))
1581
#define __Pyx_c_pow_float(a, b) (::std::pow(a, b))
1582
#endif
1583
#else
1584
#define __Pyx_c_is_zero_float(z) ((z)==0)
1585
#define __Pyx_c_conj_float(z) (conjf(z))
1586
#if 1
1587
#define __Pyx_c_abs_float(z) (cabsf(z))
1588
#define __Pyx_c_pow_float(a, b) (cpowf(a, b))
1589
#endif
1590
#endif
1591
#else
1592
static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex);
1593
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex);
1594
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex);
1595
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex);
1596
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex);
1597
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex);
1598
static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex);
1599
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex);
1600
#if 1
1601
static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex);
1602
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex);
1603
#endif
1604
#endif
1605
1606
/* Arithmetic.proto */
1607
#if CYTHON_CCOMPLEX
1608
#define __Pyx_c_eq_double(a, b) ((a)==(b))
1609
#define __Pyx_c_sum_double(a, b) ((a)+(b))
1610
#define __Pyx_c_diff_double(a, b) ((a)-(b))
1611
#define __Pyx_c_prod_double(a, b) ((a)*(b))
1612
#define __Pyx_c_quot_double(a, b) ((a)/(b))
1613
#define __Pyx_c_neg_double(a) (-(a))
1614
#ifdef __cplusplus
1615
#define __Pyx_c_is_zero_double(z) ((z)==(double)0)
1616
#define __Pyx_c_conj_double(z) (::std::conj(z))
1617
#if 1
1618
#define __Pyx_c_abs_double(z) (::std::abs(z))
1619
#define __Pyx_c_pow_double(a, b) (::std::pow(a, b))
1620
#endif
1621
#else
1622
#define __Pyx_c_is_zero_double(z) ((z)==0)
1623
#define __Pyx_c_conj_double(z) (conj(z))
1624
#if 1
1625
#define __Pyx_c_abs_double(z) (cabs(z))
1626
#define __Pyx_c_pow_double(a, b) (cpow(a, b))
1627
#endif
1628
#endif
1629
#else
1630
static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
1631
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
1632
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
1633
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
1634
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
1635
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
1636
static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex);
1637
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
1638
#if 1
1639
static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex);
1640
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
1641
#endif
1642
#endif
1643
1644
/* CIntToPy.proto */
1645
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value);
1646
1647
/* CIntFromPy.proto */
1648
static CYTHON_INLINE npy_int32 __Pyx_PyInt_As_npy_int32(PyObject *);
1649
1650
/* CIntFromPy.proto */
1651
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
1652
1653
/* CIntToPy.proto */
1654
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
1655
1656
/* CIntFromPy.proto */
1657
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
1658
1659
/* FastTypeChecks.proto */
1660
#if CYTHON_COMPILING_IN_CPYTHON
1661
#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1662
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1663
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1664
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1665
#else
1666
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1667
#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1668
#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1669
#endif
1670
#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1671
1672
/* CheckBinaryVersion.proto */
1673
static int __Pyx_check_binary_version(void);
1674
1675
/* InitStrings.proto */
1676
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
1677
1678
1679
/* Module declarations from 'cpython.buffer' */
1680
1681
/* Module declarations from 'libc.string' */
1682
1683
/* Module declarations from 'libc.stdio' */
1684
1685
/* Module declarations from '__builtin__' */
1686
1687
/* Module declarations from 'cpython.type' */
1688
static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
1689
1690
/* Module declarations from 'cpython' */
1691
1692
/* Module declarations from 'cpython.object' */
1693
1694
/* Module declarations from 'cpython.ref' */
1695
1696
/* Module declarations from 'cpython.mem' */
1697
1698
/* Module declarations from 'numpy' */
1699
1700
/* Module declarations from 'numpy' */
1701
static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
1702
static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
1703
static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
1704
static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
1705
static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
1706
static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/
1707
1708
/* Module declarations from 'poly_nms' */
1709
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 };
1710
static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t = { "int32_t", NULL, sizeof(__pyx_t_5numpy_int32_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_5numpy_int32_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_5numpy_int32_t), 0 };
1711
static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int_t = { "int_t", NULL, sizeof(__pyx_t_5numpy_int_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_5numpy_int_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_5numpy_int_t), 0 };
1712
#define __Pyx_MODULE_NAME "poly_nms"
1713
extern int __pyx_module_is_main_poly_nms;
1714
int __pyx_module_is_main_poly_nms = 0;
1715
1716
/* Implementation of 'poly_nms' */
1717
static PyObject *__pyx_builtin_ValueError;
1718
static PyObject *__pyx_builtin_range;
1719
static PyObject *__pyx_builtin_RuntimeError;
1720
static PyObject *__pyx_builtin_ImportError;
1721
static const char __pyx_k_np[] = "np";
1722
static const char __pyx_k_dets[] = "dets";
1723
static const char __pyx_k_keep[] = "keep";
1724
static const char __pyx_k_main[] = "__main__";
1725
static const char __pyx_k_name[] = "__name__";
1726
static const char __pyx_k_test[] = "__test__";
1727
static const char __pyx_k_dtype[] = "dtype";
1728
static const char __pyx_k_int32[] = "int32";
1729
static const char __pyx_k_numpy[] = "numpy";
1730
static const char __pyx_k_order[] = "order";
1731
static const char __pyx_k_range[] = "range";
1732
static const char __pyx_k_zeros[] = "zeros";
1733
static const char __pyx_k_import[] = "__import__";
1734
static const char __pyx_k_scores[] = "scores";
1735
static const char __pyx_k_thresh[] = "thresh";
1736
static const char __pyx_k_argsort[] = "argsort";
1737
static const char __pyx_k_num_out[] = "num_out";
1738
static const char __pyx_k_poly_nms[] = "poly_nms";
1739
static const char __pyx_k_boxes_dim[] = "boxes_dim";
1740
static const char __pyx_k_boxes_num[] = "boxes_num";
1741
static const char __pyx_k_device_id[] = "device_id";
1742
static const char __pyx_k_ValueError[] = "ValueError";
1743
static const char __pyx_k_ImportError[] = "ImportError";
1744
static const char __pyx_k_sorted_dets[] = "sorted_dets";
1745
static const char __pyx_k_RuntimeError[] = "RuntimeError";
1746
static const char __pyx_k_poly_gpu_nms[] = "poly_gpu_nms";
1747
static const char __pyx_k_poly_nms_pyx[] = "poly_nms.pyx";
1748
static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
1749
static const char __pyx_k_ndarray_is_not_C_contiguous[] = "ndarray is not C contiguous";
1750
static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import";
1751
static const char __pyx_k_unknown_dtype_code_in_numpy_pxd[] = "unknown dtype code in numpy.pxd (%d)";
1752
static const char __pyx_k_Format_string_allocated_too_shor[] = "Format string allocated too short, see comment in numpy.pxd";
1753
static const char __pyx_k_Non_native_byte_order_not_suppor[] = "Non-native byte order not supported";
1754
static const char __pyx_k_ndarray_is_not_Fortran_contiguou[] = "ndarray is not Fortran contiguous";
1755
static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import";
1756
static const char __pyx_k_Format_string_allocated_too_shor_2[] = "Format string allocated too short.";
1757
static PyObject *__pyx_kp_u_Format_string_allocated_too_shor;
1758
static PyObject *__pyx_kp_u_Format_string_allocated_too_shor_2;
1759
static PyObject *__pyx_n_s_ImportError;
1760
static PyObject *__pyx_kp_u_Non_native_byte_order_not_suppor;
1761
static PyObject *__pyx_n_s_RuntimeError;
1762
static PyObject *__pyx_n_s_ValueError;
1763
static PyObject *__pyx_n_s_argsort;
1764
static PyObject *__pyx_n_s_boxes_dim;
1765
static PyObject *__pyx_n_s_boxes_num;
1766
static PyObject *__pyx_n_s_cline_in_traceback;
1767
static PyObject *__pyx_n_s_dets;
1768
static PyObject *__pyx_n_s_device_id;
1769
static PyObject *__pyx_n_s_dtype;
1770
static PyObject *__pyx_n_s_import;
1771
static PyObject *__pyx_n_s_int32;
1772
static PyObject *__pyx_n_s_keep;
1773
static PyObject *__pyx_n_s_main;
1774
static PyObject *__pyx_n_s_name;
1775
static PyObject *__pyx_kp_u_ndarray_is_not_C_contiguous;
1776
static PyObject *__pyx_kp_u_ndarray_is_not_Fortran_contiguou;
1777
static PyObject *__pyx_n_s_np;
1778
static PyObject *__pyx_n_s_num_out;
1779
static PyObject *__pyx_n_s_numpy;
1780
static PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to;
1781
static PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor;
1782
static PyObject *__pyx_n_s_order;
1783
static PyObject *__pyx_n_s_poly_gpu_nms;
1784
static PyObject *__pyx_n_s_poly_nms;
1785
static PyObject *__pyx_kp_s_poly_nms_pyx;
1786
static PyObject *__pyx_n_s_range;
1787
static PyObject *__pyx_n_s_scores;
1788
static PyObject *__pyx_n_s_sorted_dets;
1789
static PyObject *__pyx_n_s_test;
1790
static PyObject *__pyx_n_s_thresh;
1791
static PyObject *__pyx_kp_u_unknown_dtype_code_in_numpy_pxd;
1792
static PyObject *__pyx_n_s_zeros;
1793
static PyObject *__pyx_pf_8poly_nms_poly_gpu_nms(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_dets, PyObject *__pyx_v_thresh, __pyx_t_5numpy_int32_t __pyx_v_device_id); /* proto */
1794
static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
1795
static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */
1796
static PyObject *__pyx_int_8;
1797
static PyObject *__pyx_int_neg_1;
1798
static PyObject *__pyx_slice_;
1799
static PyObject *__pyx_slice__3;
1800
static PyObject *__pyx_tuple__2;
1801
static PyObject *__pyx_tuple__4;
1802
static PyObject *__pyx_tuple__5;
1803
static PyObject *__pyx_tuple__6;
1804
static PyObject *__pyx_tuple__7;
1805
static PyObject *__pyx_tuple__8;
1806
static PyObject *__pyx_tuple__9;
1807
static PyObject *__pyx_tuple__10;
1808
static PyObject *__pyx_tuple__11;
1809
static PyObject *__pyx_codeobj__12;
1810
/* Late includes */
1811
1812
/* "poly_nms.pyx":9
1813
* void _poly_nms(np.int32_t*, int*, np.float32_t*, int, int, float, int)
1814
*
1815
* def poly_gpu_nms(np.ndarray[np.float32_t, ndim=2] dets, np.float thresh, # <<<<<<<<<<<<<<
1816
* np.int32_t device_id=0):
1817
* cdef int boxes_num = dets.shape[0]
1818
*/
1819
1820
/* Python wrapper */
1821
static PyObject *__pyx_pw_8poly_nms_1poly_gpu_nms(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
1822
static PyMethodDef __pyx_mdef_8poly_nms_1poly_gpu_nms = {"poly_gpu_nms", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8poly_nms_1poly_gpu_nms, METH_VARARGS|METH_KEYWORDS, 0};
1823
static PyObject *__pyx_pw_8poly_nms_1poly_gpu_nms(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1824
PyArrayObject *__pyx_v_dets = 0;
1825
PyObject *__pyx_v_thresh = 0;
1826
__pyx_t_5numpy_int32_t __pyx_v_device_id;
1827
PyObject *__pyx_r = 0;
1828
__Pyx_RefNannyDeclarations
1829
__Pyx_RefNannySetupContext("poly_gpu_nms (wrapper)", 0);
1830
{
1831
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dets,&__pyx_n_s_thresh,&__pyx_n_s_device_id,0};
1832
PyObject* values[3] = {0,0,0};
1833
if (unlikely(__pyx_kwds)) {
1834
Py_ssize_t kw_args;
1835
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
1836
switch (pos_args) {
1837
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
1838
CYTHON_FALLTHROUGH;
1839
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1840
CYTHON_FALLTHROUGH;
1841
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1842
CYTHON_FALLTHROUGH;
1843
case 0: break;
1844
default: goto __pyx_L5_argtuple_error;
1845
}
1846
kw_args = PyDict_Size(__pyx_kwds);
1847
switch (pos_args) {
1848
case 0:
1849
if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dets)) != 0)) kw_args--;
1850
else goto __pyx_L5_argtuple_error;
1851
CYTHON_FALLTHROUGH;
1852
case 1:
1853
if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_thresh)) != 0)) kw_args--;
1854
else {
1855
__Pyx_RaiseArgtupleInvalid("poly_gpu_nms", 0, 2, 3, 1); __PYX_ERR(0, 9, __pyx_L3_error)
1856
}
1857
CYTHON_FALLTHROUGH;
1858
case 2:
1859
if (kw_args > 0) {
1860
PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_device_id);
1861
if (value) { values[2] = value; kw_args--; }
1862
}
1863
}
1864
if (unlikely(kw_args > 0)) {
1865
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "poly_gpu_nms") < 0)) __PYX_ERR(0, 9, __pyx_L3_error)
1866
}
1867
} else {
1868
switch (PyTuple_GET_SIZE(__pyx_args)) {
1869
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
1870
CYTHON_FALLTHROUGH;
1871
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1872
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1873
break;
1874
default: goto __pyx_L5_argtuple_error;
1875
}
1876
}
1877
__pyx_v_dets = ((PyArrayObject *)values[0]);
1878
__pyx_v_thresh = ((PyObject*)values[1]);
1879
if (values[2]) {
1880
__pyx_v_device_id = __Pyx_PyInt_As_npy_int32(values[2]); if (unlikely((__pyx_v_device_id == ((npy_int32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 10, __pyx_L3_error)
1881
} else {
1882
__pyx_v_device_id = ((__pyx_t_5numpy_int32_t)0);
1883
}
1884
}
1885
goto __pyx_L4_argument_unpacking_done;
1886
__pyx_L5_argtuple_error:;
1887
__Pyx_RaiseArgtupleInvalid("poly_gpu_nms", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 9, __pyx_L3_error)
1888
__pyx_L3_error:;
1889
__Pyx_AddTraceback("poly_nms.poly_gpu_nms", __pyx_clineno, __pyx_lineno, __pyx_filename);
1890
__Pyx_RefNannyFinishContext();
1891
return NULL;
1892
__pyx_L4_argument_unpacking_done:;
1893
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dets), __pyx_ptype_5numpy_ndarray, 1, "dets", 0))) __PYX_ERR(0, 9, __pyx_L1_error)
1894
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_thresh), (&PyFloat_Type), 1, "thresh", 1))) __PYX_ERR(0, 9, __pyx_L1_error)
1895
__pyx_r = __pyx_pf_8poly_nms_poly_gpu_nms(__pyx_self, __pyx_v_dets, __pyx_v_thresh, __pyx_v_device_id);
1896
1897
/* function exit code */
1898
goto __pyx_L0;
1899
__pyx_L1_error:;
1900
__pyx_r = NULL;
1901
__pyx_L0:;
1902
__Pyx_RefNannyFinishContext();
1903
return __pyx_r;
1904
}
1905
1906
static PyObject *__pyx_pf_8poly_nms_poly_gpu_nms(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_dets, PyObject *__pyx_v_thresh, __pyx_t_5numpy_int32_t __pyx_v_device_id) {
1907
int __pyx_v_boxes_num;
1908
int __pyx_v_boxes_dim;
1909
int __pyx_v_num_out;
1910
PyArrayObject *__pyx_v_keep = 0;
1911
PyArrayObject *__pyx_v_scores = 0;
1912
PyArrayObject *__pyx_v_order = 0;
1913
PyArrayObject *__pyx_v_sorted_dets = 0;
1914
__Pyx_LocalBuf_ND __pyx_pybuffernd_dets;
1915
__Pyx_Buffer __pyx_pybuffer_dets;
1916
__Pyx_LocalBuf_ND __pyx_pybuffernd_keep;
1917
__Pyx_Buffer __pyx_pybuffer_keep;
1918
__Pyx_LocalBuf_ND __pyx_pybuffernd_order;
1919
__Pyx_Buffer __pyx_pybuffer_order;
1920
__Pyx_LocalBuf_ND __pyx_pybuffernd_scores;
1921
__Pyx_Buffer __pyx_pybuffer_scores;
1922
__Pyx_LocalBuf_ND __pyx_pybuffernd_sorted_dets;
1923
__Pyx_Buffer __pyx_pybuffer_sorted_dets;
1924
PyObject *__pyx_r = NULL;
1925
__Pyx_RefNannyDeclarations
1926
PyObject *__pyx_t_1 = NULL;
1927
PyObject *__pyx_t_2 = NULL;
1928
PyObject *__pyx_t_3 = NULL;
1929
PyObject *__pyx_t_4 = NULL;
1930
PyObject *__pyx_t_5 = NULL;
1931
PyArrayObject *__pyx_t_6 = NULL;
1932
PyArrayObject *__pyx_t_7 = NULL;
1933
PyArrayObject *__pyx_t_8 = NULL;
1934
PyArrayObject *__pyx_t_9 = NULL;
1935
Py_ssize_t __pyx_t_10;
1936
int __pyx_t_11;
1937
Py_ssize_t __pyx_t_12;
1938
Py_ssize_t __pyx_t_13;
1939
float __pyx_t_14;
1940
PyObject *__pyx_t_15 = NULL;
1941
PyObject *__pyx_t_16 = NULL;
1942
PyObject *__pyx_t_17 = NULL;
1943
__Pyx_RefNannySetupContext("poly_gpu_nms", 0);
1944
__pyx_pybuffer_keep.pybuffer.buf = NULL;
1945
__pyx_pybuffer_keep.refcount = 0;
1946
__pyx_pybuffernd_keep.data = NULL;
1947
__pyx_pybuffernd_keep.rcbuffer = &__pyx_pybuffer_keep;
1948
__pyx_pybuffer_scores.pybuffer.buf = NULL;
1949
__pyx_pybuffer_scores.refcount = 0;
1950
__pyx_pybuffernd_scores.data = NULL;
1951
__pyx_pybuffernd_scores.rcbuffer = &__pyx_pybuffer_scores;
1952
__pyx_pybuffer_order.pybuffer.buf = NULL;
1953
__pyx_pybuffer_order.refcount = 0;
1954
__pyx_pybuffernd_order.data = NULL;
1955
__pyx_pybuffernd_order.rcbuffer = &__pyx_pybuffer_order;
1956
__pyx_pybuffer_sorted_dets.pybuffer.buf = NULL;
1957
__pyx_pybuffer_sorted_dets.refcount = 0;
1958
__pyx_pybuffernd_sorted_dets.data = NULL;
1959
__pyx_pybuffernd_sorted_dets.rcbuffer = &__pyx_pybuffer_sorted_dets;
1960
__pyx_pybuffer_dets.pybuffer.buf = NULL;
1961
__pyx_pybuffer_dets.refcount = 0;
1962
__pyx_pybuffernd_dets.data = NULL;
1963
__pyx_pybuffernd_dets.rcbuffer = &__pyx_pybuffer_dets;
1964
{
1965
__Pyx_BufFmt_StackElem __pyx_stack[1];
1966
if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dets.rcbuffer->pybuffer, (PyObject*)__pyx_v_dets, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 9, __pyx_L1_error)
1967
}
1968
__pyx_pybuffernd_dets.diminfo[0].strides = __pyx_pybuffernd_dets.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dets.diminfo[0].shape = __pyx_pybuffernd_dets.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dets.diminfo[1].strides = __pyx_pybuffernd_dets.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dets.diminfo[1].shape = __pyx_pybuffernd_dets.rcbuffer->pybuffer.shape[1];
1969
1970
/* "poly_nms.pyx":11
1971
* def poly_gpu_nms(np.ndarray[np.float32_t, ndim=2] dets, np.float thresh,
1972
* np.int32_t device_id=0):
1973
* cdef int boxes_num = dets.shape[0] # <<<<<<<<<<<<<<
1974
* cdef int boxes_dim = dets.shape[1]
1975
* cdef int num_out
1976
*/
1977
__pyx_v_boxes_num = (__pyx_v_dets->dimensions[0]);
1978
1979
/* "poly_nms.pyx":12
1980
* np.int32_t device_id=0):
1981
* cdef int boxes_num = dets.shape[0]
1982
* cdef int boxes_dim = dets.shape[1] # <<<<<<<<<<<<<<
1983
* cdef int num_out
1984
* cdef np.ndarray[np.int32_t, ndim=1] \
1985
*/
1986
__pyx_v_boxes_dim = (__pyx_v_dets->dimensions[1]);
1987
1988
/* "poly_nms.pyx":15
1989
* cdef int num_out
1990
* cdef np.ndarray[np.int32_t, ndim=1] \
1991
* keep = np.zeros(boxes_num, dtype=np.int32) # <<<<<<<<<<<<<<
1992
* cdef np.ndarray[np.float32_t, ndim=1] \
1993
* scores = dets[:, 8]
1994
*/
1995
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error)
1996
__Pyx_GOTREF(__pyx_t_1);
1997
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 15, __pyx_L1_error)
1998
__Pyx_GOTREF(__pyx_t_2);
1999
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2000
__pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_boxes_num); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error)
2001
__Pyx_GOTREF(__pyx_t_1);
2002
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 15, __pyx_L1_error)
2003
__Pyx_GOTREF(__pyx_t_3);
2004
__Pyx_GIVEREF(__pyx_t_1);
2005
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
2006
__pyx_t_1 = 0;
2007
__pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error)
2008
__Pyx_GOTREF(__pyx_t_1);
2009
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 15, __pyx_L1_error)
2010
__Pyx_GOTREF(__pyx_t_4);
2011
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_int32); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 15, __pyx_L1_error)
2012
__Pyx_GOTREF(__pyx_t_5);
2013
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2014
if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 15, __pyx_L1_error)
2015
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2016
__pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 15, __pyx_L1_error)
2017
__Pyx_GOTREF(__pyx_t_5);
2018
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2019
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2020
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2021
if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 15, __pyx_L1_error)
2022
__pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
2023
{
2024
__Pyx_BufFmt_StackElem __pyx_stack[1];
2025
if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_keep.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
2026
__pyx_v_keep = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_keep.rcbuffer->pybuffer.buf = NULL;
2027
__PYX_ERR(0, 14, __pyx_L1_error)
2028
} else {__pyx_pybuffernd_keep.diminfo[0].strides = __pyx_pybuffernd_keep.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_keep.diminfo[0].shape = __pyx_pybuffernd_keep.rcbuffer->pybuffer.shape[0];
2029
}
2030
}
2031
__pyx_t_6 = 0;
2032
__pyx_v_keep = ((PyArrayObject *)__pyx_t_5);
2033
__pyx_t_5 = 0;
2034
2035
/* "poly_nms.pyx":17
2036
* keep = np.zeros(boxes_num, dtype=np.int32)
2037
* cdef np.ndarray[np.float32_t, ndim=1] \
2038
* scores = dets[:, 8] # <<<<<<<<<<<<<<
2039
* cdef np.ndarray[np.int_t, ndim=1] \
2040
* order = scores.argsort()[::-1]
2041
*/
2042
__pyx_t_5 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_dets), __pyx_tuple__2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 17, __pyx_L1_error)
2043
__Pyx_GOTREF(__pyx_t_5);
2044
if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 17, __pyx_L1_error)
2045
__pyx_t_7 = ((PyArrayObject *)__pyx_t_5);
2046
{
2047
__Pyx_BufFmt_StackElem __pyx_stack[1];
2048
if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_scores.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
2049
__pyx_v_scores = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_scores.rcbuffer->pybuffer.buf = NULL;
2050
__PYX_ERR(0, 16, __pyx_L1_error)
2051
} else {__pyx_pybuffernd_scores.diminfo[0].strides = __pyx_pybuffernd_scores.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_scores.diminfo[0].shape = __pyx_pybuffernd_scores.rcbuffer->pybuffer.shape[0];
2052
}
2053
}
2054
__pyx_t_7 = 0;
2055
__pyx_v_scores = ((PyArrayObject *)__pyx_t_5);
2056
__pyx_t_5 = 0;
2057
2058
/* "poly_nms.pyx":19
2059
* scores = dets[:, 8]
2060
* cdef np.ndarray[np.int_t, ndim=1] \
2061
* order = scores.argsort()[::-1] # <<<<<<<<<<<<<<
2062
* cdef np.ndarray[np.float32_t, ndim=2] \
2063
* sorted_dets = dets[order, :]
2064
*/
2065
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_scores), __pyx_n_s_argsort); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error)
2066
__Pyx_GOTREF(__pyx_t_1);
2067
__pyx_t_3 = NULL;
2068
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
2069
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
2070
if (likely(__pyx_t_3)) {
2071
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
2072
__Pyx_INCREF(__pyx_t_3);
2073
__Pyx_INCREF(function);
2074
__Pyx_DECREF_SET(__pyx_t_1, function);
2075
}
2076
}
2077
__pyx_t_5 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
2078
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
2079
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 19, __pyx_L1_error)
2080
__Pyx_GOTREF(__pyx_t_5);
2081
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2082
__pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_5, __pyx_slice__3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error)
2083
__Pyx_GOTREF(__pyx_t_1);
2084
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2085
if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 19, __pyx_L1_error)
2086
__pyx_t_8 = ((PyArrayObject *)__pyx_t_1);
2087
{
2088
__Pyx_BufFmt_StackElem __pyx_stack[1];
2089
if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_order.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
2090
__pyx_v_order = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_order.rcbuffer->pybuffer.buf = NULL;
2091
__PYX_ERR(0, 18, __pyx_L1_error)
2092
} else {__pyx_pybuffernd_order.diminfo[0].strides = __pyx_pybuffernd_order.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_order.diminfo[0].shape = __pyx_pybuffernd_order.rcbuffer->pybuffer.shape[0];
2093
}
2094
}
2095
__pyx_t_8 = 0;
2096
__pyx_v_order = ((PyArrayObject *)__pyx_t_1);
2097
__pyx_t_1 = 0;
2098
2099
/* "poly_nms.pyx":21
2100
* order = scores.argsort()[::-1]
2101
* cdef np.ndarray[np.float32_t, ndim=2] \
2102
* sorted_dets = dets[order, :] # <<<<<<<<<<<<<<
2103
* _poly_nms(&keep[0], &num_out, &sorted_dets[0, 0], boxes_num, boxes_dim, thresh, device_id)
2104
* keep = keep[:num_out]
2105
*/
2106
__pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 21, __pyx_L1_error)
2107
__Pyx_GOTREF(__pyx_t_1);
2108
__Pyx_INCREF(((PyObject *)__pyx_v_order));
2109
__Pyx_GIVEREF(((PyObject *)__pyx_v_order));
2110
PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_order));
2111
__Pyx_INCREF(__pyx_slice_);
2112
__Pyx_GIVEREF(__pyx_slice_);
2113
PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_slice_);
2114
__pyx_t_5 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_dets), __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 21, __pyx_L1_error)
2115
__Pyx_GOTREF(__pyx_t_5);
2116
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2117
if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 21, __pyx_L1_error)
2118
__pyx_t_9 = ((PyArrayObject *)__pyx_t_5);
2119
{
2120
__Pyx_BufFmt_StackElem __pyx_stack[1];
2121
if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sorted_dets.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
2122
__pyx_v_sorted_dets = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_sorted_dets.rcbuffer->pybuffer.buf = NULL;
2123
__PYX_ERR(0, 20, __pyx_L1_error)
2124
} else {__pyx_pybuffernd_sorted_dets.diminfo[0].strides = __pyx_pybuffernd_sorted_dets.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_sorted_dets.diminfo[0].shape = __pyx_pybuffernd_sorted_dets.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_sorted_dets.diminfo[1].strides = __pyx_pybuffernd_sorted_dets.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_sorted_dets.diminfo[1].shape = __pyx_pybuffernd_sorted_dets.rcbuffer->pybuffer.shape[1];
2125
}
2126
}
2127
__pyx_t_9 = 0;
2128
__pyx_v_sorted_dets = ((PyArrayObject *)__pyx_t_5);
2129
__pyx_t_5 = 0;
2130
2131
/* "poly_nms.pyx":22
2132
* cdef np.ndarray[np.float32_t, ndim=2] \
2133
* sorted_dets = dets[order, :]
2134
* _poly_nms(&keep[0], &num_out, &sorted_dets[0, 0], boxes_num, boxes_dim, thresh, device_id) # <<<<<<<<<<<<<<
2135
* keep = keep[:num_out]
2136
* return list(order[keep])
2137
*/
2138
__pyx_t_10 = 0;
2139
__pyx_t_11 = -1;
2140
if (__pyx_t_10 < 0) {
2141
__pyx_t_10 += __pyx_pybuffernd_keep.diminfo[0].shape;
2142
if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 0;
2143
} else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_keep.diminfo[0].shape)) __pyx_t_11 = 0;
2144
if (unlikely(__pyx_t_11 != -1)) {
2145
__Pyx_RaiseBufferIndexError(__pyx_t_11);
2146
__PYX_ERR(0, 22, __pyx_L1_error)
2147
}
2148
__pyx_t_12 = 0;
2149
__pyx_t_13 = 0;
2150
__pyx_t_11 = -1;
2151
if (__pyx_t_12 < 0) {
2152
__pyx_t_12 += __pyx_pybuffernd_sorted_dets.diminfo[0].shape;
2153
if (unlikely(__pyx_t_12 < 0)) __pyx_t_11 = 0;
2154
} else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_sorted_dets.diminfo[0].shape)) __pyx_t_11 = 0;
2155
if (__pyx_t_13 < 0) {
2156
__pyx_t_13 += __pyx_pybuffernd_sorted_dets.diminfo[1].shape;
2157
if (unlikely(__pyx_t_13 < 0)) __pyx_t_11 = 1;
2158
} else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_sorted_dets.diminfo[1].shape)) __pyx_t_11 = 1;
2159
if (unlikely(__pyx_t_11 != -1)) {
2160
__Pyx_RaiseBufferIndexError(__pyx_t_11);
2161
__PYX_ERR(0, 22, __pyx_L1_error)
2162
}
2163
__pyx_t_14 = __pyx_PyFloat_AsFloat(__pyx_v_thresh); if (unlikely((__pyx_t_14 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 22, __pyx_L1_error)
2164
_poly_nms((&(*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_keep.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_keep.diminfo[0].strides))), (&__pyx_v_num_out), (&(*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_sorted_dets.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_sorted_dets.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_sorted_dets.diminfo[1].strides))), __pyx_v_boxes_num, __pyx_v_boxes_dim, __pyx_t_14, __pyx_v_device_id);
2165
2166
/* "poly_nms.pyx":23
2167
* sorted_dets = dets[order, :]
2168
* _poly_nms(&keep[0], &num_out, &sorted_dets[0, 0], boxes_num, boxes_dim, thresh, device_id)
2169
* keep = keep[:num_out] # <<<<<<<<<<<<<<
2170
* return list(order[keep])
2171
*/
2172
__pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_num_out); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 23, __pyx_L1_error)
2173
__Pyx_GOTREF(__pyx_t_5);
2174
__pyx_t_1 = PySlice_New(Py_None, __pyx_t_5, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)
2175
__Pyx_GOTREF(__pyx_t_1);
2176
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2177
__pyx_t_5 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_keep), __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 23, __pyx_L1_error)
2178
__Pyx_GOTREF(__pyx_t_5);
2179
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2180
if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 23, __pyx_L1_error)
2181
__pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
2182
{
2183
__Pyx_BufFmt_StackElem __pyx_stack[1];
2184
__Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_keep.rcbuffer->pybuffer);
2185
__pyx_t_11 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_keep.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
2186
if (unlikely(__pyx_t_11 < 0)) {
2187
PyErr_Fetch(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17);
2188
if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_keep.rcbuffer->pybuffer, (PyObject*)__pyx_v_keep, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
2189
Py_XDECREF(__pyx_t_15); Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_17);
2190
__Pyx_RaiseBufferFallbackError();
2191
} else {
2192
PyErr_Restore(__pyx_t_15, __pyx_t_16, __pyx_t_17);
2193
}
2194
__pyx_t_15 = __pyx_t_16 = __pyx_t_17 = 0;
2195
}
2196
__pyx_pybuffernd_keep.diminfo[0].strides = __pyx_pybuffernd_keep.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_keep.diminfo[0].shape = __pyx_pybuffernd_keep.rcbuffer->pybuffer.shape[0];
2197
if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 23, __pyx_L1_error)
2198
}
2199
__pyx_t_6 = 0;
2200
__Pyx_DECREF_SET(__pyx_v_keep, ((PyArrayObject *)__pyx_t_5));
2201
__pyx_t_5 = 0;
2202
2203
/* "poly_nms.pyx":24
2204
* _poly_nms(&keep[0], &num_out, &sorted_dets[0, 0], boxes_num, boxes_dim, thresh, device_id)
2205
* keep = keep[:num_out]
2206
* return list(order[keep]) # <<<<<<<<<<<<<<
2207
*/
2208
__Pyx_XDECREF(__pyx_r);
2209
__pyx_t_5 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_order), ((PyObject *)__pyx_v_keep)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 24, __pyx_L1_error)
2210
__Pyx_GOTREF(__pyx_t_5);
2211
__pyx_t_1 = PySequence_List(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 24, __pyx_L1_error)
2212
__Pyx_GOTREF(__pyx_t_1);
2213
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2214
__pyx_r = __pyx_t_1;
2215
__pyx_t_1 = 0;
2216
goto __pyx_L0;
2217
2218
/* "poly_nms.pyx":9
2219
* void _poly_nms(np.int32_t*, int*, np.float32_t*, int, int, float, int)
2220
*
2221
* def poly_gpu_nms(np.ndarray[np.float32_t, ndim=2] dets, np.float thresh, # <<<<<<<<<<<<<<
2222
* np.int32_t device_id=0):
2223
* cdef int boxes_num = dets.shape[0]
2224
*/
2225
2226
/* function exit code */
2227
__pyx_L1_error:;
2228
__Pyx_XDECREF(__pyx_t_1);
2229
__Pyx_XDECREF(__pyx_t_2);
2230
__Pyx_XDECREF(__pyx_t_3);
2231
__Pyx_XDECREF(__pyx_t_4);
2232
__Pyx_XDECREF(__pyx_t_5);
2233
{ PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
2234
__Pyx_PyThreadState_declare
2235
__Pyx_PyThreadState_assign
2236
__Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
2237
__Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dets.rcbuffer->pybuffer);
2238
__Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_keep.rcbuffer->pybuffer);
2239
__Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_order.rcbuffer->pybuffer);
2240
__Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_scores.rcbuffer->pybuffer);
2241
__Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sorted_dets.rcbuffer->pybuffer);
2242
__Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
2243
__Pyx_AddTraceback("poly_nms.poly_gpu_nms", __pyx_clineno, __pyx_lineno, __pyx_filename);
2244
__pyx_r = NULL;
2245
goto __pyx_L2;
2246
__pyx_L0:;
2247
__Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dets.rcbuffer->pybuffer);
2248
__Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_keep.rcbuffer->pybuffer);
2249
__Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_order.rcbuffer->pybuffer);
2250
__Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_scores.rcbuffer->pybuffer);
2251
__Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sorted_dets.rcbuffer->pybuffer);
2252
__pyx_L2:;
2253
__Pyx_XDECREF((PyObject *)__pyx_v_keep);
2254
__Pyx_XDECREF((PyObject *)__pyx_v_scores);
2255
__Pyx_XDECREF((PyObject *)__pyx_v_order);
2256
__Pyx_XDECREF((PyObject *)__pyx_v_sorted_dets);
2257
__Pyx_XGIVEREF(__pyx_r);
2258
__Pyx_RefNannyFinishContext();
2259
return __pyx_r;
2260
}
2261
2262
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":258
2263
* # experimental exception made for __getbuffer__ and __releasebuffer__
2264
* # -- the details of this may change.
2265
* def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<<
2266
* # This implementation of getbuffer is geared towards Cython
2267
* # requirements, and does not yet fulfill the PEP.
2268
*/
2269
2270
/* Python wrapper */
2271
static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
2272
static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
2273
int __pyx_r;
2274
__Pyx_RefNannyDeclarations
2275
__Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
2276
__pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
2277
2278
/* function exit code */
2279
__Pyx_RefNannyFinishContext();
2280
return __pyx_r;
2281
}
2282
2283
static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
2284
int __pyx_v_i;
2285
int __pyx_v_ndim;
2286
int __pyx_v_endian_detector;
2287
int __pyx_v_little_endian;
2288
int __pyx_v_t;
2289
char *__pyx_v_f;
2290
PyArray_Descr *__pyx_v_descr = 0;
2291
int __pyx_v_offset;
2292
int __pyx_r;
2293
__Pyx_RefNannyDeclarations
2294
int __pyx_t_1;
2295
int __pyx_t_2;
2296
PyObject *__pyx_t_3 = NULL;
2297
int __pyx_t_4;
2298
int __pyx_t_5;
2299
int __pyx_t_6;
2300
PyArray_Descr *__pyx_t_7;
2301
PyObject *__pyx_t_8 = NULL;
2302
char *__pyx_t_9;
2303
if (__pyx_v_info == NULL) {
2304
PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
2305
return -1;
2306
}
2307
__Pyx_RefNannySetupContext("__getbuffer__", 0);
2308
__pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
2309
__Pyx_GIVEREF(__pyx_v_info->obj);
2310
2311
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":265
2312
*
2313
* cdef int i, ndim
2314
* cdef int endian_detector = 1 # <<<<<<<<<<<<<<
2315
* cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
2316
*
2317
*/
2318
__pyx_v_endian_detector = 1;
2319
2320
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":266
2321
* cdef int i, ndim
2322
* cdef int endian_detector = 1
2323
* cdef bint little_endian = ((<char*>&endian_detector)[0] != 0) # <<<<<<<<<<<<<<
2324
*
2325
* ndim = PyArray_NDIM(self)
2326
*/
2327
__pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
2328
2329
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":268
2330
* cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
2331
*
2332
* ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<<
2333
*
2334
* if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
2335
*/
2336
__pyx_v_ndim = PyArray_NDIM(__pyx_v_self);
2337
2338
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":270
2339
* ndim = PyArray_NDIM(self)
2340
*
2341
* if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<<
2342
* and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
2343
* raise ValueError(u"ndarray is not C contiguous")
2344
*/
2345
__pyx_t_2 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0);
2346
if (__pyx_t_2) {
2347
} else {
2348
__pyx_t_1 = __pyx_t_2;
2349
goto __pyx_L4_bool_binop_done;
2350
}
2351
2352
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":271
2353
*
2354
* if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
2355
* and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)): # <<<<<<<<<<<<<<
2356
* raise ValueError(u"ndarray is not C contiguous")
2357
*
2358
*/
2359
__pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_ARRAY_C_CONTIGUOUS) != 0)) != 0);
2360
__pyx_t_1 = __pyx_t_2;
2361
__pyx_L4_bool_binop_done:;
2362
2363
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":270
2364
* ndim = PyArray_NDIM(self)
2365
*
2366
* if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<<
2367
* and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
2368
* raise ValueError(u"ndarray is not C contiguous")
2369
*/
2370
if (unlikely(__pyx_t_1)) {
2371
2372
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":272
2373
* if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
2374
* and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
2375
* raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<<
2376
*
2377
* if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
2378
*/
2379
__pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 272, __pyx_L1_error)
2380
__Pyx_GOTREF(__pyx_t_3);
2381
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
2382
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2383
__PYX_ERR(1, 272, __pyx_L1_error)
2384
2385
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":270
2386
* ndim = PyArray_NDIM(self)
2387
*
2388
* if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<<
2389
* and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
2390
* raise ValueError(u"ndarray is not C contiguous")
2391
*/
2392
}
2393
2394
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":274
2395
* raise ValueError(u"ndarray is not C contiguous")
2396
*
2397
* if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<<
2398
* and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
2399
* raise ValueError(u"ndarray is not Fortran contiguous")
2400
*/
2401
__pyx_t_2 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0);
2402
if (__pyx_t_2) {
2403
} else {
2404
__pyx_t_1 = __pyx_t_2;
2405
goto __pyx_L7_bool_binop_done;
2406
}
2407
2408
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":275
2409
*
2410
* if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
2411
* and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)): # <<<<<<<<<<<<<<
2412
* raise ValueError(u"ndarray is not Fortran contiguous")
2413
*
2414
*/
2415
__pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_ARRAY_F_CONTIGUOUS) != 0)) != 0);
2416
__pyx_t_1 = __pyx_t_2;
2417
__pyx_L7_bool_binop_done:;
2418
2419
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":274
2420
* raise ValueError(u"ndarray is not C contiguous")
2421
*
2422
* if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<<
2423
* and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
2424
* raise ValueError(u"ndarray is not Fortran contiguous")
2425
*/
2426
if (unlikely(__pyx_t_1)) {
2427
2428
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":276
2429
* if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
2430
* and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
2431
* raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<<
2432
*
2433
* info.buf = PyArray_DATA(self)
2434
*/
2435
__pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 276, __pyx_L1_error)
2436
__Pyx_GOTREF(__pyx_t_3);
2437
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
2438
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2439
__PYX_ERR(1, 276, __pyx_L1_error)
2440
2441
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":274
2442
* raise ValueError(u"ndarray is not C contiguous")
2443
*
2444
* if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<<
2445
* and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
2446
* raise ValueError(u"ndarray is not Fortran contiguous")
2447
*/
2448
}
2449
2450
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":278
2451
* raise ValueError(u"ndarray is not Fortran contiguous")
2452
*
2453
* info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<<
2454
* info.ndim = ndim
2455
* if sizeof(npy_intp) != sizeof(Py_ssize_t):
2456
*/
2457
__pyx_v_info->buf = PyArray_DATA(__pyx_v_self);
2458
2459
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":279
2460
*
2461
* info.buf = PyArray_DATA(self)
2462
* info.ndim = ndim # <<<<<<<<<<<<<<
2463
* if sizeof(npy_intp) != sizeof(Py_ssize_t):
2464
* # Allocate new buffer for strides and shape info.
2465
*/
2466
__pyx_v_info->ndim = __pyx_v_ndim;
2467
2468
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":280
2469
* info.buf = PyArray_DATA(self)
2470
* info.ndim = ndim
2471
* if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
2472
* # Allocate new buffer for strides and shape info.
2473
* # This is allocated as one block, strides first.
2474
*/
2475
__pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
2476
if (__pyx_t_1) {
2477
2478
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":283
2479
* # Allocate new buffer for strides and shape info.
2480
* # This is allocated as one block, strides first.
2481
* info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim) # <<<<<<<<<<<<<<
2482
* info.shape = info.strides + ndim
2483
* for i in range(ndim):
2484
*/
2485
__pyx_v_info->strides = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * 2) * ((size_t)__pyx_v_ndim))));
2486
2487
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":284
2488
* # This is allocated as one block, strides first.
2489
* info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim)
2490
* info.shape = info.strides + ndim # <<<<<<<<<<<<<<
2491
* for i in range(ndim):
2492
* info.strides[i] = PyArray_STRIDES(self)[i]
2493
*/
2494
__pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim);
2495
2496
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":285
2497
* info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim)
2498
* info.shape = info.strides + ndim
2499
* for i in range(ndim): # <<<<<<<<<<<<<<
2500
* info.strides[i] = PyArray_STRIDES(self)[i]
2501
* info.shape[i] = PyArray_DIMS(self)[i]
2502
*/
2503
__pyx_t_4 = __pyx_v_ndim;
2504
__pyx_t_5 = __pyx_t_4;
2505
for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
2506
__pyx_v_i = __pyx_t_6;
2507
2508
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":286
2509
* info.shape = info.strides + ndim
2510
* for i in range(ndim):
2511
* info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<<
2512
* info.shape[i] = PyArray_DIMS(self)[i]
2513
* else:
2514
*/
2515
(__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]);
2516
2517
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":287
2518
* for i in range(ndim):
2519
* info.strides[i] = PyArray_STRIDES(self)[i]
2520
* info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<<
2521
* else:
2522
* info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
2523
*/
2524
(__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]);
2525
}
2526
2527
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":280
2528
* info.buf = PyArray_DATA(self)
2529
* info.ndim = ndim
2530
* if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
2531
* # Allocate new buffer for strides and shape info.
2532
* # This is allocated as one block, strides first.
2533
*/
2534
goto __pyx_L9;
2535
}
2536
2537
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":289
2538
* info.shape[i] = PyArray_DIMS(self)[i]
2539
* else:
2540
* info.strides = <Py_ssize_t*>PyArray_STRIDES(self) # <<<<<<<<<<<<<<
2541
* info.shape = <Py_ssize_t*>PyArray_DIMS(self)
2542
* info.suboffsets = NULL
2543
*/
2544
/*else*/ {
2545
__pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self));
2546
2547
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":290
2548
* else:
2549
* info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
2550
* info.shape = <Py_ssize_t*>PyArray_DIMS(self) # <<<<<<<<<<<<<<
2551
* info.suboffsets = NULL
2552
* info.itemsize = PyArray_ITEMSIZE(self)
2553
*/
2554
__pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self));
2555
}
2556
__pyx_L9:;
2557
2558
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":291
2559
* info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
2560
* info.shape = <Py_ssize_t*>PyArray_DIMS(self)
2561
* info.suboffsets = NULL # <<<<<<<<<<<<<<
2562
* info.itemsize = PyArray_ITEMSIZE(self)
2563
* info.readonly = not PyArray_ISWRITEABLE(self)
2564
*/
2565
__pyx_v_info->suboffsets = NULL;
2566
2567
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":292
2568
* info.shape = <Py_ssize_t*>PyArray_DIMS(self)
2569
* info.suboffsets = NULL
2570
* info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<<
2571
* info.readonly = not PyArray_ISWRITEABLE(self)
2572
*
2573
*/
2574
__pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self);
2575
2576
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":293
2577
* info.suboffsets = NULL
2578
* info.itemsize = PyArray_ITEMSIZE(self)
2579
* info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<<
2580
*
2581
* cdef int t
2582
*/
2583
__pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0));
2584
2585
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":296
2586
*
2587
* cdef int t
2588
* cdef char* f = NULL # <<<<<<<<<<<<<<
2589
* cdef dtype descr = <dtype>PyArray_DESCR(self)
2590
* cdef int offset
2591
*/
2592
__pyx_v_f = NULL;
2593
2594
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":297
2595
* cdef int t
2596
* cdef char* f = NULL
2597
* cdef dtype descr = <dtype>PyArray_DESCR(self) # <<<<<<<<<<<<<<
2598
* cdef int offset
2599
*
2600
*/
2601
__pyx_t_7 = PyArray_DESCR(__pyx_v_self);
2602
__pyx_t_3 = ((PyObject *)__pyx_t_7);
2603
__Pyx_INCREF(__pyx_t_3);
2604
__pyx_v_descr = ((PyArray_Descr *)__pyx_t_3);
2605
__pyx_t_3 = 0;
2606
2607
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":300
2608
* cdef int offset
2609
*
2610
* info.obj = self # <<<<<<<<<<<<<<
2611
*
2612
* if not PyDataType_HASFIELDS(descr):
2613
*/
2614
__Pyx_INCREF(((PyObject *)__pyx_v_self));
2615
__Pyx_GIVEREF(((PyObject *)__pyx_v_self));
2616
__Pyx_GOTREF(__pyx_v_info->obj);
2617
__Pyx_DECREF(__pyx_v_info->obj);
2618
__pyx_v_info->obj = ((PyObject *)__pyx_v_self);
2619
2620
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":302
2621
* info.obj = self
2622
*
2623
* if not PyDataType_HASFIELDS(descr): # <<<<<<<<<<<<<<
2624
* t = descr.type_num
2625
* if ((descr.byteorder == c'>' and little_endian) or
2626
*/
2627
__pyx_t_1 = ((!(PyDataType_HASFIELDS(__pyx_v_descr) != 0)) != 0);
2628
if (__pyx_t_1) {
2629
2630
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":303
2631
*
2632
* if not PyDataType_HASFIELDS(descr):
2633
* t = descr.type_num # <<<<<<<<<<<<<<
2634
* if ((descr.byteorder == c'>' and little_endian) or
2635
* (descr.byteorder == c'<' and not little_endian)):
2636
*/
2637
__pyx_t_4 = __pyx_v_descr->type_num;
2638
__pyx_v_t = __pyx_t_4;
2639
2640
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":304
2641
* if not PyDataType_HASFIELDS(descr):
2642
* t = descr.type_num
2643
* if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
2644
* (descr.byteorder == c'<' and not little_endian)):
2645
* raise ValueError(u"Non-native byte order not supported")
2646
*/
2647
__pyx_t_2 = ((__pyx_v_descr->byteorder == '>') != 0);
2648
if (!__pyx_t_2) {
2649
goto __pyx_L15_next_or;
2650
} else {
2651
}
2652
__pyx_t_2 = (__pyx_v_little_endian != 0);
2653
if (!__pyx_t_2) {
2654
} else {
2655
__pyx_t_1 = __pyx_t_2;
2656
goto __pyx_L14_bool_binop_done;
2657
}
2658
__pyx_L15_next_or:;
2659
2660
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":305
2661
* t = descr.type_num
2662
* if ((descr.byteorder == c'>' and little_endian) or
2663
* (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<<
2664
* raise ValueError(u"Non-native byte order not supported")
2665
* if t == NPY_BYTE: f = "b"
2666
*/
2667
__pyx_t_2 = ((__pyx_v_descr->byteorder == '<') != 0);
2668
if (__pyx_t_2) {
2669
} else {
2670
__pyx_t_1 = __pyx_t_2;
2671
goto __pyx_L14_bool_binop_done;
2672
}
2673
__pyx_t_2 = ((!(__pyx_v_little_endian != 0)) != 0);
2674
__pyx_t_1 = __pyx_t_2;
2675
__pyx_L14_bool_binop_done:;
2676
2677
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":304
2678
* if not PyDataType_HASFIELDS(descr):
2679
* t = descr.type_num
2680
* if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
2681
* (descr.byteorder == c'<' and not little_endian)):
2682
* raise ValueError(u"Non-native byte order not supported")
2683
*/
2684
if (unlikely(__pyx_t_1)) {
2685
2686
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":306
2687
* if ((descr.byteorder == c'>' and little_endian) or
2688
* (descr.byteorder == c'<' and not little_endian)):
2689
* raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
2690
* if t == NPY_BYTE: f = "b"
2691
* elif t == NPY_UBYTE: f = "B"
2692
*/
2693
__pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 306, __pyx_L1_error)
2694
__Pyx_GOTREF(__pyx_t_3);
2695
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
2696
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2697
__PYX_ERR(1, 306, __pyx_L1_error)
2698
2699
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":304
2700
* if not PyDataType_HASFIELDS(descr):
2701
* t = descr.type_num
2702
* if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
2703
* (descr.byteorder == c'<' and not little_endian)):
2704
* raise ValueError(u"Non-native byte order not supported")
2705
*/
2706
}
2707
2708
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":307
2709
* (descr.byteorder == c'<' and not little_endian)):
2710
* raise ValueError(u"Non-native byte order not supported")
2711
* if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<<
2712
* elif t == NPY_UBYTE: f = "B"
2713
* elif t == NPY_SHORT: f = "h"
2714
*/
2715
switch (__pyx_v_t) {
2716
case NPY_BYTE:
2717
__pyx_v_f = ((char *)"b");
2718
break;
2719
case NPY_UBYTE:
2720
2721
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":308
2722
* raise ValueError(u"Non-native byte order not supported")
2723
* if t == NPY_BYTE: f = "b"
2724
* elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<<
2725
* elif t == NPY_SHORT: f = "h"
2726
* elif t == NPY_USHORT: f = "H"
2727
*/
2728
__pyx_v_f = ((char *)"B");
2729
break;
2730
case NPY_SHORT:
2731
2732
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":309
2733
* if t == NPY_BYTE: f = "b"
2734
* elif t == NPY_UBYTE: f = "B"
2735
* elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<<
2736
* elif t == NPY_USHORT: f = "H"
2737
* elif t == NPY_INT: f = "i"
2738
*/
2739
__pyx_v_f = ((char *)"h");
2740
break;
2741
case NPY_USHORT:
2742
2743
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":310
2744
* elif t == NPY_UBYTE: f = "B"
2745
* elif t == NPY_SHORT: f = "h"
2746
* elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<<
2747
* elif t == NPY_INT: f = "i"
2748
* elif t == NPY_UINT: f = "I"
2749
*/
2750
__pyx_v_f = ((char *)"H");
2751
break;
2752
case NPY_INT:
2753
2754
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":311
2755
* elif t == NPY_SHORT: f = "h"
2756
* elif t == NPY_USHORT: f = "H"
2757
* elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<<
2758
* elif t == NPY_UINT: f = "I"
2759
* elif t == NPY_LONG: f = "l"
2760
*/
2761
__pyx_v_f = ((char *)"i");
2762
break;
2763
case NPY_UINT:
2764
2765
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":312
2766
* elif t == NPY_USHORT: f = "H"
2767
* elif t == NPY_INT: f = "i"
2768
* elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<<
2769
* elif t == NPY_LONG: f = "l"
2770
* elif t == NPY_ULONG: f = "L"
2771
*/
2772
__pyx_v_f = ((char *)"I");
2773
break;
2774
case NPY_LONG:
2775
2776
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":313
2777
* elif t == NPY_INT: f = "i"
2778
* elif t == NPY_UINT: f = "I"
2779
* elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<<
2780
* elif t == NPY_ULONG: f = "L"
2781
* elif t == NPY_LONGLONG: f = "q"
2782
*/
2783
__pyx_v_f = ((char *)"l");
2784
break;
2785
case NPY_ULONG:
2786
2787
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":314
2788
* elif t == NPY_UINT: f = "I"
2789
* elif t == NPY_LONG: f = "l"
2790
* elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<<
2791
* elif t == NPY_LONGLONG: f = "q"
2792
* elif t == NPY_ULONGLONG: f = "Q"
2793
*/
2794
__pyx_v_f = ((char *)"L");
2795
break;
2796
case NPY_LONGLONG:
2797
2798
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":315
2799
* elif t == NPY_LONG: f = "l"
2800
* elif t == NPY_ULONG: f = "L"
2801
* elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<<
2802
* elif t == NPY_ULONGLONG: f = "Q"
2803
* elif t == NPY_FLOAT: f = "f"
2804
*/
2805
__pyx_v_f = ((char *)"q");
2806
break;
2807
case NPY_ULONGLONG:
2808
2809
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":316
2810
* elif t == NPY_ULONG: f = "L"
2811
* elif t == NPY_LONGLONG: f = "q"
2812
* elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<<
2813
* elif t == NPY_FLOAT: f = "f"
2814
* elif t == NPY_DOUBLE: f = "d"
2815
*/
2816
__pyx_v_f = ((char *)"Q");
2817
break;
2818
case NPY_FLOAT:
2819
2820
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":317
2821
* elif t == NPY_LONGLONG: f = "q"
2822
* elif t == NPY_ULONGLONG: f = "Q"
2823
* elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<<
2824
* elif t == NPY_DOUBLE: f = "d"
2825
* elif t == NPY_LONGDOUBLE: f = "g"
2826
*/
2827
__pyx_v_f = ((char *)"f");
2828
break;
2829
case NPY_DOUBLE:
2830
2831
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":318
2832
* elif t == NPY_ULONGLONG: f = "Q"
2833
* elif t == NPY_FLOAT: f = "f"
2834
* elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<<
2835
* elif t == NPY_LONGDOUBLE: f = "g"
2836
* elif t == NPY_CFLOAT: f = "Zf"
2837
*/
2838
__pyx_v_f = ((char *)"d");
2839
break;
2840
case NPY_LONGDOUBLE:
2841
2842
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":319
2843
* elif t == NPY_FLOAT: f = "f"
2844
* elif t == NPY_DOUBLE: f = "d"
2845
* elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<<
2846
* elif t == NPY_CFLOAT: f = "Zf"
2847
* elif t == NPY_CDOUBLE: f = "Zd"
2848
*/
2849
__pyx_v_f = ((char *)"g");
2850
break;
2851
case NPY_CFLOAT:
2852
2853
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":320
2854
* elif t == NPY_DOUBLE: f = "d"
2855
* elif t == NPY_LONGDOUBLE: f = "g"
2856
* elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<<
2857
* elif t == NPY_CDOUBLE: f = "Zd"
2858
* elif t == NPY_CLONGDOUBLE: f = "Zg"
2859
*/
2860
__pyx_v_f = ((char *)"Zf");
2861
break;
2862
case NPY_CDOUBLE:
2863
2864
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":321
2865
* elif t == NPY_LONGDOUBLE: f = "g"
2866
* elif t == NPY_CFLOAT: f = "Zf"
2867
* elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<<
2868
* elif t == NPY_CLONGDOUBLE: f = "Zg"
2869
* elif t == NPY_OBJECT: f = "O"
2870
*/
2871
__pyx_v_f = ((char *)"Zd");
2872
break;
2873
case NPY_CLONGDOUBLE:
2874
2875
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":322
2876
* elif t == NPY_CFLOAT: f = "Zf"
2877
* elif t == NPY_CDOUBLE: f = "Zd"
2878
* elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<<
2879
* elif t == NPY_OBJECT: f = "O"
2880
* else:
2881
*/
2882
__pyx_v_f = ((char *)"Zg");
2883
break;
2884
case NPY_OBJECT:
2885
2886
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":323
2887
* elif t == NPY_CDOUBLE: f = "Zd"
2888
* elif t == NPY_CLONGDOUBLE: f = "Zg"
2889
* elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<<
2890
* else:
2891
* raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
2892
*/
2893
__pyx_v_f = ((char *)"O");
2894
break;
2895
default:
2896
2897
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":325
2898
* elif t == NPY_OBJECT: f = "O"
2899
* else:
2900
* raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<<
2901
* info.format = f
2902
* return
2903
*/
2904
__pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 325, __pyx_L1_error)
2905
__Pyx_GOTREF(__pyx_t_3);
2906
__pyx_t_8 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 325, __pyx_L1_error)
2907
__Pyx_GOTREF(__pyx_t_8);
2908
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2909
__pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 325, __pyx_L1_error)
2910
__Pyx_GOTREF(__pyx_t_3);
2911
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
2912
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
2913
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2914
__PYX_ERR(1, 325, __pyx_L1_error)
2915
break;
2916
}
2917
2918
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":326
2919
* else:
2920
* raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
2921
* info.format = f # <<<<<<<<<<<<<<
2922
* return
2923
* else:
2924
*/
2925
__pyx_v_info->format = __pyx_v_f;
2926
2927
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":327
2928
* raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
2929
* info.format = f
2930
* return # <<<<<<<<<<<<<<
2931
* else:
2932
* info.format = <char*>PyObject_Malloc(_buffer_format_string_len)
2933
*/
2934
__pyx_r = 0;
2935
goto __pyx_L0;
2936
2937
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":302
2938
* info.obj = self
2939
*
2940
* if not PyDataType_HASFIELDS(descr): # <<<<<<<<<<<<<<
2941
* t = descr.type_num
2942
* if ((descr.byteorder == c'>' and little_endian) or
2943
*/
2944
}
2945
2946
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":329
2947
* return
2948
* else:
2949
* info.format = <char*>PyObject_Malloc(_buffer_format_string_len) # <<<<<<<<<<<<<<
2950
* info.format[0] = c'^' # Native data types, manual alignment
2951
* offset = 0
2952
*/
2953
/*else*/ {
2954
__pyx_v_info->format = ((char *)PyObject_Malloc(0xFF));
2955
2956
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":330
2957
* else:
2958
* info.format = <char*>PyObject_Malloc(_buffer_format_string_len)
2959
* info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<<
2960
* offset = 0
2961
* f = _util_dtypestring(descr, info.format + 1,
2962
*/
2963
(__pyx_v_info->format[0]) = '^';
2964
2965
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":331
2966
* info.format = <char*>PyObject_Malloc(_buffer_format_string_len)
2967
* info.format[0] = c'^' # Native data types, manual alignment
2968
* offset = 0 # <<<<<<<<<<<<<<
2969
* f = _util_dtypestring(descr, info.format + 1,
2970
* info.format + _buffer_format_string_len,
2971
*/
2972
__pyx_v_offset = 0;
2973
2974
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":332
2975
* info.format[0] = c'^' # Native data types, manual alignment
2976
* offset = 0
2977
* f = _util_dtypestring(descr, info.format + 1, # <<<<<<<<<<<<<<
2978
* info.format + _buffer_format_string_len,
2979
* &offset)
2980
*/
2981
__pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 0xFF), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == ((char *)NULL))) __PYX_ERR(1, 332, __pyx_L1_error)
2982
__pyx_v_f = __pyx_t_9;
2983
2984
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":335
2985
* info.format + _buffer_format_string_len,
2986
* &offset)
2987
* f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<<
2988
*
2989
* def __releasebuffer__(ndarray self, Py_buffer* info):
2990
*/
2991
(__pyx_v_f[0]) = '\x00';
2992
}
2993
2994
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":258
2995
* # experimental exception made for __getbuffer__ and __releasebuffer__
2996
* # -- the details of this may change.
2997
* def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<<
2998
* # This implementation of getbuffer is geared towards Cython
2999
* # requirements, and does not yet fulfill the PEP.
3000
*/
3001
3002
/* function exit code */
3003
__pyx_r = 0;
3004
goto __pyx_L0;
3005
__pyx_L1_error:;
3006
__Pyx_XDECREF(__pyx_t_3);
3007
__Pyx_XDECREF(__pyx_t_8);
3008
__Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3009
__pyx_r = -1;
3010
if (__pyx_v_info->obj != NULL) {
3011
__Pyx_GOTREF(__pyx_v_info->obj);
3012
__Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
3013
}
3014
goto __pyx_L2;
3015
__pyx_L0:;
3016
if (__pyx_v_info->obj == Py_None) {
3017
__Pyx_GOTREF(__pyx_v_info->obj);
3018
__Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
3019
}
3020
__pyx_L2:;
3021
__Pyx_XDECREF((PyObject *)__pyx_v_descr);
3022
__Pyx_RefNannyFinishContext();
3023
return __pyx_r;
3024
}
3025
3026
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":337
3027
* f[0] = c'\0' # Terminate format string
3028
*
3029
* def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<<
3030
* if PyArray_HASFIELDS(self):
3031
* PyObject_Free(info.format)
3032
*/
3033
3034
/* Python wrapper */
3035
static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
3036
static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
3037
__Pyx_RefNannyDeclarations
3038
__Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
3039
__pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info));
3040
3041
/* function exit code */
3042
__Pyx_RefNannyFinishContext();
3043
}
3044
3045
static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
3046
__Pyx_RefNannyDeclarations
3047
int __pyx_t_1;
3048
__Pyx_RefNannySetupContext("__releasebuffer__", 0);
3049
3050
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":338
3051
*
3052
* def __releasebuffer__(ndarray self, Py_buffer* info):
3053
* if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<<
3054
* PyObject_Free(info.format)
3055
* if sizeof(npy_intp) != sizeof(Py_ssize_t):
3056
*/
3057
__pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0);
3058
if (__pyx_t_1) {
3059
3060
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":339
3061
* def __releasebuffer__(ndarray self, Py_buffer* info):
3062
* if PyArray_HASFIELDS(self):
3063
* PyObject_Free(info.format) # <<<<<<<<<<<<<<
3064
* if sizeof(npy_intp) != sizeof(Py_ssize_t):
3065
* PyObject_Free(info.strides)
3066
*/
3067
PyObject_Free(__pyx_v_info->format);
3068
3069
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":338
3070
*
3071
* def __releasebuffer__(ndarray self, Py_buffer* info):
3072
* if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<<
3073
* PyObject_Free(info.format)
3074
* if sizeof(npy_intp) != sizeof(Py_ssize_t):
3075
*/
3076
}
3077
3078
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":340
3079
* if PyArray_HASFIELDS(self):
3080
* PyObject_Free(info.format)
3081
* if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
3082
* PyObject_Free(info.strides)
3083
* # info.shape was stored after info.strides in the same block
3084
*/
3085
__pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
3086
if (__pyx_t_1) {
3087
3088
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":341
3089
* PyObject_Free(info.format)
3090
* if sizeof(npy_intp) != sizeof(Py_ssize_t):
3091
* PyObject_Free(info.strides) # <<<<<<<<<<<<<<
3092
* # info.shape was stored after info.strides in the same block
3093
*
3094
*/
3095
PyObject_Free(__pyx_v_info->strides);
3096
3097
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":340
3098
* if PyArray_HASFIELDS(self):
3099
* PyObject_Free(info.format)
3100
* if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
3101
* PyObject_Free(info.strides)
3102
* # info.shape was stored after info.strides in the same block
3103
*/
3104
}
3105
3106
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":337
3107
* f[0] = c'\0' # Terminate format string
3108
*
3109
* def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<<
3110
* if PyArray_HASFIELDS(self):
3111
* PyObject_Free(info.format)
3112
*/
3113
3114
/* function exit code */
3115
__Pyx_RefNannyFinishContext();
3116
}
3117
3118
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":821
3119
* ctypedef npy_cdouble complex_t
3120
*
3121
* cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<<
3122
* return PyArray_MultiIterNew(1, <void*>a)
3123
*
3124
*/
3125
3126
static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
3127
PyObject *__pyx_r = NULL;
3128
__Pyx_RefNannyDeclarations
3129
PyObject *__pyx_t_1 = NULL;
3130
__Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);
3131
3132
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":822
3133
*
3134
* cdef inline object PyArray_MultiIterNew1(a):
3135
* return PyArray_MultiIterNew(1, <void*>a) # <<<<<<<<<<<<<<
3136
*
3137
* cdef inline object PyArray_MultiIterNew2(a, b):
3138
*/
3139
__Pyx_XDECREF(__pyx_r);
3140
__pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 822, __pyx_L1_error)
3141
__Pyx_GOTREF(__pyx_t_1);
3142
__pyx_r = __pyx_t_1;
3143
__pyx_t_1 = 0;
3144
goto __pyx_L0;
3145
3146
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":821
3147
* ctypedef npy_cdouble complex_t
3148
*
3149
* cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<<
3150
* return PyArray_MultiIterNew(1, <void*>a)
3151
*
3152
*/
3153
3154
/* function exit code */
3155
__pyx_L1_error:;
3156
__Pyx_XDECREF(__pyx_t_1);
3157
__Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
3158
__pyx_r = 0;
3159
__pyx_L0:;
3160
__Pyx_XGIVEREF(__pyx_r);
3161
__Pyx_RefNannyFinishContext();
3162
return __pyx_r;
3163
}
3164
3165
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":824
3166
* return PyArray_MultiIterNew(1, <void*>a)
3167
*
3168
* cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<<
3169
* return PyArray_MultiIterNew(2, <void*>a, <void*>b)
3170
*
3171
*/
3172
3173
static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
3174
PyObject *__pyx_r = NULL;
3175
__Pyx_RefNannyDeclarations
3176
PyObject *__pyx_t_1 = NULL;
3177
__Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);
3178
3179
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":825
3180
*
3181
* cdef inline object PyArray_MultiIterNew2(a, b):
3182
* return PyArray_MultiIterNew(2, <void*>a, <void*>b) # <<<<<<<<<<<<<<
3183
*
3184
* cdef inline object PyArray_MultiIterNew3(a, b, c):
3185
*/
3186
__Pyx_XDECREF(__pyx_r);
3187
__pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 825, __pyx_L1_error)
3188
__Pyx_GOTREF(__pyx_t_1);
3189
__pyx_r = __pyx_t_1;
3190
__pyx_t_1 = 0;
3191
goto __pyx_L0;
3192
3193
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":824
3194
* return PyArray_MultiIterNew(1, <void*>a)
3195
*
3196
* cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<<
3197
* return PyArray_MultiIterNew(2, <void*>a, <void*>b)
3198
*
3199
*/
3200
3201
/* function exit code */
3202
__pyx_L1_error:;
3203
__Pyx_XDECREF(__pyx_t_1);
3204
__Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
3205
__pyx_r = 0;
3206
__pyx_L0:;
3207
__Pyx_XGIVEREF(__pyx_r);
3208
__Pyx_RefNannyFinishContext();
3209
return __pyx_r;
3210
}
3211
3212
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":827
3213
* return PyArray_MultiIterNew(2, <void*>a, <void*>b)
3214
*
3215
* cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<<
3216
* return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
3217
*
3218
*/
3219
3220
static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
3221
PyObject *__pyx_r = NULL;
3222
__Pyx_RefNannyDeclarations
3223
PyObject *__pyx_t_1 = NULL;
3224
__Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);
3225
3226
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":828
3227
*
3228
* cdef inline object PyArray_MultiIterNew3(a, b, c):
3229
* return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c) # <<<<<<<<<<<<<<
3230
*
3231
* cdef inline object PyArray_MultiIterNew4(a, b, c, d):
3232
*/
3233
__Pyx_XDECREF(__pyx_r);
3234
__pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 828, __pyx_L1_error)
3235
__Pyx_GOTREF(__pyx_t_1);
3236
__pyx_r = __pyx_t_1;
3237
__pyx_t_1 = 0;
3238
goto __pyx_L0;
3239
3240
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":827
3241
* return PyArray_MultiIterNew(2, <void*>a, <void*>b)
3242
*
3243
* cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<<
3244
* return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
3245
*
3246
*/
3247
3248
/* function exit code */
3249
__pyx_L1_error:;
3250
__Pyx_XDECREF(__pyx_t_1);
3251
__Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
3252
__pyx_r = 0;
3253
__pyx_L0:;
3254
__Pyx_XGIVEREF(__pyx_r);
3255
__Pyx_RefNannyFinishContext();
3256
return __pyx_r;
3257
}
3258
3259
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":830
3260
* return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
3261
*
3262
* cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<<
3263
* return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
3264
*
3265
*/
3266
3267
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) {
3268
PyObject *__pyx_r = NULL;
3269
__Pyx_RefNannyDeclarations
3270
PyObject *__pyx_t_1 = NULL;
3271
__Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);
3272
3273
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":831
3274
*
3275
* cdef inline object PyArray_MultiIterNew4(a, b, c, d):
3276
* return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d) # <<<<<<<<<<<<<<
3277
*
3278
* cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
3279
*/
3280
__Pyx_XDECREF(__pyx_r);
3281
__pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 831, __pyx_L1_error)
3282
__Pyx_GOTREF(__pyx_t_1);
3283
__pyx_r = __pyx_t_1;
3284
__pyx_t_1 = 0;
3285
goto __pyx_L0;
3286
3287
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":830
3288
* return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
3289
*
3290
* cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<<
3291
* return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
3292
*
3293
*/
3294
3295
/* function exit code */
3296
__pyx_L1_error:;
3297
__Pyx_XDECREF(__pyx_t_1);
3298
__Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
3299
__pyx_r = 0;
3300
__pyx_L0:;
3301
__Pyx_XGIVEREF(__pyx_r);
3302
__Pyx_RefNannyFinishContext();
3303
return __pyx_r;
3304
}
3305
3306
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":833
3307
* return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
3308
*
3309
* cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<<
3310
* return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
3311
*
3312
*/
3313
3314
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) {
3315
PyObject *__pyx_r = NULL;
3316
__Pyx_RefNannyDeclarations
3317
PyObject *__pyx_t_1 = NULL;
3318
__Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);
3319
3320
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":834
3321
*
3322
* cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
3323
* return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e) # <<<<<<<<<<<<<<
3324
*
3325
* cdef inline tuple PyDataType_SHAPE(dtype d):
3326
*/
3327
__Pyx_XDECREF(__pyx_r);
3328
__pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 834, __pyx_L1_error)
3329
__Pyx_GOTREF(__pyx_t_1);
3330
__pyx_r = __pyx_t_1;
3331
__pyx_t_1 = 0;
3332
goto __pyx_L0;
3333
3334
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":833
3335
* return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
3336
*
3337
* cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<<
3338
* return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
3339
*
3340
*/
3341
3342
/* function exit code */
3343
__pyx_L1_error:;
3344
__Pyx_XDECREF(__pyx_t_1);
3345
__Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
3346
__pyx_r = 0;
3347
__pyx_L0:;
3348
__Pyx_XGIVEREF(__pyx_r);
3349
__Pyx_RefNannyFinishContext();
3350
return __pyx_r;
3351
}
3352
3353
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":836
3354
* return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
3355
*
3356
* cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<<
3357
* if PyDataType_HASSUBARRAY(d):
3358
* return <tuple>d.subarray.shape
3359
*/
3360
3361
static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) {
3362
PyObject *__pyx_r = NULL;
3363
__Pyx_RefNannyDeclarations
3364
int __pyx_t_1;
3365
__Pyx_RefNannySetupContext("PyDataType_SHAPE", 0);
3366
3367
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":837
3368
*
3369
* cdef inline tuple PyDataType_SHAPE(dtype d):
3370
* if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<<
3371
* return <tuple>d.subarray.shape
3372
* else:
3373
*/
3374
__pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0);
3375
if (__pyx_t_1) {
3376
3377
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":838
3378
* cdef inline tuple PyDataType_SHAPE(dtype d):
3379
* if PyDataType_HASSUBARRAY(d):
3380
* return <tuple>d.subarray.shape # <<<<<<<<<<<<<<
3381
* else:
3382
* return ()
3383
*/
3384
__Pyx_XDECREF(__pyx_r);
3385
__Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape));
3386
__pyx_r = ((PyObject*)__pyx_v_d->subarray->shape);
3387
goto __pyx_L0;
3388
3389
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":837
3390
*
3391
* cdef inline tuple PyDataType_SHAPE(dtype d):
3392
* if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<<
3393
* return <tuple>d.subarray.shape
3394
* else:
3395
*/
3396
}
3397
3398
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":840
3399
* return <tuple>d.subarray.shape
3400
* else:
3401
* return () # <<<<<<<<<<<<<<
3402
*
3403
* cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:
3404
*/
3405
/*else*/ {
3406
__Pyx_XDECREF(__pyx_r);
3407
__Pyx_INCREF(__pyx_empty_tuple);
3408
__pyx_r = __pyx_empty_tuple;
3409
goto __pyx_L0;
3410
}
3411
3412
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":836
3413
* return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
3414
*
3415
* cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<<
3416
* if PyDataType_HASSUBARRAY(d):
3417
* return <tuple>d.subarray.shape
3418
*/
3419
3420
/* function exit code */
3421
__pyx_L0:;
3422
__Pyx_XGIVEREF(__pyx_r);
3423
__Pyx_RefNannyFinishContext();
3424
return __pyx_r;
3425
}
3426
3427
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":842
3428
* return ()
3429
*
3430
* cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<<
3431
* # Recursive utility function used in __getbuffer__ to get format
3432
* # string. The new location in the format string is returned.
3433
*/
3434
3435
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) {
3436
PyArray_Descr *__pyx_v_child = 0;
3437
int __pyx_v_endian_detector;
3438
int __pyx_v_little_endian;
3439
PyObject *__pyx_v_fields = 0;
3440
PyObject *__pyx_v_childname = NULL;
3441
PyObject *__pyx_v_new_offset = NULL;
3442
PyObject *__pyx_v_t = NULL;
3443
char *__pyx_r;
3444
__Pyx_RefNannyDeclarations
3445
PyObject *__pyx_t_1 = NULL;
3446
Py_ssize_t __pyx_t_2;
3447
PyObject *__pyx_t_3 = NULL;
3448
PyObject *__pyx_t_4 = NULL;
3449
int __pyx_t_5;
3450
int __pyx_t_6;
3451
int __pyx_t_7;
3452
long __pyx_t_8;
3453
char *__pyx_t_9;
3454
__Pyx_RefNannySetupContext("_util_dtypestring", 0);
3455
3456
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":847
3457
*
3458
* cdef dtype child
3459
* cdef int endian_detector = 1 # <<<<<<<<<<<<<<
3460
* cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
3461
* cdef tuple fields
3462
*/
3463
__pyx_v_endian_detector = 1;
3464
3465
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":848
3466
* cdef dtype child
3467
* cdef int endian_detector = 1
3468
* cdef bint little_endian = ((<char*>&endian_detector)[0] != 0) # <<<<<<<<<<<<<<
3469
* cdef tuple fields
3470
*
3471
*/
3472
__pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
3473
3474
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":851
3475
* cdef tuple fields
3476
*
3477
* for childname in descr.names: # <<<<<<<<<<<<<<
3478
* fields = descr.fields[childname]
3479
* child, new_offset = fields
3480
*/
3481
if (unlikely(__pyx_v_descr->names == Py_None)) {
3482
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
3483
__PYX_ERR(1, 851, __pyx_L1_error)
3484
}
3485
__pyx_t_1 = __pyx_v_descr->names; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
3486
for (;;) {
3487
if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
3488
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3489
__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_ERR(1, 851, __pyx_L1_error)
3490
#else
3491
__pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 851, __pyx_L1_error)
3492
__Pyx_GOTREF(__pyx_t_3);
3493
#endif
3494
__Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3);
3495
__pyx_t_3 = 0;
3496
3497
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":852
3498
*
3499
* for childname in descr.names:
3500
* fields = descr.fields[childname] # <<<<<<<<<<<<<<
3501
* child, new_offset = fields
3502
*
3503
*/
3504
if (unlikely(__pyx_v_descr->fields == Py_None)) {
3505
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
3506
__PYX_ERR(1, 852, __pyx_L1_error)
3507
}
3508
__pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 852, __pyx_L1_error)
3509
__Pyx_GOTREF(__pyx_t_3);
3510
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_ERR(1, 852, __pyx_L1_error)
3511
__Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3));
3512
__pyx_t_3 = 0;
3513
3514
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":853
3515
* for childname in descr.names:
3516
* fields = descr.fields[childname]
3517
* child, new_offset = fields # <<<<<<<<<<<<<<
3518
*
3519
* if (end - f) - <int>(new_offset - offset[0]) < 15:
3520
*/
3521
if (likely(__pyx_v_fields != Py_None)) {
3522
PyObject* sequence = __pyx_v_fields;
3523
Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
3524
if (unlikely(size != 2)) {
3525
if (size > 2) __Pyx_RaiseTooManyValuesError(2);
3526
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
3527
__PYX_ERR(1, 853, __pyx_L1_error)
3528
}
3529
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3530
__pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
3531
__pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
3532
__Pyx_INCREF(__pyx_t_3);
3533
__Pyx_INCREF(__pyx_t_4);
3534
#else
3535
__pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 853, __pyx_L1_error)
3536
__Pyx_GOTREF(__pyx_t_3);
3537
__pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 853, __pyx_L1_error)
3538
__Pyx_GOTREF(__pyx_t_4);
3539
#endif
3540
} else {
3541
__Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 853, __pyx_L1_error)
3542
}
3543
if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) __PYX_ERR(1, 853, __pyx_L1_error)
3544
__Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3));
3545
__pyx_t_3 = 0;
3546
__Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4);
3547
__pyx_t_4 = 0;
3548
3549
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":855
3550
* child, new_offset = fields
3551
*
3552
* if (end - f) - <int>(new_offset - offset[0]) < 15: # <<<<<<<<<<<<<<
3553
* raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
3554
*
3555
*/
3556
__pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 855, __pyx_L1_error)
3557
__Pyx_GOTREF(__pyx_t_4);
3558
__pyx_t_3 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 855, __pyx_L1_error)
3559
__Pyx_GOTREF(__pyx_t_3);
3560
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3561
__pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 855, __pyx_L1_error)
3562
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3563
__pyx_t_6 = ((((__pyx_v_end - __pyx_v_f) - ((int)__pyx_t_5)) < 15) != 0);
3564
if (unlikely(__pyx_t_6)) {
3565
3566
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":856
3567
*
3568
* if (end - f) - <int>(new_offset - offset[0]) < 15:
3569
* raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<<
3570
*
3571
* if ((child.byteorder == c'>' and little_endian) or
3572
*/
3573
__pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 856, __pyx_L1_error)
3574
__Pyx_GOTREF(__pyx_t_3);
3575
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
3576
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3577
__PYX_ERR(1, 856, __pyx_L1_error)
3578
3579
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":855
3580
* child, new_offset = fields
3581
*
3582
* if (end - f) - <int>(new_offset - offset[0]) < 15: # <<<<<<<<<<<<<<
3583
* raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
3584
*
3585
*/
3586
}
3587
3588
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":858
3589
* raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
3590
*
3591
* if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
3592
* (child.byteorder == c'<' and not little_endian)):
3593
* raise ValueError(u"Non-native byte order not supported")
3594
*/
3595
__pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0);
3596
if (!__pyx_t_7) {
3597
goto __pyx_L8_next_or;
3598
} else {
3599
}
3600
__pyx_t_7 = (__pyx_v_little_endian != 0);
3601
if (!__pyx_t_7) {
3602
} else {
3603
__pyx_t_6 = __pyx_t_7;
3604
goto __pyx_L7_bool_binop_done;
3605
}
3606
__pyx_L8_next_or:;
3607
3608
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":859
3609
*
3610
* if ((child.byteorder == c'>' and little_endian) or
3611
* (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<<
3612
* raise ValueError(u"Non-native byte order not supported")
3613
* # One could encode it in the format string and have Cython
3614
*/
3615
__pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0);
3616
if (__pyx_t_7) {
3617
} else {
3618
__pyx_t_6 = __pyx_t_7;
3619
goto __pyx_L7_bool_binop_done;
3620
}
3621
__pyx_t_7 = ((!(__pyx_v_little_endian != 0)) != 0);
3622
__pyx_t_6 = __pyx_t_7;
3623
__pyx_L7_bool_binop_done:;
3624
3625
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":858
3626
* raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
3627
*
3628
* if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
3629
* (child.byteorder == c'<' and not little_endian)):
3630
* raise ValueError(u"Non-native byte order not supported")
3631
*/
3632
if (unlikely(__pyx_t_6)) {
3633
3634
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":860
3635
* if ((child.byteorder == c'>' and little_endian) or
3636
* (child.byteorder == c'<' and not little_endian)):
3637
* raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
3638
* # One could encode it in the format string and have Cython
3639
* # complain instead, BUT: < and > in format strings also imply
3640
*/
3641
__pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 860, __pyx_L1_error)
3642
__Pyx_GOTREF(__pyx_t_3);
3643
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
3644
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3645
__PYX_ERR(1, 860, __pyx_L1_error)
3646
3647
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":858
3648
* raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
3649
*
3650
* if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
3651
* (child.byteorder == c'<' and not little_endian)):
3652
* raise ValueError(u"Non-native byte order not supported")
3653
*/
3654
}
3655
3656
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":870
3657
*
3658
* # Output padding bytes
3659
* while offset[0] < new_offset: # <<<<<<<<<<<<<<
3660
* f[0] = 120 # "x"; pad byte
3661
* f += 1
3662
*/
3663
while (1) {
3664
__pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 870, __pyx_L1_error)
3665
__Pyx_GOTREF(__pyx_t_3);
3666
__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_ERR(1, 870, __pyx_L1_error)
3667
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3668
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 870, __pyx_L1_error)
3669
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3670
if (!__pyx_t_6) break;
3671
3672
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":871
3673
* # Output padding bytes
3674
* while offset[0] < new_offset:
3675
* f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<<
3676
* f += 1
3677
* offset[0] += 1
3678
*/
3679
(__pyx_v_f[0]) = 0x78;
3680
3681
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":872
3682
* while offset[0] < new_offset:
3683
* f[0] = 120 # "x"; pad byte
3684
* f += 1 # <<<<<<<<<<<<<<
3685
* offset[0] += 1
3686
*
3687
*/
3688
__pyx_v_f = (__pyx_v_f + 1);
3689
3690
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":873
3691
* f[0] = 120 # "x"; pad byte
3692
* f += 1
3693
* offset[0] += 1 # <<<<<<<<<<<<<<
3694
*
3695
* offset[0] += child.itemsize
3696
*/
3697
__pyx_t_8 = 0;
3698
(__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + 1);
3699
}
3700
3701
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":875
3702
* offset[0] += 1
3703
*
3704
* offset[0] += child.itemsize # <<<<<<<<<<<<<<
3705
*
3706
* if not PyDataType_HASFIELDS(child):
3707
*/
3708
__pyx_t_8 = 0;
3709
(__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + __pyx_v_child->elsize);
3710
3711
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":877
3712
* offset[0] += child.itemsize
3713
*
3714
* if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<<
3715
* t = child.type_num
3716
* if end - f < 5:
3717
*/
3718
__pyx_t_6 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0);
3719
if (__pyx_t_6) {
3720
3721
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":878
3722
*
3723
* if not PyDataType_HASFIELDS(child):
3724
* t = child.type_num # <<<<<<<<<<<<<<
3725
* if end - f < 5:
3726
* raise RuntimeError(u"Format string allocated too short.")
3727
*/
3728
__pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 878, __pyx_L1_error)
3729
__Pyx_GOTREF(__pyx_t_4);
3730
__Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4);
3731
__pyx_t_4 = 0;
3732
3733
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":879
3734
* if not PyDataType_HASFIELDS(child):
3735
* t = child.type_num
3736
* if end - f < 5: # <<<<<<<<<<<<<<
3737
* raise RuntimeError(u"Format string allocated too short.")
3738
*
3739
*/
3740
__pyx_t_6 = (((__pyx_v_end - __pyx_v_f) < 5) != 0);
3741
if (unlikely(__pyx_t_6)) {
3742
3743
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":880
3744
* t = child.type_num
3745
* if end - f < 5:
3746
* raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<<
3747
*
3748
* # Until ticket #99 is fixed, use integers to avoid warnings
3749
*/
3750
__pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 880, __pyx_L1_error)
3751
__Pyx_GOTREF(__pyx_t_4);
3752
__Pyx_Raise(__pyx_t_4, 0, 0, 0);
3753
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3754
__PYX_ERR(1, 880, __pyx_L1_error)
3755
3756
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":879
3757
* if not PyDataType_HASFIELDS(child):
3758
* t = child.type_num
3759
* if end - f < 5: # <<<<<<<<<<<<<<
3760
* raise RuntimeError(u"Format string allocated too short.")
3761
*
3762
*/
3763
}
3764
3765
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":883
3766
*
3767
* # Until ticket #99 is fixed, use integers to avoid warnings
3768
* if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<<
3769
* elif t == NPY_UBYTE: f[0] = 66 #"B"
3770
* elif t == NPY_SHORT: f[0] = 104 #"h"
3771
*/
3772
__pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_BYTE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 883, __pyx_L1_error)
3773
__Pyx_GOTREF(__pyx_t_4);
3774
__pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 883, __pyx_L1_error)
3775
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3776
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 883, __pyx_L1_error)
3777
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3778
if (__pyx_t_6) {
3779
(__pyx_v_f[0]) = 98;
3780
goto __pyx_L15;
3781
}
3782
3783
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":884
3784
* # Until ticket #99 is fixed, use integers to avoid warnings
3785
* if t == NPY_BYTE: f[0] = 98 #"b"
3786
* elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<<
3787
* elif t == NPY_SHORT: f[0] = 104 #"h"
3788
* elif t == NPY_USHORT: f[0] = 72 #"H"
3789
*/
3790
__pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UBYTE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 884, __pyx_L1_error)
3791
__Pyx_GOTREF(__pyx_t_3);
3792
__pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 884, __pyx_L1_error)
3793
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3794
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 884, __pyx_L1_error)
3795
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3796
if (__pyx_t_6) {
3797
(__pyx_v_f[0]) = 66;
3798
goto __pyx_L15;
3799
}
3800
3801
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":885
3802
* if t == NPY_BYTE: f[0] = 98 #"b"
3803
* elif t == NPY_UBYTE: f[0] = 66 #"B"
3804
* elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<<
3805
* elif t == NPY_USHORT: f[0] = 72 #"H"
3806
* elif t == NPY_INT: f[0] = 105 #"i"
3807
*/
3808
__pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_SHORT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 885, __pyx_L1_error)
3809
__Pyx_GOTREF(__pyx_t_4);
3810
__pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 885, __pyx_L1_error)
3811
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3812
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 885, __pyx_L1_error)
3813
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3814
if (__pyx_t_6) {
3815
(__pyx_v_f[0]) = 0x68;
3816
goto __pyx_L15;
3817
}
3818
3819
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":886
3820
* elif t == NPY_UBYTE: f[0] = 66 #"B"
3821
* elif t == NPY_SHORT: f[0] = 104 #"h"
3822
* elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<<
3823
* elif t == NPY_INT: f[0] = 105 #"i"
3824
* elif t == NPY_UINT: f[0] = 73 #"I"
3825
*/
3826
__pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_USHORT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 886, __pyx_L1_error)
3827
__Pyx_GOTREF(__pyx_t_3);
3828
__pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 886, __pyx_L1_error)
3829
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3830
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 886, __pyx_L1_error)
3831
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3832
if (__pyx_t_6) {
3833
(__pyx_v_f[0]) = 72;
3834
goto __pyx_L15;
3835
}
3836
3837
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":887
3838
* elif t == NPY_SHORT: f[0] = 104 #"h"
3839
* elif t == NPY_USHORT: f[0] = 72 #"H"
3840
* elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<<
3841
* elif t == NPY_UINT: f[0] = 73 #"I"
3842
* elif t == NPY_LONG: f[0] = 108 #"l"
3843
*/
3844
__pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_INT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 887, __pyx_L1_error)
3845
__Pyx_GOTREF(__pyx_t_4);
3846
__pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 887, __pyx_L1_error)
3847
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3848
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 887, __pyx_L1_error)
3849
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3850
if (__pyx_t_6) {
3851
(__pyx_v_f[0]) = 0x69;
3852
goto __pyx_L15;
3853
}
3854
3855
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":888
3856
* elif t == NPY_USHORT: f[0] = 72 #"H"
3857
* elif t == NPY_INT: f[0] = 105 #"i"
3858
* elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<<
3859
* elif t == NPY_LONG: f[0] = 108 #"l"
3860
* elif t == NPY_ULONG: f[0] = 76 #"L"
3861
*/
3862
__pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UINT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 888, __pyx_L1_error)
3863
__Pyx_GOTREF(__pyx_t_3);
3864
__pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 888, __pyx_L1_error)
3865
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3866
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 888, __pyx_L1_error)
3867
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3868
if (__pyx_t_6) {
3869
(__pyx_v_f[0]) = 73;
3870
goto __pyx_L15;
3871
}
3872
3873
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":889
3874
* elif t == NPY_INT: f[0] = 105 #"i"
3875
* elif t == NPY_UINT: f[0] = 73 #"I"
3876
* elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<<
3877
* elif t == NPY_ULONG: f[0] = 76 #"L"
3878
* elif t == NPY_LONGLONG: f[0] = 113 #"q"
3879
*/
3880
__pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 889, __pyx_L1_error)
3881
__Pyx_GOTREF(__pyx_t_4);
3882
__pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 889, __pyx_L1_error)
3883
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3884
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 889, __pyx_L1_error)
3885
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3886
if (__pyx_t_6) {
3887
(__pyx_v_f[0]) = 0x6C;
3888
goto __pyx_L15;
3889
}
3890
3891
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":890
3892
* elif t == NPY_UINT: f[0] = 73 #"I"
3893
* elif t == NPY_LONG: f[0] = 108 #"l"
3894
* elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<<
3895
* elif t == NPY_LONGLONG: f[0] = 113 #"q"
3896
* elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
3897
*/
3898
__pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 890, __pyx_L1_error)
3899
__Pyx_GOTREF(__pyx_t_3);
3900
__pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 890, __pyx_L1_error)
3901
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3902
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 890, __pyx_L1_error)
3903
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3904
if (__pyx_t_6) {
3905
(__pyx_v_f[0]) = 76;
3906
goto __pyx_L15;
3907
}
3908
3909
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":891
3910
* elif t == NPY_LONG: f[0] = 108 #"l"
3911
* elif t == NPY_ULONG: f[0] = 76 #"L"
3912
* elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<<
3913
* elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
3914
* elif t == NPY_FLOAT: f[0] = 102 #"f"
3915
*/
3916
__pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGLONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 891, __pyx_L1_error)
3917
__Pyx_GOTREF(__pyx_t_4);
3918
__pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 891, __pyx_L1_error)
3919
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3920
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 891, __pyx_L1_error)
3921
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3922
if (__pyx_t_6) {
3923
(__pyx_v_f[0]) = 0x71;
3924
goto __pyx_L15;
3925
}
3926
3927
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":892
3928
* elif t == NPY_ULONG: f[0] = 76 #"L"
3929
* elif t == NPY_LONGLONG: f[0] = 113 #"q"
3930
* elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<<
3931
* elif t == NPY_FLOAT: f[0] = 102 #"f"
3932
* elif t == NPY_DOUBLE: f[0] = 100 #"d"
3933
*/
3934
__pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 892, __pyx_L1_error)
3935
__Pyx_GOTREF(__pyx_t_3);
3936
__pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 892, __pyx_L1_error)
3937
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3938
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 892, __pyx_L1_error)
3939
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3940
if (__pyx_t_6) {
3941
(__pyx_v_f[0]) = 81;
3942
goto __pyx_L15;
3943
}
3944
3945
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":893
3946
* elif t == NPY_LONGLONG: f[0] = 113 #"q"
3947
* elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
3948
* elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<<
3949
* elif t == NPY_DOUBLE: f[0] = 100 #"d"
3950
* elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
3951
*/
3952
__pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_FLOAT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 893, __pyx_L1_error)
3953
__Pyx_GOTREF(__pyx_t_4);
3954
__pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 893, __pyx_L1_error)
3955
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3956
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 893, __pyx_L1_error)
3957
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3958
if (__pyx_t_6) {
3959
(__pyx_v_f[0]) = 0x66;
3960
goto __pyx_L15;
3961
}
3962
3963
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":894
3964
* elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
3965
* elif t == NPY_FLOAT: f[0] = 102 #"f"
3966
* elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<<
3967
* elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
3968
* elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
3969
*/
3970
__pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 894, __pyx_L1_error)
3971
__Pyx_GOTREF(__pyx_t_3);
3972
__pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 894, __pyx_L1_error)
3973
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3974
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 894, __pyx_L1_error)
3975
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3976
if (__pyx_t_6) {
3977
(__pyx_v_f[0]) = 0x64;
3978
goto __pyx_L15;
3979
}
3980
3981
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":895
3982
* elif t == NPY_FLOAT: f[0] = 102 #"f"
3983
* elif t == NPY_DOUBLE: f[0] = 100 #"d"
3984
* elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<<
3985
* elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
3986
* elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
3987
*/
3988
__pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 895, __pyx_L1_error)
3989
__Pyx_GOTREF(__pyx_t_4);
3990
__pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 895, __pyx_L1_error)
3991
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3992
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 895, __pyx_L1_error)
3993
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3994
if (__pyx_t_6) {
3995
(__pyx_v_f[0]) = 0x67;
3996
goto __pyx_L15;
3997
}
3998
3999
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":896
4000
* elif t == NPY_DOUBLE: f[0] = 100 #"d"
4001
* elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
4002
* elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<<
4003
* elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
4004
* elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
4005
*/
4006
__pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 896, __pyx_L1_error)
4007
__Pyx_GOTREF(__pyx_t_3);
4008
__pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 896, __pyx_L1_error)
4009
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4010
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 896, __pyx_L1_error)
4011
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4012
if (__pyx_t_6) {
4013
(__pyx_v_f[0]) = 90;
4014
(__pyx_v_f[1]) = 0x66;
4015
__pyx_v_f = (__pyx_v_f + 1);
4016
goto __pyx_L15;
4017
}
4018
4019
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":897
4020
* elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
4021
* elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
4022
* elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<<
4023
* elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
4024
* elif t == NPY_OBJECT: f[0] = 79 #"O"
4025
*/
4026
__pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 897, __pyx_L1_error)
4027
__Pyx_GOTREF(__pyx_t_4);
4028
__pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 897, __pyx_L1_error)
4029
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4030
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 897, __pyx_L1_error)
4031
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4032
if (__pyx_t_6) {
4033
(__pyx_v_f[0]) = 90;
4034
(__pyx_v_f[1]) = 0x64;
4035
__pyx_v_f = (__pyx_v_f + 1);
4036
goto __pyx_L15;
4037
}
4038
4039
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":898
4040
* elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
4041
* elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
4042
* elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<<
4043
* elif t == NPY_OBJECT: f[0] = 79 #"O"
4044
* else:
4045
*/
4046
__pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 898, __pyx_L1_error)
4047
__Pyx_GOTREF(__pyx_t_3);
4048
__pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 898, __pyx_L1_error)
4049
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4050
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 898, __pyx_L1_error)
4051
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4052
if (__pyx_t_6) {
4053
(__pyx_v_f[0]) = 90;
4054
(__pyx_v_f[1]) = 0x67;
4055
__pyx_v_f = (__pyx_v_f + 1);
4056
goto __pyx_L15;
4057
}
4058
4059
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":899
4060
* elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
4061
* elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
4062
* elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<<
4063
* else:
4064
* raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
4065
*/
4066
__pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_OBJECT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 899, __pyx_L1_error)
4067
__Pyx_GOTREF(__pyx_t_4);
4068
__pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 899, __pyx_L1_error)
4069
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4070
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 899, __pyx_L1_error)
4071
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4072
if (likely(__pyx_t_6)) {
4073
(__pyx_v_f[0]) = 79;
4074
goto __pyx_L15;
4075
}
4076
4077
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":901
4078
* elif t == NPY_OBJECT: f[0] = 79 #"O"
4079
* else:
4080
* raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<<
4081
* f += 1
4082
* else:
4083
*/
4084
/*else*/ {
4085
__pyx_t_3 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 901, __pyx_L1_error)
4086
__Pyx_GOTREF(__pyx_t_3);
4087
__pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 901, __pyx_L1_error)
4088
__Pyx_GOTREF(__pyx_t_4);
4089
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4090
__Pyx_Raise(__pyx_t_4, 0, 0, 0);
4091
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4092
__PYX_ERR(1, 901, __pyx_L1_error)
4093
}
4094
__pyx_L15:;
4095
4096
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":902
4097
* else:
4098
* raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
4099
* f += 1 # <<<<<<<<<<<<<<
4100
* else:
4101
* # Cython ignores struct boundary information ("T{...}"),
4102
*/
4103
__pyx_v_f = (__pyx_v_f + 1);
4104
4105
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":877
4106
* offset[0] += child.itemsize
4107
*
4108
* if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<<
4109
* t = child.type_num
4110
* if end - f < 5:
4111
*/
4112
goto __pyx_L13;
4113
}
4114
4115
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":906
4116
* # Cython ignores struct boundary information ("T{...}"),
4117
* # so don't output it
4118
* f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<<
4119
* return f
4120
*
4121
*/
4122
/*else*/ {
4123
__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 == ((char *)NULL))) __PYX_ERR(1, 906, __pyx_L1_error)
4124
__pyx_v_f = __pyx_t_9;
4125
}
4126
__pyx_L13:;
4127
4128
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":851
4129
* cdef tuple fields
4130
*
4131
* for childname in descr.names: # <<<<<<<<<<<<<<
4132
* fields = descr.fields[childname]
4133
* child, new_offset = fields
4134
*/
4135
}
4136
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4137
4138
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":907
4139
* # so don't output it
4140
* f = _util_dtypestring(child, f, end, offset)
4141
* return f # <<<<<<<<<<<<<<
4142
*
4143
*
4144
*/
4145
__pyx_r = __pyx_v_f;
4146
goto __pyx_L0;
4147
4148
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":842
4149
* return ()
4150
*
4151
* cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<<
4152
* # Recursive utility function used in __getbuffer__ to get format
4153
* # string. The new location in the format string is returned.
4154
*/
4155
4156
/* function exit code */
4157
__pyx_L1_error:;
4158
__Pyx_XDECREF(__pyx_t_1);
4159
__Pyx_XDECREF(__pyx_t_3);
4160
__Pyx_XDECREF(__pyx_t_4);
4161
__Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename);
4162
__pyx_r = NULL;
4163
__pyx_L0:;
4164
__Pyx_XDECREF((PyObject *)__pyx_v_child);
4165
__Pyx_XDECREF(__pyx_v_fields);
4166
__Pyx_XDECREF(__pyx_v_childname);
4167
__Pyx_XDECREF(__pyx_v_new_offset);
4168
__Pyx_XDECREF(__pyx_v_t);
4169
__Pyx_RefNannyFinishContext();
4170
return __pyx_r;
4171
}
4172
4173
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1022
4174
* int _import_umath() except -1
4175
*
4176
* cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<<
4177
* Py_INCREF(base) # important to do this before stealing the reference below!
4178
* PyArray_SetBaseObject(arr, base)
4179
*/
4180
4181
static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
4182
__Pyx_RefNannyDeclarations
4183
__Pyx_RefNannySetupContext("set_array_base", 0);
4184
4185
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1023
4186
*
4187
* cdef inline void set_array_base(ndarray arr, object base):
4188
* Py_INCREF(base) # important to do this before stealing the reference below! # <<<<<<<<<<<<<<
4189
* PyArray_SetBaseObject(arr, base)
4190
*
4191
*/
4192
Py_INCREF(__pyx_v_base);
4193
4194
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1024
4195
* cdef inline void set_array_base(ndarray arr, object base):
4196
* Py_INCREF(base) # important to do this before stealing the reference below!
4197
* PyArray_SetBaseObject(arr, base) # <<<<<<<<<<<<<<
4198
*
4199
* cdef inline object get_array_base(ndarray arr):
4200
*/
4201
(void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base));
4202
4203
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1022
4204
* int _import_umath() except -1
4205
*
4206
* cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<<
4207
* Py_INCREF(base) # important to do this before stealing the reference below!
4208
* PyArray_SetBaseObject(arr, base)
4209
*/
4210
4211
/* function exit code */
4212
__Pyx_RefNannyFinishContext();
4213
}
4214
4215
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1026
4216
* PyArray_SetBaseObject(arr, base)
4217
*
4218
* cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
4219
* base = PyArray_BASE(arr)
4220
* if base is NULL:
4221
*/
4222
4223
static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
4224
PyObject *__pyx_v_base;
4225
PyObject *__pyx_r = NULL;
4226
__Pyx_RefNannyDeclarations
4227
int __pyx_t_1;
4228
__Pyx_RefNannySetupContext("get_array_base", 0);
4229
4230
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1027
4231
*
4232
* cdef inline object get_array_base(ndarray arr):
4233
* base = PyArray_BASE(arr) # <<<<<<<<<<<<<<
4234
* if base is NULL:
4235
* return None
4236
*/
4237
__pyx_v_base = PyArray_BASE(__pyx_v_arr);
4238
4239
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1028
4240
* cdef inline object get_array_base(ndarray arr):
4241
* base = PyArray_BASE(arr)
4242
* if base is NULL: # <<<<<<<<<<<<<<
4243
* return None
4244
* return <object>base
4245
*/
4246
__pyx_t_1 = ((__pyx_v_base == NULL) != 0);
4247
if (__pyx_t_1) {
4248
4249
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1029
4250
* base = PyArray_BASE(arr)
4251
* if base is NULL:
4252
* return None # <<<<<<<<<<<<<<
4253
* return <object>base
4254
*
4255
*/
4256
__Pyx_XDECREF(__pyx_r);
4257
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
4258
goto __pyx_L0;
4259
4260
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1028
4261
* cdef inline object get_array_base(ndarray arr):
4262
* base = PyArray_BASE(arr)
4263
* if base is NULL: # <<<<<<<<<<<<<<
4264
* return None
4265
* return <object>base
4266
*/
4267
}
4268
4269
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1030
4270
* if base is NULL:
4271
* return None
4272
* return <object>base # <<<<<<<<<<<<<<
4273
*
4274
* # Versions of the import_* functions which are more suitable for
4275
*/
4276
__Pyx_XDECREF(__pyx_r);
4277
__Pyx_INCREF(((PyObject *)__pyx_v_base));
4278
__pyx_r = ((PyObject *)__pyx_v_base);
4279
goto __pyx_L0;
4280
4281
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1026
4282
* PyArray_SetBaseObject(arr, base)
4283
*
4284
* cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
4285
* base = PyArray_BASE(arr)
4286
* if base is NULL:
4287
*/
4288
4289
/* function exit code */
4290
__pyx_L0:;
4291
__Pyx_XGIVEREF(__pyx_r);
4292
__Pyx_RefNannyFinishContext();
4293
return __pyx_r;
4294
}
4295
4296
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1034
4297
* # Versions of the import_* functions which are more suitable for
4298
* # Cython code.
4299
* cdef inline int import_array() except -1: # <<<<<<<<<<<<<<
4300
* try:
4301
* _import_array()
4302
*/
4303
4304
static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) {
4305
int __pyx_r;
4306
__Pyx_RefNannyDeclarations
4307
PyObject *__pyx_t_1 = NULL;
4308
PyObject *__pyx_t_2 = NULL;
4309
PyObject *__pyx_t_3 = NULL;
4310
int __pyx_t_4;
4311
PyObject *__pyx_t_5 = NULL;
4312
PyObject *__pyx_t_6 = NULL;
4313
PyObject *__pyx_t_7 = NULL;
4314
PyObject *__pyx_t_8 = NULL;
4315
__Pyx_RefNannySetupContext("import_array", 0);
4316
4317
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1035
4318
* # Cython code.
4319
* cdef inline int import_array() except -1:
4320
* try: # <<<<<<<<<<<<<<
4321
* _import_array()
4322
* except Exception:
4323
*/
4324
{
4325
__Pyx_PyThreadState_declare
4326
__Pyx_PyThreadState_assign
4327
__Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
4328
__Pyx_XGOTREF(__pyx_t_1);
4329
__Pyx_XGOTREF(__pyx_t_2);
4330
__Pyx_XGOTREF(__pyx_t_3);
4331
/*try:*/ {
4332
4333
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1036
4334
* cdef inline int import_array() except -1:
4335
* try:
4336
* _import_array() # <<<<<<<<<<<<<<
4337
* except Exception:
4338
* raise ImportError("numpy.core.multiarray failed to import")
4339
*/
4340
__pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1036, __pyx_L3_error)
4341
4342
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1035
4343
* # Cython code.
4344
* cdef inline int import_array() except -1:
4345
* try: # <<<<<<<<<<<<<<
4346
* _import_array()
4347
* except Exception:
4348
*/
4349
}
4350
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
4351
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
4352
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4353
goto __pyx_L8_try_end;
4354
__pyx_L3_error:;
4355
4356
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1037
4357
* try:
4358
* _import_array()
4359
* except Exception: # <<<<<<<<<<<<<<
4360
* raise ImportError("numpy.core.multiarray failed to import")
4361
*
4362
*/
4363
__pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
4364
if (__pyx_t_4) {
4365
__Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
4366
if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1037, __pyx_L5_except_error)
4367
__Pyx_GOTREF(__pyx_t_5);
4368
__Pyx_GOTREF(__pyx_t_6);
4369
__Pyx_GOTREF(__pyx_t_7);
4370
4371
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1038
4372
* _import_array()
4373
* except Exception:
4374
* raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<<
4375
*
4376
* cdef inline int import_umath() except -1:
4377
*/
4378
__pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1038, __pyx_L5_except_error)
4379
__Pyx_GOTREF(__pyx_t_8);
4380
__Pyx_Raise(__pyx_t_8, 0, 0, 0);
4381
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
4382
__PYX_ERR(1, 1038, __pyx_L5_except_error)
4383
}
4384
goto __pyx_L5_except_error;
4385
__pyx_L5_except_error:;
4386
4387
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1035
4388
* # Cython code.
4389
* cdef inline int import_array() except -1:
4390
* try: # <<<<<<<<<<<<<<
4391
* _import_array()
4392
* except Exception:
4393
*/
4394
__Pyx_XGIVEREF(__pyx_t_1);
4395
__Pyx_XGIVEREF(__pyx_t_2);
4396
__Pyx_XGIVEREF(__pyx_t_3);
4397
__Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
4398
goto __pyx_L1_error;
4399
__pyx_L8_try_end:;
4400
}
4401
4402
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1034
4403
* # Versions of the import_* functions which are more suitable for
4404
* # Cython code.
4405
* cdef inline int import_array() except -1: # <<<<<<<<<<<<<<
4406
* try:
4407
* _import_array()
4408
*/
4409
4410
/* function exit code */
4411
__pyx_r = 0;
4412
goto __pyx_L0;
4413
__pyx_L1_error:;
4414
__Pyx_XDECREF(__pyx_t_5);
4415
__Pyx_XDECREF(__pyx_t_6);
4416
__Pyx_XDECREF(__pyx_t_7);
4417
__Pyx_XDECREF(__pyx_t_8);
4418
__Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
4419
__pyx_r = -1;
4420
__pyx_L0:;
4421
__Pyx_RefNannyFinishContext();
4422
return __pyx_r;
4423
}
4424
4425
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1040
4426
* raise ImportError("numpy.core.multiarray failed to import")
4427
*
4428
* cdef inline int import_umath() except -1: # <<<<<<<<<<<<<<
4429
* try:
4430
* _import_umath()
4431
*/
4432
4433
static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) {
4434
int __pyx_r;
4435
__Pyx_RefNannyDeclarations
4436
PyObject *__pyx_t_1 = NULL;
4437
PyObject *__pyx_t_2 = NULL;
4438
PyObject *__pyx_t_3 = NULL;
4439
int __pyx_t_4;
4440
PyObject *__pyx_t_5 = NULL;
4441
PyObject *__pyx_t_6 = NULL;
4442
PyObject *__pyx_t_7 = NULL;
4443
PyObject *__pyx_t_8 = NULL;
4444
__Pyx_RefNannySetupContext("import_umath", 0);
4445
4446
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1041
4447
*
4448
* cdef inline int import_umath() except -1:
4449
* try: # <<<<<<<<<<<<<<
4450
* _import_umath()
4451
* except Exception:
4452
*/
4453
{
4454
__Pyx_PyThreadState_declare
4455
__Pyx_PyThreadState_assign
4456
__Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
4457
__Pyx_XGOTREF(__pyx_t_1);
4458
__Pyx_XGOTREF(__pyx_t_2);
4459
__Pyx_XGOTREF(__pyx_t_3);
4460
/*try:*/ {
4461
4462
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1042
4463
* cdef inline int import_umath() except -1:
4464
* try:
4465
* _import_umath() # <<<<<<<<<<<<<<
4466
* except Exception:
4467
* raise ImportError("numpy.core.umath failed to import")
4468
*/
4469
__pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1042, __pyx_L3_error)
4470
4471
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1041
4472
*
4473
* cdef inline int import_umath() except -1:
4474
* try: # <<<<<<<<<<<<<<
4475
* _import_umath()
4476
* except Exception:
4477
*/
4478
}
4479
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
4480
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
4481
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4482
goto __pyx_L8_try_end;
4483
__pyx_L3_error:;
4484
4485
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1043
4486
* try:
4487
* _import_umath()
4488
* except Exception: # <<<<<<<<<<<<<<
4489
* raise ImportError("numpy.core.umath failed to import")
4490
*
4491
*/
4492
__pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
4493
if (__pyx_t_4) {
4494
__Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
4495
if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1043, __pyx_L5_except_error)
4496
__Pyx_GOTREF(__pyx_t_5);
4497
__Pyx_GOTREF(__pyx_t_6);
4498
__Pyx_GOTREF(__pyx_t_7);
4499
4500
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1044
4501
* _import_umath()
4502
* except Exception:
4503
* raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
4504
*
4505
* cdef inline int import_ufunc() except -1:
4506
*/
4507
__pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1044, __pyx_L5_except_error)
4508
__Pyx_GOTREF(__pyx_t_8);
4509
__Pyx_Raise(__pyx_t_8, 0, 0, 0);
4510
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
4511
__PYX_ERR(1, 1044, __pyx_L5_except_error)
4512
}
4513
goto __pyx_L5_except_error;
4514
__pyx_L5_except_error:;
4515
4516
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1041
4517
*
4518
* cdef inline int import_umath() except -1:
4519
* try: # <<<<<<<<<<<<<<
4520
* _import_umath()
4521
* except Exception:
4522
*/
4523
__Pyx_XGIVEREF(__pyx_t_1);
4524
__Pyx_XGIVEREF(__pyx_t_2);
4525
__Pyx_XGIVEREF(__pyx_t_3);
4526
__Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
4527
goto __pyx_L1_error;
4528
__pyx_L8_try_end:;
4529
}
4530
4531
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1040
4532
* raise ImportError("numpy.core.multiarray failed to import")
4533
*
4534
* cdef inline int import_umath() except -1: # <<<<<<<<<<<<<<
4535
* try:
4536
* _import_umath()
4537
*/
4538
4539
/* function exit code */
4540
__pyx_r = 0;
4541
goto __pyx_L0;
4542
__pyx_L1_error:;
4543
__Pyx_XDECREF(__pyx_t_5);
4544
__Pyx_XDECREF(__pyx_t_6);
4545
__Pyx_XDECREF(__pyx_t_7);
4546
__Pyx_XDECREF(__pyx_t_8);
4547
__Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
4548
__pyx_r = -1;
4549
__pyx_L0:;
4550
__Pyx_RefNannyFinishContext();
4551
return __pyx_r;
4552
}
4553
4554
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1046
4555
* raise ImportError("numpy.core.umath failed to import")
4556
*
4557
* cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<<
4558
* try:
4559
* _import_umath()
4560
*/
4561
4562
static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) {
4563
int __pyx_r;
4564
__Pyx_RefNannyDeclarations
4565
PyObject *__pyx_t_1 = NULL;
4566
PyObject *__pyx_t_2 = NULL;
4567
PyObject *__pyx_t_3 = NULL;
4568
int __pyx_t_4;
4569
PyObject *__pyx_t_5 = NULL;
4570
PyObject *__pyx_t_6 = NULL;
4571
PyObject *__pyx_t_7 = NULL;
4572
PyObject *__pyx_t_8 = NULL;
4573
__Pyx_RefNannySetupContext("import_ufunc", 0);
4574
4575
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1047
4576
*
4577
* cdef inline int import_ufunc() except -1:
4578
* try: # <<<<<<<<<<<<<<
4579
* _import_umath()
4580
* except Exception:
4581
*/
4582
{
4583
__Pyx_PyThreadState_declare
4584
__Pyx_PyThreadState_assign
4585
__Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
4586
__Pyx_XGOTREF(__pyx_t_1);
4587
__Pyx_XGOTREF(__pyx_t_2);
4588
__Pyx_XGOTREF(__pyx_t_3);
4589
/*try:*/ {
4590
4591
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1048
4592
* cdef inline int import_ufunc() except -1:
4593
* try:
4594
* _import_umath() # <<<<<<<<<<<<<<
4595
* except Exception:
4596
* raise ImportError("numpy.core.umath failed to import")
4597
*/
4598
__pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1048, __pyx_L3_error)
4599
4600
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1047
4601
*
4602
* cdef inline int import_ufunc() except -1:
4603
* try: # <<<<<<<<<<<<<<
4604
* _import_umath()
4605
* except Exception:
4606
*/
4607
}
4608
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
4609
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
4610
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4611
goto __pyx_L8_try_end;
4612
__pyx_L3_error:;
4613
4614
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1049
4615
* try:
4616
* _import_umath()
4617
* except Exception: # <<<<<<<<<<<<<<
4618
* raise ImportError("numpy.core.umath failed to import")
4619
*/
4620
__pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
4621
if (__pyx_t_4) {
4622
__Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
4623
if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1049, __pyx_L5_except_error)
4624
__Pyx_GOTREF(__pyx_t_5);
4625
__Pyx_GOTREF(__pyx_t_6);
4626
__Pyx_GOTREF(__pyx_t_7);
4627
4628
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1050
4629
* _import_umath()
4630
* except Exception:
4631
* raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
4632
*/
4633
__pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1050, __pyx_L5_except_error)
4634
__Pyx_GOTREF(__pyx_t_8);
4635
__Pyx_Raise(__pyx_t_8, 0, 0, 0);
4636
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
4637
__PYX_ERR(1, 1050, __pyx_L5_except_error)
4638
}
4639
goto __pyx_L5_except_error;
4640
__pyx_L5_except_error:;
4641
4642
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1047
4643
*
4644
* cdef inline int import_ufunc() except -1:
4645
* try: # <<<<<<<<<<<<<<
4646
* _import_umath()
4647
* except Exception:
4648
*/
4649
__Pyx_XGIVEREF(__pyx_t_1);
4650
__Pyx_XGIVEREF(__pyx_t_2);
4651
__Pyx_XGIVEREF(__pyx_t_3);
4652
__Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
4653
goto __pyx_L1_error;
4654
__pyx_L8_try_end:;
4655
}
4656
4657
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1046
4658
* raise ImportError("numpy.core.umath failed to import")
4659
*
4660
* cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<<
4661
* try:
4662
* _import_umath()
4663
*/
4664
4665
/* function exit code */
4666
__pyx_r = 0;
4667
goto __pyx_L0;
4668
__pyx_L1_error:;
4669
__Pyx_XDECREF(__pyx_t_5);
4670
__Pyx_XDECREF(__pyx_t_6);
4671
__Pyx_XDECREF(__pyx_t_7);
4672
__Pyx_XDECREF(__pyx_t_8);
4673
__Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
4674
__pyx_r = -1;
4675
__pyx_L0:;
4676
__Pyx_RefNannyFinishContext();
4677
return __pyx_r;
4678
}
4679
4680
static PyMethodDef __pyx_methods[] = {
4681
{0, 0, 0, 0}
4682
};
4683
4684
#if PY_MAJOR_VERSION >= 3
4685
#if CYTHON_PEP489_MULTI_PHASE_INIT
4686
static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
4687
static int __pyx_pymod_exec_poly_nms(PyObject* module); /*proto*/
4688
static PyModuleDef_Slot __pyx_moduledef_slots[] = {
4689
{Py_mod_create, (void*)__pyx_pymod_create},
4690
{Py_mod_exec, (void*)__pyx_pymod_exec_poly_nms},
4691
{0, NULL}
4692
};
4693
#endif
4694
4695
static struct PyModuleDef __pyx_moduledef = {
4696
PyModuleDef_HEAD_INIT,
4697
"poly_nms",
4698
0, /* m_doc */
4699
#if CYTHON_PEP489_MULTI_PHASE_INIT
4700
0, /* m_size */
4701
#else
4702
-1, /* m_size */
4703
#endif
4704
__pyx_methods /* m_methods */,
4705
#if CYTHON_PEP489_MULTI_PHASE_INIT
4706
__pyx_moduledef_slots, /* m_slots */
4707
#else
4708
NULL, /* m_reload */
4709
#endif
4710
NULL, /* m_traverse */
4711
NULL, /* m_clear */
4712
NULL /* m_free */
4713
};
4714
#endif
4715
#ifndef CYTHON_SMALL_CODE
4716
#if defined(__clang__)
4717
#define CYTHON_SMALL_CODE
4718
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
4719
#define CYTHON_SMALL_CODE __attribute__((cold))
4720
#else
4721
#define CYTHON_SMALL_CODE
4722
#endif
4723
#endif
4724
4725
static __Pyx_StringTabEntry __pyx_string_tab[] = {
4726
{&__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},
4727
{&__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},
4728
{&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
4729
{&__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},
4730
{&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
4731
{&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
4732
{&__pyx_n_s_argsort, __pyx_k_argsort, sizeof(__pyx_k_argsort), 0, 0, 1, 1},
4733
{&__pyx_n_s_boxes_dim, __pyx_k_boxes_dim, sizeof(__pyx_k_boxes_dim), 0, 0, 1, 1},
4734
{&__pyx_n_s_boxes_num, __pyx_k_boxes_num, sizeof(__pyx_k_boxes_num), 0, 0, 1, 1},
4735
{&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
4736
{&__pyx_n_s_dets, __pyx_k_dets, sizeof(__pyx_k_dets), 0, 0, 1, 1},
4737
{&__pyx_n_s_device_id, __pyx_k_device_id, sizeof(__pyx_k_device_id), 0, 0, 1, 1},
4738
{&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1},
4739
{&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
4740
{&__pyx_n_s_int32, __pyx_k_int32, sizeof(__pyx_k_int32), 0, 0, 1, 1},
4741
{&__pyx_n_s_keep, __pyx_k_keep, sizeof(__pyx_k_keep), 0, 0, 1, 1},
4742
{&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
4743
{&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
4744
{&__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},
4745
{&__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},
4746
{&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1},
4747
{&__pyx_n_s_num_out, __pyx_k_num_out, sizeof(__pyx_k_num_out), 0, 0, 1, 1},
4748
{&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
4749
{&__pyx_kp_s_numpy_core_multiarray_failed_to, __pyx_k_numpy_core_multiarray_failed_to, sizeof(__pyx_k_numpy_core_multiarray_failed_to), 0, 0, 1, 0},
4750
{&__pyx_kp_s_numpy_core_umath_failed_to_impor, __pyx_k_numpy_core_umath_failed_to_impor, sizeof(__pyx_k_numpy_core_umath_failed_to_impor), 0, 0, 1, 0},
4751
{&__pyx_n_s_order, __pyx_k_order, sizeof(__pyx_k_order), 0, 0, 1, 1},
4752
{&__pyx_n_s_poly_gpu_nms, __pyx_k_poly_gpu_nms, sizeof(__pyx_k_poly_gpu_nms), 0, 0, 1, 1},
4753
{&__pyx_n_s_poly_nms, __pyx_k_poly_nms, sizeof(__pyx_k_poly_nms), 0, 0, 1, 1},
4754
{&__pyx_kp_s_poly_nms_pyx, __pyx_k_poly_nms_pyx, sizeof(__pyx_k_poly_nms_pyx), 0, 0, 1, 0},
4755
{&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
4756
{&__pyx_n_s_scores, __pyx_k_scores, sizeof(__pyx_k_scores), 0, 0, 1, 1},
4757
{&__pyx_n_s_sorted_dets, __pyx_k_sorted_dets, sizeof(__pyx_k_sorted_dets), 0, 0, 1, 1},
4758
{&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
4759
{&__pyx_n_s_thresh, __pyx_k_thresh, sizeof(__pyx_k_thresh), 0, 0, 1, 1},
4760
{&__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},
4761
{&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1},
4762
{0, 0, 0, 0, 0, 0, 0}
4763
};
4764
static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
4765
__pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(1, 272, __pyx_L1_error)
4766
__pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(1, 285, __pyx_L1_error)
4767
__pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(1, 856, __pyx_L1_error)
4768
__pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 1038, __pyx_L1_error)
4769
return 0;
4770
__pyx_L1_error:;
4771
return -1;
4772
}
4773
4774
static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
4775
__Pyx_RefNannyDeclarations
4776
__Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
4777
4778
/* "poly_nms.pyx":17
4779
* keep = np.zeros(boxes_num, dtype=np.int32)
4780
* cdef np.ndarray[np.float32_t, ndim=1] \
4781
* scores = dets[:, 8] # <<<<<<<<<<<<<<
4782
* cdef np.ndarray[np.int_t, ndim=1] \
4783
* order = scores.argsort()[::-1]
4784
*/
4785
__pyx_slice_ = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice_)) __PYX_ERR(0, 17, __pyx_L1_error)
4786
__Pyx_GOTREF(__pyx_slice_);
4787
__Pyx_GIVEREF(__pyx_slice_);
4788
__pyx_tuple__2 = PyTuple_Pack(2, __pyx_slice_, __pyx_int_8); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 17, __pyx_L1_error)
4789
__Pyx_GOTREF(__pyx_tuple__2);
4790
__Pyx_GIVEREF(__pyx_tuple__2);
4791
4792
/* "poly_nms.pyx":19
4793
* scores = dets[:, 8]
4794
* cdef np.ndarray[np.int_t, ndim=1] \
4795
* order = scores.argsort()[::-1] # <<<<<<<<<<<<<<
4796
* cdef np.ndarray[np.float32_t, ndim=2] \
4797
* sorted_dets = dets[order, :]
4798
*/
4799
__pyx_slice__3 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_slice__3)) __PYX_ERR(0, 19, __pyx_L1_error)
4800
__Pyx_GOTREF(__pyx_slice__3);
4801
__Pyx_GIVEREF(__pyx_slice__3);
4802
4803
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":272
4804
* if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
4805
* and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
4806
* raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<<
4807
*
4808
* if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
4809
*/
4810
__pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_C_contiguous); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(1, 272, __pyx_L1_error)
4811
__Pyx_GOTREF(__pyx_tuple__4);
4812
__Pyx_GIVEREF(__pyx_tuple__4);
4813
4814
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":276
4815
* if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
4816
* and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
4817
* raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<<
4818
*
4819
* info.buf = PyArray_DATA(self)
4820
*/
4821
__pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_Fortran_contiguou); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(1, 276, __pyx_L1_error)
4822
__Pyx_GOTREF(__pyx_tuple__5);
4823
__Pyx_GIVEREF(__pyx_tuple__5);
4824
4825
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":306
4826
* if ((descr.byteorder == c'>' and little_endian) or
4827
* (descr.byteorder == c'<' and not little_endian)):
4828
* raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
4829
* if t == NPY_BYTE: f = "b"
4830
* elif t == NPY_UBYTE: f = "B"
4831
*/
4832
__pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(1, 306, __pyx_L1_error)
4833
__Pyx_GOTREF(__pyx_tuple__6);
4834
__Pyx_GIVEREF(__pyx_tuple__6);
4835
4836
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":856
4837
*
4838
* if (end - f) - <int>(new_offset - offset[0]) < 15:
4839
* raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<<
4840
*
4841
* if ((child.byteorder == c'>' and little_endian) or
4842
*/
4843
__pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(1, 856, __pyx_L1_error)
4844
__Pyx_GOTREF(__pyx_tuple__7);
4845
__Pyx_GIVEREF(__pyx_tuple__7);
4846
4847
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":880
4848
* t = child.type_num
4849
* if end - f < 5:
4850
* raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<<
4851
*
4852
* # Until ticket #99 is fixed, use integers to avoid warnings
4853
*/
4854
__pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor_2); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 880, __pyx_L1_error)
4855
__Pyx_GOTREF(__pyx_tuple__8);
4856
__Pyx_GIVEREF(__pyx_tuple__8);
4857
4858
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1038
4859
* _import_array()
4860
* except Exception:
4861
* raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<<
4862
*
4863
* cdef inline int import_umath() except -1:
4864
*/
4865
__pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(1, 1038, __pyx_L1_error)
4866
__Pyx_GOTREF(__pyx_tuple__9);
4867
__Pyx_GIVEREF(__pyx_tuple__9);
4868
4869
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1044
4870
* _import_umath()
4871
* except Exception:
4872
* raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
4873
*
4874
* cdef inline int import_ufunc() except -1:
4875
*/
4876
__pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(1, 1044, __pyx_L1_error)
4877
__Pyx_GOTREF(__pyx_tuple__10);
4878
__Pyx_GIVEREF(__pyx_tuple__10);
4879
4880
/* "poly_nms.pyx":9
4881
* void _poly_nms(np.int32_t*, int*, np.float32_t*, int, int, float, int)
4882
*
4883
* def poly_gpu_nms(np.ndarray[np.float32_t, ndim=2] dets, np.float thresh, # <<<<<<<<<<<<<<
4884
* np.int32_t device_id=0):
4885
* cdef int boxes_num = dets.shape[0]
4886
*/
4887
__pyx_tuple__11 = PyTuple_Pack(10, __pyx_n_s_dets, __pyx_n_s_thresh, __pyx_n_s_device_id, __pyx_n_s_boxes_num, __pyx_n_s_boxes_dim, __pyx_n_s_num_out, __pyx_n_s_keep, __pyx_n_s_scores, __pyx_n_s_order, __pyx_n_s_sorted_dets); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 9, __pyx_L1_error)
4888
__Pyx_GOTREF(__pyx_tuple__11);
4889
__Pyx_GIVEREF(__pyx_tuple__11);
4890
__pyx_codeobj__12 = (PyObject*)__Pyx_PyCode_New(3, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__11, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_poly_nms_pyx, __pyx_n_s_poly_gpu_nms, 9, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__12)) __PYX_ERR(0, 9, __pyx_L1_error)
4891
__Pyx_RefNannyFinishContext();
4892
return 0;
4893
__pyx_L1_error:;
4894
__Pyx_RefNannyFinishContext();
4895
return -1;
4896
}
4897
4898
static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
4899
if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
4900
__pyx_int_8 = PyInt_FromLong(8); if (unlikely(!__pyx_int_8)) __PYX_ERR(0, 1, __pyx_L1_error)
4901
__pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
4902
return 0;
4903
__pyx_L1_error:;
4904
return -1;
4905
}
4906
4907
static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
4908
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
4909
static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
4910
static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
4911
static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
4912
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
4913
static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
4914
4915
static int __Pyx_modinit_global_init_code(void) {
4916
__Pyx_RefNannyDeclarations
4917
__Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
4918
/*--- Global init code ---*/
4919
__Pyx_RefNannyFinishContext();
4920
return 0;
4921
}
4922
4923
static int __Pyx_modinit_variable_export_code(void) {
4924
__Pyx_RefNannyDeclarations
4925
__Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
4926
/*--- Variable export code ---*/
4927
__Pyx_RefNannyFinishContext();
4928
return 0;
4929
}
4930
4931
static int __Pyx_modinit_function_export_code(void) {
4932
__Pyx_RefNannyDeclarations
4933
__Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
4934
/*--- Function export code ---*/
4935
__Pyx_RefNannyFinishContext();
4936
return 0;
4937
}
4938
4939
static int __Pyx_modinit_type_init_code(void) {
4940
__Pyx_RefNannyDeclarations
4941
__Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
4942
/*--- Type init code ---*/
4943
__Pyx_RefNannyFinishContext();
4944
return 0;
4945
}
4946
4947
static int __Pyx_modinit_type_import_code(void) {
4948
__Pyx_RefNannyDeclarations
4949
PyObject *__pyx_t_1 = NULL;
4950
__Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
4951
/*--- Type import code ---*/
4952
__pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 9, __pyx_L1_error)
4953
__Pyx_GOTREF(__pyx_t_1);
4954
__pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type",
4955
#if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
4956
sizeof(PyTypeObject),
4957
#else
4958
sizeof(PyHeapTypeObject),
4959
#endif
4960
__Pyx_ImportType_CheckSize_Warn);
4961
if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(2, 9, __pyx_L1_error)
4962
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4963
__pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 206, __pyx_L1_error)
4964
__Pyx_GOTREF(__pyx_t_1);
4965
__pyx_ptype_5numpy_dtype = __Pyx_ImportType(__pyx_t_1, "numpy", "dtype", sizeof(PyArray_Descr), __Pyx_ImportType_CheckSize_Ignore);
4966
if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(1, 206, __pyx_L1_error)
4967
__pyx_ptype_5numpy_flatiter = __Pyx_ImportType(__pyx_t_1, "numpy", "flatiter", sizeof(PyArrayIterObject), __Pyx_ImportType_CheckSize_Warn);
4968
if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(1, 229, __pyx_L1_error)
4969
__pyx_ptype_5numpy_broadcast = __Pyx_ImportType(__pyx_t_1, "numpy", "broadcast", sizeof(PyArrayMultiIterObject), __Pyx_ImportType_CheckSize_Warn);
4970
if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(1, 233, __pyx_L1_error)
4971
__pyx_ptype_5numpy_ndarray = __Pyx_ImportType(__pyx_t_1, "numpy", "ndarray", sizeof(PyArrayObject), __Pyx_ImportType_CheckSize_Ignore);
4972
if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(1, 242, __pyx_L1_error)
4973
__pyx_ptype_5numpy_ufunc = __Pyx_ImportType(__pyx_t_1, "numpy", "ufunc", sizeof(PyUFuncObject), __Pyx_ImportType_CheckSize_Warn);
4974
if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(1, 918, __pyx_L1_error)
4975
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4976
__Pyx_RefNannyFinishContext();
4977
return 0;
4978
__pyx_L1_error:;
4979
__Pyx_XDECREF(__pyx_t_1);
4980
__Pyx_RefNannyFinishContext();
4981
return -1;
4982
}
4983
4984
static int __Pyx_modinit_variable_import_code(void) {
4985
__Pyx_RefNannyDeclarations
4986
__Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
4987
/*--- Variable import code ---*/
4988
__Pyx_RefNannyFinishContext();
4989
return 0;
4990
}
4991
4992
static int __Pyx_modinit_function_import_code(void) {
4993
__Pyx_RefNannyDeclarations
4994
__Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
4995
/*--- Function import code ---*/
4996
__Pyx_RefNannyFinishContext();
4997
return 0;
4998
}
4999
5000
5001
#if PY_MAJOR_VERSION < 3
5002
#ifdef CYTHON_NO_PYINIT_EXPORT
5003
#define __Pyx_PyMODINIT_FUNC void
5004
#else
5005
#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
5006
#endif
5007
#else
5008
#ifdef CYTHON_NO_PYINIT_EXPORT
5009
#define __Pyx_PyMODINIT_FUNC PyObject *
5010
#else
5011
#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
5012
#endif
5013
#endif
5014
5015
5016
#if PY_MAJOR_VERSION < 3
5017
__Pyx_PyMODINIT_FUNC initpoly_nms(void) CYTHON_SMALL_CODE; /*proto*/
5018
__Pyx_PyMODINIT_FUNC initpoly_nms(void)
5019
#else
5020
__Pyx_PyMODINIT_FUNC PyInit_poly_nms(void) CYTHON_SMALL_CODE; /*proto*/
5021
__Pyx_PyMODINIT_FUNC PyInit_poly_nms(void)
5022
#if CYTHON_PEP489_MULTI_PHASE_INIT
5023
{
5024
return PyModuleDef_Init(&__pyx_moduledef);
5025
}
5026
static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
5027
#if PY_VERSION_HEX >= 0x030700A1
5028
static PY_INT64_T main_interpreter_id = -1;
5029
PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
5030
if (main_interpreter_id == -1) {
5031
main_interpreter_id = current_id;
5032
return (unlikely(current_id == -1)) ? -1 : 0;
5033
} else if (unlikely(main_interpreter_id != current_id))
5034
#else
5035
static PyInterpreterState *main_interpreter = NULL;
5036
PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
5037
if (!main_interpreter) {
5038
main_interpreter = current_interpreter;
5039
} else if (unlikely(main_interpreter != current_interpreter))
5040
#endif
5041
{
5042
PyErr_SetString(
5043
PyExc_ImportError,
5044
"Interpreter change detected - this module can only be loaded into one interpreter per process.");
5045
return -1;
5046
}
5047
return 0;
5048
}
5049
static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) {
5050
PyObject *value = PyObject_GetAttrString(spec, from_name);
5051
int result = 0;
5052
if (likely(value)) {
5053
if (allow_none || value != Py_None) {
5054
result = PyDict_SetItemString(moddict, to_name, value);
5055
}
5056
Py_DECREF(value);
5057
} else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
5058
PyErr_Clear();
5059
} else {
5060
result = -1;
5061
}
5062
return result;
5063
}
5064
static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
5065
PyObject *module = NULL, *moddict, *modname;
5066
if (__Pyx_check_single_interpreter())
5067
return NULL;
5068
if (__pyx_m)
5069
return __Pyx_NewRef(__pyx_m);
5070
modname = PyObject_GetAttrString(spec, "name");
5071
if (unlikely(!modname)) goto bad;
5072
module = PyModule_NewObject(modname);
5073
Py_DECREF(modname);
5074
if (unlikely(!module)) goto bad;
5075
moddict = PyModule_GetDict(module);
5076
if (unlikely(!moddict)) goto bad;
5077
if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
5078
if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
5079
if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
5080
if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
5081
return module;
5082
bad:
5083
Py_XDECREF(module);
5084
return NULL;
5085
}
5086
5087
5088
static CYTHON_SMALL_CODE int __pyx_pymod_exec_poly_nms(PyObject *__pyx_pyinit_module)
5089
#endif
5090
#endif
5091
{
5092
PyObject *__pyx_t_1 = NULL;
5093
__Pyx_RefNannyDeclarations
5094
#if CYTHON_PEP489_MULTI_PHASE_INIT
5095
if (__pyx_m) {
5096
if (__pyx_m == __pyx_pyinit_module) return 0;
5097
PyErr_SetString(PyExc_RuntimeError, "Module 'poly_nms' has already been imported. Re-initialisation is not supported.");
5098
return -1;
5099
}
5100
#elif PY_MAJOR_VERSION >= 3
5101
if (__pyx_m) return __Pyx_NewRef(__pyx_m);
5102
#endif
5103
#if CYTHON_REFNANNY
5104
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
5105
if (!__Pyx_RefNanny) {
5106
PyErr_Clear();
5107
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
5108
if (!__Pyx_RefNanny)
5109
Py_FatalError("failed to import 'refnanny' module");
5110
}
5111
#endif
5112
__Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_poly_nms(void)", 0);
5113
if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5114
#ifdef __Pxy_PyFrame_Initialize_Offsets
5115
__Pxy_PyFrame_Initialize_Offsets();
5116
#endif
5117
__pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
5118
__pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
5119
__pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
5120
#ifdef __Pyx_CyFunction_USED
5121
if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5122
#endif
5123
#ifdef __Pyx_FusedFunction_USED
5124
if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5125
#endif
5126
#ifdef __Pyx_Coroutine_USED
5127
if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5128
#endif
5129
#ifdef __Pyx_Generator_USED
5130
if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5131
#endif
5132
#ifdef __Pyx_AsyncGen_USED
5133
if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5134
#endif
5135
#ifdef __Pyx_StopAsyncIteration_USED
5136
if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5137
#endif
5138
/*--- Library function declarations ---*/
5139
/*--- Threads initialization code ---*/
5140
#if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
5141
#ifdef WITH_THREAD /* Python build with threading support? */
5142
PyEval_InitThreads();
5143
#endif
5144
#endif
5145
/*--- Module creation code ---*/
5146
#if CYTHON_PEP489_MULTI_PHASE_INIT
5147
__pyx_m = __pyx_pyinit_module;
5148
Py_INCREF(__pyx_m);
5149
#else
5150
#if PY_MAJOR_VERSION < 3
5151
__pyx_m = Py_InitModule4("poly_nms", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
5152
#else
5153
__pyx_m = PyModule_Create(&__pyx_moduledef);
5154
#endif
5155
if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
5156
#endif
5157
__pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
5158
Py_INCREF(__pyx_d);
5159
__pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
5160
Py_INCREF(__pyx_b);
5161
__pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
5162
Py_INCREF(__pyx_cython_runtime);
5163
if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
5164
/*--- Initialize various global constants etc. ---*/
5165
if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5166
#if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
5167
if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5168
#endif
5169
if (__pyx_module_is_main_poly_nms) {
5170
if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5171
}
5172
#if PY_MAJOR_VERSION >= 3
5173
{
5174
PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
5175
if (!PyDict_GetItemString(modules, "poly_nms")) {
5176
if (unlikely(PyDict_SetItemString(modules, "poly_nms", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
5177
}
5178
}
5179
#endif
5180
/*--- Builtin init code ---*/
5181
if (__Pyx_InitCachedBuiltins() < 0) goto __pyx_L1_error;
5182
/*--- Constants init code ---*/
5183
if (__Pyx_InitCachedConstants() < 0) goto __pyx_L1_error;
5184
/*--- Global type/function init code ---*/
5185
(void)__Pyx_modinit_global_init_code();
5186
(void)__Pyx_modinit_variable_export_code();
5187
(void)__Pyx_modinit_function_export_code();
5188
(void)__Pyx_modinit_type_init_code();
5189
if (unlikely(__Pyx_modinit_type_import_code() != 0)) goto __pyx_L1_error;
5190
(void)__Pyx_modinit_variable_import_code();
5191
(void)__Pyx_modinit_function_import_code();
5192
/*--- Execution code ---*/
5193
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
5194
if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5195
#endif
5196
5197
/* "poly_nms.pyx":1
5198
* import numpy as np # <<<<<<<<<<<<<<
5199
* cimport numpy as np
5200
*
5201
*/
5202
__pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
5203
__Pyx_GOTREF(__pyx_t_1);
5204
if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5205
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5206
5207
/* "poly_nms.pyx":4
5208
* cimport numpy as np
5209
*
5210
* assert sizeof(int) == sizeof(np.int32_t) # <<<<<<<<<<<<<<
5211
*
5212
* cdef extern from "poly_nms.hpp":
5213
*/
5214
#ifndef CYTHON_WITHOUT_ASSERTIONS
5215
if (unlikely(!Py_OptimizeFlag)) {
5216
if (unlikely(!(((sizeof(int)) == (sizeof(__pyx_t_5numpy_int32_t))) != 0))) {
5217
PyErr_SetNone(PyExc_AssertionError);
5218
__PYX_ERR(0, 4, __pyx_L1_error)
5219
}
5220
}
5221
#endif
5222
5223
/* "poly_nms.pyx":9
5224
* void _poly_nms(np.int32_t*, int*, np.float32_t*, int, int, float, int)
5225
*
5226
* def poly_gpu_nms(np.ndarray[np.float32_t, ndim=2] dets, np.float thresh, # <<<<<<<<<<<<<<
5227
* np.int32_t device_id=0):
5228
* cdef int boxes_num = dets.shape[0]
5229
*/
5230
__pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8poly_nms_1poly_gpu_nms, NULL, __pyx_n_s_poly_nms); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error)
5231
__Pyx_GOTREF(__pyx_t_1);
5232
if (PyDict_SetItem(__pyx_d, __pyx_n_s_poly_gpu_nms, __pyx_t_1) < 0) __PYX_ERR(0, 9, __pyx_L1_error)
5233
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5234
5235
/* "poly_nms.pyx":1
5236
* import numpy as np # <<<<<<<<<<<<<<
5237
* cimport numpy as np
5238
*
5239
*/
5240
__pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
5241
__Pyx_GOTREF(__pyx_t_1);
5242
if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5243
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5244
5245
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1046
5246
* raise ImportError("numpy.core.umath failed to import")
5247
*
5248
* cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<<
5249
* try:
5250
* _import_umath()
5251
*/
5252
5253
/*--- Wrapped vars code ---*/
5254
5255
goto __pyx_L0;
5256
__pyx_L1_error:;
5257
__Pyx_XDECREF(__pyx_t_1);
5258
if (__pyx_m) {
5259
if (__pyx_d) {
5260
__Pyx_AddTraceback("init poly_nms", __pyx_clineno, __pyx_lineno, __pyx_filename);
5261
}
5262
Py_CLEAR(__pyx_m);
5263
} else if (!PyErr_Occurred()) {
5264
PyErr_SetString(PyExc_ImportError, "init poly_nms");
5265
}
5266
__pyx_L0:;
5267
__Pyx_RefNannyFinishContext();
5268
#if CYTHON_PEP489_MULTI_PHASE_INIT
5269
return (__pyx_m != NULL) ? 0 : -1;
5270
#elif PY_MAJOR_VERSION >= 3
5271
return __pyx_m;
5272
#else
5273
return;
5274
#endif
5275
}
5276
5277
/* --- Runtime support code --- */
5278
/* Refnanny */
5279
#if CYTHON_REFNANNY
5280
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
5281
PyObject *m = NULL, *p = NULL;
5282
void *r = NULL;
5283
m = PyImport_ImportModule(modname);
5284
if (!m) goto end;
5285
p = PyObject_GetAttrString(m, "RefNannyAPI");
5286
if (!p) goto end;
5287
r = PyLong_AsVoidPtr(p);
5288
end:
5289
Py_XDECREF(p);
5290
Py_XDECREF(m);
5291
return (__Pyx_RefNannyAPIStruct *)r;
5292
}
5293
#endif
5294
5295
/* RaiseArgTupleInvalid */
5296
static void __Pyx_RaiseArgtupleInvalid(
5297
const char* func_name,
5298
int exact,
5299
Py_ssize_t num_min,
5300
Py_ssize_t num_max,
5301
Py_ssize_t num_found)
5302
{
5303
Py_ssize_t num_expected;
5304
const char *more_or_less;
5305
if (num_found < num_min) {
5306
num_expected = num_min;
5307
more_or_less = "at least";
5308
} else {
5309
num_expected = num_max;
5310
more_or_less = "at most";
5311
}
5312
if (exact) {
5313
more_or_less = "exactly";
5314
}
5315
PyErr_Format(PyExc_TypeError,
5316
"%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
5317
func_name, more_or_less, num_expected,
5318
(num_expected == 1) ? "" : "s", num_found);
5319
}
5320
5321
/* RaiseDoubleKeywords */
5322
static void __Pyx_RaiseDoubleKeywordsError(
5323
const char* func_name,
5324
PyObject* kw_name)
5325
{
5326
PyErr_Format(PyExc_TypeError,
5327
#if PY_MAJOR_VERSION >= 3
5328
"%s() got multiple values for keyword argument '%U'", func_name, kw_name);
5329
#else
5330
"%s() got multiple values for keyword argument '%s'", func_name,
5331
PyString_AsString(kw_name));
5332
#endif
5333
}
5334
5335
/* ParseKeywords */
5336
static int __Pyx_ParseOptionalKeywords(
5337
PyObject *kwds,
5338
PyObject **argnames[],
5339
PyObject *kwds2,
5340
PyObject *values[],
5341
Py_ssize_t num_pos_args,
5342
const char* function_name)
5343
{
5344
PyObject *key = 0, *value = 0;
5345
Py_ssize_t pos = 0;
5346
PyObject*** name;
5347
PyObject*** first_kw_arg = argnames + num_pos_args;
5348
while (PyDict_Next(kwds, &pos, &key, &value)) {
5349
name = first_kw_arg;
5350
while (*name && (**name != key)) name++;
5351
if (*name) {
5352
values[name-argnames] = value;
5353
continue;
5354
}
5355
name = first_kw_arg;
5356
#if PY_MAJOR_VERSION < 3
5357
if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
5358
while (*name) {
5359
if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
5360
&& _PyString_Eq(**name, key)) {
5361
values[name-argnames] = value;
5362
break;
5363
}
5364
name++;
5365
}
5366
if (*name) continue;
5367
else {
5368
PyObject*** argname = argnames;
5369
while (argname != first_kw_arg) {
5370
if ((**argname == key) || (
5371
(CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
5372
&& _PyString_Eq(**argname, key))) {
5373
goto arg_passed_twice;
5374
}
5375
argname++;
5376
}
5377
}
5378
} else
5379
#endif
5380
if (likely(PyUnicode_Check(key))) {
5381
while (*name) {
5382
int cmp = (**name == key) ? 0 :
5383
#if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
5384
(PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
5385
#endif
5386
PyUnicode_Compare(**name, key);
5387
if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
5388
if (cmp == 0) {
5389
values[name-argnames] = value;
5390
break;
5391
}
5392
name++;
5393
}
5394
if (*name) continue;
5395
else {
5396
PyObject*** argname = argnames;
5397
while (argname != first_kw_arg) {
5398
int cmp = (**argname == key) ? 0 :
5399
#if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
5400
(PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
5401
#endif
5402
PyUnicode_Compare(**argname, key);
5403
if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
5404
if (cmp == 0) goto arg_passed_twice;
5405
argname++;
5406
}
5407
}
5408
} else
5409
goto invalid_keyword_type;
5410
if (kwds2) {
5411
if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
5412
} else {
5413
goto invalid_keyword;
5414
}
5415
}
5416
return 0;
5417
arg_passed_twice:
5418
__Pyx_RaiseDoubleKeywordsError(function_name, key);
5419
goto bad;
5420
invalid_keyword_type:
5421
PyErr_Format(PyExc_TypeError,
5422
"%.200s() keywords must be strings", function_name);
5423
goto bad;
5424
invalid_keyword:
5425
PyErr_Format(PyExc_TypeError,
5426
#if PY_MAJOR_VERSION < 3
5427
"%.200s() got an unexpected keyword argument '%.200s'",
5428
function_name, PyString_AsString(key));
5429
#else
5430
"%s() got an unexpected keyword argument '%U'",
5431
function_name, key);
5432
#endif
5433
bad:
5434
return -1;
5435
}
5436
5437
/* ArgTypeTest */
5438
static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
5439
{
5440
if (unlikely(!type)) {
5441
PyErr_SetString(PyExc_SystemError, "Missing type object");
5442
return 0;
5443
}
5444
else if (exact) {
5445
#if PY_MAJOR_VERSION == 2
5446
if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
5447
#endif
5448
}
5449
else {
5450
if (likely(__Pyx_TypeCheck(obj, type))) return 1;
5451
}
5452
PyErr_Format(PyExc_TypeError,
5453
"Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
5454
name, type->tp_name, Py_TYPE(obj)->tp_name);
5455
return 0;
5456
}
5457
5458
/* IsLittleEndian */
5459
static CYTHON_INLINE int __Pyx_Is_Little_Endian(void)
5460
{
5461
union {
5462
uint32_t u32;
5463
uint8_t u8[4];
5464
} S;
5465
S.u32 = 0x01020304;
5466
return S.u8[0] == 4;
5467
}
5468
5469
/* BufferFormatCheck */
5470
static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
5471
__Pyx_BufFmt_StackElem* stack,
5472
__Pyx_TypeInfo* type) {
5473
stack[0].field = &ctx->root;
5474
stack[0].parent_offset = 0;
5475
ctx->root.type = type;
5476
ctx->root.name = "buffer dtype";
5477
ctx->root.offset = 0;
5478
ctx->head = stack;
5479
ctx->head->field = &ctx->root;
5480
ctx->fmt_offset = 0;
5481
ctx->head->parent_offset = 0;
5482
ctx->new_packmode = '@';
5483
ctx->enc_packmode = '@';
5484
ctx->new_count = 1;
5485
ctx->enc_count = 0;
5486
ctx->enc_type = 0;
5487
ctx->is_complex = 0;
5488
ctx->is_valid_array = 0;
5489
ctx->struct_alignment = 0;
5490
while (type->typegroup == 'S') {
5491
++ctx->head;
5492
ctx->head->field = type->fields;
5493
ctx->head->parent_offset = 0;
5494
type = type->fields->type;
5495
}
5496
}
5497
static int __Pyx_BufFmt_ParseNumber(const char** ts) {
5498
int count;
5499
const char* t = *ts;
5500
if (*t < '0' || *t > '9') {
5501
return -1;
5502
} else {
5503
count = *t++ - '0';
5504
while (*t >= '0' && *t <= '9') {
5505
count *= 10;
5506
count += *t++ - '0';
5507
}
5508
}
5509
*ts = t;
5510
return count;
5511
}
5512
static int __Pyx_BufFmt_ExpectNumber(const char **ts) {
5513
int number = __Pyx_BufFmt_ParseNumber(ts);
5514
if (number == -1)
5515
PyErr_Format(PyExc_ValueError,\
5516
"Does not understand character buffer dtype format string ('%c')", **ts);
5517
return number;
5518
}
5519
static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
5520
PyErr_Format(PyExc_ValueError,
5521
"Unexpected format string character: '%c'", ch);
5522
}
5523
static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
5524
switch (ch) {
5525
case '?': return "'bool'";
5526
case 'c': return "'char'";
5527
case 'b': return "'signed char'";
5528
case 'B': return "'unsigned char'";
5529
case 'h': return "'short'";
5530
case 'H': return "'unsigned short'";
5531
case 'i': return "'int'";
5532
case 'I': return "'unsigned int'";
5533
case 'l': return "'long'";
5534
case 'L': return "'unsigned long'";
5535
case 'q': return "'long long'";
5536
case 'Q': return "'unsigned long long'";
5537
case 'f': return (is_complex ? "'complex float'" : "'float'");
5538
case 'd': return (is_complex ? "'complex double'" : "'double'");
5539
case 'g': return (is_complex ? "'complex long double'" : "'long double'");
5540
case 'T': return "a struct";
5541
case 'O': return "Python object";
5542
case 'P': return "a pointer";
5543
case 's': case 'p': return "a string";
5544
case 0: return "end";
5545
default: return "unparseable format string";
5546
}
5547
}
5548
static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
5549
switch (ch) {
5550
case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
5551
case 'h': case 'H': return 2;
5552
case 'i': case 'I': case 'l': case 'L': return 4;
5553
case 'q': case 'Q': return 8;
5554
case 'f': return (is_complex ? 8 : 4);
5555
case 'd': return (is_complex ? 16 : 8);
5556
case 'g': {
5557
PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
5558
return 0;
5559
}
5560
case 'O': case 'P': return sizeof(void*);
5561
default:
5562
__Pyx_BufFmt_RaiseUnexpectedChar(ch);
5563
return 0;
5564
}
5565
}
5566
static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
5567
switch (ch) {
5568
case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
5569
case 'h': case 'H': return sizeof(short);
5570
case 'i': case 'I': return sizeof(int);
5571
case 'l': case 'L': return sizeof(long);
5572
#ifdef HAVE_LONG_LONG
5573
case 'q': case 'Q': return sizeof(PY_LONG_LONG);
5574
#endif
5575
case 'f': return sizeof(float) * (is_complex ? 2 : 1);
5576
case 'd': return sizeof(double) * (is_complex ? 2 : 1);
5577
case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
5578
case 'O': case 'P': return sizeof(void*);
5579
default: {
5580
__Pyx_BufFmt_RaiseUnexpectedChar(ch);
5581
return 0;
5582
}
5583
}
5584
}
5585
typedef struct { char c; short x; } __Pyx_st_short;
5586
typedef struct { char c; int x; } __Pyx_st_int;
5587
typedef struct { char c; long x; } __Pyx_st_long;
5588
typedef struct { char c; float x; } __Pyx_st_float;
5589
typedef struct { char c; double x; } __Pyx_st_double;
5590
typedef struct { char c; long double x; } __Pyx_st_longdouble;
5591
typedef struct { char c; void *x; } __Pyx_st_void_p;
5592
#ifdef HAVE_LONG_LONG
5593
typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
5594
#endif
5595
static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) {
5596
switch (ch) {
5597
case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
5598
case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
5599
case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
5600
case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
5601
#ifdef HAVE_LONG_LONG
5602
case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG);
5603
#endif
5604
case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
5605
case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
5606
case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
5607
case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
5608
default:
5609
__Pyx_BufFmt_RaiseUnexpectedChar(ch);
5610
return 0;
5611
}
5612
}
5613
/* These are for computing the padding at the end of the struct to align
5614
on the first member of the struct. This will probably the same as above,
5615
but we don't have any guarantees.
5616
*/
5617
typedef struct { short x; char c; } __Pyx_pad_short;
5618
typedef struct { int x; char c; } __Pyx_pad_int;
5619
typedef struct { long x; char c; } __Pyx_pad_long;
5620
typedef struct { float x; char c; } __Pyx_pad_float;
5621
typedef struct { double x; char c; } __Pyx_pad_double;
5622
typedef struct { long double x; char c; } __Pyx_pad_longdouble;
5623
typedef struct { void *x; char c; } __Pyx_pad_void_p;
5624
#ifdef HAVE_LONG_LONG
5625
typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong;
5626
#endif
5627
static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) {
5628
switch (ch) {
5629
case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
5630
case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short);
5631
case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int);
5632
case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long);
5633
#ifdef HAVE_LONG_LONG
5634
case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG);
5635
#endif
5636
case 'f': return sizeof(__Pyx_pad_float) - sizeof(float);
5637
case 'd': return sizeof(__Pyx_pad_double) - sizeof(double);
5638
case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double);
5639
case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*);
5640
default:
5641
__Pyx_BufFmt_RaiseUnexpectedChar(ch);
5642
return 0;
5643
}
5644
}
5645
static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
5646
switch (ch) {
5647
case 'c':
5648
return 'H';
5649
case 'b': case 'h': case 'i':
5650
case 'l': case 'q': case 's': case 'p':
5651
return 'I';
5652
case '?': case 'B': case 'H': case 'I': case 'L': case 'Q':
5653
return 'U';
5654
case 'f': case 'd': case 'g':
5655
return (is_complex ? 'C' : 'R');
5656
case 'O':
5657
return 'O';
5658
case 'P':
5659
return 'P';
5660
default: {
5661
__Pyx_BufFmt_RaiseUnexpectedChar(ch);
5662
return 0;
5663
}
5664
}
5665
}
5666
static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
5667
if (ctx->head == NULL || ctx->head->field == &ctx->root) {
5668
const char* expected;
5669
const char* quote;
5670
if (ctx->head == NULL) {
5671
expected = "end";
5672
quote = "";
5673
} else {
5674
expected = ctx->head->field->type->name;
5675
quote = "'";
5676
}
5677
PyErr_Format(PyExc_ValueError,
5678
"Buffer dtype mismatch, expected %s%s%s but got %s",
5679
quote, expected, quote,
5680
__Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
5681
} else {
5682
__Pyx_StructField* field = ctx->head->field;
5683
__Pyx_StructField* parent = (ctx->head - 1)->field;
5684
PyErr_Format(PyExc_ValueError,
5685
"Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
5686
field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
5687
parent->type->name, field->name);
5688
}
5689
}
5690
static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
5691
char group;
5692
size_t size, offset, arraysize = 1;
5693
if (ctx->enc_type == 0) return 0;
5694
if (ctx->head->field->type->arraysize[0]) {
5695
int i, ndim = 0;
5696
if (ctx->enc_type == 's' || ctx->enc_type == 'p') {
5697
ctx->is_valid_array = ctx->head->field->type->ndim == 1;
5698
ndim = 1;
5699
if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
5700
PyErr_Format(PyExc_ValueError,
5701
"Expected a dimension of size %zu, got %zu",
5702
ctx->head->field->type->arraysize[0], ctx->enc_count);
5703
return -1;
5704
}
5705
}
5706
if (!ctx->is_valid_array) {
5707
PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d",
5708
ctx->head->field->type->ndim, ndim);
5709
return -1;
5710
}
5711
for (i = 0; i < ctx->head->field->type->ndim; i++) {
5712
arraysize *= ctx->head->field->type->arraysize[i];
5713
}
5714
ctx->is_valid_array = 0;
5715
ctx->enc_count = 1;
5716
}
5717
group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
5718
do {
5719
__Pyx_StructField* field = ctx->head->field;
5720
__Pyx_TypeInfo* type = field->type;
5721
if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') {
5722
size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
5723
} else {
5724
size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
5725
}
5726
if (ctx->enc_packmode == '@') {
5727
size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
5728
size_t align_mod_offset;
5729
if (align_at == 0) return -1;
5730
align_mod_offset = ctx->fmt_offset % align_at;
5731
if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
5732
if (ctx->struct_alignment == 0)
5733
ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
5734
ctx->is_complex);
5735
}
5736
if (type->size != size || type->typegroup != group) {
5737
if (type->typegroup == 'C' && type->fields != NULL) {
5738
size_t parent_offset = ctx->head->parent_offset + field->offset;
5739
++ctx->head;
5740
ctx->head->field = type->fields;
5741
ctx->head->parent_offset = parent_offset;
5742
continue;
5743
}
5744
if ((type->typegroup == 'H' || group == 'H') && type->size == size) {
5745
} else {
5746
__Pyx_BufFmt_RaiseExpected(ctx);
5747
return -1;
5748
}
5749
}
5750
offset = ctx->head->parent_offset + field->offset;
5751
if (ctx->fmt_offset != offset) {
5752
PyErr_Format(PyExc_ValueError,
5753
"Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected",
5754
(Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
5755
return -1;
5756
}
5757
ctx->fmt_offset += size;
5758
if (arraysize)
5759
ctx->fmt_offset += (arraysize - 1) * size;
5760
--ctx->enc_count;
5761
while (1) {
5762
if (field == &ctx->root) {
5763
ctx->head = NULL;
5764
if (ctx->enc_count != 0) {
5765
__Pyx_BufFmt_RaiseExpected(ctx);
5766
return -1;
5767
}
5768
break;
5769
}
5770
ctx->head->field = ++field;
5771
if (field->type == NULL) {
5772
--ctx->head;
5773
field = ctx->head->field;
5774
continue;
5775
} else if (field->type->typegroup == 'S') {
5776
size_t parent_offset = ctx->head->parent_offset + field->offset;
5777
if (field->type->fields->type == NULL) continue;
5778
field = field->type->fields;
5779
++ctx->head;
5780
ctx->head->field = field;
5781
ctx->head->parent_offset = parent_offset;
5782
break;
5783
} else {
5784
break;
5785
}
5786
}
5787
} while (ctx->enc_count);
5788
ctx->enc_type = 0;
5789
ctx->is_complex = 0;
5790
return 0;
5791
}
5792
static PyObject *
5793
__pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
5794
{
5795
const char *ts = *tsp;
5796
int i = 0, number;
5797
int ndim = ctx->head->field->type->ndim;
5798
;
5799
++ts;
5800
if (ctx->new_count != 1) {
5801
PyErr_SetString(PyExc_ValueError,
5802
"Cannot handle repeated arrays in format string");
5803
return NULL;
5804
}
5805
if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
5806
while (*ts && *ts != ')') {
5807
switch (*ts) {
5808
case ' ': case '\f': case '\r': case '\n': case '\t': case '\v': continue;
5809
default: break;
5810
}
5811
number = __Pyx_BufFmt_ExpectNumber(&ts);
5812
if (number == -1) return NULL;
5813
if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i])
5814
return PyErr_Format(PyExc_ValueError,
5815
"Expected a dimension of size %zu, got %d",
5816
ctx->head->field->type->arraysize[i], number);
5817
if (*ts != ',' && *ts != ')')
5818
return PyErr_Format(PyExc_ValueError,
5819
"Expected a comma in format string, got '%c'", *ts);
5820
if (*ts == ',') ts++;
5821
i++;
5822
}
5823
if (i != ndim)
5824
return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
5825
ctx->head->field->type->ndim, i);
5826
if (!*ts) {
5827
PyErr_SetString(PyExc_ValueError,
5828
"Unexpected end of format string, expected ')'");
5829
return NULL;
5830
}
5831
ctx->is_valid_array = 1;
5832
ctx->new_count = 1;
5833
*tsp = ++ts;
5834
return Py_None;
5835
}
5836
static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
5837
int got_Z = 0;
5838
while (1) {
5839
switch(*ts) {
5840
case 0:
5841
if (ctx->enc_type != 0 && ctx->head == NULL) {
5842
__Pyx_BufFmt_RaiseExpected(ctx);
5843
return NULL;
5844
}
5845
if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
5846
if (ctx->head != NULL) {
5847
__Pyx_BufFmt_RaiseExpected(ctx);
5848
return NULL;
5849
}
5850
return ts;
5851
case ' ':
5852
case '\r':
5853
case '\n':
5854
++ts;
5855
break;
5856
case '<':
5857
if (!__Pyx_Is_Little_Endian()) {
5858
PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
5859
return NULL;
5860
}
5861
ctx->new_packmode = '=';
5862
++ts;
5863
break;
5864
case '>':
5865
case '!':
5866
if (__Pyx_Is_Little_Endian()) {
5867
PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
5868
return NULL;
5869
}
5870
ctx->new_packmode = '=';
5871
++ts;
5872
break;
5873
case '=':
5874
case '@':
5875
case '^':
5876
ctx->new_packmode = *ts++;
5877
break;
5878
case 'T':
5879
{
5880
const char* ts_after_sub;
5881
size_t i, struct_count = ctx->new_count;
5882
size_t struct_alignment = ctx->struct_alignment;
5883
ctx->new_count = 1;
5884
++ts;
5885
if (*ts != '{') {
5886
PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
5887
return NULL;
5888
}
5889
if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
5890
ctx->enc_type = 0;
5891
ctx->enc_count = 0;
5892
ctx->struct_alignment = 0;
5893
++ts;
5894
ts_after_sub = ts;
5895
for (i = 0; i != struct_count; ++i) {
5896
ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
5897
if (!ts_after_sub) return NULL;
5898
}
5899
ts = ts_after_sub;
5900
if (struct_alignment) ctx->struct_alignment = struct_alignment;
5901
}
5902
break;
5903
case '}':
5904
{
5905
size_t alignment = ctx->struct_alignment;
5906
++ts;
5907
if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
5908
ctx->enc_type = 0;
5909
if (alignment && ctx->fmt_offset % alignment) {
5910
ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
5911
}
5912
}
5913
return ts;
5914
case 'x':
5915
if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
5916
ctx->fmt_offset += ctx->new_count;
5917
ctx->new_count = 1;
5918
ctx->enc_count = 0;
5919
ctx->enc_type = 0;
5920
ctx->enc_packmode = ctx->new_packmode;
5921
++ts;
5922
break;
5923
case 'Z':
5924
got_Z = 1;
5925
++ts;
5926
if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
5927
__Pyx_BufFmt_RaiseUnexpectedChar('Z');
5928
return NULL;
5929
}
5930
CYTHON_FALLTHROUGH;
5931
case '?': case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
5932
case 'l': case 'L': case 'q': case 'Q':
5933
case 'f': case 'd': case 'g':
5934
case 'O': case 'p':
5935
if (ctx->enc_type == *ts && got_Z == ctx->is_complex &&
5936
ctx->enc_packmode == ctx->new_packmode) {
5937
ctx->enc_count += ctx->new_count;
5938
ctx->new_count = 1;
5939
got_Z = 0;
5940
++ts;
5941
break;
5942
}
5943
CYTHON_FALLTHROUGH;
5944
case 's':
5945
if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
5946
ctx->enc_count = ctx->new_count;
5947
ctx->enc_packmode = ctx->new_packmode;
5948
ctx->enc_type = *ts;
5949
ctx->is_complex = got_Z;
5950
++ts;
5951
ctx->new_count = 1;
5952
got_Z = 0;
5953
break;
5954
case ':':
5955
++ts;
5956
while(*ts != ':') ++ts;
5957
++ts;
5958
break;
5959
case '(':
5960
if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL;
5961
break;
5962
default:
5963
{
5964
int number = __Pyx_BufFmt_ExpectNumber(&ts);
5965
if (number == -1) return NULL;
5966
ctx->new_count = (size_t)number;
5967
}
5968
}
5969
}
5970
}
5971
5972
/* BufferGetAndValidate */
5973
static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
5974
if (unlikely(info->buf == NULL)) return;
5975
if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL;
5976
__Pyx_ReleaseBuffer(info);
5977
}
5978
static void __Pyx_ZeroBuffer(Py_buffer* buf) {
5979
buf->buf = NULL;
5980
buf->obj = NULL;
5981
buf->strides = __Pyx_zeros;
5982
buf->shape = __Pyx_zeros;
5983
buf->suboffsets = __Pyx_minusones;
5984
}
5985
static int __Pyx__GetBufferAndValidate(
5986
Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags,
5987
int nd, int cast, __Pyx_BufFmt_StackElem* stack)
5988
{
5989
buf->buf = NULL;
5990
if (unlikely(__Pyx_GetBuffer(obj, buf, flags) == -1)) {
5991
__Pyx_ZeroBuffer(buf);
5992
return -1;
5993
}
5994
if (unlikely(buf->ndim != nd)) {
5995
PyErr_Format(PyExc_ValueError,
5996
"Buffer has wrong number of dimensions (expected %d, got %d)",
5997
nd, buf->ndim);
5998
goto fail;
5999
}
6000
if (!cast) {
6001
__Pyx_BufFmt_Context ctx;
6002
__Pyx_BufFmt_Init(&ctx, stack, dtype);
6003
if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
6004
}
6005
if (unlikely((size_t)buf->itemsize != dtype->size)) {
6006
PyErr_Format(PyExc_ValueError,
6007
"Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)",
6008
buf->itemsize, (buf->itemsize > 1) ? "s" : "",
6009
dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : "");
6010
goto fail;
6011
}
6012
if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
6013
return 0;
6014
fail:;
6015
__Pyx_SafeReleaseBuffer(buf);
6016
return -1;
6017
}
6018
6019
/* PyObjectGetAttrStr */
6020
#if CYTHON_USE_TYPE_SLOTS
6021
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
6022
PyTypeObject* tp = Py_TYPE(obj);
6023
if (likely(tp->tp_getattro))
6024
return tp->tp_getattro(obj, attr_name);
6025
#if PY_MAJOR_VERSION < 3
6026
if (likely(tp->tp_getattr))
6027
return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
6028
#endif
6029
return PyObject_GetAttr(obj, attr_name);
6030
}
6031
#endif
6032
6033
/* GetBuiltinName */
6034
static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
6035
PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
6036
if (unlikely(!result)) {
6037
PyErr_Format(PyExc_NameError,
6038
#if PY_MAJOR_VERSION >= 3
6039
"name '%U' is not defined", name);
6040
#else
6041
"name '%.200s' is not defined", PyString_AS_STRING(name));
6042
#endif
6043
}
6044
return result;
6045
}
6046
6047
/* PyDictVersioning */
6048
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
6049
static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
6050
PyObject *dict = Py_TYPE(obj)->tp_dict;
6051
return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
6052
}
6053
static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
6054
PyObject **dictptr = NULL;
6055
Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
6056
if (offset) {
6057
#if CYTHON_COMPILING_IN_CPYTHON
6058
dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
6059
#else
6060
dictptr = _PyObject_GetDictPtr(obj);
6061
#endif
6062
}
6063
return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
6064
}
6065
static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
6066
PyObject *dict = Py_TYPE(obj)->tp_dict;
6067
if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
6068
return 0;
6069
return obj_dict_version == __Pyx_get_object_dict_version(obj);
6070
}
6071
#endif
6072
6073
/* GetModuleGlobalName */
6074
#if CYTHON_USE_DICT_VERSIONS
6075
static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
6076
#else
6077
static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
6078
#endif
6079
{
6080
PyObject *result;
6081
#if !CYTHON_AVOID_BORROWED_REFS
6082
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
6083
result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
6084
__PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
6085
if (likely(result)) {
6086
return __Pyx_NewRef(result);
6087
} else if (unlikely(PyErr_Occurred())) {
6088
return NULL;
6089
}
6090
#else
6091
result = PyDict_GetItem(__pyx_d, name);
6092
__PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
6093
if (likely(result)) {
6094
return __Pyx_NewRef(result);
6095
}
6096
#endif
6097
#else
6098
result = PyObject_GetItem(__pyx_d, name);
6099
__PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
6100
if (likely(result)) {
6101
return __Pyx_NewRef(result);
6102
}
6103
PyErr_Clear();
6104
#endif
6105
return __Pyx_GetBuiltinName(name);
6106
}
6107
6108
/* PyObjectCall */
6109
#if CYTHON_COMPILING_IN_CPYTHON
6110
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
6111
PyObject *result;
6112
ternaryfunc call = func->ob_type->tp_call;
6113
if (unlikely(!call))
6114
return PyObject_Call(func, arg, kw);
6115
if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
6116
return NULL;
6117
result = (*call)(func, arg, kw);
6118
Py_LeaveRecursiveCall();
6119
if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
6120
PyErr_SetString(
6121
PyExc_SystemError,
6122
"NULL result without error in PyObject_Call");
6123
}
6124
return result;
6125
}
6126
#endif
6127
6128
/* ExtTypeTest */
6129
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
6130
if (unlikely(!type)) {
6131
PyErr_SetString(PyExc_SystemError, "Missing type object");
6132
return 0;
6133
}
6134
if (likely(__Pyx_TypeCheck(obj, type)))
6135
return 1;
6136
PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
6137
Py_TYPE(obj)->tp_name, type->tp_name);
6138
return 0;
6139
}
6140
6141
/* GetItemInt */
6142
static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
6143
PyObject *r;
6144
if (!j) return NULL;
6145
r = PyObject_GetItem(o, j);
6146
Py_DECREF(j);
6147
return r;
6148
}
6149
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
6150
CYTHON_NCP_UNUSED int wraparound,
6151
CYTHON_NCP_UNUSED int boundscheck) {
6152
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6153
Py_ssize_t wrapped_i = i;
6154
if (wraparound & unlikely(i < 0)) {
6155
wrapped_i += PyList_GET_SIZE(o);
6156
}
6157
if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
6158
PyObject *r = PyList_GET_ITEM(o, wrapped_i);
6159
Py_INCREF(r);
6160
return r;
6161
}
6162
return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
6163
#else
6164
return PySequence_GetItem(o, i);
6165
#endif
6166
}
6167
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
6168
CYTHON_NCP_UNUSED int wraparound,
6169
CYTHON_NCP_UNUSED int boundscheck) {
6170
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6171
Py_ssize_t wrapped_i = i;
6172
if (wraparound & unlikely(i < 0)) {
6173
wrapped_i += PyTuple_GET_SIZE(o);
6174
}
6175
if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
6176
PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
6177
Py_INCREF(r);
6178
return r;
6179
}
6180
return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
6181
#else
6182
return PySequence_GetItem(o, i);
6183
#endif
6184
}
6185
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
6186
CYTHON_NCP_UNUSED int wraparound,
6187
CYTHON_NCP_UNUSED int boundscheck) {
6188
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
6189
if (is_list || PyList_CheckExact(o)) {
6190
Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
6191
if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
6192
PyObject *r = PyList_GET_ITEM(o, n);
6193
Py_INCREF(r);
6194
return r;
6195
}
6196
}
6197
else if (PyTuple_CheckExact(o)) {
6198
Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
6199
if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
6200
PyObject *r = PyTuple_GET_ITEM(o, n);
6201
Py_INCREF(r);
6202
return r;
6203
}
6204
} else {
6205
PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
6206
if (likely(m && m->sq_item)) {
6207
if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
6208
Py_ssize_t l = m->sq_length(o);
6209
if (likely(l >= 0)) {
6210
i += l;
6211
} else {
6212
if (!PyErr_ExceptionMatches(PyExc_OverflowError))
6213
return NULL;
6214
PyErr_Clear();
6215
}
6216
}
6217
return m->sq_item(o, i);
6218
}
6219
}
6220
#else
6221
if (is_list || PySequence_Check(o)) {
6222
return PySequence_GetItem(o, i);
6223
}
6224
#endif
6225
return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
6226
}
6227
6228
/* ObjectGetItem */
6229
#if CYTHON_USE_TYPE_SLOTS
6230
static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
6231
PyObject *runerr;
6232
Py_ssize_t key_value;
6233
PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
6234
if (unlikely(!(m && m->sq_item))) {
6235
PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
6236
return NULL;
6237
}
6238
key_value = __Pyx_PyIndex_AsSsize_t(index);
6239
if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
6240
return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
6241
}
6242
if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
6243
PyErr_Clear();
6244
PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
6245
}
6246
return NULL;
6247
}
6248
static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
6249
PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
6250
if (likely(m && m->mp_subscript)) {
6251
return m->mp_subscript(obj, key);
6252
}
6253
return __Pyx_PyObject_GetIndex(obj, key);
6254
}
6255
#endif
6256
6257
/* PyFunctionFastCall */
6258
#if CYTHON_FAST_PYCALL
6259
static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
6260
PyObject *globals) {
6261
PyFrameObject *f;
6262
PyThreadState *tstate = __Pyx_PyThreadState_Current;
6263
PyObject **fastlocals;
6264
Py_ssize_t i;
6265
PyObject *result;
6266
assert(globals != NULL);
6267
/* XXX Perhaps we should create a specialized
6268
PyFrame_New() that doesn't take locals, but does
6269
take builtins without sanity checking them.
6270
*/
6271
assert(tstate != NULL);
6272
f = PyFrame_New(tstate, co, globals, NULL);
6273
if (f == NULL) {
6274
return NULL;
6275
}
6276
fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
6277
for (i = 0; i < na; i++) {
6278
Py_INCREF(*args);
6279
fastlocals[i] = *args++;
6280
}
6281
result = PyEval_EvalFrameEx(f,0);
6282
++tstate->recursion_depth;
6283
Py_DECREF(f);
6284
--tstate->recursion_depth;
6285
return result;
6286
}
6287
#if 1 || PY_VERSION_HEX < 0x030600B1
6288
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
6289
PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
6290
PyObject *globals = PyFunction_GET_GLOBALS(func);
6291
PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
6292
PyObject *closure;
6293
#if PY_MAJOR_VERSION >= 3
6294
PyObject *kwdefs;
6295
#endif
6296
PyObject *kwtuple, **k;
6297
PyObject **d;
6298
Py_ssize_t nd;
6299
Py_ssize_t nk;
6300
PyObject *result;
6301
assert(kwargs == NULL || PyDict_Check(kwargs));
6302
nk = kwargs ? PyDict_Size(kwargs) : 0;
6303
if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
6304
return NULL;
6305
}
6306
if (
6307
#if PY_MAJOR_VERSION >= 3
6308
co->co_kwonlyargcount == 0 &&
6309
#endif
6310
likely(kwargs == NULL || nk == 0) &&
6311
co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
6312
if (argdefs == NULL && co->co_argcount == nargs) {
6313
result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
6314
goto done;
6315
}
6316
else if (nargs == 0 && argdefs != NULL
6317
&& co->co_argcount == Py_SIZE(argdefs)) {
6318
/* function called with no arguments, but all parameters have
6319
a default value: use default values as arguments .*/
6320
args = &PyTuple_GET_ITEM(argdefs, 0);
6321
result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
6322
goto done;
6323
}
6324
}
6325
if (kwargs != NULL) {
6326
Py_ssize_t pos, i;
6327
kwtuple = PyTuple_New(2 * nk);
6328
if (kwtuple == NULL) {
6329
result = NULL;
6330
goto done;
6331
}
6332
k = &PyTuple_GET_ITEM(kwtuple, 0);
6333
pos = i = 0;
6334
while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
6335
Py_INCREF(k[i]);
6336
Py_INCREF(k[i+1]);
6337
i += 2;
6338
}
6339
nk = i / 2;
6340
}
6341
else {
6342
kwtuple = NULL;
6343
k = NULL;
6344
}
6345
closure = PyFunction_GET_CLOSURE(func);
6346
#if PY_MAJOR_VERSION >= 3
6347
kwdefs = PyFunction_GET_KW_DEFAULTS(func);
6348
#endif
6349
if (argdefs != NULL) {
6350
d = &PyTuple_GET_ITEM(argdefs, 0);
6351
nd = Py_SIZE(argdefs);
6352
}
6353
else {
6354
d = NULL;
6355
nd = 0;
6356
}
6357
#if PY_MAJOR_VERSION >= 3
6358
result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
6359
args, (int)nargs,
6360
k, (int)nk,
6361
d, (int)nd, kwdefs, closure);
6362
#else
6363
result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
6364
args, (int)nargs,
6365
k, (int)nk,
6366
d, (int)nd, closure);
6367
#endif
6368
Py_XDECREF(kwtuple);
6369
done:
6370
Py_LeaveRecursiveCall();
6371
return result;
6372
}
6373
#endif
6374
#endif
6375
6376
/* PyObjectCallMethO */
6377
#if CYTHON_COMPILING_IN_CPYTHON
6378
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
6379
PyObject *self, *result;
6380
PyCFunction cfunc;
6381
cfunc = PyCFunction_GET_FUNCTION(func);
6382
self = PyCFunction_GET_SELF(func);
6383
if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
6384
return NULL;
6385
result = cfunc(self, arg);
6386
Py_LeaveRecursiveCall();
6387
if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
6388
PyErr_SetString(
6389
PyExc_SystemError,
6390
"NULL result without error in PyObject_Call");
6391
}
6392
return result;
6393
}
6394
#endif
6395
6396
/* PyObjectCallNoArg */
6397
#if CYTHON_COMPILING_IN_CPYTHON
6398
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
6399
#if CYTHON_FAST_PYCALL
6400
if (PyFunction_Check(func)) {
6401
return __Pyx_PyFunction_FastCall(func, NULL, 0);
6402
}
6403
#endif
6404
#ifdef __Pyx_CyFunction_USED
6405
if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
6406
#else
6407
if (likely(PyCFunction_Check(func)))
6408
#endif
6409
{
6410
if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
6411
return __Pyx_PyObject_CallMethO(func, NULL);
6412
}
6413
}
6414
return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
6415
}
6416
#endif
6417
6418
/* PyCFunctionFastCall */
6419
#if CYTHON_FAST_PYCCALL
6420
static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
6421
PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
6422
PyCFunction meth = PyCFunction_GET_FUNCTION(func);
6423
PyObject *self = PyCFunction_GET_SELF(func);
6424
int flags = PyCFunction_GET_FLAGS(func);
6425
assert(PyCFunction_Check(func));
6426
assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
6427
assert(nargs >= 0);
6428
assert(nargs == 0 || args != NULL);
6429
/* _PyCFunction_FastCallDict() must not be called with an exception set,
6430
because it may clear it (directly or indirectly) and so the
6431
caller loses its exception */
6432
assert(!PyErr_Occurred());
6433
if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
6434
return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
6435
} else {
6436
return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
6437
}
6438
}
6439
#endif
6440
6441
/* PyObjectCallOneArg */
6442
#if CYTHON_COMPILING_IN_CPYTHON
6443
static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
6444
PyObject *result;
6445
PyObject *args = PyTuple_New(1);
6446
if (unlikely(!args)) return NULL;
6447
Py_INCREF(arg);
6448
PyTuple_SET_ITEM(args, 0, arg);
6449
result = __Pyx_PyObject_Call(func, args, NULL);
6450
Py_DECREF(args);
6451
return result;
6452
}
6453
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
6454
#if CYTHON_FAST_PYCALL
6455
if (PyFunction_Check(func)) {
6456
return __Pyx_PyFunction_FastCall(func, &arg, 1);
6457
}
6458
#endif
6459
if (likely(PyCFunction_Check(func))) {
6460
if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
6461
return __Pyx_PyObject_CallMethO(func, arg);
6462
#if CYTHON_FAST_PYCCALL
6463
} else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
6464
return __Pyx_PyCFunction_FastCall(func, &arg, 1);
6465
#endif
6466
}
6467
}
6468
return __Pyx__PyObject_CallOneArg(func, arg);
6469
}
6470
#else
6471
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
6472
PyObject *result;
6473
PyObject *args = PyTuple_Pack(1, arg);
6474
if (unlikely(!args)) return NULL;
6475
result = __Pyx_PyObject_Call(func, args, NULL);
6476
Py_DECREF(args);
6477
return result;
6478
}
6479
#endif
6480
6481
/* BufferIndexError */
6482
static void __Pyx_RaiseBufferIndexError(int axis) {
6483
PyErr_Format(PyExc_IndexError,
6484
"Out of bounds on buffer access (axis %d)", axis);
6485
}
6486
6487
/* BufferFallbackError */
6488
static void __Pyx_RaiseBufferFallbackError(void) {
6489
PyErr_SetString(PyExc_ValueError,
6490
"Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!");
6491
}
6492
6493
/* PyErrFetchRestore */
6494
#if CYTHON_FAST_THREAD_STATE
6495
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
6496
PyObject *tmp_type, *tmp_value, *tmp_tb;
6497
tmp_type = tstate->curexc_type;
6498
tmp_value = tstate->curexc_value;
6499
tmp_tb = tstate->curexc_traceback;
6500
tstate->curexc_type = type;
6501
tstate->curexc_value = value;
6502
tstate->curexc_traceback = tb;
6503
Py_XDECREF(tmp_type);
6504
Py_XDECREF(tmp_value);
6505
Py_XDECREF(tmp_tb);
6506
}
6507
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
6508
*type = tstate->curexc_type;
6509
*value = tstate->curexc_value;
6510
*tb = tstate->curexc_traceback;
6511
tstate->curexc_type = 0;
6512
tstate->curexc_value = 0;
6513
tstate->curexc_traceback = 0;
6514
}
6515
#endif
6516
6517
/* RaiseException */
6518
#if PY_MAJOR_VERSION < 3
6519
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
6520
CYTHON_UNUSED PyObject *cause) {
6521
__Pyx_PyThreadState_declare
6522
Py_XINCREF(type);
6523
if (!value || value == Py_None)
6524
value = NULL;
6525
else
6526
Py_INCREF(value);
6527
if (!tb || tb == Py_None)
6528
tb = NULL;
6529
else {
6530
Py_INCREF(tb);
6531
if (!PyTraceBack_Check(tb)) {
6532
PyErr_SetString(PyExc_TypeError,
6533
"raise: arg 3 must be a traceback or None");
6534
goto raise_error;
6535
}
6536
}
6537
if (PyType_Check(type)) {
6538
#if CYTHON_COMPILING_IN_PYPY
6539
if (!value) {
6540
Py_INCREF(Py_None);
6541
value = Py_None;
6542
}
6543
#endif
6544
PyErr_NormalizeException(&type, &value, &tb);
6545
} else {
6546
if (value) {
6547
PyErr_SetString(PyExc_TypeError,
6548
"instance exception may not have a separate value");
6549
goto raise_error;
6550
}
6551
value = type;
6552
type = (PyObject*) Py_TYPE(type);
6553
Py_INCREF(type);
6554
if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
6555
PyErr_SetString(PyExc_TypeError,
6556
"raise: exception class must be a subclass of BaseException");
6557
goto raise_error;
6558
}
6559
}
6560
__Pyx_PyThreadState_assign
6561
__Pyx_ErrRestore(type, value, tb);
6562
return;
6563
raise_error:
6564
Py_XDECREF(value);
6565
Py_XDECREF(type);
6566
Py_XDECREF(tb);
6567
return;
6568
}
6569
#else
6570
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
6571
PyObject* owned_instance = NULL;
6572
if (tb == Py_None) {
6573
tb = 0;
6574
} else if (tb && !PyTraceBack_Check(tb)) {
6575
PyErr_SetString(PyExc_TypeError,
6576
"raise: arg 3 must be a traceback or None");
6577
goto bad;
6578
}
6579
if (value == Py_None)
6580
value = 0;
6581
if (PyExceptionInstance_Check(type)) {
6582
if (value) {
6583
PyErr_SetString(PyExc_TypeError,
6584
"instance exception may not have a separate value");
6585
goto bad;
6586
}
6587
value = type;
6588
type = (PyObject*) Py_TYPE(value);
6589
} else if (PyExceptionClass_Check(type)) {
6590
PyObject *instance_class = NULL;
6591
if (value && PyExceptionInstance_Check(value)) {
6592
instance_class = (PyObject*) Py_TYPE(value);
6593
if (instance_class != type) {
6594
int is_subclass = PyObject_IsSubclass(instance_class, type);
6595
if (!is_subclass) {
6596
instance_class = NULL;
6597
} else if (unlikely(is_subclass == -1)) {
6598
goto bad;
6599
} else {
6600
type = instance_class;
6601
}
6602
}
6603
}
6604
if (!instance_class) {
6605
PyObject *args;
6606
if (!value)
6607
args = PyTuple_New(0);
6608
else if (PyTuple_Check(value)) {
6609
Py_INCREF(value);
6610
args = value;
6611
} else
6612
args = PyTuple_Pack(1, value);
6613
if (!args)
6614
goto bad;
6615
owned_instance = PyObject_Call(type, args, NULL);
6616
Py_DECREF(args);
6617
if (!owned_instance)
6618
goto bad;
6619
value = owned_instance;
6620
if (!PyExceptionInstance_Check(value)) {
6621
PyErr_Format(PyExc_TypeError,
6622
"calling %R should have returned an instance of "
6623
"BaseException, not %R",
6624
type, Py_TYPE(value));
6625
goto bad;
6626
}
6627
}
6628
} else {
6629
PyErr_SetString(PyExc_TypeError,
6630
"raise: exception class must be a subclass of BaseException");
6631
goto bad;
6632
}
6633
if (cause) {
6634
PyObject *fixed_cause;
6635
if (cause == Py_None) {
6636
fixed_cause = NULL;
6637
} else if (PyExceptionClass_Check(cause)) {
6638
fixed_cause = PyObject_CallObject(cause, NULL);
6639
if (fixed_cause == NULL)
6640
goto bad;
6641
} else if (PyExceptionInstance_Check(cause)) {
6642
fixed_cause = cause;
6643
Py_INCREF(fixed_cause);
6644
} else {
6645
PyErr_SetString(PyExc_TypeError,
6646
"exception causes must derive from "
6647
"BaseException");
6648
goto bad;
6649
}
6650
PyException_SetCause(value, fixed_cause);
6651
}
6652
PyErr_SetObject(type, value);
6653
if (tb) {
6654
#if CYTHON_COMPILING_IN_PYPY
6655
PyObject *tmp_type, *tmp_value, *tmp_tb;
6656
PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
6657
Py_INCREF(tb);
6658
PyErr_Restore(tmp_type, tmp_value, tb);
6659
Py_XDECREF(tmp_tb);
6660
#else
6661
PyThreadState *tstate = __Pyx_PyThreadState_Current;
6662
PyObject* tmp_tb = tstate->curexc_traceback;
6663
if (tb != tmp_tb) {
6664
Py_INCREF(tb);
6665
tstate->curexc_traceback = tb;
6666
Py_XDECREF(tmp_tb);
6667
}
6668
#endif
6669
}
6670
bad:
6671
Py_XDECREF(owned_instance);
6672
return;
6673
}
6674
#endif
6675
6676
/* DictGetItem */
6677
#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
6678
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
6679
PyObject *value;
6680
value = PyDict_GetItemWithError(d, key);
6681
if (unlikely(!value)) {
6682
if (!PyErr_Occurred()) {
6683
if (unlikely(PyTuple_Check(key))) {
6684
PyObject* args = PyTuple_Pack(1, key);
6685
if (likely(args)) {
6686
PyErr_SetObject(PyExc_KeyError, args);
6687
Py_DECREF(args);
6688
}
6689
} else {
6690
PyErr_SetObject(PyExc_KeyError, key);
6691
}
6692
}
6693
return NULL;
6694
}
6695
Py_INCREF(value);
6696
return value;
6697
}
6698
#endif
6699
6700
/* RaiseTooManyValuesToUnpack */
6701
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
6702
PyErr_Format(PyExc_ValueError,
6703
"too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
6704
}
6705
6706
/* RaiseNeedMoreValuesToUnpack */
6707
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
6708
PyErr_Format(PyExc_ValueError,
6709
"need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
6710
index, (index == 1) ? "" : "s");
6711
}
6712
6713
/* RaiseNoneIterError */
6714
static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
6715
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
6716
}
6717
6718
/* GetTopmostException */
6719
#if CYTHON_USE_EXC_INFO_STACK
6720
static _PyErr_StackItem *
6721
__Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
6722
{
6723
_PyErr_StackItem *exc_info = tstate->exc_info;
6724
while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
6725
exc_info->previous_item != NULL)
6726
{
6727
exc_info = exc_info->previous_item;
6728
}
6729
return exc_info;
6730
}
6731
#endif
6732
6733
/* SaveResetException */
6734
#if CYTHON_FAST_THREAD_STATE
6735
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
6736
#if CYTHON_USE_EXC_INFO_STACK
6737
_PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
6738
*type = exc_info->exc_type;
6739
*value = exc_info->exc_value;
6740
*tb = exc_info->exc_traceback;
6741
#else
6742
*type = tstate->exc_type;
6743
*value = tstate->exc_value;
6744
*tb = tstate->exc_traceback;
6745
#endif
6746
Py_XINCREF(*type);
6747
Py_XINCREF(*value);
6748
Py_XINCREF(*tb);
6749
}
6750
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
6751
PyObject *tmp_type, *tmp_value, *tmp_tb;
6752
#if CYTHON_USE_EXC_INFO_STACK
6753
_PyErr_StackItem *exc_info = tstate->exc_info;
6754
tmp_type = exc_info->exc_type;
6755
tmp_value = exc_info->exc_value;
6756
tmp_tb = exc_info->exc_traceback;
6757
exc_info->exc_type = type;
6758
exc_info->exc_value = value;
6759
exc_info->exc_traceback = tb;
6760
#else
6761
tmp_type = tstate->exc_type;
6762
tmp_value = tstate->exc_value;
6763
tmp_tb = tstate->exc_traceback;
6764
tstate->exc_type = type;
6765
tstate->exc_value = value;
6766
tstate->exc_traceback = tb;
6767
#endif
6768
Py_XDECREF(tmp_type);
6769
Py_XDECREF(tmp_value);
6770
Py_XDECREF(tmp_tb);
6771
}
6772
#endif
6773
6774
/* PyErrExceptionMatches */
6775
#if CYTHON_FAST_THREAD_STATE
6776
static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
6777
Py_ssize_t i, n;
6778
n = PyTuple_GET_SIZE(tuple);
6779
#if PY_MAJOR_VERSION >= 3
6780
for (i=0; i<n; i++) {
6781
if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
6782
}
6783
#endif
6784
for (i=0; i<n; i++) {
6785
if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
6786
}
6787
return 0;
6788
}
6789
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
6790
PyObject *exc_type = tstate->curexc_type;
6791
if (exc_type == err) return 1;
6792
if (unlikely(!exc_type)) return 0;
6793
if (unlikely(PyTuple_Check(err)))
6794
return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
6795
return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
6796
}
6797
#endif
6798
6799
/* GetException */
6800
#if CYTHON_FAST_THREAD_STATE
6801
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
6802
#else
6803
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
6804
#endif
6805
{
6806
PyObject *local_type, *local_value, *local_tb;
6807
#if CYTHON_FAST_THREAD_STATE
6808
PyObject *tmp_type, *tmp_value, *tmp_tb;
6809
local_type = tstate->curexc_type;
6810
local_value = tstate->curexc_value;
6811
local_tb = tstate->curexc_traceback;
6812
tstate->curexc_type = 0;
6813
tstate->curexc_value = 0;
6814
tstate->curexc_traceback = 0;
6815
#else
6816
PyErr_Fetch(&local_type, &local_value, &local_tb);
6817
#endif
6818
PyErr_NormalizeException(&local_type, &local_value, &local_tb);
6819
#if CYTHON_FAST_THREAD_STATE
6820
if (unlikely(tstate->curexc_type))
6821
#else
6822
if (unlikely(PyErr_Occurred()))
6823
#endif
6824
goto bad;
6825
#if PY_MAJOR_VERSION >= 3
6826
if (local_tb) {
6827
if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
6828
goto bad;
6829
}
6830
#endif
6831
Py_XINCREF(local_tb);
6832
Py_XINCREF(local_type);
6833
Py_XINCREF(local_value);
6834
*type = local_type;
6835
*value = local_value;
6836
*tb = local_tb;
6837
#if CYTHON_FAST_THREAD_STATE
6838
#if CYTHON_USE_EXC_INFO_STACK
6839
{
6840
_PyErr_StackItem *exc_info = tstate->exc_info;
6841
tmp_type = exc_info->exc_type;
6842
tmp_value = exc_info->exc_value;
6843
tmp_tb = exc_info->exc_traceback;
6844
exc_info->exc_type = local_type;
6845
exc_info->exc_value = local_value;
6846
exc_info->exc_traceback = local_tb;
6847
}
6848
#else
6849
tmp_type = tstate->exc_type;
6850
tmp_value = tstate->exc_value;
6851
tmp_tb = tstate->exc_traceback;
6852
tstate->exc_type = local_type;
6853
tstate->exc_value = local_value;
6854
tstate->exc_traceback = local_tb;
6855
#endif
6856
Py_XDECREF(tmp_type);
6857
Py_XDECREF(tmp_value);
6858
Py_XDECREF(tmp_tb);
6859
#else
6860
PyErr_SetExcInfo(local_type, local_value, local_tb);
6861
#endif
6862
return 0;
6863
bad:
6864
*type = 0;
6865
*value = 0;
6866
*tb = 0;
6867
Py_XDECREF(local_type);
6868
Py_XDECREF(local_value);
6869
Py_XDECREF(local_tb);
6870
return -1;
6871
}
6872
6873
/* TypeImport */
6874
#ifndef __PYX_HAVE_RT_ImportType
6875
#define __PYX_HAVE_RT_ImportType
6876
static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
6877
size_t size, enum __Pyx_ImportType_CheckSize check_size)
6878
{
6879
PyObject *result = 0;
6880
char warning[200];
6881
Py_ssize_t basicsize;
6882
#ifdef Py_LIMITED_API
6883
PyObject *py_basicsize;
6884
#endif
6885
result = PyObject_GetAttrString(module, class_name);
6886
if (!result)
6887
goto bad;
6888
if (!PyType_Check(result)) {
6889
PyErr_Format(PyExc_TypeError,
6890
"%.200s.%.200s is not a type object",
6891
module_name, class_name);
6892
goto bad;
6893
}
6894
#ifndef Py_LIMITED_API
6895
basicsize = ((PyTypeObject *)result)->tp_basicsize;
6896
#else
6897
py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
6898
if (!py_basicsize)
6899
goto bad;
6900
basicsize = PyLong_AsSsize_t(py_basicsize);
6901
Py_DECREF(py_basicsize);
6902
py_basicsize = 0;
6903
if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
6904
goto bad;
6905
#endif
6906
if ((size_t)basicsize < size) {
6907
PyErr_Format(PyExc_ValueError,
6908
"%.200s.%.200s size changed, may indicate binary incompatibility. "
6909
"Expected %zd from C header, got %zd from PyObject",
6910
module_name, class_name, size, basicsize);
6911
goto bad;
6912
}
6913
if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
6914
PyErr_Format(PyExc_ValueError,
6915
"%.200s.%.200s size changed, may indicate binary incompatibility. "
6916
"Expected %zd from C header, got %zd from PyObject",
6917
module_name, class_name, size, basicsize);
6918
goto bad;
6919
}
6920
else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
6921
PyOS_snprintf(warning, sizeof(warning),
6922
"%s.%s size changed, may indicate binary incompatibility. "
6923
"Expected %zd from C header, got %zd from PyObject",
6924
module_name, class_name, size, basicsize);
6925
if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
6926
}
6927
return (PyTypeObject *)result;
6928
bad:
6929
Py_XDECREF(result);
6930
return NULL;
6931
}
6932
#endif
6933
6934
/* Import */
6935
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
6936
PyObject *empty_list = 0;
6937
PyObject *module = 0;
6938
PyObject *global_dict = 0;
6939
PyObject *empty_dict = 0;
6940
PyObject *list;
6941
#if PY_MAJOR_VERSION < 3
6942
PyObject *py_import;
6943
py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
6944
if (!py_import)
6945
goto bad;
6946
#endif
6947
if (from_list)
6948
list = from_list;
6949
else {
6950
empty_list = PyList_New(0);
6951
if (!empty_list)
6952
goto bad;
6953
list = empty_list;
6954
}
6955
global_dict = PyModule_GetDict(__pyx_m);
6956
if (!global_dict)
6957
goto bad;
6958
empty_dict = PyDict_New();
6959
if (!empty_dict)
6960
goto bad;
6961
{
6962
#if PY_MAJOR_VERSION >= 3
6963
if (level == -1) {
6964
if (strchr(__Pyx_MODULE_NAME, '.')) {
6965
module = PyImport_ImportModuleLevelObject(
6966
name, global_dict, empty_dict, list, 1);
6967
if (!module) {
6968
if (!PyErr_ExceptionMatches(PyExc_ImportError))
6969
goto bad;
6970
PyErr_Clear();
6971
}
6972
}
6973
level = 0;
6974
}
6975
#endif
6976
if (!module) {
6977
#if PY_MAJOR_VERSION < 3
6978
PyObject *py_level = PyInt_FromLong(level);
6979
if (!py_level)
6980
goto bad;
6981
module = PyObject_CallFunctionObjArgs(py_import,
6982
name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
6983
Py_DECREF(py_level);
6984
#else
6985
module = PyImport_ImportModuleLevelObject(
6986
name, global_dict, empty_dict, list, level);
6987
#endif
6988
}
6989
}
6990
bad:
6991
#if PY_MAJOR_VERSION < 3
6992
Py_XDECREF(py_import);
6993
#endif
6994
Py_XDECREF(empty_list);
6995
Py_XDECREF(empty_dict);
6996
return module;
6997
}
6998
6999
/* CLineInTraceback */
7000
#ifndef CYTHON_CLINE_IN_TRACEBACK
7001
static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) {
7002
PyObject *use_cline;
7003
PyObject *ptype, *pvalue, *ptraceback;
7004
#if CYTHON_COMPILING_IN_CPYTHON
7005
PyObject **cython_runtime_dict;
7006
#endif
7007
if (unlikely(!__pyx_cython_runtime)) {
7008
return c_line;
7009
}
7010
__Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
7011
#if CYTHON_COMPILING_IN_CPYTHON
7012
cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
7013
if (likely(cython_runtime_dict)) {
7014
__PYX_PY_DICT_LOOKUP_IF_MODIFIED(
7015
use_cline, *cython_runtime_dict,
7016
__Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
7017
} else
7018
#endif
7019
{
7020
PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
7021
if (use_cline_obj) {
7022
use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
7023
Py_DECREF(use_cline_obj);
7024
} else {
7025
PyErr_Clear();
7026
use_cline = NULL;
7027
}
7028
}
7029
if (!use_cline) {
7030
c_line = 0;
7031
PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
7032
}
7033
else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
7034
c_line = 0;
7035
}
7036
__Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
7037
return c_line;
7038
}
7039
#endif
7040
7041
/* CodeObjectCache */
7042
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
7043
int start = 0, mid = 0, end = count - 1;
7044
if (end >= 0 && code_line > entries[end].code_line) {
7045
return count;
7046
}
7047
while (start < end) {
7048
mid = start + (end - start) / 2;
7049
if (code_line < entries[mid].code_line) {
7050
end = mid;
7051
} else if (code_line > entries[mid].code_line) {
7052
start = mid + 1;
7053
} else {
7054
return mid;
7055
}
7056
}
7057
if (code_line <= entries[mid].code_line) {
7058
return mid;
7059
} else {
7060
return mid + 1;
7061
}
7062
}
7063
static PyCodeObject *__pyx_find_code_object(int code_line) {
7064
PyCodeObject* code_object;
7065
int pos;
7066
if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
7067
return NULL;
7068
}
7069
pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
7070
if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
7071
return NULL;
7072
}
7073
code_object = __pyx_code_cache.entries[pos].code_object;
7074
Py_INCREF(code_object);
7075
return code_object;
7076
}
7077
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
7078
int pos, i;
7079
__Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
7080
if (unlikely(!code_line)) {
7081
return;
7082
}
7083
if (unlikely(!entries)) {
7084
entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
7085
if (likely(entries)) {
7086
__pyx_code_cache.entries = entries;
7087
__pyx_code_cache.max_count = 64;
7088
__pyx_code_cache.count = 1;
7089
entries[0].code_line = code_line;
7090
entries[0].code_object = code_object;
7091
Py_INCREF(code_object);
7092
}
7093
return;
7094
}
7095
pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
7096
if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
7097
PyCodeObject* tmp = entries[pos].code_object;
7098
entries[pos].code_object = code_object;
7099
Py_DECREF(tmp);
7100
return;
7101
}
7102
if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
7103
int new_max = __pyx_code_cache.max_count + 64;
7104
entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
7105
__pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
7106
if (unlikely(!entries)) {
7107
return;
7108
}
7109
__pyx_code_cache.entries = entries;
7110
__pyx_code_cache.max_count = new_max;
7111
}
7112
for (i=__pyx_code_cache.count; i>pos; i--) {
7113
entries[i] = entries[i-1];
7114
}
7115
entries[pos].code_line = code_line;
7116
entries[pos].code_object = code_object;
7117
__pyx_code_cache.count++;
7118
Py_INCREF(code_object);
7119
}
7120
7121
/* AddTraceback */
7122
#include "compile.h"
7123
#include "frameobject.h"
7124
#include "traceback.h"
7125
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
7126
const char *funcname, int c_line,
7127
int py_line, const char *filename) {
7128
PyCodeObject *py_code = 0;
7129
PyObject *py_srcfile = 0;
7130
PyObject *py_funcname = 0;
7131
#if PY_MAJOR_VERSION < 3
7132
py_srcfile = PyString_FromString(filename);
7133
#else
7134
py_srcfile = PyUnicode_FromString(filename);
7135
#endif
7136
if (!py_srcfile) goto bad;
7137
if (c_line) {
7138
#if PY_MAJOR_VERSION < 3
7139
py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
7140
#else
7141
py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
7142
#endif
7143
}
7144
else {
7145
#if PY_MAJOR_VERSION < 3
7146
py_funcname = PyString_FromString(funcname);
7147
#else
7148
py_funcname = PyUnicode_FromString(funcname);
7149
#endif
7150
}
7151
if (!py_funcname) goto bad;
7152
py_code = __Pyx_PyCode_New(
7153
0,
7154
0,
7155
0,
7156
0,
7157
0,
7158
__pyx_empty_bytes, /*PyObject *code,*/
7159
__pyx_empty_tuple, /*PyObject *consts,*/
7160
__pyx_empty_tuple, /*PyObject *names,*/
7161
__pyx_empty_tuple, /*PyObject *varnames,*/
7162
__pyx_empty_tuple, /*PyObject *freevars,*/
7163
__pyx_empty_tuple, /*PyObject *cellvars,*/
7164
py_srcfile, /*PyObject *filename,*/
7165
py_funcname, /*PyObject *name,*/
7166
py_line,
7167
__pyx_empty_bytes /*PyObject *lnotab*/
7168
);
7169
Py_DECREF(py_srcfile);
7170
Py_DECREF(py_funcname);
7171
return py_code;
7172
bad:
7173
Py_XDECREF(py_srcfile);
7174
Py_XDECREF(py_funcname);
7175
return NULL;
7176
}
7177
static void __Pyx_AddTraceback(const char *funcname, int c_line,
7178
int py_line, const char *filename) {
7179
PyCodeObject *py_code = 0;
7180
PyFrameObject *py_frame = 0;
7181
PyThreadState *tstate = __Pyx_PyThreadState_Current;
7182
if (c_line) {
7183
c_line = __Pyx_CLineForTraceback(tstate, c_line);
7184
}
7185
py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
7186
if (!py_code) {
7187
py_code = __Pyx_CreateCodeObjectForTraceback(
7188
funcname, c_line, py_line, filename);
7189
if (!py_code) goto bad;
7190
__pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
7191
}
7192
py_frame = PyFrame_New(
7193
tstate, /*PyThreadState *tstate,*/
7194
py_code, /*PyCodeObject *code,*/
7195
__pyx_d, /*PyObject *globals,*/
7196
0 /*PyObject *locals*/
7197
);
7198
if (!py_frame) goto bad;
7199
__Pyx_PyFrame_SetLineNumber(py_frame, py_line);
7200
PyTraceBack_Here(py_frame);
7201
bad:
7202
Py_XDECREF(py_code);
7203
Py_XDECREF(py_frame);
7204
}
7205
7206
#if PY_MAJOR_VERSION < 3
7207
static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
7208
if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
7209
if (__Pyx_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags);
7210
PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
7211
return -1;
7212
}
7213
static void __Pyx_ReleaseBuffer(Py_buffer *view) {
7214
PyObject *obj = view->obj;
7215
if (!obj) return;
7216
if (PyObject_CheckBuffer(obj)) {
7217
PyBuffer_Release(view);
7218
return;
7219
}
7220
if ((0)) {}
7221
else if (__Pyx_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view);
7222
view->obj = NULL;
7223
Py_DECREF(obj);
7224
}
7225
#endif
7226
7227
7228
/* CIntFromPyVerify */
7229
#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
7230
__PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
7231
#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
7232
__PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
7233
#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
7234
{\
7235
func_type value = func_value;\
7236
if (sizeof(target_type) < sizeof(func_type)) {\
7237
if (unlikely(value != (func_type) (target_type) value)) {\
7238
func_type zero = 0;\
7239
if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
7240
return (target_type) -1;\
7241
if (is_unsigned && unlikely(value < zero))\
7242
goto raise_neg_overflow;\
7243
else\
7244
goto raise_overflow;\
7245
}\
7246
}\
7247
return (target_type) value;\
7248
}
7249
7250
/* CIntToPy */
7251
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
7252
const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
7253
const int is_unsigned = neg_one > const_zero;
7254
if (is_unsigned) {
7255
if (sizeof(int) < sizeof(long)) {
7256
return PyInt_FromLong((long) value);
7257
} else if (sizeof(int) <= sizeof(unsigned long)) {
7258
return PyLong_FromUnsignedLong((unsigned long) value);
7259
#ifdef HAVE_LONG_LONG
7260
} else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
7261
return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
7262
#endif
7263
}
7264
} else {
7265
if (sizeof(int) <= sizeof(long)) {
7266
return PyInt_FromLong((long) value);
7267
#ifdef HAVE_LONG_LONG
7268
} else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
7269
return PyLong_FromLongLong((PY_LONG_LONG) value);
7270
#endif
7271
}
7272
}
7273
{
7274
int one = 1; int little = (int)*(unsigned char *)&one;
7275
unsigned char *bytes = (unsigned char *)&value;
7276
return _PyLong_FromByteArray(bytes, sizeof(int),
7277
little, !is_unsigned);
7278
}
7279
}
7280
7281
/* Declarations */
7282
#if CYTHON_CCOMPLEX
7283
#ifdef __cplusplus
7284
static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
7285
return ::std::complex< float >(x, y);
7286
}
7287
#else
7288
static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
7289
return x + y*(__pyx_t_float_complex)_Complex_I;
7290
}
7291
#endif
7292
#else
7293
static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
7294
__pyx_t_float_complex z;
7295
z.real = x;
7296
z.imag = y;
7297
return z;
7298
}
7299
#endif
7300
7301
/* Arithmetic */
7302
#if CYTHON_CCOMPLEX
7303
#else
7304
static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
7305
return (a.real == b.real) && (a.imag == b.imag);
7306
}
7307
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
7308
__pyx_t_float_complex z;
7309
z.real = a.real + b.real;
7310
z.imag = a.imag + b.imag;
7311
return z;
7312
}
7313
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
7314
__pyx_t_float_complex z;
7315
z.real = a.real - b.real;
7316
z.imag = a.imag - b.imag;
7317
return z;
7318
}
7319
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
7320
__pyx_t_float_complex z;
7321
z.real = a.real * b.real - a.imag * b.imag;
7322
z.imag = a.real * b.imag + a.imag * b.real;
7323
return z;
7324
}
7325
#if 1
7326
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
7327
if (b.imag == 0) {
7328
return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
7329
} else if (fabsf(b.real) >= fabsf(b.imag)) {
7330
if (b.real == 0 && b.imag == 0) {
7331
return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag);
7332
} else {
7333
float r = b.imag / b.real;
7334
float s = (float)(1.0) / (b.real + b.imag * r);
7335
return __pyx_t_float_complex_from_parts(
7336
(a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
7337
}
7338
} else {
7339
float r = b.real / b.imag;
7340
float s = (float)(1.0) / (b.imag + b.real * r);
7341
return __pyx_t_float_complex_from_parts(
7342
(a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
7343
}
7344
}
7345
#else
7346
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
7347
if (b.imag == 0) {
7348
return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
7349
} else {
7350
float denom = b.real * b.real + b.imag * b.imag;
7351
return __pyx_t_float_complex_from_parts(
7352
(a.real * b.real + a.imag * b.imag) / denom,
7353
(a.imag * b.real - a.real * b.imag) / denom);
7354
}
7355
}
7356
#endif
7357
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
7358
__pyx_t_float_complex z;
7359
z.real = -a.real;
7360
z.imag = -a.imag;
7361
return z;
7362
}
7363
static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
7364
return (a.real == 0) && (a.imag == 0);
7365
}
7366
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
7367
__pyx_t_float_complex z;
7368
z.real = a.real;
7369
z.imag = -a.imag;
7370
return z;
7371
}
7372
#if 1
7373
static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) {
7374
#if !defined(HAVE_HYPOT) || defined(_MSC_VER)
7375
return sqrtf(z.real*z.real + z.imag*z.imag);
7376
#else
7377
return hypotf(z.real, z.imag);
7378
#endif
7379
}
7380
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
7381
__pyx_t_float_complex z;
7382
float r, lnr, theta, z_r, z_theta;
7383
if (b.imag == 0 && b.real == (int)b.real) {
7384
if (b.real < 0) {
7385
float denom = a.real * a.real + a.imag * a.imag;
7386
a.real = a.real / denom;
7387
a.imag = -a.imag / denom;
7388
b.real = -b.real;
7389
}
7390
switch ((int)b.real) {
7391
case 0:
7392
z.real = 1;
7393
z.imag = 0;
7394
return z;
7395
case 1:
7396
return a;
7397
case 2:
7398
return __Pyx_c_prod_float(a, a);
7399
case 3:
7400
z = __Pyx_c_prod_float(a, a);
7401
return __Pyx_c_prod_float(z, a);
7402
case 4:
7403
z = __Pyx_c_prod_float(a, a);
7404
return __Pyx_c_prod_float(z, z);
7405
}
7406
}
7407
if (a.imag == 0) {
7408
if (a.real == 0) {
7409
return a;
7410
} else if (b.imag == 0) {
7411
z.real = powf(a.real, b.real);
7412
z.imag = 0;
7413
return z;
7414
} else if (a.real > 0) {
7415
r = a.real;
7416
theta = 0;
7417
} else {
7418
r = -a.real;
7419
theta = atan2f(0.0, -1.0);
7420
}
7421
} else {
7422
r = __Pyx_c_abs_float(a);
7423
theta = atan2f(a.imag, a.real);
7424
}
7425
lnr = logf(r);
7426
z_r = expf(lnr * b.real - theta * b.imag);
7427
z_theta = theta * b.real + lnr * b.imag;
7428
z.real = z_r * cosf(z_theta);
7429
z.imag = z_r * sinf(z_theta);
7430
return z;
7431
}
7432
#endif
7433
#endif
7434
7435
/* Declarations */
7436
#if CYTHON_CCOMPLEX
7437
#ifdef __cplusplus
7438
static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
7439
return ::std::complex< double >(x, y);
7440
}
7441
#else
7442
static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
7443
return x + y*(__pyx_t_double_complex)_Complex_I;
7444
}
7445
#endif
7446
#else
7447
static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
7448
__pyx_t_double_complex z;
7449
z.real = x;
7450
z.imag = y;
7451
return z;
7452
}
7453
#endif
7454
7455
/* Arithmetic */
7456
#if CYTHON_CCOMPLEX
7457
#else
7458
static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
7459
return (a.real == b.real) && (a.imag == b.imag);
7460
}
7461
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
7462
__pyx_t_double_complex z;
7463
z.real = a.real + b.real;
7464
z.imag = a.imag + b.imag;
7465
return z;
7466
}
7467
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
7468
__pyx_t_double_complex z;
7469
z.real = a.real - b.real;
7470
z.imag = a.imag - b.imag;
7471
return z;
7472
}
7473
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
7474
__pyx_t_double_complex z;
7475
z.real = a.real * b.real - a.imag * b.imag;
7476
z.imag = a.real * b.imag + a.imag * b.real;
7477
return z;
7478
}
7479
#if 1
7480
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
7481
if (b.imag == 0) {
7482
return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
7483
} else if (fabs(b.real) >= fabs(b.imag)) {
7484
if (b.real == 0 && b.imag == 0) {
7485
return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
7486
} else {
7487
double r = b.imag / b.real;
7488
double s = (double)(1.0) / (b.real + b.imag * r);
7489
return __pyx_t_double_complex_from_parts(
7490
(a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
7491
}
7492
} else {
7493
double r = b.real / b.imag;
7494
double s = (double)(1.0) / (b.imag + b.real * r);
7495
return __pyx_t_double_complex_from_parts(
7496
(a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
7497
}
7498
}
7499
#else
7500
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
7501
if (b.imag == 0) {
7502
return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
7503
} else {
7504
double denom = b.real * b.real + b.imag * b.imag;
7505
return __pyx_t_double_complex_from_parts(
7506
(a.real * b.real + a.imag * b.imag) / denom,
7507
(a.imag * b.real - a.real * b.imag) / denom);
7508
}
7509
}
7510
#endif
7511
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
7512
__pyx_t_double_complex z;
7513
z.real = -a.real;
7514
z.imag = -a.imag;
7515
return z;
7516
}
7517
static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
7518
return (a.real == 0) && (a.imag == 0);
7519
}
7520
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
7521
__pyx_t_double_complex z;
7522
z.real = a.real;
7523
z.imag = -a.imag;
7524
return z;
7525
}
7526
#if 1
7527
static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) {
7528
#if !defined(HAVE_HYPOT) || defined(_MSC_VER)
7529
return sqrt(z.real*z.real + z.imag*z.imag);
7530
#else
7531
return hypot(z.real, z.imag);
7532
#endif
7533
}
7534
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
7535
__pyx_t_double_complex z;
7536
double r, lnr, theta, z_r, z_theta;
7537
if (b.imag == 0 && b.real == (int)b.real) {
7538
if (b.real < 0) {
7539
double denom = a.real * a.real + a.imag * a.imag;
7540
a.real = a.real / denom;
7541
a.imag = -a.imag / denom;
7542
b.real = -b.real;
7543
}
7544
switch ((int)b.real) {
7545
case 0:
7546
z.real = 1;
7547
z.imag = 0;
7548
return z;
7549
case 1:
7550
return a;
7551
case 2:
7552
return __Pyx_c_prod_double(a, a);
7553
case 3:
7554
z = __Pyx_c_prod_double(a, a);
7555
return __Pyx_c_prod_double(z, a);
7556
case 4:
7557
z = __Pyx_c_prod_double(a, a);
7558
return __Pyx_c_prod_double(z, z);
7559
}
7560
}
7561
if (a.imag == 0) {
7562
if (a.real == 0) {
7563
return a;
7564
} else if (b.imag == 0) {
7565
z.real = pow(a.real, b.real);
7566
z.imag = 0;
7567
return z;
7568
} else if (a.real > 0) {
7569
r = a.real;
7570
theta = 0;
7571
} else {
7572
r = -a.real;
7573
theta = atan2(0.0, -1.0);
7574
}
7575
} else {
7576
r = __Pyx_c_abs_double(a);
7577
theta = atan2(a.imag, a.real);
7578
}
7579
lnr = log(r);
7580
z_r = exp(lnr * b.real - theta * b.imag);
7581
z_theta = theta * b.real + lnr * b.imag;
7582
z.real = z_r * cos(z_theta);
7583
z.imag = z_r * sin(z_theta);
7584
return z;
7585
}
7586
#endif
7587
#endif
7588
7589
/* CIntToPy */
7590
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value) {
7591
const enum NPY_TYPES neg_one = (enum NPY_TYPES) ((enum NPY_TYPES) 0 - (enum NPY_TYPES) 1), const_zero = (enum NPY_TYPES) 0;
7592
const int is_unsigned = neg_one > const_zero;
7593
if (is_unsigned) {
7594
if (sizeof(enum NPY_TYPES) < sizeof(long)) {
7595
return PyInt_FromLong((long) value);
7596
} else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned long)) {
7597
return PyLong_FromUnsignedLong((unsigned long) value);
7598
#ifdef HAVE_LONG_LONG
7599
} else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned PY_LONG_LONG)) {
7600
return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
7601
#endif
7602
}
7603
} else {
7604
if (sizeof(enum NPY_TYPES) <= sizeof(long)) {
7605
return PyInt_FromLong((long) value);
7606
#ifdef HAVE_LONG_LONG
7607
} else if (sizeof(enum NPY_TYPES) <= sizeof(PY_LONG_LONG)) {
7608
return PyLong_FromLongLong((PY_LONG_LONG) value);
7609
#endif
7610
}
7611
}
7612
{
7613
int one = 1; int little = (int)*(unsigned char *)&one;
7614
unsigned char *bytes = (unsigned char *)&value;
7615
return _PyLong_FromByteArray(bytes, sizeof(enum NPY_TYPES),
7616
little, !is_unsigned);
7617
}
7618
}
7619
7620
/* CIntFromPy */
7621
static CYTHON_INLINE npy_int32 __Pyx_PyInt_As_npy_int32(PyObject *x) {
7622
const npy_int32 neg_one = (npy_int32) ((npy_int32) 0 - (npy_int32) 1), const_zero = (npy_int32) 0;
7623
const int is_unsigned = neg_one > const_zero;
7624
#if PY_MAJOR_VERSION < 3
7625
if (likely(PyInt_Check(x))) {
7626
if (sizeof(npy_int32) < sizeof(long)) {
7627
__PYX_VERIFY_RETURN_INT(npy_int32, long, PyInt_AS_LONG(x))
7628
} else {
7629
long val = PyInt_AS_LONG(x);
7630
if (is_unsigned && unlikely(val < 0)) {
7631
goto raise_neg_overflow;
7632
}
7633
return (npy_int32) val;
7634
}
7635
} else
7636
#endif
7637
if (likely(PyLong_Check(x))) {
7638
if (is_unsigned) {
7639
#if CYTHON_USE_PYLONG_INTERNALS
7640
const digit* digits = ((PyLongObject*)x)->ob_digit;
7641
switch (Py_SIZE(x)) {
7642
case 0: return (npy_int32) 0;
7643
case 1: __PYX_VERIFY_RETURN_INT(npy_int32, digit, digits[0])
7644
case 2:
7645
if (8 * sizeof(npy_int32) > 1 * PyLong_SHIFT) {
7646
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
7647
__PYX_VERIFY_RETURN_INT(npy_int32, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7648
} else if (8 * sizeof(npy_int32) >= 2 * PyLong_SHIFT) {
7649
return (npy_int32) (((((npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0]));
7650
}
7651
}
7652
break;
7653
case 3:
7654
if (8 * sizeof(npy_int32) > 2 * PyLong_SHIFT) {
7655
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
7656
__PYX_VERIFY_RETURN_INT(npy_int32, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7657
} else if (8 * sizeof(npy_int32) >= 3 * PyLong_SHIFT) {
7658
return (npy_int32) (((((((npy_int32)digits[2]) << PyLong_SHIFT) | (npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0]));
7659
}
7660
}
7661
break;
7662
case 4:
7663
if (8 * sizeof(npy_int32) > 3 * PyLong_SHIFT) {
7664
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
7665
__PYX_VERIFY_RETURN_INT(npy_int32, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7666
} else if (8 * sizeof(npy_int32) >= 4 * PyLong_SHIFT) {
7667
return (npy_int32) (((((((((npy_int32)digits[3]) << PyLong_SHIFT) | (npy_int32)digits[2]) << PyLong_SHIFT) | (npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0]));
7668
}
7669
}
7670
break;
7671
}
7672
#endif
7673
#if CYTHON_COMPILING_IN_CPYTHON
7674
if (unlikely(Py_SIZE(x) < 0)) {
7675
goto raise_neg_overflow;
7676
}
7677
#else
7678
{
7679
int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
7680
if (unlikely(result < 0))
7681
return (npy_int32) -1;
7682
if (unlikely(result == 1))
7683
goto raise_neg_overflow;
7684
}
7685
#endif
7686
if (sizeof(npy_int32) <= sizeof(unsigned long)) {
7687
__PYX_VERIFY_RETURN_INT_EXC(npy_int32, unsigned long, PyLong_AsUnsignedLong(x))
7688
#ifdef HAVE_LONG_LONG
7689
} else if (sizeof(npy_int32) <= sizeof(unsigned PY_LONG_LONG)) {
7690
__PYX_VERIFY_RETURN_INT_EXC(npy_int32, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
7691
#endif
7692
}
7693
} else {
7694
#if CYTHON_USE_PYLONG_INTERNALS
7695
const digit* digits = ((PyLongObject*)x)->ob_digit;
7696
switch (Py_SIZE(x)) {
7697
case 0: return (npy_int32) 0;
7698
case -1: __PYX_VERIFY_RETURN_INT(npy_int32, sdigit, (sdigit) (-(sdigit)digits[0]))
7699
case 1: __PYX_VERIFY_RETURN_INT(npy_int32, digit, +digits[0])
7700
case -2:
7701
if (8 * sizeof(npy_int32) - 1 > 1 * PyLong_SHIFT) {
7702
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
7703
__PYX_VERIFY_RETURN_INT(npy_int32, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7704
} else if (8 * sizeof(npy_int32) - 1 > 2 * PyLong_SHIFT) {
7705
return (npy_int32) (((npy_int32)-1)*(((((npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0])));
7706
}
7707
}
7708
break;
7709
case 2:
7710
if (8 * sizeof(npy_int32) > 1 * PyLong_SHIFT) {
7711
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
7712
__PYX_VERIFY_RETURN_INT(npy_int32, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7713
} else if (8 * sizeof(npy_int32) - 1 > 2 * PyLong_SHIFT) {
7714
return (npy_int32) ((((((npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0])));
7715
}
7716
}
7717
break;
7718
case -3:
7719
if (8 * sizeof(npy_int32) - 1 > 2 * PyLong_SHIFT) {
7720
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
7721
__PYX_VERIFY_RETURN_INT(npy_int32, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7722
} else if (8 * sizeof(npy_int32) - 1 > 3 * PyLong_SHIFT) {
7723
return (npy_int32) (((npy_int32)-1)*(((((((npy_int32)digits[2]) << PyLong_SHIFT) | (npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0])));
7724
}
7725
}
7726
break;
7727
case 3:
7728
if (8 * sizeof(npy_int32) > 2 * PyLong_SHIFT) {
7729
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
7730
__PYX_VERIFY_RETURN_INT(npy_int32, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7731
} else if (8 * sizeof(npy_int32) - 1 > 3 * PyLong_SHIFT) {
7732
return (npy_int32) ((((((((npy_int32)digits[2]) << PyLong_SHIFT) | (npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0])));
7733
}
7734
}
7735
break;
7736
case -4:
7737
if (8 * sizeof(npy_int32) - 1 > 3 * PyLong_SHIFT) {
7738
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
7739
__PYX_VERIFY_RETURN_INT(npy_int32, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7740
} else if (8 * sizeof(npy_int32) - 1 > 4 * PyLong_SHIFT) {
7741
return (npy_int32) (((npy_int32)-1)*(((((((((npy_int32)digits[3]) << PyLong_SHIFT) | (npy_int32)digits[2]) << PyLong_SHIFT) | (npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0])));
7742
}
7743
}
7744
break;
7745
case 4:
7746
if (8 * sizeof(npy_int32) > 3 * PyLong_SHIFT) {
7747
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
7748
__PYX_VERIFY_RETURN_INT(npy_int32, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7749
} else if (8 * sizeof(npy_int32) - 1 > 4 * PyLong_SHIFT) {
7750
return (npy_int32) ((((((((((npy_int32)digits[3]) << PyLong_SHIFT) | (npy_int32)digits[2]) << PyLong_SHIFT) | (npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0])));
7751
}
7752
}
7753
break;
7754
}
7755
#endif
7756
if (sizeof(npy_int32) <= sizeof(long)) {
7757
__PYX_VERIFY_RETURN_INT_EXC(npy_int32, long, PyLong_AsLong(x))
7758
#ifdef HAVE_LONG_LONG
7759
} else if (sizeof(npy_int32) <= sizeof(PY_LONG_LONG)) {
7760
__PYX_VERIFY_RETURN_INT_EXC(npy_int32, PY_LONG_LONG, PyLong_AsLongLong(x))
7761
#endif
7762
}
7763
}
7764
{
7765
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
7766
PyErr_SetString(PyExc_RuntimeError,
7767
"_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
7768
#else
7769
npy_int32 val;
7770
PyObject *v = __Pyx_PyNumber_IntOrLong(x);
7771
#if PY_MAJOR_VERSION < 3
7772
if (likely(v) && !PyLong_Check(v)) {
7773
PyObject *tmp = v;
7774
v = PyNumber_Long(tmp);
7775
Py_DECREF(tmp);
7776
}
7777
#endif
7778
if (likely(v)) {
7779
int one = 1; int is_little = (int)*(unsigned char *)&one;
7780
unsigned char *bytes = (unsigned char *)&val;
7781
int ret = _PyLong_AsByteArray((PyLongObject *)v,
7782
bytes, sizeof(val),
7783
is_little, !is_unsigned);
7784
Py_DECREF(v);
7785
if (likely(!ret))
7786
return val;
7787
}
7788
#endif
7789
return (npy_int32) -1;
7790
}
7791
} else {
7792
npy_int32 val;
7793
PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
7794
if (!tmp) return (npy_int32) -1;
7795
val = __Pyx_PyInt_As_npy_int32(tmp);
7796
Py_DECREF(tmp);
7797
return val;
7798
}
7799
raise_overflow:
7800
PyErr_SetString(PyExc_OverflowError,
7801
"value too large to convert to npy_int32");
7802
return (npy_int32) -1;
7803
raise_neg_overflow:
7804
PyErr_SetString(PyExc_OverflowError,
7805
"can't convert negative value to npy_int32");
7806
return (npy_int32) -1;
7807
}
7808
7809
/* CIntFromPy */
7810
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
7811
const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
7812
const int is_unsigned = neg_one > const_zero;
7813
#if PY_MAJOR_VERSION < 3
7814
if (likely(PyInt_Check(x))) {
7815
if (sizeof(int) < sizeof(long)) {
7816
__PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
7817
} else {
7818
long val = PyInt_AS_LONG(x);
7819
if (is_unsigned && unlikely(val < 0)) {
7820
goto raise_neg_overflow;
7821
}
7822
return (int) val;
7823
}
7824
} else
7825
#endif
7826
if (likely(PyLong_Check(x))) {
7827
if (is_unsigned) {
7828
#if CYTHON_USE_PYLONG_INTERNALS
7829
const digit* digits = ((PyLongObject*)x)->ob_digit;
7830
switch (Py_SIZE(x)) {
7831
case 0: return (int) 0;
7832
case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
7833
case 2:
7834
if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
7835
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
7836
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7837
} else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
7838
return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
7839
}
7840
}
7841
break;
7842
case 3:
7843
if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
7844
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
7845
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7846
} else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
7847
return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
7848
}
7849
}
7850
break;
7851
case 4:
7852
if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
7853
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
7854
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7855
} else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
7856
return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
7857
}
7858
}
7859
break;
7860
}
7861
#endif
7862
#if CYTHON_COMPILING_IN_CPYTHON
7863
if (unlikely(Py_SIZE(x) < 0)) {
7864
goto raise_neg_overflow;
7865
}
7866
#else
7867
{
7868
int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
7869
if (unlikely(result < 0))
7870
return (int) -1;
7871
if (unlikely(result == 1))
7872
goto raise_neg_overflow;
7873
}
7874
#endif
7875
if (sizeof(int) <= sizeof(unsigned long)) {
7876
__PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
7877
#ifdef HAVE_LONG_LONG
7878
} else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
7879
__PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
7880
#endif
7881
}
7882
} else {
7883
#if CYTHON_USE_PYLONG_INTERNALS
7884
const digit* digits = ((PyLongObject*)x)->ob_digit;
7885
switch (Py_SIZE(x)) {
7886
case 0: return (int) 0;
7887
case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
7888
case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
7889
case -2:
7890
if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
7891
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
7892
__PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7893
} else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
7894
return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
7895
}
7896
}
7897
break;
7898
case 2:
7899
if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
7900
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
7901
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7902
} else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
7903
return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
7904
}
7905
}
7906
break;
7907
case -3:
7908
if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
7909
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
7910
__PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7911
} else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
7912
return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
7913
}
7914
}
7915
break;
7916
case 3:
7917
if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
7918
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
7919
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7920
} else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
7921
return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
7922
}
7923
}
7924
break;
7925
case -4:
7926
if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
7927
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
7928
__PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7929
} else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
7930
return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
7931
}
7932
}
7933
break;
7934
case 4:
7935
if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
7936
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
7937
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7938
} else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
7939
return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
7940
}
7941
}
7942
break;
7943
}
7944
#endif
7945
if (sizeof(int) <= sizeof(long)) {
7946
__PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
7947
#ifdef HAVE_LONG_LONG
7948
} else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
7949
__PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
7950
#endif
7951
}
7952
}
7953
{
7954
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
7955
PyErr_SetString(PyExc_RuntimeError,
7956
"_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
7957
#else
7958
int val;
7959
PyObject *v = __Pyx_PyNumber_IntOrLong(x);
7960
#if PY_MAJOR_VERSION < 3
7961
if (likely(v) && !PyLong_Check(v)) {
7962
PyObject *tmp = v;
7963
v = PyNumber_Long(tmp);
7964
Py_DECREF(tmp);
7965
}
7966
#endif
7967
if (likely(v)) {
7968
int one = 1; int is_little = (int)*(unsigned char *)&one;
7969
unsigned char *bytes = (unsigned char *)&val;
7970
int ret = _PyLong_AsByteArray((PyLongObject *)v,
7971
bytes, sizeof(val),
7972
is_little, !is_unsigned);
7973
Py_DECREF(v);
7974
if (likely(!ret))
7975
return val;
7976
}
7977
#endif
7978
return (int) -1;
7979
}
7980
} else {
7981
int val;
7982
PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
7983
if (!tmp) return (int) -1;
7984
val = __Pyx_PyInt_As_int(tmp);
7985
Py_DECREF(tmp);
7986
return val;
7987
}
7988
raise_overflow:
7989
PyErr_SetString(PyExc_OverflowError,
7990
"value too large to convert to int");
7991
return (int) -1;
7992
raise_neg_overflow:
7993
PyErr_SetString(PyExc_OverflowError,
7994
"can't convert negative value to int");
7995
return (int) -1;
7996
}
7997
7998
/* CIntToPy */
7999
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
8000
const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
8001
const int is_unsigned = neg_one > const_zero;
8002
if (is_unsigned) {
8003
if (sizeof(long) < sizeof(long)) {
8004
return PyInt_FromLong((long) value);
8005
} else if (sizeof(long) <= sizeof(unsigned long)) {
8006
return PyLong_FromUnsignedLong((unsigned long) value);
8007
#ifdef HAVE_LONG_LONG
8008
} else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
8009
return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
8010
#endif
8011
}
8012
} else {
8013
if (sizeof(long) <= sizeof(long)) {
8014
return PyInt_FromLong((long) value);
8015
#ifdef HAVE_LONG_LONG
8016
} else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
8017
return PyLong_FromLongLong((PY_LONG_LONG) value);
8018
#endif
8019
}
8020
}
8021
{
8022
int one = 1; int little = (int)*(unsigned char *)&one;
8023
unsigned char *bytes = (unsigned char *)&value;
8024
return _PyLong_FromByteArray(bytes, sizeof(long),
8025
little, !is_unsigned);
8026
}
8027
}
8028
8029
/* CIntFromPy */
8030
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
8031
const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
8032
const int is_unsigned = neg_one > const_zero;
8033
#if PY_MAJOR_VERSION < 3
8034
if (likely(PyInt_Check(x))) {
8035
if (sizeof(long) < sizeof(long)) {
8036
__PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
8037
} else {
8038
long val = PyInt_AS_LONG(x);
8039
if (is_unsigned && unlikely(val < 0)) {
8040
goto raise_neg_overflow;
8041
}
8042
return (long) val;
8043
}
8044
} else
8045
#endif
8046
if (likely(PyLong_Check(x))) {
8047
if (is_unsigned) {
8048
#if CYTHON_USE_PYLONG_INTERNALS
8049
const digit* digits = ((PyLongObject*)x)->ob_digit;
8050
switch (Py_SIZE(x)) {
8051
case 0: return (long) 0;
8052
case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
8053
case 2:
8054
if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
8055
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
8056
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8057
} else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
8058
return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
8059
}
8060
}
8061
break;
8062
case 3:
8063
if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
8064
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
8065
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8066
} else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
8067
return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
8068
}
8069
}
8070
break;
8071
case 4:
8072
if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
8073
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
8074
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8075
} else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
8076
return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
8077
}
8078
}
8079
break;
8080
}
8081
#endif
8082
#if CYTHON_COMPILING_IN_CPYTHON
8083
if (unlikely(Py_SIZE(x) < 0)) {
8084
goto raise_neg_overflow;
8085
}
8086
#else
8087
{
8088
int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
8089
if (unlikely(result < 0))
8090
return (long) -1;
8091
if (unlikely(result == 1))
8092
goto raise_neg_overflow;
8093
}
8094
#endif
8095
if (sizeof(long) <= sizeof(unsigned long)) {
8096
__PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
8097
#ifdef HAVE_LONG_LONG
8098
} else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
8099
__PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
8100
#endif
8101
}
8102
} else {
8103
#if CYTHON_USE_PYLONG_INTERNALS
8104
const digit* digits = ((PyLongObject*)x)->ob_digit;
8105
switch (Py_SIZE(x)) {
8106
case 0: return (long) 0;
8107
case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
8108
case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
8109
case -2:
8110
if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
8111
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
8112
__PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8113
} else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
8114
return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
8115
}
8116
}
8117
break;
8118
case 2:
8119
if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
8120
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
8121
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8122
} else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
8123
return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
8124
}
8125
}
8126
break;
8127
case -3:
8128
if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
8129
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
8130
__PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8131
} else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
8132
return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
8133
}
8134
}
8135
break;
8136
case 3:
8137
if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
8138
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
8139
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8140
} else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
8141
return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
8142
}
8143
}
8144
break;
8145
case -4:
8146
if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
8147
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
8148
__PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8149
} else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
8150
return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
8151
}
8152
}
8153
break;
8154
case 4:
8155
if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
8156
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
8157
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8158
} else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
8159
return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
8160
}
8161
}
8162
break;
8163
}
8164
#endif
8165
if (sizeof(long) <= sizeof(long)) {
8166
__PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
8167
#ifdef HAVE_LONG_LONG
8168
} else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
8169
__PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
8170
#endif
8171
}
8172
}
8173
{
8174
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
8175
PyErr_SetString(PyExc_RuntimeError,
8176
"_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
8177
#else
8178
long val;
8179
PyObject *v = __Pyx_PyNumber_IntOrLong(x);
8180
#if PY_MAJOR_VERSION < 3
8181
if (likely(v) && !PyLong_Check(v)) {
8182
PyObject *tmp = v;
8183
v = PyNumber_Long(tmp);
8184
Py_DECREF(tmp);
8185
}
8186
#endif
8187
if (likely(v)) {
8188
int one = 1; int is_little = (int)*(unsigned char *)&one;
8189
unsigned char *bytes = (unsigned char *)&val;
8190
int ret = _PyLong_AsByteArray((PyLongObject *)v,
8191
bytes, sizeof(val),
8192
is_little, !is_unsigned);
8193
Py_DECREF(v);
8194
if (likely(!ret))
8195
return val;
8196
}
8197
#endif
8198
return (long) -1;
8199
}
8200
} else {
8201
long val;
8202
PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
8203
if (!tmp) return (long) -1;
8204
val = __Pyx_PyInt_As_long(tmp);
8205
Py_DECREF(tmp);
8206
return val;
8207
}
8208
raise_overflow:
8209
PyErr_SetString(PyExc_OverflowError,
8210
"value too large to convert to long");
8211
return (long) -1;
8212
raise_neg_overflow:
8213
PyErr_SetString(PyExc_OverflowError,
8214
"can't convert negative value to long");
8215
return (long) -1;
8216
}
8217
8218
/* FastTypeChecks */
8219
#if CYTHON_COMPILING_IN_CPYTHON
8220
static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
8221
while (a) {
8222
a = a->tp_base;
8223
if (a == b)
8224
return 1;
8225
}
8226
return b == &PyBaseObject_Type;
8227
}
8228
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
8229
PyObject *mro;
8230
if (a == b) return 1;
8231
mro = a->tp_mro;
8232
if (likely(mro)) {
8233
Py_ssize_t i, n;
8234
n = PyTuple_GET_SIZE(mro);
8235
for (i = 0; i < n; i++) {
8236
if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
8237
return 1;
8238
}
8239
return 0;
8240
}
8241
return __Pyx_InBases(a, b);
8242
}
8243
#if PY_MAJOR_VERSION == 2
8244
static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
8245
PyObject *exception, *value, *tb;
8246
int res;
8247
__Pyx_PyThreadState_declare
8248
__Pyx_PyThreadState_assign
8249
__Pyx_ErrFetch(&exception, &value, &tb);
8250
res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
8251
if (unlikely(res == -1)) {
8252
PyErr_WriteUnraisable(err);
8253
res = 0;
8254
}
8255
if (!res) {
8256
res = PyObject_IsSubclass(err, exc_type2);
8257
if (unlikely(res == -1)) {
8258
PyErr_WriteUnraisable(err);
8259
res = 0;
8260
}
8261
}
8262
__Pyx_ErrRestore(exception, value, tb);
8263
return res;
8264
}
8265
#else
8266
static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
8267
int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
8268
if (!res) {
8269
res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
8270
}
8271
return res;
8272
}
8273
#endif
8274
static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
8275
Py_ssize_t i, n;
8276
assert(PyExceptionClass_Check(exc_type));
8277
n = PyTuple_GET_SIZE(tuple);
8278
#if PY_MAJOR_VERSION >= 3
8279
for (i=0; i<n; i++) {
8280
if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
8281
}
8282
#endif
8283
for (i=0; i<n; i++) {
8284
PyObject *t = PyTuple_GET_ITEM(tuple, i);
8285
#if PY_MAJOR_VERSION < 3
8286
if (likely(exc_type == t)) return 1;
8287
#endif
8288
if (likely(PyExceptionClass_Check(t))) {
8289
if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
8290
} else {
8291
}
8292
}
8293
return 0;
8294
}
8295
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
8296
if (likely(err == exc_type)) return 1;
8297
if (likely(PyExceptionClass_Check(err))) {
8298
if (likely(PyExceptionClass_Check(exc_type))) {
8299
return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
8300
} else if (likely(PyTuple_Check(exc_type))) {
8301
return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
8302
} else {
8303
}
8304
}
8305
return PyErr_GivenExceptionMatches(err, exc_type);
8306
}
8307
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
8308
assert(PyExceptionClass_Check(exc_type1));
8309
assert(PyExceptionClass_Check(exc_type2));
8310
if (likely(err == exc_type1 || err == exc_type2)) return 1;
8311
if (likely(PyExceptionClass_Check(err))) {
8312
return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
8313
}
8314
return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
8315
}
8316
#endif
8317
8318
/* CheckBinaryVersion */
8319
static int __Pyx_check_binary_version(void) {
8320
char ctversion[4], rtversion[4];
8321
PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
8322
PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
8323
if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
8324
char message[200];
8325
PyOS_snprintf(message, sizeof(message),
8326
"compiletime version %s of module '%.100s' "
8327
"does not match runtime version %s",
8328
ctversion, __Pyx_MODULE_NAME, rtversion);
8329
return PyErr_WarnEx(NULL, message, 1);
8330
}
8331
return 0;
8332
}
8333
8334
/* InitStrings */
8335
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
8336
while (t->p) {
8337
#if PY_MAJOR_VERSION < 3
8338
if (t->is_unicode) {
8339
*t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
8340
} else if (t->intern) {
8341
*t->p = PyString_InternFromString(t->s);
8342
} else {
8343
*t->p = PyString_FromStringAndSize(t->s, t->n - 1);
8344
}
8345
#else
8346
if (t->is_unicode | t->is_str) {
8347
if (t->intern) {
8348
*t->p = PyUnicode_InternFromString(t->s);
8349
} else if (t->encoding) {
8350
*t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
8351
} else {
8352
*t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
8353
}
8354
} else {
8355
*t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
8356
}
8357
#endif
8358
if (!*t->p)
8359
return -1;
8360
if (PyObject_Hash(*t->p) == -1)
8361
return -1;
8362
++t;
8363
}
8364
return 0;
8365
}
8366
8367
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
8368
return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
8369
}
8370
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
8371
Py_ssize_t ignore;
8372
return __Pyx_PyObject_AsStringAndSize(o, &ignore);
8373
}
8374
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
8375
#if !CYTHON_PEP393_ENABLED
8376
static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
8377
char* defenc_c;
8378
PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
8379
if (!defenc) return NULL;
8380
defenc_c = PyBytes_AS_STRING(defenc);
8381
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
8382
{
8383
char* end = defenc_c + PyBytes_GET_SIZE(defenc);
8384
char* c;
8385
for (c = defenc_c; c < end; c++) {
8386
if ((unsigned char) (*c) >= 128) {
8387
PyUnicode_AsASCIIString(o);
8388
return NULL;
8389
}
8390
}
8391
}
8392
#endif
8393
*length = PyBytes_GET_SIZE(defenc);
8394
return defenc_c;
8395
}
8396
#else
8397
static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
8398
if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
8399
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
8400
if (likely(PyUnicode_IS_ASCII(o))) {
8401
*length = PyUnicode_GET_LENGTH(o);
8402
return PyUnicode_AsUTF8(o);
8403
} else {
8404
PyUnicode_AsASCIIString(o);
8405
return NULL;
8406
}
8407
#else
8408
return PyUnicode_AsUTF8AndSize(o, length);
8409
#endif
8410
}
8411
#endif
8412
#endif
8413
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
8414
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
8415
if (
8416
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
8417
__Pyx_sys_getdefaultencoding_not_ascii &&
8418
#endif
8419
PyUnicode_Check(o)) {
8420
return __Pyx_PyUnicode_AsStringAndSize(o, length);
8421
} else
8422
#endif
8423
#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
8424
if (PyByteArray_Check(o)) {
8425
*length = PyByteArray_GET_SIZE(o);
8426
return PyByteArray_AS_STRING(o);
8427
} else
8428
#endif
8429
{
8430
char* result;
8431
int r = PyBytes_AsStringAndSize(o, &result, length);
8432
if (unlikely(r < 0)) {
8433
return NULL;
8434
} else {
8435
return result;
8436
}
8437
}
8438
}
8439
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
8440
int is_true = x == Py_True;
8441
if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
8442
else return PyObject_IsTrue(x);
8443
}
8444
static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
8445
int retval;
8446
if (unlikely(!x)) return -1;
8447
retval = __Pyx_PyObject_IsTrue(x);
8448
Py_DECREF(x);
8449
return retval;
8450
}
8451
static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
8452
#if PY_MAJOR_VERSION >= 3
8453
if (PyLong_Check(result)) {
8454
if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
8455
"__int__ returned non-int (type %.200s). "
8456
"The ability to return an instance of a strict subclass of int "
8457
"is deprecated, and may be removed in a future version of Python.",
8458
Py_TYPE(result)->tp_name)) {
8459
Py_DECREF(result);
8460
return NULL;
8461
}
8462
return result;
8463
}
8464
#endif
8465
PyErr_Format(PyExc_TypeError,
8466
"__%.4s__ returned non-%.4s (type %.200s)",
8467
type_name, type_name, Py_TYPE(result)->tp_name);
8468
Py_DECREF(result);
8469
return NULL;
8470
}
8471
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
8472
#if CYTHON_USE_TYPE_SLOTS
8473
PyNumberMethods *m;
8474
#endif
8475
const char *name = NULL;
8476
PyObject *res = NULL;
8477
#if PY_MAJOR_VERSION < 3
8478
if (likely(PyInt_Check(x) || PyLong_Check(x)))
8479
#else
8480
if (likely(PyLong_Check(x)))
8481
#endif
8482
return __Pyx_NewRef(x);
8483
#if CYTHON_USE_TYPE_SLOTS
8484
m = Py_TYPE(x)->tp_as_number;
8485
#if PY_MAJOR_VERSION < 3
8486
if (m && m->nb_int) {
8487
name = "int";
8488
res = m->nb_int(x);
8489
}
8490
else if (m && m->nb_long) {
8491
name = "long";
8492
res = m->nb_long(x);
8493
}
8494
#else
8495
if (likely(m && m->nb_int)) {
8496
name = "int";
8497
res = m->nb_int(x);
8498
}
8499
#endif
8500
#else
8501
if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
8502
res = PyNumber_Int(x);
8503
}
8504
#endif
8505
if (likely(res)) {
8506
#if PY_MAJOR_VERSION < 3
8507
if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
8508
#else
8509
if (unlikely(!PyLong_CheckExact(res))) {
8510
#endif
8511
return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
8512
}
8513
}
8514
else if (!PyErr_Occurred()) {
8515
PyErr_SetString(PyExc_TypeError,
8516
"an integer is required");
8517
}
8518
return res;
8519
}
8520
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
8521
Py_ssize_t ival;
8522
PyObject *x;
8523
#if PY_MAJOR_VERSION < 3
8524
if (likely(PyInt_CheckExact(b))) {
8525
if (sizeof(Py_ssize_t) >= sizeof(long))
8526
return PyInt_AS_LONG(b);
8527
else
8528
return PyInt_AsSsize_t(b);
8529
}
8530
#endif
8531
if (likely(PyLong_CheckExact(b))) {
8532
#if CYTHON_USE_PYLONG_INTERNALS
8533
const digit* digits = ((PyLongObject*)b)->ob_digit;
8534
const Py_ssize_t size = Py_SIZE(b);
8535
if (likely(__Pyx_sst_abs(size) <= 1)) {
8536
ival = likely(size) ? digits[0] : 0;
8537
if (size == -1) ival = -ival;
8538
return ival;
8539
} else {
8540
switch (size) {
8541
case 2:
8542
if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
8543
return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
8544
}
8545
break;
8546
case -2:
8547
if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
8548
return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
8549
}
8550
break;
8551
case 3:
8552
if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
8553
return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
8554
}
8555
break;
8556
case -3:
8557
if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
8558
return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
8559
}
8560
break;
8561
case 4:
8562
if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
8563
return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
8564
}
8565
break;
8566
case -4:
8567
if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
8568
return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
8569
}
8570
break;
8571
}
8572
}
8573
#endif
8574
return PyLong_AsSsize_t(b);
8575
}
8576
x = PyNumber_Index(b);
8577
if (!x) return -1;
8578
ival = PyInt_AsSsize_t(x);
8579
Py_DECREF(x);
8580
return ival;
8581
}
8582
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
8583
return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
8584
}
8585
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
8586
return PyInt_FromSize_t(ival);
8587
}
8588
8589
8590
#endif /* Py_PYTHON_H */
8591
8592