1 | /* Generated by Cython 3.0.0a10 */ |
2 | |
3 | #ifndef PY_SSIZE_T_CLEAN |
4 | #define PY_SSIZE_T_CLEAN |
5 | #endif /* PY_SSIZE_T_CLEAN */ |
6 | #if defined(CYTHON_LIMITED_API) && 0 |
7 | #ifndef Py_LIMITED_API |
8 | #if CYTHON_LIMITED_API+0 > 0x03030000 |
9 | #define Py_LIMITED_API CYTHON_LIMITED_API |
10 | #else |
11 | #define Py_LIMITED_API 0x03030000 |
12 | #endif |
13 | #endif |
14 | #endif |
15 | |
16 | #include "Python.h" |
17 | #ifndef Py_PYTHON_H |
18 | #error Python headers needed to compile C extensions, please install development version of Python. |
19 | #elif PY_VERSION_HEX < 0x02070000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) |
20 | #error Cython requires Python 2.7+ or Python 3.3+. |
21 | #else |
22 | #define CYTHON_ABI "3_0_0a10" |
23 | #define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI |
24 | #define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "." |
25 | #define CYTHON_HEX_VERSION 0x030000AA |
26 | #define CYTHON_FUTURE_DIVISION 1 |
27 | #include <stddef.h> |
28 | #ifndef offsetof |
29 | #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) |
30 | #endif |
31 | #if !defined(_WIN32) && !defined(WIN32) && !defined(MS_WINDOWS) |
32 | #ifndef __stdcall |
33 | #define __stdcall |
34 | #endif |
35 | #ifndef __cdecl |
36 | #define __cdecl |
37 | #endif |
38 | #ifndef __fastcall |
39 | #define __fastcall |
40 | #endif |
41 | #endif |
42 | #ifndef DL_IMPORT |
43 | #define DL_IMPORT(t) t |
44 | #endif |
45 | #ifndef DL_EXPORT |
46 | #define DL_EXPORT(t) t |
47 | #endif |
48 | #define __PYX_COMMA , |
49 | #ifndef HAVE_LONG_LONG |
50 | #define HAVE_LONG_LONG |
51 | #endif |
52 | #ifndef PY_LONG_LONG |
53 | #define PY_LONG_LONG LONG_LONG |
54 | #endif |
55 | #ifndef Py_HUGE_VAL |
56 | #define Py_HUGE_VAL HUGE_VAL |
57 | #endif |
58 | #if defined(GRAALVM_PYTHON) |
59 | /* For very preliminary testing purposes. Most variables are set the same as PyPy. |
60 | The existence of this section does not imply that anything works or is even tested */ |
61 | #define CYTHON_COMPILING_IN_PYPY 0 |
62 | #define CYTHON_COMPILING_IN_CPYTHON 0 |
63 | #define CYTHON_COMPILING_IN_LIMITED_API 0 |
64 | #define CYTHON_COMPILING_IN_GRAAL 1 |
65 | #undef CYTHON_USE_TYPE_SLOTS |
66 | #define CYTHON_USE_TYPE_SLOTS 0 |
67 | #undef CYTHON_USE_TYPE_SPECS |
68 | #define CYTHON_USE_TYPE_SPECS 0 |
69 | #undef CYTHON_USE_PYTYPE_LOOKUP |
70 | #define CYTHON_USE_PYTYPE_LOOKUP 0 |
71 | #if PY_VERSION_HEX < 0x03050000 |
72 | #undef CYTHON_USE_ASYNC_SLOTS |
73 | #define CYTHON_USE_ASYNC_SLOTS 0 |
74 | #elif !defined(CYTHON_USE_ASYNC_SLOTS) |
75 | #define CYTHON_USE_ASYNC_SLOTS 1 |
76 | #endif |
77 | #undef CYTHON_USE_PYLIST_INTERNALS |
78 | #define CYTHON_USE_PYLIST_INTERNALS 0 |
79 | #undef CYTHON_USE_UNICODE_INTERNALS |
80 | #define CYTHON_USE_UNICODE_INTERNALS 0 |
81 | #undef CYTHON_USE_UNICODE_WRITER |
82 | #define CYTHON_USE_UNICODE_WRITER 0 |
83 | #undef CYTHON_USE_PYLONG_INTERNALS |
84 | #define CYTHON_USE_PYLONG_INTERNALS 0 |
85 | #undef CYTHON_AVOID_BORROWED_REFS |
86 | #define CYTHON_AVOID_BORROWED_REFS 1 |
87 | #undef CYTHON_ASSUME_SAFE_MACROS |
88 | #define CYTHON_ASSUME_SAFE_MACROS 0 |
89 | #undef CYTHON_UNPACK_METHODS |
90 | #define CYTHON_UNPACK_METHODS 0 |
91 | #undef CYTHON_FAST_THREAD_STATE |
92 | #define CYTHON_FAST_THREAD_STATE 0 |
93 | #undef CYTHON_FAST_GIL |
94 | #define CYTHON_FAST_GIL 0 |
95 | #undef CYTHON_METH_FASTCALL |
96 | #define CYTHON_METH_FASTCALL 0 |
97 | #undef CYTHON_FAST_PYCALL |
98 | #define CYTHON_FAST_PYCALL 0 |
99 | #ifndef CYTHON_PEP487_INIT_SUBCLASS |
100 | #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3) |
101 | #endif |
102 | #undef CYTHON_PEP489_MULTI_PHASE_INIT |
103 | #define CYTHON_PEP489_MULTI_PHASE_INIT 1 |
104 | #undef CYTHON_USE_MODULE_STATE |
105 | #define CYTHON_USE_MODULE_STATE 0 |
106 | #undef CYTHON_USE_TP_FINALIZE |
107 | #define CYTHON_USE_TP_FINALIZE 0 |
108 | #undef CYTHON_USE_DICT_VERSIONS |
109 | #define CYTHON_USE_DICT_VERSIONS 0 |
110 | #undef CYTHON_USE_EXC_INFO_STACK |
111 | #define CYTHON_USE_EXC_INFO_STACK 0 |
112 | #elif defined(PYPY_VERSION) |
113 | #define CYTHON_COMPILING_IN_PYPY 1 |
114 | #define CYTHON_COMPILING_IN_CPYTHON 0 |
115 | #define CYTHON_COMPILING_IN_LIMITED_API 0 |
116 | #define CYTHON_COMPILING_IN_GRAAL 0 |
117 | #undef CYTHON_USE_TYPE_SLOTS |
118 | #define CYTHON_USE_TYPE_SLOTS 0 |
119 | #undef CYTHON_USE_TYPE_SPECS |
120 | #define CYTHON_USE_TYPE_SPECS 0 |
121 | #undef CYTHON_USE_PYTYPE_LOOKUP |
122 | #define CYTHON_USE_PYTYPE_LOOKUP 0 |
123 | #if PY_VERSION_HEX < 0x03050000 |
124 | #undef CYTHON_USE_ASYNC_SLOTS |
125 | #define CYTHON_USE_ASYNC_SLOTS 0 |
126 | #elif !defined(CYTHON_USE_ASYNC_SLOTS) |
127 | #define CYTHON_USE_ASYNC_SLOTS 1 |
128 | #endif |
129 | #undef CYTHON_USE_PYLIST_INTERNALS |
130 | #define CYTHON_USE_PYLIST_INTERNALS 0 |
131 | #undef CYTHON_USE_UNICODE_INTERNALS |
132 | #define CYTHON_USE_UNICODE_INTERNALS 0 |
133 | #undef CYTHON_USE_UNICODE_WRITER |
134 | #define CYTHON_USE_UNICODE_WRITER 0 |
135 | #undef CYTHON_USE_PYLONG_INTERNALS |
136 | #define CYTHON_USE_PYLONG_INTERNALS 0 |
137 | #undef CYTHON_AVOID_BORROWED_REFS |
138 | #define CYTHON_AVOID_BORROWED_REFS 1 |
139 | #undef CYTHON_ASSUME_SAFE_MACROS |
140 | #define CYTHON_ASSUME_SAFE_MACROS 0 |
141 | #undef CYTHON_UNPACK_METHODS |
142 | #define CYTHON_UNPACK_METHODS 0 |
143 | #undef CYTHON_FAST_THREAD_STATE |
144 | #define CYTHON_FAST_THREAD_STATE 0 |
145 | #undef CYTHON_FAST_GIL |
146 | #define CYTHON_FAST_GIL 0 |
147 | #undef CYTHON_METH_FASTCALL |
148 | #define CYTHON_METH_FASTCALL 0 |
149 | #undef CYTHON_FAST_PYCALL |
150 | #define CYTHON_FAST_PYCALL 0 |
151 | #ifndef CYTHON_PEP487_INIT_SUBCLASS |
152 | #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3) |
153 | #endif |
154 | #undef CYTHON_PEP489_MULTI_PHASE_INIT |
155 | #define CYTHON_PEP489_MULTI_PHASE_INIT 0 |
156 | #undef CYTHON_USE_MODULE_STATE |
157 | #define CYTHON_USE_MODULE_STATE 0 |
158 | #undef CYTHON_USE_TP_FINALIZE |
159 | #define CYTHON_USE_TP_FINALIZE 0 |
160 | #undef CYTHON_USE_DICT_VERSIONS |
161 | #define CYTHON_USE_DICT_VERSIONS 0 |
162 | #undef CYTHON_USE_EXC_INFO_STACK |
163 | #define CYTHON_USE_EXC_INFO_STACK 0 |
164 | #elif defined(CYTHON_LIMITED_API) |
165 | #define CYTHON_COMPILING_IN_PYPY 0 |
166 | #define CYTHON_COMPILING_IN_CPYTHON 0 |
167 | #define CYTHON_COMPILING_IN_LIMITED_API 1 |
168 | #define CYTHON_COMPILING_IN_GRAAL 0 |
169 | #undef CYTHON_USE_TYPE_SLOTS |
170 | #define CYTHON_USE_TYPE_SLOTS 0 |
171 | #undef CYTHON_USE_TYPE_SPECS |
172 | #define CYTHON_USE_TYPE_SPECS 1 |
173 | #undef CYTHON_USE_PYTYPE_LOOKUP |
174 | #define CYTHON_USE_PYTYPE_LOOKUP 0 |
175 | #undef CYTHON_USE_ASYNC_SLOTS |
176 | #define CYTHON_USE_ASYNC_SLOTS 0 |
177 | #undef CYTHON_USE_PYLIST_INTERNALS |
178 | #define CYTHON_USE_PYLIST_INTERNALS 0 |
179 | #undef CYTHON_USE_UNICODE_INTERNALS |
180 | #define CYTHON_USE_UNICODE_INTERNALS 0 |
181 | #ifndef CYTHON_USE_UNICODE_WRITER |
182 | #define CYTHON_USE_UNICODE_WRITER 0 |
183 | #endif |
184 | #undef CYTHON_USE_PYLONG_INTERNALS |
185 | #define CYTHON_USE_PYLONG_INTERNALS 0 |
186 | #ifndef CYTHON_AVOID_BORROWED_REFS |
187 | #define CYTHON_AVOID_BORROWED_REFS 0 |
188 | #endif |
189 | #undef CYTHON_ASSUME_SAFE_MACROS |
190 | #define CYTHON_ASSUME_SAFE_MACROS 0 |
191 | #undef CYTHON_UNPACK_METHODS |
192 | #define CYTHON_UNPACK_METHODS 0 |
193 | #undef CYTHON_FAST_THREAD_STATE |
194 | #define CYTHON_FAST_THREAD_STATE 0 |
195 | #undef CYTHON_FAST_GIL |
196 | #define CYTHON_FAST_GIL 0 |
197 | #undef CYTHON_METH_FASTCALL |
198 | #define CYTHON_METH_FASTCALL 0 |
199 | #undef CYTHON_FAST_PYCALL |
200 | #define CYTHON_FAST_PYCALL 0 |
201 | #ifndef CYTHON_PEP487_INIT_SUBCLASS |
202 | #define CYTHON_PEP487_INIT_SUBCLASS 1 |
203 | #endif |
204 | #undef CYTHON_PEP489_MULTI_PHASE_INIT |
205 | #define CYTHON_PEP489_MULTI_PHASE_INIT 0 |
206 | #undef CYTHON_USE_MODULE_STATE |
207 | #define CYTHON_USE_MODULE_STATE 1 |
208 | #ifndef CYTHON_USE_TP_FINALIZE |
209 | #define CYTHON_USE_TP_FINALIZE 1 |
210 | #endif |
211 | #undef CYTHON_USE_DICT_VERSIONS |
212 | #define CYTHON_USE_DICT_VERSIONS 0 |
213 | #undef CYTHON_USE_EXC_INFO_STACK |
214 | #define CYTHON_USE_EXC_INFO_STACK 0 |
215 | #else |
216 | #define CYTHON_COMPILING_IN_PYPY 0 |
217 | #define CYTHON_COMPILING_IN_CPYTHON 1 |
218 | #define CYTHON_COMPILING_IN_LIMITED_API 0 |
219 | #define CYTHON_COMPILING_IN_GRAAL 0 |
220 | #ifndef CYTHON_USE_TYPE_SLOTS |
221 | #define CYTHON_USE_TYPE_SLOTS 1 |
222 | #endif |
223 | #ifndef CYTHON_USE_TYPE_SPECS |
224 | #define CYTHON_USE_TYPE_SPECS 0 |
225 | #endif |
226 | #ifndef CYTHON_USE_PYTYPE_LOOKUP |
227 | #define CYTHON_USE_PYTYPE_LOOKUP 1 |
228 | #endif |
229 | #if PY_MAJOR_VERSION < 3 |
230 | #undef CYTHON_USE_ASYNC_SLOTS |
231 | #define CYTHON_USE_ASYNC_SLOTS 0 |
232 | #elif !defined(CYTHON_USE_ASYNC_SLOTS) |
233 | #define CYTHON_USE_ASYNC_SLOTS 1 |
234 | #endif |
235 | #ifndef CYTHON_USE_PYLONG_INTERNALS |
236 | #define CYTHON_USE_PYLONG_INTERNALS 1 |
237 | #endif |
238 | #ifndef CYTHON_USE_PYLIST_INTERNALS |
239 | #define CYTHON_USE_PYLIST_INTERNALS 1 |
240 | #endif |
241 | #ifndef CYTHON_USE_UNICODE_INTERNALS |
242 | #define CYTHON_USE_UNICODE_INTERNALS 1 |
243 | #endif |
244 | #if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2 |
245 | #undef CYTHON_USE_UNICODE_WRITER |
246 | #define CYTHON_USE_UNICODE_WRITER 0 |
247 | #elif !defined(CYTHON_USE_UNICODE_WRITER) |
248 | #define CYTHON_USE_UNICODE_WRITER 1 |
249 | #endif |
250 | #ifndef CYTHON_AVOID_BORROWED_REFS |
251 | #define CYTHON_AVOID_BORROWED_REFS 0 |
252 | #endif |
253 | #ifndef CYTHON_ASSUME_SAFE_MACROS |
254 | #define CYTHON_ASSUME_SAFE_MACROS 1 |
255 | #endif |
256 | #ifndef CYTHON_UNPACK_METHODS |
257 | #define CYTHON_UNPACK_METHODS 1 |
258 | #endif |
259 | #ifndef CYTHON_FAST_THREAD_STATE |
260 | #define CYTHON_FAST_THREAD_STATE 1 |
261 | #endif |
262 | #ifndef CYTHON_FAST_GIL |
263 | #define CYTHON_FAST_GIL (PY_MAJOR_VERSION < 3 || PY_VERSION_HEX >= 0x03060000) |
264 | #endif |
265 | #ifndef CYTHON_METH_FASTCALL |
266 | #define CYTHON_METH_FASTCALL (PY_VERSION_HEX >= 0x030700A1) |
267 | #endif |
268 | #ifndef CYTHON_FAST_PYCALL |
269 | #define CYTHON_FAST_PYCALL 1 |
270 | #endif |
271 | #ifndef CYTHON_PEP487_INIT_SUBCLASS |
272 | #define CYTHON_PEP487_INIT_SUBCLASS 1 |
273 | #endif |
274 | #if PY_VERSION_HEX < 0x03050000 |
275 | #undef CYTHON_PEP489_MULTI_PHASE_INIT |
276 | #define CYTHON_PEP489_MULTI_PHASE_INIT 0 |
277 | #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) |
278 | #define CYTHON_PEP489_MULTI_PHASE_INIT 1 |
279 | #endif |
280 | #ifndef CYTHON_USE_MODULE_STATE |
281 | #define CYTHON_USE_MODULE_STATE 0 |
282 | #endif |
283 | #if PY_VERSION_HEX < 0x030400a1 |
284 | #undef CYTHON_USE_TP_FINALIZE |
285 | #define CYTHON_USE_TP_FINALIZE 0 |
286 | #elif !defined(CYTHON_USE_TP_FINALIZE) |
287 | #define CYTHON_USE_TP_FINALIZE 1 |
288 | #endif |
289 | #if PY_VERSION_HEX < 0x030600B1 |
290 | #undef CYTHON_USE_DICT_VERSIONS |
291 | #define CYTHON_USE_DICT_VERSIONS 0 |
292 | #elif !defined(CYTHON_USE_DICT_VERSIONS) |
293 | #define CYTHON_USE_DICT_VERSIONS 1 |
294 | #endif |
295 | #if PY_VERSION_HEX < 0x030700A3 |
296 | #undef CYTHON_USE_EXC_INFO_STACK |
297 | #define CYTHON_USE_EXC_INFO_STACK 0 |
298 | #elif !defined(CYTHON_USE_EXC_INFO_STACK) |
299 | #define CYTHON_USE_EXC_INFO_STACK 1 |
300 | #endif |
301 | #endif |
302 | #if !defined(CYTHON_FAST_PYCCALL) |
303 | #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) |
304 | #endif |
305 | #if !defined(CYTHON_VECTORCALL) |
306 | #define CYTHON_VECTORCALL (CYTHON_FAST_PYCCALL && PY_VERSION_HEX >= 0x030800B1) |
307 | #endif |
308 | #define CYTHON_BACKPORT_VECTORCALL (CYTHON_METH_FASTCALL && PY_VERSION_HEX < 0x030800B1) |
309 | #if CYTHON_USE_PYLONG_INTERNALS |
310 | #if PY_MAJOR_VERSION < 3 |
311 | #include "longintrepr.h" |
312 | #endif |
313 | #undef SHIFT |
314 | #undef BASE |
315 | #undef MASK |
316 | #ifdef SIZEOF_VOID_P |
317 | enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) }; |
318 | #endif |
319 | #endif |
320 | #ifndef __has_attribute |
321 | #define __has_attribute(x) 0 |
322 | #endif |
323 | #ifndef __has_cpp_attribute |
324 | #define __has_cpp_attribute(x) 0 |
325 | #endif |
326 | #ifndef CYTHON_RESTRICT |
327 | #if defined(__GNUC__) |
328 | #define CYTHON_RESTRICT __restrict__ |
329 | #elif defined(_MSC_VER) && _MSC_VER >= 1400 |
330 | #define CYTHON_RESTRICT __restrict |
331 | #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L |
332 | #define CYTHON_RESTRICT restrict |
333 | #else |
334 | #define CYTHON_RESTRICT |
335 | #endif |
336 | #endif |
337 | #ifndef CYTHON_UNUSED |
338 | # if defined(__GNUC__) |
339 | # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) |
340 | # define CYTHON_UNUSED __attribute__ ((__unused__)) |
341 | # else |
342 | # define CYTHON_UNUSED |
343 | # endif |
344 | # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) |
345 | # define CYTHON_UNUSED __attribute__ ((__unused__)) |
346 | # else |
347 | # define CYTHON_UNUSED |
348 | # endif |
349 | #endif |
350 | #ifndef CYTHON_UNUSED_VAR |
351 | # if defined(__cplusplus) |
352 | template<class T> void CYTHON_UNUSED_VAR( const T& ) { } |
353 | # else |
354 | # define CYTHON_UNUSED_VAR(x) (void)(x) |
355 | # endif |
356 | #endif |
357 | #ifndef CYTHON_MAYBE_UNUSED_VAR |
358 | #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x) |
359 | #endif |
360 | #ifndef CYTHON_NCP_UNUSED |
361 | # if CYTHON_COMPILING_IN_CPYTHON |
362 | # define CYTHON_NCP_UNUSED |
363 | # else |
364 | # define CYTHON_NCP_UNUSED CYTHON_UNUSED |
365 | # endif |
366 | #endif |
367 | #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) |
368 | #ifdef _MSC_VER |
369 | #ifndef _MSC_STDINT_H_ |
370 | #if _MSC_VER < 1300 |
371 | typedef unsigned char uint8_t; |
372 | typedef unsigned short uint16_t; |
373 | typedef unsigned int uint32_t; |
374 | #else |
375 | typedef unsigned __int8 uint8_t; |
376 | typedef unsigned __int16 uint16_t; |
377 | typedef unsigned __int32 uint32_t; |
378 | #endif |
379 | #endif |
380 | #if _MSC_VER < 1300 |
381 | #ifdef _WIN64 |
382 | typedef unsigned long long __pyx_uintptr_t; |
383 | #else |
384 | typedef unsigned int __pyx_uintptr_t; |
385 | #endif |
386 | #else |
387 | #ifdef _WIN64 |
388 | typedef unsigned __int64 __pyx_uintptr_t; |
389 | #else |
390 | typedef unsigned __int32 __pyx_uintptr_t; |
391 | #endif |
392 | #endif |
393 | #else |
394 | #include <stdint.h> |
395 | typedef uintptr_t __pyx_uintptr_t; |
396 | #endif |
397 | #ifndef CYTHON_FALLTHROUGH |
398 | #if defined(__cplusplus) && __cplusplus >= 201103L |
399 | #if __has_cpp_attribute(fallthrough) |
400 | #define CYTHON_FALLTHROUGH [[fallthrough]] |
401 | #elif __has_cpp_attribute(clang::fallthrough) |
402 | #define CYTHON_FALLTHROUGH [[clang::fallthrough]] |
403 | #elif __has_cpp_attribute(gnu::fallthrough) |
404 | #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] |
405 | #endif |
406 | #endif |
407 | #ifndef CYTHON_FALLTHROUGH |
408 | #if __has_attribute(fallthrough) |
409 | #define CYTHON_FALLTHROUGH __attribute__((fallthrough)) |
410 | #else |
411 | #define CYTHON_FALLTHROUGH |
412 | #endif |
413 | #endif |
414 | #if defined(__clang__ ) && defined(__apple_build_version__) |
415 | #if __apple_build_version__ < 7000000 |
416 | #undef CYTHON_FALLTHROUGH |
417 | #define CYTHON_FALLTHROUGH |
418 | #endif |
419 | #endif |
420 | #endif |
421 | |
422 | #ifndef __cplusplus |
423 | #error "Cython files generated with the C++ option must be compiled with a C++ compiler." |
424 | #endif |
425 | #ifndef CYTHON_INLINE |
426 | #if defined(__clang__) |
427 | #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) |
428 | #else |
429 | #define CYTHON_INLINE inline |
430 | #endif |
431 | #endif |
432 | template<typename T> |
433 | void __Pyx_call_destructor(T& x) { |
434 | x.~T(); |
435 | } |
436 | template<typename T> |
437 | class __Pyx_FakeReference { |
438 | public: |
439 | __Pyx_FakeReference() : ptr(NULL) { } |
440 | __Pyx_FakeReference(const T& ref) : ptr(const_cast<T*>(&ref)) { } |
441 | T *operator->() { return ptr; } |
442 | T *operator&() { return ptr; } |
443 | operator T&() { return *ptr; } |
444 | template<typename U> bool operator ==(U other) { return *ptr == other; } |
445 | template<typename U> bool operator !=(U other) { return *ptr != other; } |
446 | private: |
447 | T *ptr; |
448 | }; |
449 | |
450 | #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) |
451 | #define Py_OptimizeFlag 0 |
452 | #endif |
453 | #define __PYX_BUILD_PY_SSIZE_T "n" |
454 | #define CYTHON_FORMAT_SSIZE_T "z" |
455 | #if PY_MAJOR_VERSION < 3 |
456 | #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" |
457 | #define __Pyx_DefaultClassType PyClass_Type |
458 | #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ |
459 | PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) |
460 | #else |
461 | #define __Pyx_BUILTIN_MODULE_NAME "builtins" |
462 | #define __Pyx_DefaultClassType PyType_Type |
463 | #if PY_VERSION_HEX >= 0x030B00A1 |
464 | static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int p, int k, int l, int s, int f, |
465 | PyObject *code, PyObject *c, PyObject* n, PyObject *v, |
466 | PyObject *fv, PyObject *cell, PyObject* fn, |
467 | PyObject *name, int fline, PyObject *lnos) { |
468 | PyObject *kwds=NULL, *argcount=NULL, *posonlyargcount=NULL, *kwonlyargcount=NULL; |
469 | PyObject *nlocals=NULL, *stacksize=NULL, *flags=NULL, *replace=NULL, *call_result=NULL, *empty=NULL; |
470 | const char *fn_cstr=NULL; |
471 | const char *name_cstr=NULL; |
472 | PyCodeObject* co=NULL; |
473 | PyObject *type, *value, *traceback; |
474 | PyErr_Fetch(&type, &value, &traceback); |
475 | if (!(kwds=PyDict_New())) goto end; |
476 | if (!(argcount=PyLong_FromLong(a))) goto end; |
477 | if (PyDict_SetItemString(kwds, "co_argcount" , argcount) != 0) goto end; |
478 | if (!(posonlyargcount=PyLong_FromLong(p))) goto end; |
479 | if (PyDict_SetItemString(kwds, "co_posonlyargcount" , posonlyargcount) != 0) goto end; |
480 | if (!(kwonlyargcount=PyLong_FromLong(k))) goto end; |
481 | if (PyDict_SetItemString(kwds, "co_kwonlyargcount" , kwonlyargcount) != 0) goto end; |
482 | if (!(nlocals=PyLong_FromLong(l))) goto end; |
483 | if (PyDict_SetItemString(kwds, "co_nlocals" , nlocals) != 0) goto end; |
484 | if (!(stacksize=PyLong_FromLong(s))) goto end; |
485 | if (PyDict_SetItemString(kwds, "co_stacksize" , stacksize) != 0) goto end; |
486 | if (!(flags=PyLong_FromLong(f))) goto end; |
487 | if (PyDict_SetItemString(kwds, "co_flags" , flags) != 0) goto end; |
488 | if (PyDict_SetItemString(kwds, "co_code" , code) != 0) goto end; |
489 | if (PyDict_SetItemString(kwds, "co_consts" , c) != 0) goto end; |
490 | if (PyDict_SetItemString(kwds, "co_names" , n) != 0) goto end; |
491 | if (PyDict_SetItemString(kwds, "co_varnames" , v) != 0) goto end; |
492 | if (PyDict_SetItemString(kwds, "co_freevars" , fv) != 0) goto end; |
493 | if (PyDict_SetItemString(kwds, "co_cellvars" , cell) != 0) goto end; |
494 | if (PyDict_SetItemString(kwds, "co_linetable" , lnos) != 0) goto end; |
495 | if (!(fn_cstr=PyUnicode_AsUTF8AndSize(fn, NULL))) goto end; |
496 | if (!(name_cstr=PyUnicode_AsUTF8AndSize(name, NULL))) goto end; |
497 | if (!(co = PyCode_NewEmpty(fn_cstr, name_cstr, fline))) goto end; |
498 | if (!(replace = PyObject_GetAttrString((PyObject*)co, "replace" ))) goto cleanup_code_too; |
499 | if (!(empty = PyTuple_New(0))) goto cleanup_code_too; // unfortunately __pyx_empty_tuple isn't available here |
500 | if (!(call_result = PyObject_Call(replace, empty, kwds))) goto cleanup_code_too; |
501 | Py_XDECREF((PyObject*)co); |
502 | co = (PyCodeObject*)call_result; |
503 | call_result = NULL; |
504 | if (0) { |
505 | cleanup_code_too: |
506 | Py_XDECREF((PyObject*)co); |
507 | co = NULL; |
508 | } |
509 | end: |
510 | Py_XDECREF(kwds); |
511 | Py_XDECREF(argcount); |
512 | Py_XDECREF(posonlyargcount); |
513 | Py_XDECREF(kwonlyargcount); |
514 | Py_XDECREF(nlocals); |
515 | Py_XDECREF(stacksize); |
516 | Py_XDECREF(replace); |
517 | Py_XDECREF(call_result); |
518 | Py_XDECREF(empty); |
519 | if (type) { |
520 | PyErr_Restore(type, value, traceback); |
521 | } |
522 | return co; |
523 | } |
524 | #elif PY_VERSION_HEX >= 0x030800B2 && !CYTHON_COMPILING_IN_PYPY |
525 | #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ |
526 | PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) |
527 | #else |
528 | #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ |
529 | PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) |
530 | #endif |
531 | #endif |
532 | #if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE) |
533 | #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type) |
534 | #else |
535 | #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type)) |
536 | #endif |
537 | #ifndef Py_TPFLAGS_CHECKTYPES |
538 | #define Py_TPFLAGS_CHECKTYPES 0 |
539 | #endif |
540 | #ifndef Py_TPFLAGS_HAVE_INDEX |
541 | #define Py_TPFLAGS_HAVE_INDEX 0 |
542 | #endif |
543 | #ifndef Py_TPFLAGS_HAVE_NEWBUFFER |
544 | #define Py_TPFLAGS_HAVE_NEWBUFFER 0 |
545 | #endif |
546 | #ifndef Py_TPFLAGS_HAVE_FINALIZE |
547 | #define Py_TPFLAGS_HAVE_FINALIZE 0 |
548 | #endif |
549 | #ifndef METH_STACKLESS |
550 | #define METH_STACKLESS 0 |
551 | #endif |
552 | #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL) |
553 | #ifndef METH_FASTCALL |
554 | #define METH_FASTCALL 0x80 |
555 | #endif |
556 | typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs); |
557 | typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args, |
558 | Py_ssize_t nargs, PyObject *kwnames); |
559 | #else |
560 | #define __Pyx_PyCFunctionFast _PyCFunctionFast |
561 | #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords |
562 | #endif |
563 | #if CYTHON_METH_FASTCALL |
564 | #define __Pyx_METH_FASTCALL METH_FASTCALL |
565 | #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast |
566 | #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords |
567 | #else |
568 | #define __Pyx_METH_FASTCALL METH_VARARGS |
569 | #define __Pyx_PyCFunction_FastCall PyCFunction |
570 | #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords |
571 | #endif |
572 | #if CYTHON_VECTORCALL |
573 | #define __pyx_vectorcallfunc vectorcallfunc |
574 | #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET PY_VECTORCALL_ARGUMENTS_OFFSET |
575 | #define __Pyx_PyVectorcall_NARGS(n) PyVectorcall_NARGS((size_t)(n)) |
576 | #elif CYTHON_BACKPORT_VECTORCALL |
577 | typedef PyObject *(*__pyx_vectorcallfunc)(PyObject *callable, PyObject *const *args, |
578 | size_t nargsf, PyObject *kwnames); |
579 | #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET ((size_t)1 << (8 * sizeof(size_t) - 1)) |
580 | #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(((size_t)(n)) & ~__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)) |
581 | #else |
582 | #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET 0 |
583 | #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(n)) |
584 | #endif |
585 | #if PY_VERSION_HEX < 0x030900B1 |
586 | #define __Pyx_PyType_FromModuleAndSpec(m, s, b) ((void)m, PyType_FromSpecWithBases(s, b)) |
587 | typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *); |
588 | #else |
589 | #define __Pyx_PyType_FromModuleAndSpec(m, s, b) PyType_FromModuleAndSpec(m, s, b) |
590 | #define __Pyx_PyCMethod PyCMethod |
591 | #endif |
592 | #ifndef METH_METHOD |
593 | #define METH_METHOD 0x200 |
594 | #endif |
595 | #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) |
596 | #define PyObject_Malloc(s) PyMem_Malloc(s) |
597 | #define PyObject_Free(p) PyMem_Free(p) |
598 | #define PyObject_Realloc(p) PyMem_Realloc(p) |
599 | #endif |
600 | #if CYTHON_COMPILING_IN_LIMITED_API |
601 | #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) |
602 | #define __Pyx_PyFrame_SetLineNumber(frame, lineno) |
603 | #else |
604 | #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) |
605 | #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) |
606 | #endif |
607 | #if CYTHON_COMPILING_IN_LIMITED_API |
608 | #define __Pyx_PyThreadState_Current PyThreadState_Get() |
609 | #elif !CYTHON_FAST_THREAD_STATE |
610 | #define __Pyx_PyThreadState_Current PyThreadState_GET() |
611 | #elif PY_VERSION_HEX >= 0x03060000 |
612 | #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() |
613 | #elif PY_VERSION_HEX >= 0x03000000 |
614 | #define __Pyx_PyThreadState_Current PyThreadState_GET() |
615 | #else |
616 | #define __Pyx_PyThreadState_Current _PyThreadState_Current |
617 | #endif |
618 | #if CYTHON_COMPILING_IN_LIMITED_API |
619 | static CYTHON_INLINE void *__Pyx_PyModule_GetState(PyObject *op) |
620 | { |
621 | void *result; |
622 | result = PyModule_GetState(op); |
623 | if (!result) |
624 | Py_FatalError("Couldn't find the module state" ); |
625 | return result; |
626 | } |
627 | #endif |
628 | #define __Pyx_PyObject_GetSlot(obj, name, func_ctype) __Pyx_PyType_GetSlot(Py_TYPE(obj), name, func_ctype) |
629 | #if CYTHON_COMPILING_IN_LIMITED_API |
630 | #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((func_ctype) PyType_GetSlot((type), Py_##name)) |
631 | #else |
632 | #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((type)->name) |
633 | #endif |
634 | #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT) |
635 | #include "pythread.h" |
636 | #define Py_tss_NEEDS_INIT 0 |
637 | typedef int Py_tss_t; |
638 | static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) { |
639 | *key = PyThread_create_key(); |
640 | return 0; |
641 | } |
642 | static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) { |
643 | Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t)); |
644 | *key = Py_tss_NEEDS_INIT; |
645 | return key; |
646 | } |
647 | static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) { |
648 | PyObject_Free(key); |
649 | } |
650 | static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) { |
651 | return *key != Py_tss_NEEDS_INIT; |
652 | } |
653 | static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) { |
654 | PyThread_delete_key(*key); |
655 | *key = Py_tss_NEEDS_INIT; |
656 | } |
657 | static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) { |
658 | return PyThread_set_key_value(*key, value); |
659 | } |
660 | static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { |
661 | return PyThread_get_key_value(*key); |
662 | } |
663 | #endif |
664 | #if PY_MAJOR_VERSION < 3 |
665 | #if CYTHON_COMPILING_IN_PYPY |
666 | #if PYPY_VERSION_NUM < 0x07030600 |
667 | #if defined(__cplusplus) && __cplusplus >= 201402L |
668 | [[deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6" )]] |
669 | #elif defined(__GNUC__) || defined(__clang__) |
670 | __attribute__ ((__deprecated__("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6" ))) |
671 | #elif defined(_MSC_VER) |
672 | __declspec(deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6" )) |
673 | #endif |
674 | static CYTHON_INLINE int PyGILState_Check(void) { |
675 | return 0; |
676 | } |
677 | #else // PYPY_VERSION_NUM < 0x07030600 |
678 | #endif // PYPY_VERSION_NUM < 0x07030600 |
679 | #else |
680 | static CYTHON_INLINE int PyGILState_Check(void) { |
681 | PyThreadState * tstate = _PyThreadState_Current; |
682 | return tstate && (tstate == PyGILState_GetThisThreadState()); |
683 | } |
684 | #endif |
685 | #endif |
686 | #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized) |
687 | #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) |
688 | #else |
689 | #define __Pyx_PyDict_NewPresized(n) PyDict_New() |
690 | #endif |
691 | #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION |
692 | #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) |
693 | #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) |
694 | #else |
695 | #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) |
696 | #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) |
697 | #endif |
698 | #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX > 0x030600B4 && CYTHON_USE_UNICODE_INTERNALS |
699 | #define __Pyx_PyDict_GetItemStrWithError(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) |
700 | static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) { |
701 | PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name); |
702 | if (res == NULL) PyErr_Clear(); |
703 | return res; |
704 | } |
705 | #elif PY_MAJOR_VERSION >= 3 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000) |
706 | #define __Pyx_PyDict_GetItemStrWithError PyDict_GetItemWithError |
707 | #define __Pyx_PyDict_GetItemStr PyDict_GetItem |
708 | #else |
709 | static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) { |
710 | #if CYTHON_COMPILING_IN_PYPY |
711 | return PyDict_GetItem(dict, name); |
712 | #else |
713 | PyDictEntry *ep; |
714 | PyDictObject *mp = (PyDictObject*) dict; |
715 | long hash = ((PyStringObject *) name)->ob_shash; |
716 | assert(hash != -1); |
717 | ep = (mp->ma_lookup)(mp, name, hash); |
718 | if (ep == NULL) { |
719 | return NULL; |
720 | } |
721 | return ep->me_value; |
722 | #endif |
723 | } |
724 | #define __Pyx_PyDict_GetItemStr PyDict_GetItem |
725 | #endif |
726 | #if CYTHON_USE_TYPE_SLOTS |
727 | #define __Pyx_PyType_GetFlags(tp) (((PyTypeObject *)tp)->tp_flags) |
728 | #define __Pyx_PyType_HasFeature(type, feature) ((__Pyx_PyType_GetFlags(type) & (feature)) != 0) |
729 | #define __Pyx_PyObject_GetIterNextFunc(obj) (Py_TYPE(obj)->tp_iternext) |
730 | #else |
731 | #define __Pyx_PyType_GetFlags(tp) (PyType_GetFlags((PyTypeObject *)tp)) |
732 | #define __Pyx_PyType_HasFeature(type, feature) PyType_HasFeature(type, feature) |
733 | #define __Pyx_PyObject_GetIterNextFunc(obj) PyIter_Next |
734 | #endif |
735 | #if CYTHON_USE_TYPE_SPECS && PY_VERSION_HEX >= 0x03080000 |
736 | #define __Pyx_PyHeapTypeObject_GC_Del(obj) {\ |
737 | PyTypeObject *type = Py_TYPE(obj);\ |
738 | assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\ |
739 | PyObject_GC_Del(obj);\ |
740 | Py_DECREF(type);\ |
741 | } |
742 | #else |
743 | #define __Pyx_PyHeapTypeObject_GC_Del(obj) PyObject_GC_Del(obj) |
744 | #endif |
745 | #if CYTHON_COMPILING_IN_LIMITED_API |
746 | #define CYTHON_PEP393_ENABLED 1 |
747 | #define __Pyx_PyUnicode_READY(op) (0) |
748 | #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GetLength(u) |
749 | #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i) |
750 | #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((void)u, 1114111) |
751 | #define __Pyx_PyUnicode_KIND(u) ((void)u, (0)) |
752 | #define __Pyx_PyUnicode_DATA(u) ((void*)u) |
753 | #define __Pyx_PyUnicode_READ(k, d, i) ((void)k, PyUnicode_ReadChar((PyObject*)(d), i)) |
754 | #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GetLength(u)) |
755 | #elif PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) |
756 | #define CYTHON_PEP393_ENABLED 1 |
757 | #if defined(PyUnicode_IS_READY) |
758 | #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ |
759 | 0 : _PyUnicode_Ready((PyObject *)(op))) |
760 | #else |
761 | #define __Pyx_PyUnicode_READY(op) (0) |
762 | #endif |
763 | #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) |
764 | #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) |
765 | #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) |
766 | #define __Pyx_PyUnicode_KIND(u) ((int)PyUnicode_KIND(u)) |
767 | #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) |
768 | #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) |
769 | #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch) |
770 | #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE) |
771 | #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000 |
772 | #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length)) |
773 | #else |
774 | #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) |
775 | #endif |
776 | #else |
777 | #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u)) |
778 | #endif |
779 | #else |
780 | #define CYTHON_PEP393_ENABLED 0 |
781 | #define PyUnicode_1BYTE_KIND 1 |
782 | #define PyUnicode_2BYTE_KIND 2 |
783 | #define PyUnicode_4BYTE_KIND 4 |
784 | #define __Pyx_PyUnicode_READY(op) (0) |
785 | #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) |
786 | #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) |
787 | #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111) |
788 | #define __Pyx_PyUnicode_KIND(u) ((int)sizeof(Py_UNICODE)) |
789 | #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) |
790 | #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) |
791 | #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch) |
792 | #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) |
793 | #endif |
794 | #if CYTHON_COMPILING_IN_PYPY |
795 | #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) |
796 | #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) |
797 | #else |
798 | #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) |
799 | #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ |
800 | PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) |
801 | #endif |
802 | #if CYTHON_COMPILING_IN_PYPY |
803 | #if !defined(PyUnicode_DecodeUnicodeEscape) |
804 | #define PyUnicode_DecodeUnicodeEscape(s, size, errors) PyUnicode_Decode(s, size, "unicode_escape", errors) |
805 | #endif |
806 | #if !defined(PyUnicode_Contains) || (PY_MAJOR_VERSION == 2 && PYPY_VERSION_NUM < 0x07030500) |
807 | #undef PyUnicode_Contains |
808 | #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) |
809 | #endif |
810 | #if !defined(PyByteArray_Check) |
811 | #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) |
812 | #endif |
813 | #if !defined(PyObject_Format) |
814 | #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) |
815 | #endif |
816 | #endif |
817 | #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)) |
818 | #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) |
819 | #if PY_MAJOR_VERSION >= 3 |
820 | #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b) |
821 | #else |
822 | #define __Pyx_PyString_Format(a, b) PyString_Format(a, b) |
823 | #endif |
824 | #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII) |
825 | #define PyObject_ASCII(o) PyObject_Repr(o) |
826 | #endif |
827 | #if PY_MAJOR_VERSION >= 3 |
828 | #define PyBaseString_Type PyUnicode_Type |
829 | #define PyStringObject PyUnicodeObject |
830 | #define PyString_Type PyUnicode_Type |
831 | #define PyString_Check PyUnicode_Check |
832 | #define PyString_CheckExact PyUnicode_CheckExact |
833 | #ifndef PyObject_Unicode |
834 | #define PyObject_Unicode PyObject_Str |
835 | #endif |
836 | #endif |
837 | #if PY_MAJOR_VERSION >= 3 |
838 | #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) |
839 | #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) |
840 | #else |
841 | #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) |
842 | #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) |
843 | #endif |
844 | #if CYTHON_COMPILING_IN_CPYTHON |
845 | #define __Pyx_PySequence_ListKeepNew(obj)\ |
846 | (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj)) |
847 | #else |
848 | #define __Pyx_PySequence_ListKeepNew(obj) PySequence_List(obj) |
849 | #endif |
850 | #ifndef PySet_CheckExact |
851 | #define PySet_CheckExact(obj) __Pyx_IS_TYPE(obj, &PySet_Type) |
852 | #endif |
853 | #if PY_VERSION_HEX >= 0x030900A4 |
854 | #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt) |
855 | #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size) |
856 | #else |
857 | #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt) |
858 | #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size) |
859 | #endif |
860 | #if CYTHON_ASSUME_SAFE_MACROS |
861 | #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq) |
862 | #else |
863 | #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq) |
864 | #endif |
865 | #if PY_MAJOR_VERSION >= 3 |
866 | #define PyIntObject PyLongObject |
867 | #define PyInt_Type PyLong_Type |
868 | #define PyInt_Check(op) PyLong_Check(op) |
869 | #define PyInt_CheckExact(op) PyLong_CheckExact(op) |
870 | #define PyInt_FromString PyLong_FromString |
871 | #define PyInt_FromUnicode PyLong_FromUnicode |
872 | #define PyInt_FromLong PyLong_FromLong |
873 | #define PyInt_FromSize_t PyLong_FromSize_t |
874 | #define PyInt_FromSsize_t PyLong_FromSsize_t |
875 | #define PyInt_AsLong PyLong_AsLong |
876 | #define PyInt_AS_LONG PyLong_AS_LONG |
877 | #define PyInt_AsSsize_t PyLong_AsSsize_t |
878 | #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask |
879 | #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask |
880 | #define PyNumber_Int PyNumber_Long |
881 | #endif |
882 | #if PY_MAJOR_VERSION >= 3 |
883 | #define PyBoolObject PyLongObject |
884 | #endif |
885 | #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY |
886 | #ifndef PyUnicode_InternFromString |
887 | #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) |
888 | #endif |
889 | #endif |
890 | #if PY_VERSION_HEX < 0x030200A4 |
891 | typedef long Py_hash_t; |
892 | #define __Pyx_PyInt_FromHash_t PyInt_FromLong |
893 | #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsHash_t |
894 | #else |
895 | #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t |
896 | #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t |
897 | #endif |
898 | #if CYTHON_USE_ASYNC_SLOTS |
899 | #if PY_VERSION_HEX >= 0x030500B1 |
900 | #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods |
901 | #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async) |
902 | #else |
903 | #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved)) |
904 | #endif |
905 | #else |
906 | #define __Pyx_PyType_AsAsync(obj) NULL |
907 | #endif |
908 | #ifndef __Pyx_PyAsyncMethodsStruct |
909 | typedef struct { |
910 | unaryfunc am_await; |
911 | unaryfunc am_aiter; |
912 | unaryfunc am_anext; |
913 | } __Pyx_PyAsyncMethodsStruct; |
914 | #endif |
915 | |
916 | #if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS) |
917 | #define _USE_MATH_DEFINES |
918 | #endif |
919 | #include <math.h> |
920 | #ifdef NAN |
921 | #define __PYX_NAN() ((float) NAN) |
922 | #else |
923 | static CYTHON_INLINE float __PYX_NAN() { |
924 | float value; |
925 | memset(&value, 0xFF, sizeof(value)); |
926 | return value; |
927 | } |
928 | #endif |
929 | #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) |
930 | #define __Pyx_truncl trunc |
931 | #else |
932 | #define __Pyx_truncl truncl |
933 | #endif |
934 | |
935 | #define __PYX_MARK_ERR_POS(f_index, lineno) \ |
936 | { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; } |
937 | #define __PYX_ERR(f_index, lineno, Ln_error) \ |
938 | { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; } |
939 | |
940 | #ifndef __PYX_EXTERN_C |
941 | #ifdef __cplusplus |
942 | #define __PYX_EXTERN_C extern "C" |
943 | #else |
944 | #define __PYX_EXTERN_C extern |
945 | #endif |
946 | #endif |
947 | |
948 | #define __PYX_HAVE__tensorflow__python__framework__fast_tensor_util |
949 | #define __PYX_HAVE_API__tensorflow__python__framework__fast_tensor_util |
950 | /* Early includes */ |
951 | #include <string.h> |
952 | #include <stdio.h> |
953 | |
954 | /* Using NumPy API declarations from "numpy/__init__.cython-30.pxd" */ |
955 | |
956 | #include "numpy/arrayobject.h" |
957 | #include "numpy/ndarrayobject.h" |
958 | #include "numpy/ndarraytypes.h" |
959 | #include "numpy/arrayscalars.h" |
960 | #include "numpy/ufuncobject.h" |
961 | #ifdef _OPENMP |
962 | #include <omp.h> |
963 | #endif /* _OPENMP */ |
964 | |
965 | #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS) |
966 | #define CYTHON_WITHOUT_ASSERTIONS |
967 | #endif |
968 | |
969 | typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding; |
970 | const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; |
971 | |
972 | #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 |
973 | #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0 |
974 | #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8) |
975 | #define __PYX_DEFAULT_STRING_ENCODING "" |
976 | #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString |
977 | #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize |
978 | #define __Pyx_uchar_cast(c) ((unsigned char)c) |
979 | #define __Pyx_long_cast(x) ((long)x) |
980 | #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\ |
981 | (sizeof(type) < sizeof(Py_ssize_t)) ||\ |
982 | (sizeof(type) > sizeof(Py_ssize_t) &&\ |
983 | likely(v < (type)PY_SSIZE_T_MAX ||\ |
984 | v == (type)PY_SSIZE_T_MAX) &&\ |
985 | (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\ |
986 | v == (type)PY_SSIZE_T_MIN))) ||\ |
987 | (sizeof(type) == sizeof(Py_ssize_t) &&\ |
988 | (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ |
989 | v == (type)PY_SSIZE_T_MAX))) ) |
990 | static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) { |
991 | return (size_t) i < (size_t) limit; |
992 | } |
993 | #if defined (__cplusplus) && __cplusplus >= 201103L |
994 | #include <cstdlib> |
995 | #define __Pyx_sst_abs(value) std::abs(value) |
996 | #elif SIZEOF_INT >= SIZEOF_SIZE_T |
997 | #define __Pyx_sst_abs(value) abs(value) |
998 | #elif SIZEOF_LONG >= SIZEOF_SIZE_T |
999 | #define __Pyx_sst_abs(value) labs(value) |
1000 | #elif defined (_MSC_VER) |
1001 | #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value)) |
1002 | #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L |
1003 | #define __Pyx_sst_abs(value) llabs(value) |
1004 | #elif defined (__GNUC__) |
1005 | #define __Pyx_sst_abs(value) __builtin_llabs(value) |
1006 | #else |
1007 | #define __Pyx_sst_abs(value) ((value<0) ? -value : value) |
1008 | #endif |
1009 | static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*); |
1010 | static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); |
1011 | #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s)) |
1012 | #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) |
1013 | #define __Pyx_PyBytes_FromString PyBytes_FromString |
1014 | #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize |
1015 | static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); |
1016 | #if PY_MAJOR_VERSION < 3 |
1017 | #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString |
1018 | #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize |
1019 | #else |
1020 | #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString |
1021 | #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize |
1022 | #endif |
1023 | #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s)) |
1024 | #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s)) |
1025 | #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s)) |
1026 | #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s)) |
1027 | #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s)) |
1028 | #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s)) |
1029 | #define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) |
1030 | #define __Pyx_PyObject_AsWritableSString(s) ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) |
1031 | #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) |
1032 | #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s)) |
1033 | #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s)) |
1034 | #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) |
1035 | #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) |
1036 | #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) |
1037 | #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) |
1038 | #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) |
1039 | #if CYTHON_COMPILING_IN_LIMITED_API |
1040 | static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const wchar_t *u) |
1041 | { |
1042 | const wchar_t *u_end = u; |
1043 | while (*u_end++) ; |
1044 | return (size_t)(u_end - u - 1); |
1045 | } |
1046 | #else |
1047 | static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) |
1048 | { |
1049 | const Py_UNICODE *u_end = u; |
1050 | while (*u_end++) ; |
1051 | return (size_t)(u_end - u - 1); |
1052 | } |
1053 | #endif |
1054 | #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) |
1055 | #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode |
1056 | #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode |
1057 | #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj) |
1058 | #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None) |
1059 | static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b); |
1060 | static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); |
1061 | static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*); |
1062 | static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); |
1063 | #define __Pyx_PySequence_Tuple(obj)\ |
1064 | (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) |
1065 | static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); |
1066 | static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); |
1067 | static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); |
1068 | #if CYTHON_ASSUME_SAFE_MACROS |
1069 | #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) |
1070 | #else |
1071 | #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) |
1072 | #endif |
1073 | #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) |
1074 | #if PY_MAJOR_VERSION >= 3 |
1075 | #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) |
1076 | #else |
1077 | #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) |
1078 | #endif |
1079 | #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII |
1080 | static int __Pyx_sys_getdefaultencoding_not_ascii; |
1081 | static int __Pyx_init_sys_getdefaultencoding_params(void) { |
1082 | PyObject* sys; |
1083 | PyObject* default_encoding = NULL; |
1084 | PyObject* ascii_chars_u = NULL; |
1085 | PyObject* ascii_chars_b = NULL; |
1086 | const char* default_encoding_c; |
1087 | sys = PyImport_ImportModule("sys" ); |
1088 | if (!sys) goto bad; |
1089 | default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding" , NULL); |
1090 | Py_DECREF(sys); |
1091 | if (!default_encoding) goto bad; |
1092 | default_encoding_c = PyBytes_AsString(default_encoding); |
1093 | if (!default_encoding_c) goto bad; |
1094 | if (strcmp(default_encoding_c, "ascii" ) == 0) { |
1095 | __Pyx_sys_getdefaultencoding_not_ascii = 0; |
1096 | } else { |
1097 | char ascii_chars[128]; |
1098 | int c; |
1099 | for (c = 0; c < 128; c++) { |
1100 | ascii_chars[c] = c; |
1101 | } |
1102 | __Pyx_sys_getdefaultencoding_not_ascii = 1; |
1103 | ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); |
1104 | if (!ascii_chars_u) goto bad; |
1105 | ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); |
1106 | if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { |
1107 | PyErr_Format( |
1108 | PyExc_ValueError, |
1109 | "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii." , |
1110 | default_encoding_c); |
1111 | goto bad; |
1112 | } |
1113 | Py_DECREF(ascii_chars_u); |
1114 | Py_DECREF(ascii_chars_b); |
1115 | } |
1116 | Py_DECREF(default_encoding); |
1117 | return 0; |
1118 | bad: |
1119 | Py_XDECREF(default_encoding); |
1120 | Py_XDECREF(ascii_chars_u); |
1121 | Py_XDECREF(ascii_chars_b); |
1122 | return -1; |
1123 | } |
1124 | #endif |
1125 | #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 |
1126 | #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) |
1127 | #else |
1128 | #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) |
1129 | #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT |
1130 | static char* __PYX_DEFAULT_STRING_ENCODING; |
1131 | static int __Pyx_init_sys_getdefaultencoding_params(void) { |
1132 | PyObject* sys; |
1133 | PyObject* default_encoding = NULL; |
1134 | char* default_encoding_c; |
1135 | sys = PyImport_ImportModule("sys" ); |
1136 | if (!sys) goto bad; |
1137 | default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding" , NULL); |
1138 | Py_DECREF(sys); |
1139 | if (!default_encoding) goto bad; |
1140 | default_encoding_c = PyBytes_AsString(default_encoding); |
1141 | if (!default_encoding_c) goto bad; |
1142 | __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1); |
1143 | if (!__PYX_DEFAULT_STRING_ENCODING) goto bad; |
1144 | strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); |
1145 | Py_DECREF(default_encoding); |
1146 | return 0; |
1147 | bad: |
1148 | Py_XDECREF(default_encoding); |
1149 | return -1; |
1150 | } |
1151 | #endif |
1152 | #endif |
1153 | |
1154 | |
1155 | /* Test for GCC > 2.95 */ |
1156 | #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))) |
1157 | #define likely(x) __builtin_expect(!!(x), 1) |
1158 | #define unlikely(x) __builtin_expect(!!(x), 0) |
1159 | #else /* !__GNUC__ or GCC < 2.95 */ |
1160 | #define likely(x) (x) |
1161 | #define unlikely(x) (x) |
1162 | #endif /* __GNUC__ */ |
1163 | static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } |
1164 | |
1165 | #if !CYTHON_USE_MODULE_STATE |
1166 | static PyObject *__pyx_m = NULL; |
1167 | static PyObject *__pyx_d; |
1168 | static PyObject *__pyx_b; |
1169 | static PyObject *__pyx_cython_runtime = NULL; |
1170 | static PyObject *__pyx_empty_tuple; |
1171 | static PyObject *__pyx_empty_bytes; |
1172 | static PyObject *__pyx_empty_unicode; |
1173 | #endif |
1174 | static int __pyx_lineno; |
1175 | static int __pyx_clineno = 0; |
1176 | static const char * __pyx_cfilenm = __FILE__; |
1177 | static const char *__pyx_filename; |
1178 | |
1179 | /* Header.proto */ |
1180 | #if !defined(CYTHON_CCOMPLEX) |
1181 | #if defined(__cplusplus) |
1182 | #define CYTHON_CCOMPLEX 1 |
1183 | #elif defined(_Complex_I) |
1184 | #define CYTHON_CCOMPLEX 1 |
1185 | #else |
1186 | #define CYTHON_CCOMPLEX 0 |
1187 | #endif |
1188 | #endif |
1189 | #if CYTHON_CCOMPLEX |
1190 | #ifdef __cplusplus |
1191 | #include <complex> |
1192 | #else |
1193 | #include <complex.h> |
1194 | #endif |
1195 | #endif |
1196 | #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) |
1197 | #undef _Complex_I |
1198 | #define _Complex_I 1.0fj |
1199 | #endif |
1200 | |
1201 | /* #### Code section: filename_table ### */ |
1202 | |
1203 | static const char *__pyx_f[] = { |
1204 | "tensorflow/python/framework/fast_tensor_util.pyx" , |
1205 | "__init__.cython-30.pxd" , |
1206 | "type.pxd" , |
1207 | }; |
1208 | /* #### Code section: utility_code_proto_before_types ### */ |
1209 | /* BufferFormatStructs.proto */ |
1210 | #define IS_UNSIGNED(type) (((type) -1) > 0) |
1211 | struct __Pyx_StructField_; |
1212 | #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0) |
1213 | typedef struct { |
1214 | const char* name; |
1215 | struct __Pyx_StructField_* fields; |
1216 | size_t size; |
1217 | size_t arraysize[8]; |
1218 | int ndim; |
1219 | char typegroup; |
1220 | char is_unsigned; |
1221 | int flags; |
1222 | } __Pyx_TypeInfo; |
1223 | typedef struct __Pyx_StructField_ { |
1224 | __Pyx_TypeInfo* type; |
1225 | const char* name; |
1226 | size_t offset; |
1227 | } __Pyx_StructField; |
1228 | typedef struct { |
1229 | __Pyx_StructField* field; |
1230 | size_t parent_offset; |
1231 | } __Pyx_BufFmt_StackElem; |
1232 | typedef struct { |
1233 | __Pyx_StructField root; |
1234 | __Pyx_BufFmt_StackElem* head; |
1235 | size_t fmt_offset; |
1236 | size_t new_count, enc_count; |
1237 | size_t struct_alignment; |
1238 | int is_complex; |
1239 | char enc_type; |
1240 | char new_packmode; |
1241 | char enc_packmode; |
1242 | char is_valid_array; |
1243 | } __Pyx_BufFmt_Context; |
1244 | |
1245 | /* #### Code section: numeric_typedefs ### */ |
1246 | |
1247 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":731 |
1248 | * # in Cython to enable them only on the right systems. |
1249 | * |
1250 | * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< |
1251 | * ctypedef npy_int16 int16_t |
1252 | * ctypedef npy_int32 int32_t |
1253 | */ |
1254 | typedef npy_int8 __pyx_t_5numpy_int8_t; |
1255 | |
1256 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":732 |
1257 | * |
1258 | * ctypedef npy_int8 int8_t |
1259 | * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< |
1260 | * ctypedef npy_int32 int32_t |
1261 | * ctypedef npy_int64 int64_t |
1262 | */ |
1263 | typedef npy_int16 __pyx_t_5numpy_int16_t; |
1264 | |
1265 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":733 |
1266 | * ctypedef npy_int8 int8_t |
1267 | * ctypedef npy_int16 int16_t |
1268 | * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< |
1269 | * ctypedef npy_int64 int64_t |
1270 | * #ctypedef npy_int96 int96_t |
1271 | */ |
1272 | typedef npy_int32 __pyx_t_5numpy_int32_t; |
1273 | |
1274 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":734 |
1275 | * ctypedef npy_int16 int16_t |
1276 | * ctypedef npy_int32 int32_t |
1277 | * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< |
1278 | * #ctypedef npy_int96 int96_t |
1279 | * #ctypedef npy_int128 int128_t |
1280 | */ |
1281 | typedef npy_int64 __pyx_t_5numpy_int64_t; |
1282 | |
1283 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":738 |
1284 | * #ctypedef npy_int128 int128_t |
1285 | * |
1286 | * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< |
1287 | * ctypedef npy_uint16 uint16_t |
1288 | * ctypedef npy_uint32 uint32_t |
1289 | */ |
1290 | typedef npy_uint8 __pyx_t_5numpy_uint8_t; |
1291 | |
1292 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":739 |
1293 | * |
1294 | * ctypedef npy_uint8 uint8_t |
1295 | * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< |
1296 | * ctypedef npy_uint32 uint32_t |
1297 | * ctypedef npy_uint64 uint64_t |
1298 | */ |
1299 | typedef npy_uint16 __pyx_t_5numpy_uint16_t; |
1300 | |
1301 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":740 |
1302 | * ctypedef npy_uint8 uint8_t |
1303 | * ctypedef npy_uint16 uint16_t |
1304 | * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< |
1305 | * ctypedef npy_uint64 uint64_t |
1306 | * #ctypedef npy_uint96 uint96_t |
1307 | */ |
1308 | typedef npy_uint32 __pyx_t_5numpy_uint32_t; |
1309 | |
1310 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":741 |
1311 | * ctypedef npy_uint16 uint16_t |
1312 | * ctypedef npy_uint32 uint32_t |
1313 | * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< |
1314 | * #ctypedef npy_uint96 uint96_t |
1315 | * #ctypedef npy_uint128 uint128_t |
1316 | */ |
1317 | typedef npy_uint64 __pyx_t_5numpy_uint64_t; |
1318 | |
1319 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":745 |
1320 | * #ctypedef npy_uint128 uint128_t |
1321 | * |
1322 | * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< |
1323 | * ctypedef npy_float64 float64_t |
1324 | * #ctypedef npy_float80 float80_t |
1325 | */ |
1326 | typedef npy_float32 __pyx_t_5numpy_float32_t; |
1327 | |
1328 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":746 |
1329 | * |
1330 | * ctypedef npy_float32 float32_t |
1331 | * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< |
1332 | * #ctypedef npy_float80 float80_t |
1333 | * #ctypedef npy_float128 float128_t |
1334 | */ |
1335 | typedef npy_float64 __pyx_t_5numpy_float64_t; |
1336 | |
1337 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":755 |
1338 | * # The int types are mapped a bit surprising -- |
1339 | * # numpy.int corresponds to 'l' and numpy.long to 'q' |
1340 | * ctypedef npy_long int_t # <<<<<<<<<<<<<< |
1341 | * ctypedef npy_longlong long_t |
1342 | * ctypedef npy_longlong longlong_t |
1343 | */ |
1344 | typedef npy_long __pyx_t_5numpy_int_t; |
1345 | |
1346 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":756 |
1347 | * # numpy.int corresponds to 'l' and numpy.long to 'q' |
1348 | * ctypedef npy_long int_t |
1349 | * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< |
1350 | * ctypedef npy_longlong longlong_t |
1351 | * |
1352 | */ |
1353 | typedef npy_longlong __pyx_t_5numpy_long_t; |
1354 | |
1355 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":757 |
1356 | * ctypedef npy_long int_t |
1357 | * ctypedef npy_longlong long_t |
1358 | * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< |
1359 | * |
1360 | * ctypedef npy_ulong uint_t |
1361 | */ |
1362 | typedef npy_longlong __pyx_t_5numpy_longlong_t; |
1363 | |
1364 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":759 |
1365 | * ctypedef npy_longlong longlong_t |
1366 | * |
1367 | * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< |
1368 | * ctypedef npy_ulonglong ulong_t |
1369 | * ctypedef npy_ulonglong ulonglong_t |
1370 | */ |
1371 | typedef npy_ulong __pyx_t_5numpy_uint_t; |
1372 | |
1373 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":760 |
1374 | * |
1375 | * ctypedef npy_ulong uint_t |
1376 | * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< |
1377 | * ctypedef npy_ulonglong ulonglong_t |
1378 | * |
1379 | */ |
1380 | typedef npy_ulonglong __pyx_t_5numpy_ulong_t; |
1381 | |
1382 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":761 |
1383 | * ctypedef npy_ulong uint_t |
1384 | * ctypedef npy_ulonglong ulong_t |
1385 | * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< |
1386 | * |
1387 | * ctypedef npy_intp intp_t |
1388 | */ |
1389 | typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; |
1390 | |
1391 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":763 |
1392 | * ctypedef npy_ulonglong ulonglong_t |
1393 | * |
1394 | * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< |
1395 | * ctypedef npy_uintp uintp_t |
1396 | * |
1397 | */ |
1398 | typedef npy_intp __pyx_t_5numpy_intp_t; |
1399 | |
1400 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":764 |
1401 | * |
1402 | * ctypedef npy_intp intp_t |
1403 | * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< |
1404 | * |
1405 | * ctypedef npy_double float_t |
1406 | */ |
1407 | typedef npy_uintp __pyx_t_5numpy_uintp_t; |
1408 | |
1409 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":766 |
1410 | * ctypedef npy_uintp uintp_t |
1411 | * |
1412 | * ctypedef npy_double float_t # <<<<<<<<<<<<<< |
1413 | * ctypedef npy_double double_t |
1414 | * ctypedef npy_longdouble longdouble_t |
1415 | */ |
1416 | typedef npy_double __pyx_t_5numpy_float_t; |
1417 | |
1418 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":767 |
1419 | * |
1420 | * ctypedef npy_double float_t |
1421 | * ctypedef npy_double double_t # <<<<<<<<<<<<<< |
1422 | * ctypedef npy_longdouble longdouble_t |
1423 | * |
1424 | */ |
1425 | typedef npy_double __pyx_t_5numpy_double_t; |
1426 | |
1427 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":768 |
1428 | * ctypedef npy_double float_t |
1429 | * ctypedef npy_double double_t |
1430 | * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< |
1431 | * |
1432 | * ctypedef npy_cfloat cfloat_t |
1433 | */ |
1434 | typedef npy_longdouble __pyx_t_5numpy_longdouble_t; |
1435 | /* #### Code section: complex_type_declarations ### */ |
1436 | /* Declarations.proto */ |
1437 | #if CYTHON_CCOMPLEX |
1438 | #ifdef __cplusplus |
1439 | typedef ::std::complex< float > __pyx_t_float_complex; |
1440 | #else |
1441 | typedef float _Complex __pyx_t_float_complex; |
1442 | #endif |
1443 | #else |
1444 | typedef struct { float real, imag; } __pyx_t_float_complex; |
1445 | #endif |
1446 | static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); |
1447 | |
1448 | /* Declarations.proto */ |
1449 | #if CYTHON_CCOMPLEX |
1450 | #ifdef __cplusplus |
1451 | typedef ::std::complex< double > __pyx_t_double_complex; |
1452 | #else |
1453 | typedef double _Complex __pyx_t_double_complex; |
1454 | #endif |
1455 | #else |
1456 | typedef struct { double real, imag; } __pyx_t_double_complex; |
1457 | #endif |
1458 | static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); |
1459 | |
1460 | /* #### Code section: type_declarations ### */ |
1461 | |
1462 | /*--- Type declarations ---*/ |
1463 | |
1464 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":770 |
1465 | * ctypedef npy_longdouble longdouble_t |
1466 | * |
1467 | * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< |
1468 | * ctypedef npy_cdouble cdouble_t |
1469 | * ctypedef npy_clongdouble clongdouble_t |
1470 | */ |
1471 | typedef npy_cfloat __pyx_t_5numpy_cfloat_t; |
1472 | |
1473 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":771 |
1474 | * |
1475 | * ctypedef npy_cfloat cfloat_t |
1476 | * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< |
1477 | * ctypedef npy_clongdouble clongdouble_t |
1478 | * |
1479 | */ |
1480 | typedef npy_cdouble __pyx_t_5numpy_cdouble_t; |
1481 | |
1482 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":772 |
1483 | * ctypedef npy_cfloat cfloat_t |
1484 | * ctypedef npy_cdouble cdouble_t |
1485 | * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< |
1486 | * |
1487 | * ctypedef npy_cdouble complex_t |
1488 | */ |
1489 | typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; |
1490 | |
1491 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":774 |
1492 | * ctypedef npy_clongdouble clongdouble_t |
1493 | * |
1494 | * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< |
1495 | * |
1496 | * cdef inline object PyArray_MultiIterNew1(a): |
1497 | */ |
1498 | typedef npy_cdouble __pyx_t_5numpy_complex_t; |
1499 | /* #### Code section: utility_code_proto ### */ |
1500 | |
1501 | /* --- Runtime support code (head) --- */ |
1502 | /* Refnanny.proto */ |
1503 | #ifndef CYTHON_REFNANNY |
1504 | #define CYTHON_REFNANNY 0 |
1505 | #endif |
1506 | #if CYTHON_REFNANNY |
1507 | typedef struct { |
1508 | void (*INCREF)(void*, PyObject*, Py_ssize_t); |
1509 | void (*DECREF)(void*, PyObject*, Py_ssize_t); |
1510 | void (*GOTREF)(void*, PyObject*, Py_ssize_t); |
1511 | void (*GIVEREF)(void*, PyObject*, Py_ssize_t); |
1512 | void* (*SetupContext)(const char*, Py_ssize_t, const char*); |
1513 | void (*FinishContext)(void**); |
1514 | } __Pyx_RefNannyAPIStruct; |
1515 | static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; |
1516 | static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); |
1517 | #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; |
1518 | #ifdef WITH_THREAD |
1519 | #define __Pyx_RefNannySetupContext(name, acquire_gil)\ |
1520 | if (acquire_gil) {\ |
1521 | PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ |
1522 | __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ |
1523 | PyGILState_Release(__pyx_gilstate_save);\ |
1524 | } else {\ |
1525 | __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ |
1526 | } |
1527 | #define __Pyx_RefNannyFinishContextNogil() {\ |
1528 | PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ |
1529 | __Pyx_RefNannyFinishContext();\ |
1530 | PyGILState_Release(__pyx_gilstate_save);\ |
1531 | } |
1532 | #else |
1533 | #define __Pyx_RefNannySetupContext(name, acquire_gil)\ |
1534 | __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__)) |
1535 | #define __Pyx_RefNannyFinishContextNogil() __Pyx_RefNannyFinishContext() |
1536 | #endif |
1537 | #define __Pyx_RefNannyFinishContext()\ |
1538 | __Pyx_RefNanny->FinishContext(&__pyx_refnanny) |
1539 | #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) |
1540 | #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) |
1541 | #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) |
1542 | #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) |
1543 | #define __Pyx_XINCREF(r) do { if((r) == NULL); else {__Pyx_INCREF(r); }} while(0) |
1544 | #define __Pyx_XDECREF(r) do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0) |
1545 | #define __Pyx_XGOTREF(r) do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0) |
1546 | #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0) |
1547 | #else |
1548 | #define __Pyx_RefNannyDeclarations |
1549 | #define __Pyx_RefNannySetupContext(name, acquire_gil) |
1550 | #define __Pyx_RefNannyFinishContextNogil() |
1551 | #define __Pyx_RefNannyFinishContext() |
1552 | #define __Pyx_INCREF(r) Py_INCREF(r) |
1553 | #define __Pyx_DECREF(r) Py_DECREF(r) |
1554 | #define __Pyx_GOTREF(r) |
1555 | #define __Pyx_GIVEREF(r) |
1556 | #define __Pyx_XINCREF(r) Py_XINCREF(r) |
1557 | #define __Pyx_XDECREF(r) Py_XDECREF(r) |
1558 | #define __Pyx_XGOTREF(r) |
1559 | #define __Pyx_XGIVEREF(r) |
1560 | #endif |
1561 | #define __Pyx_Py_XDECREF_SET(r, v) do {\ |
1562 | PyObject *tmp = (PyObject *) r;\ |
1563 | r = v; Py_XDECREF(tmp);\ |
1564 | } while (0) |
1565 | #define __Pyx_XDECREF_SET(r, v) do {\ |
1566 | PyObject *tmp = (PyObject *) r;\ |
1567 | r = v; __Pyx_XDECREF(tmp);\ |
1568 | } while (0) |
1569 | #define __Pyx_DECREF_SET(r, v) do {\ |
1570 | PyObject *tmp = (PyObject *) r;\ |
1571 | r = v; __Pyx_DECREF(tmp);\ |
1572 | } while (0) |
1573 | #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) |
1574 | #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) |
1575 | |
1576 | /* PyErrExceptionMatches.proto */ |
1577 | #if CYTHON_FAST_THREAD_STATE |
1578 | #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) |
1579 | static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); |
1580 | #else |
1581 | #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) |
1582 | #endif |
1583 | |
1584 | /* PyThreadStateGet.proto */ |
1585 | #if CYTHON_FAST_THREAD_STATE |
1586 | #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; |
1587 | #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; |
1588 | #define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type |
1589 | #else |
1590 | #define __Pyx_PyThreadState_declare |
1591 | #define __Pyx_PyThreadState_assign |
1592 | #define __Pyx_PyErr_Occurred() PyErr_Occurred() |
1593 | #endif |
1594 | |
1595 | /* PyErrFetchRestore.proto */ |
1596 | #if CYTHON_FAST_THREAD_STATE |
1597 | #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) |
1598 | #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) |
1599 | #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) |
1600 | #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) |
1601 | #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) |
1602 | static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); |
1603 | static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); |
1604 | #if CYTHON_COMPILING_IN_CPYTHON |
1605 | #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) |
1606 | #else |
1607 | #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) |
1608 | #endif |
1609 | #else |
1610 | #define __Pyx_PyErr_Clear() PyErr_Clear() |
1611 | #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) |
1612 | #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) |
1613 | #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) |
1614 | #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) |
1615 | #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) |
1616 | #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) |
1617 | #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) |
1618 | #endif |
1619 | |
1620 | /* PyObjectGetAttrStr.proto */ |
1621 | #if CYTHON_USE_TYPE_SLOTS |
1622 | static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); |
1623 | #else |
1624 | #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) |
1625 | #endif |
1626 | |
1627 | /* PyObjectGetAttrStrNoError.proto */ |
1628 | static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); |
1629 | |
1630 | /* GetBuiltinName.proto */ |
1631 | static PyObject *__Pyx_GetBuiltinName(PyObject *name); |
1632 | |
1633 | /* TupleAndListFromArray.proto */ |
1634 | #if CYTHON_COMPILING_IN_CPYTHON |
1635 | static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n); |
1636 | static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n); |
1637 | #endif |
1638 | |
1639 | /* IncludeStringH.proto */ |
1640 | #include <string.h> |
1641 | |
1642 | /* BytesEquals.proto */ |
1643 | static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); |
1644 | |
1645 | /* UnicodeEquals.proto */ |
1646 | static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); |
1647 | |
1648 | /* fastcall.proto */ |
1649 | #define __Pyx_Arg_VARARGS(args, i) PyTuple_GET_ITEM(args, i) |
1650 | #define __Pyx_NumKwargs_VARARGS(kwds) PyDict_Size(kwds) |
1651 | #define __Pyx_KwValues_VARARGS(args, nargs) NULL |
1652 | #define __Pyx_GetKwValue_VARARGS(kw, kwvalues, s) __Pyx_PyDict_GetItemStrWithError(kw, s) |
1653 | #define __Pyx_KwargsAsDict_VARARGS(kw, kwvalues) PyDict_Copy(kw) |
1654 | #if CYTHON_METH_FASTCALL |
1655 | #define __Pyx_Arg_FASTCALL(args, i) args[i] |
1656 | #define __Pyx_NumKwargs_FASTCALL(kwds) PyTuple_GET_SIZE(kwds) |
1657 | #define __Pyx_KwValues_FASTCALL(args, nargs) (&args[nargs]) |
1658 | static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s); |
1659 | #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw) |
1660 | #else |
1661 | #define __Pyx_Arg_FASTCALL __Pyx_Arg_VARARGS |
1662 | #define __Pyx_NumKwargs_FASTCALL __Pyx_NumKwargs_VARARGS |
1663 | #define __Pyx_KwValues_FASTCALL __Pyx_KwValues_VARARGS |
1664 | #define __Pyx_GetKwValue_FASTCALL __Pyx_GetKwValue_VARARGS |
1665 | #define __Pyx_KwargsAsDict_FASTCALL __Pyx_KwargsAsDict_VARARGS |
1666 | #endif |
1667 | #if CYTHON_COMPILING_IN_CPYTHON |
1668 | #define __Pyx_ArgsSlice_VARARGS(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_VARARGS(args, start), stop - start) |
1669 | #define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_FASTCALL(args, start), stop - start) |
1670 | #else |
1671 | #define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop) |
1672 | #define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop) |
1673 | #endif |
1674 | |
1675 | /* RaiseArgTupleInvalid.proto */ |
1676 | static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, |
1677 | Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); |
1678 | |
1679 | /* RaiseDoubleKeywords.proto */ |
1680 | static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); |
1681 | |
1682 | /* ParseKeywords.proto */ |
1683 | static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject *const *kwvalues, |
1684 | PyObject **argnames[], |
1685 | PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, |
1686 | const char* function_name); |
1687 | |
1688 | /* ArgTypeTest.proto */ |
1689 | #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\ |
1690 | ((likely(__Pyx_IS_TYPE(obj, type) | (none_allowed && (obj == Py_None)))) ? 1 :\ |
1691 | __Pyx__ArgTypeTest(obj, type, name, exact)) |
1692 | static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact); |
1693 | |
1694 | /* IsLittleEndian.proto */ |
1695 | static CYTHON_INLINE int __Pyx_Is_Little_Endian(void); |
1696 | |
1697 | /* BufferFormatCheck.proto */ |
1698 | static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts); |
1699 | static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, |
1700 | __Pyx_BufFmt_StackElem* stack, |
1701 | __Pyx_TypeInfo* type); |
1702 | |
1703 | /* BufferGetAndValidate.proto */ |
1704 | #define __Pyx_GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack)\ |
1705 | ((obj == Py_None || obj == NULL) ?\ |
1706 | (__Pyx_ZeroBuffer(buf), 0) :\ |
1707 | __Pyx__GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack)) |
1708 | static int __Pyx__GetBufferAndValidate(Py_buffer* buf, PyObject* obj, |
1709 | __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); |
1710 | static void __Pyx_ZeroBuffer(Py_buffer* buf); |
1711 | static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); |
1712 | static Py_ssize_t __Pyx_minusones[] = { -1, -1, -1, -1, -1, -1, -1, -1 }; |
1713 | static Py_ssize_t __Pyx_zeros[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; |
1714 | |
1715 | /* ListAppend.proto */ |
1716 | #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS |
1717 | static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { |
1718 | PyListObject* L = (PyListObject*) list; |
1719 | Py_ssize_t len = Py_SIZE(list); |
1720 | if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) { |
1721 | Py_INCREF(x); |
1722 | PyList_SET_ITEM(list, len, x); |
1723 | __Pyx_SET_SIZE(list, len + 1); |
1724 | return 0; |
1725 | } |
1726 | return PyList_Append(list, x); |
1727 | } |
1728 | #else |
1729 | #define __Pyx_PyList_Append(L,x) PyList_Append(L,x) |
1730 | #endif |
1731 | |
1732 | /* PyFunctionFastCall.proto */ |
1733 | #if CYTHON_FAST_PYCALL |
1734 | #if !CYTHON_VECTORCALL |
1735 | #define __Pyx_PyFunction_FastCall(func, args, nargs)\ |
1736 | __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) |
1737 | static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs); |
1738 | #endif |
1739 | #define __Pyx_BUILD_ASSERT_EXPR(cond)\ |
1740 | (sizeof(char [1 - 2*!(cond)]) - 1) |
1741 | #ifndef Py_MEMBER_SIZE |
1742 | #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member) |
1743 | #endif |
1744 | #if !CYTHON_VECTORCALL |
1745 | static size_t __pyx_pyframe_localsplus_offset = 0; |
1746 | #include "frameobject.h" |
1747 | #define __Pxy_PyFrame_Initialize_Offsets()\ |
1748 | ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\ |
1749 | (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus))) |
1750 | #define __Pyx_PyFrame_GetLocalsplus(frame)\ |
1751 | (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset)) |
1752 | #endif // !CYTHON_VECTORCALL |
1753 | #endif |
1754 | |
1755 | /* PyObjectCall.proto */ |
1756 | #if CYTHON_COMPILING_IN_CPYTHON |
1757 | static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); |
1758 | #else |
1759 | #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) |
1760 | #endif |
1761 | |
1762 | /* PyObjectCallMethO.proto */ |
1763 | #if CYTHON_COMPILING_IN_CPYTHON |
1764 | static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); |
1765 | #endif |
1766 | |
1767 | /* PyObjectFastCall.proto */ |
1768 | #define __Pyx_PyObject_FastCall(func, args, nargs) __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL) |
1769 | static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs); |
1770 | |
1771 | /* PyObjectCall2Args.proto */ |
1772 | static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); |
1773 | |
1774 | /* PyObjectCallOneArg.proto */ |
1775 | static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); |
1776 | |
1777 | /* PyObjectGetMethod.proto */ |
1778 | static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method); |
1779 | |
1780 | /* PyObjectCallMethod1.proto */ |
1781 | static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg); |
1782 | |
1783 | /* append.proto */ |
1784 | static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x); |
1785 | |
1786 | #define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0) |
1787 | /* PyDictVersioning.proto */ |
1788 | #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS |
1789 | #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) |
1790 | #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) |
1791 | #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ |
1792 | (version_var) = __PYX_GET_DICT_VERSION(dict);\ |
1793 | (cache_var) = (value); |
1794 | #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\ |
1795 | static PY_UINT64_T __pyx_dict_version = 0;\ |
1796 | static PyObject *__pyx_dict_cached_value = NULL;\ |
1797 | if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\ |
1798 | (VAR) = __pyx_dict_cached_value;\ |
1799 | } else {\ |
1800 | (VAR) = __pyx_dict_cached_value = (LOOKUP);\ |
1801 | __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\ |
1802 | }\ |
1803 | } |
1804 | static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj); |
1805 | static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj); |
1806 | static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version); |
1807 | #else |
1808 | #define __PYX_GET_DICT_VERSION(dict) (0) |
1809 | #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) |
1810 | #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); |
1811 | #endif |
1812 | |
1813 | /* GetModuleGlobalName.proto */ |
1814 | #if CYTHON_USE_DICT_VERSIONS |
1815 | #define __Pyx_GetModuleGlobalName(var, name) {\ |
1816 | static PY_UINT64_T __pyx_dict_version = 0;\ |
1817 | static PyObject *__pyx_dict_cached_value = NULL;\ |
1818 | (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\ |
1819 | (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\ |
1820 | __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ |
1821 | } |
1822 | #define __Pyx_GetModuleGlobalNameUncached(var, name) {\ |
1823 | PY_UINT64_T __pyx_dict_version;\ |
1824 | PyObject *__pyx_dict_cached_value;\ |
1825 | (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ |
1826 | } |
1827 | static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value); |
1828 | #else |
1829 | #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name) |
1830 | #define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name) |
1831 | static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); |
1832 | #endif |
1833 | |
1834 | /* GetItemInt.proto */ |
1835 | #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ |
1836 | (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ |
1837 | __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\ |
1838 | (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\ |
1839 | __Pyx_GetItemInt_Generic(o, to_py_func(i)))) |
1840 | #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ |
1841 | (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ |
1842 | __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ |
1843 | (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) |
1844 | static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, |
1845 | int wraparound, int boundscheck); |
1846 | #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ |
1847 | (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ |
1848 | __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ |
1849 | (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL)) |
1850 | static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, |
1851 | int wraparound, int boundscheck); |
1852 | static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); |
1853 | static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, |
1854 | int is_list, int wraparound, int boundscheck); |
1855 | |
1856 | /* GetTopmostException.proto */ |
1857 | #if CYTHON_USE_EXC_INFO_STACK |
1858 | static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate); |
1859 | #endif |
1860 | |
1861 | /* SaveResetException.proto */ |
1862 | #if CYTHON_FAST_THREAD_STATE |
1863 | #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb) |
1864 | static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); |
1865 | #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb) |
1866 | static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); |
1867 | #else |
1868 | #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb) |
1869 | #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb) |
1870 | #endif |
1871 | |
1872 | /* GetException.proto */ |
1873 | #if CYTHON_FAST_THREAD_STATE |
1874 | #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb) |
1875 | static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); |
1876 | #else |
1877 | static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); |
1878 | #endif |
1879 | |
1880 | /* RaiseException.proto */ |
1881 | static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); |
1882 | |
1883 | /* TypeImport.proto */ |
1884 | #ifndef __PYX_HAVE_RT_ImportType_proto |
1885 | #define __PYX_HAVE_RT_ImportType_proto |
1886 | enum __Pyx_ImportType_CheckSize { |
1887 | __Pyx_ImportType_CheckSize_Error = 0, |
1888 | __Pyx_ImportType_CheckSize_Warn = 1, |
1889 | __Pyx_ImportType_CheckSize_Ignore = 2 |
1890 | }; |
1891 | static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size); |
1892 | #endif |
1893 | |
1894 | /* Import.proto */ |
1895 | static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); |
1896 | |
1897 | /* ImportDottedModule.proto */ |
1898 | static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple); |
1899 | |
1900 | /* ImportFrom.proto */ |
1901 | static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); |
1902 | |
1903 | /* IncludeStructmemberH.proto */ |
1904 | #include <structmember.h> |
1905 | |
1906 | /* FixUpExtensionType.proto */ |
1907 | #if CYTHON_USE_TYPE_SPECS |
1908 | static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type); |
1909 | #endif |
1910 | |
1911 | /* FetchCommonType.proto */ |
1912 | #if !CYTHON_USE_TYPE_SPECS |
1913 | static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type); |
1914 | #else |
1915 | static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases); |
1916 | #endif |
1917 | |
1918 | /* PyMethodNew.proto */ |
1919 | #if PY_MAJOR_VERSION >= 3 |
1920 | static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { |
1921 | CYTHON_UNUSED_VAR(typ); |
1922 | if (!self) |
1923 | return __Pyx_NewRef(func); |
1924 | return PyMethod_New(func, self); |
1925 | } |
1926 | #else |
1927 | #define __Pyx_PyMethod_New PyMethod_New |
1928 | #endif |
1929 | |
1930 | /* PyVectorcallFastCallDict.proto */ |
1931 | #if CYTHON_METH_FASTCALL |
1932 | static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw); |
1933 | #endif |
1934 | |
1935 | /* CythonFunctionShared.proto */ |
1936 | #define __Pyx_CyFunction_USED |
1937 | #define __Pyx_CYFUNCTION_STATICMETHOD 0x01 |
1938 | #define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 |
1939 | #define __Pyx_CYFUNCTION_CCLASS 0x04 |
1940 | #define __Pyx_CYFUNCTION_COROUTINE 0x08 |
1941 | #define __Pyx_CyFunction_GetClosure(f)\ |
1942 | (((__pyx_CyFunctionObject *) (f))->func_closure) |
1943 | #if PY_VERSION_HEX < 0x030900B1 |
1944 | #define __Pyx_CyFunction_GetClassObj(f)\ |
1945 | (((__pyx_CyFunctionObject *) (f))->func_classobj) |
1946 | #else |
1947 | #define __Pyx_CyFunction_GetClassObj(f)\ |
1948 | ((PyObject*) ((PyCMethodObject *) (f))->mm_class) |
1949 | #endif |
1950 | #define __Pyx_CyFunction_SetClassObj(f, classobj)\ |
1951 | __Pyx__CyFunction_SetClassObj((__pyx_CyFunctionObject *) (f), (classobj)) |
1952 | #define __Pyx_CyFunction_Defaults(type, f)\ |
1953 | ((type *)(((__pyx_CyFunctionObject *) (f))->defaults)) |
1954 | #define __Pyx_CyFunction_SetDefaultsGetter(f, g)\ |
1955 | ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g) |
1956 | typedef struct { |
1957 | #if PY_VERSION_HEX < 0x030900B1 |
1958 | PyCFunctionObject func; |
1959 | #else |
1960 | PyCMethodObject func; |
1961 | #endif |
1962 | #if CYTHON_BACKPORT_VECTORCALL |
1963 | __pyx_vectorcallfunc func_vectorcall; |
1964 | #endif |
1965 | #if PY_VERSION_HEX < 0x030500A0 |
1966 | PyObject *func_weakreflist; |
1967 | #endif |
1968 | PyObject *func_dict; |
1969 | PyObject *func_name; |
1970 | PyObject *func_qualname; |
1971 | PyObject *func_doc; |
1972 | PyObject *func_globals; |
1973 | PyObject *func_code; |
1974 | PyObject *func_closure; |
1975 | #if PY_VERSION_HEX < 0x030900B1 |
1976 | PyObject *func_classobj; |
1977 | #endif |
1978 | void *defaults; |
1979 | int defaults_pyobjects; |
1980 | size_t defaults_size; // used by FusedFunction for copying defaults |
1981 | int flags; |
1982 | PyObject *defaults_tuple; |
1983 | PyObject *defaults_kwdict; |
1984 | PyObject *(*defaults_getter)(PyObject *); |
1985 | PyObject *func_annotations; |
1986 | PyObject *func_is_coroutine; |
1987 | } __pyx_CyFunctionObject; |
1988 | #if !CYTHON_USE_MODULE_STATE |
1989 | static PyTypeObject *__pyx_CyFunctionType = 0; |
1990 | #endif |
1991 | #define __Pyx_CyFunction_Check(obj) __Pyx_TypeCheck(obj, __pyx_CyFunctionType) |
1992 | #define __Pyx_IsCyOrPyCFunction(obj) __Pyx_TypeCheck2(obj, __pyx_CyFunctionType, &PyCFunction_Type) |
1993 | #define __Pyx_CyFunction_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_CyFunctionType) |
1994 | static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml, |
1995 | int flags, PyObject* qualname, |
1996 | PyObject *closure, |
1997 | PyObject *module, PyObject *globals, |
1998 | PyObject* code); |
1999 | static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj); |
2000 | static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m, |
2001 | size_t size, |
2002 | int pyobjects); |
2003 | static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m, |
2004 | PyObject *tuple); |
2005 | static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m, |
2006 | PyObject *dict); |
2007 | static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, |
2008 | PyObject *dict); |
2009 | static int __pyx_CyFunction_init(PyObject *module); |
2010 | #if CYTHON_METH_FASTCALL |
2011 | static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); |
2012 | static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); |
2013 | static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); |
2014 | static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); |
2015 | #if CYTHON_BACKPORT_VECTORCALL |
2016 | #define __Pyx_CyFunction_func_vectorcall(f) (((__pyx_CyFunctionObject*)f)->func_vectorcall) |
2017 | #else |
2018 | #define __Pyx_CyFunction_func_vectorcall(f) (((PyCFunctionObject*)f)->vectorcall) |
2019 | #endif |
2020 | #endif |
2021 | |
2022 | /* CythonFunction.proto */ |
2023 | static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, |
2024 | int flags, PyObject* qualname, |
2025 | PyObject *closure, |
2026 | PyObject *module, PyObject *globals, |
2027 | PyObject* code); |
2028 | |
2029 | /* CLineInTraceback.proto */ |
2030 | #ifdef CYTHON_CLINE_IN_TRACEBACK |
2031 | #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) |
2032 | #else |
2033 | static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line); |
2034 | #endif |
2035 | |
2036 | /* CodeObjectCache.proto */ |
2037 | #if !CYTHON_COMPILING_IN_LIMITED_API |
2038 | typedef struct { |
2039 | PyCodeObject* code_object; |
2040 | int code_line; |
2041 | } __Pyx_CodeObjectCacheEntry; |
2042 | struct __Pyx_CodeObjectCache { |
2043 | int count; |
2044 | int max_count; |
2045 | __Pyx_CodeObjectCacheEntry* entries; |
2046 | }; |
2047 | static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; |
2048 | static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); |
2049 | static PyCodeObject *__pyx_find_code_object(int code_line); |
2050 | static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); |
2051 | #endif |
2052 | |
2053 | /* AddTraceback.proto */ |
2054 | static void __Pyx_AddTraceback(const char *funcname, int c_line, |
2055 | int py_line, const char *filename); |
2056 | |
2057 | /* BufferStructDeclare.proto */ |
2058 | typedef struct { |
2059 | Py_ssize_t shape, strides, suboffsets; |
2060 | } __Pyx_Buf_DimInfo; |
2061 | typedef struct { |
2062 | size_t refcount; |
2063 | Py_buffer pybuffer; |
2064 | } __Pyx_Buffer; |
2065 | typedef struct { |
2066 | __Pyx_Buffer *rcbuffer; |
2067 | char *data; |
2068 | __Pyx_Buf_DimInfo diminfo[8]; |
2069 | } __Pyx_LocalBuf_ND; |
2070 | |
2071 | #if PY_MAJOR_VERSION < 3 |
2072 | static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags); |
2073 | static void __Pyx_ReleaseBuffer(Py_buffer *view); |
2074 | #else |
2075 | #define __Pyx_GetBuffer PyObject_GetBuffer |
2076 | #define __Pyx_ReleaseBuffer PyBuffer_Release |
2077 | #endif |
2078 | |
2079 | |
2080 | /* GCCDiagnostics.proto */ |
2081 | #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) |
2082 | #define __Pyx_HAS_GCC_DIAGNOSTIC |
2083 | #endif |
2084 | |
2085 | /* RealImag.proto */ |
2086 | #if CYTHON_CCOMPLEX |
2087 | #ifdef __cplusplus |
2088 | #define __Pyx_CREAL(z) ((z).real()) |
2089 | #define __Pyx_CIMAG(z) ((z).imag()) |
2090 | #else |
2091 | #define __Pyx_CREAL(z) (__real__(z)) |
2092 | #define __Pyx_CIMAG(z) (__imag__(z)) |
2093 | #endif |
2094 | #else |
2095 | #define __Pyx_CREAL(z) ((z).real) |
2096 | #define __Pyx_CIMAG(z) ((z).imag) |
2097 | #endif |
2098 | #if defined(__cplusplus) && CYTHON_CCOMPLEX\ |
2099 | && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103) |
2100 | #define __Pyx_SET_CREAL(z,x) ((z).real(x)) |
2101 | #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) |
2102 | #else |
2103 | #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) |
2104 | #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) |
2105 | #endif |
2106 | |
2107 | /* Arithmetic.proto */ |
2108 | #if CYTHON_CCOMPLEX |
2109 | #define __Pyx_c_eq_float(a, b) ((a)==(b)) |
2110 | #define __Pyx_c_sum_float(a, b) ((a)+(b)) |
2111 | #define __Pyx_c_diff_float(a, b) ((a)-(b)) |
2112 | #define __Pyx_c_prod_float(a, b) ((a)*(b)) |
2113 | #define __Pyx_c_quot_float(a, b) ((a)/(b)) |
2114 | #define __Pyx_c_neg_float(a) (-(a)) |
2115 | #ifdef __cplusplus |
2116 | #define __Pyx_c_is_zero_float(z) ((z)==(float)0) |
2117 | #define __Pyx_c_conj_float(z) (::std::conj(z)) |
2118 | #if 1 |
2119 | #define __Pyx_c_abs_float(z) (::std::abs(z)) |
2120 | #define __Pyx_c_pow_float(a, b) (::std::pow(a, b)) |
2121 | #endif |
2122 | #else |
2123 | #define __Pyx_c_is_zero_float(z) ((z)==0) |
2124 | #define __Pyx_c_conj_float(z) (conjf(z)) |
2125 | #if 1 |
2126 | #define __Pyx_c_abs_float(z) (cabsf(z)) |
2127 | #define __Pyx_c_pow_float(a, b) (cpowf(a, b)) |
2128 | #endif |
2129 | #endif |
2130 | #else |
2131 | static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex); |
2132 | static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex); |
2133 | static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex); |
2134 | static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex); |
2135 | static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex); |
2136 | static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex); |
2137 | static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex); |
2138 | static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex); |
2139 | #if 1 |
2140 | static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex); |
2141 | static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex); |
2142 | #endif |
2143 | #endif |
2144 | |
2145 | /* Arithmetic.proto */ |
2146 | #if CYTHON_CCOMPLEX |
2147 | #define __Pyx_c_eq_double(a, b) ((a)==(b)) |
2148 | #define __Pyx_c_sum_double(a, b) ((a)+(b)) |
2149 | #define __Pyx_c_diff_double(a, b) ((a)-(b)) |
2150 | #define __Pyx_c_prod_double(a, b) ((a)*(b)) |
2151 | #define __Pyx_c_quot_double(a, b) ((a)/(b)) |
2152 | #define __Pyx_c_neg_double(a) (-(a)) |
2153 | #ifdef __cplusplus |
2154 | #define __Pyx_c_is_zero_double(z) ((z)==(double)0) |
2155 | #define __Pyx_c_conj_double(z) (::std::conj(z)) |
2156 | #if 1 |
2157 | #define __Pyx_c_abs_double(z) (::std::abs(z)) |
2158 | #define __Pyx_c_pow_double(a, b) (::std::pow(a, b)) |
2159 | #endif |
2160 | #else |
2161 | #define __Pyx_c_is_zero_double(z) ((z)==0) |
2162 | #define __Pyx_c_conj_double(z) (conj(z)) |
2163 | #if 1 |
2164 | #define __Pyx_c_abs_double(z) (cabs(z)) |
2165 | #define __Pyx_c_pow_double(a, b) (cpow(a, b)) |
2166 | #endif |
2167 | #endif |
2168 | #else |
2169 | static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex); |
2170 | static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex); |
2171 | static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex); |
2172 | static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex); |
2173 | static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex); |
2174 | static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex); |
2175 | static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex); |
2176 | static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex); |
2177 | #if 1 |
2178 | static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex); |
2179 | static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex); |
2180 | #endif |
2181 | #endif |
2182 | |
2183 | /* CIntToPy.proto */ |
2184 | static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); |
2185 | |
2186 | /* CIntFromPy.proto */ |
2187 | static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); |
2188 | |
2189 | /* CIntToPy.proto */ |
2190 | static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_uint16(npy_uint16 value); |
2191 | |
2192 | /* CIntToPy.proto */ |
2193 | static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_int32(npy_int32 value); |
2194 | |
2195 | /* CIntToPy.proto */ |
2196 | static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_uint32(npy_uint32 value); |
2197 | |
2198 | /* CIntToPy.proto */ |
2199 | static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_int64(npy_int64 value); |
2200 | |
2201 | /* CIntToPy.proto */ |
2202 | static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_uint64(npy_uint64 value); |
2203 | |
2204 | /* CIntToPy.proto */ |
2205 | static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_uint8(npy_uint8 value); |
2206 | |
2207 | /* CIntToPy.proto */ |
2208 | static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_int16(npy_int16 value); |
2209 | |
2210 | /* CIntToPy.proto */ |
2211 | static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_int8(npy_int8 value); |
2212 | |
2213 | /* FormatTypeName.proto */ |
2214 | #if CYTHON_COMPILING_IN_LIMITED_API |
2215 | typedef PyObject *__Pyx_TypeName; |
2216 | #define __Pyx_FMT_TYPENAME "%U" |
2217 | static __Pyx_TypeName __Pyx_PyType_GetName(PyTypeObject* tp); |
2218 | #define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj) |
2219 | #else |
2220 | typedef const char *__Pyx_TypeName; |
2221 | #define __Pyx_FMT_TYPENAME "%.200s" |
2222 | #define __Pyx_PyType_GetName(tp) ((tp)->tp_name) |
2223 | #define __Pyx_DECREF_TypeName(obj) |
2224 | #endif |
2225 | |
2226 | /* CIntFromPy.proto */ |
2227 | static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); |
2228 | |
2229 | /* FastTypeChecks.proto */ |
2230 | #if CYTHON_COMPILING_IN_CPYTHON |
2231 | #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) |
2232 | #define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2) |
2233 | static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b); |
2234 | static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b); |
2235 | static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type); |
2236 | static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2); |
2237 | #else |
2238 | #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) |
2239 | #define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2)) |
2240 | #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) |
2241 | #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2)) |
2242 | #endif |
2243 | #define __Pyx_PyErr_ExceptionMatches2(err1, err2) __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_Occurred(), err1, err2) |
2244 | #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) |
2245 | |
2246 | /* CheckBinaryVersion.proto */ |
2247 | static int __Pyx_check_binary_version(void); |
2248 | |
2249 | /* InitStrings.proto */ |
2250 | #if CYTHON_COMPILING_IN_LIMITED_API |
2251 | static int __Pyx_InitString(__Pyx_StringTabEntry t, PyObject **str); |
2252 | #else |
2253 | static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); |
2254 | #endif |
2255 | |
2256 | /* #### Code section: module_declarations ### */ |
2257 | static CYTHON_INLINE PyObject *__pyx_f_5numpy_7ndarray_4base_base(PyArrayObject *__pyx_v_self); /* proto*/ |
2258 | static CYTHON_INLINE PyArray_Descr *__pyx_f_5numpy_7ndarray_5descr_descr(PyArrayObject *__pyx_v_self); /* proto*/ |
2259 | static CYTHON_INLINE int __pyx_f_5numpy_7ndarray_4ndim_ndim(PyArrayObject *__pyx_v_self); /* proto*/ |
2260 | static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_5shape_shape(PyArrayObject *__pyx_v_self); /* proto*/ |
2261 | static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_7strides_strides(PyArrayObject *__pyx_v_self); /* proto*/ |
2262 | static CYTHON_INLINE npy_intp __pyx_f_5numpy_7ndarray_4size_size(PyArrayObject *__pyx_v_self); /* proto*/ |
2263 | static CYTHON_INLINE char *__pyx_f_5numpy_7ndarray_4data_data(PyArrayObject *__pyx_v_self); /* proto*/ |
2264 | |
2265 | /* Module declarations from "libc.string" */ |
2266 | #if !CYTHON_USE_MODULE_STATE |
2267 | #endif |
2268 | |
2269 | /* Module declarations from "libc.stdio" */ |
2270 | #if !CYTHON_USE_MODULE_STATE |
2271 | #endif |
2272 | |
2273 | /* Module declarations from "__builtin__" */ |
2274 | #if !CYTHON_USE_MODULE_STATE |
2275 | #endif |
2276 | |
2277 | /* Module declarations from "cpython.type" */ |
2278 | #if !CYTHON_USE_MODULE_STATE |
2279 | static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; |
2280 | #endif |
2281 | |
2282 | /* Module declarations from "cpython" */ |
2283 | #if !CYTHON_USE_MODULE_STATE |
2284 | #endif |
2285 | |
2286 | /* Module declarations from "cpython.object" */ |
2287 | #if !CYTHON_USE_MODULE_STATE |
2288 | #endif |
2289 | |
2290 | /* Module declarations from "cpython.ref" */ |
2291 | #if !CYTHON_USE_MODULE_STATE |
2292 | #endif |
2293 | |
2294 | /* Module declarations from "numpy" */ |
2295 | #if !CYTHON_USE_MODULE_STATE |
2296 | #endif |
2297 | |
2298 | /* Module declarations from "numpy" */ |
2299 | #if !CYTHON_USE_MODULE_STATE |
2300 | static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; |
2301 | static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; |
2302 | static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; |
2303 | static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; |
2304 | static PyTypeObject *__pyx_ptype_5numpy_generic = 0; |
2305 | static PyTypeObject *__pyx_ptype_5numpy_number = 0; |
2306 | static PyTypeObject *__pyx_ptype_5numpy_integer = 0; |
2307 | static PyTypeObject *__pyx_ptype_5numpy_signedinteger = 0; |
2308 | static PyTypeObject *__pyx_ptype_5numpy_unsignedinteger = 0; |
2309 | static PyTypeObject *__pyx_ptype_5numpy_inexact = 0; |
2310 | static PyTypeObject *__pyx_ptype_5numpy_floating = 0; |
2311 | static PyTypeObject *__pyx_ptype_5numpy_complexfloating = 0; |
2312 | static PyTypeObject *__pyx_ptype_5numpy_flexible = 0; |
2313 | static PyTypeObject *__pyx_ptype_5numpy_character = 0; |
2314 | static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; |
2315 | #endif |
2316 | |
2317 | /* Module declarations from "tensorflow.python.framework.fast_tensor_util" */ |
2318 | #if !CYTHON_USE_MODULE_STATE |
2319 | #endif |
2320 | /* #### Code section: typeinfo ### */ |
2321 | static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_uint16_t = { "uint16_t" , NULL, sizeof(__pyx_t_5numpy_uint16_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_5numpy_uint16_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_5numpy_uint16_t), 0 }; |
2322 | 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 }; |
2323 | static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t = { "float64_t" , NULL, sizeof(__pyx_t_5numpy_float64_t), { 0 }, 0, 'R', 0, 0 }; |
2324 | 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 }; |
2325 | static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_uint32_t = { "uint32_t" , NULL, sizeof(__pyx_t_5numpy_uint32_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_5numpy_uint32_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_5numpy_uint32_t), 0 }; |
2326 | static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t = { "int64_t" , NULL, sizeof(__pyx_t_5numpy_int64_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_5numpy_int64_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_5numpy_int64_t), 0 }; |
2327 | static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t = { "uint64_t" , NULL, sizeof(__pyx_t_5numpy_uint64_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_5numpy_uint64_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_5numpy_uint64_t), 0 }; |
2328 | static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t = { "uint8_t" , NULL, sizeof(__pyx_t_5numpy_uint8_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_5numpy_uint8_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_5numpy_uint8_t), 0 }; |
2329 | static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int16_t = { "int16_t" , NULL, sizeof(__pyx_t_5numpy_int16_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_5numpy_int16_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_5numpy_int16_t), 0 }; |
2330 | static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t = { "int8_t" , NULL, sizeof(__pyx_t_5numpy_int8_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_5numpy_int8_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_5numpy_int8_t), 0 }; |
2331 | static __Pyx_TypeInfo __Pyx_TypeInfo___pyx_t_float_complex = { "float complex" , NULL, sizeof(__pyx_t_float_complex), { 0 }, 0, 'C', 0, 0 }; |
2332 | static __Pyx_TypeInfo __Pyx_TypeInfo___pyx_t_double_complex = { "double complex" , NULL, sizeof(__pyx_t_double_complex), { 0 }, 0, 'C', 0, 0 }; |
2333 | /* #### Code section: before_global_var ### */ |
2334 | #define __Pyx_MODULE_NAME "tensorflow.python.framework.fast_tensor_util" |
2335 | extern int __pyx_module_is_main_tensorflow__python__framework__fast_tensor_util; |
2336 | int __pyx_module_is_main_tensorflow__python__framework__fast_tensor_util = 0; |
2337 | |
2338 | /* Implementation of "tensorflow.python.framework.fast_tensor_util" */ |
2339 | /* #### Code section: global_var ### */ |
2340 | static PyObject *__pyx_builtin_range; |
2341 | static PyObject *__pyx_builtin_ImportError; |
2342 | /* #### Code section: string_decls ### */ |
2343 | static const char __pyx_k_i[] = "i" ; |
2344 | static const char __pyx_k_n[] = "n" ; |
2345 | static const char __pyx_k__3[] = "*" ; |
2346 | static const char __pyx_k__4[] = "." ; |
2347 | static const char __pyx_k_np[] = "np" ; |
2348 | static const char __pyx_k__22[] = "?" ; |
2349 | static const char __pyx_k_item[] = "item" ; |
2350 | static const char __pyx_k_main[] = "__main__" ; |
2351 | static const char __pyx_k_name[] = "__name__" ; |
2352 | static const char __pyx_k_size[] = "size" ; |
2353 | static const char __pyx_k_spec[] = "__spec__" ; |
2354 | static const char __pyx_k_test[] = "__test__" ; |
2355 | static const char __pyx_k_numpy[] = "numpy" ; |
2356 | static const char __pyx_k_range[] = "range" ; |
2357 | static const char __pyx_k_append[] = "append" ; |
2358 | static const char __pyx_k_compat[] = "compat" ; |
2359 | static const char __pyx_k_import[] = "__import__" ; |
2360 | static const char __pyx_k_int_val[] = "int_val" ; |
2361 | static const char __pyx_k_nparray[] = "nparray" ; |
2362 | static const char __pyx_k_as_bytes[] = "as_bytes" ; |
2363 | static const char __pyx_k_bool_val[] = "bool_val" ; |
2364 | static const char __pyx_k_half_val[] = "half_val" ; |
2365 | static const char __pyx_k_float_val[] = "float_val" ; |
2366 | static const char __pyx_k_int64_val[] = "int64_val" ; |
2367 | static const char __pyx_k_double_val[] = "double_val" ; |
2368 | static const char __pyx_k_string_val[] = "string_val" ; |
2369 | static const char __pyx_k_uint32_val[] = "uint32_val" ; |
2370 | static const char __pyx_k_uint64_val[] = "uint64_val" ; |
2371 | static const char __pyx_k_ImportError[] = "ImportError" ; |
2372 | static const char __pyx_k_dcomplex_val[] = "dcomplex_val" ; |
2373 | static const char __pyx_k_initializing[] = "_initializing" ; |
2374 | static const char __pyx_k_is_coroutine[] = "_is_coroutine" ; |
2375 | static const char __pyx_k_scomplex_val[] = "scomplex_val" ; |
2376 | static const char __pyx_k_tensor_proto[] = "tensor_proto" ; |
2377 | static const char __pyx_k_asyncio_coroutines[] = "asyncio.coroutines" ; |
2378 | static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback" ; |
2379 | static const char __pyx_k_tensorflow_python_util[] = "tensorflow.python.util" ; |
2380 | static const char __pyx_k_AppendBoolArrayToTensorProto[] = "AppendBoolArrayToTensorProto" ; |
2381 | static const char __pyx_k_AppendInt8ArrayToTensorProto[] = "AppendInt8ArrayToTensorProto" ; |
2382 | static const char __pyx_k_AppendInt16ArrayToTensorProto[] = "AppendInt16ArrayToTensorProto" ; |
2383 | static const char __pyx_k_AppendInt32ArrayToTensorProto[] = "AppendInt32ArrayToTensorProto" ; |
2384 | static const char __pyx_k_AppendInt64ArrayToTensorProto[] = "AppendInt64ArrayToTensorProto" ; |
2385 | static const char __pyx_k_AppendUInt8ArrayToTensorProto[] = "AppendUInt8ArrayToTensorProto" ; |
2386 | static const char __pyx_k_AppendObjectArrayToTensorProto[] = "AppendObjectArrayToTensorProto" ; |
2387 | static const char __pyx_k_AppendUInt16ArrayToTensorProto[] = "AppendUInt16ArrayToTensorProto" ; |
2388 | static const char __pyx_k_AppendUInt32ArrayToTensorProto[] = "AppendUInt32ArrayToTensorProto" ; |
2389 | static const char __pyx_k_AppendUInt64ArrayToTensorProto[] = "AppendUInt64ArrayToTensorProto" ; |
2390 | static const char __pyx_k_AppendFloat16ArrayToTensorProto[] = "AppendFloat16ArrayToTensorProto" ; |
2391 | static const char __pyx_k_AppendFloat32ArrayToTensorProto[] = "AppendFloat32ArrayToTensorProto" ; |
2392 | static const char __pyx_k_AppendFloat64ArrayToTensorProto[] = "AppendFloat64ArrayToTensorProto" ; |
2393 | static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import" ; |
2394 | static const char __pyx_k_AppendBFloat16ArrayToTensorProto[] = "AppendBFloat16ArrayToTensorProto" ; |
2395 | static const char __pyx_k_AppendComplex128ArrayToTensorPro[] = "AppendComplex128ArrayToTensorProto" ; |
2396 | static const char __pyx_k_AppendComplex64ArrayToTensorProt[] = "AppendComplex64ArrayToTensorProto" ; |
2397 | static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import" ; |
2398 | static const char __pyx_k_tensorflow_python_framework_fast[] = "tensorflow/python/framework/fast_tensor_util.pyx" ; |
2399 | static const char __pyx_k_tensorflow_python_framework_fast_2[] = "tensorflow.python.framework.fast_tensor_util" ; |
2400 | #if !CYTHON_USE_MODULE_STATE |
2401 | static PyObject *__pyx_n_s_AppendBFloat16ArrayToTensorProto; |
2402 | static PyObject *__pyx_n_s_AppendBoolArrayToTensorProto; |
2403 | static PyObject *__pyx_n_s_AppendComplex128ArrayToTensorPro; |
2404 | static PyObject *__pyx_n_s_AppendComplex64ArrayToTensorProt; |
2405 | static PyObject *__pyx_n_s_AppendFloat16ArrayToTensorProto; |
2406 | static PyObject *__pyx_n_s_AppendFloat32ArrayToTensorProto; |
2407 | static PyObject *__pyx_n_s_AppendFloat64ArrayToTensorProto; |
2408 | static PyObject *__pyx_n_s_AppendInt16ArrayToTensorProto; |
2409 | static PyObject *__pyx_n_s_AppendInt32ArrayToTensorProto; |
2410 | static PyObject *__pyx_n_s_AppendInt64ArrayToTensorProto; |
2411 | static PyObject *__pyx_n_s_AppendInt8ArrayToTensorProto; |
2412 | static PyObject *__pyx_n_s_AppendObjectArrayToTensorProto; |
2413 | static PyObject *__pyx_n_s_AppendUInt16ArrayToTensorProto; |
2414 | static PyObject *__pyx_n_s_AppendUInt32ArrayToTensorProto; |
2415 | static PyObject *__pyx_n_s_AppendUInt64ArrayToTensorProto; |
2416 | static PyObject *__pyx_n_s_AppendUInt8ArrayToTensorProto; |
2417 | static PyObject *__pyx_n_s_ImportError; |
2418 | static PyObject *__pyx_n_s__22; |
2419 | static PyObject *__pyx_n_s__3; |
2420 | static PyObject *__pyx_kp_u__4; |
2421 | static PyObject *__pyx_n_s_append; |
2422 | static PyObject *__pyx_n_s_as_bytes; |
2423 | static PyObject *__pyx_n_s_asyncio_coroutines; |
2424 | static PyObject *__pyx_n_s_bool_val; |
2425 | static PyObject *__pyx_n_s_cline_in_traceback; |
2426 | static PyObject *__pyx_n_s_compat; |
2427 | static PyObject *__pyx_n_s_dcomplex_val; |
2428 | static PyObject *__pyx_n_s_double_val; |
2429 | static PyObject *__pyx_n_s_float_val; |
2430 | static PyObject *__pyx_n_s_half_val; |
2431 | static PyObject *__pyx_n_s_i; |
2432 | static PyObject *__pyx_n_s_import; |
2433 | static PyObject *__pyx_n_s_initializing; |
2434 | static PyObject *__pyx_n_s_int64_val; |
2435 | static PyObject *__pyx_n_s_int_val; |
2436 | static PyObject *__pyx_n_s_is_coroutine; |
2437 | static PyObject *__pyx_n_s_item; |
2438 | static PyObject *__pyx_n_s_main; |
2439 | static PyObject *__pyx_n_s_n; |
2440 | static PyObject *__pyx_n_s_name; |
2441 | static PyObject *__pyx_n_s_np; |
2442 | static PyObject *__pyx_n_s_nparray; |
2443 | static PyObject *__pyx_n_s_numpy; |
2444 | static PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to; |
2445 | static PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor; |
2446 | static PyObject *__pyx_n_s_range; |
2447 | static PyObject *__pyx_n_s_scomplex_val; |
2448 | static PyObject *__pyx_n_s_size; |
2449 | static PyObject *__pyx_n_s_spec; |
2450 | static PyObject *__pyx_n_s_string_val; |
2451 | static PyObject *__pyx_n_s_tensor_proto; |
2452 | static PyObject *__pyx_kp_s_tensorflow_python_framework_fast; |
2453 | static PyObject *__pyx_n_s_tensorflow_python_framework_fast_2; |
2454 | static PyObject *__pyx_n_s_tensorflow_python_util; |
2455 | static PyObject *__pyx_n_s_test; |
2456 | static PyObject *__pyx_n_s_uint32_val; |
2457 | static PyObject *__pyx_n_s_uint64_val; |
2458 | #endif |
2459 | /* #### Code section: decls ### */ |
2460 | static PyObject *__pyx_pf_10tensorflow_6python_9framework_16fast_tensor_util_AppendBFloat16ArrayToTensorProto(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tensor_proto, PyArrayObject *__pyx_v_nparray); /* proto */ |
2461 | static PyObject *__pyx_pf_10tensorflow_6python_9framework_16fast_tensor_util_2AppendFloat16ArrayToTensorProto(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tensor_proto, PyArrayObject *__pyx_v_nparray); /* proto */ |
2462 | static PyObject *__pyx_pf_10tensorflow_6python_9framework_16fast_tensor_util_4AppendFloat32ArrayToTensorProto(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tensor_proto, PyArrayObject *__pyx_v_nparray); /* proto */ |
2463 | static PyObject *__pyx_pf_10tensorflow_6python_9framework_16fast_tensor_util_6AppendFloat64ArrayToTensorProto(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tensor_proto, PyArrayObject *__pyx_v_nparray); /* proto */ |
2464 | static PyObject *__pyx_pf_10tensorflow_6python_9framework_16fast_tensor_util_8AppendInt32ArrayToTensorProto(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tensor_proto, PyArrayObject *__pyx_v_nparray); /* proto */ |
2465 | static PyObject *__pyx_pf_10tensorflow_6python_9framework_16fast_tensor_util_10AppendUInt32ArrayToTensorProto(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tensor_proto, PyArrayObject *__pyx_v_nparray); /* proto */ |
2466 | static PyObject *__pyx_pf_10tensorflow_6python_9framework_16fast_tensor_util_12AppendInt64ArrayToTensorProto(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tensor_proto, PyArrayObject *__pyx_v_nparray); /* proto */ |
2467 | static PyObject *__pyx_pf_10tensorflow_6python_9framework_16fast_tensor_util_14AppendUInt64ArrayToTensorProto(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tensor_proto, PyArrayObject *__pyx_v_nparray); /* proto */ |
2468 | static PyObject *__pyx_pf_10tensorflow_6python_9framework_16fast_tensor_util_16AppendUInt8ArrayToTensorProto(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tensor_proto, PyArrayObject *__pyx_v_nparray); /* proto */ |
2469 | static PyObject *__pyx_pf_10tensorflow_6python_9framework_16fast_tensor_util_18AppendUInt16ArrayToTensorProto(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tensor_proto, PyArrayObject *__pyx_v_nparray); /* proto */ |
2470 | static PyObject *__pyx_pf_10tensorflow_6python_9framework_16fast_tensor_util_20AppendInt16ArrayToTensorProto(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tensor_proto, PyArrayObject *__pyx_v_nparray); /* proto */ |
2471 | static PyObject *__pyx_pf_10tensorflow_6python_9framework_16fast_tensor_util_22AppendInt8ArrayToTensorProto(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tensor_proto, PyArrayObject *__pyx_v_nparray); /* proto */ |
2472 | static PyObject *__pyx_pf_10tensorflow_6python_9framework_16fast_tensor_util_24AppendComplex64ArrayToTensorProto(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tensor_proto, PyArrayObject *__pyx_v_nparray); /* proto */ |
2473 | static PyObject *__pyx_pf_10tensorflow_6python_9framework_16fast_tensor_util_26AppendComplex128ArrayToTensorProto(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tensor_proto, PyArrayObject *__pyx_v_nparray); /* proto */ |
2474 | static PyObject *__pyx_pf_10tensorflow_6python_9framework_16fast_tensor_util_28AppendObjectArrayToTensorProto(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tensor_proto, PyArrayObject *__pyx_v_nparray); /* proto */ |
2475 | static PyObject *__pyx_pf_10tensorflow_6python_9framework_16fast_tensor_util_30AppendBoolArrayToTensorProto(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tensor_proto, PyObject *__pyx_v_nparray); /* proto */ |
2476 | #if !CYTHON_USE_MODULE_STATE |
2477 | #endif |
2478 | #if !CYTHON_USE_MODULE_STATE |
2479 | static PyObject *__pyx_tuple_; |
2480 | static PyObject *__pyx_tuple__2; |
2481 | static PyObject *__pyx_tuple__5; |
2482 | static PyObject *__pyx_codeobj__6; |
2483 | static PyObject *__pyx_codeobj__7; |
2484 | static PyObject *__pyx_codeobj__8; |
2485 | static PyObject *__pyx_codeobj__9; |
2486 | static PyObject *__pyx_codeobj__10; |
2487 | static PyObject *__pyx_codeobj__11; |
2488 | static PyObject *__pyx_codeobj__12; |
2489 | static PyObject *__pyx_codeobj__13; |
2490 | static PyObject *__pyx_codeobj__14; |
2491 | static PyObject *__pyx_codeobj__15; |
2492 | static PyObject *__pyx_codeobj__16; |
2493 | static PyObject *__pyx_codeobj__17; |
2494 | static PyObject *__pyx_codeobj__18; |
2495 | static PyObject *__pyx_codeobj__19; |
2496 | static PyObject *__pyx_codeobj__20; |
2497 | static PyObject *__pyx_codeobj__21; |
2498 | #endif |
2499 | /* #### Code section: late_includes ### */ |
2500 | /* #### Code section: module_state ### */ |
2501 | #if CYTHON_USE_MODULE_STATE |
2502 | typedef struct { |
2503 | PyObject *__pyx_d; |
2504 | PyObject *__pyx_b; |
2505 | PyObject *__pyx_cython_runtime; |
2506 | PyObject *__pyx_empty_tuple; |
2507 | PyObject *__pyx_empty_bytes; |
2508 | PyObject *__pyx_empty_unicode; |
2509 | #ifdef __Pyx_CyFunction_USED |
2510 | PyTypeObject *__pyx_CyFunctionType; |
2511 | #endif |
2512 | #ifdef __Pyx_FusedFunction_USED |
2513 | PyTypeObject *__pyx_FusedFunctionType; |
2514 | #endif |
2515 | PyTypeObject *__pyx_ptype_7cpython_4type_type; |
2516 | PyTypeObject *__pyx_ptype_5numpy_dtype; |
2517 | PyTypeObject *__pyx_ptype_5numpy_flatiter; |
2518 | PyTypeObject *__pyx_ptype_5numpy_broadcast; |
2519 | PyTypeObject *__pyx_ptype_5numpy_ndarray; |
2520 | PyTypeObject *__pyx_ptype_5numpy_generic; |
2521 | PyTypeObject *__pyx_ptype_5numpy_number; |
2522 | PyTypeObject *__pyx_ptype_5numpy_integer; |
2523 | PyTypeObject *__pyx_ptype_5numpy_signedinteger; |
2524 | PyTypeObject *__pyx_ptype_5numpy_unsignedinteger; |
2525 | PyTypeObject *__pyx_ptype_5numpy_inexact; |
2526 | PyTypeObject *__pyx_ptype_5numpy_floating; |
2527 | PyTypeObject *__pyx_ptype_5numpy_complexfloating; |
2528 | PyTypeObject *__pyx_ptype_5numpy_flexible; |
2529 | PyTypeObject *__pyx_ptype_5numpy_character; |
2530 | PyTypeObject *__pyx_ptype_5numpy_ufunc; |
2531 | PyObject *__pyx_n_s_AppendBFloat16ArrayToTensorProto; |
2532 | PyObject *__pyx_n_s_AppendBoolArrayToTensorProto; |
2533 | PyObject *__pyx_n_s_AppendComplex128ArrayToTensorPro; |
2534 | PyObject *__pyx_n_s_AppendComplex64ArrayToTensorProt; |
2535 | PyObject *__pyx_n_s_AppendFloat16ArrayToTensorProto; |
2536 | PyObject *__pyx_n_s_AppendFloat32ArrayToTensorProto; |
2537 | PyObject *__pyx_n_s_AppendFloat64ArrayToTensorProto; |
2538 | PyObject *__pyx_n_s_AppendInt16ArrayToTensorProto; |
2539 | PyObject *__pyx_n_s_AppendInt32ArrayToTensorProto; |
2540 | PyObject *__pyx_n_s_AppendInt64ArrayToTensorProto; |
2541 | PyObject *__pyx_n_s_AppendInt8ArrayToTensorProto; |
2542 | PyObject *__pyx_n_s_AppendObjectArrayToTensorProto; |
2543 | PyObject *__pyx_n_s_AppendUInt16ArrayToTensorProto; |
2544 | PyObject *__pyx_n_s_AppendUInt32ArrayToTensorProto; |
2545 | PyObject *__pyx_n_s_AppendUInt64ArrayToTensorProto; |
2546 | PyObject *__pyx_n_s_AppendUInt8ArrayToTensorProto; |
2547 | PyObject *__pyx_n_s_ImportError; |
2548 | PyObject *__pyx_n_s__22; |
2549 | PyObject *__pyx_n_s__3; |
2550 | PyObject *__pyx_kp_u__4; |
2551 | PyObject *__pyx_n_s_append; |
2552 | PyObject *__pyx_n_s_as_bytes; |
2553 | PyObject *__pyx_n_s_asyncio_coroutines; |
2554 | PyObject *__pyx_n_s_bool_val; |
2555 | PyObject *__pyx_n_s_cline_in_traceback; |
2556 | PyObject *__pyx_n_s_compat; |
2557 | PyObject *__pyx_n_s_dcomplex_val; |
2558 | PyObject *__pyx_n_s_double_val; |
2559 | PyObject *__pyx_n_s_float_val; |
2560 | PyObject *__pyx_n_s_half_val; |
2561 | PyObject *__pyx_n_s_i; |
2562 | PyObject *__pyx_n_s_import; |
2563 | PyObject *__pyx_n_s_initializing; |
2564 | PyObject *__pyx_n_s_int64_val; |
2565 | PyObject *__pyx_n_s_int_val; |
2566 | PyObject *__pyx_n_s_is_coroutine; |
2567 | PyObject *__pyx_n_s_item; |
2568 | PyObject *__pyx_n_s_main; |
2569 | PyObject *__pyx_n_s_n; |
2570 | PyObject *__pyx_n_s_name; |
2571 | PyObject *__pyx_n_s_np; |
2572 | PyObject *__pyx_n_s_nparray; |
2573 | PyObject *__pyx_n_s_numpy; |
2574 | PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to; |
2575 | PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor; |
2576 | PyObject *__pyx_n_s_range; |
2577 | PyObject *__pyx_n_s_scomplex_val; |
2578 | PyObject *__pyx_n_s_size; |
2579 | PyObject *__pyx_n_s_spec; |
2580 | PyObject *__pyx_n_s_string_val; |
2581 | PyObject *__pyx_n_s_tensor_proto; |
2582 | PyObject *__pyx_kp_s_tensorflow_python_framework_fast; |
2583 | PyObject *__pyx_n_s_tensorflow_python_framework_fast_2; |
2584 | PyObject *__pyx_n_s_tensorflow_python_util; |
2585 | PyObject *__pyx_n_s_test; |
2586 | PyObject *__pyx_n_s_uint32_val; |
2587 | PyObject *__pyx_n_s_uint64_val; |
2588 | PyObject *__pyx_tuple_; |
2589 | PyObject *__pyx_tuple__2; |
2590 | PyObject *__pyx_tuple__5; |
2591 | PyObject *__pyx_codeobj__6; |
2592 | PyObject *__pyx_codeobj__7; |
2593 | PyObject *__pyx_codeobj__8; |
2594 | PyObject *__pyx_codeobj__9; |
2595 | PyObject *__pyx_codeobj__10; |
2596 | PyObject *__pyx_codeobj__11; |
2597 | PyObject *__pyx_codeobj__12; |
2598 | PyObject *__pyx_codeobj__13; |
2599 | PyObject *__pyx_codeobj__14; |
2600 | PyObject *__pyx_codeobj__15; |
2601 | PyObject *__pyx_codeobj__16; |
2602 | PyObject *__pyx_codeobj__17; |
2603 | PyObject *__pyx_codeobj__18; |
2604 | PyObject *__pyx_codeobj__19; |
2605 | PyObject *__pyx_codeobj__20; |
2606 | PyObject *__pyx_codeobj__21; |
2607 | } __pyx_mstate; |
2608 | |
2609 | #ifdef __cplusplus |
2610 | namespace { |
2611 | extern struct PyModuleDef __pyx_moduledef; |
2612 | } /* anonymous namespace */ |
2613 | #else |
2614 | static struct PyModuleDef __pyx_moduledef; |
2615 | #endif |
2616 | |
2617 | #define __pyx_mstate(o) ((__pyx_mstate *)__Pyx_PyModule_GetState(o)) |
2618 | |
2619 | #define __pyx_mstate_global (__pyx_mstate(PyState_FindModule(&__pyx_moduledef))) |
2620 | |
2621 | #define __pyx_m (PyState_FindModule(&__pyx_moduledef)) |
2622 | #endif |
2623 | /* #### Code section: module_state_clear ### */ |
2624 | #if CYTHON_USE_MODULE_STATE |
2625 | static int __pyx_m_clear(PyObject *m) { |
2626 | __pyx_mstate *clear_module_state = __pyx_mstate(m); |
2627 | if (!clear_module_state) return 0; |
2628 | Py_CLEAR(clear_module_state->__pyx_d); |
2629 | Py_CLEAR(clear_module_state->__pyx_b); |
2630 | Py_CLEAR(clear_module_state->__pyx_cython_runtime); |
2631 | Py_CLEAR(clear_module_state->__pyx_empty_tuple); |
2632 | Py_CLEAR(clear_module_state->__pyx_empty_bytes); |
2633 | Py_CLEAR(clear_module_state->__pyx_empty_unicode); |
2634 | #ifdef __Pyx_CyFunction_USED |
2635 | Py_CLEAR(clear_module_state->__pyx_CyFunctionType); |
2636 | #endif |
2637 | #ifdef __Pyx_FusedFunction_USED |
2638 | Py_CLEAR(clear_module_state->__pyx_FusedFunctionType); |
2639 | #endif |
2640 | Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_4type_type); |
2641 | Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_dtype); |
2642 | Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_flatiter); |
2643 | Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_broadcast); |
2644 | Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_ndarray); |
2645 | Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_generic); |
2646 | Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_number); |
2647 | Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_integer); |
2648 | Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_signedinteger); |
2649 | Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_unsignedinteger); |
2650 | Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_inexact); |
2651 | Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_floating); |
2652 | Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_complexfloating); |
2653 | Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_flexible); |
2654 | Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_character); |
2655 | Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_ufunc); |
2656 | Py_CLEAR(clear_module_state->__pyx_n_s_AppendBFloat16ArrayToTensorProto); |
2657 | Py_CLEAR(clear_module_state->__pyx_n_s_AppendBoolArrayToTensorProto); |
2658 | Py_CLEAR(clear_module_state->__pyx_n_s_AppendComplex128ArrayToTensorPro); |
2659 | Py_CLEAR(clear_module_state->__pyx_n_s_AppendComplex64ArrayToTensorProt); |
2660 | Py_CLEAR(clear_module_state->__pyx_n_s_AppendFloat16ArrayToTensorProto); |
2661 | Py_CLEAR(clear_module_state->__pyx_n_s_AppendFloat32ArrayToTensorProto); |
2662 | Py_CLEAR(clear_module_state->__pyx_n_s_AppendFloat64ArrayToTensorProto); |
2663 | Py_CLEAR(clear_module_state->__pyx_n_s_AppendInt16ArrayToTensorProto); |
2664 | Py_CLEAR(clear_module_state->__pyx_n_s_AppendInt32ArrayToTensorProto); |
2665 | Py_CLEAR(clear_module_state->__pyx_n_s_AppendInt64ArrayToTensorProto); |
2666 | Py_CLEAR(clear_module_state->__pyx_n_s_AppendInt8ArrayToTensorProto); |
2667 | Py_CLEAR(clear_module_state->__pyx_n_s_AppendObjectArrayToTensorProto); |
2668 | Py_CLEAR(clear_module_state->__pyx_n_s_AppendUInt16ArrayToTensorProto); |
2669 | Py_CLEAR(clear_module_state->__pyx_n_s_AppendUInt32ArrayToTensorProto); |
2670 | Py_CLEAR(clear_module_state->__pyx_n_s_AppendUInt64ArrayToTensorProto); |
2671 | Py_CLEAR(clear_module_state->__pyx_n_s_AppendUInt8ArrayToTensorProto); |
2672 | Py_CLEAR(clear_module_state->__pyx_n_s_ImportError); |
2673 | Py_CLEAR(clear_module_state->__pyx_n_s__22); |
2674 | Py_CLEAR(clear_module_state->__pyx_n_s__3); |
2675 | Py_CLEAR(clear_module_state->__pyx_kp_u__4); |
2676 | Py_CLEAR(clear_module_state->__pyx_n_s_append); |
2677 | Py_CLEAR(clear_module_state->__pyx_n_s_as_bytes); |
2678 | Py_CLEAR(clear_module_state->__pyx_n_s_asyncio_coroutines); |
2679 | Py_CLEAR(clear_module_state->__pyx_n_s_bool_val); |
2680 | Py_CLEAR(clear_module_state->__pyx_n_s_cline_in_traceback); |
2681 | Py_CLEAR(clear_module_state->__pyx_n_s_compat); |
2682 | Py_CLEAR(clear_module_state->__pyx_n_s_dcomplex_val); |
2683 | Py_CLEAR(clear_module_state->__pyx_n_s_double_val); |
2684 | Py_CLEAR(clear_module_state->__pyx_n_s_float_val); |
2685 | Py_CLEAR(clear_module_state->__pyx_n_s_half_val); |
2686 | Py_CLEAR(clear_module_state->__pyx_n_s_i); |
2687 | Py_CLEAR(clear_module_state->__pyx_n_s_import); |
2688 | Py_CLEAR(clear_module_state->__pyx_n_s_initializing); |
2689 | Py_CLEAR(clear_module_state->__pyx_n_s_int64_val); |
2690 | Py_CLEAR(clear_module_state->__pyx_n_s_int_val); |
2691 | Py_CLEAR(clear_module_state->__pyx_n_s_is_coroutine); |
2692 | Py_CLEAR(clear_module_state->__pyx_n_s_item); |
2693 | Py_CLEAR(clear_module_state->__pyx_n_s_main); |
2694 | Py_CLEAR(clear_module_state->__pyx_n_s_n); |
2695 | Py_CLEAR(clear_module_state->__pyx_n_s_name); |
2696 | Py_CLEAR(clear_module_state->__pyx_n_s_np); |
2697 | Py_CLEAR(clear_module_state->__pyx_n_s_nparray); |
2698 | Py_CLEAR(clear_module_state->__pyx_n_s_numpy); |
2699 | Py_CLEAR(clear_module_state->__pyx_kp_s_numpy_core_multiarray_failed_to); |
2700 | Py_CLEAR(clear_module_state->__pyx_kp_s_numpy_core_umath_failed_to_impor); |
2701 | Py_CLEAR(clear_module_state->__pyx_n_s_range); |
2702 | Py_CLEAR(clear_module_state->__pyx_n_s_scomplex_val); |
2703 | Py_CLEAR(clear_module_state->__pyx_n_s_size); |
2704 | Py_CLEAR(clear_module_state->__pyx_n_s_spec); |
2705 | Py_CLEAR(clear_module_state->__pyx_n_s_string_val); |
2706 | Py_CLEAR(clear_module_state->__pyx_n_s_tensor_proto); |
2707 | Py_CLEAR(clear_module_state->__pyx_kp_s_tensorflow_python_framework_fast); |
2708 | Py_CLEAR(clear_module_state->__pyx_n_s_tensorflow_python_framework_fast_2); |
2709 | Py_CLEAR(clear_module_state->__pyx_n_s_tensorflow_python_util); |
2710 | Py_CLEAR(clear_module_state->__pyx_n_s_test); |
2711 | Py_CLEAR(clear_module_state->__pyx_n_s_uint32_val); |
2712 | Py_CLEAR(clear_module_state->__pyx_n_s_uint64_val); |
2713 | Py_CLEAR(clear_module_state->__pyx_tuple_); |
2714 | Py_CLEAR(clear_module_state->__pyx_tuple__2); |
2715 | Py_CLEAR(clear_module_state->__pyx_tuple__5); |
2716 | Py_CLEAR(clear_module_state->__pyx_codeobj__6); |
2717 | Py_CLEAR(clear_module_state->__pyx_codeobj__7); |
2718 | Py_CLEAR(clear_module_state->__pyx_codeobj__8); |
2719 | Py_CLEAR(clear_module_state->__pyx_codeobj__9); |
2720 | Py_CLEAR(clear_module_state->__pyx_codeobj__10); |
2721 | Py_CLEAR(clear_module_state->__pyx_codeobj__11); |
2722 | Py_CLEAR(clear_module_state->__pyx_codeobj__12); |
2723 | Py_CLEAR(clear_module_state->__pyx_codeobj__13); |
2724 | Py_CLEAR(clear_module_state->__pyx_codeobj__14); |
2725 | Py_CLEAR(clear_module_state->__pyx_codeobj__15); |
2726 | Py_CLEAR(clear_module_state->__pyx_codeobj__16); |
2727 | Py_CLEAR(clear_module_state->__pyx_codeobj__17); |
2728 | Py_CLEAR(clear_module_state->__pyx_codeobj__18); |
2729 | Py_CLEAR(clear_module_state->__pyx_codeobj__19); |
2730 | Py_CLEAR(clear_module_state->__pyx_codeobj__20); |
2731 | Py_CLEAR(clear_module_state->__pyx_codeobj__21); |
2732 | return 0; |
2733 | } |
2734 | #endif |
2735 | /* #### Code section: module_state_traverse ### */ |
2736 | #if CYTHON_USE_MODULE_STATE |
2737 | static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { |
2738 | __pyx_mstate *traverse_module_state = __pyx_mstate(m); |
2739 | if (!traverse_module_state) return 0; |
2740 | Py_VISIT(traverse_module_state->__pyx_d); |
2741 | Py_VISIT(traverse_module_state->__pyx_b); |
2742 | Py_VISIT(traverse_module_state->__pyx_cython_runtime); |
2743 | Py_VISIT(traverse_module_state->__pyx_empty_tuple); |
2744 | Py_VISIT(traverse_module_state->__pyx_empty_bytes); |
2745 | Py_VISIT(traverse_module_state->__pyx_empty_unicode); |
2746 | #ifdef __Pyx_CyFunction_USED |
2747 | Py_VISIT(traverse_module_state->__pyx_CyFunctionType); |
2748 | #endif |
2749 | #ifdef __Pyx_FusedFunction_USED |
2750 | Py_VISIT(traverse_module_state->__pyx_FusedFunctionType); |
2751 | #endif |
2752 | Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_4type_type); |
2753 | Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_dtype); |
2754 | Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_flatiter); |
2755 | Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_broadcast); |
2756 | Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_ndarray); |
2757 | Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_generic); |
2758 | Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_number); |
2759 | Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_integer); |
2760 | Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_signedinteger); |
2761 | Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_unsignedinteger); |
2762 | Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_inexact); |
2763 | Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_floating); |
2764 | Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_complexfloating); |
2765 | Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_flexible); |
2766 | Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_character); |
2767 | Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_ufunc); |
2768 | Py_VISIT(traverse_module_state->__pyx_n_s_AppendBFloat16ArrayToTensorProto); |
2769 | Py_VISIT(traverse_module_state->__pyx_n_s_AppendBoolArrayToTensorProto); |
2770 | Py_VISIT(traverse_module_state->__pyx_n_s_AppendComplex128ArrayToTensorPro); |
2771 | Py_VISIT(traverse_module_state->__pyx_n_s_AppendComplex64ArrayToTensorProt); |
2772 | Py_VISIT(traverse_module_state->__pyx_n_s_AppendFloat16ArrayToTensorProto); |
2773 | Py_VISIT(traverse_module_state->__pyx_n_s_AppendFloat32ArrayToTensorProto); |
2774 | Py_VISIT(traverse_module_state->__pyx_n_s_AppendFloat64ArrayToTensorProto); |
2775 | Py_VISIT(traverse_module_state->__pyx_n_s_AppendInt16ArrayToTensorProto); |
2776 | Py_VISIT(traverse_module_state->__pyx_n_s_AppendInt32ArrayToTensorProto); |
2777 | Py_VISIT(traverse_module_state->__pyx_n_s_AppendInt64ArrayToTensorProto); |
2778 | Py_VISIT(traverse_module_state->__pyx_n_s_AppendInt8ArrayToTensorProto); |
2779 | Py_VISIT(traverse_module_state->__pyx_n_s_AppendObjectArrayToTensorProto); |
2780 | Py_VISIT(traverse_module_state->__pyx_n_s_AppendUInt16ArrayToTensorProto); |
2781 | Py_VISIT(traverse_module_state->__pyx_n_s_AppendUInt32ArrayToTensorProto); |
2782 | Py_VISIT(traverse_module_state->__pyx_n_s_AppendUInt64ArrayToTensorProto); |
2783 | Py_VISIT(traverse_module_state->__pyx_n_s_AppendUInt8ArrayToTensorProto); |
2784 | Py_VISIT(traverse_module_state->__pyx_n_s_ImportError); |
2785 | Py_VISIT(traverse_module_state->__pyx_n_s__22); |
2786 | Py_VISIT(traverse_module_state->__pyx_n_s__3); |
2787 | Py_VISIT(traverse_module_state->__pyx_kp_u__4); |
2788 | Py_VISIT(traverse_module_state->__pyx_n_s_append); |
2789 | Py_VISIT(traverse_module_state->__pyx_n_s_as_bytes); |
2790 | Py_VISIT(traverse_module_state->__pyx_n_s_asyncio_coroutines); |
2791 | Py_VISIT(traverse_module_state->__pyx_n_s_bool_val); |
2792 | Py_VISIT(traverse_module_state->__pyx_n_s_cline_in_traceback); |
2793 | Py_VISIT(traverse_module_state->__pyx_n_s_compat); |
2794 | Py_VISIT(traverse_module_state->__pyx_n_s_dcomplex_val); |
2795 | Py_VISIT(traverse_module_state->__pyx_n_s_double_val); |
2796 | Py_VISIT(traverse_module_state->__pyx_n_s_float_val); |
2797 | Py_VISIT(traverse_module_state->__pyx_n_s_half_val); |
2798 | Py_VISIT(traverse_module_state->__pyx_n_s_i); |
2799 | Py_VISIT(traverse_module_state->__pyx_n_s_import); |
2800 | Py_VISIT(traverse_module_state->__pyx_n_s_initializing); |
2801 | Py_VISIT(traverse_module_state->__pyx_n_s_int64_val); |
2802 | Py_VISIT(traverse_module_state->__pyx_n_s_int_val); |
2803 | Py_VISIT(traverse_module_state->__pyx_n_s_is_coroutine); |
2804 | Py_VISIT(traverse_module_state->__pyx_n_s_item); |
2805 | Py_VISIT(traverse_module_state->__pyx_n_s_main); |
2806 | Py_VISIT(traverse_module_state->__pyx_n_s_n); |
2807 | Py_VISIT(traverse_module_state->__pyx_n_s_name); |
2808 | Py_VISIT(traverse_module_state->__pyx_n_s_np); |
2809 | Py_VISIT(traverse_module_state->__pyx_n_s_nparray); |
2810 | Py_VISIT(traverse_module_state->__pyx_n_s_numpy); |
2811 | Py_VISIT(traverse_module_state->__pyx_kp_s_numpy_core_multiarray_failed_to); |
2812 | Py_VISIT(traverse_module_state->__pyx_kp_s_numpy_core_umath_failed_to_impor); |
2813 | Py_VISIT(traverse_module_state->__pyx_n_s_range); |
2814 | Py_VISIT(traverse_module_state->__pyx_n_s_scomplex_val); |
2815 | Py_VISIT(traverse_module_state->__pyx_n_s_size); |
2816 | Py_VISIT(traverse_module_state->__pyx_n_s_spec); |
2817 | Py_VISIT(traverse_module_state->__pyx_n_s_string_val); |
2818 | Py_VISIT(traverse_module_state->__pyx_n_s_tensor_proto); |
2819 | Py_VISIT(traverse_module_state->__pyx_kp_s_tensorflow_python_framework_fast); |
2820 | Py_VISIT(traverse_module_state->__pyx_n_s_tensorflow_python_framework_fast_2); |
2821 | Py_VISIT(traverse_module_state->__pyx_n_s_tensorflow_python_util); |
2822 | Py_VISIT(traverse_module_state->__pyx_n_s_test); |
2823 | Py_VISIT(traverse_module_state->__pyx_n_s_uint32_val); |
2824 | Py_VISIT(traverse_module_state->__pyx_n_s_uint64_val); |
2825 | Py_VISIT(traverse_module_state->__pyx_tuple_); |
2826 | Py_VISIT(traverse_module_state->__pyx_tuple__2); |
2827 | Py_VISIT(traverse_module_state->__pyx_tuple__5); |
2828 | Py_VISIT(traverse_module_state->__pyx_codeobj__6); |
2829 | Py_VISIT(traverse_module_state->__pyx_codeobj__7); |
2830 | Py_VISIT(traverse_module_state->__pyx_codeobj__8); |
2831 | Py_VISIT(traverse_module_state->__pyx_codeobj__9); |
2832 | Py_VISIT(traverse_module_state->__pyx_codeobj__10); |
2833 | Py_VISIT(traverse_module_state->__pyx_codeobj__11); |
2834 | Py_VISIT(traverse_module_state->__pyx_codeobj__12); |
2835 | Py_VISIT(traverse_module_state->__pyx_codeobj__13); |
2836 | Py_VISIT(traverse_module_state->__pyx_codeobj__14); |
2837 | Py_VISIT(traverse_module_state->__pyx_codeobj__15); |
2838 | Py_VISIT(traverse_module_state->__pyx_codeobj__16); |
2839 | Py_VISIT(traverse_module_state->__pyx_codeobj__17); |
2840 | Py_VISIT(traverse_module_state->__pyx_codeobj__18); |
2841 | Py_VISIT(traverse_module_state->__pyx_codeobj__19); |
2842 | Py_VISIT(traverse_module_state->__pyx_codeobj__20); |
2843 | Py_VISIT(traverse_module_state->__pyx_codeobj__21); |
2844 | return 0; |
2845 | } |
2846 | #endif |
2847 | /* #### Code section: module_state_defines ### */ |
2848 | #if CYTHON_USE_MODULE_STATE |
2849 | #define __pyx_d __pyx_mstate_global->__pyx_d |
2850 | #define __pyx_b __pyx_mstate_global->__pyx_b |
2851 | #define __pyx_cython_runtime __pyx_mstate_global->__pyx_cython_runtime |
2852 | #define __pyx_empty_tuple __pyx_mstate_global->__pyx_empty_tuple |
2853 | #define __pyx_empty_bytes __pyx_mstate_global->__pyx_empty_bytes |
2854 | #define __pyx_empty_unicode __pyx_mstate_global->__pyx_empty_unicode |
2855 | #ifdef __Pyx_CyFunction_USED |
2856 | #define __pyx_CyFunctionType __pyx_mstate_global->__pyx_CyFunctionType |
2857 | #endif |
2858 | #ifdef __Pyx_FusedFunction_USED |
2859 | #define __pyx_FusedFunctionType __pyx_mstate_global->__pyx_FusedFunctionType |
2860 | #endif |
2861 | #define __pyx_ptype_7cpython_4type_type __pyx_mstate_global->__pyx_ptype_7cpython_4type_type |
2862 | #define __pyx_ptype_5numpy_dtype __pyx_mstate_global->__pyx_ptype_5numpy_dtype |
2863 | #define __pyx_ptype_5numpy_flatiter __pyx_mstate_global->__pyx_ptype_5numpy_flatiter |
2864 | #define __pyx_ptype_5numpy_broadcast __pyx_mstate_global->__pyx_ptype_5numpy_broadcast |
2865 | #define __pyx_ptype_5numpy_ndarray __pyx_mstate_global->__pyx_ptype_5numpy_ndarray |
2866 | #define __pyx_ptype_5numpy_generic __pyx_mstate_global->__pyx_ptype_5numpy_generic |
2867 | #define __pyx_ptype_5numpy_number __pyx_mstate_global->__pyx_ptype_5numpy_number |
2868 | #define __pyx_ptype_5numpy_integer __pyx_mstate_global->__pyx_ptype_5numpy_integer |
2869 | #define __pyx_ptype_5numpy_signedinteger __pyx_mstate_global->__pyx_ptype_5numpy_signedinteger |
2870 | #define __pyx_ptype_5numpy_unsignedinteger __pyx_mstate_global->__pyx_ptype_5numpy_unsignedinteger |
2871 | #define __pyx_ptype_5numpy_inexact __pyx_mstate_global->__pyx_ptype_5numpy_inexact |
2872 | #define __pyx_ptype_5numpy_floating __pyx_mstate_global->__pyx_ptype_5numpy_floating |
2873 | #define __pyx_ptype_5numpy_complexfloating __pyx_mstate_global->__pyx_ptype_5numpy_complexfloating |
2874 | #define __pyx_ptype_5numpy_flexible __pyx_mstate_global->__pyx_ptype_5numpy_flexible |
2875 | #define __pyx_ptype_5numpy_character __pyx_mstate_global->__pyx_ptype_5numpy_character |
2876 | #define __pyx_ptype_5numpy_ufunc __pyx_mstate_global->__pyx_ptype_5numpy_ufunc |
2877 | #define __pyx_n_s_AppendBFloat16ArrayToTensorProto __pyx_mstate_global->__pyx_n_s_AppendBFloat16ArrayToTensorProto |
2878 | #define __pyx_n_s_AppendBoolArrayToTensorProto __pyx_mstate_global->__pyx_n_s_AppendBoolArrayToTensorProto |
2879 | #define __pyx_n_s_AppendComplex128ArrayToTensorPro __pyx_mstate_global->__pyx_n_s_AppendComplex128ArrayToTensorPro |
2880 | #define __pyx_n_s_AppendComplex64ArrayToTensorProt __pyx_mstate_global->__pyx_n_s_AppendComplex64ArrayToTensorProt |
2881 | #define __pyx_n_s_AppendFloat16ArrayToTensorProto __pyx_mstate_global->__pyx_n_s_AppendFloat16ArrayToTensorProto |
2882 | #define __pyx_n_s_AppendFloat32ArrayToTensorProto __pyx_mstate_global->__pyx_n_s_AppendFloat32ArrayToTensorProto |
2883 | #define __pyx_n_s_AppendFloat64ArrayToTensorProto __pyx_mstate_global->__pyx_n_s_AppendFloat64ArrayToTensorProto |
2884 | #define __pyx_n_s_AppendInt16ArrayToTensorProto __pyx_mstate_global->__pyx_n_s_AppendInt16ArrayToTensorProto |
2885 | #define __pyx_n_s_AppendInt32ArrayToTensorProto __pyx_mstate_global->__pyx_n_s_AppendInt32ArrayToTensorProto |
2886 | #define __pyx_n_s_AppendInt64ArrayToTensorProto __pyx_mstate_global->__pyx_n_s_AppendInt64ArrayToTensorProto |
2887 | #define __pyx_n_s_AppendInt8ArrayToTensorProto __pyx_mstate_global->__pyx_n_s_AppendInt8ArrayToTensorProto |
2888 | #define __pyx_n_s_AppendObjectArrayToTensorProto __pyx_mstate_global->__pyx_n_s_AppendObjectArrayToTensorProto |
2889 | #define __pyx_n_s_AppendUInt16ArrayToTensorProto __pyx_mstate_global->__pyx_n_s_AppendUInt16ArrayToTensorProto |
2890 | #define __pyx_n_s_AppendUInt32ArrayToTensorProto __pyx_mstate_global->__pyx_n_s_AppendUInt32ArrayToTensorProto |
2891 | #define __pyx_n_s_AppendUInt64ArrayToTensorProto __pyx_mstate_global->__pyx_n_s_AppendUInt64ArrayToTensorProto |
2892 | #define __pyx_n_s_AppendUInt8ArrayToTensorProto __pyx_mstate_global->__pyx_n_s_AppendUInt8ArrayToTensorProto |
2893 | #define __pyx_n_s_ImportError __pyx_mstate_global->__pyx_n_s_ImportError |
2894 | #define __pyx_n_s__22 __pyx_mstate_global->__pyx_n_s__22 |
2895 | #define __pyx_n_s__3 __pyx_mstate_global->__pyx_n_s__3 |
2896 | #define __pyx_kp_u__4 __pyx_mstate_global->__pyx_kp_u__4 |
2897 | #define __pyx_n_s_append __pyx_mstate_global->__pyx_n_s_append |
2898 | #define __pyx_n_s_as_bytes __pyx_mstate_global->__pyx_n_s_as_bytes |
2899 | #define __pyx_n_s_asyncio_coroutines __pyx_mstate_global->__pyx_n_s_asyncio_coroutines |
2900 | #define __pyx_n_s_bool_val __pyx_mstate_global->__pyx_n_s_bool_val |
2901 | #define __pyx_n_s_cline_in_traceback __pyx_mstate_global->__pyx_n_s_cline_in_traceback |
2902 | #define __pyx_n_s_compat __pyx_mstate_global->__pyx_n_s_compat |
2903 | #define __pyx_n_s_dcomplex_val __pyx_mstate_global->__pyx_n_s_dcomplex_val |
2904 | #define __pyx_n_s_double_val __pyx_mstate_global->__pyx_n_s_double_val |
2905 | #define __pyx_n_s_float_val __pyx_mstate_global->__pyx_n_s_float_val |
2906 | #define __pyx_n_s_half_val __pyx_mstate_global->__pyx_n_s_half_val |
2907 | #define __pyx_n_s_i __pyx_mstate_global->__pyx_n_s_i |
2908 | #define __pyx_n_s_import __pyx_mstate_global->__pyx_n_s_import |
2909 | #define __pyx_n_s_initializing __pyx_mstate_global->__pyx_n_s_initializing |
2910 | #define __pyx_n_s_int64_val __pyx_mstate_global->__pyx_n_s_int64_val |
2911 | #define __pyx_n_s_int_val __pyx_mstate_global->__pyx_n_s_int_val |
2912 | #define __pyx_n_s_is_coroutine __pyx_mstate_global->__pyx_n_s_is_coroutine |
2913 | #define __pyx_n_s_item __pyx_mstate_global->__pyx_n_s_item |
2914 | #define __pyx_n_s_main __pyx_mstate_global->__pyx_n_s_main |
2915 | #define __pyx_n_s_n __pyx_mstate_global->__pyx_n_s_n |
2916 | #define __pyx_n_s_name __pyx_mstate_global->__pyx_n_s_name |
2917 | #define __pyx_n_s_np __pyx_mstate_global->__pyx_n_s_np |
2918 | #define __pyx_n_s_nparray __pyx_mstate_global->__pyx_n_s_nparray |
2919 | #define __pyx_n_s_numpy __pyx_mstate_global->__pyx_n_s_numpy |
2920 | #define __pyx_kp_s_numpy_core_multiarray_failed_to __pyx_mstate_global->__pyx_kp_s_numpy_core_multiarray_failed_to |
2921 | #define __pyx_kp_s_numpy_core_umath_failed_to_impor __pyx_mstate_global->__pyx_kp_s_numpy_core_umath_failed_to_impor |
2922 | #define __pyx_n_s_range __pyx_mstate_global->__pyx_n_s_range |
2923 | #define __pyx_n_s_scomplex_val __pyx_mstate_global->__pyx_n_s_scomplex_val |
2924 | #define __pyx_n_s_size __pyx_mstate_global->__pyx_n_s_size |
2925 | #define __pyx_n_s_spec __pyx_mstate_global->__pyx_n_s_spec |
2926 | #define __pyx_n_s_string_val __pyx_mstate_global->__pyx_n_s_string_val |
2927 | #define __pyx_n_s_tensor_proto __pyx_mstate_global->__pyx_n_s_tensor_proto |
2928 | #define __pyx_kp_s_tensorflow_python_framework_fast __pyx_mstate_global->__pyx_kp_s_tensorflow_python_framework_fast |
2929 | #define __pyx_n_s_tensorflow_python_framework_fast_2 __pyx_mstate_global->__pyx_n_s_tensorflow_python_framework_fast_2 |
2930 | #define __pyx_n_s_tensorflow_python_util __pyx_mstate_global->__pyx_n_s_tensorflow_python_util |
2931 | #define __pyx_n_s_test __pyx_mstate_global->__pyx_n_s_test |
2932 | #define __pyx_n_s_uint32_val __pyx_mstate_global->__pyx_n_s_uint32_val |
2933 | #define __pyx_n_s_uint64_val __pyx_mstate_global->__pyx_n_s_uint64_val |
2934 | #define __pyx_tuple_ __pyx_mstate_global->__pyx_tuple_ |
2935 | #define __pyx_tuple__2 __pyx_mstate_global->__pyx_tuple__2 |
2936 | #define __pyx_tuple__5 __pyx_mstate_global->__pyx_tuple__5 |
2937 | #define __pyx_codeobj__6 __pyx_mstate_global->__pyx_codeobj__6 |
2938 | #define __pyx_codeobj__7 __pyx_mstate_global->__pyx_codeobj__7 |
2939 | #define __pyx_codeobj__8 __pyx_mstate_global->__pyx_codeobj__8 |
2940 | #define __pyx_codeobj__9 __pyx_mstate_global->__pyx_codeobj__9 |
2941 | #define __pyx_codeobj__10 __pyx_mstate_global->__pyx_codeobj__10 |
2942 | #define __pyx_codeobj__11 __pyx_mstate_global->__pyx_codeobj__11 |
2943 | #define __pyx_codeobj__12 __pyx_mstate_global->__pyx_codeobj__12 |
2944 | #define __pyx_codeobj__13 __pyx_mstate_global->__pyx_codeobj__13 |
2945 | #define __pyx_codeobj__14 __pyx_mstate_global->__pyx_codeobj__14 |
2946 | #define __pyx_codeobj__15 __pyx_mstate_global->__pyx_codeobj__15 |
2947 | #define __pyx_codeobj__16 __pyx_mstate_global->__pyx_codeobj__16 |
2948 | #define __pyx_codeobj__17 __pyx_mstate_global->__pyx_codeobj__17 |
2949 | #define __pyx_codeobj__18 __pyx_mstate_global->__pyx_codeobj__18 |
2950 | #define __pyx_codeobj__19 __pyx_mstate_global->__pyx_codeobj__19 |
2951 | #define __pyx_codeobj__20 __pyx_mstate_global->__pyx_codeobj__20 |
2952 | #define __pyx_codeobj__21 __pyx_mstate_global->__pyx_codeobj__21 |
2953 | #endif |
2954 | /* #### Code section: module_code ### */ |
2955 | |
2956 | /* "tensorflow/python/framework/fast_tensor_util.pyx":9 |
2957 | * from tensorflow.python.util import compat |
2958 | * |
2959 | * def AppendBFloat16ArrayToTensorProto( # <<<<<<<<<<<<<< |
2960 | * tensor_proto, np.ndarray[np.uint16_t, ndim=1] nparray): |
2961 | * cdef long i, n |
2962 | */ |
2963 | |
2964 | /* Python wrapper */ |
2965 | static PyObject *__pyx_pw_10tensorflow_6python_9framework_16fast_tensor_util_1AppendBFloat16ArrayToTensorProto(PyObject *__pyx_self, |
2966 | #if CYTHON_METH_FASTCALL |
2967 | PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds |
2968 | #else |
2969 | PyObject *__pyx_args, PyObject *__pyx_kwds |
2970 | #endif |
2971 | ); /*proto*/ |
2972 | static PyMethodDef __pyx_mdef_10tensorflow_6python_9framework_16fast_tensor_util_1AppendBFloat16ArrayToTensorProto = {"AppendBFloat16ArrayToTensorProto" , (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_10tensorflow_6python_9framework_16fast_tensor_util_1AppendBFloat16ArrayToTensorProto, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; |
2973 | static PyObject *__pyx_pw_10tensorflow_6python_9framework_16fast_tensor_util_1AppendBFloat16ArrayToTensorProto(PyObject *__pyx_self, |
2974 | #if CYTHON_METH_FASTCALL |
2975 | PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds |
2976 | #else |
2977 | PyObject *__pyx_args, PyObject *__pyx_kwds |
2978 | #endif |
2979 | ) { |
2980 | PyObject *__pyx_v_tensor_proto = 0; |
2981 | PyArrayObject *__pyx_v_nparray = 0; |
2982 | #if !CYTHON_METH_FASTCALL |
2983 | CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); |
2984 | #endif |
2985 | CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); |
2986 | int __pyx_lineno = 0; |
2987 | const char *__pyx_filename = NULL; |
2988 | int __pyx_clineno = 0; |
2989 | PyObject *__pyx_r = 0; |
2990 | __Pyx_RefNannyDeclarations |
2991 | __Pyx_RefNannySetupContext("AppendBFloat16ArrayToTensorProto (wrapper)" , 0); |
2992 | { |
2993 | #if CYTHON_USE_MODULE_STATE |
2994 | PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tensor_proto,&__pyx_n_s_nparray,0}; |
2995 | #else |
2996 | static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tensor_proto,&__pyx_n_s_nparray,0}; |
2997 | #endif |
2998 | PyObject* values[2] = {0,0}; |
2999 | if (__pyx_kwds) { |
3000 | Py_ssize_t kw_args; |
3001 | switch (__pyx_nargs) { |
3002 | case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); |
3003 | CYTHON_FALLTHROUGH; |
3004 | case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); |
3005 | CYTHON_FALLTHROUGH; |
3006 | case 0: break; |
3007 | default: goto __pyx_L5_argtuple_error; |
3008 | } |
3009 | kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); |
3010 | switch (__pyx_nargs) { |
3011 | case 0: |
3012 | if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tensor_proto)) != 0)) kw_args--; |
3013 | else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 9, __pyx_L3_error) |
3014 | else goto __pyx_L5_argtuple_error; |
3015 | CYTHON_FALLTHROUGH; |
3016 | case 1: |
3017 | if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nparray)) != 0)) kw_args--; |
3018 | else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 9, __pyx_L3_error) |
3019 | else { |
3020 | __Pyx_RaiseArgtupleInvalid("AppendBFloat16ArrayToTensorProto" , 1, 2, 2, 1); __PYX_ERR(0, 9, __pyx_L3_error) |
3021 | } |
3022 | } |
3023 | if (unlikely(kw_args > 0)) { |
3024 | const Py_ssize_t kwd_pos_args = __pyx_nargs; |
3025 | if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "AppendBFloat16ArrayToTensorProto" ) < 0)) __PYX_ERR(0, 9, __pyx_L3_error) |
3026 | } |
3027 | } else if (unlikely(__pyx_nargs != 2)) { |
3028 | goto __pyx_L5_argtuple_error; |
3029 | } else { |
3030 | values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); |
3031 | values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); |
3032 | } |
3033 | __pyx_v_tensor_proto = values[0]; |
3034 | __pyx_v_nparray = ((PyArrayObject *)values[1]); |
3035 | } |
3036 | goto __pyx_L4_argument_unpacking_done; |
3037 | __pyx_L5_argtuple_error:; |
3038 | __Pyx_RaiseArgtupleInvalid("AppendBFloat16ArrayToTensorProto" , 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 9, __pyx_L3_error) |
3039 | __pyx_L3_error:; |
3040 | __Pyx_AddTraceback("tensorflow.python.framework.fast_tensor_util.AppendBFloat16ArrayToTensorProto" , __pyx_clineno, __pyx_lineno, __pyx_filename); |
3041 | __Pyx_RefNannyFinishContext(); |
3042 | return NULL; |
3043 | __pyx_L4_argument_unpacking_done:; |
3044 | if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nparray), __pyx_ptype_5numpy_ndarray, 1, "nparray" , 0))) __PYX_ERR(0, 10, __pyx_L1_error) |
3045 | __pyx_r = __pyx_pf_10tensorflow_6python_9framework_16fast_tensor_util_AppendBFloat16ArrayToTensorProto(__pyx_self, __pyx_v_tensor_proto, __pyx_v_nparray); |
3046 | |
3047 | /* function exit code */ |
3048 | goto __pyx_L0; |
3049 | __pyx_L1_error:; |
3050 | __pyx_r = NULL; |
3051 | __pyx_L0:; |
3052 | __Pyx_RefNannyFinishContext(); |
3053 | return __pyx_r; |
3054 | } |
3055 | |
3056 | static PyObject *__pyx_pf_10tensorflow_6python_9framework_16fast_tensor_util_AppendBFloat16ArrayToTensorProto(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tensor_proto, PyArrayObject *__pyx_v_nparray) { |
3057 | long __pyx_v_i; |
3058 | long __pyx_v_n; |
3059 | __Pyx_LocalBuf_ND __pyx_pybuffernd_nparray; |
3060 | __Pyx_Buffer __pyx_pybuffer_nparray; |
3061 | PyObject *__pyx_r = NULL; |
3062 | __Pyx_RefNannyDeclarations |
3063 | long __pyx_t_1; |
3064 | long __pyx_t_2; |
3065 | long __pyx_t_3; |
3066 | PyObject *__pyx_t_4 = NULL; |
3067 | Py_ssize_t __pyx_t_5; |
3068 | PyObject *__pyx_t_6 = NULL; |
3069 | int __pyx_t_7; |
3070 | int __pyx_lineno = 0; |
3071 | const char *__pyx_filename = NULL; |
3072 | int __pyx_clineno = 0; |
3073 | __Pyx_RefNannySetupContext("AppendBFloat16ArrayToTensorProto" , 0); |
3074 | __pyx_pybuffer_nparray.pybuffer.buf = NULL; |
3075 | __pyx_pybuffer_nparray.refcount = 0; |
3076 | __pyx_pybuffernd_nparray.data = NULL; |
3077 | __pyx_pybuffernd_nparray.rcbuffer = &__pyx_pybuffer_nparray; |
3078 | { |
3079 | __Pyx_BufFmt_StackElem __pyx_stack[1]; |
3080 | if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nparray.rcbuffer->pybuffer, (PyObject*)__pyx_v_nparray, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint16_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 9, __pyx_L1_error) |
3081 | } |
3082 | __pyx_pybuffernd_nparray.diminfo[0].strides = __pyx_pybuffernd_nparray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nparray.diminfo[0].shape = __pyx_pybuffernd_nparray.rcbuffer->pybuffer.shape[0]; |
3083 | |
3084 | /* "tensorflow/python/framework/fast_tensor_util.pyx":12 |
3085 | * tensor_proto, np.ndarray[np.uint16_t, ndim=1] nparray): |
3086 | * cdef long i, n |
3087 | * n = nparray.size # <<<<<<<<<<<<<< |
3088 | * for i in range(n): |
3089 | * tensor_proto.half_val.append(nparray[i]) |
3090 | */ |
3091 | __pyx_v_n = __pyx_f_5numpy_7ndarray_4size_size(((PyArrayObject *)__pyx_v_nparray)); |
3092 | |
3093 | /* "tensorflow/python/framework/fast_tensor_util.pyx":13 |
3094 | * cdef long i, n |
3095 | * n = nparray.size |
3096 | * for i in range(n): # <<<<<<<<<<<<<< |
3097 | * tensor_proto.half_val.append(nparray[i]) |
3098 | * |
3099 | */ |
3100 | __pyx_t_1 = __pyx_v_n; |
3101 | __pyx_t_2 = __pyx_t_1; |
3102 | for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { |
3103 | __pyx_v_i = __pyx_t_3; |
3104 | |
3105 | /* "tensorflow/python/framework/fast_tensor_util.pyx":14 |
3106 | * n = nparray.size |
3107 | * for i in range(n): |
3108 | * tensor_proto.half_val.append(nparray[i]) # <<<<<<<<<<<<<< |
3109 | * |
3110 | * |
3111 | */ |
3112 | __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_tensor_proto, __pyx_n_s_half_val); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 14, __pyx_L1_error) |
3113 | __Pyx_GOTREF(__pyx_t_4); |
3114 | __pyx_t_5 = __pyx_v_i; |
3115 | __pyx_t_6 = __Pyx_PyInt_From_npy_uint16((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint16_t *, __pyx_pybuffernd_nparray.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_nparray.diminfo[0].strides))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 14, __pyx_L1_error) |
3116 | __Pyx_GOTREF(__pyx_t_6); |
3117 | __pyx_t_7 = __Pyx_PyObject_Append(__pyx_t_4, __pyx_t_6); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 14, __pyx_L1_error) |
3118 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
3119 | __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; |
3120 | } |
3121 | |
3122 | /* "tensorflow/python/framework/fast_tensor_util.pyx":9 |
3123 | * from tensorflow.python.util import compat |
3124 | * |
3125 | * def AppendBFloat16ArrayToTensorProto( # <<<<<<<<<<<<<< |
3126 | * tensor_proto, np.ndarray[np.uint16_t, ndim=1] nparray): |
3127 | * cdef long i, n |
3128 | */ |
3129 | |
3130 | /* function exit code */ |
3131 | __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
3132 | goto __pyx_L0; |
3133 | __pyx_L1_error:; |
3134 | __Pyx_XDECREF(__pyx_t_4); |
3135 | __Pyx_XDECREF(__pyx_t_6); |
3136 | { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; |
3137 | __Pyx_PyThreadState_declare |
3138 | __Pyx_PyThreadState_assign |
3139 | __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); |
3140 | __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nparray.rcbuffer->pybuffer); |
3141 | __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} |
3142 | __Pyx_AddTraceback("tensorflow.python.framework.fast_tensor_util.AppendBFloat16ArrayToTensorProto" , __pyx_clineno, __pyx_lineno, __pyx_filename); |
3143 | __pyx_r = NULL; |
3144 | goto __pyx_L2; |
3145 | __pyx_L0:; |
3146 | __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nparray.rcbuffer->pybuffer); |
3147 | __pyx_L2:; |
3148 | __Pyx_XGIVEREF(__pyx_r); |
3149 | __Pyx_RefNannyFinishContext(); |
3150 | return __pyx_r; |
3151 | } |
3152 | |
3153 | /* "tensorflow/python/framework/fast_tensor_util.pyx":17 |
3154 | * |
3155 | * |
3156 | * def AppendFloat16ArrayToTensorProto( # <<<<<<<<<<<<<< |
3157 | * # For numpy, npy_half is a typedef for npy_uint16, |
3158 | * # see: https://github.com/numpy/numpy/blob/master/doc/source/reference/c-api.coremath.rst#half-precision-functions |
3159 | */ |
3160 | |
3161 | /* Python wrapper */ |
3162 | static PyObject *__pyx_pw_10tensorflow_6python_9framework_16fast_tensor_util_3AppendFloat16ArrayToTensorProto(PyObject *__pyx_self, |
3163 | #if CYTHON_METH_FASTCALL |
3164 | PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds |
3165 | #else |
3166 | PyObject *__pyx_args, PyObject *__pyx_kwds |
3167 | #endif |
3168 | ); /*proto*/ |
3169 | static PyMethodDef __pyx_mdef_10tensorflow_6python_9framework_16fast_tensor_util_3AppendFloat16ArrayToTensorProto = {"AppendFloat16ArrayToTensorProto" , (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_10tensorflow_6python_9framework_16fast_tensor_util_3AppendFloat16ArrayToTensorProto, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; |
3170 | static PyObject *__pyx_pw_10tensorflow_6python_9framework_16fast_tensor_util_3AppendFloat16ArrayToTensorProto(PyObject *__pyx_self, |
3171 | #if CYTHON_METH_FASTCALL |
3172 | PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds |
3173 | #else |
3174 | PyObject *__pyx_args, PyObject *__pyx_kwds |
3175 | #endif |
3176 | ) { |
3177 | PyObject *__pyx_v_tensor_proto = 0; |
3178 | PyArrayObject *__pyx_v_nparray = 0; |
3179 | #if !CYTHON_METH_FASTCALL |
3180 | CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); |
3181 | #endif |
3182 | CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); |
3183 | int __pyx_lineno = 0; |
3184 | const char *__pyx_filename = NULL; |
3185 | int __pyx_clineno = 0; |
3186 | PyObject *__pyx_r = 0; |
3187 | __Pyx_RefNannyDeclarations |
3188 | __Pyx_RefNannySetupContext("AppendFloat16ArrayToTensorProto (wrapper)" , 0); |
3189 | { |
3190 | #if CYTHON_USE_MODULE_STATE |
3191 | PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tensor_proto,&__pyx_n_s_nparray,0}; |
3192 | #else |
3193 | static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tensor_proto,&__pyx_n_s_nparray,0}; |
3194 | #endif |
3195 | PyObject* values[2] = {0,0}; |
3196 | if (__pyx_kwds) { |
3197 | Py_ssize_t kw_args; |
3198 | switch (__pyx_nargs) { |
3199 | case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); |
3200 | CYTHON_FALLTHROUGH; |
3201 | case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); |
3202 | CYTHON_FALLTHROUGH; |
3203 | case 0: break; |
3204 | default: goto __pyx_L5_argtuple_error; |
3205 | } |
3206 | kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); |
3207 | switch (__pyx_nargs) { |
3208 | case 0: |
3209 | if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tensor_proto)) != 0)) kw_args--; |
3210 | else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 17, __pyx_L3_error) |
3211 | else goto __pyx_L5_argtuple_error; |
3212 | CYTHON_FALLTHROUGH; |
3213 | case 1: |
3214 | if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nparray)) != 0)) kw_args--; |
3215 | else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 17, __pyx_L3_error) |
3216 | else { |
3217 | __Pyx_RaiseArgtupleInvalid("AppendFloat16ArrayToTensorProto" , 1, 2, 2, 1); __PYX_ERR(0, 17, __pyx_L3_error) |
3218 | } |
3219 | } |
3220 | if (unlikely(kw_args > 0)) { |
3221 | const Py_ssize_t kwd_pos_args = __pyx_nargs; |
3222 | if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "AppendFloat16ArrayToTensorProto" ) < 0)) __PYX_ERR(0, 17, __pyx_L3_error) |
3223 | } |
3224 | } else if (unlikely(__pyx_nargs != 2)) { |
3225 | goto __pyx_L5_argtuple_error; |
3226 | } else { |
3227 | values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); |
3228 | values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); |
3229 | } |
3230 | __pyx_v_tensor_proto = values[0]; |
3231 | __pyx_v_nparray = ((PyArrayObject *)values[1]); |
3232 | } |
3233 | goto __pyx_L4_argument_unpacking_done; |
3234 | __pyx_L5_argtuple_error:; |
3235 | __Pyx_RaiseArgtupleInvalid("AppendFloat16ArrayToTensorProto" , 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 17, __pyx_L3_error) |
3236 | __pyx_L3_error:; |
3237 | __Pyx_AddTraceback("tensorflow.python.framework.fast_tensor_util.AppendFloat16ArrayToTensorProto" , __pyx_clineno, __pyx_lineno, __pyx_filename); |
3238 | __Pyx_RefNannyFinishContext(); |
3239 | return NULL; |
3240 | __pyx_L4_argument_unpacking_done:; |
3241 | if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nparray), __pyx_ptype_5numpy_ndarray, 1, "nparray" , 0))) __PYX_ERR(0, 22, __pyx_L1_error) |
3242 | __pyx_r = __pyx_pf_10tensorflow_6python_9framework_16fast_tensor_util_2AppendFloat16ArrayToTensorProto(__pyx_self, __pyx_v_tensor_proto, __pyx_v_nparray); |
3243 | |
3244 | /* function exit code */ |
3245 | goto __pyx_L0; |
3246 | __pyx_L1_error:; |
3247 | __pyx_r = NULL; |
3248 | __pyx_L0:; |
3249 | __Pyx_RefNannyFinishContext(); |
3250 | return __pyx_r; |
3251 | } |
3252 | |
3253 | static PyObject *__pyx_pf_10tensorflow_6python_9framework_16fast_tensor_util_2AppendFloat16ArrayToTensorProto(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tensor_proto, PyArrayObject *__pyx_v_nparray) { |
3254 | long __pyx_v_i; |
3255 | long __pyx_v_n; |
3256 | __Pyx_LocalBuf_ND __pyx_pybuffernd_nparray; |
3257 | __Pyx_Buffer __pyx_pybuffer_nparray; |
3258 | PyObject *__pyx_r = NULL; |
3259 | __Pyx_RefNannyDeclarations |
3260 | long __pyx_t_1; |
3261 | long __pyx_t_2; |
3262 | long __pyx_t_3; |
3263 | PyObject *__pyx_t_4 = NULL; |
3264 | Py_ssize_t __pyx_t_5; |
3265 | PyObject *__pyx_t_6 = NULL; |
3266 | int __pyx_t_7; |
3267 | int __pyx_lineno = 0; |
3268 | const char *__pyx_filename = NULL; |
3269 | int __pyx_clineno = 0; |
3270 | __Pyx_RefNannySetupContext("AppendFloat16ArrayToTensorProto" , 0); |
3271 | __pyx_pybuffer_nparray.pybuffer.buf = NULL; |
3272 | __pyx_pybuffer_nparray.refcount = 0; |
3273 | __pyx_pybuffernd_nparray.data = NULL; |
3274 | __pyx_pybuffernd_nparray.rcbuffer = &__pyx_pybuffer_nparray; |
3275 | { |
3276 | __Pyx_BufFmt_StackElem __pyx_stack[1]; |
3277 | if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nparray.rcbuffer->pybuffer, (PyObject*)__pyx_v_nparray, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint16_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 17, __pyx_L1_error) |
3278 | } |
3279 | __pyx_pybuffernd_nparray.diminfo[0].strides = __pyx_pybuffernd_nparray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nparray.diminfo[0].shape = __pyx_pybuffernd_nparray.rcbuffer->pybuffer.shape[0]; |
3280 | |
3281 | /* "tensorflow/python/framework/fast_tensor_util.pyx":24 |
3282 | * tensor_proto, np.ndarray[np.uint16_t, ndim=1] nparray): |
3283 | * cdef long i, n |
3284 | * n = nparray.size # <<<<<<<<<<<<<< |
3285 | * for i in range(n): |
3286 | * tensor_proto.half_val.append(nparray[i]) |
3287 | */ |
3288 | __pyx_v_n = __pyx_f_5numpy_7ndarray_4size_size(((PyArrayObject *)__pyx_v_nparray)); |
3289 | |
3290 | /* "tensorflow/python/framework/fast_tensor_util.pyx":25 |
3291 | * cdef long i, n |
3292 | * n = nparray.size |
3293 | * for i in range(n): # <<<<<<<<<<<<<< |
3294 | * tensor_proto.half_val.append(nparray[i]) |
3295 | * |
3296 | */ |
3297 | __pyx_t_1 = __pyx_v_n; |
3298 | __pyx_t_2 = __pyx_t_1; |
3299 | for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { |
3300 | __pyx_v_i = __pyx_t_3; |
3301 | |
3302 | /* "tensorflow/python/framework/fast_tensor_util.pyx":26 |
3303 | * n = nparray.size |
3304 | * for i in range(n): |
3305 | * tensor_proto.half_val.append(nparray[i]) # <<<<<<<<<<<<<< |
3306 | * |
3307 | * |
3308 | */ |
3309 | __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_tensor_proto, __pyx_n_s_half_val); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 26, __pyx_L1_error) |
3310 | __Pyx_GOTREF(__pyx_t_4); |
3311 | __pyx_t_5 = __pyx_v_i; |
3312 | __pyx_t_6 = __Pyx_PyInt_From_npy_uint16((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint16_t *, __pyx_pybuffernd_nparray.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_nparray.diminfo[0].strides))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 26, __pyx_L1_error) |
3313 | __Pyx_GOTREF(__pyx_t_6); |
3314 | __pyx_t_7 = __Pyx_PyObject_Append(__pyx_t_4, __pyx_t_6); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 26, __pyx_L1_error) |
3315 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
3316 | __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; |
3317 | } |
3318 | |
3319 | /* "tensorflow/python/framework/fast_tensor_util.pyx":17 |
3320 | * |
3321 | * |
3322 | * def AppendFloat16ArrayToTensorProto( # <<<<<<<<<<<<<< |
3323 | * # For numpy, npy_half is a typedef for npy_uint16, |
3324 | * # see: https://github.com/numpy/numpy/blob/master/doc/source/reference/c-api.coremath.rst#half-precision-functions |
3325 | */ |
3326 | |
3327 | /* function exit code */ |
3328 | __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
3329 | goto __pyx_L0; |
3330 | __pyx_L1_error:; |
3331 | __Pyx_XDECREF(__pyx_t_4); |
3332 | __Pyx_XDECREF(__pyx_t_6); |
3333 | { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; |
3334 | __Pyx_PyThreadState_declare |
3335 | __Pyx_PyThreadState_assign |
3336 | __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); |
3337 | __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nparray.rcbuffer->pybuffer); |
3338 | __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} |
3339 | __Pyx_AddTraceback("tensorflow.python.framework.fast_tensor_util.AppendFloat16ArrayToTensorProto" , __pyx_clineno, __pyx_lineno, __pyx_filename); |
3340 | __pyx_r = NULL; |
3341 | goto __pyx_L2; |
3342 | __pyx_L0:; |
3343 | __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nparray.rcbuffer->pybuffer); |
3344 | __pyx_L2:; |
3345 | __Pyx_XGIVEREF(__pyx_r); |
3346 | __Pyx_RefNannyFinishContext(); |
3347 | return __pyx_r; |
3348 | } |
3349 | |
3350 | /* "tensorflow/python/framework/fast_tensor_util.pyx":29 |
3351 | * |
3352 | * |
3353 | * def AppendFloat32ArrayToTensorProto( # <<<<<<<<<<<<<< |
3354 | * tensor_proto, np.ndarray[np.float32_t, ndim=1] nparray): |
3355 | * cdef long i, n |
3356 | */ |
3357 | |
3358 | /* Python wrapper */ |
3359 | static PyObject *__pyx_pw_10tensorflow_6python_9framework_16fast_tensor_util_5AppendFloat32ArrayToTensorProto(PyObject *__pyx_self, |
3360 | #if CYTHON_METH_FASTCALL |
3361 | PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds |
3362 | #else |
3363 | PyObject *__pyx_args, PyObject *__pyx_kwds |
3364 | #endif |
3365 | ); /*proto*/ |
3366 | static PyMethodDef __pyx_mdef_10tensorflow_6python_9framework_16fast_tensor_util_5AppendFloat32ArrayToTensorProto = {"AppendFloat32ArrayToTensorProto" , (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_10tensorflow_6python_9framework_16fast_tensor_util_5AppendFloat32ArrayToTensorProto, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; |
3367 | static PyObject *__pyx_pw_10tensorflow_6python_9framework_16fast_tensor_util_5AppendFloat32ArrayToTensorProto(PyObject *__pyx_self, |
3368 | #if CYTHON_METH_FASTCALL |
3369 | PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds |
3370 | #else |
3371 | PyObject *__pyx_args, PyObject *__pyx_kwds |
3372 | #endif |
3373 | ) { |
3374 | PyObject *__pyx_v_tensor_proto = 0; |
3375 | PyArrayObject *__pyx_v_nparray = 0; |
3376 | #if !CYTHON_METH_FASTCALL |
3377 | CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); |
3378 | #endif |
3379 | CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); |
3380 | int __pyx_lineno = 0; |
3381 | const char *__pyx_filename = NULL; |
3382 | int __pyx_clineno = 0; |
3383 | PyObject *__pyx_r = 0; |
3384 | __Pyx_RefNannyDeclarations |
3385 | __Pyx_RefNannySetupContext("AppendFloat32ArrayToTensorProto (wrapper)" , 0); |
3386 | { |
3387 | #if CYTHON_USE_MODULE_STATE |
3388 | PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tensor_proto,&__pyx_n_s_nparray,0}; |
3389 | #else |
3390 | static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tensor_proto,&__pyx_n_s_nparray,0}; |
3391 | #endif |
3392 | PyObject* values[2] = {0,0}; |
3393 | if (__pyx_kwds) { |
3394 | Py_ssize_t kw_args; |
3395 | switch (__pyx_nargs) { |
3396 | case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); |
3397 | CYTHON_FALLTHROUGH; |
3398 | case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); |
3399 | CYTHON_FALLTHROUGH; |
3400 | case 0: break; |
3401 | default: goto __pyx_L5_argtuple_error; |
3402 | } |
3403 | kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); |
3404 | switch (__pyx_nargs) { |
3405 | case 0: |
3406 | if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tensor_proto)) != 0)) kw_args--; |
3407 | else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 29, __pyx_L3_error) |
3408 | else goto __pyx_L5_argtuple_error; |
3409 | CYTHON_FALLTHROUGH; |
3410 | case 1: |
3411 | if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nparray)) != 0)) kw_args--; |
3412 | else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 29, __pyx_L3_error) |
3413 | else { |
3414 | __Pyx_RaiseArgtupleInvalid("AppendFloat32ArrayToTensorProto" , 1, 2, 2, 1); __PYX_ERR(0, 29, __pyx_L3_error) |
3415 | } |
3416 | } |
3417 | if (unlikely(kw_args > 0)) { |
3418 | const Py_ssize_t kwd_pos_args = __pyx_nargs; |
3419 | if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "AppendFloat32ArrayToTensorProto" ) < 0)) __PYX_ERR(0, 29, __pyx_L3_error) |
3420 | } |
3421 | } else if (unlikely(__pyx_nargs != 2)) { |
3422 | goto __pyx_L5_argtuple_error; |
3423 | } else { |
3424 | values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); |
3425 | values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); |
3426 | } |
3427 | __pyx_v_tensor_proto = values[0]; |
3428 | __pyx_v_nparray = ((PyArrayObject *)values[1]); |
3429 | } |
3430 | goto __pyx_L4_argument_unpacking_done; |
3431 | __pyx_L5_argtuple_error:; |
3432 | __Pyx_RaiseArgtupleInvalid("AppendFloat32ArrayToTensorProto" , 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 29, __pyx_L3_error) |
3433 | __pyx_L3_error:; |
3434 | __Pyx_AddTraceback("tensorflow.python.framework.fast_tensor_util.AppendFloat32ArrayToTensorProto" , __pyx_clineno, __pyx_lineno, __pyx_filename); |
3435 | __Pyx_RefNannyFinishContext(); |
3436 | return NULL; |
3437 | __pyx_L4_argument_unpacking_done:; |
3438 | if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nparray), __pyx_ptype_5numpy_ndarray, 1, "nparray" , 0))) __PYX_ERR(0, 30, __pyx_L1_error) |
3439 | __pyx_r = __pyx_pf_10tensorflow_6python_9framework_16fast_tensor_util_4AppendFloat32ArrayToTensorProto(__pyx_self, __pyx_v_tensor_proto, __pyx_v_nparray); |
3440 | |
3441 | /* function exit code */ |
3442 | goto __pyx_L0; |
3443 | __pyx_L1_error:; |
3444 | __pyx_r = NULL; |
3445 | __pyx_L0:; |
3446 | __Pyx_RefNannyFinishContext(); |
3447 | return __pyx_r; |
3448 | } |
3449 | |
3450 | static PyObject *__pyx_pf_10tensorflow_6python_9framework_16fast_tensor_util_4AppendFloat32ArrayToTensorProto(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tensor_proto, PyArrayObject *__pyx_v_nparray) { |
3451 | long __pyx_v_i; |
3452 | long __pyx_v_n; |
3453 | __Pyx_LocalBuf_ND __pyx_pybuffernd_nparray; |
3454 | __Pyx_Buffer __pyx_pybuffer_nparray; |
3455 | PyObject *__pyx_r = NULL; |
3456 | __Pyx_RefNannyDeclarations |
3457 | long __pyx_t_1; |
3458 | long __pyx_t_2; |
3459 | long __pyx_t_3; |
3460 | PyObject *__pyx_t_4 = NULL; |
3461 | Py_ssize_t __pyx_t_5; |
3462 | PyObject *__pyx_t_6 = NULL; |
3463 | int __pyx_t_7; |
3464 | int __pyx_lineno = 0; |
3465 | const char *__pyx_filename = NULL; |
3466 | int __pyx_clineno = 0; |
3467 | __Pyx_RefNannySetupContext("AppendFloat32ArrayToTensorProto" , 0); |
3468 | __pyx_pybuffer_nparray.pybuffer.buf = NULL; |
3469 | __pyx_pybuffer_nparray.refcount = 0; |
3470 | __pyx_pybuffernd_nparray.data = NULL; |
3471 | __pyx_pybuffernd_nparray.rcbuffer = &__pyx_pybuffer_nparray; |
3472 | { |
3473 | __Pyx_BufFmt_StackElem __pyx_stack[1]; |
3474 | if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nparray.rcbuffer->pybuffer, (PyObject*)__pyx_v_nparray, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 29, __pyx_L1_error) |
3475 | } |
3476 | __pyx_pybuffernd_nparray.diminfo[0].strides = __pyx_pybuffernd_nparray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nparray.diminfo[0].shape = __pyx_pybuffernd_nparray.rcbuffer->pybuffer.shape[0]; |
3477 | |
3478 | /* "tensorflow/python/framework/fast_tensor_util.pyx":32 |
3479 | * tensor_proto, np.ndarray[np.float32_t, ndim=1] nparray): |
3480 | * cdef long i, n |
3481 | * n = nparray.size # <<<<<<<<<<<<<< |
3482 | * for i in range(n): |
3483 | * tensor_proto.float_val.append(nparray[i]) |
3484 | */ |
3485 | __pyx_v_n = __pyx_f_5numpy_7ndarray_4size_size(((PyArrayObject *)__pyx_v_nparray)); |
3486 | |
3487 | /* "tensorflow/python/framework/fast_tensor_util.pyx":33 |
3488 | * cdef long i, n |
3489 | * n = nparray.size |
3490 | * for i in range(n): # <<<<<<<<<<<<<< |
3491 | * tensor_proto.float_val.append(nparray[i]) |
3492 | * |
3493 | */ |
3494 | __pyx_t_1 = __pyx_v_n; |
3495 | __pyx_t_2 = __pyx_t_1; |
3496 | for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { |
3497 | __pyx_v_i = __pyx_t_3; |
3498 | |
3499 | /* "tensorflow/python/framework/fast_tensor_util.pyx":34 |
3500 | * n = nparray.size |
3501 | * for i in range(n): |
3502 | * tensor_proto.float_val.append(nparray[i]) # <<<<<<<<<<<<<< |
3503 | * |
3504 | * |
3505 | */ |
3506 | __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_tensor_proto, __pyx_n_s_float_val); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 34, __pyx_L1_error) |
3507 | __Pyx_GOTREF(__pyx_t_4); |
3508 | __pyx_t_5 = __pyx_v_i; |
3509 | __pyx_t_6 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_nparray.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_nparray.diminfo[0].strides))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 34, __pyx_L1_error) |
3510 | __Pyx_GOTREF(__pyx_t_6); |
3511 | __pyx_t_7 = __Pyx_PyObject_Append(__pyx_t_4, __pyx_t_6); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 34, __pyx_L1_error) |
3512 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
3513 | __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; |
3514 | } |
3515 | |
3516 | /* "tensorflow/python/framework/fast_tensor_util.pyx":29 |
3517 | * |
3518 | * |
3519 | * def AppendFloat32ArrayToTensorProto( # <<<<<<<<<<<<<< |
3520 | * tensor_proto, np.ndarray[np.float32_t, ndim=1] nparray): |
3521 | * cdef long i, n |
3522 | */ |
3523 | |
3524 | /* function exit code */ |
3525 | __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
3526 | goto __pyx_L0; |
3527 | __pyx_L1_error:; |
3528 | __Pyx_XDECREF(__pyx_t_4); |
3529 | __Pyx_XDECREF(__pyx_t_6); |
3530 | { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; |
3531 | __Pyx_PyThreadState_declare |
3532 | __Pyx_PyThreadState_assign |
3533 | __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); |
3534 | __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nparray.rcbuffer->pybuffer); |
3535 | __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} |
3536 | __Pyx_AddTraceback("tensorflow.python.framework.fast_tensor_util.AppendFloat32ArrayToTensorProto" , __pyx_clineno, __pyx_lineno, __pyx_filename); |
3537 | __pyx_r = NULL; |
3538 | goto __pyx_L2; |
3539 | __pyx_L0:; |
3540 | __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nparray.rcbuffer->pybuffer); |
3541 | __pyx_L2:; |
3542 | __Pyx_XGIVEREF(__pyx_r); |
3543 | __Pyx_RefNannyFinishContext(); |
3544 | return __pyx_r; |
3545 | } |
3546 | |
3547 | /* "tensorflow/python/framework/fast_tensor_util.pyx":37 |
3548 | * |
3549 | * |
3550 | * def AppendFloat64ArrayToTensorProto( # <<<<<<<<<<<<<< |
3551 | * tensor_proto, np.ndarray[np.float64_t, ndim=1] nparray): |
3552 | * cdef long i, n |
3553 | */ |
3554 | |
3555 | /* Python wrapper */ |
3556 | static PyObject *__pyx_pw_10tensorflow_6python_9framework_16fast_tensor_util_7AppendFloat64ArrayToTensorProto(PyObject *__pyx_self, |
3557 | #if CYTHON_METH_FASTCALL |
3558 | PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds |
3559 | #else |
3560 | PyObject *__pyx_args, PyObject *__pyx_kwds |
3561 | #endif |
3562 | ); /*proto*/ |
3563 | static PyMethodDef __pyx_mdef_10tensorflow_6python_9framework_16fast_tensor_util_7AppendFloat64ArrayToTensorProto = {"AppendFloat64ArrayToTensorProto" , (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_10tensorflow_6python_9framework_16fast_tensor_util_7AppendFloat64ArrayToTensorProto, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; |
3564 | static PyObject *__pyx_pw_10tensorflow_6python_9framework_16fast_tensor_util_7AppendFloat64ArrayToTensorProto(PyObject *__pyx_self, |
3565 | #if CYTHON_METH_FASTCALL |
3566 | PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds |
3567 | #else |
3568 | PyObject *__pyx_args, PyObject *__pyx_kwds |
3569 | #endif |
3570 | ) { |
3571 | PyObject *__pyx_v_tensor_proto = 0; |
3572 | PyArrayObject *__pyx_v_nparray = 0; |
3573 | #if !CYTHON_METH_FASTCALL |
3574 | CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); |
3575 | #endif |
3576 | CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); |
3577 | int __pyx_lineno = 0; |
3578 | const char *__pyx_filename = NULL; |
3579 | int __pyx_clineno = 0; |
3580 | PyObject *__pyx_r = 0; |
3581 | __Pyx_RefNannyDeclarations |
3582 | __Pyx_RefNannySetupContext("AppendFloat64ArrayToTensorProto (wrapper)" , 0); |
3583 | { |
3584 | #if CYTHON_USE_MODULE_STATE |
3585 | PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tensor_proto,&__pyx_n_s_nparray,0}; |
3586 | #else |
3587 | static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tensor_proto,&__pyx_n_s_nparray,0}; |
3588 | #endif |
3589 | PyObject* values[2] = {0,0}; |
3590 | if (__pyx_kwds) { |
3591 | Py_ssize_t kw_args; |
3592 | switch (__pyx_nargs) { |
3593 | case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); |
3594 | CYTHON_FALLTHROUGH; |
3595 | case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); |
3596 | CYTHON_FALLTHROUGH; |
3597 | case 0: break; |
3598 | default: goto __pyx_L5_argtuple_error; |
3599 | } |
3600 | kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); |
3601 | switch (__pyx_nargs) { |
3602 | case 0: |
3603 | if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tensor_proto)) != 0)) kw_args--; |
3604 | else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 37, __pyx_L3_error) |
3605 | else goto __pyx_L5_argtuple_error; |
3606 | CYTHON_FALLTHROUGH; |
3607 | case 1: |
3608 | if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nparray)) != 0)) kw_args--; |
3609 | else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 37, __pyx_L3_error) |
3610 | else { |
3611 | __Pyx_RaiseArgtupleInvalid("AppendFloat64ArrayToTensorProto" , 1, 2, 2, 1); __PYX_ERR(0, 37, __pyx_L3_error) |
3612 | } |
3613 | } |
3614 | if (unlikely(kw_args > 0)) { |
3615 | const Py_ssize_t kwd_pos_args = __pyx_nargs; |
3616 | if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "AppendFloat64ArrayToTensorProto" ) < 0)) __PYX_ERR(0, 37, __pyx_L3_error) |
3617 | } |
3618 | } else if (unlikely(__pyx_nargs != 2)) { |
3619 | goto __pyx_L5_argtuple_error; |
3620 | } else { |
3621 | values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); |
3622 | values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); |
3623 | } |
3624 | __pyx_v_tensor_proto = values[0]; |
3625 | __pyx_v_nparray = ((PyArrayObject *)values[1]); |
3626 | } |
3627 | goto __pyx_L4_argument_unpacking_done; |
3628 | __pyx_L5_argtuple_error:; |
3629 | __Pyx_RaiseArgtupleInvalid("AppendFloat64ArrayToTensorProto" , 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 37, __pyx_L3_error) |
3630 | __pyx_L3_error:; |
3631 | __Pyx_AddTraceback("tensorflow.python.framework.fast_tensor_util.AppendFloat64ArrayToTensorProto" , __pyx_clineno, __pyx_lineno, __pyx_filename); |
3632 | __Pyx_RefNannyFinishContext(); |
3633 | return NULL; |
3634 | __pyx_L4_argument_unpacking_done:; |
3635 | if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nparray), __pyx_ptype_5numpy_ndarray, 1, "nparray" , 0))) __PYX_ERR(0, 38, __pyx_L1_error) |
3636 | __pyx_r = __pyx_pf_10tensorflow_6python_9framework_16fast_tensor_util_6AppendFloat64ArrayToTensorProto(__pyx_self, __pyx_v_tensor_proto, __pyx_v_nparray); |
3637 | |
3638 | /* function exit code */ |
3639 | goto __pyx_L0; |
3640 | __pyx_L1_error:; |
3641 | __pyx_r = NULL; |
3642 | __pyx_L0:; |
3643 | __Pyx_RefNannyFinishContext(); |
3644 | return __pyx_r; |
3645 | } |
3646 | |
3647 | static PyObject *__pyx_pf_10tensorflow_6python_9framework_16fast_tensor_util_6AppendFloat64ArrayToTensorProto(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tensor_proto, PyArrayObject *__pyx_v_nparray) { |
3648 | long __pyx_v_i; |
3649 | long __pyx_v_n; |
3650 | __Pyx_LocalBuf_ND __pyx_pybuffernd_nparray; |
3651 | __Pyx_Buffer __pyx_pybuffer_nparray; |
3652 | PyObject *__pyx_r = NULL; |
3653 | __Pyx_RefNannyDeclarations |
3654 | long __pyx_t_1; |
3655 | long __pyx_t_2; |
3656 | long __pyx_t_3; |
3657 | PyObject *__pyx_t_4 = NULL; |
3658 | Py_ssize_t __pyx_t_5; |
3659 | PyObject *__pyx_t_6 = NULL; |
3660 | int __pyx_t_7; |
3661 | int __pyx_lineno = 0; |
3662 | const char *__pyx_filename = NULL; |
3663 | int __pyx_clineno = 0; |
3664 | __Pyx_RefNannySetupContext("AppendFloat64ArrayToTensorProto" , 0); |
3665 | __pyx_pybuffer_nparray.pybuffer.buf = NULL; |
3666 | __pyx_pybuffer_nparray.refcount = 0; |
3667 | __pyx_pybuffernd_nparray.data = NULL; |
3668 | __pyx_pybuffernd_nparray.rcbuffer = &__pyx_pybuffer_nparray; |
3669 | { |
3670 | __Pyx_BufFmt_StackElem __pyx_stack[1]; |
3671 | if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nparray.rcbuffer->pybuffer, (PyObject*)__pyx_v_nparray, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 37, __pyx_L1_error) |
3672 | } |
3673 | __pyx_pybuffernd_nparray.diminfo[0].strides = __pyx_pybuffernd_nparray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nparray.diminfo[0].shape = __pyx_pybuffernd_nparray.rcbuffer->pybuffer.shape[0]; |
3674 | |
3675 | /* "tensorflow/python/framework/fast_tensor_util.pyx":40 |
3676 | * tensor_proto, np.ndarray[np.float64_t, ndim=1] nparray): |
3677 | * cdef long i, n |
3678 | * n = nparray.size # <<<<<<<<<<<<<< |
3679 | * for i in range(n): |
3680 | * tensor_proto.double_val.append(nparray[i]) |
3681 | */ |
3682 | __pyx_v_n = __pyx_f_5numpy_7ndarray_4size_size(((PyArrayObject *)__pyx_v_nparray)); |
3683 | |
3684 | /* "tensorflow/python/framework/fast_tensor_util.pyx":41 |
3685 | * cdef long i, n |
3686 | * n = nparray.size |
3687 | * for i in range(n): # <<<<<<<<<<<<<< |
3688 | * tensor_proto.double_val.append(nparray[i]) |
3689 | * |
3690 | */ |
3691 | __pyx_t_1 = __pyx_v_n; |
3692 | __pyx_t_2 = __pyx_t_1; |
3693 | for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { |
3694 | __pyx_v_i = __pyx_t_3; |
3695 | |
3696 | /* "tensorflow/python/framework/fast_tensor_util.pyx":42 |
3697 | * n = nparray.size |
3698 | * for i in range(n): |
3699 | * tensor_proto.double_val.append(nparray[i]) # <<<<<<<<<<<<<< |
3700 | * |
3701 | * |
3702 | */ |
3703 | __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_tensor_proto, __pyx_n_s_double_val); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 42, __pyx_L1_error) |
3704 | __Pyx_GOTREF(__pyx_t_4); |
3705 | __pyx_t_5 = __pyx_v_i; |
3706 | __pyx_t_6 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_nparray.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_nparray.diminfo[0].strides))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 42, __pyx_L1_error) |
3707 | __Pyx_GOTREF(__pyx_t_6); |
3708 | __pyx_t_7 = __Pyx_PyObject_Append(__pyx_t_4, __pyx_t_6); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 42, __pyx_L1_error) |
3709 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
3710 | __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; |
3711 | } |
3712 | |
3713 | /* "tensorflow/python/framework/fast_tensor_util.pyx":37 |
3714 | * |
3715 | * |
3716 | * def AppendFloat64ArrayToTensorProto( # <<<<<<<<<<<<<< |
3717 | * tensor_proto, np.ndarray[np.float64_t, ndim=1] nparray): |
3718 | * cdef long i, n |
3719 | */ |
3720 | |
3721 | /* function exit code */ |
3722 | __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
3723 | goto __pyx_L0; |
3724 | __pyx_L1_error:; |
3725 | __Pyx_XDECREF(__pyx_t_4); |
3726 | __Pyx_XDECREF(__pyx_t_6); |
3727 | { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; |
3728 | __Pyx_PyThreadState_declare |
3729 | __Pyx_PyThreadState_assign |
3730 | __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); |
3731 | __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nparray.rcbuffer->pybuffer); |
3732 | __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} |
3733 | __Pyx_AddTraceback("tensorflow.python.framework.fast_tensor_util.AppendFloat64ArrayToTensorProto" , __pyx_clineno, __pyx_lineno, __pyx_filename); |
3734 | __pyx_r = NULL; |
3735 | goto __pyx_L2; |
3736 | __pyx_L0:; |
3737 | __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nparray.rcbuffer->pybuffer); |
3738 | __pyx_L2:; |
3739 | __Pyx_XGIVEREF(__pyx_r); |
3740 | __Pyx_RefNannyFinishContext(); |
3741 | return __pyx_r; |
3742 | } |
3743 | |
3744 | /* "tensorflow/python/framework/fast_tensor_util.pyx":45 |
3745 | * |
3746 | * |
3747 | * def AppendInt32ArrayToTensorProto( # <<<<<<<<<<<<<< |
3748 | * tensor_proto, np.ndarray[np.int32_t, ndim=1] nparray): |
3749 | * cdef long i, n |
3750 | */ |
3751 | |
3752 | /* Python wrapper */ |
3753 | static PyObject *__pyx_pw_10tensorflow_6python_9framework_16fast_tensor_util_9AppendInt32ArrayToTensorProto(PyObject *__pyx_self, |
3754 | #if CYTHON_METH_FASTCALL |
3755 | PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds |
3756 | #else |
3757 | PyObject *__pyx_args, PyObject *__pyx_kwds |
3758 | #endif |
3759 | ); /*proto*/ |
3760 | static PyMethodDef __pyx_mdef_10tensorflow_6python_9framework_16fast_tensor_util_9AppendInt32ArrayToTensorProto = {"AppendInt32ArrayToTensorProto" , (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_10tensorflow_6python_9framework_16fast_tensor_util_9AppendInt32ArrayToTensorProto, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; |
3761 | static PyObject *__pyx_pw_10tensorflow_6python_9framework_16fast_tensor_util_9AppendInt32ArrayToTensorProto(PyObject *__pyx_self, |
3762 | #if CYTHON_METH_FASTCALL |
3763 | PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds |
3764 | #else |
3765 | PyObject *__pyx_args, PyObject *__pyx_kwds |
3766 | #endif |
3767 | ) { |
3768 | PyObject *__pyx_v_tensor_proto = 0; |
3769 | PyArrayObject *__pyx_v_nparray = 0; |
3770 | #if !CYTHON_METH_FASTCALL |
3771 | CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); |
3772 | #endif |
3773 | CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); |
3774 | int __pyx_lineno = 0; |
3775 | const char *__pyx_filename = NULL; |
3776 | int __pyx_clineno = 0; |
3777 | PyObject *__pyx_r = 0; |
3778 | __Pyx_RefNannyDeclarations |
3779 | __Pyx_RefNannySetupContext("AppendInt32ArrayToTensorProto (wrapper)" , 0); |
3780 | { |
3781 | #if CYTHON_USE_MODULE_STATE |
3782 | PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tensor_proto,&__pyx_n_s_nparray,0}; |
3783 | #else |
3784 | static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tensor_proto,&__pyx_n_s_nparray,0}; |
3785 | #endif |
3786 | PyObject* values[2] = {0,0}; |
3787 | if (__pyx_kwds) { |
3788 | Py_ssize_t kw_args; |
3789 | switch (__pyx_nargs) { |
3790 | case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); |
3791 | CYTHON_FALLTHROUGH; |
3792 | case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); |
3793 | CYTHON_FALLTHROUGH; |
3794 | case 0: break; |
3795 | default: goto __pyx_L5_argtuple_error; |
3796 | } |
3797 | kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); |
3798 | switch (__pyx_nargs) { |
3799 | case 0: |
3800 | if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tensor_proto)) != 0)) kw_args--; |
3801 | else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 45, __pyx_L3_error) |
3802 | else goto __pyx_L5_argtuple_error; |
3803 | CYTHON_FALLTHROUGH; |
3804 | case 1: |
3805 | if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nparray)) != 0)) kw_args--; |
3806 | else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 45, __pyx_L3_error) |
3807 | else { |
3808 | __Pyx_RaiseArgtupleInvalid("AppendInt32ArrayToTensorProto" , 1, 2, 2, 1); __PYX_ERR(0, 45, __pyx_L3_error) |
3809 | } |
3810 | } |
3811 | if (unlikely(kw_args > 0)) { |
3812 | const Py_ssize_t kwd_pos_args = __pyx_nargs; |
3813 | if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "AppendInt32ArrayToTensorProto" ) < 0)) __PYX_ERR(0, 45, __pyx_L3_error) |
3814 | } |
3815 | } else if (unlikely(__pyx_nargs != 2)) { |
3816 | goto __pyx_L5_argtuple_error; |
3817 | } else { |
3818 | values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); |
3819 | values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); |
3820 | } |
3821 | __pyx_v_tensor_proto = values[0]; |
3822 | __pyx_v_nparray = ((PyArrayObject *)values[1]); |
3823 | } |
3824 | goto __pyx_L4_argument_unpacking_done; |
3825 | __pyx_L5_argtuple_error:; |
3826 | __Pyx_RaiseArgtupleInvalid("AppendInt32ArrayToTensorProto" , 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 45, __pyx_L3_error) |
3827 | __pyx_L3_error:; |
3828 | __Pyx_AddTraceback("tensorflow.python.framework.fast_tensor_util.AppendInt32ArrayToTensorProto" , __pyx_clineno, __pyx_lineno, __pyx_filename); |
3829 | __Pyx_RefNannyFinishContext(); |
3830 | return NULL; |
3831 | __pyx_L4_argument_unpacking_done:; |
3832 | if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nparray), __pyx_ptype_5numpy_ndarray, 1, "nparray" , 0))) __PYX_ERR(0, 46, __pyx_L1_error) |
3833 | __pyx_r = __pyx_pf_10tensorflow_6python_9framework_16fast_tensor_util_8AppendInt32ArrayToTensorProto(__pyx_self, __pyx_v_tensor_proto, __pyx_v_nparray); |
3834 | |
3835 | /* function exit code */ |
3836 | goto __pyx_L0; |
3837 | __pyx_L1_error:; |
3838 | __pyx_r = NULL; |
3839 | __pyx_L0:; |
3840 | __Pyx_RefNannyFinishContext(); |
3841 | return __pyx_r; |
3842 | } |
3843 | |
3844 | static PyObject *__pyx_pf_10tensorflow_6python_9framework_16fast_tensor_util_8AppendInt32ArrayToTensorProto(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tensor_proto, PyArrayObject *__pyx_v_nparray) { |
3845 | long __pyx_v_i; |
3846 | long __pyx_v_n; |
3847 | __Pyx_LocalBuf_ND __pyx_pybuffernd_nparray; |
3848 | __Pyx_Buffer __pyx_pybuffer_nparray; |
3849 | PyObject *__pyx_r = NULL; |
3850 | __Pyx_RefNannyDeclarations |
3851 | long __pyx_t_1; |
3852 | long __pyx_t_2; |
3853 | long __pyx_t_3; |
3854 | PyObject *__pyx_t_4 = NULL; |
3855 | Py_ssize_t __pyx_t_5; |
3856 | PyObject *__pyx_t_6 = NULL; |
3857 | int __pyx_t_7; |
3858 | int __pyx_lineno = 0; |
3859 | const char *__pyx_filename = NULL; |
3860 | int __pyx_clineno = 0; |
3861 | __Pyx_RefNannySetupContext("AppendInt32ArrayToTensorProto" , 0); |
3862 | __pyx_pybuffer_nparray.pybuffer.buf = NULL; |
3863 | __pyx_pybuffer_nparray.refcount = 0; |
3864 | __pyx_pybuffernd_nparray.data = NULL; |
3865 | __pyx_pybuffernd_nparray.rcbuffer = &__pyx_pybuffer_nparray; |
3866 | { |
3867 | __Pyx_BufFmt_StackElem __pyx_stack[1]; |
3868 | if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nparray.rcbuffer->pybuffer, (PyObject*)__pyx_v_nparray, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 45, __pyx_L1_error) |
3869 | } |
3870 | __pyx_pybuffernd_nparray.diminfo[0].strides = __pyx_pybuffernd_nparray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nparray.diminfo[0].shape = __pyx_pybuffernd_nparray.rcbuffer->pybuffer.shape[0]; |
3871 | |
3872 | /* "tensorflow/python/framework/fast_tensor_util.pyx":48 |
3873 | * tensor_proto, np.ndarray[np.int32_t, ndim=1] nparray): |
3874 | * cdef long i, n |
3875 | * n = nparray.size # <<<<<<<<<<<<<< |
3876 | * for i in range(n): |
3877 | * tensor_proto.int_val.append(nparray[i]) |
3878 | */ |
3879 | __pyx_v_n = __pyx_f_5numpy_7ndarray_4size_size(((PyArrayObject *)__pyx_v_nparray)); |
3880 | |
3881 | /* "tensorflow/python/framework/fast_tensor_util.pyx":49 |
3882 | * cdef long i, n |
3883 | * n = nparray.size |
3884 | * for i in range(n): # <<<<<<<<<<<<<< |
3885 | * tensor_proto.int_val.append(nparray[i]) |
3886 | * |
3887 | */ |
3888 | __pyx_t_1 = __pyx_v_n; |
3889 | __pyx_t_2 = __pyx_t_1; |
3890 | for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { |
3891 | __pyx_v_i = __pyx_t_3; |
3892 | |
3893 | /* "tensorflow/python/framework/fast_tensor_util.pyx":50 |
3894 | * n = nparray.size |
3895 | * for i in range(n): |
3896 | * tensor_proto.int_val.append(nparray[i]) # <<<<<<<<<<<<<< |
3897 | * |
3898 | * def AppendUInt32ArrayToTensorProto( |
3899 | */ |
3900 | __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_tensor_proto, __pyx_n_s_int_val); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 50, __pyx_L1_error) |
3901 | __Pyx_GOTREF(__pyx_t_4); |
3902 | __pyx_t_5 = __pyx_v_i; |
3903 | __pyx_t_6 = __Pyx_PyInt_From_npy_int32((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_nparray.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_nparray.diminfo[0].strides))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 50, __pyx_L1_error) |
3904 | __Pyx_GOTREF(__pyx_t_6); |
3905 | __pyx_t_7 = __Pyx_PyObject_Append(__pyx_t_4, __pyx_t_6); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 50, __pyx_L1_error) |
3906 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
3907 | __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; |
3908 | } |
3909 | |
3910 | /* "tensorflow/python/framework/fast_tensor_util.pyx":45 |
3911 | * |
3912 | * |
3913 | * def AppendInt32ArrayToTensorProto( # <<<<<<<<<<<<<< |
3914 | * tensor_proto, np.ndarray[np.int32_t, ndim=1] nparray): |
3915 | * cdef long i, n |
3916 | */ |
3917 | |
3918 | /* function exit code */ |
3919 | __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
3920 | goto __pyx_L0; |
3921 | __pyx_L1_error:; |
3922 | __Pyx_XDECREF(__pyx_t_4); |
3923 | __Pyx_XDECREF(__pyx_t_6); |
3924 | { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; |
3925 | __Pyx_PyThreadState_declare |
3926 | __Pyx_PyThreadState_assign |
3927 | __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); |
3928 | __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nparray.rcbuffer->pybuffer); |
3929 | __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} |
3930 | __Pyx_AddTraceback("tensorflow.python.framework.fast_tensor_util.AppendInt32ArrayToTensorProto" , __pyx_clineno, __pyx_lineno, __pyx_filename); |
3931 | __pyx_r = NULL; |
3932 | goto __pyx_L2; |
3933 | __pyx_L0:; |
3934 | __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nparray.rcbuffer->pybuffer); |
3935 | __pyx_L2:; |
3936 | __Pyx_XGIVEREF(__pyx_r); |
3937 | __Pyx_RefNannyFinishContext(); |
3938 | return __pyx_r; |
3939 | } |
3940 | |
3941 | /* "tensorflow/python/framework/fast_tensor_util.pyx":52 |
3942 | * tensor_proto.int_val.append(nparray[i]) |
3943 | * |
3944 | * def AppendUInt32ArrayToTensorProto( # <<<<<<<<<<<<<< |
3945 | * tensor_proto, np.ndarray[np.uint32_t, ndim=1] nparray): |
3946 | * cdef long i, n |
3947 | */ |
3948 | |
3949 | /* Python wrapper */ |
3950 | static PyObject *__pyx_pw_10tensorflow_6python_9framework_16fast_tensor_util_11AppendUInt32ArrayToTensorProto(PyObject *__pyx_self, |
3951 | #if CYTHON_METH_FASTCALL |
3952 | PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds |
3953 | #else |
3954 | PyObject *__pyx_args, PyObject *__pyx_kwds |
3955 | #endif |
3956 | ); /*proto*/ |
3957 | static PyMethodDef __pyx_mdef_10tensorflow_6python_9framework_16fast_tensor_util_11AppendUInt32ArrayToTensorProto = {"AppendUInt32ArrayToTensorProto" , (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_10tensorflow_6python_9framework_16fast_tensor_util_11AppendUInt32ArrayToTensorProto, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; |
3958 | static PyObject *__pyx_pw_10tensorflow_6python_9framework_16fast_tensor_util_11AppendUInt32ArrayToTensorProto(PyObject *__pyx_self, |
3959 | #if CYTHON_METH_FASTCALL |
3960 | PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds |
3961 | #else |
3962 | PyObject *__pyx_args, PyObject *__pyx_kwds |
3963 | #endif |
3964 | ) { |
3965 | PyObject *__pyx_v_tensor_proto = 0; |
3966 | PyArrayObject *__pyx_v_nparray = 0; |
3967 | #if !CYTHON_METH_FASTCALL |
3968 | CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); |
3969 | #endif |
3970 | CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); |
3971 | int __pyx_lineno = 0; |
3972 | const char *__pyx_filename = NULL; |
3973 | int __pyx_clineno = 0; |
3974 | PyObject *__pyx_r = 0; |
3975 | __Pyx_RefNannyDeclarations |
3976 | __Pyx_RefNannySetupContext("AppendUInt32ArrayToTensorProto (wrapper)" , 0); |
3977 | { |
3978 | #if CYTHON_USE_MODULE_STATE |
3979 | PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tensor_proto,&__pyx_n_s_nparray,0}; |
3980 | #else |
3981 | static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tensor_proto,&__pyx_n_s_nparray,0}; |
3982 | #endif |
3983 | PyObject* values[2] = {0,0}; |
3984 | if (__pyx_kwds) { |
3985 | Py_ssize_t kw_args; |
3986 | switch (__pyx_nargs) { |
3987 | case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); |
3988 | CYTHON_FALLTHROUGH; |
3989 | case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); |
3990 | CYTHON_FALLTHROUGH; |
3991 | case 0: break; |
3992 | default: goto __pyx_L5_argtuple_error; |
3993 | } |
3994 | kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); |
3995 | switch (__pyx_nargs) { |
3996 | case 0: |
3997 | if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tensor_proto)) != 0)) kw_args--; |
3998 | else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 52, __pyx_L3_error) |
3999 | else goto __pyx_L5_argtuple_error; |
4000 | CYTHON_FALLTHROUGH; |
4001 | case 1: |
4002 | if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nparray)) != 0)) kw_args--; |
4003 | else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 52, __pyx_L3_error) |
4004 | else { |
4005 | __Pyx_RaiseArgtupleInvalid("AppendUInt32ArrayToTensorProto" , 1, 2, 2, 1); __PYX_ERR(0, 52, __pyx_L3_error) |
4006 | } |
4007 | } |
4008 | if (unlikely(kw_args > 0)) { |
4009 | const Py_ssize_t kwd_pos_args = __pyx_nargs; |
4010 | if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "AppendUInt32ArrayToTensorProto" ) < 0)) __PYX_ERR(0, 52, __pyx_L3_error) |
4011 | } |
4012 | } else if (unlikely(__pyx_nargs != 2)) { |
4013 | goto __pyx_L5_argtuple_error; |
4014 | } else { |
4015 | values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); |
4016 | values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); |
4017 | } |
4018 | __pyx_v_tensor_proto = values[0]; |
4019 | __pyx_v_nparray = ((PyArrayObject *)values[1]); |
4020 | } |
4021 | goto __pyx_L4_argument_unpacking_done; |
4022 | __pyx_L5_argtuple_error:; |
4023 | __Pyx_RaiseArgtupleInvalid("AppendUInt32ArrayToTensorProto" , 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 52, __pyx_L3_error) |
4024 | __pyx_L3_error:; |
4025 | __Pyx_AddTraceback("tensorflow.python.framework.fast_tensor_util.AppendUInt32ArrayToTensorProto" , __pyx_clineno, __pyx_lineno, __pyx_filename); |
4026 | __Pyx_RefNannyFinishContext(); |
4027 | return NULL; |
4028 | __pyx_L4_argument_unpacking_done:; |
4029 | if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nparray), __pyx_ptype_5numpy_ndarray, 1, "nparray" , 0))) __PYX_ERR(0, 53, __pyx_L1_error) |
4030 | __pyx_r = __pyx_pf_10tensorflow_6python_9framework_16fast_tensor_util_10AppendUInt32ArrayToTensorProto(__pyx_self, __pyx_v_tensor_proto, __pyx_v_nparray); |
4031 | |
4032 | /* function exit code */ |
4033 | goto __pyx_L0; |
4034 | __pyx_L1_error:; |
4035 | __pyx_r = NULL; |
4036 | __pyx_L0:; |
4037 | __Pyx_RefNannyFinishContext(); |
4038 | return __pyx_r; |
4039 | } |
4040 | |
4041 | static PyObject *__pyx_pf_10tensorflow_6python_9framework_16fast_tensor_util_10AppendUInt32ArrayToTensorProto(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tensor_proto, PyArrayObject *__pyx_v_nparray) { |
4042 | long __pyx_v_i; |
4043 | long __pyx_v_n; |
4044 | __Pyx_LocalBuf_ND __pyx_pybuffernd_nparray; |
4045 | __Pyx_Buffer __pyx_pybuffer_nparray; |
4046 | PyObject *__pyx_r = NULL; |
4047 | __Pyx_RefNannyDeclarations |
4048 | long __pyx_t_1; |
4049 | long __pyx_t_2; |
4050 | long __pyx_t_3; |
4051 | PyObject *__pyx_t_4 = NULL; |
4052 | Py_ssize_t __pyx_t_5; |
4053 | PyObject *__pyx_t_6 = NULL; |
4054 | int __pyx_t_7; |
4055 | int __pyx_lineno = 0; |
4056 | const char *__pyx_filename = NULL; |
4057 | int __pyx_clineno = 0; |
4058 | __Pyx_RefNannySetupContext("AppendUInt32ArrayToTensorProto" , 0); |
4059 | __pyx_pybuffer_nparray.pybuffer.buf = NULL; |
4060 | __pyx_pybuffer_nparray.refcount = 0; |
4061 | __pyx_pybuffernd_nparray.data = NULL; |
4062 | __pyx_pybuffernd_nparray.rcbuffer = &__pyx_pybuffer_nparray; |
4063 | { |
4064 | __Pyx_BufFmt_StackElem __pyx_stack[1]; |
4065 | if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nparray.rcbuffer->pybuffer, (PyObject*)__pyx_v_nparray, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 52, __pyx_L1_error) |
4066 | } |
4067 | __pyx_pybuffernd_nparray.diminfo[0].strides = __pyx_pybuffernd_nparray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nparray.diminfo[0].shape = __pyx_pybuffernd_nparray.rcbuffer->pybuffer.shape[0]; |
4068 | |
4069 | /* "tensorflow/python/framework/fast_tensor_util.pyx":55 |
4070 | * tensor_proto, np.ndarray[np.uint32_t, ndim=1] nparray): |
4071 | * cdef long i, n |
4072 | * n = nparray.size # <<<<<<<<<<<<<< |
4073 | * for i in range(n): |
4074 | * tensor_proto.uint32_val.append(nparray[i]) |
4075 | */ |
4076 | __pyx_v_n = __pyx_f_5numpy_7ndarray_4size_size(((PyArrayObject *)__pyx_v_nparray)); |
4077 | |
4078 | /* "tensorflow/python/framework/fast_tensor_util.pyx":56 |
4079 | * cdef long i, n |
4080 | * n = nparray.size |
4081 | * for i in range(n): # <<<<<<<<<<<<<< |
4082 | * tensor_proto.uint32_val.append(nparray[i]) |
4083 | * |
4084 | */ |
4085 | __pyx_t_1 = __pyx_v_n; |
4086 | __pyx_t_2 = __pyx_t_1; |
4087 | for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { |
4088 | __pyx_v_i = __pyx_t_3; |
4089 | |
4090 | /* "tensorflow/python/framework/fast_tensor_util.pyx":57 |
4091 | * n = nparray.size |
4092 | * for i in range(n): |
4093 | * tensor_proto.uint32_val.append(nparray[i]) # <<<<<<<<<<<<<< |
4094 | * |
4095 | * def AppendInt64ArrayToTensorProto( |
4096 | */ |
4097 | __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_tensor_proto, __pyx_n_s_uint32_val); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 57, __pyx_L1_error) |
4098 | __Pyx_GOTREF(__pyx_t_4); |
4099 | __pyx_t_5 = __pyx_v_i; |
4100 | __pyx_t_6 = __Pyx_PyInt_From_npy_uint32((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint32_t *, __pyx_pybuffernd_nparray.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_nparray.diminfo[0].strides))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 57, __pyx_L1_error) |
4101 | __Pyx_GOTREF(__pyx_t_6); |
4102 | __pyx_t_7 = __Pyx_PyObject_Append(__pyx_t_4, __pyx_t_6); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 57, __pyx_L1_error) |
4103 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
4104 | __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; |
4105 | } |
4106 | |
4107 | /* "tensorflow/python/framework/fast_tensor_util.pyx":52 |
4108 | * tensor_proto.int_val.append(nparray[i]) |
4109 | * |
4110 | * def AppendUInt32ArrayToTensorProto( # <<<<<<<<<<<<<< |
4111 | * tensor_proto, np.ndarray[np.uint32_t, ndim=1] nparray): |
4112 | * cdef long i, n |
4113 | */ |
4114 | |
4115 | /* function exit code */ |
4116 | __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
4117 | goto __pyx_L0; |
4118 | __pyx_L1_error:; |
4119 | __Pyx_XDECREF(__pyx_t_4); |
4120 | __Pyx_XDECREF(__pyx_t_6); |
4121 | { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; |
4122 | __Pyx_PyThreadState_declare |
4123 | __Pyx_PyThreadState_assign |
4124 | __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); |
4125 | __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nparray.rcbuffer->pybuffer); |
4126 | __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} |
4127 | __Pyx_AddTraceback("tensorflow.python.framework.fast_tensor_util.AppendUInt32ArrayToTensorProto" , __pyx_clineno, __pyx_lineno, __pyx_filename); |
4128 | __pyx_r = NULL; |
4129 | goto __pyx_L2; |
4130 | __pyx_L0:; |
4131 | __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nparray.rcbuffer->pybuffer); |
4132 | __pyx_L2:; |
4133 | __Pyx_XGIVEREF(__pyx_r); |
4134 | __Pyx_RefNannyFinishContext(); |
4135 | return __pyx_r; |
4136 | } |
4137 | |
4138 | /* "tensorflow/python/framework/fast_tensor_util.pyx":59 |
4139 | * tensor_proto.uint32_val.append(nparray[i]) |
4140 | * |
4141 | * def AppendInt64ArrayToTensorProto( # <<<<<<<<<<<<<< |
4142 | * tensor_proto, np.ndarray[np.int64_t, ndim=1] nparray): |
4143 | * cdef long i, n |
4144 | */ |
4145 | |
4146 | /* Python wrapper */ |
4147 | static PyObject *__pyx_pw_10tensorflow_6python_9framework_16fast_tensor_util_13AppendInt64ArrayToTensorProto(PyObject *__pyx_self, |
4148 | #if CYTHON_METH_FASTCALL |
4149 | PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds |
4150 | #else |
4151 | PyObject *__pyx_args, PyObject *__pyx_kwds |
4152 | #endif |
4153 | ); /*proto*/ |
4154 | static PyMethodDef __pyx_mdef_10tensorflow_6python_9framework_16fast_tensor_util_13AppendInt64ArrayToTensorProto = {"AppendInt64ArrayToTensorProto" , (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_10tensorflow_6python_9framework_16fast_tensor_util_13AppendInt64ArrayToTensorProto, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; |
4155 | static PyObject *__pyx_pw_10tensorflow_6python_9framework_16fast_tensor_util_13AppendInt64ArrayToTensorProto(PyObject *__pyx_self, |
4156 | #if CYTHON_METH_FASTCALL |
4157 | PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds |
4158 | #else |
4159 | PyObject *__pyx_args, PyObject *__pyx_kwds |
4160 | #endif |
4161 | ) { |
4162 | PyObject *__pyx_v_tensor_proto = 0; |
4163 | PyArrayObject *__pyx_v_nparray = 0; |
4164 | #if !CYTHON_METH_FASTCALL |
4165 | CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); |
4166 | #endif |
4167 | CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); |
4168 | int __pyx_lineno = 0; |
4169 | const char *__pyx_filename = NULL; |
4170 | int __pyx_clineno = 0; |
4171 | PyObject *__pyx_r = 0; |
4172 | __Pyx_RefNannyDeclarations |
4173 | __Pyx_RefNannySetupContext("AppendInt64ArrayToTensorProto (wrapper)" , 0); |
4174 | { |
4175 | #if CYTHON_USE_MODULE_STATE |
4176 | PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tensor_proto,&__pyx_n_s_nparray,0}; |
4177 | #else |
4178 | static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tensor_proto,&__pyx_n_s_nparray,0}; |
4179 | #endif |
4180 | PyObject* values[2] = {0,0}; |
4181 | if (__pyx_kwds) { |
4182 | Py_ssize_t kw_args; |
4183 | switch (__pyx_nargs) { |
4184 | case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); |
4185 | CYTHON_FALLTHROUGH; |
4186 | case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); |
4187 | CYTHON_FALLTHROUGH; |
4188 | case 0: break; |
4189 | default: goto __pyx_L5_argtuple_error; |
4190 | } |
4191 | kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); |
4192 | switch (__pyx_nargs) { |
4193 | case 0: |
4194 | if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tensor_proto)) != 0)) kw_args--; |
4195 | else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 59, __pyx_L3_error) |
4196 | else goto __pyx_L5_argtuple_error; |
4197 | CYTHON_FALLTHROUGH; |
4198 | case 1: |
4199 | if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nparray)) != 0)) kw_args--; |
4200 | else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 59, __pyx_L3_error) |
4201 | else { |
4202 | __Pyx_RaiseArgtupleInvalid("AppendInt64ArrayToTensorProto" , 1, 2, 2, 1); __PYX_ERR(0, 59, __pyx_L3_error) |
4203 | } |
4204 | } |
4205 | if (unlikely(kw_args > 0)) { |
4206 | const Py_ssize_t kwd_pos_args = __pyx_nargs; |
4207 | if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "AppendInt64ArrayToTensorProto" ) < 0)) __PYX_ERR(0, 59, __pyx_L3_error) |
4208 | } |
4209 | } else if (unlikely(__pyx_nargs != 2)) { |
4210 | goto __pyx_L5_argtuple_error; |
4211 | } else { |
4212 | values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); |
4213 | values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); |
4214 | } |
4215 | __pyx_v_tensor_proto = values[0]; |
4216 | __pyx_v_nparray = ((PyArrayObject *)values[1]); |
4217 | } |
4218 | goto __pyx_L4_argument_unpacking_done; |
4219 | __pyx_L5_argtuple_error:; |
4220 | __Pyx_RaiseArgtupleInvalid("AppendInt64ArrayToTensorProto" , 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 59, __pyx_L3_error) |
4221 | __pyx_L3_error:; |
4222 | __Pyx_AddTraceback("tensorflow.python.framework.fast_tensor_util.AppendInt64ArrayToTensorProto" , __pyx_clineno, __pyx_lineno, __pyx_filename); |
4223 | __Pyx_RefNannyFinishContext(); |
4224 | return NULL; |
4225 | __pyx_L4_argument_unpacking_done:; |
4226 | if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nparray), __pyx_ptype_5numpy_ndarray, 1, "nparray" , 0))) __PYX_ERR(0, 60, __pyx_L1_error) |
4227 | __pyx_r = __pyx_pf_10tensorflow_6python_9framework_16fast_tensor_util_12AppendInt64ArrayToTensorProto(__pyx_self, __pyx_v_tensor_proto, __pyx_v_nparray); |
4228 | |
4229 | /* function exit code */ |
4230 | goto __pyx_L0; |
4231 | __pyx_L1_error:; |
4232 | __pyx_r = NULL; |
4233 | __pyx_L0:; |
4234 | __Pyx_RefNannyFinishContext(); |
4235 | return __pyx_r; |
4236 | } |
4237 | |
4238 | static PyObject *__pyx_pf_10tensorflow_6python_9framework_16fast_tensor_util_12AppendInt64ArrayToTensorProto(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tensor_proto, PyArrayObject *__pyx_v_nparray) { |
4239 | long __pyx_v_i; |
4240 | long __pyx_v_n; |
4241 | __Pyx_LocalBuf_ND __pyx_pybuffernd_nparray; |
4242 | __Pyx_Buffer __pyx_pybuffer_nparray; |
4243 | PyObject *__pyx_r = NULL; |
4244 | __Pyx_RefNannyDeclarations |
4245 | long __pyx_t_1; |
4246 | long __pyx_t_2; |
4247 | long __pyx_t_3; |
4248 | PyObject *__pyx_t_4 = NULL; |
4249 | Py_ssize_t __pyx_t_5; |
4250 | PyObject *__pyx_t_6 = NULL; |
4251 | int __pyx_t_7; |
4252 | int __pyx_lineno = 0; |
4253 | const char *__pyx_filename = NULL; |
4254 | int __pyx_clineno = 0; |
4255 | __Pyx_RefNannySetupContext("AppendInt64ArrayToTensorProto" , 0); |
4256 | __pyx_pybuffer_nparray.pybuffer.buf = NULL; |
4257 | __pyx_pybuffer_nparray.refcount = 0; |
4258 | __pyx_pybuffernd_nparray.data = NULL; |
4259 | __pyx_pybuffernd_nparray.rcbuffer = &__pyx_pybuffer_nparray; |
4260 | { |
4261 | __Pyx_BufFmt_StackElem __pyx_stack[1]; |
4262 | if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nparray.rcbuffer->pybuffer, (PyObject*)__pyx_v_nparray, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 59, __pyx_L1_error) |
4263 | } |
4264 | __pyx_pybuffernd_nparray.diminfo[0].strides = __pyx_pybuffernd_nparray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nparray.diminfo[0].shape = __pyx_pybuffernd_nparray.rcbuffer->pybuffer.shape[0]; |
4265 | |
4266 | /* "tensorflow/python/framework/fast_tensor_util.pyx":62 |
4267 | * tensor_proto, np.ndarray[np.int64_t, ndim=1] nparray): |
4268 | * cdef long i, n |
4269 | * n = nparray.size # <<<<<<<<<<<<<< |
4270 | * for i in range(n): |
4271 | * tensor_proto.int64_val.append(nparray[i]) |
4272 | */ |
4273 | __pyx_v_n = __pyx_f_5numpy_7ndarray_4size_size(((PyArrayObject *)__pyx_v_nparray)); |
4274 | |
4275 | /* "tensorflow/python/framework/fast_tensor_util.pyx":63 |
4276 | * cdef long i, n |
4277 | * n = nparray.size |
4278 | * for i in range(n): # <<<<<<<<<<<<<< |
4279 | * tensor_proto.int64_val.append(nparray[i]) |
4280 | * |
4281 | */ |
4282 | __pyx_t_1 = __pyx_v_n; |
4283 | __pyx_t_2 = __pyx_t_1; |
4284 | for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { |
4285 | __pyx_v_i = __pyx_t_3; |
4286 | |
4287 | /* "tensorflow/python/framework/fast_tensor_util.pyx":64 |
4288 | * n = nparray.size |
4289 | * for i in range(n): |
4290 | * tensor_proto.int64_val.append(nparray[i]) # <<<<<<<<<<<<<< |
4291 | * |
4292 | * def AppendUInt64ArrayToTensorProto( |
4293 | */ |
4294 | __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_tensor_proto, __pyx_n_s_int64_val); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 64, __pyx_L1_error) |
4295 | __Pyx_GOTREF(__pyx_t_4); |
4296 | __pyx_t_5 = __pyx_v_i; |
4297 | __pyx_t_6 = __Pyx_PyInt_From_npy_int64((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_nparray.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_nparray.diminfo[0].strides))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 64, __pyx_L1_error) |
4298 | __Pyx_GOTREF(__pyx_t_6); |
4299 | __pyx_t_7 = __Pyx_PyObject_Append(__pyx_t_4, __pyx_t_6); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 64, __pyx_L1_error) |
4300 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
4301 | __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; |
4302 | } |
4303 | |
4304 | /* "tensorflow/python/framework/fast_tensor_util.pyx":59 |
4305 | * tensor_proto.uint32_val.append(nparray[i]) |
4306 | * |
4307 | * def AppendInt64ArrayToTensorProto( # <<<<<<<<<<<<<< |
4308 | * tensor_proto, np.ndarray[np.int64_t, ndim=1] nparray): |
4309 | * cdef long i, n |
4310 | */ |
4311 | |
4312 | /* function exit code */ |
4313 | __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
4314 | goto __pyx_L0; |
4315 | __pyx_L1_error:; |
4316 | __Pyx_XDECREF(__pyx_t_4); |
4317 | __Pyx_XDECREF(__pyx_t_6); |
4318 | { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; |
4319 | __Pyx_PyThreadState_declare |
4320 | __Pyx_PyThreadState_assign |
4321 | __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); |
4322 | __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nparray.rcbuffer->pybuffer); |
4323 | __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} |
4324 | __Pyx_AddTraceback("tensorflow.python.framework.fast_tensor_util.AppendInt64ArrayToTensorProto" , __pyx_clineno, __pyx_lineno, __pyx_filename); |
4325 | __pyx_r = NULL; |
4326 | goto __pyx_L2; |
4327 | __pyx_L0:; |
4328 | __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nparray.rcbuffer->pybuffer); |
4329 | __pyx_L2:; |
4330 | __Pyx_XGIVEREF(__pyx_r); |
4331 | __Pyx_RefNannyFinishContext(); |
4332 | return __pyx_r; |
4333 | } |
4334 | |
4335 | /* "tensorflow/python/framework/fast_tensor_util.pyx":66 |
4336 | * tensor_proto.int64_val.append(nparray[i]) |
4337 | * |
4338 | * def AppendUInt64ArrayToTensorProto( # <<<<<<<<<<<<<< |
4339 | * tensor_proto, np.ndarray[np.uint64_t, ndim=1] nparray): |
4340 | * cdef long i, n |
4341 | */ |
4342 | |
4343 | /* Python wrapper */ |
4344 | static PyObject *__pyx_pw_10tensorflow_6python_9framework_16fast_tensor_util_15AppendUInt64ArrayToTensorProto(PyObject *__pyx_self, |
4345 | #if CYTHON_METH_FASTCALL |
4346 | PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds |
4347 | #else |
4348 | PyObject *__pyx_args, PyObject *__pyx_kwds |
4349 | #endif |
4350 | ); /*proto*/ |
4351 | static PyMethodDef __pyx_mdef_10tensorflow_6python_9framework_16fast_tensor_util_15AppendUInt64ArrayToTensorProto = {"AppendUInt64ArrayToTensorProto" , (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_10tensorflow_6python_9framework_16fast_tensor_util_15AppendUInt64ArrayToTensorProto, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; |
4352 | static PyObject *__pyx_pw_10tensorflow_6python_9framework_16fast_tensor_util_15AppendUInt64ArrayToTensorProto(PyObject *__pyx_self, |
4353 | #if CYTHON_METH_FASTCALL |
4354 | PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds |
4355 | #else |
4356 | PyObject *__pyx_args, PyObject *__pyx_kwds |
4357 | #endif |
4358 | ) { |
4359 | PyObject *__pyx_v_tensor_proto = 0; |
4360 | PyArrayObject *__pyx_v_nparray = 0; |
4361 | #if !CYTHON_METH_FASTCALL |
4362 | CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); |
4363 | #endif |
4364 | CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); |
4365 | int __pyx_lineno = 0; |
4366 | const char *__pyx_filename = NULL; |
4367 | int __pyx_clineno = 0; |
4368 | PyObject *__pyx_r = 0; |
4369 | __Pyx_RefNannyDeclarations |
4370 | __Pyx_RefNannySetupContext("AppendUInt64ArrayToTensorProto (wrapper)" , 0); |
4371 | { |
4372 | #if CYTHON_USE_MODULE_STATE |
4373 | PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tensor_proto,&__pyx_n_s_nparray,0}; |
4374 | #else |
4375 | static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tensor_proto,&__pyx_n_s_nparray,0}; |
4376 | #endif |
4377 | PyObject* values[2] = {0,0}; |
4378 | if (__pyx_kwds) { |
4379 | Py_ssize_t kw_args; |
4380 | switch (__pyx_nargs) { |
4381 | case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); |
4382 | CYTHON_FALLTHROUGH; |
4383 | case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); |
4384 | CYTHON_FALLTHROUGH; |
4385 | case 0: break; |
4386 | default: goto __pyx_L5_argtuple_error; |
4387 | } |
4388 | kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); |
4389 | switch (__pyx_nargs) { |
4390 | case 0: |
4391 | if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tensor_proto)) != 0)) kw_args--; |
4392 | else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 66, __pyx_L3_error) |
4393 | else goto __pyx_L5_argtuple_error; |
4394 | CYTHON_FALLTHROUGH; |
4395 | case 1: |
4396 | if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nparray)) != 0)) kw_args--; |
4397 | else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 66, __pyx_L3_error) |
4398 | else { |
4399 | __Pyx_RaiseArgtupleInvalid("AppendUInt64ArrayToTensorProto" , 1, 2, 2, 1); __PYX_ERR(0, 66, __pyx_L3_error) |
4400 | } |
4401 | } |
4402 | if (unlikely(kw_args > 0)) { |
4403 | const Py_ssize_t kwd_pos_args = __pyx_nargs; |
4404 | if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "AppendUInt64ArrayToTensorProto" ) < 0)) __PYX_ERR(0, 66, __pyx_L3_error) |
4405 | } |
4406 | } else if (unlikely(__pyx_nargs != 2)) { |
4407 | goto __pyx_L5_argtuple_error; |
4408 | } else { |
4409 | values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); |
4410 | values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); |
4411 | } |
4412 | __pyx_v_tensor_proto = values[0]; |
4413 | __pyx_v_nparray = ((PyArrayObject *)values[1]); |
4414 | } |
4415 | goto __pyx_L4_argument_unpacking_done; |
4416 | __pyx_L5_argtuple_error:; |
4417 | __Pyx_RaiseArgtupleInvalid("AppendUInt64ArrayToTensorProto" , 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 66, __pyx_L3_error) |
4418 | __pyx_L3_error:; |
4419 | __Pyx_AddTraceback("tensorflow.python.framework.fast_tensor_util.AppendUInt64ArrayToTensorProto" , __pyx_clineno, __pyx_lineno, __pyx_filename); |
4420 | __Pyx_RefNannyFinishContext(); |
4421 | return NULL; |
4422 | __pyx_L4_argument_unpacking_done:; |
4423 | if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nparray), __pyx_ptype_5numpy_ndarray, 1, "nparray" , 0))) __PYX_ERR(0, 67, __pyx_L1_error) |
4424 | __pyx_r = __pyx_pf_10tensorflow_6python_9framework_16fast_tensor_util_14AppendUInt64ArrayToTensorProto(__pyx_self, __pyx_v_tensor_proto, __pyx_v_nparray); |
4425 | |
4426 | /* function exit code */ |
4427 | goto __pyx_L0; |
4428 | __pyx_L1_error:; |
4429 | __pyx_r = NULL; |
4430 | __pyx_L0:; |
4431 | __Pyx_RefNannyFinishContext(); |
4432 | return __pyx_r; |
4433 | } |
4434 | |
4435 | static PyObject *__pyx_pf_10tensorflow_6python_9framework_16fast_tensor_util_14AppendUInt64ArrayToTensorProto(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tensor_proto, PyArrayObject *__pyx_v_nparray) { |
4436 | long __pyx_v_i; |
4437 | long __pyx_v_n; |
4438 | __Pyx_LocalBuf_ND __pyx_pybuffernd_nparray; |
4439 | __Pyx_Buffer __pyx_pybuffer_nparray; |
4440 | PyObject *__pyx_r = NULL; |
4441 | __Pyx_RefNannyDeclarations |
4442 | long __pyx_t_1; |
4443 | long __pyx_t_2; |
4444 | long __pyx_t_3; |
4445 | PyObject *__pyx_t_4 = NULL; |
4446 | Py_ssize_t __pyx_t_5; |
4447 | PyObject *__pyx_t_6 = NULL; |
4448 | int __pyx_t_7; |
4449 | int __pyx_lineno = 0; |
4450 | const char *__pyx_filename = NULL; |
4451 | int __pyx_clineno = 0; |
4452 | __Pyx_RefNannySetupContext("AppendUInt64ArrayToTensorProto" , 0); |
4453 | __pyx_pybuffer_nparray.pybuffer.buf = NULL; |
4454 | __pyx_pybuffer_nparray.refcount = 0; |
4455 | __pyx_pybuffernd_nparray.data = NULL; |
4456 | __pyx_pybuffernd_nparray.rcbuffer = &__pyx_pybuffer_nparray; |
4457 | { |
4458 | __Pyx_BufFmt_StackElem __pyx_stack[1]; |
4459 | if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nparray.rcbuffer->pybuffer, (PyObject*)__pyx_v_nparray, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 66, __pyx_L1_error) |
4460 | } |
4461 | __pyx_pybuffernd_nparray.diminfo[0].strides = __pyx_pybuffernd_nparray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nparray.diminfo[0].shape = __pyx_pybuffernd_nparray.rcbuffer->pybuffer.shape[0]; |
4462 | |
4463 | /* "tensorflow/python/framework/fast_tensor_util.pyx":69 |
4464 | * tensor_proto, np.ndarray[np.uint64_t, ndim=1] nparray): |
4465 | * cdef long i, n |
4466 | * n = nparray.size # <<<<<<<<<<<<<< |
4467 | * for i in range(n): |
4468 | * tensor_proto.uint64_val.append(nparray[i]) |
4469 | */ |
4470 | __pyx_v_n = __pyx_f_5numpy_7ndarray_4size_size(((PyArrayObject *)__pyx_v_nparray)); |
4471 | |
4472 | /* "tensorflow/python/framework/fast_tensor_util.pyx":70 |
4473 | * cdef long i, n |
4474 | * n = nparray.size |
4475 | * for i in range(n): # <<<<<<<<<<<<<< |
4476 | * tensor_proto.uint64_val.append(nparray[i]) |
4477 | * |
4478 | */ |
4479 | __pyx_t_1 = __pyx_v_n; |
4480 | __pyx_t_2 = __pyx_t_1; |
4481 | for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { |
4482 | __pyx_v_i = __pyx_t_3; |
4483 | |
4484 | /* "tensorflow/python/framework/fast_tensor_util.pyx":71 |
4485 | * n = nparray.size |
4486 | * for i in range(n): |
4487 | * tensor_proto.uint64_val.append(nparray[i]) # <<<<<<<<<<<<<< |
4488 | * |
4489 | * def AppendUInt8ArrayToTensorProto( |
4490 | */ |
4491 | __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_tensor_proto, __pyx_n_s_uint64_val); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 71, __pyx_L1_error) |
4492 | __Pyx_GOTREF(__pyx_t_4); |
4493 | __pyx_t_5 = __pyx_v_i; |
4494 | __pyx_t_6 = __Pyx_PyInt_From_npy_uint64((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_nparray.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_nparray.diminfo[0].strides))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 71, __pyx_L1_error) |
4495 | __Pyx_GOTREF(__pyx_t_6); |
4496 | __pyx_t_7 = __Pyx_PyObject_Append(__pyx_t_4, __pyx_t_6); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 71, __pyx_L1_error) |
4497 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
4498 | __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; |
4499 | } |
4500 | |
4501 | /* "tensorflow/python/framework/fast_tensor_util.pyx":66 |
4502 | * tensor_proto.int64_val.append(nparray[i]) |
4503 | * |
4504 | * def AppendUInt64ArrayToTensorProto( # <<<<<<<<<<<<<< |
4505 | * tensor_proto, np.ndarray[np.uint64_t, ndim=1] nparray): |
4506 | * cdef long i, n |
4507 | */ |
4508 | |
4509 | /* function exit code */ |
4510 | __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
4511 | goto __pyx_L0; |
4512 | __pyx_L1_error:; |
4513 | __Pyx_XDECREF(__pyx_t_4); |
4514 | __Pyx_XDECREF(__pyx_t_6); |
4515 | { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; |
4516 | __Pyx_PyThreadState_declare |
4517 | __Pyx_PyThreadState_assign |
4518 | __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); |
4519 | __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nparray.rcbuffer->pybuffer); |
4520 | __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} |
4521 | __Pyx_AddTraceback("tensorflow.python.framework.fast_tensor_util.AppendUInt64ArrayToTensorProto" , __pyx_clineno, __pyx_lineno, __pyx_filename); |
4522 | __pyx_r = NULL; |
4523 | goto __pyx_L2; |
4524 | __pyx_L0:; |
4525 | __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nparray.rcbuffer->pybuffer); |
4526 | __pyx_L2:; |
4527 | __Pyx_XGIVEREF(__pyx_r); |
4528 | __Pyx_RefNannyFinishContext(); |
4529 | return __pyx_r; |
4530 | } |
4531 | |
4532 | /* "tensorflow/python/framework/fast_tensor_util.pyx":73 |
4533 | * tensor_proto.uint64_val.append(nparray[i]) |
4534 | * |
4535 | * def AppendUInt8ArrayToTensorProto( # <<<<<<<<<<<<<< |
4536 | * tensor_proto, np.ndarray[np.uint8_t, ndim=1] nparray): |
4537 | * cdef long i, n |
4538 | */ |
4539 | |
4540 | /* Python wrapper */ |
4541 | static PyObject *__pyx_pw_10tensorflow_6python_9framework_16fast_tensor_util_17AppendUInt8ArrayToTensorProto(PyObject *__pyx_self, |
4542 | #if CYTHON_METH_FASTCALL |
4543 | PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds |
4544 | #else |
4545 | PyObject *__pyx_args, PyObject *__pyx_kwds |
4546 | #endif |
4547 | ); /*proto*/ |
4548 | static PyMethodDef __pyx_mdef_10tensorflow_6python_9framework_16fast_tensor_util_17AppendUInt8ArrayToTensorProto = {"AppendUInt8ArrayToTensorProto" , (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_10tensorflow_6python_9framework_16fast_tensor_util_17AppendUInt8ArrayToTensorProto, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; |
4549 | static PyObject *__pyx_pw_10tensorflow_6python_9framework_16fast_tensor_util_17AppendUInt8ArrayToTensorProto(PyObject *__pyx_self, |
4550 | #if CYTHON_METH_FASTCALL |
4551 | PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds |
4552 | #else |
4553 | PyObject *__pyx_args, PyObject *__pyx_kwds |
4554 | #endif |
4555 | ) { |
4556 | PyObject *__pyx_v_tensor_proto = 0; |
4557 | PyArrayObject *__pyx_v_nparray = 0; |
4558 | #if !CYTHON_METH_FASTCALL |
4559 | CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); |
4560 | #endif |
4561 | CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); |
4562 | int __pyx_lineno = 0; |
4563 | const char *__pyx_filename = NULL; |
4564 | int __pyx_clineno = 0; |
4565 | PyObject *__pyx_r = 0; |
4566 | __Pyx_RefNannyDeclarations |
4567 | __Pyx_RefNannySetupContext("AppendUInt8ArrayToTensorProto (wrapper)" , 0); |
4568 | { |
4569 | #if CYTHON_USE_MODULE_STATE |
4570 | PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tensor_proto,&__pyx_n_s_nparray,0}; |
4571 | #else |
4572 | static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tensor_proto,&__pyx_n_s_nparray,0}; |
4573 | #endif |
4574 | PyObject* values[2] = {0,0}; |
4575 | if (__pyx_kwds) { |
4576 | Py_ssize_t kw_args; |
4577 | switch (__pyx_nargs) { |
4578 | case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); |
4579 | CYTHON_FALLTHROUGH; |
4580 | case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); |
4581 | CYTHON_FALLTHROUGH; |
4582 | case 0: break; |
4583 | default: goto __pyx_L5_argtuple_error; |
4584 | } |
4585 | kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); |
4586 | switch (__pyx_nargs) { |
4587 | case 0: |
4588 | if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tensor_proto)) != 0)) kw_args--; |
4589 | else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 73, __pyx_L3_error) |
4590 | else goto __pyx_L5_argtuple_error; |
4591 | CYTHON_FALLTHROUGH; |
4592 | case 1: |
4593 | if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nparray)) != 0)) kw_args--; |
4594 | else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 73, __pyx_L3_error) |
4595 | else { |
4596 | __Pyx_RaiseArgtupleInvalid("AppendUInt8ArrayToTensorProto" , 1, 2, 2, 1); __PYX_ERR(0, 73, __pyx_L3_error) |
4597 | } |
4598 | } |
4599 | if (unlikely(kw_args > 0)) { |
4600 | const Py_ssize_t kwd_pos_args = __pyx_nargs; |
4601 | if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "AppendUInt8ArrayToTensorProto" ) < 0)) __PYX_ERR(0, 73, __pyx_L3_error) |
4602 | } |
4603 | } else if (unlikely(__pyx_nargs != 2)) { |
4604 | goto __pyx_L5_argtuple_error; |
4605 | } else { |
4606 | values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); |
4607 | values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); |
4608 | } |
4609 | __pyx_v_tensor_proto = values[0]; |
4610 | __pyx_v_nparray = ((PyArrayObject *)values[1]); |
4611 | } |
4612 | goto __pyx_L4_argument_unpacking_done; |
4613 | __pyx_L5_argtuple_error:; |
4614 | __Pyx_RaiseArgtupleInvalid("AppendUInt8ArrayToTensorProto" , 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 73, __pyx_L3_error) |
4615 | __pyx_L3_error:; |
4616 | __Pyx_AddTraceback("tensorflow.python.framework.fast_tensor_util.AppendUInt8ArrayToTensorProto" , __pyx_clineno, __pyx_lineno, __pyx_filename); |
4617 | __Pyx_RefNannyFinishContext(); |
4618 | return NULL; |
4619 | __pyx_L4_argument_unpacking_done:; |
4620 | if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nparray), __pyx_ptype_5numpy_ndarray, 1, "nparray" , 0))) __PYX_ERR(0, 74, __pyx_L1_error) |
4621 | __pyx_r = __pyx_pf_10tensorflow_6python_9framework_16fast_tensor_util_16AppendUInt8ArrayToTensorProto(__pyx_self, __pyx_v_tensor_proto, __pyx_v_nparray); |
4622 | |
4623 | /* function exit code */ |
4624 | goto __pyx_L0; |
4625 | __pyx_L1_error:; |
4626 | __pyx_r = NULL; |
4627 | __pyx_L0:; |
4628 | __Pyx_RefNannyFinishContext(); |
4629 | return __pyx_r; |
4630 | } |
4631 | |
4632 | static PyObject *__pyx_pf_10tensorflow_6python_9framework_16fast_tensor_util_16AppendUInt8ArrayToTensorProto(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tensor_proto, PyArrayObject *__pyx_v_nparray) { |
4633 | long __pyx_v_i; |
4634 | long __pyx_v_n; |
4635 | __Pyx_LocalBuf_ND __pyx_pybuffernd_nparray; |
4636 | __Pyx_Buffer __pyx_pybuffer_nparray; |
4637 | PyObject *__pyx_r = NULL; |
4638 | __Pyx_RefNannyDeclarations |
4639 | long __pyx_t_1; |
4640 | long __pyx_t_2; |
4641 | long __pyx_t_3; |
4642 | PyObject *__pyx_t_4 = NULL; |
4643 | Py_ssize_t __pyx_t_5; |
4644 | PyObject *__pyx_t_6 = NULL; |
4645 | int __pyx_t_7; |
4646 | int __pyx_lineno = 0; |
4647 | const char *__pyx_filename = NULL; |
4648 | int __pyx_clineno = 0; |
4649 | __Pyx_RefNannySetupContext("AppendUInt8ArrayToTensorProto" , 0); |
4650 | __pyx_pybuffer_nparray.pybuffer.buf = NULL; |
4651 | __pyx_pybuffer_nparray.refcount = 0; |
4652 | __pyx_pybuffernd_nparray.data = NULL; |
4653 | __pyx_pybuffernd_nparray.rcbuffer = &__pyx_pybuffer_nparray; |
4654 | { |
4655 | __Pyx_BufFmt_StackElem __pyx_stack[1]; |
4656 | if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nparray.rcbuffer->pybuffer, (PyObject*)__pyx_v_nparray, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 73, __pyx_L1_error) |
4657 | } |
4658 | __pyx_pybuffernd_nparray.diminfo[0].strides = __pyx_pybuffernd_nparray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nparray.diminfo[0].shape = __pyx_pybuffernd_nparray.rcbuffer->pybuffer.shape[0]; |
4659 | |
4660 | /* "tensorflow/python/framework/fast_tensor_util.pyx":76 |
4661 | * tensor_proto, np.ndarray[np.uint8_t, ndim=1] nparray): |
4662 | * cdef long i, n |
4663 | * n = nparray.size # <<<<<<<<<<<<<< |
4664 | * for i in range(n): |
4665 | * tensor_proto.int_val.append(nparray[i]) |
4666 | */ |
4667 | __pyx_v_n = __pyx_f_5numpy_7ndarray_4size_size(((PyArrayObject *)__pyx_v_nparray)); |
4668 | |
4669 | /* "tensorflow/python/framework/fast_tensor_util.pyx":77 |
4670 | * cdef long i, n |
4671 | * n = nparray.size |
4672 | * for i in range(n): # <<<<<<<<<<<<<< |
4673 | * tensor_proto.int_val.append(nparray[i]) |
4674 | * |
4675 | */ |
4676 | __pyx_t_1 = __pyx_v_n; |
4677 | __pyx_t_2 = __pyx_t_1; |
4678 | for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { |
4679 | __pyx_v_i = __pyx_t_3; |
4680 | |
4681 | /* "tensorflow/python/framework/fast_tensor_util.pyx":78 |
4682 | * n = nparray.size |
4683 | * for i in range(n): |
4684 | * tensor_proto.int_val.append(nparray[i]) # <<<<<<<<<<<<<< |
4685 | * |
4686 | * |
4687 | */ |
4688 | __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_tensor_proto, __pyx_n_s_int_val); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 78, __pyx_L1_error) |
4689 | __Pyx_GOTREF(__pyx_t_4); |
4690 | __pyx_t_5 = __pyx_v_i; |
4691 | __pyx_t_6 = __Pyx_PyInt_From_npy_uint8((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_nparray.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_nparray.diminfo[0].strides))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 78, __pyx_L1_error) |
4692 | __Pyx_GOTREF(__pyx_t_6); |
4693 | __pyx_t_7 = __Pyx_PyObject_Append(__pyx_t_4, __pyx_t_6); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 78, __pyx_L1_error) |
4694 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
4695 | __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; |
4696 | } |
4697 | |
4698 | /* "tensorflow/python/framework/fast_tensor_util.pyx":73 |
4699 | * tensor_proto.uint64_val.append(nparray[i]) |
4700 | * |
4701 | * def AppendUInt8ArrayToTensorProto( # <<<<<<<<<<<<<< |
4702 | * tensor_proto, np.ndarray[np.uint8_t, ndim=1] nparray): |
4703 | * cdef long i, n |
4704 | */ |
4705 | |
4706 | /* function exit code */ |
4707 | __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
4708 | goto __pyx_L0; |
4709 | __pyx_L1_error:; |
4710 | __Pyx_XDECREF(__pyx_t_4); |
4711 | __Pyx_XDECREF(__pyx_t_6); |
4712 | { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; |
4713 | __Pyx_PyThreadState_declare |
4714 | __Pyx_PyThreadState_assign |
4715 | __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); |
4716 | __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nparray.rcbuffer->pybuffer); |
4717 | __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} |
4718 | __Pyx_AddTraceback("tensorflow.python.framework.fast_tensor_util.AppendUInt8ArrayToTensorProto" , __pyx_clineno, __pyx_lineno, __pyx_filename); |
4719 | __pyx_r = NULL; |
4720 | goto __pyx_L2; |
4721 | __pyx_L0:; |
4722 | __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nparray.rcbuffer->pybuffer); |
4723 | __pyx_L2:; |
4724 | __Pyx_XGIVEREF(__pyx_r); |
4725 | __Pyx_RefNannyFinishContext(); |
4726 | return __pyx_r; |
4727 | } |
4728 | |
4729 | /* "tensorflow/python/framework/fast_tensor_util.pyx":81 |
4730 | * |
4731 | * |
4732 | * def AppendUInt16ArrayToTensorProto( # <<<<<<<<<<<<<< |
4733 | * tensor_proto, np.ndarray[np.uint16_t, ndim=1] nparray): |
4734 | * cdef long i, n |
4735 | */ |
4736 | |
4737 | /* Python wrapper */ |
4738 | static PyObject *__pyx_pw_10tensorflow_6python_9framework_16fast_tensor_util_19AppendUInt16ArrayToTensorProto(PyObject *__pyx_self, |
4739 | #if CYTHON_METH_FASTCALL |
4740 | PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds |
4741 | #else |
4742 | PyObject *__pyx_args, PyObject *__pyx_kwds |
4743 | #endif |
4744 | ); /*proto*/ |
4745 | static PyMethodDef __pyx_mdef_10tensorflow_6python_9framework_16fast_tensor_util_19AppendUInt16ArrayToTensorProto = {"AppendUInt16ArrayToTensorProto" , (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_10tensorflow_6python_9framework_16fast_tensor_util_19AppendUInt16ArrayToTensorProto, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; |
4746 | static PyObject *__pyx_pw_10tensorflow_6python_9framework_16fast_tensor_util_19AppendUInt16ArrayToTensorProto(PyObject *__pyx_self, |
4747 | #if CYTHON_METH_FASTCALL |
4748 | PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds |
4749 | #else |
4750 | PyObject *__pyx_args, PyObject *__pyx_kwds |
4751 | #endif |
4752 | ) { |
4753 | PyObject *__pyx_v_tensor_proto = 0; |
4754 | PyArrayObject *__pyx_v_nparray = 0; |
4755 | #if !CYTHON_METH_FASTCALL |
4756 | CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); |
4757 | #endif |
4758 | CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); |
4759 | int __pyx_lineno = 0; |
4760 | const char *__pyx_filename = NULL; |
4761 | int __pyx_clineno = 0; |
4762 | PyObject *__pyx_r = 0; |
4763 | __Pyx_RefNannyDeclarations |
4764 | __Pyx_RefNannySetupContext("AppendUInt16ArrayToTensorProto (wrapper)" , 0); |
4765 | { |
4766 | #if CYTHON_USE_MODULE_STATE |
4767 | PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tensor_proto,&__pyx_n_s_nparray,0}; |
4768 | #else |
4769 | static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tensor_proto,&__pyx_n_s_nparray,0}; |
4770 | #endif |
4771 | PyObject* values[2] = {0,0}; |
4772 | if (__pyx_kwds) { |
4773 | Py_ssize_t kw_args; |
4774 | switch (__pyx_nargs) { |
4775 | case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); |
4776 | CYTHON_FALLTHROUGH; |
4777 | case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); |
4778 | CYTHON_FALLTHROUGH; |
4779 | case 0: break; |
4780 | default: goto __pyx_L5_argtuple_error; |
4781 | } |
4782 | kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); |
4783 | switch (__pyx_nargs) { |
4784 | case 0: |
4785 | if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tensor_proto)) != 0)) kw_args--; |
4786 | else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 81, __pyx_L3_error) |
4787 | else goto __pyx_L5_argtuple_error; |
4788 | CYTHON_FALLTHROUGH; |
4789 | case 1: |
4790 | if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nparray)) != 0)) kw_args--; |
4791 | else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 81, __pyx_L3_error) |
4792 | else { |
4793 | __Pyx_RaiseArgtupleInvalid("AppendUInt16ArrayToTensorProto" , 1, 2, 2, 1); __PYX_ERR(0, 81, __pyx_L3_error) |
4794 | } |
4795 | } |
4796 | if (unlikely(kw_args > 0)) { |
4797 | const Py_ssize_t kwd_pos_args = __pyx_nargs; |
4798 | if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "AppendUInt16ArrayToTensorProto" ) < 0)) __PYX_ERR(0, 81, __pyx_L3_error) |
4799 | } |
4800 | } else if (unlikely(__pyx_nargs != 2)) { |
4801 | goto __pyx_L5_argtuple_error; |
4802 | } else { |
4803 | values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); |
4804 | values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); |
4805 | } |
4806 | __pyx_v_tensor_proto = values[0]; |
4807 | __pyx_v_nparray = ((PyArrayObject *)values[1]); |
4808 | } |
4809 | goto __pyx_L4_argument_unpacking_done; |
4810 | __pyx_L5_argtuple_error:; |
4811 | __Pyx_RaiseArgtupleInvalid("AppendUInt16ArrayToTensorProto" , 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 81, __pyx_L3_error) |
4812 | __pyx_L3_error:; |
4813 | __Pyx_AddTraceback("tensorflow.python.framework.fast_tensor_util.AppendUInt16ArrayToTensorProto" , __pyx_clineno, __pyx_lineno, __pyx_filename); |
4814 | __Pyx_RefNannyFinishContext(); |
4815 | return NULL; |
4816 | __pyx_L4_argument_unpacking_done:; |
4817 | if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nparray), __pyx_ptype_5numpy_ndarray, 1, "nparray" , 0))) __PYX_ERR(0, 82, __pyx_L1_error) |
4818 | __pyx_r = __pyx_pf_10tensorflow_6python_9framework_16fast_tensor_util_18AppendUInt16ArrayToTensorProto(__pyx_self, __pyx_v_tensor_proto, __pyx_v_nparray); |
4819 | |
4820 | /* function exit code */ |
4821 | goto __pyx_L0; |
4822 | __pyx_L1_error:; |
4823 | __pyx_r = NULL; |
4824 | __pyx_L0:; |
4825 | __Pyx_RefNannyFinishContext(); |
4826 | return __pyx_r; |
4827 | } |
4828 | |
4829 | static PyObject *__pyx_pf_10tensorflow_6python_9framework_16fast_tensor_util_18AppendUInt16ArrayToTensorProto(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tensor_proto, PyArrayObject *__pyx_v_nparray) { |
4830 | long __pyx_v_i; |
4831 | long __pyx_v_n; |
4832 | __Pyx_LocalBuf_ND __pyx_pybuffernd_nparray; |
4833 | __Pyx_Buffer __pyx_pybuffer_nparray; |
4834 | PyObject *__pyx_r = NULL; |
4835 | __Pyx_RefNannyDeclarations |
4836 | long __pyx_t_1; |
4837 | long __pyx_t_2; |
4838 | long __pyx_t_3; |
4839 | PyObject *__pyx_t_4 = NULL; |
4840 | Py_ssize_t __pyx_t_5; |
4841 | PyObject *__pyx_t_6 = NULL; |
4842 | int __pyx_t_7; |
4843 | int __pyx_lineno = 0; |
4844 | const char *__pyx_filename = NULL; |
4845 | int __pyx_clineno = 0; |
4846 | __Pyx_RefNannySetupContext("AppendUInt16ArrayToTensorProto" , 0); |
4847 | __pyx_pybuffer_nparray.pybuffer.buf = NULL; |
4848 | __pyx_pybuffer_nparray.refcount = 0; |
4849 | __pyx_pybuffernd_nparray.data = NULL; |
4850 | __pyx_pybuffernd_nparray.rcbuffer = &__pyx_pybuffer_nparray; |
4851 | { |
4852 | __Pyx_BufFmt_StackElem __pyx_stack[1]; |
4853 | if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nparray.rcbuffer->pybuffer, (PyObject*)__pyx_v_nparray, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint16_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 81, __pyx_L1_error) |
4854 | } |
4855 | __pyx_pybuffernd_nparray.diminfo[0].strides = __pyx_pybuffernd_nparray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nparray.diminfo[0].shape = __pyx_pybuffernd_nparray.rcbuffer->pybuffer.shape[0]; |
4856 | |
4857 | /* "tensorflow/python/framework/fast_tensor_util.pyx":84 |
4858 | * tensor_proto, np.ndarray[np.uint16_t, ndim=1] nparray): |
4859 | * cdef long i, n |
4860 | * n = nparray.size # <<<<<<<<<<<<<< |
4861 | * for i in range(n): |
4862 | * tensor_proto.int_val.append(nparray[i]) |
4863 | */ |
4864 | __pyx_v_n = __pyx_f_5numpy_7ndarray_4size_size(((PyArrayObject *)__pyx_v_nparray)); |
4865 | |
4866 | /* "tensorflow/python/framework/fast_tensor_util.pyx":85 |
4867 | * cdef long i, n |
4868 | * n = nparray.size |
4869 | * for i in range(n): # <<<<<<<<<<<<<< |
4870 | * tensor_proto.int_val.append(nparray[i]) |
4871 | * |
4872 | */ |
4873 | __pyx_t_1 = __pyx_v_n; |
4874 | __pyx_t_2 = __pyx_t_1; |
4875 | for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { |
4876 | __pyx_v_i = __pyx_t_3; |
4877 | |
4878 | /* "tensorflow/python/framework/fast_tensor_util.pyx":86 |
4879 | * n = nparray.size |
4880 | * for i in range(n): |
4881 | * tensor_proto.int_val.append(nparray[i]) # <<<<<<<<<<<<<< |
4882 | * |
4883 | * |
4884 | */ |
4885 | __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_tensor_proto, __pyx_n_s_int_val); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 86, __pyx_L1_error) |
4886 | __Pyx_GOTREF(__pyx_t_4); |
4887 | __pyx_t_5 = __pyx_v_i; |
4888 | __pyx_t_6 = __Pyx_PyInt_From_npy_uint16((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint16_t *, __pyx_pybuffernd_nparray.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_nparray.diminfo[0].strides))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 86, __pyx_L1_error) |
4889 | __Pyx_GOTREF(__pyx_t_6); |
4890 | __pyx_t_7 = __Pyx_PyObject_Append(__pyx_t_4, __pyx_t_6); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 86, __pyx_L1_error) |
4891 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
4892 | __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; |
4893 | } |
4894 | |
4895 | /* "tensorflow/python/framework/fast_tensor_util.pyx":81 |
4896 | * |
4897 | * |
4898 | * def AppendUInt16ArrayToTensorProto( # <<<<<<<<<<<<<< |
4899 | * tensor_proto, np.ndarray[np.uint16_t, ndim=1] nparray): |
4900 | * cdef long i, n |
4901 | */ |
4902 | |
4903 | /* function exit code */ |
4904 | __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
4905 | goto __pyx_L0; |
4906 | __pyx_L1_error:; |
4907 | __Pyx_XDECREF(__pyx_t_4); |
4908 | __Pyx_XDECREF(__pyx_t_6); |
4909 | { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; |
4910 | __Pyx_PyThreadState_declare |
4911 | __Pyx_PyThreadState_assign |
4912 | __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); |
4913 | __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nparray.rcbuffer->pybuffer); |
4914 | __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} |
4915 | __Pyx_AddTraceback("tensorflow.python.framework.fast_tensor_util.AppendUInt16ArrayToTensorProto" , __pyx_clineno, __pyx_lineno, __pyx_filename); |
4916 | __pyx_r = NULL; |
4917 | goto __pyx_L2; |
4918 | __pyx_L0:; |
4919 | __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nparray.rcbuffer->pybuffer); |
4920 | __pyx_L2:; |
4921 | __Pyx_XGIVEREF(__pyx_r); |
4922 | __Pyx_RefNannyFinishContext(); |
4923 | return __pyx_r; |
4924 | } |
4925 | |
4926 | /* "tensorflow/python/framework/fast_tensor_util.pyx":89 |
4927 | * |
4928 | * |
4929 | * def AppendInt16ArrayToTensorProto( # <<<<<<<<<<<<<< |
4930 | * tensor_proto, np.ndarray[np.int16_t, ndim=1] nparray): |
4931 | * cdef long i, n |
4932 | */ |
4933 | |
4934 | /* Python wrapper */ |
4935 | static PyObject *__pyx_pw_10tensorflow_6python_9framework_16fast_tensor_util_21AppendInt16ArrayToTensorProto(PyObject *__pyx_self, |
4936 | #if CYTHON_METH_FASTCALL |
4937 | PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds |
4938 | #else |
4939 | PyObject *__pyx_args, PyObject *__pyx_kwds |
4940 | #endif |
4941 | ); /*proto*/ |
4942 | static PyMethodDef __pyx_mdef_10tensorflow_6python_9framework_16fast_tensor_util_21AppendInt16ArrayToTensorProto = {"AppendInt16ArrayToTensorProto" , (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_10tensorflow_6python_9framework_16fast_tensor_util_21AppendInt16ArrayToTensorProto, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; |
4943 | static PyObject *__pyx_pw_10tensorflow_6python_9framework_16fast_tensor_util_21AppendInt16ArrayToTensorProto(PyObject *__pyx_self, |
4944 | #if CYTHON_METH_FASTCALL |
4945 | PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds |
4946 | #else |
4947 | PyObject *__pyx_args, PyObject *__pyx_kwds |
4948 | #endif |
4949 | ) { |
4950 | PyObject *__pyx_v_tensor_proto = 0; |
4951 | PyArrayObject *__pyx_v_nparray = 0; |
4952 | #if !CYTHON_METH_FASTCALL |
4953 | CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); |
4954 | #endif |
4955 | CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); |
4956 | int __pyx_lineno = 0; |
4957 | const char *__pyx_filename = NULL; |
4958 | int __pyx_clineno = 0; |
4959 | PyObject *__pyx_r = 0; |
4960 | __Pyx_RefNannyDeclarations |
4961 | __Pyx_RefNannySetupContext("AppendInt16ArrayToTensorProto (wrapper)" , 0); |
4962 | { |
4963 | #if CYTHON_USE_MODULE_STATE |
4964 | PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tensor_proto,&__pyx_n_s_nparray,0}; |
4965 | #else |
4966 | static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tensor_proto,&__pyx_n_s_nparray,0}; |
4967 | #endif |
4968 | PyObject* values[2] = {0,0}; |
4969 | if (__pyx_kwds) { |
4970 | Py_ssize_t kw_args; |
4971 | switch (__pyx_nargs) { |
4972 | case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); |
4973 | CYTHON_FALLTHROUGH; |
4974 | case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); |
4975 | CYTHON_FALLTHROUGH; |
4976 | case 0: break; |
4977 | default: goto __pyx_L5_argtuple_error; |
4978 | } |
4979 | kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); |
4980 | switch (__pyx_nargs) { |
4981 | case 0: |
4982 | if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tensor_proto)) != 0)) kw_args--; |
4983 | else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 89, __pyx_L3_error) |
4984 | else goto __pyx_L5_argtuple_error; |
4985 | CYTHON_FALLTHROUGH; |
4986 | case 1: |
4987 | if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nparray)) != 0)) kw_args--; |
4988 | else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 89, __pyx_L3_error) |
4989 | else { |
4990 | __Pyx_RaiseArgtupleInvalid("AppendInt16ArrayToTensorProto" , 1, 2, 2, 1); __PYX_ERR(0, 89, __pyx_L3_error) |
4991 | } |
4992 | } |
4993 | if (unlikely(kw_args > 0)) { |
4994 | const Py_ssize_t kwd_pos_args = __pyx_nargs; |
4995 | if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "AppendInt16ArrayToTensorProto" ) < 0)) __PYX_ERR(0, 89, __pyx_L3_error) |
4996 | } |
4997 | } else if (unlikely(__pyx_nargs != 2)) { |
4998 | goto __pyx_L5_argtuple_error; |
4999 | } else { |
5000 | values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); |
5001 | values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); |
5002 | } |
5003 | __pyx_v_tensor_proto = values[0]; |
5004 | __pyx_v_nparray = ((PyArrayObject *)values[1]); |
5005 | } |
5006 | goto __pyx_L4_argument_unpacking_done; |
5007 | __pyx_L5_argtuple_error:; |
5008 | __Pyx_RaiseArgtupleInvalid("AppendInt16ArrayToTensorProto" , 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 89, __pyx_L3_error) |
5009 | __pyx_L3_error:; |
5010 | __Pyx_AddTraceback("tensorflow.python.framework.fast_tensor_util.AppendInt16ArrayToTensorProto" , __pyx_clineno, __pyx_lineno, __pyx_filename); |
5011 | __Pyx_RefNannyFinishContext(); |
5012 | return NULL; |
5013 | __pyx_L4_argument_unpacking_done:; |
5014 | if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nparray), __pyx_ptype_5numpy_ndarray, 1, "nparray" , 0))) __PYX_ERR(0, 90, __pyx_L1_error) |
5015 | __pyx_r = __pyx_pf_10tensorflow_6python_9framework_16fast_tensor_util_20AppendInt16ArrayToTensorProto(__pyx_self, __pyx_v_tensor_proto, __pyx_v_nparray); |
5016 | |
5017 | /* function exit code */ |
5018 | goto __pyx_L0; |
5019 | __pyx_L1_error:; |
5020 | __pyx_r = NULL; |
5021 | __pyx_L0:; |
5022 | __Pyx_RefNannyFinishContext(); |
5023 | return __pyx_r; |
5024 | } |
5025 | |
5026 | static PyObject *__pyx_pf_10tensorflow_6python_9framework_16fast_tensor_util_20AppendInt16ArrayToTensorProto(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tensor_proto, PyArrayObject *__pyx_v_nparray) { |
5027 | long __pyx_v_i; |
5028 | long __pyx_v_n; |
5029 | __Pyx_LocalBuf_ND __pyx_pybuffernd_nparray; |
5030 | __Pyx_Buffer __pyx_pybuffer_nparray; |
5031 | PyObject *__pyx_r = NULL; |
5032 | __Pyx_RefNannyDeclarations |
5033 | long __pyx_t_1; |
5034 | long __pyx_t_2; |
5035 | long __pyx_t_3; |
5036 | PyObject *__pyx_t_4 = NULL; |
5037 | Py_ssize_t __pyx_t_5; |
5038 | PyObject *__pyx_t_6 = NULL; |
5039 | int __pyx_t_7; |
5040 | int __pyx_lineno = 0; |
5041 | const char *__pyx_filename = NULL; |
5042 | int __pyx_clineno = 0; |
5043 | __Pyx_RefNannySetupContext("AppendInt16ArrayToTensorProto" , 0); |
5044 | __pyx_pybuffer_nparray.pybuffer.buf = NULL; |
5045 | __pyx_pybuffer_nparray.refcount = 0; |
5046 | __pyx_pybuffernd_nparray.data = NULL; |
5047 | __pyx_pybuffernd_nparray.rcbuffer = &__pyx_pybuffer_nparray; |
5048 | { |
5049 | __Pyx_BufFmt_StackElem __pyx_stack[1]; |
5050 | if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nparray.rcbuffer->pybuffer, (PyObject*)__pyx_v_nparray, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int16_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 89, __pyx_L1_error) |
5051 | } |
5052 | __pyx_pybuffernd_nparray.diminfo[0].strides = __pyx_pybuffernd_nparray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nparray.diminfo[0].shape = __pyx_pybuffernd_nparray.rcbuffer->pybuffer.shape[0]; |
5053 | |
5054 | /* "tensorflow/python/framework/fast_tensor_util.pyx":92 |
5055 | * tensor_proto, np.ndarray[np.int16_t, ndim=1] nparray): |
5056 | * cdef long i, n |
5057 | * n = nparray.size # <<<<<<<<<<<<<< |
5058 | * for i in range(n): |
5059 | * tensor_proto.int_val.append(nparray[i]) |
5060 | */ |
5061 | __pyx_v_n = __pyx_f_5numpy_7ndarray_4size_size(((PyArrayObject *)__pyx_v_nparray)); |
5062 | |
5063 | /* "tensorflow/python/framework/fast_tensor_util.pyx":93 |
5064 | * cdef long i, n |
5065 | * n = nparray.size |
5066 | * for i in range(n): # <<<<<<<<<<<<<< |
5067 | * tensor_proto.int_val.append(nparray[i]) |
5068 | * |
5069 | */ |
5070 | __pyx_t_1 = __pyx_v_n; |
5071 | __pyx_t_2 = __pyx_t_1; |
5072 | for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { |
5073 | __pyx_v_i = __pyx_t_3; |
5074 | |
5075 | /* "tensorflow/python/framework/fast_tensor_util.pyx":94 |
5076 | * n = nparray.size |
5077 | * for i in range(n): |
5078 | * tensor_proto.int_val.append(nparray[i]) # <<<<<<<<<<<<<< |
5079 | * |
5080 | * |
5081 | */ |
5082 | __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_tensor_proto, __pyx_n_s_int_val); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 94, __pyx_L1_error) |
5083 | __Pyx_GOTREF(__pyx_t_4); |
5084 | __pyx_t_5 = __pyx_v_i; |
5085 | __pyx_t_6 = __Pyx_PyInt_From_npy_int16((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int16_t *, __pyx_pybuffernd_nparray.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_nparray.diminfo[0].strides))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 94, __pyx_L1_error) |
5086 | __Pyx_GOTREF(__pyx_t_6); |
5087 | __pyx_t_7 = __Pyx_PyObject_Append(__pyx_t_4, __pyx_t_6); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 94, __pyx_L1_error) |
5088 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
5089 | __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; |
5090 | } |
5091 | |
5092 | /* "tensorflow/python/framework/fast_tensor_util.pyx":89 |
5093 | * |
5094 | * |
5095 | * def AppendInt16ArrayToTensorProto( # <<<<<<<<<<<<<< |
5096 | * tensor_proto, np.ndarray[np.int16_t, ndim=1] nparray): |
5097 | * cdef long i, n |
5098 | */ |
5099 | |
5100 | /* function exit code */ |
5101 | __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
5102 | goto __pyx_L0; |
5103 | __pyx_L1_error:; |
5104 | __Pyx_XDECREF(__pyx_t_4); |
5105 | __Pyx_XDECREF(__pyx_t_6); |
5106 | { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; |
5107 | __Pyx_PyThreadState_declare |
5108 | __Pyx_PyThreadState_assign |
5109 | __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); |
5110 | __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nparray.rcbuffer->pybuffer); |
5111 | __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} |
5112 | __Pyx_AddTraceback("tensorflow.python.framework.fast_tensor_util.AppendInt16ArrayToTensorProto" , __pyx_clineno, __pyx_lineno, __pyx_filename); |
5113 | __pyx_r = NULL; |
5114 | goto __pyx_L2; |
5115 | __pyx_L0:; |
5116 | __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nparray.rcbuffer->pybuffer); |
5117 | __pyx_L2:; |
5118 | __Pyx_XGIVEREF(__pyx_r); |
5119 | __Pyx_RefNannyFinishContext(); |
5120 | return __pyx_r; |
5121 | } |
5122 | |
5123 | /* "tensorflow/python/framework/fast_tensor_util.pyx":97 |
5124 | * |
5125 | * |
5126 | * def AppendInt8ArrayToTensorProto( # <<<<<<<<<<<<<< |
5127 | * tensor_proto, np.ndarray[np.int8_t, ndim=1] nparray): |
5128 | * cdef long i, n |
5129 | */ |
5130 | |
5131 | /* Python wrapper */ |
5132 | static PyObject *__pyx_pw_10tensorflow_6python_9framework_16fast_tensor_util_23AppendInt8ArrayToTensorProto(PyObject *__pyx_self, |
5133 | #if CYTHON_METH_FASTCALL |
5134 | PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds |
5135 | #else |
5136 | PyObject *__pyx_args, PyObject *__pyx_kwds |
5137 | #endif |
5138 | ); /*proto*/ |
5139 | static PyMethodDef __pyx_mdef_10tensorflow_6python_9framework_16fast_tensor_util_23AppendInt8ArrayToTensorProto = {"AppendInt8ArrayToTensorProto" , (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_10tensorflow_6python_9framework_16fast_tensor_util_23AppendInt8ArrayToTensorProto, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; |
5140 | static PyObject *__pyx_pw_10tensorflow_6python_9framework_16fast_tensor_util_23AppendInt8ArrayToTensorProto(PyObject *__pyx_self, |
5141 | #if CYTHON_METH_FASTCALL |
5142 | PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds |
5143 | #else |
5144 | PyObject *__pyx_args, PyObject *__pyx_kwds |
5145 | #endif |
5146 | ) { |
5147 | PyObject *__pyx_v_tensor_proto = 0; |
5148 | PyArrayObject *__pyx_v_nparray = 0; |
5149 | #if !CYTHON_METH_FASTCALL |
5150 | CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); |
5151 | #endif |
5152 | CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); |
5153 | int __pyx_lineno = 0; |
5154 | const char *__pyx_filename = NULL; |
5155 | int __pyx_clineno = 0; |
5156 | PyObject *__pyx_r = 0; |
5157 | __Pyx_RefNannyDeclarations |
5158 | __Pyx_RefNannySetupContext("AppendInt8ArrayToTensorProto (wrapper)" , 0); |
5159 | { |
5160 | #if CYTHON_USE_MODULE_STATE |
5161 | PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tensor_proto,&__pyx_n_s_nparray,0}; |
5162 | #else |
5163 | static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tensor_proto,&__pyx_n_s_nparray,0}; |
5164 | #endif |
5165 | PyObject* values[2] = {0,0}; |
5166 | if (__pyx_kwds) { |
5167 | Py_ssize_t kw_args; |
5168 | switch (__pyx_nargs) { |
5169 | case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); |
5170 | CYTHON_FALLTHROUGH; |
5171 | case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); |
5172 | CYTHON_FALLTHROUGH; |
5173 | case 0: break; |
5174 | default: goto __pyx_L5_argtuple_error; |
5175 | } |
5176 | kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); |
5177 | switch (__pyx_nargs) { |
5178 | case 0: |
5179 | if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tensor_proto)) != 0)) kw_args--; |
5180 | else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error) |
5181 | else goto __pyx_L5_argtuple_error; |
5182 | CYTHON_FALLTHROUGH; |
5183 | case 1: |
5184 | if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nparray)) != 0)) kw_args--; |
5185 | else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error) |
5186 | else { |
5187 | __Pyx_RaiseArgtupleInvalid("AppendInt8ArrayToTensorProto" , 1, 2, 2, 1); __PYX_ERR(0, 97, __pyx_L3_error) |
5188 | } |
5189 | } |
5190 | if (unlikely(kw_args > 0)) { |
5191 | const Py_ssize_t kwd_pos_args = __pyx_nargs; |
5192 | if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "AppendInt8ArrayToTensorProto" ) < 0)) __PYX_ERR(0, 97, __pyx_L3_error) |
5193 | } |
5194 | } else if (unlikely(__pyx_nargs != 2)) { |
5195 | goto __pyx_L5_argtuple_error; |
5196 | } else { |
5197 | values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); |
5198 | values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); |
5199 | } |
5200 | __pyx_v_tensor_proto = values[0]; |
5201 | __pyx_v_nparray = ((PyArrayObject *)values[1]); |
5202 | } |
5203 | goto __pyx_L4_argument_unpacking_done; |
5204 | __pyx_L5_argtuple_error:; |
5205 | __Pyx_RaiseArgtupleInvalid("AppendInt8ArrayToTensorProto" , 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 97, __pyx_L3_error) |
5206 | __pyx_L3_error:; |
5207 | __Pyx_AddTraceback("tensorflow.python.framework.fast_tensor_util.AppendInt8ArrayToTensorProto" , __pyx_clineno, __pyx_lineno, __pyx_filename); |
5208 | __Pyx_RefNannyFinishContext(); |
5209 | return NULL; |
5210 | __pyx_L4_argument_unpacking_done:; |
5211 | if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nparray), __pyx_ptype_5numpy_ndarray, 1, "nparray" , 0))) __PYX_ERR(0, 98, __pyx_L1_error) |
5212 | __pyx_r = __pyx_pf_10tensorflow_6python_9framework_16fast_tensor_util_22AppendInt8ArrayToTensorProto(__pyx_self, __pyx_v_tensor_proto, __pyx_v_nparray); |
5213 | |
5214 | /* function exit code */ |
5215 | goto __pyx_L0; |
5216 | __pyx_L1_error:; |
5217 | __pyx_r = NULL; |
5218 | __pyx_L0:; |
5219 | __Pyx_RefNannyFinishContext(); |
5220 | return __pyx_r; |
5221 | } |
5222 | |
5223 | static PyObject *__pyx_pf_10tensorflow_6python_9framework_16fast_tensor_util_22AppendInt8ArrayToTensorProto(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tensor_proto, PyArrayObject *__pyx_v_nparray) { |
5224 | long __pyx_v_i; |
5225 | long __pyx_v_n; |
5226 | __Pyx_LocalBuf_ND __pyx_pybuffernd_nparray; |
5227 | __Pyx_Buffer __pyx_pybuffer_nparray; |
5228 | PyObject *__pyx_r = NULL; |
5229 | __Pyx_RefNannyDeclarations |
5230 | long __pyx_t_1; |
5231 | long __pyx_t_2; |
5232 | long __pyx_t_3; |
5233 | PyObject *__pyx_t_4 = NULL; |
5234 | Py_ssize_t __pyx_t_5; |
5235 | PyObject *__pyx_t_6 = NULL; |
5236 | int __pyx_t_7; |
5237 | int __pyx_lineno = 0; |
5238 | const char *__pyx_filename = NULL; |
5239 | int __pyx_clineno = 0; |
5240 | __Pyx_RefNannySetupContext("AppendInt8ArrayToTensorProto" , 0); |
5241 | __pyx_pybuffer_nparray.pybuffer.buf = NULL; |
5242 | __pyx_pybuffer_nparray.refcount = 0; |
5243 | __pyx_pybuffernd_nparray.data = NULL; |
5244 | __pyx_pybuffernd_nparray.rcbuffer = &__pyx_pybuffer_nparray; |
5245 | { |
5246 | __Pyx_BufFmt_StackElem __pyx_stack[1]; |
5247 | if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nparray.rcbuffer->pybuffer, (PyObject*)__pyx_v_nparray, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 97, __pyx_L1_error) |
5248 | } |
5249 | __pyx_pybuffernd_nparray.diminfo[0].strides = __pyx_pybuffernd_nparray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nparray.diminfo[0].shape = __pyx_pybuffernd_nparray.rcbuffer->pybuffer.shape[0]; |
5250 | |
5251 | /* "tensorflow/python/framework/fast_tensor_util.pyx":100 |
5252 | * tensor_proto, np.ndarray[np.int8_t, ndim=1] nparray): |
5253 | * cdef long i, n |
5254 | * n = nparray.size # <<<<<<<<<<<<<< |
5255 | * for i in range(n): |
5256 | * tensor_proto.int_val.append(nparray[i]) |
5257 | */ |
5258 | __pyx_v_n = __pyx_f_5numpy_7ndarray_4size_size(((PyArrayObject *)__pyx_v_nparray)); |
5259 | |
5260 | /* "tensorflow/python/framework/fast_tensor_util.pyx":101 |
5261 | * cdef long i, n |
5262 | * n = nparray.size |
5263 | * for i in range(n): # <<<<<<<<<<<<<< |
5264 | * tensor_proto.int_val.append(nparray[i]) |
5265 | * |
5266 | */ |
5267 | __pyx_t_1 = __pyx_v_n; |
5268 | __pyx_t_2 = __pyx_t_1; |
5269 | for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { |
5270 | __pyx_v_i = __pyx_t_3; |
5271 | |
5272 | /* "tensorflow/python/framework/fast_tensor_util.pyx":102 |
5273 | * n = nparray.size |
5274 | * for i in range(n): |
5275 | * tensor_proto.int_val.append(nparray[i]) # <<<<<<<<<<<<<< |
5276 | * |
5277 | * |
5278 | */ |
5279 | __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_tensor_proto, __pyx_n_s_int_val); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 102, __pyx_L1_error) |
5280 | __Pyx_GOTREF(__pyx_t_4); |
5281 | __pyx_t_5 = __pyx_v_i; |
5282 | __pyx_t_6 = __Pyx_PyInt_From_npy_int8((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nparray.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_nparray.diminfo[0].strides))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 102, __pyx_L1_error) |
5283 | __Pyx_GOTREF(__pyx_t_6); |
5284 | __pyx_t_7 = __Pyx_PyObject_Append(__pyx_t_4, __pyx_t_6); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 102, __pyx_L1_error) |
5285 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
5286 | __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; |
5287 | } |
5288 | |
5289 | /* "tensorflow/python/framework/fast_tensor_util.pyx":97 |
5290 | * |
5291 | * |
5292 | * def AppendInt8ArrayToTensorProto( # <<<<<<<<<<<<<< |
5293 | * tensor_proto, np.ndarray[np.int8_t, ndim=1] nparray): |
5294 | * cdef long i, n |
5295 | */ |
5296 | |
5297 | /* function exit code */ |
5298 | __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
5299 | goto __pyx_L0; |
5300 | __pyx_L1_error:; |
5301 | __Pyx_XDECREF(__pyx_t_4); |
5302 | __Pyx_XDECREF(__pyx_t_6); |
5303 | { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; |
5304 | __Pyx_PyThreadState_declare |
5305 | __Pyx_PyThreadState_assign |
5306 | __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); |
5307 | __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nparray.rcbuffer->pybuffer); |
5308 | __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} |
5309 | __Pyx_AddTraceback("tensorflow.python.framework.fast_tensor_util.AppendInt8ArrayToTensorProto" , __pyx_clineno, __pyx_lineno, __pyx_filename); |
5310 | __pyx_r = NULL; |
5311 | goto __pyx_L2; |
5312 | __pyx_L0:; |
5313 | __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nparray.rcbuffer->pybuffer); |
5314 | __pyx_L2:; |
5315 | __Pyx_XGIVEREF(__pyx_r); |
5316 | __Pyx_RefNannyFinishContext(); |
5317 | return __pyx_r; |
5318 | } |
5319 | |
5320 | /* "tensorflow/python/framework/fast_tensor_util.pyx":105 |
5321 | * |
5322 | * |
5323 | * def AppendComplex64ArrayToTensorProto( # <<<<<<<<<<<<<< |
5324 | * tensor_proto, np.ndarray[np.complex64_t, ndim=1] nparray): |
5325 | * cdef long i, n |
5326 | */ |
5327 | |
5328 | /* Python wrapper */ |
5329 | static PyObject *__pyx_pw_10tensorflow_6python_9framework_16fast_tensor_util_25AppendComplex64ArrayToTensorProto(PyObject *__pyx_self, |
5330 | #if CYTHON_METH_FASTCALL |
5331 | PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds |
5332 | #else |
5333 | PyObject *__pyx_args, PyObject *__pyx_kwds |
5334 | #endif |
5335 | ); /*proto*/ |
5336 | static PyMethodDef __pyx_mdef_10tensorflow_6python_9framework_16fast_tensor_util_25AppendComplex64ArrayToTensorProto = {"AppendComplex64ArrayToTensorProto" , (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_10tensorflow_6python_9framework_16fast_tensor_util_25AppendComplex64ArrayToTensorProto, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; |
5337 | static PyObject *__pyx_pw_10tensorflow_6python_9framework_16fast_tensor_util_25AppendComplex64ArrayToTensorProto(PyObject *__pyx_self, |
5338 | #if CYTHON_METH_FASTCALL |
5339 | PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds |
5340 | #else |
5341 | PyObject *__pyx_args, PyObject *__pyx_kwds |
5342 | #endif |
5343 | ) { |
5344 | PyObject *__pyx_v_tensor_proto = 0; |
5345 | PyArrayObject *__pyx_v_nparray = 0; |
5346 | #if !CYTHON_METH_FASTCALL |
5347 | CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); |
5348 | #endif |
5349 | CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); |
5350 | int __pyx_lineno = 0; |
5351 | const char *__pyx_filename = NULL; |
5352 | int __pyx_clineno = 0; |
5353 | PyObject *__pyx_r = 0; |
5354 | __Pyx_RefNannyDeclarations |
5355 | __Pyx_RefNannySetupContext("AppendComplex64ArrayToTensorProto (wrapper)" , 0); |
5356 | { |
5357 | #if CYTHON_USE_MODULE_STATE |
5358 | PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tensor_proto,&__pyx_n_s_nparray,0}; |
5359 | #else |
5360 | static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tensor_proto,&__pyx_n_s_nparray,0}; |
5361 | #endif |
5362 | PyObject* values[2] = {0,0}; |
5363 | if (__pyx_kwds) { |
5364 | Py_ssize_t kw_args; |
5365 | switch (__pyx_nargs) { |
5366 | case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); |
5367 | CYTHON_FALLTHROUGH; |
5368 | case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); |
5369 | CYTHON_FALLTHROUGH; |
5370 | case 0: break; |
5371 | default: goto __pyx_L5_argtuple_error; |
5372 | } |
5373 | kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); |
5374 | switch (__pyx_nargs) { |
5375 | case 0: |
5376 | if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tensor_proto)) != 0)) kw_args--; |
5377 | else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 105, __pyx_L3_error) |
5378 | else goto __pyx_L5_argtuple_error; |
5379 | CYTHON_FALLTHROUGH; |
5380 | case 1: |
5381 | if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nparray)) != 0)) kw_args--; |
5382 | else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 105, __pyx_L3_error) |
5383 | else { |
5384 | __Pyx_RaiseArgtupleInvalid("AppendComplex64ArrayToTensorProto" , 1, 2, 2, 1); __PYX_ERR(0, 105, __pyx_L3_error) |
5385 | } |
5386 | } |
5387 | if (unlikely(kw_args > 0)) { |
5388 | const Py_ssize_t kwd_pos_args = __pyx_nargs; |
5389 | if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "AppendComplex64ArrayToTensorProto" ) < 0)) __PYX_ERR(0, 105, __pyx_L3_error) |
5390 | } |
5391 | } else if (unlikely(__pyx_nargs != 2)) { |
5392 | goto __pyx_L5_argtuple_error; |
5393 | } else { |
5394 | values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); |
5395 | values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); |
5396 | } |
5397 | __pyx_v_tensor_proto = values[0]; |
5398 | __pyx_v_nparray = ((PyArrayObject *)values[1]); |
5399 | } |
5400 | goto __pyx_L4_argument_unpacking_done; |
5401 | __pyx_L5_argtuple_error:; |
5402 | __Pyx_RaiseArgtupleInvalid("AppendComplex64ArrayToTensorProto" , 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 105, __pyx_L3_error) |
5403 | __pyx_L3_error:; |
5404 | __Pyx_AddTraceback("tensorflow.python.framework.fast_tensor_util.AppendComplex64ArrayToTensorProto" , __pyx_clineno, __pyx_lineno, __pyx_filename); |
5405 | __Pyx_RefNannyFinishContext(); |
5406 | return NULL; |
5407 | __pyx_L4_argument_unpacking_done:; |
5408 | if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nparray), __pyx_ptype_5numpy_ndarray, 1, "nparray" , 0))) __PYX_ERR(0, 106, __pyx_L1_error) |
5409 | __pyx_r = __pyx_pf_10tensorflow_6python_9framework_16fast_tensor_util_24AppendComplex64ArrayToTensorProto(__pyx_self, __pyx_v_tensor_proto, __pyx_v_nparray); |
5410 | |
5411 | /* function exit code */ |
5412 | goto __pyx_L0; |
5413 | __pyx_L1_error:; |
5414 | __pyx_r = NULL; |
5415 | __pyx_L0:; |
5416 | __Pyx_RefNannyFinishContext(); |
5417 | return __pyx_r; |
5418 | } |
5419 | |
5420 | static PyObject *__pyx_pf_10tensorflow_6python_9framework_16fast_tensor_util_24AppendComplex64ArrayToTensorProto(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tensor_proto, PyArrayObject *__pyx_v_nparray) { |
5421 | long __pyx_v_i; |
5422 | long __pyx_v_n; |
5423 | __Pyx_LocalBuf_ND __pyx_pybuffernd_nparray; |
5424 | __Pyx_Buffer __pyx_pybuffer_nparray; |
5425 | PyObject *__pyx_r = NULL; |
5426 | __Pyx_RefNannyDeclarations |
5427 | long __pyx_t_1; |
5428 | long __pyx_t_2; |
5429 | long __pyx_t_3; |
5430 | PyObject *__pyx_t_4 = NULL; |
5431 | Py_ssize_t __pyx_t_5; |
5432 | PyObject *__pyx_t_6 = NULL; |
5433 | int __pyx_t_7; |
5434 | int __pyx_lineno = 0; |
5435 | const char *__pyx_filename = NULL; |
5436 | int __pyx_clineno = 0; |
5437 | __Pyx_RefNannySetupContext("AppendComplex64ArrayToTensorProto" , 0); |
5438 | __pyx_pybuffer_nparray.pybuffer.buf = NULL; |
5439 | __pyx_pybuffer_nparray.refcount = 0; |
5440 | __pyx_pybuffernd_nparray.data = NULL; |
5441 | __pyx_pybuffernd_nparray.rcbuffer = &__pyx_pybuffer_nparray; |
5442 | { |
5443 | __Pyx_BufFmt_StackElem __pyx_stack[1]; |
5444 | if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nparray.rcbuffer->pybuffer, (PyObject*)__pyx_v_nparray, &__Pyx_TypeInfo___pyx_t_float_complex, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 105, __pyx_L1_error) |
5445 | } |
5446 | __pyx_pybuffernd_nparray.diminfo[0].strides = __pyx_pybuffernd_nparray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nparray.diminfo[0].shape = __pyx_pybuffernd_nparray.rcbuffer->pybuffer.shape[0]; |
5447 | |
5448 | /* "tensorflow/python/framework/fast_tensor_util.pyx":108 |
5449 | * tensor_proto, np.ndarray[np.complex64_t, ndim=1] nparray): |
5450 | * cdef long i, n |
5451 | * n = nparray.size # <<<<<<<<<<<<<< |
5452 | * for i in range(n): |
5453 | * tensor_proto.scomplex_val.append(nparray[i].real) |
5454 | */ |
5455 | __pyx_v_n = __pyx_f_5numpy_7ndarray_4size_size(((PyArrayObject *)__pyx_v_nparray)); |
5456 | |
5457 | /* "tensorflow/python/framework/fast_tensor_util.pyx":109 |
5458 | * cdef long i, n |
5459 | * n = nparray.size |
5460 | * for i in range(n): # <<<<<<<<<<<<<< |
5461 | * tensor_proto.scomplex_val.append(nparray[i].real) |
5462 | * tensor_proto.scomplex_val.append(nparray[i].imag) |
5463 | */ |
5464 | __pyx_t_1 = __pyx_v_n; |
5465 | __pyx_t_2 = __pyx_t_1; |
5466 | for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { |
5467 | __pyx_v_i = __pyx_t_3; |
5468 | |
5469 | /* "tensorflow/python/framework/fast_tensor_util.pyx":110 |
5470 | * n = nparray.size |
5471 | * for i in range(n): |
5472 | * tensor_proto.scomplex_val.append(nparray[i].real) # <<<<<<<<<<<<<< |
5473 | * tensor_proto.scomplex_val.append(nparray[i].imag) |
5474 | * |
5475 | */ |
5476 | __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_tensor_proto, __pyx_n_s_scomplex_val); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 110, __pyx_L1_error) |
5477 | __Pyx_GOTREF(__pyx_t_4); |
5478 | __pyx_t_5 = __pyx_v_i; |
5479 | __pyx_t_6 = PyFloat_FromDouble(__Pyx_CREAL((*__Pyx_BufPtrStrided1d(__pyx_t_float_complex *, __pyx_pybuffernd_nparray.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_nparray.diminfo[0].strides)))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 110, __pyx_L1_error) |
5480 | __Pyx_GOTREF(__pyx_t_6); |
5481 | __pyx_t_7 = __Pyx_PyObject_Append(__pyx_t_4, __pyx_t_6); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 110, __pyx_L1_error) |
5482 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
5483 | __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; |
5484 | |
5485 | /* "tensorflow/python/framework/fast_tensor_util.pyx":111 |
5486 | * for i in range(n): |
5487 | * tensor_proto.scomplex_val.append(nparray[i].real) |
5488 | * tensor_proto.scomplex_val.append(nparray[i].imag) # <<<<<<<<<<<<<< |
5489 | * |
5490 | * |
5491 | */ |
5492 | __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_tensor_proto, __pyx_n_s_scomplex_val); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 111, __pyx_L1_error) |
5493 | __Pyx_GOTREF(__pyx_t_6); |
5494 | __pyx_t_5 = __pyx_v_i; |
5495 | __pyx_t_4 = PyFloat_FromDouble(__Pyx_CIMAG((*__Pyx_BufPtrStrided1d(__pyx_t_float_complex *, __pyx_pybuffernd_nparray.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_nparray.diminfo[0].strides)))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 111, __pyx_L1_error) |
5496 | __Pyx_GOTREF(__pyx_t_4); |
5497 | __pyx_t_7 = __Pyx_PyObject_Append(__pyx_t_6, __pyx_t_4); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 111, __pyx_L1_error) |
5498 | __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; |
5499 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
5500 | } |
5501 | |
5502 | /* "tensorflow/python/framework/fast_tensor_util.pyx":105 |
5503 | * |
5504 | * |
5505 | * def AppendComplex64ArrayToTensorProto( # <<<<<<<<<<<<<< |
5506 | * tensor_proto, np.ndarray[np.complex64_t, ndim=1] nparray): |
5507 | * cdef long i, n |
5508 | */ |
5509 | |
5510 | /* function exit code */ |
5511 | __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
5512 | goto __pyx_L0; |
5513 | __pyx_L1_error:; |
5514 | __Pyx_XDECREF(__pyx_t_4); |
5515 | __Pyx_XDECREF(__pyx_t_6); |
5516 | { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; |
5517 | __Pyx_PyThreadState_declare |
5518 | __Pyx_PyThreadState_assign |
5519 | __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); |
5520 | __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nparray.rcbuffer->pybuffer); |
5521 | __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} |
5522 | __Pyx_AddTraceback("tensorflow.python.framework.fast_tensor_util.AppendComplex64ArrayToTensorProto" , __pyx_clineno, __pyx_lineno, __pyx_filename); |
5523 | __pyx_r = NULL; |
5524 | goto __pyx_L2; |
5525 | __pyx_L0:; |
5526 | __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nparray.rcbuffer->pybuffer); |
5527 | __pyx_L2:; |
5528 | __Pyx_XGIVEREF(__pyx_r); |
5529 | __Pyx_RefNannyFinishContext(); |
5530 | return __pyx_r; |
5531 | } |
5532 | |
5533 | /* "tensorflow/python/framework/fast_tensor_util.pyx":114 |
5534 | * |
5535 | * |
5536 | * def AppendComplex128ArrayToTensorProto( # <<<<<<<<<<<<<< |
5537 | * tensor_proto, np.ndarray[np.complex128_t, ndim=1] nparray): |
5538 | * cdef long i, n |
5539 | */ |
5540 | |
5541 | /* Python wrapper */ |
5542 | static PyObject *__pyx_pw_10tensorflow_6python_9framework_16fast_tensor_util_27AppendComplex128ArrayToTensorProto(PyObject *__pyx_self, |
5543 | #if CYTHON_METH_FASTCALL |
5544 | PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds |
5545 | #else |
5546 | PyObject *__pyx_args, PyObject *__pyx_kwds |
5547 | #endif |
5548 | ); /*proto*/ |
5549 | static PyMethodDef __pyx_mdef_10tensorflow_6python_9framework_16fast_tensor_util_27AppendComplex128ArrayToTensorProto = {"AppendComplex128ArrayToTensorProto" , (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_10tensorflow_6python_9framework_16fast_tensor_util_27AppendComplex128ArrayToTensorProto, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; |
5550 | static PyObject *__pyx_pw_10tensorflow_6python_9framework_16fast_tensor_util_27AppendComplex128ArrayToTensorProto(PyObject *__pyx_self, |
5551 | #if CYTHON_METH_FASTCALL |
5552 | PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds |
5553 | #else |
5554 | PyObject *__pyx_args, PyObject *__pyx_kwds |
5555 | #endif |
5556 | ) { |
5557 | PyObject *__pyx_v_tensor_proto = 0; |
5558 | PyArrayObject *__pyx_v_nparray = 0; |
5559 | #if !CYTHON_METH_FASTCALL |
5560 | CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); |
5561 | #endif |
5562 | CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); |
5563 | int __pyx_lineno = 0; |
5564 | const char *__pyx_filename = NULL; |
5565 | int __pyx_clineno = 0; |
5566 | PyObject *__pyx_r = 0; |
5567 | __Pyx_RefNannyDeclarations |
5568 | __Pyx_RefNannySetupContext("AppendComplex128ArrayToTensorProto (wrapper)" , 0); |
5569 | { |
5570 | #if CYTHON_USE_MODULE_STATE |
5571 | PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tensor_proto,&__pyx_n_s_nparray,0}; |
5572 | #else |
5573 | static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tensor_proto,&__pyx_n_s_nparray,0}; |
5574 | #endif |
5575 | PyObject* values[2] = {0,0}; |
5576 | if (__pyx_kwds) { |
5577 | Py_ssize_t kw_args; |
5578 | switch (__pyx_nargs) { |
5579 | case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); |
5580 | CYTHON_FALLTHROUGH; |
5581 | case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); |
5582 | CYTHON_FALLTHROUGH; |
5583 | case 0: break; |
5584 | default: goto __pyx_L5_argtuple_error; |
5585 | } |
5586 | kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); |
5587 | switch (__pyx_nargs) { |
5588 | case 0: |
5589 | if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tensor_proto)) != 0)) kw_args--; |
5590 | else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 114, __pyx_L3_error) |
5591 | else goto __pyx_L5_argtuple_error; |
5592 | CYTHON_FALLTHROUGH; |
5593 | case 1: |
5594 | if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nparray)) != 0)) kw_args--; |
5595 | else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 114, __pyx_L3_error) |
5596 | else { |
5597 | __Pyx_RaiseArgtupleInvalid("AppendComplex128ArrayToTensorProto" , 1, 2, 2, 1); __PYX_ERR(0, 114, __pyx_L3_error) |
5598 | } |
5599 | } |
5600 | if (unlikely(kw_args > 0)) { |
5601 | const Py_ssize_t kwd_pos_args = __pyx_nargs; |
5602 | if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "AppendComplex128ArrayToTensorProto" ) < 0)) __PYX_ERR(0, 114, __pyx_L3_error) |
5603 | } |
5604 | } else if (unlikely(__pyx_nargs != 2)) { |
5605 | goto __pyx_L5_argtuple_error; |
5606 | } else { |
5607 | values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); |
5608 | values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); |
5609 | } |
5610 | __pyx_v_tensor_proto = values[0]; |
5611 | __pyx_v_nparray = ((PyArrayObject *)values[1]); |
5612 | } |
5613 | goto __pyx_L4_argument_unpacking_done; |
5614 | __pyx_L5_argtuple_error:; |
5615 | __Pyx_RaiseArgtupleInvalid("AppendComplex128ArrayToTensorProto" , 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 114, __pyx_L3_error) |
5616 | __pyx_L3_error:; |
5617 | __Pyx_AddTraceback("tensorflow.python.framework.fast_tensor_util.AppendComplex128ArrayToTensorProto" , __pyx_clineno, __pyx_lineno, __pyx_filename); |
5618 | __Pyx_RefNannyFinishContext(); |
5619 | return NULL; |
5620 | __pyx_L4_argument_unpacking_done:; |
5621 | if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nparray), __pyx_ptype_5numpy_ndarray, 1, "nparray" , 0))) __PYX_ERR(0, 115, __pyx_L1_error) |
5622 | __pyx_r = __pyx_pf_10tensorflow_6python_9framework_16fast_tensor_util_26AppendComplex128ArrayToTensorProto(__pyx_self, __pyx_v_tensor_proto, __pyx_v_nparray); |
5623 | |
5624 | /* function exit code */ |
5625 | goto __pyx_L0; |
5626 | __pyx_L1_error:; |
5627 | __pyx_r = NULL; |
5628 | __pyx_L0:; |
5629 | __Pyx_RefNannyFinishContext(); |
5630 | return __pyx_r; |
5631 | } |
5632 | |
5633 | static PyObject *__pyx_pf_10tensorflow_6python_9framework_16fast_tensor_util_26AppendComplex128ArrayToTensorProto(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tensor_proto, PyArrayObject *__pyx_v_nparray) { |
5634 | long __pyx_v_i; |
5635 | long __pyx_v_n; |
5636 | __Pyx_LocalBuf_ND __pyx_pybuffernd_nparray; |
5637 | __Pyx_Buffer __pyx_pybuffer_nparray; |
5638 | PyObject *__pyx_r = NULL; |
5639 | __Pyx_RefNannyDeclarations |
5640 | long __pyx_t_1; |
5641 | long __pyx_t_2; |
5642 | long __pyx_t_3; |
5643 | PyObject *__pyx_t_4 = NULL; |
5644 | Py_ssize_t __pyx_t_5; |
5645 | PyObject *__pyx_t_6 = NULL; |
5646 | int __pyx_t_7; |
5647 | int __pyx_lineno = 0; |
5648 | const char *__pyx_filename = NULL; |
5649 | int __pyx_clineno = 0; |
5650 | __Pyx_RefNannySetupContext("AppendComplex128ArrayToTensorProto" , 0); |
5651 | __pyx_pybuffer_nparray.pybuffer.buf = NULL; |
5652 | __pyx_pybuffer_nparray.refcount = 0; |
5653 | __pyx_pybuffernd_nparray.data = NULL; |
5654 | __pyx_pybuffernd_nparray.rcbuffer = &__pyx_pybuffer_nparray; |
5655 | { |
5656 | __Pyx_BufFmt_StackElem __pyx_stack[1]; |
5657 | if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nparray.rcbuffer->pybuffer, (PyObject*)__pyx_v_nparray, &__Pyx_TypeInfo___pyx_t_double_complex, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 114, __pyx_L1_error) |
5658 | } |
5659 | __pyx_pybuffernd_nparray.diminfo[0].strides = __pyx_pybuffernd_nparray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nparray.diminfo[0].shape = __pyx_pybuffernd_nparray.rcbuffer->pybuffer.shape[0]; |
5660 | |
5661 | /* "tensorflow/python/framework/fast_tensor_util.pyx":117 |
5662 | * tensor_proto, np.ndarray[np.complex128_t, ndim=1] nparray): |
5663 | * cdef long i, n |
5664 | * n = nparray.size # <<<<<<<<<<<<<< |
5665 | * for i in range(n): |
5666 | * tensor_proto.dcomplex_val.append(nparray[i].real) |
5667 | */ |
5668 | __pyx_v_n = __pyx_f_5numpy_7ndarray_4size_size(((PyArrayObject *)__pyx_v_nparray)); |
5669 | |
5670 | /* "tensorflow/python/framework/fast_tensor_util.pyx":118 |
5671 | * cdef long i, n |
5672 | * n = nparray.size |
5673 | * for i in range(n): # <<<<<<<<<<<<<< |
5674 | * tensor_proto.dcomplex_val.append(nparray[i].real) |
5675 | * tensor_proto.dcomplex_val.append(nparray[i].imag) |
5676 | */ |
5677 | __pyx_t_1 = __pyx_v_n; |
5678 | __pyx_t_2 = __pyx_t_1; |
5679 | for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { |
5680 | __pyx_v_i = __pyx_t_3; |
5681 | |
5682 | /* "tensorflow/python/framework/fast_tensor_util.pyx":119 |
5683 | * n = nparray.size |
5684 | * for i in range(n): |
5685 | * tensor_proto.dcomplex_val.append(nparray[i].real) # <<<<<<<<<<<<<< |
5686 | * tensor_proto.dcomplex_val.append(nparray[i].imag) |
5687 | * |
5688 | */ |
5689 | __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_tensor_proto, __pyx_n_s_dcomplex_val); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 119, __pyx_L1_error) |
5690 | __Pyx_GOTREF(__pyx_t_4); |
5691 | __pyx_t_5 = __pyx_v_i; |
5692 | __pyx_t_6 = PyFloat_FromDouble(__Pyx_CREAL((*__Pyx_BufPtrStrided1d(__pyx_t_double_complex *, __pyx_pybuffernd_nparray.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_nparray.diminfo[0].strides)))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 119, __pyx_L1_error) |
5693 | __Pyx_GOTREF(__pyx_t_6); |
5694 | __pyx_t_7 = __Pyx_PyObject_Append(__pyx_t_4, __pyx_t_6); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 119, __pyx_L1_error) |
5695 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
5696 | __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; |
5697 | |
5698 | /* "tensorflow/python/framework/fast_tensor_util.pyx":120 |
5699 | * for i in range(n): |
5700 | * tensor_proto.dcomplex_val.append(nparray[i].real) |
5701 | * tensor_proto.dcomplex_val.append(nparray[i].imag) # <<<<<<<<<<<<<< |
5702 | * |
5703 | * |
5704 | */ |
5705 | __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_tensor_proto, __pyx_n_s_dcomplex_val); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 120, __pyx_L1_error) |
5706 | __Pyx_GOTREF(__pyx_t_6); |
5707 | __pyx_t_5 = __pyx_v_i; |
5708 | __pyx_t_4 = PyFloat_FromDouble(__Pyx_CIMAG((*__Pyx_BufPtrStrided1d(__pyx_t_double_complex *, __pyx_pybuffernd_nparray.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_nparray.diminfo[0].strides)))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 120, __pyx_L1_error) |
5709 | __Pyx_GOTREF(__pyx_t_4); |
5710 | __pyx_t_7 = __Pyx_PyObject_Append(__pyx_t_6, __pyx_t_4); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 120, __pyx_L1_error) |
5711 | __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; |
5712 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
5713 | } |
5714 | |
5715 | /* "tensorflow/python/framework/fast_tensor_util.pyx":114 |
5716 | * |
5717 | * |
5718 | * def AppendComplex128ArrayToTensorProto( # <<<<<<<<<<<<<< |
5719 | * tensor_proto, np.ndarray[np.complex128_t, ndim=1] nparray): |
5720 | * cdef long i, n |
5721 | */ |
5722 | |
5723 | /* function exit code */ |
5724 | __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
5725 | goto __pyx_L0; |
5726 | __pyx_L1_error:; |
5727 | __Pyx_XDECREF(__pyx_t_4); |
5728 | __Pyx_XDECREF(__pyx_t_6); |
5729 | { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; |
5730 | __Pyx_PyThreadState_declare |
5731 | __Pyx_PyThreadState_assign |
5732 | __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); |
5733 | __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nparray.rcbuffer->pybuffer); |
5734 | __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} |
5735 | __Pyx_AddTraceback("tensorflow.python.framework.fast_tensor_util.AppendComplex128ArrayToTensorProto" , __pyx_clineno, __pyx_lineno, __pyx_filename); |
5736 | __pyx_r = NULL; |
5737 | goto __pyx_L2; |
5738 | __pyx_L0:; |
5739 | __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nparray.rcbuffer->pybuffer); |
5740 | __pyx_L2:; |
5741 | __Pyx_XGIVEREF(__pyx_r); |
5742 | __Pyx_RefNannyFinishContext(); |
5743 | return __pyx_r; |
5744 | } |
5745 | |
5746 | /* "tensorflow/python/framework/fast_tensor_util.pyx":123 |
5747 | * |
5748 | * |
5749 | * def AppendObjectArrayToTensorProto(tensor_proto, np.ndarray nparray): # <<<<<<<<<<<<<< |
5750 | * cdef long i, n |
5751 | * n = nparray.size |
5752 | */ |
5753 | |
5754 | /* Python wrapper */ |
5755 | static PyObject *__pyx_pw_10tensorflow_6python_9framework_16fast_tensor_util_29AppendObjectArrayToTensorProto(PyObject *__pyx_self, |
5756 | #if CYTHON_METH_FASTCALL |
5757 | PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds |
5758 | #else |
5759 | PyObject *__pyx_args, PyObject *__pyx_kwds |
5760 | #endif |
5761 | ); /*proto*/ |
5762 | static PyMethodDef __pyx_mdef_10tensorflow_6python_9framework_16fast_tensor_util_29AppendObjectArrayToTensorProto = {"AppendObjectArrayToTensorProto" , (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_10tensorflow_6python_9framework_16fast_tensor_util_29AppendObjectArrayToTensorProto, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; |
5763 | static PyObject *__pyx_pw_10tensorflow_6python_9framework_16fast_tensor_util_29AppendObjectArrayToTensorProto(PyObject *__pyx_self, |
5764 | #if CYTHON_METH_FASTCALL |
5765 | PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds |
5766 | #else |
5767 | PyObject *__pyx_args, PyObject *__pyx_kwds |
5768 | #endif |
5769 | ) { |
5770 | PyObject *__pyx_v_tensor_proto = 0; |
5771 | PyArrayObject *__pyx_v_nparray = 0; |
5772 | #if !CYTHON_METH_FASTCALL |
5773 | CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); |
5774 | #endif |
5775 | CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); |
5776 | int __pyx_lineno = 0; |
5777 | const char *__pyx_filename = NULL; |
5778 | int __pyx_clineno = 0; |
5779 | PyObject *__pyx_r = 0; |
5780 | __Pyx_RefNannyDeclarations |
5781 | __Pyx_RefNannySetupContext("AppendObjectArrayToTensorProto (wrapper)" , 0); |
5782 | { |
5783 | #if CYTHON_USE_MODULE_STATE |
5784 | PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tensor_proto,&__pyx_n_s_nparray,0}; |
5785 | #else |
5786 | static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tensor_proto,&__pyx_n_s_nparray,0}; |
5787 | #endif |
5788 | PyObject* values[2] = {0,0}; |
5789 | if (__pyx_kwds) { |
5790 | Py_ssize_t kw_args; |
5791 | switch (__pyx_nargs) { |
5792 | case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); |
5793 | CYTHON_FALLTHROUGH; |
5794 | case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); |
5795 | CYTHON_FALLTHROUGH; |
5796 | case 0: break; |
5797 | default: goto __pyx_L5_argtuple_error; |
5798 | } |
5799 | kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); |
5800 | switch (__pyx_nargs) { |
5801 | case 0: |
5802 | if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tensor_proto)) != 0)) kw_args--; |
5803 | else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 123, __pyx_L3_error) |
5804 | else goto __pyx_L5_argtuple_error; |
5805 | CYTHON_FALLTHROUGH; |
5806 | case 1: |
5807 | if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nparray)) != 0)) kw_args--; |
5808 | else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 123, __pyx_L3_error) |
5809 | else { |
5810 | __Pyx_RaiseArgtupleInvalid("AppendObjectArrayToTensorProto" , 1, 2, 2, 1); __PYX_ERR(0, 123, __pyx_L3_error) |
5811 | } |
5812 | } |
5813 | if (unlikely(kw_args > 0)) { |
5814 | const Py_ssize_t kwd_pos_args = __pyx_nargs; |
5815 | if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "AppendObjectArrayToTensorProto" ) < 0)) __PYX_ERR(0, 123, __pyx_L3_error) |
5816 | } |
5817 | } else if (unlikely(__pyx_nargs != 2)) { |
5818 | goto __pyx_L5_argtuple_error; |
5819 | } else { |
5820 | values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); |
5821 | values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); |
5822 | } |
5823 | __pyx_v_tensor_proto = values[0]; |
5824 | __pyx_v_nparray = ((PyArrayObject *)values[1]); |
5825 | } |
5826 | goto __pyx_L4_argument_unpacking_done; |
5827 | __pyx_L5_argtuple_error:; |
5828 | __Pyx_RaiseArgtupleInvalid("AppendObjectArrayToTensorProto" , 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 123, __pyx_L3_error) |
5829 | __pyx_L3_error:; |
5830 | __Pyx_AddTraceback("tensorflow.python.framework.fast_tensor_util.AppendObjectArrayToTensorProto" , __pyx_clineno, __pyx_lineno, __pyx_filename); |
5831 | __Pyx_RefNannyFinishContext(); |
5832 | return NULL; |
5833 | __pyx_L4_argument_unpacking_done:; |
5834 | if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nparray), __pyx_ptype_5numpy_ndarray, 1, "nparray" , 0))) __PYX_ERR(0, 123, __pyx_L1_error) |
5835 | __pyx_r = __pyx_pf_10tensorflow_6python_9framework_16fast_tensor_util_28AppendObjectArrayToTensorProto(__pyx_self, __pyx_v_tensor_proto, __pyx_v_nparray); |
5836 | |
5837 | /* function exit code */ |
5838 | goto __pyx_L0; |
5839 | __pyx_L1_error:; |
5840 | __pyx_r = NULL; |
5841 | __pyx_L0:; |
5842 | __Pyx_RefNannyFinishContext(); |
5843 | return __pyx_r; |
5844 | } |
5845 | |
5846 | static PyObject *__pyx_pf_10tensorflow_6python_9framework_16fast_tensor_util_28AppendObjectArrayToTensorProto(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tensor_proto, PyArrayObject *__pyx_v_nparray) { |
5847 | long __pyx_v_i; |
5848 | long __pyx_v_n; |
5849 | PyObject *__pyx_r = NULL; |
5850 | __Pyx_RefNannyDeclarations |
5851 | long __pyx_t_1; |
5852 | long __pyx_t_2; |
5853 | long __pyx_t_3; |
5854 | PyObject *__pyx_t_4 = NULL; |
5855 | PyObject *__pyx_t_5 = NULL; |
5856 | PyObject *__pyx_t_6 = NULL; |
5857 | PyObject *__pyx_t_7 = NULL; |
5858 | PyObject *__pyx_t_8 = NULL; |
5859 | int __pyx_t_9; |
5860 | int __pyx_t_10; |
5861 | int __pyx_lineno = 0; |
5862 | const char *__pyx_filename = NULL; |
5863 | int __pyx_clineno = 0; |
5864 | __Pyx_RefNannySetupContext("AppendObjectArrayToTensorProto" , 0); |
5865 | |
5866 | /* "tensorflow/python/framework/fast_tensor_util.pyx":125 |
5867 | * def AppendObjectArrayToTensorProto(tensor_proto, np.ndarray nparray): |
5868 | * cdef long i, n |
5869 | * n = nparray.size # <<<<<<<<<<<<<< |
5870 | * for i in range(n): |
5871 | * tensor_proto.string_val.append(compat.as_bytes(nparray[i])) |
5872 | */ |
5873 | __pyx_v_n = __pyx_f_5numpy_7ndarray_4size_size(__pyx_v_nparray); |
5874 | |
5875 | /* "tensorflow/python/framework/fast_tensor_util.pyx":126 |
5876 | * cdef long i, n |
5877 | * n = nparray.size |
5878 | * for i in range(n): # <<<<<<<<<<<<<< |
5879 | * tensor_proto.string_val.append(compat.as_bytes(nparray[i])) |
5880 | * |
5881 | */ |
5882 | __pyx_t_1 = __pyx_v_n; |
5883 | __pyx_t_2 = __pyx_t_1; |
5884 | for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { |
5885 | __pyx_v_i = __pyx_t_3; |
5886 | |
5887 | /* "tensorflow/python/framework/fast_tensor_util.pyx":127 |
5888 | * n = nparray.size |
5889 | * for i in range(n): |
5890 | * tensor_proto.string_val.append(compat.as_bytes(nparray[i])) # <<<<<<<<<<<<<< |
5891 | * |
5892 | * |
5893 | */ |
5894 | __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_tensor_proto, __pyx_n_s_string_val); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 127, __pyx_L1_error) |
5895 | __Pyx_GOTREF(__pyx_t_4); |
5896 | __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_compat); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 127, __pyx_L1_error) |
5897 | __Pyx_GOTREF(__pyx_t_6); |
5898 | __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_as_bytes); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 127, __pyx_L1_error) |
5899 | __Pyx_GOTREF(__pyx_t_7); |
5900 | __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; |
5901 | __pyx_t_6 = __Pyx_GetItemInt(((PyObject *)__pyx_v_nparray), __pyx_v_i, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 127, __pyx_L1_error) |
5902 | __Pyx_GOTREF(__pyx_t_6); |
5903 | __pyx_t_8 = NULL; |
5904 | __pyx_t_9 = 0; |
5905 | if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { |
5906 | __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7); |
5907 | if (likely(__pyx_t_8)) { |
5908 | PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); |
5909 | __Pyx_INCREF(__pyx_t_8); |
5910 | __Pyx_INCREF(function); |
5911 | __Pyx_DECREF_SET(__pyx_t_7, function); |
5912 | __pyx_t_9 = 1; |
5913 | } |
5914 | } |
5915 | { |
5916 | PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_t_6}; |
5917 | __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9); |
5918 | __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; |
5919 | __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; |
5920 | if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 127, __pyx_L1_error) |
5921 | __Pyx_GOTREF(__pyx_t_5); |
5922 | __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; |
5923 | } |
5924 | __pyx_t_10 = __Pyx_PyObject_Append(__pyx_t_4, __pyx_t_5); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 127, __pyx_L1_error) |
5925 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
5926 | __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; |
5927 | } |
5928 | |
5929 | /* "tensorflow/python/framework/fast_tensor_util.pyx":123 |
5930 | * |
5931 | * |
5932 | * def AppendObjectArrayToTensorProto(tensor_proto, np.ndarray nparray): # <<<<<<<<<<<<<< |
5933 | * cdef long i, n |
5934 | * n = nparray.size |
5935 | */ |
5936 | |
5937 | /* function exit code */ |
5938 | __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
5939 | goto __pyx_L0; |
5940 | __pyx_L1_error:; |
5941 | __Pyx_XDECREF(__pyx_t_4); |
5942 | __Pyx_XDECREF(__pyx_t_5); |
5943 | __Pyx_XDECREF(__pyx_t_6); |
5944 | __Pyx_XDECREF(__pyx_t_7); |
5945 | __Pyx_XDECREF(__pyx_t_8); |
5946 | __Pyx_AddTraceback("tensorflow.python.framework.fast_tensor_util.AppendObjectArrayToTensorProto" , __pyx_clineno, __pyx_lineno, __pyx_filename); |
5947 | __pyx_r = NULL; |
5948 | __pyx_L0:; |
5949 | __Pyx_XGIVEREF(__pyx_r); |
5950 | __Pyx_RefNannyFinishContext(); |
5951 | return __pyx_r; |
5952 | } |
5953 | |
5954 | /* "tensorflow/python/framework/fast_tensor_util.pyx":130 |
5955 | * |
5956 | * |
5957 | * def AppendBoolArrayToTensorProto(tensor_proto, nparray): # <<<<<<<<<<<<<< |
5958 | * cdef long i, n |
5959 | * n = nparray.size |
5960 | */ |
5961 | |
5962 | /* Python wrapper */ |
5963 | static PyObject *__pyx_pw_10tensorflow_6python_9framework_16fast_tensor_util_31AppendBoolArrayToTensorProto(PyObject *__pyx_self, |
5964 | #if CYTHON_METH_FASTCALL |
5965 | PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds |
5966 | #else |
5967 | PyObject *__pyx_args, PyObject *__pyx_kwds |
5968 | #endif |
5969 | ); /*proto*/ |
5970 | static PyMethodDef __pyx_mdef_10tensorflow_6python_9framework_16fast_tensor_util_31AppendBoolArrayToTensorProto = {"AppendBoolArrayToTensorProto" , (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_10tensorflow_6python_9framework_16fast_tensor_util_31AppendBoolArrayToTensorProto, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; |
5971 | static PyObject *__pyx_pw_10tensorflow_6python_9framework_16fast_tensor_util_31AppendBoolArrayToTensorProto(PyObject *__pyx_self, |
5972 | #if CYTHON_METH_FASTCALL |
5973 | PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds |
5974 | #else |
5975 | PyObject *__pyx_args, PyObject *__pyx_kwds |
5976 | #endif |
5977 | ) { |
5978 | PyObject *__pyx_v_tensor_proto = 0; |
5979 | PyObject *__pyx_v_nparray = 0; |
5980 | #if !CYTHON_METH_FASTCALL |
5981 | CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); |
5982 | #endif |
5983 | CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); |
5984 | int __pyx_lineno = 0; |
5985 | const char *__pyx_filename = NULL; |
5986 | int __pyx_clineno = 0; |
5987 | PyObject *__pyx_r = 0; |
5988 | __Pyx_RefNannyDeclarations |
5989 | __Pyx_RefNannySetupContext("AppendBoolArrayToTensorProto (wrapper)" , 0); |
5990 | { |
5991 | #if CYTHON_USE_MODULE_STATE |
5992 | PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tensor_proto,&__pyx_n_s_nparray,0}; |
5993 | #else |
5994 | static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tensor_proto,&__pyx_n_s_nparray,0}; |
5995 | #endif |
5996 | PyObject* values[2] = {0,0}; |
5997 | if (__pyx_kwds) { |
5998 | Py_ssize_t kw_args; |
5999 | switch (__pyx_nargs) { |
6000 | case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); |
6001 | CYTHON_FALLTHROUGH; |
6002 | case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); |
6003 | CYTHON_FALLTHROUGH; |
6004 | case 0: break; |
6005 | default: goto __pyx_L5_argtuple_error; |
6006 | } |
6007 | kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); |
6008 | switch (__pyx_nargs) { |
6009 | case 0: |
6010 | if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tensor_proto)) != 0)) kw_args--; |
6011 | else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 130, __pyx_L3_error) |
6012 | else goto __pyx_L5_argtuple_error; |
6013 | CYTHON_FALLTHROUGH; |
6014 | case 1: |
6015 | if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nparray)) != 0)) kw_args--; |
6016 | else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 130, __pyx_L3_error) |
6017 | else { |
6018 | __Pyx_RaiseArgtupleInvalid("AppendBoolArrayToTensorProto" , 1, 2, 2, 1); __PYX_ERR(0, 130, __pyx_L3_error) |
6019 | } |
6020 | } |
6021 | if (unlikely(kw_args > 0)) { |
6022 | const Py_ssize_t kwd_pos_args = __pyx_nargs; |
6023 | if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "AppendBoolArrayToTensorProto" ) < 0)) __PYX_ERR(0, 130, __pyx_L3_error) |
6024 | } |
6025 | } else if (unlikely(__pyx_nargs != 2)) { |
6026 | goto __pyx_L5_argtuple_error; |
6027 | } else { |
6028 | values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); |
6029 | values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); |
6030 | } |
6031 | __pyx_v_tensor_proto = values[0]; |
6032 | __pyx_v_nparray = values[1]; |
6033 | } |
6034 | goto __pyx_L4_argument_unpacking_done; |
6035 | __pyx_L5_argtuple_error:; |
6036 | __Pyx_RaiseArgtupleInvalid("AppendBoolArrayToTensorProto" , 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 130, __pyx_L3_error) |
6037 | __pyx_L3_error:; |
6038 | __Pyx_AddTraceback("tensorflow.python.framework.fast_tensor_util.AppendBoolArrayToTensorProto" , __pyx_clineno, __pyx_lineno, __pyx_filename); |
6039 | __Pyx_RefNannyFinishContext(); |
6040 | return NULL; |
6041 | __pyx_L4_argument_unpacking_done:; |
6042 | __pyx_r = __pyx_pf_10tensorflow_6python_9framework_16fast_tensor_util_30AppendBoolArrayToTensorProto(__pyx_self, __pyx_v_tensor_proto, __pyx_v_nparray); |
6043 | |
6044 | /* function exit code */ |
6045 | __Pyx_RefNannyFinishContext(); |
6046 | return __pyx_r; |
6047 | } |
6048 | |
6049 | static PyObject *__pyx_pf_10tensorflow_6python_9framework_16fast_tensor_util_30AppendBoolArrayToTensorProto(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tensor_proto, PyObject *__pyx_v_nparray) { |
6050 | long __pyx_v_i; |
6051 | long __pyx_v_n; |
6052 | PyObject *__pyx_r = NULL; |
6053 | __Pyx_RefNannyDeclarations |
6054 | PyObject *__pyx_t_1 = NULL; |
6055 | long __pyx_t_2; |
6056 | long __pyx_t_3; |
6057 | long __pyx_t_4; |
6058 | PyObject *__pyx_t_5 = NULL; |
6059 | PyObject *__pyx_t_6 = NULL; |
6060 | PyObject *__pyx_t_7 = NULL; |
6061 | PyObject *__pyx_t_8 = NULL; |
6062 | int __pyx_t_9; |
6063 | int __pyx_t_10; |
6064 | int __pyx_lineno = 0; |
6065 | const char *__pyx_filename = NULL; |
6066 | int __pyx_clineno = 0; |
6067 | __Pyx_RefNannySetupContext("AppendBoolArrayToTensorProto" , 0); |
6068 | |
6069 | /* "tensorflow/python/framework/fast_tensor_util.pyx":132 |
6070 | * def AppendBoolArrayToTensorProto(tensor_proto, nparray): |
6071 | * cdef long i, n |
6072 | * n = nparray.size # <<<<<<<<<<<<<< |
6073 | * for i in range(n): |
6074 | * tensor_proto.bool_val.append(nparray.item(i)) |
6075 | */ |
6076 | __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_nparray, __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 132, __pyx_L1_error) |
6077 | __Pyx_GOTREF(__pyx_t_1); |
6078 | __pyx_t_2 = __Pyx_PyInt_As_long(__pyx_t_1); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 132, __pyx_L1_error) |
6079 | __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
6080 | __pyx_v_n = __pyx_t_2; |
6081 | |
6082 | /* "tensorflow/python/framework/fast_tensor_util.pyx":133 |
6083 | * cdef long i, n |
6084 | * n = nparray.size |
6085 | * for i in range(n): # <<<<<<<<<<<<<< |
6086 | * tensor_proto.bool_val.append(nparray.item(i)) |
6087 | */ |
6088 | __pyx_t_2 = __pyx_v_n; |
6089 | __pyx_t_3 = __pyx_t_2; |
6090 | for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { |
6091 | __pyx_v_i = __pyx_t_4; |
6092 | |
6093 | /* "tensorflow/python/framework/fast_tensor_util.pyx":134 |
6094 | * n = nparray.size |
6095 | * for i in range(n): |
6096 | * tensor_proto.bool_val.append(nparray.item(i)) # <<<<<<<<<<<<<< |
6097 | */ |
6098 | __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_tensor_proto, __pyx_n_s_bool_val); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 134, __pyx_L1_error) |
6099 | __Pyx_GOTREF(__pyx_t_1); |
6100 | __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_nparray, __pyx_n_s_item); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 134, __pyx_L1_error) |
6101 | __Pyx_GOTREF(__pyx_t_6); |
6102 | __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_i); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 134, __pyx_L1_error) |
6103 | __Pyx_GOTREF(__pyx_t_7); |
6104 | __pyx_t_8 = NULL; |
6105 | __pyx_t_9 = 0; |
6106 | if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { |
6107 | __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6); |
6108 | if (likely(__pyx_t_8)) { |
6109 | PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); |
6110 | __Pyx_INCREF(__pyx_t_8); |
6111 | __Pyx_INCREF(function); |
6112 | __Pyx_DECREF_SET(__pyx_t_6, function); |
6113 | __pyx_t_9 = 1; |
6114 | } |
6115 | } |
6116 | { |
6117 | PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_t_7}; |
6118 | __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9); |
6119 | __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; |
6120 | __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; |
6121 | if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 134, __pyx_L1_error) |
6122 | __Pyx_GOTREF(__pyx_t_5); |
6123 | __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; |
6124 | } |
6125 | __pyx_t_10 = __Pyx_PyObject_Append(__pyx_t_1, __pyx_t_5); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 134, __pyx_L1_error) |
6126 | __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
6127 | __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; |
6128 | } |
6129 | |
6130 | /* "tensorflow/python/framework/fast_tensor_util.pyx":130 |
6131 | * |
6132 | * |
6133 | * def AppendBoolArrayToTensorProto(tensor_proto, nparray): # <<<<<<<<<<<<<< |
6134 | * cdef long i, n |
6135 | * n = nparray.size |
6136 | */ |
6137 | |
6138 | /* function exit code */ |
6139 | __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
6140 | goto __pyx_L0; |
6141 | __pyx_L1_error:; |
6142 | __Pyx_XDECREF(__pyx_t_1); |
6143 | __Pyx_XDECREF(__pyx_t_5); |
6144 | __Pyx_XDECREF(__pyx_t_6); |
6145 | __Pyx_XDECREF(__pyx_t_7); |
6146 | __Pyx_XDECREF(__pyx_t_8); |
6147 | __Pyx_AddTraceback("tensorflow.python.framework.fast_tensor_util.AppendBoolArrayToTensorProto" , __pyx_clineno, __pyx_lineno, __pyx_filename); |
6148 | __pyx_r = NULL; |
6149 | __pyx_L0:; |
6150 | __Pyx_XGIVEREF(__pyx_r); |
6151 | __Pyx_RefNannyFinishContext(); |
6152 | return __pyx_r; |
6153 | } |
6154 | |
6155 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":245 |
6156 | * |
6157 | * @property |
6158 | * cdef inline PyObject* base(self) nogil: # <<<<<<<<<<<<<< |
6159 | * """Returns a borrowed reference to the object owning the data/memory. |
6160 | * """ |
6161 | */ |
6162 | |
6163 | static CYTHON_INLINE PyObject *__pyx_f_5numpy_7ndarray_4base_base(PyArrayObject *__pyx_v_self) { |
6164 | PyObject *__pyx_r; |
6165 | |
6166 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":248 |
6167 | * """Returns a borrowed reference to the object owning the data/memory. |
6168 | * """ |
6169 | * return PyArray_BASE(self) # <<<<<<<<<<<<<< |
6170 | * |
6171 | * @property |
6172 | */ |
6173 | __pyx_r = PyArray_BASE(__pyx_v_self); |
6174 | goto __pyx_L0; |
6175 | |
6176 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":245 |
6177 | * |
6178 | * @property |
6179 | * cdef inline PyObject* base(self) nogil: # <<<<<<<<<<<<<< |
6180 | * """Returns a borrowed reference to the object owning the data/memory. |
6181 | * """ |
6182 | */ |
6183 | |
6184 | /* function exit code */ |
6185 | __pyx_L0:; |
6186 | return __pyx_r; |
6187 | } |
6188 | |
6189 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":251 |
6190 | * |
6191 | * @property |
6192 | * cdef inline dtype descr(self): # <<<<<<<<<<<<<< |
6193 | * """Returns an owned reference to the dtype of the array. |
6194 | * """ |
6195 | */ |
6196 | |
6197 | static CYTHON_INLINE PyArray_Descr *__pyx_f_5numpy_7ndarray_5descr_descr(PyArrayObject *__pyx_v_self) { |
6198 | PyArray_Descr *__pyx_r = NULL; |
6199 | __Pyx_RefNannyDeclarations |
6200 | PyArray_Descr *__pyx_t_1; |
6201 | __Pyx_RefNannySetupContext("descr" , 0); |
6202 | |
6203 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":254 |
6204 | * """Returns an owned reference to the dtype of the array. |
6205 | * """ |
6206 | * return <dtype>PyArray_DESCR(self) # <<<<<<<<<<<<<< |
6207 | * |
6208 | * @property |
6209 | */ |
6210 | __Pyx_XDECREF((PyObject *)__pyx_r); |
6211 | __pyx_t_1 = PyArray_DESCR(__pyx_v_self); |
6212 | __Pyx_INCREF((PyObject *)((PyArray_Descr *)__pyx_t_1)); |
6213 | __pyx_r = ((PyArray_Descr *)__pyx_t_1); |
6214 | goto __pyx_L0; |
6215 | |
6216 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":251 |
6217 | * |
6218 | * @property |
6219 | * cdef inline dtype descr(self): # <<<<<<<<<<<<<< |
6220 | * """Returns an owned reference to the dtype of the array. |
6221 | * """ |
6222 | */ |
6223 | |
6224 | /* function exit code */ |
6225 | __pyx_L0:; |
6226 | __Pyx_XGIVEREF((PyObject *)__pyx_r); |
6227 | __Pyx_RefNannyFinishContext(); |
6228 | return __pyx_r; |
6229 | } |
6230 | |
6231 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":257 |
6232 | * |
6233 | * @property |
6234 | * cdef inline int ndim(self) nogil: # <<<<<<<<<<<<<< |
6235 | * """Returns the number of dimensions in the array. |
6236 | * """ |
6237 | */ |
6238 | |
6239 | static CYTHON_INLINE int __pyx_f_5numpy_7ndarray_4ndim_ndim(PyArrayObject *__pyx_v_self) { |
6240 | int __pyx_r; |
6241 | |
6242 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":260 |
6243 | * """Returns the number of dimensions in the array. |
6244 | * """ |
6245 | * return PyArray_NDIM(self) # <<<<<<<<<<<<<< |
6246 | * |
6247 | * @property |
6248 | */ |
6249 | __pyx_r = PyArray_NDIM(__pyx_v_self); |
6250 | goto __pyx_L0; |
6251 | |
6252 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":257 |
6253 | * |
6254 | * @property |
6255 | * cdef inline int ndim(self) nogil: # <<<<<<<<<<<<<< |
6256 | * """Returns the number of dimensions in the array. |
6257 | * """ |
6258 | */ |
6259 | |
6260 | /* function exit code */ |
6261 | __pyx_L0:; |
6262 | return __pyx_r; |
6263 | } |
6264 | |
6265 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":263 |
6266 | * |
6267 | * @property |
6268 | * cdef inline npy_intp *shape(self) nogil: # <<<<<<<<<<<<<< |
6269 | * """Returns a pointer to the dimensions/shape of the array. |
6270 | * The number of elements matches the number of dimensions of the array (ndim). |
6271 | */ |
6272 | |
6273 | static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_5shape_shape(PyArrayObject *__pyx_v_self) { |
6274 | npy_intp *__pyx_r; |
6275 | |
6276 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":268 |
6277 | * Can return NULL for 0-dimensional arrays. |
6278 | * """ |
6279 | * return PyArray_DIMS(self) # <<<<<<<<<<<<<< |
6280 | * |
6281 | * @property |
6282 | */ |
6283 | __pyx_r = PyArray_DIMS(__pyx_v_self); |
6284 | goto __pyx_L0; |
6285 | |
6286 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":263 |
6287 | * |
6288 | * @property |
6289 | * cdef inline npy_intp *shape(self) nogil: # <<<<<<<<<<<<<< |
6290 | * """Returns a pointer to the dimensions/shape of the array. |
6291 | * The number of elements matches the number of dimensions of the array (ndim). |
6292 | */ |
6293 | |
6294 | /* function exit code */ |
6295 | __pyx_L0:; |
6296 | return __pyx_r; |
6297 | } |
6298 | |
6299 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":271 |
6300 | * |
6301 | * @property |
6302 | * cdef inline npy_intp *strides(self) nogil: # <<<<<<<<<<<<<< |
6303 | * """Returns a pointer to the strides of the array. |
6304 | * The number of elements matches the number of dimensions of the array (ndim). |
6305 | */ |
6306 | |
6307 | static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_7strides_strides(PyArrayObject *__pyx_v_self) { |
6308 | npy_intp *__pyx_r; |
6309 | |
6310 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":275 |
6311 | * The number of elements matches the number of dimensions of the array (ndim). |
6312 | * """ |
6313 | * return PyArray_STRIDES(self) # <<<<<<<<<<<<<< |
6314 | * |
6315 | * @property |
6316 | */ |
6317 | __pyx_r = PyArray_STRIDES(__pyx_v_self); |
6318 | goto __pyx_L0; |
6319 | |
6320 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":271 |
6321 | * |
6322 | * @property |
6323 | * cdef inline npy_intp *strides(self) nogil: # <<<<<<<<<<<<<< |
6324 | * """Returns a pointer to the strides of the array. |
6325 | * The number of elements matches the number of dimensions of the array (ndim). |
6326 | */ |
6327 | |
6328 | /* function exit code */ |
6329 | __pyx_L0:; |
6330 | return __pyx_r; |
6331 | } |
6332 | |
6333 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":278 |
6334 | * |
6335 | * @property |
6336 | * cdef inline npy_intp size(self) nogil: # <<<<<<<<<<<<<< |
6337 | * """Returns the total size (in number of elements) of the array. |
6338 | * """ |
6339 | */ |
6340 | |
6341 | static CYTHON_INLINE npy_intp __pyx_f_5numpy_7ndarray_4size_size(PyArrayObject *__pyx_v_self) { |
6342 | npy_intp __pyx_r; |
6343 | |
6344 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":281 |
6345 | * """Returns the total size (in number of elements) of the array. |
6346 | * """ |
6347 | * return PyArray_SIZE(self) # <<<<<<<<<<<<<< |
6348 | * |
6349 | * @property |
6350 | */ |
6351 | __pyx_r = PyArray_SIZE(__pyx_v_self); |
6352 | goto __pyx_L0; |
6353 | |
6354 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":278 |
6355 | * |
6356 | * @property |
6357 | * cdef inline npy_intp size(self) nogil: # <<<<<<<<<<<<<< |
6358 | * """Returns the total size (in number of elements) of the array. |
6359 | * """ |
6360 | */ |
6361 | |
6362 | /* function exit code */ |
6363 | __pyx_L0:; |
6364 | return __pyx_r; |
6365 | } |
6366 | |
6367 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":284 |
6368 | * |
6369 | * @property |
6370 | * cdef inline char* data(self) nogil: # <<<<<<<<<<<<<< |
6371 | * """The pointer to the data buffer as a char*. |
6372 | * This is provided for legacy reasons to avoid direct struct field access. |
6373 | */ |
6374 | |
6375 | static CYTHON_INLINE char *__pyx_f_5numpy_7ndarray_4data_data(PyArrayObject *__pyx_v_self) { |
6376 | char *__pyx_r; |
6377 | |
6378 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":290 |
6379 | * of `PyArray_DATA()` instead, which returns a 'void*'. |
6380 | * """ |
6381 | * return PyArray_BYTES(self) # <<<<<<<<<<<<<< |
6382 | * |
6383 | * ctypedef unsigned char npy_bool |
6384 | */ |
6385 | __pyx_r = PyArray_BYTES(__pyx_v_self); |
6386 | goto __pyx_L0; |
6387 | |
6388 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":284 |
6389 | * |
6390 | * @property |
6391 | * cdef inline char* data(self) nogil: # <<<<<<<<<<<<<< |
6392 | * """The pointer to the data buffer as a char*. |
6393 | * This is provided for legacy reasons to avoid direct struct field access. |
6394 | */ |
6395 | |
6396 | /* function exit code */ |
6397 | __pyx_L0:; |
6398 | return __pyx_r; |
6399 | } |
6400 | |
6401 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":776 |
6402 | * ctypedef npy_cdouble complex_t |
6403 | * |
6404 | * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< |
6405 | * return PyArray_MultiIterNew(1, <void*>a) |
6406 | * |
6407 | */ |
6408 | |
6409 | static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { |
6410 | PyObject *__pyx_r = NULL; |
6411 | __Pyx_RefNannyDeclarations |
6412 | PyObject *__pyx_t_1 = NULL; |
6413 | int __pyx_lineno = 0; |
6414 | const char *__pyx_filename = NULL; |
6415 | int __pyx_clineno = 0; |
6416 | __Pyx_RefNannySetupContext("PyArray_MultiIterNew1" , 0); |
6417 | |
6418 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":777 |
6419 | * |
6420 | * cdef inline object PyArray_MultiIterNew1(a): |
6421 | * return PyArray_MultiIterNew(1, <void*>a) # <<<<<<<<<<<<<< |
6422 | * |
6423 | * cdef inline object PyArray_MultiIterNew2(a, b): |
6424 | */ |
6425 | __Pyx_XDECREF(__pyx_r); |
6426 | __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 777, __pyx_L1_error) |
6427 | __Pyx_GOTREF(__pyx_t_1); |
6428 | __pyx_r = __pyx_t_1; |
6429 | __pyx_t_1 = 0; |
6430 | goto __pyx_L0; |
6431 | |
6432 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":776 |
6433 | * ctypedef npy_cdouble complex_t |
6434 | * |
6435 | * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< |
6436 | * return PyArray_MultiIterNew(1, <void*>a) |
6437 | * |
6438 | */ |
6439 | |
6440 | /* function exit code */ |
6441 | __pyx_L1_error:; |
6442 | __Pyx_XDECREF(__pyx_t_1); |
6443 | __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1" , __pyx_clineno, __pyx_lineno, __pyx_filename); |
6444 | __pyx_r = 0; |
6445 | __pyx_L0:; |
6446 | __Pyx_XGIVEREF(__pyx_r); |
6447 | __Pyx_RefNannyFinishContext(); |
6448 | return __pyx_r; |
6449 | } |
6450 | |
6451 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":779 |
6452 | * return PyArray_MultiIterNew(1, <void*>a) |
6453 | * |
6454 | * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< |
6455 | * return PyArray_MultiIterNew(2, <void*>a, <void*>b) |
6456 | * |
6457 | */ |
6458 | |
6459 | static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { |
6460 | PyObject *__pyx_r = NULL; |
6461 | __Pyx_RefNannyDeclarations |
6462 | PyObject *__pyx_t_1 = NULL; |
6463 | int __pyx_lineno = 0; |
6464 | const char *__pyx_filename = NULL; |
6465 | int __pyx_clineno = 0; |
6466 | __Pyx_RefNannySetupContext("PyArray_MultiIterNew2" , 0); |
6467 | |
6468 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":780 |
6469 | * |
6470 | * cdef inline object PyArray_MultiIterNew2(a, b): |
6471 | * return PyArray_MultiIterNew(2, <void*>a, <void*>b) # <<<<<<<<<<<<<< |
6472 | * |
6473 | * cdef inline object PyArray_MultiIterNew3(a, b, c): |
6474 | */ |
6475 | __Pyx_XDECREF(__pyx_r); |
6476 | __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 780, __pyx_L1_error) |
6477 | __Pyx_GOTREF(__pyx_t_1); |
6478 | __pyx_r = __pyx_t_1; |
6479 | __pyx_t_1 = 0; |
6480 | goto __pyx_L0; |
6481 | |
6482 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":779 |
6483 | * return PyArray_MultiIterNew(1, <void*>a) |
6484 | * |
6485 | * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< |
6486 | * return PyArray_MultiIterNew(2, <void*>a, <void*>b) |
6487 | * |
6488 | */ |
6489 | |
6490 | /* function exit code */ |
6491 | __pyx_L1_error:; |
6492 | __Pyx_XDECREF(__pyx_t_1); |
6493 | __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2" , __pyx_clineno, __pyx_lineno, __pyx_filename); |
6494 | __pyx_r = 0; |
6495 | __pyx_L0:; |
6496 | __Pyx_XGIVEREF(__pyx_r); |
6497 | __Pyx_RefNannyFinishContext(); |
6498 | return __pyx_r; |
6499 | } |
6500 | |
6501 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":782 |
6502 | * return PyArray_MultiIterNew(2, <void*>a, <void*>b) |
6503 | * |
6504 | * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< |
6505 | * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c) |
6506 | * |
6507 | */ |
6508 | |
6509 | static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { |
6510 | PyObject *__pyx_r = NULL; |
6511 | __Pyx_RefNannyDeclarations |
6512 | PyObject *__pyx_t_1 = NULL; |
6513 | int __pyx_lineno = 0; |
6514 | const char *__pyx_filename = NULL; |
6515 | int __pyx_clineno = 0; |
6516 | __Pyx_RefNannySetupContext("PyArray_MultiIterNew3" , 0); |
6517 | |
6518 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":783 |
6519 | * |
6520 | * cdef inline object PyArray_MultiIterNew3(a, b, c): |
6521 | * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c) # <<<<<<<<<<<<<< |
6522 | * |
6523 | * cdef inline object PyArray_MultiIterNew4(a, b, c, d): |
6524 | */ |
6525 | __Pyx_XDECREF(__pyx_r); |
6526 | __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, 783, __pyx_L1_error) |
6527 | __Pyx_GOTREF(__pyx_t_1); |
6528 | __pyx_r = __pyx_t_1; |
6529 | __pyx_t_1 = 0; |
6530 | goto __pyx_L0; |
6531 | |
6532 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":782 |
6533 | * return PyArray_MultiIterNew(2, <void*>a, <void*>b) |
6534 | * |
6535 | * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< |
6536 | * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c) |
6537 | * |
6538 | */ |
6539 | |
6540 | /* function exit code */ |
6541 | __pyx_L1_error:; |
6542 | __Pyx_XDECREF(__pyx_t_1); |
6543 | __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3" , __pyx_clineno, __pyx_lineno, __pyx_filename); |
6544 | __pyx_r = 0; |
6545 | __pyx_L0:; |
6546 | __Pyx_XGIVEREF(__pyx_r); |
6547 | __Pyx_RefNannyFinishContext(); |
6548 | return __pyx_r; |
6549 | } |
6550 | |
6551 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":785 |
6552 | * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c) |
6553 | * |
6554 | * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< |
6555 | * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d) |
6556 | * |
6557 | */ |
6558 | |
6559 | 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) { |
6560 | PyObject *__pyx_r = NULL; |
6561 | __Pyx_RefNannyDeclarations |
6562 | PyObject *__pyx_t_1 = NULL; |
6563 | int __pyx_lineno = 0; |
6564 | const char *__pyx_filename = NULL; |
6565 | int __pyx_clineno = 0; |
6566 | __Pyx_RefNannySetupContext("PyArray_MultiIterNew4" , 0); |
6567 | |
6568 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":786 |
6569 | * |
6570 | * cdef inline object PyArray_MultiIterNew4(a, b, c, d): |
6571 | * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d) # <<<<<<<<<<<<<< |
6572 | * |
6573 | * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): |
6574 | */ |
6575 | __Pyx_XDECREF(__pyx_r); |
6576 | __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, 786, __pyx_L1_error) |
6577 | __Pyx_GOTREF(__pyx_t_1); |
6578 | __pyx_r = __pyx_t_1; |
6579 | __pyx_t_1 = 0; |
6580 | goto __pyx_L0; |
6581 | |
6582 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":785 |
6583 | * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c) |
6584 | * |
6585 | * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< |
6586 | * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d) |
6587 | * |
6588 | */ |
6589 | |
6590 | /* function exit code */ |
6591 | __pyx_L1_error:; |
6592 | __Pyx_XDECREF(__pyx_t_1); |
6593 | __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4" , __pyx_clineno, __pyx_lineno, __pyx_filename); |
6594 | __pyx_r = 0; |
6595 | __pyx_L0:; |
6596 | __Pyx_XGIVEREF(__pyx_r); |
6597 | __Pyx_RefNannyFinishContext(); |
6598 | return __pyx_r; |
6599 | } |
6600 | |
6601 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":788 |
6602 | * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d) |
6603 | * |
6604 | * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< |
6605 | * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e) |
6606 | * |
6607 | */ |
6608 | |
6609 | 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) { |
6610 | PyObject *__pyx_r = NULL; |
6611 | __Pyx_RefNannyDeclarations |
6612 | PyObject *__pyx_t_1 = NULL; |
6613 | int __pyx_lineno = 0; |
6614 | const char *__pyx_filename = NULL; |
6615 | int __pyx_clineno = 0; |
6616 | __Pyx_RefNannySetupContext("PyArray_MultiIterNew5" , 0); |
6617 | |
6618 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":789 |
6619 | * |
6620 | * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): |
6621 | * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e) # <<<<<<<<<<<<<< |
6622 | * |
6623 | * cdef inline tuple PyDataType_SHAPE(dtype d): |
6624 | */ |
6625 | __Pyx_XDECREF(__pyx_r); |
6626 | __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, 789, __pyx_L1_error) |
6627 | __Pyx_GOTREF(__pyx_t_1); |
6628 | __pyx_r = __pyx_t_1; |
6629 | __pyx_t_1 = 0; |
6630 | goto __pyx_L0; |
6631 | |
6632 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":788 |
6633 | * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d) |
6634 | * |
6635 | * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< |
6636 | * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e) |
6637 | * |
6638 | */ |
6639 | |
6640 | /* function exit code */ |
6641 | __pyx_L1_error:; |
6642 | __Pyx_XDECREF(__pyx_t_1); |
6643 | __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5" , __pyx_clineno, __pyx_lineno, __pyx_filename); |
6644 | __pyx_r = 0; |
6645 | __pyx_L0:; |
6646 | __Pyx_XGIVEREF(__pyx_r); |
6647 | __Pyx_RefNannyFinishContext(); |
6648 | return __pyx_r; |
6649 | } |
6650 | |
6651 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":791 |
6652 | * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e) |
6653 | * |
6654 | * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< |
6655 | * if PyDataType_HASSUBARRAY(d): |
6656 | * return <tuple>d.subarray.shape |
6657 | */ |
6658 | |
6659 | static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) { |
6660 | PyObject *__pyx_r = NULL; |
6661 | __Pyx_RefNannyDeclarations |
6662 | int __pyx_t_1; |
6663 | __Pyx_RefNannySetupContext("PyDataType_SHAPE" , 0); |
6664 | |
6665 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":792 |
6666 | * |
6667 | * cdef inline tuple PyDataType_SHAPE(dtype d): |
6668 | * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< |
6669 | * return <tuple>d.subarray.shape |
6670 | * else: |
6671 | */ |
6672 | __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0); |
6673 | if (__pyx_t_1) { |
6674 | |
6675 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":793 |
6676 | * cdef inline tuple PyDataType_SHAPE(dtype d): |
6677 | * if PyDataType_HASSUBARRAY(d): |
6678 | * return <tuple>d.subarray.shape # <<<<<<<<<<<<<< |
6679 | * else: |
6680 | * return () |
6681 | */ |
6682 | __Pyx_XDECREF(__pyx_r); |
6683 | __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape)); |
6684 | __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape); |
6685 | goto __pyx_L0; |
6686 | |
6687 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":792 |
6688 | * |
6689 | * cdef inline tuple PyDataType_SHAPE(dtype d): |
6690 | * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< |
6691 | * return <tuple>d.subarray.shape |
6692 | * else: |
6693 | */ |
6694 | } |
6695 | |
6696 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":795 |
6697 | * return <tuple>d.subarray.shape |
6698 | * else: |
6699 | * return () # <<<<<<<<<<<<<< |
6700 | * |
6701 | * |
6702 | */ |
6703 | /*else*/ { |
6704 | __Pyx_XDECREF(__pyx_r); |
6705 | __Pyx_INCREF(__pyx_empty_tuple); |
6706 | __pyx_r = __pyx_empty_tuple; |
6707 | goto __pyx_L0; |
6708 | } |
6709 | |
6710 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":791 |
6711 | * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e) |
6712 | * |
6713 | * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< |
6714 | * if PyDataType_HASSUBARRAY(d): |
6715 | * return <tuple>d.subarray.shape |
6716 | */ |
6717 | |
6718 | /* function exit code */ |
6719 | __pyx_L0:; |
6720 | __Pyx_XGIVEREF(__pyx_r); |
6721 | __Pyx_RefNannyFinishContext(); |
6722 | return __pyx_r; |
6723 | } |
6724 | |
6725 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":970 |
6726 | * int _import_umath() except -1 |
6727 | * |
6728 | * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< |
6729 | * Py_INCREF(base) # important to do this before stealing the reference below! |
6730 | * PyArray_SetBaseObject(arr, base) |
6731 | */ |
6732 | |
6733 | static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { |
6734 | __Pyx_RefNannyDeclarations |
6735 | __Pyx_RefNannySetupContext("set_array_base" , 0); |
6736 | |
6737 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":971 |
6738 | * |
6739 | * cdef inline void set_array_base(ndarray arr, object base): |
6740 | * Py_INCREF(base) # important to do this before stealing the reference below! # <<<<<<<<<<<<<< |
6741 | * PyArray_SetBaseObject(arr, base) |
6742 | * |
6743 | */ |
6744 | Py_INCREF(__pyx_v_base); |
6745 | |
6746 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":972 |
6747 | * cdef inline void set_array_base(ndarray arr, object base): |
6748 | * Py_INCREF(base) # important to do this before stealing the reference below! |
6749 | * PyArray_SetBaseObject(arr, base) # <<<<<<<<<<<<<< |
6750 | * |
6751 | * cdef inline object get_array_base(ndarray arr): |
6752 | */ |
6753 | (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base)); |
6754 | |
6755 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":970 |
6756 | * int _import_umath() except -1 |
6757 | * |
6758 | * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< |
6759 | * Py_INCREF(base) # important to do this before stealing the reference below! |
6760 | * PyArray_SetBaseObject(arr, base) |
6761 | */ |
6762 | |
6763 | /* function exit code */ |
6764 | __Pyx_RefNannyFinishContext(); |
6765 | } |
6766 | |
6767 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":974 |
6768 | * PyArray_SetBaseObject(arr, base) |
6769 | * |
6770 | * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< |
6771 | * base = PyArray_BASE(arr) |
6772 | * if base is NULL: |
6773 | */ |
6774 | |
6775 | static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { |
6776 | PyObject *__pyx_v_base; |
6777 | PyObject *__pyx_r = NULL; |
6778 | __Pyx_RefNannyDeclarations |
6779 | int __pyx_t_1; |
6780 | __Pyx_RefNannySetupContext("get_array_base" , 0); |
6781 | |
6782 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":975 |
6783 | * |
6784 | * cdef inline object get_array_base(ndarray arr): |
6785 | * base = PyArray_BASE(arr) # <<<<<<<<<<<<<< |
6786 | * if base is NULL: |
6787 | * return None |
6788 | */ |
6789 | __pyx_v_base = PyArray_BASE(__pyx_v_arr); |
6790 | |
6791 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":976 |
6792 | * cdef inline object get_array_base(ndarray arr): |
6793 | * base = PyArray_BASE(arr) |
6794 | * if base is NULL: # <<<<<<<<<<<<<< |
6795 | * return None |
6796 | * return <object>base |
6797 | */ |
6798 | __pyx_t_1 = ((__pyx_v_base == NULL) != 0); |
6799 | if (__pyx_t_1) { |
6800 | |
6801 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":977 |
6802 | * base = PyArray_BASE(arr) |
6803 | * if base is NULL: |
6804 | * return None # <<<<<<<<<<<<<< |
6805 | * return <object>base |
6806 | * |
6807 | */ |
6808 | __Pyx_XDECREF(__pyx_r); |
6809 | __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
6810 | goto __pyx_L0; |
6811 | |
6812 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":976 |
6813 | * cdef inline object get_array_base(ndarray arr): |
6814 | * base = PyArray_BASE(arr) |
6815 | * if base is NULL: # <<<<<<<<<<<<<< |
6816 | * return None |
6817 | * return <object>base |
6818 | */ |
6819 | } |
6820 | |
6821 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":978 |
6822 | * if base is NULL: |
6823 | * return None |
6824 | * return <object>base # <<<<<<<<<<<<<< |
6825 | * |
6826 | * # Versions of the import_* functions which are more suitable for |
6827 | */ |
6828 | __Pyx_XDECREF(__pyx_r); |
6829 | __Pyx_INCREF(((PyObject *)__pyx_v_base)); |
6830 | __pyx_r = ((PyObject *)__pyx_v_base); |
6831 | goto __pyx_L0; |
6832 | |
6833 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":974 |
6834 | * PyArray_SetBaseObject(arr, base) |
6835 | * |
6836 | * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< |
6837 | * base = PyArray_BASE(arr) |
6838 | * if base is NULL: |
6839 | */ |
6840 | |
6841 | /* function exit code */ |
6842 | __pyx_L0:; |
6843 | __Pyx_XGIVEREF(__pyx_r); |
6844 | __Pyx_RefNannyFinishContext(); |
6845 | return __pyx_r; |
6846 | } |
6847 | |
6848 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":982 |
6849 | * # Versions of the import_* functions which are more suitable for |
6850 | * # Cython code. |
6851 | * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< |
6852 | * try: |
6853 | * __pyx_import_array() |
6854 | */ |
6855 | |
6856 | static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { |
6857 | int __pyx_r; |
6858 | __Pyx_RefNannyDeclarations |
6859 | PyObject *__pyx_t_1 = NULL; |
6860 | PyObject *__pyx_t_2 = NULL; |
6861 | PyObject *__pyx_t_3 = NULL; |
6862 | int __pyx_t_4; |
6863 | PyObject *__pyx_t_5 = NULL; |
6864 | PyObject *__pyx_t_6 = NULL; |
6865 | PyObject *__pyx_t_7 = NULL; |
6866 | PyObject *__pyx_t_8 = NULL; |
6867 | int __pyx_lineno = 0; |
6868 | const char *__pyx_filename = NULL; |
6869 | int __pyx_clineno = 0; |
6870 | __Pyx_RefNannySetupContext("import_array" , 0); |
6871 | |
6872 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":983 |
6873 | * # Cython code. |
6874 | * cdef inline int import_array() except -1: |
6875 | * try: # <<<<<<<<<<<<<< |
6876 | * __pyx_import_array() |
6877 | * except Exception: |
6878 | */ |
6879 | { |
6880 | __Pyx_PyThreadState_declare |
6881 | __Pyx_PyThreadState_assign |
6882 | __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); |
6883 | __Pyx_XGOTREF(__pyx_t_1); |
6884 | __Pyx_XGOTREF(__pyx_t_2); |
6885 | __Pyx_XGOTREF(__pyx_t_3); |
6886 | /*try:*/ { |
6887 | |
6888 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":984 |
6889 | * cdef inline int import_array() except -1: |
6890 | * try: |
6891 | * __pyx_import_array() # <<<<<<<<<<<<<< |
6892 | * except Exception: |
6893 | * raise ImportError("numpy.core.multiarray failed to import") |
6894 | */ |
6895 | __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 984, __pyx_L3_error) |
6896 | |
6897 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":983 |
6898 | * # Cython code. |
6899 | * cdef inline int import_array() except -1: |
6900 | * try: # <<<<<<<<<<<<<< |
6901 | * __pyx_import_array() |
6902 | * except Exception: |
6903 | */ |
6904 | } |
6905 | __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; |
6906 | __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; |
6907 | __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; |
6908 | goto __pyx_L8_try_end; |
6909 | __pyx_L3_error:; |
6910 | |
6911 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":985 |
6912 | * try: |
6913 | * __pyx_import_array() |
6914 | * except Exception: # <<<<<<<<<<<<<< |
6915 | * raise ImportError("numpy.core.multiarray failed to import") |
6916 | * |
6917 | */ |
6918 | __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); |
6919 | if (__pyx_t_4) { |
6920 | __Pyx_AddTraceback("numpy.import_array" , __pyx_clineno, __pyx_lineno, __pyx_filename); |
6921 | if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 985, __pyx_L5_except_error) |
6922 | __Pyx_GOTREF(__pyx_t_5); |
6923 | __Pyx_GOTREF(__pyx_t_6); |
6924 | __Pyx_GOTREF(__pyx_t_7); |
6925 | |
6926 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":986 |
6927 | * __pyx_import_array() |
6928 | * except Exception: |
6929 | * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<< |
6930 | * |
6931 | * cdef inline int import_umath() except -1: |
6932 | */ |
6933 | __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 986, __pyx_L5_except_error) |
6934 | __Pyx_GOTREF(__pyx_t_8); |
6935 | __Pyx_Raise(__pyx_t_8, 0, 0, 0); |
6936 | __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; |
6937 | __PYX_ERR(1, 986, __pyx_L5_except_error) |
6938 | } |
6939 | goto __pyx_L5_except_error; |
6940 | __pyx_L5_except_error:; |
6941 | |
6942 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":983 |
6943 | * # Cython code. |
6944 | * cdef inline int import_array() except -1: |
6945 | * try: # <<<<<<<<<<<<<< |
6946 | * __pyx_import_array() |
6947 | * except Exception: |
6948 | */ |
6949 | __Pyx_XGIVEREF(__pyx_t_1); |
6950 | __Pyx_XGIVEREF(__pyx_t_2); |
6951 | __Pyx_XGIVEREF(__pyx_t_3); |
6952 | __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); |
6953 | goto __pyx_L1_error; |
6954 | __pyx_L8_try_end:; |
6955 | } |
6956 | |
6957 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":982 |
6958 | * # Versions of the import_* functions which are more suitable for |
6959 | * # Cython code. |
6960 | * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< |
6961 | * try: |
6962 | * __pyx_import_array() |
6963 | */ |
6964 | |
6965 | /* function exit code */ |
6966 | __pyx_r = 0; |
6967 | goto __pyx_L0; |
6968 | __pyx_L1_error:; |
6969 | __Pyx_XDECREF(__pyx_t_5); |
6970 | __Pyx_XDECREF(__pyx_t_6); |
6971 | __Pyx_XDECREF(__pyx_t_7); |
6972 | __Pyx_XDECREF(__pyx_t_8); |
6973 | __Pyx_AddTraceback("numpy.import_array" , __pyx_clineno, __pyx_lineno, __pyx_filename); |
6974 | __pyx_r = -1; |
6975 | __pyx_L0:; |
6976 | __Pyx_RefNannyFinishContext(); |
6977 | return __pyx_r; |
6978 | } |
6979 | |
6980 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":988 |
6981 | * raise ImportError("numpy.core.multiarray failed to import") |
6982 | * |
6983 | * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< |
6984 | * try: |
6985 | * _import_umath() |
6986 | */ |
6987 | |
6988 | static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { |
6989 | int __pyx_r; |
6990 | __Pyx_RefNannyDeclarations |
6991 | PyObject *__pyx_t_1 = NULL; |
6992 | PyObject *__pyx_t_2 = NULL; |
6993 | PyObject *__pyx_t_3 = NULL; |
6994 | int __pyx_t_4; |
6995 | PyObject *__pyx_t_5 = NULL; |
6996 | PyObject *__pyx_t_6 = NULL; |
6997 | PyObject *__pyx_t_7 = NULL; |
6998 | PyObject *__pyx_t_8 = NULL; |
6999 | int __pyx_lineno = 0; |
7000 | const char *__pyx_filename = NULL; |
7001 | int __pyx_clineno = 0; |
7002 | __Pyx_RefNannySetupContext("import_umath" , 0); |
7003 | |
7004 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":989 |
7005 | * |
7006 | * cdef inline int import_umath() except -1: |
7007 | * try: # <<<<<<<<<<<<<< |
7008 | * _import_umath() |
7009 | * except Exception: |
7010 | */ |
7011 | { |
7012 | __Pyx_PyThreadState_declare |
7013 | __Pyx_PyThreadState_assign |
7014 | __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); |
7015 | __Pyx_XGOTREF(__pyx_t_1); |
7016 | __Pyx_XGOTREF(__pyx_t_2); |
7017 | __Pyx_XGOTREF(__pyx_t_3); |
7018 | /*try:*/ { |
7019 | |
7020 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":990 |
7021 | * cdef inline int import_umath() except -1: |
7022 | * try: |
7023 | * _import_umath() # <<<<<<<<<<<<<< |
7024 | * except Exception: |
7025 | * raise ImportError("numpy.core.umath failed to import") |
7026 | */ |
7027 | __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 990, __pyx_L3_error) |
7028 | |
7029 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":989 |
7030 | * |
7031 | * cdef inline int import_umath() except -1: |
7032 | * try: # <<<<<<<<<<<<<< |
7033 | * _import_umath() |
7034 | * except Exception: |
7035 | */ |
7036 | } |
7037 | __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; |
7038 | __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; |
7039 | __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; |
7040 | goto __pyx_L8_try_end; |
7041 | __pyx_L3_error:; |
7042 | |
7043 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":991 |
7044 | * try: |
7045 | * _import_umath() |
7046 | * except Exception: # <<<<<<<<<<<<<< |
7047 | * raise ImportError("numpy.core.umath failed to import") |
7048 | * |
7049 | */ |
7050 | __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); |
7051 | if (__pyx_t_4) { |
7052 | __Pyx_AddTraceback("numpy.import_umath" , __pyx_clineno, __pyx_lineno, __pyx_filename); |
7053 | if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 991, __pyx_L5_except_error) |
7054 | __Pyx_GOTREF(__pyx_t_5); |
7055 | __Pyx_GOTREF(__pyx_t_6); |
7056 | __Pyx_GOTREF(__pyx_t_7); |
7057 | |
7058 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":992 |
7059 | * _import_umath() |
7060 | * except Exception: |
7061 | * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< |
7062 | * |
7063 | * cdef inline int import_ufunc() except -1: |
7064 | */ |
7065 | __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 992, __pyx_L5_except_error) |
7066 | __Pyx_GOTREF(__pyx_t_8); |
7067 | __Pyx_Raise(__pyx_t_8, 0, 0, 0); |
7068 | __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; |
7069 | __PYX_ERR(1, 992, __pyx_L5_except_error) |
7070 | } |
7071 | goto __pyx_L5_except_error; |
7072 | __pyx_L5_except_error:; |
7073 | |
7074 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":989 |
7075 | * |
7076 | * cdef inline int import_umath() except -1: |
7077 | * try: # <<<<<<<<<<<<<< |
7078 | * _import_umath() |
7079 | * except Exception: |
7080 | */ |
7081 | __Pyx_XGIVEREF(__pyx_t_1); |
7082 | __Pyx_XGIVEREF(__pyx_t_2); |
7083 | __Pyx_XGIVEREF(__pyx_t_3); |
7084 | __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); |
7085 | goto __pyx_L1_error; |
7086 | __pyx_L8_try_end:; |
7087 | } |
7088 | |
7089 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":988 |
7090 | * raise ImportError("numpy.core.multiarray failed to import") |
7091 | * |
7092 | * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< |
7093 | * try: |
7094 | * _import_umath() |
7095 | */ |
7096 | |
7097 | /* function exit code */ |
7098 | __pyx_r = 0; |
7099 | goto __pyx_L0; |
7100 | __pyx_L1_error:; |
7101 | __Pyx_XDECREF(__pyx_t_5); |
7102 | __Pyx_XDECREF(__pyx_t_6); |
7103 | __Pyx_XDECREF(__pyx_t_7); |
7104 | __Pyx_XDECREF(__pyx_t_8); |
7105 | __Pyx_AddTraceback("numpy.import_umath" , __pyx_clineno, __pyx_lineno, __pyx_filename); |
7106 | __pyx_r = -1; |
7107 | __pyx_L0:; |
7108 | __Pyx_RefNannyFinishContext(); |
7109 | return __pyx_r; |
7110 | } |
7111 | |
7112 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":994 |
7113 | * raise ImportError("numpy.core.umath failed to import") |
7114 | * |
7115 | * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< |
7116 | * try: |
7117 | * _import_umath() |
7118 | */ |
7119 | |
7120 | static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { |
7121 | int __pyx_r; |
7122 | __Pyx_RefNannyDeclarations |
7123 | PyObject *__pyx_t_1 = NULL; |
7124 | PyObject *__pyx_t_2 = NULL; |
7125 | PyObject *__pyx_t_3 = NULL; |
7126 | int __pyx_t_4; |
7127 | PyObject *__pyx_t_5 = NULL; |
7128 | PyObject *__pyx_t_6 = NULL; |
7129 | PyObject *__pyx_t_7 = NULL; |
7130 | PyObject *__pyx_t_8 = NULL; |
7131 | int __pyx_lineno = 0; |
7132 | const char *__pyx_filename = NULL; |
7133 | int __pyx_clineno = 0; |
7134 | __Pyx_RefNannySetupContext("import_ufunc" , 0); |
7135 | |
7136 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":995 |
7137 | * |
7138 | * cdef inline int import_ufunc() except -1: |
7139 | * try: # <<<<<<<<<<<<<< |
7140 | * _import_umath() |
7141 | * except Exception: |
7142 | */ |
7143 | { |
7144 | __Pyx_PyThreadState_declare |
7145 | __Pyx_PyThreadState_assign |
7146 | __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); |
7147 | __Pyx_XGOTREF(__pyx_t_1); |
7148 | __Pyx_XGOTREF(__pyx_t_2); |
7149 | __Pyx_XGOTREF(__pyx_t_3); |
7150 | /*try:*/ { |
7151 | |
7152 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":996 |
7153 | * cdef inline int import_ufunc() except -1: |
7154 | * try: |
7155 | * _import_umath() # <<<<<<<<<<<<<< |
7156 | * except Exception: |
7157 | * raise ImportError("numpy.core.umath failed to import") |
7158 | */ |
7159 | __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 996, __pyx_L3_error) |
7160 | |
7161 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":995 |
7162 | * |
7163 | * cdef inline int import_ufunc() except -1: |
7164 | * try: # <<<<<<<<<<<<<< |
7165 | * _import_umath() |
7166 | * except Exception: |
7167 | */ |
7168 | } |
7169 | __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; |
7170 | __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; |
7171 | __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; |
7172 | goto __pyx_L8_try_end; |
7173 | __pyx_L3_error:; |
7174 | |
7175 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":997 |
7176 | * try: |
7177 | * _import_umath() |
7178 | * except Exception: # <<<<<<<<<<<<<< |
7179 | * raise ImportError("numpy.core.umath failed to import") |
7180 | * |
7181 | */ |
7182 | __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); |
7183 | if (__pyx_t_4) { |
7184 | __Pyx_AddTraceback("numpy.import_ufunc" , __pyx_clineno, __pyx_lineno, __pyx_filename); |
7185 | if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 997, __pyx_L5_except_error) |
7186 | __Pyx_GOTREF(__pyx_t_5); |
7187 | __Pyx_GOTREF(__pyx_t_6); |
7188 | __Pyx_GOTREF(__pyx_t_7); |
7189 | |
7190 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":998 |
7191 | * _import_umath() |
7192 | * except Exception: |
7193 | * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< |
7194 | * |
7195 | * |
7196 | */ |
7197 | __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 998, __pyx_L5_except_error) |
7198 | __Pyx_GOTREF(__pyx_t_8); |
7199 | __Pyx_Raise(__pyx_t_8, 0, 0, 0); |
7200 | __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; |
7201 | __PYX_ERR(1, 998, __pyx_L5_except_error) |
7202 | } |
7203 | goto __pyx_L5_except_error; |
7204 | __pyx_L5_except_error:; |
7205 | |
7206 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":995 |
7207 | * |
7208 | * cdef inline int import_ufunc() except -1: |
7209 | * try: # <<<<<<<<<<<<<< |
7210 | * _import_umath() |
7211 | * except Exception: |
7212 | */ |
7213 | __Pyx_XGIVEREF(__pyx_t_1); |
7214 | __Pyx_XGIVEREF(__pyx_t_2); |
7215 | __Pyx_XGIVEREF(__pyx_t_3); |
7216 | __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); |
7217 | goto __pyx_L1_error; |
7218 | __pyx_L8_try_end:; |
7219 | } |
7220 | |
7221 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":994 |
7222 | * raise ImportError("numpy.core.umath failed to import") |
7223 | * |
7224 | * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< |
7225 | * try: |
7226 | * _import_umath() |
7227 | */ |
7228 | |
7229 | /* function exit code */ |
7230 | __pyx_r = 0; |
7231 | goto __pyx_L0; |
7232 | __pyx_L1_error:; |
7233 | __Pyx_XDECREF(__pyx_t_5); |
7234 | __Pyx_XDECREF(__pyx_t_6); |
7235 | __Pyx_XDECREF(__pyx_t_7); |
7236 | __Pyx_XDECREF(__pyx_t_8); |
7237 | __Pyx_AddTraceback("numpy.import_ufunc" , __pyx_clineno, __pyx_lineno, __pyx_filename); |
7238 | __pyx_r = -1; |
7239 | __pyx_L0:; |
7240 | __Pyx_RefNannyFinishContext(); |
7241 | return __pyx_r; |
7242 | } |
7243 | |
7244 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":1001 |
7245 | * |
7246 | * |
7247 | * cdef inline bint is_timedelta64_object(object obj): # <<<<<<<<<<<<<< |
7248 | * """ |
7249 | * Cython equivalent of `isinstance(obj, np.timedelta64)` |
7250 | */ |
7251 | |
7252 | static CYTHON_INLINE int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_obj) { |
7253 | int __pyx_r; |
7254 | __Pyx_RefNannyDeclarations |
7255 | __Pyx_RefNannySetupContext("is_timedelta64_object" , 0); |
7256 | |
7257 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":1013 |
7258 | * bool |
7259 | * """ |
7260 | * return PyObject_TypeCheck(obj, &PyTimedeltaArrType_Type) # <<<<<<<<<<<<<< |
7261 | * |
7262 | * |
7263 | */ |
7264 | __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyTimedeltaArrType_Type)); |
7265 | goto __pyx_L0; |
7266 | |
7267 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":1001 |
7268 | * |
7269 | * |
7270 | * cdef inline bint is_timedelta64_object(object obj): # <<<<<<<<<<<<<< |
7271 | * """ |
7272 | * Cython equivalent of `isinstance(obj, np.timedelta64)` |
7273 | */ |
7274 | |
7275 | /* function exit code */ |
7276 | __pyx_L0:; |
7277 | __Pyx_RefNannyFinishContext(); |
7278 | return __pyx_r; |
7279 | } |
7280 | |
7281 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":1016 |
7282 | * |
7283 | * |
7284 | * cdef inline bint is_datetime64_object(object obj): # <<<<<<<<<<<<<< |
7285 | * """ |
7286 | * Cython equivalent of `isinstance(obj, np.datetime64)` |
7287 | */ |
7288 | |
7289 | static CYTHON_INLINE int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_obj) { |
7290 | int __pyx_r; |
7291 | __Pyx_RefNannyDeclarations |
7292 | __Pyx_RefNannySetupContext("is_datetime64_object" , 0); |
7293 | |
7294 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":1028 |
7295 | * bool |
7296 | * """ |
7297 | * return PyObject_TypeCheck(obj, &PyDatetimeArrType_Type) # <<<<<<<<<<<<<< |
7298 | * |
7299 | * |
7300 | */ |
7301 | __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyDatetimeArrType_Type)); |
7302 | goto __pyx_L0; |
7303 | |
7304 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":1016 |
7305 | * |
7306 | * |
7307 | * cdef inline bint is_datetime64_object(object obj): # <<<<<<<<<<<<<< |
7308 | * """ |
7309 | * Cython equivalent of `isinstance(obj, np.datetime64)` |
7310 | */ |
7311 | |
7312 | /* function exit code */ |
7313 | __pyx_L0:; |
7314 | __Pyx_RefNannyFinishContext(); |
7315 | return __pyx_r; |
7316 | } |
7317 | |
7318 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":1031 |
7319 | * |
7320 | * |
7321 | * cdef inline npy_datetime get_datetime64_value(object obj) nogil: # <<<<<<<<<<<<<< |
7322 | * """ |
7323 | * returns the int64 value underlying scalar numpy datetime64 object |
7324 | */ |
7325 | |
7326 | static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject *__pyx_v_obj) { |
7327 | npy_datetime __pyx_r; |
7328 | |
7329 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":1038 |
7330 | * also needed. That can be found using `get_datetime64_unit`. |
7331 | * """ |
7332 | * return (<PyDatetimeScalarObject*>obj).obval # <<<<<<<<<<<<<< |
7333 | * |
7334 | * |
7335 | */ |
7336 | __pyx_r = ((PyDatetimeScalarObject *)__pyx_v_obj)->obval; |
7337 | goto __pyx_L0; |
7338 | |
7339 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":1031 |
7340 | * |
7341 | * |
7342 | * cdef inline npy_datetime get_datetime64_value(object obj) nogil: # <<<<<<<<<<<<<< |
7343 | * """ |
7344 | * returns the int64 value underlying scalar numpy datetime64 object |
7345 | */ |
7346 | |
7347 | /* function exit code */ |
7348 | __pyx_L0:; |
7349 | return __pyx_r; |
7350 | } |
7351 | |
7352 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":1041 |
7353 | * |
7354 | * |
7355 | * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil: # <<<<<<<<<<<<<< |
7356 | * """ |
7357 | * returns the int64 value underlying scalar numpy timedelta64 object |
7358 | */ |
7359 | |
7360 | static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject *__pyx_v_obj) { |
7361 | npy_timedelta __pyx_r; |
7362 | |
7363 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":1045 |
7364 | * returns the int64 value underlying scalar numpy timedelta64 object |
7365 | * """ |
7366 | * return (<PyTimedeltaScalarObject*>obj).obval # <<<<<<<<<<<<<< |
7367 | * |
7368 | * |
7369 | */ |
7370 | __pyx_r = ((PyTimedeltaScalarObject *)__pyx_v_obj)->obval; |
7371 | goto __pyx_L0; |
7372 | |
7373 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":1041 |
7374 | * |
7375 | * |
7376 | * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil: # <<<<<<<<<<<<<< |
7377 | * """ |
7378 | * returns the int64 value underlying scalar numpy timedelta64 object |
7379 | */ |
7380 | |
7381 | /* function exit code */ |
7382 | __pyx_L0:; |
7383 | return __pyx_r; |
7384 | } |
7385 | |
7386 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":1048 |
7387 | * |
7388 | * |
7389 | * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<< |
7390 | * """ |
7391 | * returns the unit part of the dtype for a numpy datetime64 object. |
7392 | */ |
7393 | |
7394 | static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObject *__pyx_v_obj) { |
7395 | NPY_DATETIMEUNIT __pyx_r; |
7396 | |
7397 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":1052 |
7398 | * returns the unit part of the dtype for a numpy datetime64 object. |
7399 | * """ |
7400 | * return <NPY_DATETIMEUNIT>(<PyDatetimeScalarObject*>obj).obmeta.base # <<<<<<<<<<<<<< |
7401 | */ |
7402 | __pyx_r = ((NPY_DATETIMEUNIT)((PyDatetimeScalarObject *)__pyx_v_obj)->obmeta.base); |
7403 | goto __pyx_L0; |
7404 | |
7405 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":1048 |
7406 | * |
7407 | * |
7408 | * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<< |
7409 | * """ |
7410 | * returns the unit part of the dtype for a numpy datetime64 object. |
7411 | */ |
7412 | |
7413 | /* function exit code */ |
7414 | __pyx_L0:; |
7415 | return __pyx_r; |
7416 | } |
7417 | |
7418 | static PyMethodDef __pyx_methods[] = { |
7419 | {0, 0, 0, 0} |
7420 | }; |
7421 | #ifndef CYTHON_SMALL_CODE |
7422 | #if defined(__clang__) |
7423 | #define CYTHON_SMALL_CODE |
7424 | #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) |
7425 | #define CYTHON_SMALL_CODE __attribute__((cold)) |
7426 | #else |
7427 | #define CYTHON_SMALL_CODE |
7428 | #endif |
7429 | #endif |
7430 | /* #### Code section: pystring_table ### */ |
7431 | |
7432 | static __Pyx_StringTabEntry __pyx_string_tab[] = { |
7433 | #if CYTHON_USE_MODULE_STATE |
7434 | {0, __pyx_k_AppendBFloat16ArrayToTensorProto, sizeof(__pyx_k_AppendBFloat16ArrayToTensorProto), 0, 0, 1, 1}, |
7435 | {0, __pyx_k_AppendBoolArrayToTensorProto, sizeof(__pyx_k_AppendBoolArrayToTensorProto), 0, 0, 1, 1}, |
7436 | {0, __pyx_k_AppendComplex128ArrayToTensorPro, sizeof(__pyx_k_AppendComplex128ArrayToTensorPro), 0, 0, 1, 1}, |
7437 | {0, __pyx_k_AppendComplex64ArrayToTensorProt, sizeof(__pyx_k_AppendComplex64ArrayToTensorProt), 0, 0, 1, 1}, |
7438 | {0, __pyx_k_AppendFloat16ArrayToTensorProto, sizeof(__pyx_k_AppendFloat16ArrayToTensorProto), 0, 0, 1, 1}, |
7439 | {0, __pyx_k_AppendFloat32ArrayToTensorProto, sizeof(__pyx_k_AppendFloat32ArrayToTensorProto), 0, 0, 1, 1}, |
7440 | {0, __pyx_k_AppendFloat64ArrayToTensorProto, sizeof(__pyx_k_AppendFloat64ArrayToTensorProto), 0, 0, 1, 1}, |
7441 | {0, __pyx_k_AppendInt16ArrayToTensorProto, sizeof(__pyx_k_AppendInt16ArrayToTensorProto), 0, 0, 1, 1}, |
7442 | {0, __pyx_k_AppendInt32ArrayToTensorProto, sizeof(__pyx_k_AppendInt32ArrayToTensorProto), 0, 0, 1, 1}, |
7443 | {0, __pyx_k_AppendInt64ArrayToTensorProto, sizeof(__pyx_k_AppendInt64ArrayToTensorProto), 0, 0, 1, 1}, |
7444 | {0, __pyx_k_AppendInt8ArrayToTensorProto, sizeof(__pyx_k_AppendInt8ArrayToTensorProto), 0, 0, 1, 1}, |
7445 | {0, __pyx_k_AppendObjectArrayToTensorProto, sizeof(__pyx_k_AppendObjectArrayToTensorProto), 0, 0, 1, 1}, |
7446 | {0, __pyx_k_AppendUInt16ArrayToTensorProto, sizeof(__pyx_k_AppendUInt16ArrayToTensorProto), 0, 0, 1, 1}, |
7447 | {0, __pyx_k_AppendUInt32ArrayToTensorProto, sizeof(__pyx_k_AppendUInt32ArrayToTensorProto), 0, 0, 1, 1}, |
7448 | {0, __pyx_k_AppendUInt64ArrayToTensorProto, sizeof(__pyx_k_AppendUInt64ArrayToTensorProto), 0, 0, 1, 1}, |
7449 | {0, __pyx_k_AppendUInt8ArrayToTensorProto, sizeof(__pyx_k_AppendUInt8ArrayToTensorProto), 0, 0, 1, 1}, |
7450 | {0, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1}, |
7451 | {0, __pyx_k__22, sizeof(__pyx_k__22), 0, 0, 1, 1}, |
7452 | {0, __pyx_k__3, sizeof(__pyx_k__3), 0, 0, 1, 1}, |
7453 | {0, __pyx_k__4, sizeof(__pyx_k__4), 0, 1, 0, 0}, |
7454 | {0, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1}, |
7455 | {0, __pyx_k_as_bytes, sizeof(__pyx_k_as_bytes), 0, 0, 1, 1}, |
7456 | {0, __pyx_k_asyncio_coroutines, sizeof(__pyx_k_asyncio_coroutines), 0, 0, 1, 1}, |
7457 | {0, __pyx_k_bool_val, sizeof(__pyx_k_bool_val), 0, 0, 1, 1}, |
7458 | {0, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, |
7459 | {0, __pyx_k_compat, sizeof(__pyx_k_compat), 0, 0, 1, 1}, |
7460 | {0, __pyx_k_dcomplex_val, sizeof(__pyx_k_dcomplex_val), 0, 0, 1, 1}, |
7461 | {0, __pyx_k_double_val, sizeof(__pyx_k_double_val), 0, 0, 1, 1}, |
7462 | {0, __pyx_k_float_val, sizeof(__pyx_k_float_val), 0, 0, 1, 1}, |
7463 | {0, __pyx_k_half_val, sizeof(__pyx_k_half_val), 0, 0, 1, 1}, |
7464 | {0, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1}, |
7465 | {0, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, |
7466 | {0, __pyx_k_initializing, sizeof(__pyx_k_initializing), 0, 0, 1, 1}, |
7467 | {0, __pyx_k_int64_val, sizeof(__pyx_k_int64_val), 0, 0, 1, 1}, |
7468 | {0, __pyx_k_int_val, sizeof(__pyx_k_int_val), 0, 0, 1, 1}, |
7469 | {0, __pyx_k_is_coroutine, sizeof(__pyx_k_is_coroutine), 0, 0, 1, 1}, |
7470 | {0, __pyx_k_item, sizeof(__pyx_k_item), 0, 0, 1, 1}, |
7471 | {0, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, |
7472 | {0, __pyx_k_n, sizeof(__pyx_k_n), 0, 0, 1, 1}, |
7473 | {0, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, |
7474 | {0, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1}, |
7475 | {0, __pyx_k_nparray, sizeof(__pyx_k_nparray), 0, 0, 1, 1}, |
7476 | {0, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1}, |
7477 | {0, __pyx_k_numpy_core_multiarray_failed_to, sizeof(__pyx_k_numpy_core_multiarray_failed_to), 0, 0, 1, 0}, |
7478 | {0, __pyx_k_numpy_core_umath_failed_to_impor, sizeof(__pyx_k_numpy_core_umath_failed_to_impor), 0, 0, 1, 0}, |
7479 | {0, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, |
7480 | {0, __pyx_k_scomplex_val, sizeof(__pyx_k_scomplex_val), 0, 0, 1, 1}, |
7481 | {0, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1}, |
7482 | {0, __pyx_k_spec, sizeof(__pyx_k_spec), 0, 0, 1, 1}, |
7483 | {0, __pyx_k_string_val, sizeof(__pyx_k_string_val), 0, 0, 1, 1}, |
7484 | {0, __pyx_k_tensor_proto, sizeof(__pyx_k_tensor_proto), 0, 0, 1, 1}, |
7485 | {0, __pyx_k_tensorflow_python_framework_fast, sizeof(__pyx_k_tensorflow_python_framework_fast), 0, 0, 1, 0}, |
7486 | {0, __pyx_k_tensorflow_python_framework_fast_2, sizeof(__pyx_k_tensorflow_python_framework_fast_2), 0, 0, 1, 1}, |
7487 | {0, __pyx_k_tensorflow_python_util, sizeof(__pyx_k_tensorflow_python_util), 0, 0, 1, 1}, |
7488 | {0, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, |
7489 | {0, __pyx_k_uint32_val, sizeof(__pyx_k_uint32_val), 0, 0, 1, 1}, |
7490 | {0, __pyx_k_uint64_val, sizeof(__pyx_k_uint64_val), 0, 0, 1, 1}, |
7491 | #else |
7492 | {&__pyx_n_s_AppendBFloat16ArrayToTensorProto, __pyx_k_AppendBFloat16ArrayToTensorProto, sizeof(__pyx_k_AppendBFloat16ArrayToTensorProto), 0, 0, 1, 1}, |
7493 | {&__pyx_n_s_AppendBoolArrayToTensorProto, __pyx_k_AppendBoolArrayToTensorProto, sizeof(__pyx_k_AppendBoolArrayToTensorProto), 0, 0, 1, 1}, |
7494 | {&__pyx_n_s_AppendComplex128ArrayToTensorPro, __pyx_k_AppendComplex128ArrayToTensorPro, sizeof(__pyx_k_AppendComplex128ArrayToTensorPro), 0, 0, 1, 1}, |
7495 | {&__pyx_n_s_AppendComplex64ArrayToTensorProt, __pyx_k_AppendComplex64ArrayToTensorProt, sizeof(__pyx_k_AppendComplex64ArrayToTensorProt), 0, 0, 1, 1}, |
7496 | {&__pyx_n_s_AppendFloat16ArrayToTensorProto, __pyx_k_AppendFloat16ArrayToTensorProto, sizeof(__pyx_k_AppendFloat16ArrayToTensorProto), 0, 0, 1, 1}, |
7497 | {&__pyx_n_s_AppendFloat32ArrayToTensorProto, __pyx_k_AppendFloat32ArrayToTensorProto, sizeof(__pyx_k_AppendFloat32ArrayToTensorProto), 0, 0, 1, 1}, |
7498 | {&__pyx_n_s_AppendFloat64ArrayToTensorProto, __pyx_k_AppendFloat64ArrayToTensorProto, sizeof(__pyx_k_AppendFloat64ArrayToTensorProto), 0, 0, 1, 1}, |
7499 | {&__pyx_n_s_AppendInt16ArrayToTensorProto, __pyx_k_AppendInt16ArrayToTensorProto, sizeof(__pyx_k_AppendInt16ArrayToTensorProto), 0, 0, 1, 1}, |
7500 | {&__pyx_n_s_AppendInt32ArrayToTensorProto, __pyx_k_AppendInt32ArrayToTensorProto, sizeof(__pyx_k_AppendInt32ArrayToTensorProto), 0, 0, 1, 1}, |
7501 | {&__pyx_n_s_AppendInt64ArrayToTensorProto, __pyx_k_AppendInt64ArrayToTensorProto, sizeof(__pyx_k_AppendInt64ArrayToTensorProto), 0, 0, 1, 1}, |
7502 | {&__pyx_n_s_AppendInt8ArrayToTensorProto, __pyx_k_AppendInt8ArrayToTensorProto, sizeof(__pyx_k_AppendInt8ArrayToTensorProto), 0, 0, 1, 1}, |
7503 | {&__pyx_n_s_AppendObjectArrayToTensorProto, __pyx_k_AppendObjectArrayToTensorProto, sizeof(__pyx_k_AppendObjectArrayToTensorProto), 0, 0, 1, 1}, |
7504 | {&__pyx_n_s_AppendUInt16ArrayToTensorProto, __pyx_k_AppendUInt16ArrayToTensorProto, sizeof(__pyx_k_AppendUInt16ArrayToTensorProto), 0, 0, 1, 1}, |
7505 | {&__pyx_n_s_AppendUInt32ArrayToTensorProto, __pyx_k_AppendUInt32ArrayToTensorProto, sizeof(__pyx_k_AppendUInt32ArrayToTensorProto), 0, 0, 1, 1}, |
7506 | {&__pyx_n_s_AppendUInt64ArrayToTensorProto, __pyx_k_AppendUInt64ArrayToTensorProto, sizeof(__pyx_k_AppendUInt64ArrayToTensorProto), 0, 0, 1, 1}, |
7507 | {&__pyx_n_s_AppendUInt8ArrayToTensorProto, __pyx_k_AppendUInt8ArrayToTensorProto, sizeof(__pyx_k_AppendUInt8ArrayToTensorProto), 0, 0, 1, 1}, |
7508 | {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1}, |
7509 | {&__pyx_n_s__22, __pyx_k__22, sizeof(__pyx_k__22), 0, 0, 1, 1}, |
7510 | {&__pyx_n_s__3, __pyx_k__3, sizeof(__pyx_k__3), 0, 0, 1, 1}, |
7511 | {&__pyx_kp_u__4, __pyx_k__4, sizeof(__pyx_k__4), 0, 1, 0, 0}, |
7512 | {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1}, |
7513 | {&__pyx_n_s_as_bytes, __pyx_k_as_bytes, sizeof(__pyx_k_as_bytes), 0, 0, 1, 1}, |
7514 | {&__pyx_n_s_asyncio_coroutines, __pyx_k_asyncio_coroutines, sizeof(__pyx_k_asyncio_coroutines), 0, 0, 1, 1}, |
7515 | {&__pyx_n_s_bool_val, __pyx_k_bool_val, sizeof(__pyx_k_bool_val), 0, 0, 1, 1}, |
7516 | {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, |
7517 | {&__pyx_n_s_compat, __pyx_k_compat, sizeof(__pyx_k_compat), 0, 0, 1, 1}, |
7518 | {&__pyx_n_s_dcomplex_val, __pyx_k_dcomplex_val, sizeof(__pyx_k_dcomplex_val), 0, 0, 1, 1}, |
7519 | {&__pyx_n_s_double_val, __pyx_k_double_val, sizeof(__pyx_k_double_val), 0, 0, 1, 1}, |
7520 | {&__pyx_n_s_float_val, __pyx_k_float_val, sizeof(__pyx_k_float_val), 0, 0, 1, 1}, |
7521 | {&__pyx_n_s_half_val, __pyx_k_half_val, sizeof(__pyx_k_half_val), 0, 0, 1, 1}, |
7522 | {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1}, |
7523 | {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, |
7524 | {&__pyx_n_s_initializing, __pyx_k_initializing, sizeof(__pyx_k_initializing), 0, 0, 1, 1}, |
7525 | {&__pyx_n_s_int64_val, __pyx_k_int64_val, sizeof(__pyx_k_int64_val), 0, 0, 1, 1}, |
7526 | {&__pyx_n_s_int_val, __pyx_k_int_val, sizeof(__pyx_k_int_val), 0, 0, 1, 1}, |
7527 | {&__pyx_n_s_is_coroutine, __pyx_k_is_coroutine, sizeof(__pyx_k_is_coroutine), 0, 0, 1, 1}, |
7528 | {&__pyx_n_s_item, __pyx_k_item, sizeof(__pyx_k_item), 0, 0, 1, 1}, |
7529 | {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, |
7530 | {&__pyx_n_s_n, __pyx_k_n, sizeof(__pyx_k_n), 0, 0, 1, 1}, |
7531 | {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, |
7532 | {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1}, |
7533 | {&__pyx_n_s_nparray, __pyx_k_nparray, sizeof(__pyx_k_nparray), 0, 0, 1, 1}, |
7534 | {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1}, |
7535 | {&__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}, |
7536 | {&__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}, |
7537 | {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, |
7538 | {&__pyx_n_s_scomplex_val, __pyx_k_scomplex_val, sizeof(__pyx_k_scomplex_val), 0, 0, 1, 1}, |
7539 | {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1}, |
7540 | {&__pyx_n_s_spec, __pyx_k_spec, sizeof(__pyx_k_spec), 0, 0, 1, 1}, |
7541 | {&__pyx_n_s_string_val, __pyx_k_string_val, sizeof(__pyx_k_string_val), 0, 0, 1, 1}, |
7542 | {&__pyx_n_s_tensor_proto, __pyx_k_tensor_proto, sizeof(__pyx_k_tensor_proto), 0, 0, 1, 1}, |
7543 | {&__pyx_kp_s_tensorflow_python_framework_fast, __pyx_k_tensorflow_python_framework_fast, sizeof(__pyx_k_tensorflow_python_framework_fast), 0, 0, 1, 0}, |
7544 | {&__pyx_n_s_tensorflow_python_framework_fast_2, __pyx_k_tensorflow_python_framework_fast_2, sizeof(__pyx_k_tensorflow_python_framework_fast_2), 0, 0, 1, 1}, |
7545 | {&__pyx_n_s_tensorflow_python_util, __pyx_k_tensorflow_python_util, sizeof(__pyx_k_tensorflow_python_util), 0, 0, 1, 1}, |
7546 | {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, |
7547 | {&__pyx_n_s_uint32_val, __pyx_k_uint32_val, sizeof(__pyx_k_uint32_val), 0, 0, 1, 1}, |
7548 | {&__pyx_n_s_uint64_val, __pyx_k_uint64_val, sizeof(__pyx_k_uint64_val), 0, 0, 1, 1}, |
7549 | #endif |
7550 | {0, 0, 0, 0, 0, 0, 0} |
7551 | }; |
7552 | /* #### Code section: cached_builtins ### */ |
7553 | static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { |
7554 | __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 13, __pyx_L1_error) |
7555 | __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 986, __pyx_L1_error) |
7556 | return 0; |
7557 | __pyx_L1_error:; |
7558 | return -1; |
7559 | } |
7560 | /* #### Code section: cached_constants ### */ |
7561 | |
7562 | static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { |
7563 | __Pyx_RefNannyDeclarations |
7564 | __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants" , 0); |
7565 | |
7566 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":986 |
7567 | * __pyx_import_array() |
7568 | * except Exception: |
7569 | * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<< |
7570 | * |
7571 | * cdef inline int import_umath() except -1: |
7572 | */ |
7573 | __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple_)) __PYX_ERR(1, 986, __pyx_L1_error) |
7574 | __Pyx_GOTREF(__pyx_tuple_); |
7575 | __Pyx_GIVEREF(__pyx_tuple_); |
7576 | |
7577 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":992 |
7578 | * _import_umath() |
7579 | * except Exception: |
7580 | * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< |
7581 | * |
7582 | * cdef inline int import_ufunc() except -1: |
7583 | */ |
7584 | __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 992, __pyx_L1_error) |
7585 | __Pyx_GOTREF(__pyx_tuple__2); |
7586 | __Pyx_GIVEREF(__pyx_tuple__2); |
7587 | |
7588 | /* "tensorflow/python/framework/fast_tensor_util.pyx":9 |
7589 | * from tensorflow.python.util import compat |
7590 | * |
7591 | * def AppendBFloat16ArrayToTensorProto( # <<<<<<<<<<<<<< |
7592 | * tensor_proto, np.ndarray[np.uint16_t, ndim=1] nparray): |
7593 | * cdef long i, n |
7594 | */ |
7595 | __pyx_tuple__5 = PyTuple_Pack(4, __pyx_n_s_tensor_proto, __pyx_n_s_nparray, __pyx_n_s_i, __pyx_n_s_n); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 9, __pyx_L1_error) |
7596 | __Pyx_GOTREF(__pyx_tuple__5); |
7597 | __Pyx_GIVEREF(__pyx_tuple__5); |
7598 | __pyx_codeobj__6 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__5, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tensorflow_python_framework_fast, __pyx_n_s_AppendBFloat16ArrayToTensorProto, 9, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__6)) __PYX_ERR(0, 9, __pyx_L1_error) |
7599 | |
7600 | /* "tensorflow/python/framework/fast_tensor_util.pyx":17 |
7601 | * |
7602 | * |
7603 | * def AppendFloat16ArrayToTensorProto( # <<<<<<<<<<<<<< |
7604 | * # For numpy, npy_half is a typedef for npy_uint16, |
7605 | * # see: https://github.com/numpy/numpy/blob/master/doc/source/reference/c-api.coremath.rst#half-precision-functions |
7606 | */ |
7607 | __pyx_codeobj__7 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__5, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tensorflow_python_framework_fast, __pyx_n_s_AppendFloat16ArrayToTensorProto, 17, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__7)) __PYX_ERR(0, 17, __pyx_L1_error) |
7608 | |
7609 | /* "tensorflow/python/framework/fast_tensor_util.pyx":29 |
7610 | * |
7611 | * |
7612 | * def AppendFloat32ArrayToTensorProto( # <<<<<<<<<<<<<< |
7613 | * tensor_proto, np.ndarray[np.float32_t, ndim=1] nparray): |
7614 | * cdef long i, n |
7615 | */ |
7616 | __pyx_codeobj__8 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__5, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tensorflow_python_framework_fast, __pyx_n_s_AppendFloat32ArrayToTensorProto, 29, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__8)) __PYX_ERR(0, 29, __pyx_L1_error) |
7617 | |
7618 | /* "tensorflow/python/framework/fast_tensor_util.pyx":37 |
7619 | * |
7620 | * |
7621 | * def AppendFloat64ArrayToTensorProto( # <<<<<<<<<<<<<< |
7622 | * tensor_proto, np.ndarray[np.float64_t, ndim=1] nparray): |
7623 | * cdef long i, n |
7624 | */ |
7625 | __pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__5, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tensorflow_python_framework_fast, __pyx_n_s_AppendFloat64ArrayToTensorProto, 37, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 37, __pyx_L1_error) |
7626 | |
7627 | /* "tensorflow/python/framework/fast_tensor_util.pyx":45 |
7628 | * |
7629 | * |
7630 | * def AppendInt32ArrayToTensorProto( # <<<<<<<<<<<<<< |
7631 | * tensor_proto, np.ndarray[np.int32_t, ndim=1] nparray): |
7632 | * cdef long i, n |
7633 | */ |
7634 | __pyx_codeobj__10 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__5, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tensorflow_python_framework_fast, __pyx_n_s_AppendInt32ArrayToTensorProto, 45, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__10)) __PYX_ERR(0, 45, __pyx_L1_error) |
7635 | |
7636 | /* "tensorflow/python/framework/fast_tensor_util.pyx":52 |
7637 | * tensor_proto.int_val.append(nparray[i]) |
7638 | * |
7639 | * def AppendUInt32ArrayToTensorProto( # <<<<<<<<<<<<<< |
7640 | * tensor_proto, np.ndarray[np.uint32_t, ndim=1] nparray): |
7641 | * cdef long i, n |
7642 | */ |
7643 | __pyx_codeobj__11 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__5, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tensorflow_python_framework_fast, __pyx_n_s_AppendUInt32ArrayToTensorProto, 52, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) __PYX_ERR(0, 52, __pyx_L1_error) |
7644 | |
7645 | /* "tensorflow/python/framework/fast_tensor_util.pyx":59 |
7646 | * tensor_proto.uint32_val.append(nparray[i]) |
7647 | * |
7648 | * def AppendInt64ArrayToTensorProto( # <<<<<<<<<<<<<< |
7649 | * tensor_proto, np.ndarray[np.int64_t, ndim=1] nparray): |
7650 | * cdef long i, n |
7651 | */ |
7652 | __pyx_codeobj__12 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__5, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tensorflow_python_framework_fast, __pyx_n_s_AppendInt64ArrayToTensorProto, 59, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__12)) __PYX_ERR(0, 59, __pyx_L1_error) |
7653 | |
7654 | /* "tensorflow/python/framework/fast_tensor_util.pyx":66 |
7655 | * tensor_proto.int64_val.append(nparray[i]) |
7656 | * |
7657 | * def AppendUInt64ArrayToTensorProto( # <<<<<<<<<<<<<< |
7658 | * tensor_proto, np.ndarray[np.uint64_t, ndim=1] nparray): |
7659 | * cdef long i, n |
7660 | */ |
7661 | __pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__5, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tensorflow_python_framework_fast, __pyx_n_s_AppendUInt64ArrayToTensorProto, 66, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(0, 66, __pyx_L1_error) |
7662 | |
7663 | /* "tensorflow/python/framework/fast_tensor_util.pyx":73 |
7664 | * tensor_proto.uint64_val.append(nparray[i]) |
7665 | * |
7666 | * def AppendUInt8ArrayToTensorProto( # <<<<<<<<<<<<<< |
7667 | * tensor_proto, np.ndarray[np.uint8_t, ndim=1] nparray): |
7668 | * cdef long i, n |
7669 | */ |
7670 | __pyx_codeobj__14 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__5, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tensorflow_python_framework_fast, __pyx_n_s_AppendUInt8ArrayToTensorProto, 73, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__14)) __PYX_ERR(0, 73, __pyx_L1_error) |
7671 | |
7672 | /* "tensorflow/python/framework/fast_tensor_util.pyx":81 |
7673 | * |
7674 | * |
7675 | * def AppendUInt16ArrayToTensorProto( # <<<<<<<<<<<<<< |
7676 | * tensor_proto, np.ndarray[np.uint16_t, ndim=1] nparray): |
7677 | * cdef long i, n |
7678 | */ |
7679 | __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__5, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tensorflow_python_framework_fast, __pyx_n_s_AppendUInt16ArrayToTensorProto, 81, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(0, 81, __pyx_L1_error) |
7680 | |
7681 | /* "tensorflow/python/framework/fast_tensor_util.pyx":89 |
7682 | * |
7683 | * |
7684 | * def AppendInt16ArrayToTensorProto( # <<<<<<<<<<<<<< |
7685 | * tensor_proto, np.ndarray[np.int16_t, ndim=1] nparray): |
7686 | * cdef long i, n |
7687 | */ |
7688 | __pyx_codeobj__16 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__5, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tensorflow_python_framework_fast, __pyx_n_s_AppendInt16ArrayToTensorProto, 89, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__16)) __PYX_ERR(0, 89, __pyx_L1_error) |
7689 | |
7690 | /* "tensorflow/python/framework/fast_tensor_util.pyx":97 |
7691 | * |
7692 | * |
7693 | * def AppendInt8ArrayToTensorProto( # <<<<<<<<<<<<<< |
7694 | * tensor_proto, np.ndarray[np.int8_t, ndim=1] nparray): |
7695 | * cdef long i, n |
7696 | */ |
7697 | __pyx_codeobj__17 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__5, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tensorflow_python_framework_fast, __pyx_n_s_AppendInt8ArrayToTensorProto, 97, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) __PYX_ERR(0, 97, __pyx_L1_error) |
7698 | |
7699 | /* "tensorflow/python/framework/fast_tensor_util.pyx":105 |
7700 | * |
7701 | * |
7702 | * def AppendComplex64ArrayToTensorProto( # <<<<<<<<<<<<<< |
7703 | * tensor_proto, np.ndarray[np.complex64_t, ndim=1] nparray): |
7704 | * cdef long i, n |
7705 | */ |
7706 | __pyx_codeobj__18 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__5, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tensorflow_python_framework_fast, __pyx_n_s_AppendComplex64ArrayToTensorProt, 105, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) __PYX_ERR(0, 105, __pyx_L1_error) |
7707 | |
7708 | /* "tensorflow/python/framework/fast_tensor_util.pyx":114 |
7709 | * |
7710 | * |
7711 | * def AppendComplex128ArrayToTensorProto( # <<<<<<<<<<<<<< |
7712 | * tensor_proto, np.ndarray[np.complex128_t, ndim=1] nparray): |
7713 | * cdef long i, n |
7714 | */ |
7715 | __pyx_codeobj__19 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__5, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tensorflow_python_framework_fast, __pyx_n_s_AppendComplex128ArrayToTensorPro, 114, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__19)) __PYX_ERR(0, 114, __pyx_L1_error) |
7716 | |
7717 | /* "tensorflow/python/framework/fast_tensor_util.pyx":123 |
7718 | * |
7719 | * |
7720 | * def AppendObjectArrayToTensorProto(tensor_proto, np.ndarray nparray): # <<<<<<<<<<<<<< |
7721 | * cdef long i, n |
7722 | * n = nparray.size |
7723 | */ |
7724 | __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__5, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tensorflow_python_framework_fast, __pyx_n_s_AppendObjectArrayToTensorProto, 123, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(0, 123, __pyx_L1_error) |
7725 | |
7726 | /* "tensorflow/python/framework/fast_tensor_util.pyx":130 |
7727 | * |
7728 | * |
7729 | * def AppendBoolArrayToTensorProto(tensor_proto, nparray): # <<<<<<<<<<<<<< |
7730 | * cdef long i, n |
7731 | * n = nparray.size |
7732 | */ |
7733 | __pyx_codeobj__21 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__5, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tensorflow_python_framework_fast, __pyx_n_s_AppendBoolArrayToTensorProto, 130, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__21)) __PYX_ERR(0, 130, __pyx_L1_error) |
7734 | __Pyx_RefNannyFinishContext(); |
7735 | return 0; |
7736 | __pyx_L1_error:; |
7737 | __Pyx_RefNannyFinishContext(); |
7738 | return -1; |
7739 | } |
7740 | /* #### Code section: init_constants ### */ |
7741 | |
7742 | static CYTHON_SMALL_CODE int __Pyx_InitConstants(void) { |
7743 | #if CYTHON_USE_MODULE_STATE |
7744 | if (__Pyx_InitString(__pyx_string_tab[0], &__pyx_n_s_AppendBFloat16ArrayToTensorProto) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
7745 | if (__Pyx_InitString(__pyx_string_tab[1], &__pyx_n_s_AppendBoolArrayToTensorProto) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
7746 | if (__Pyx_InitString(__pyx_string_tab[2], &__pyx_n_s_AppendComplex128ArrayToTensorPro) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
7747 | if (__Pyx_InitString(__pyx_string_tab[3], &__pyx_n_s_AppendComplex64ArrayToTensorProt) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
7748 | if (__Pyx_InitString(__pyx_string_tab[4], &__pyx_n_s_AppendFloat16ArrayToTensorProto) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
7749 | if (__Pyx_InitString(__pyx_string_tab[5], &__pyx_n_s_AppendFloat32ArrayToTensorProto) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
7750 | if (__Pyx_InitString(__pyx_string_tab[6], &__pyx_n_s_AppendFloat64ArrayToTensorProto) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
7751 | if (__Pyx_InitString(__pyx_string_tab[7], &__pyx_n_s_AppendInt16ArrayToTensorProto) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
7752 | if (__Pyx_InitString(__pyx_string_tab[8], &__pyx_n_s_AppendInt32ArrayToTensorProto) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
7753 | if (__Pyx_InitString(__pyx_string_tab[9], &__pyx_n_s_AppendInt64ArrayToTensorProto) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
7754 | if (__Pyx_InitString(__pyx_string_tab[10], &__pyx_n_s_AppendInt8ArrayToTensorProto) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
7755 | if (__Pyx_InitString(__pyx_string_tab[11], &__pyx_n_s_AppendObjectArrayToTensorProto) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
7756 | if (__Pyx_InitString(__pyx_string_tab[12], &__pyx_n_s_AppendUInt16ArrayToTensorProto) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
7757 | if (__Pyx_InitString(__pyx_string_tab[13], &__pyx_n_s_AppendUInt32ArrayToTensorProto) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
7758 | if (__Pyx_InitString(__pyx_string_tab[14], &__pyx_n_s_AppendUInt64ArrayToTensorProto) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
7759 | if (__Pyx_InitString(__pyx_string_tab[15], &__pyx_n_s_AppendUInt8ArrayToTensorProto) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
7760 | if (__Pyx_InitString(__pyx_string_tab[16], &__pyx_n_s_ImportError) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
7761 | if (__Pyx_InitString(__pyx_string_tab[17], &__pyx_n_s__22) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
7762 | if (__Pyx_InitString(__pyx_string_tab[18], &__pyx_n_s__3) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
7763 | if (__Pyx_InitString(__pyx_string_tab[19], &__pyx_kp_u__4) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
7764 | if (__Pyx_InitString(__pyx_string_tab[20], &__pyx_n_s_append) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
7765 | if (__Pyx_InitString(__pyx_string_tab[21], &__pyx_n_s_as_bytes) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
7766 | if (__Pyx_InitString(__pyx_string_tab[22], &__pyx_n_s_asyncio_coroutines) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
7767 | if (__Pyx_InitString(__pyx_string_tab[23], &__pyx_n_s_bool_val) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
7768 | if (__Pyx_InitString(__pyx_string_tab[24], &__pyx_n_s_cline_in_traceback) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
7769 | if (__Pyx_InitString(__pyx_string_tab[25], &__pyx_n_s_compat) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
7770 | if (__Pyx_InitString(__pyx_string_tab[26], &__pyx_n_s_dcomplex_val) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
7771 | if (__Pyx_InitString(__pyx_string_tab[27], &__pyx_n_s_double_val) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
7772 | if (__Pyx_InitString(__pyx_string_tab[28], &__pyx_n_s_float_val) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
7773 | if (__Pyx_InitString(__pyx_string_tab[29], &__pyx_n_s_half_val) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
7774 | if (__Pyx_InitString(__pyx_string_tab[30], &__pyx_n_s_i) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
7775 | if (__Pyx_InitString(__pyx_string_tab[31], &__pyx_n_s_import) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
7776 | if (__Pyx_InitString(__pyx_string_tab[32], &__pyx_n_s_initializing) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
7777 | if (__Pyx_InitString(__pyx_string_tab[33], &__pyx_n_s_int64_val) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
7778 | if (__Pyx_InitString(__pyx_string_tab[34], &__pyx_n_s_int_val) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
7779 | if (__Pyx_InitString(__pyx_string_tab[35], &__pyx_n_s_is_coroutine) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
7780 | if (__Pyx_InitString(__pyx_string_tab[36], &__pyx_n_s_item) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
7781 | if (__Pyx_InitString(__pyx_string_tab[37], &__pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
7782 | if (__Pyx_InitString(__pyx_string_tab[38], &__pyx_n_s_n) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
7783 | if (__Pyx_InitString(__pyx_string_tab[39], &__pyx_n_s_name) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
7784 | if (__Pyx_InitString(__pyx_string_tab[40], &__pyx_n_s_np) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
7785 | if (__Pyx_InitString(__pyx_string_tab[41], &__pyx_n_s_nparray) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
7786 | if (__Pyx_InitString(__pyx_string_tab[42], &__pyx_n_s_numpy) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
7787 | if (__Pyx_InitString(__pyx_string_tab[43], &__pyx_kp_s_numpy_core_multiarray_failed_to) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
7788 | if (__Pyx_InitString(__pyx_string_tab[44], &__pyx_kp_s_numpy_core_umath_failed_to_impor) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
7789 | if (__Pyx_InitString(__pyx_string_tab[45], &__pyx_n_s_range) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
7790 | if (__Pyx_InitString(__pyx_string_tab[46], &__pyx_n_s_scomplex_val) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
7791 | if (__Pyx_InitString(__pyx_string_tab[47], &__pyx_n_s_size) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
7792 | if (__Pyx_InitString(__pyx_string_tab[48], &__pyx_n_s_spec) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
7793 | if (__Pyx_InitString(__pyx_string_tab[49], &__pyx_n_s_string_val) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
7794 | if (__Pyx_InitString(__pyx_string_tab[50], &__pyx_n_s_tensor_proto) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
7795 | if (__Pyx_InitString(__pyx_string_tab[51], &__pyx_kp_s_tensorflow_python_framework_fast) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
7796 | if (__Pyx_InitString(__pyx_string_tab[52], &__pyx_n_s_tensorflow_python_framework_fast_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
7797 | if (__Pyx_InitString(__pyx_string_tab[53], &__pyx_n_s_tensorflow_python_util) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
7798 | if (__Pyx_InitString(__pyx_string_tab[54], &__pyx_n_s_test) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
7799 | if (__Pyx_InitString(__pyx_string_tab[55], &__pyx_n_s_uint32_val) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
7800 | if (__Pyx_InitString(__pyx_string_tab[56], &__pyx_n_s_uint64_val) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
7801 | #endif |
7802 | #if !CYTHON_USE_MODULE_STATE |
7803 | if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
7804 | #endif |
7805 | return 0; |
7806 | __pyx_L1_error:; |
7807 | return -1; |
7808 | } |
7809 | /* #### Code section: init_globals ### */ |
7810 | |
7811 | static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { |
7812 | /* NumpyImportArray.init */ |
7813 | /* |
7814 | * Cython has automatically inserted a call to _import_array since |
7815 | * you didn't include one when you cimported numpy. To disable this |
7816 | * add the line |
7817 | * <void>numpy._import_array |
7818 | */ |
7819 | #ifdef NPY_FEATURE_VERSION |
7820 | #if !NO_IMPORT_ARRAY |
7821 | if (unlikely(_import_array() == -1)) { |
7822 | PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import " |
7823 | "(auto-generated because you didn't call 'numpy.import_array()' after cimporting numpy; " |
7824 | "use '<void>numpy._import_array' to disable if you are certain you don't need it)." ); |
7825 | __PYX_ERR(0, 5, __pyx_L1_error); |
7826 | } |
7827 | #endif |
7828 | #endif |
7829 | |
7830 | if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) |
7831 | |
7832 | return 0; |
7833 | __pyx_L1_error:; |
7834 | return -1; |
7835 | } |
7836 | /* #### Code section: init_module ### */ |
7837 | |
7838 | static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/ |
7839 | static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/ |
7840 | static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/ |
7841 | static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/ |
7842 | static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/ |
7843 | static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/ |
7844 | static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/ |
7845 | |
7846 | static int __Pyx_modinit_global_init_code(void) { |
7847 | __Pyx_RefNannyDeclarations |
7848 | __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code" , 0); |
7849 | /*--- Global init code ---*/ |
7850 | __Pyx_RefNannyFinishContext(); |
7851 | return 0; |
7852 | } |
7853 | |
7854 | static int __Pyx_modinit_variable_export_code(void) { |
7855 | __Pyx_RefNannyDeclarations |
7856 | __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code" , 0); |
7857 | /*--- Variable export code ---*/ |
7858 | __Pyx_RefNannyFinishContext(); |
7859 | return 0; |
7860 | } |
7861 | |
7862 | static int __Pyx_modinit_function_export_code(void) { |
7863 | __Pyx_RefNannyDeclarations |
7864 | __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code" , 0); |
7865 | /*--- Function export code ---*/ |
7866 | __Pyx_RefNannyFinishContext(); |
7867 | return 0; |
7868 | } |
7869 | |
7870 | static int __Pyx_modinit_type_init_code(void) { |
7871 | __Pyx_RefNannyDeclarations |
7872 | __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code" , 0); |
7873 | /*--- Type init code ---*/ |
7874 | __Pyx_RefNannyFinishContext(); |
7875 | return 0; |
7876 | } |
7877 | |
7878 | static int __Pyx_modinit_type_import_code(void) { |
7879 | __Pyx_RefNannyDeclarations |
7880 | PyObject *__pyx_t_1 = NULL; |
7881 | int __pyx_lineno = 0; |
7882 | const char *__pyx_filename = NULL; |
7883 | int __pyx_clineno = 0; |
7884 | __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code" , 0); |
7885 | /*--- Type import code ---*/ |
7886 | __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 9, __pyx_L1_error) |
7887 | __Pyx_GOTREF(__pyx_t_1); |
7888 | __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type" , |
7889 | #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 |
7890 | sizeof(PyTypeObject), |
7891 | #elif CYTHON_COMPILING_IN_LIMITED_API |
7892 | sizeof(PyTypeObject), |
7893 | #else |
7894 | sizeof(PyHeapTypeObject), |
7895 | #endif |
7896 | __Pyx_ImportType_CheckSize_Warn); |
7897 | if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(2, 9, __pyx_L1_error) |
7898 | __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
7899 | __pyx_t_1 = PyImport_ImportModule("numpy" ); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 202, __pyx_L1_error) |
7900 | __Pyx_GOTREF(__pyx_t_1); |
7901 | __pyx_ptype_5numpy_dtype = __Pyx_ImportType(__pyx_t_1, "numpy" , "dtype" , sizeof(PyArray_Descr), __Pyx_ImportType_CheckSize_Ignore); |
7902 | if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(1, 202, __pyx_L1_error) |
7903 | __pyx_ptype_5numpy_flatiter = __Pyx_ImportType(__pyx_t_1, "numpy" , "flatiter" , sizeof(PyArrayIterObject), __Pyx_ImportType_CheckSize_Ignore); |
7904 | if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(1, 225, __pyx_L1_error) |
7905 | __pyx_ptype_5numpy_broadcast = __Pyx_ImportType(__pyx_t_1, "numpy" , "broadcast" , sizeof(PyArrayMultiIterObject), __Pyx_ImportType_CheckSize_Ignore); |
7906 | if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(1, 229, __pyx_L1_error) |
7907 | __pyx_ptype_5numpy_ndarray = __Pyx_ImportType(__pyx_t_1, "numpy" , "ndarray" , sizeof(PyArrayObject), __Pyx_ImportType_CheckSize_Ignore); |
7908 | if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(1, 238, __pyx_L1_error) |
7909 | __pyx_ptype_5numpy_generic = __Pyx_ImportType(__pyx_t_1, "numpy" , "generic" , sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn); |
7910 | if (!__pyx_ptype_5numpy_generic) __PYX_ERR(1, 812, __pyx_L1_error) |
7911 | __pyx_ptype_5numpy_number = __Pyx_ImportType(__pyx_t_1, "numpy" , "number" , sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn); |
7912 | if (!__pyx_ptype_5numpy_number) __PYX_ERR(1, 814, __pyx_L1_error) |
7913 | __pyx_ptype_5numpy_integer = __Pyx_ImportType(__pyx_t_1, "numpy" , "integer" , sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn); |
7914 | if (!__pyx_ptype_5numpy_integer) __PYX_ERR(1, 816, __pyx_L1_error) |
7915 | __pyx_ptype_5numpy_signedinteger = __Pyx_ImportType(__pyx_t_1, "numpy" , "signedinteger" , sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn); |
7916 | if (!__pyx_ptype_5numpy_signedinteger) __PYX_ERR(1, 818, __pyx_L1_error) |
7917 | __pyx_ptype_5numpy_unsignedinteger = __Pyx_ImportType(__pyx_t_1, "numpy" , "unsignedinteger" , sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn); |
7918 | if (!__pyx_ptype_5numpy_unsignedinteger) __PYX_ERR(1, 820, __pyx_L1_error) |
7919 | __pyx_ptype_5numpy_inexact = __Pyx_ImportType(__pyx_t_1, "numpy" , "inexact" , sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn); |
7920 | if (!__pyx_ptype_5numpy_inexact) __PYX_ERR(1, 822, __pyx_L1_error) |
7921 | __pyx_ptype_5numpy_floating = __Pyx_ImportType(__pyx_t_1, "numpy" , "floating" , sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn); |
7922 | if (!__pyx_ptype_5numpy_floating) __PYX_ERR(1, 824, __pyx_L1_error) |
7923 | __pyx_ptype_5numpy_complexfloating = __Pyx_ImportType(__pyx_t_1, "numpy" , "complexfloating" , sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn); |
7924 | if (!__pyx_ptype_5numpy_complexfloating) __PYX_ERR(1, 826, __pyx_L1_error) |
7925 | __pyx_ptype_5numpy_flexible = __Pyx_ImportType(__pyx_t_1, "numpy" , "flexible" , sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn); |
7926 | if (!__pyx_ptype_5numpy_flexible) __PYX_ERR(1, 828, __pyx_L1_error) |
7927 | __pyx_ptype_5numpy_character = __Pyx_ImportType(__pyx_t_1, "numpy" , "character" , sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn); |
7928 | if (!__pyx_ptype_5numpy_character) __PYX_ERR(1, 830, __pyx_L1_error) |
7929 | __pyx_ptype_5numpy_ufunc = __Pyx_ImportType(__pyx_t_1, "numpy" , "ufunc" , sizeof(PyUFuncObject), __Pyx_ImportType_CheckSize_Ignore); |
7930 | if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(1, 868, __pyx_L1_error) |
7931 | __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
7932 | __Pyx_RefNannyFinishContext(); |
7933 | return 0; |
7934 | __pyx_L1_error:; |
7935 | __Pyx_XDECREF(__pyx_t_1); |
7936 | __Pyx_RefNannyFinishContext(); |
7937 | return -1; |
7938 | } |
7939 | |
7940 | static int __Pyx_modinit_variable_import_code(void) { |
7941 | __Pyx_RefNannyDeclarations |
7942 | __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code" , 0); |
7943 | /*--- Variable import code ---*/ |
7944 | __Pyx_RefNannyFinishContext(); |
7945 | return 0; |
7946 | } |
7947 | |
7948 | static int __Pyx_modinit_function_import_code(void) { |
7949 | __Pyx_RefNannyDeclarations |
7950 | __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code" , 0); |
7951 | /*--- Function import code ---*/ |
7952 | __Pyx_RefNannyFinishContext(); |
7953 | return 0; |
7954 | } |
7955 | |
7956 | |
7957 | #if PY_MAJOR_VERSION >= 3 |
7958 | #if CYTHON_PEP489_MULTI_PHASE_INIT |
7959 | static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ |
7960 | static int __pyx_pymod_exec_fast_tensor_util(PyObject* module); /*proto*/ |
7961 | static PyModuleDef_Slot __pyx_moduledef_slots[] = { |
7962 | {Py_mod_create, (void*)__pyx_pymod_create}, |
7963 | {Py_mod_exec, (void*)__pyx_pymod_exec_fast_tensor_util}, |
7964 | {0, NULL} |
7965 | }; |
7966 | #endif |
7967 | |
7968 | #ifdef __cplusplus |
7969 | namespace { |
7970 | struct PyModuleDef __pyx_moduledef = |
7971 | #else |
7972 | static struct PyModuleDef __pyx_moduledef = |
7973 | #endif |
7974 | { |
7975 | PyModuleDef_HEAD_INIT, |
7976 | "fast_tensor_util" , |
7977 | 0, /* m_doc */ |
7978 | #if CYTHON_PEP489_MULTI_PHASE_INIT |
7979 | 0, /* m_size */ |
7980 | #elif CYTHON_USE_MODULE_STATE |
7981 | sizeof(__pyx_mstate), /* m_size */ |
7982 | #else |
7983 | -1, /* m_size */ |
7984 | #endif |
7985 | __pyx_methods /* m_methods */, |
7986 | #if CYTHON_PEP489_MULTI_PHASE_INIT |
7987 | __pyx_moduledef_slots, /* m_slots */ |
7988 | #else |
7989 | NULL, /* m_reload */ |
7990 | #endif |
7991 | #if CYTHON_USE_MODULE_STATE |
7992 | __pyx_m_traverse, /* m_traverse */ |
7993 | __pyx_m_clear, /* m_clear */ |
7994 | NULL /* m_free */ |
7995 | #else |
7996 | NULL, /* m_traverse */ |
7997 | NULL, /* m_clear */ |
7998 | NULL /* m_free */ |
7999 | #endif |
8000 | }; |
8001 | #ifdef __cplusplus |
8002 | } /* anonymous namespace */ |
8003 | #endif |
8004 | #endif |
8005 | |
8006 | #ifndef CYTHON_NO_PYINIT_EXPORT |
8007 | #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC |
8008 | #elif PY_MAJOR_VERSION < 3 |
8009 | #ifdef __cplusplus |
8010 | #define __Pyx_PyMODINIT_FUNC extern "C" void |
8011 | #else |
8012 | #define __Pyx_PyMODINIT_FUNC void |
8013 | #endif |
8014 | #else |
8015 | #ifdef __cplusplus |
8016 | #define __Pyx_PyMODINIT_FUNC extern "C" PyObject * |
8017 | #else |
8018 | #define __Pyx_PyMODINIT_FUNC PyObject * |
8019 | #endif |
8020 | #endif |
8021 | |
8022 | |
8023 | #if PY_MAJOR_VERSION < 3 |
8024 | __Pyx_PyMODINIT_FUNC initfast_tensor_util(void) CYTHON_SMALL_CODE; /*proto*/ |
8025 | __Pyx_PyMODINIT_FUNC initfast_tensor_util(void) |
8026 | #else |
8027 | __Pyx_PyMODINIT_FUNC PyInit_fast_tensor_util(void) CYTHON_SMALL_CODE; /*proto*/ |
8028 | __Pyx_PyMODINIT_FUNC PyInit_fast_tensor_util(void) |
8029 | #if CYTHON_PEP489_MULTI_PHASE_INIT |
8030 | { |
8031 | return PyModuleDef_Init(&__pyx_moduledef); |
8032 | } |
8033 | static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { |
8034 | #if PY_VERSION_HEX >= 0x030700A1 |
8035 | static PY_INT64_T main_interpreter_id = -1; |
8036 | PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp); |
8037 | if (main_interpreter_id == -1) { |
8038 | main_interpreter_id = current_id; |
8039 | return (unlikely(current_id == -1)) ? -1 : 0; |
8040 | } else if (unlikely(main_interpreter_id != current_id)) |
8041 | #else |
8042 | static PyInterpreterState *main_interpreter = NULL; |
8043 | PyInterpreterState *current_interpreter = PyThreadState_Get()->interp; |
8044 | if (!main_interpreter) { |
8045 | main_interpreter = current_interpreter; |
8046 | } else if (unlikely(main_interpreter != current_interpreter)) |
8047 | #endif |
8048 | { |
8049 | PyErr_SetString( |
8050 | PyExc_ImportError, |
8051 | "Interpreter change detected - this module can only be loaded into one interpreter per process." ); |
8052 | return -1; |
8053 | } |
8054 | return 0; |
8055 | } |
8056 | #if CYTHON_COMPILING_IN_LIMITED_API |
8057 | static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *module, const char* from_name, const char* to_name, int allow_none) |
8058 | #else |
8059 | 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) |
8060 | #endif |
8061 | { |
8062 | PyObject *value = PyObject_GetAttrString(spec, from_name); |
8063 | int result = 0; |
8064 | if (likely(value)) { |
8065 | if (allow_none || value != Py_None) { |
8066 | #if CYTHON_COMPILING_IN_LIMITED_API |
8067 | result = PyModule_AddObject(module, to_name, value); |
8068 | #else |
8069 | result = PyDict_SetItemString(moddict, to_name, value); |
8070 | #endif |
8071 | } |
8072 | Py_DECREF(value); |
8073 | } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { |
8074 | PyErr_Clear(); |
8075 | } else { |
8076 | result = -1; |
8077 | } |
8078 | return result; |
8079 | } |
8080 | static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) { |
8081 | PyObject *module = NULL, *moddict, *modname; |
8082 | CYTHON_UNUSED_VAR(def); |
8083 | if (__Pyx_check_single_interpreter()) |
8084 | return NULL; |
8085 | if (__pyx_m) |
8086 | return __Pyx_NewRef(__pyx_m); |
8087 | modname = PyObject_GetAttrString(spec, "name" ); |
8088 | if (unlikely(!modname)) goto bad; |
8089 | module = PyModule_NewObject(modname); |
8090 | Py_DECREF(modname); |
8091 | if (unlikely(!module)) goto bad; |
8092 | #if CYTHON_COMPILING_IN_LIMITED_API |
8093 | moddict = module; |
8094 | #else |
8095 | moddict = PyModule_GetDict(module); |
8096 | if (unlikely(!moddict)) goto bad; |
8097 | #endif |
8098 | if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader" , "__loader__" , 1) < 0)) goto bad; |
8099 | if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin" , "__file__" , 1) < 0)) goto bad; |
8100 | if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent" , "__package__" , 1) < 0)) goto bad; |
8101 | if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations" , "__path__" , 0) < 0)) goto bad; |
8102 | return module; |
8103 | bad: |
8104 | Py_XDECREF(module); |
8105 | return NULL; |
8106 | } |
8107 | |
8108 | |
8109 | static CYTHON_SMALL_CODE int __pyx_pymod_exec_fast_tensor_util(PyObject *__pyx_pyinit_module) |
8110 | #endif |
8111 | #endif |
8112 | { |
8113 | int stringtab_initialized = 0; |
8114 | PyObject *__pyx_t_1 = NULL; |
8115 | PyObject *__pyx_t_2 = NULL; |
8116 | PyObject *__pyx_t_3 = NULL; |
8117 | int __pyx_lineno = 0; |
8118 | const char *__pyx_filename = NULL; |
8119 | int __pyx_clineno = 0; |
8120 | __Pyx_RefNannyDeclarations |
8121 | #if CYTHON_PEP489_MULTI_PHASE_INIT |
8122 | if (__pyx_m) { |
8123 | if (__pyx_m == __pyx_pyinit_module) return 0; |
8124 | PyErr_SetString(PyExc_RuntimeError, "Module 'fast_tensor_util' has already been imported. Re-initialisation is not supported." ); |
8125 | return -1; |
8126 | } |
8127 | #elif PY_MAJOR_VERSION >= 3 |
8128 | if (__pyx_m) return __Pyx_NewRef(__pyx_m); |
8129 | #endif |
8130 | /*--- Module creation code ---*/ |
8131 | #if CYTHON_PEP489_MULTI_PHASE_INIT |
8132 | __pyx_m = __pyx_pyinit_module; |
8133 | Py_INCREF(__pyx_m); |
8134 | #else |
8135 | #if PY_MAJOR_VERSION < 3 |
8136 | __pyx_m = Py_InitModule4("fast_tensor_util" , __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); |
8137 | if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) |
8138 | #elif CYTHON_COMPILING_IN_LIMITED_API |
8139 | __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) |
8140 | { |
8141 | int add_module_result = PyState_AddModule(__pyx_t_1, &__pyx_moduledef); |
8142 | Py_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
8143 | if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error) |
8144 | } |
8145 | #else |
8146 | __pyx_m = PyModule_Create(&__pyx_moduledef); |
8147 | if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) |
8148 | #endif |
8149 | #endif |
8150 | CYTHON_UNUSED_VAR(__pyx_t_1); |
8151 | __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) |
8152 | Py_INCREF(__pyx_d); |
8153 | __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) |
8154 | Py_INCREF(__pyx_b); |
8155 | __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime" ); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) |
8156 | Py_INCREF(__pyx_cython_runtime); |
8157 | if (PyObject_SetAttrString(__pyx_m, "__builtins__" , __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
8158 | #if CYTHON_REFNANNY |
8159 | __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny" ); |
8160 | if (!__Pyx_RefNanny) { |
8161 | PyErr_Clear(); |
8162 | __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny" ); |
8163 | if (!__Pyx_RefNanny) |
8164 | Py_FatalError("failed to import 'refnanny' module" ); |
8165 | } |
8166 | #endif |
8167 | __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_fast_tensor_util(void)" , 0); |
8168 | if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error) |
8169 | #ifdef __Pxy_PyFrame_Initialize_Offsets |
8170 | __Pxy_PyFrame_Initialize_Offsets(); |
8171 | #endif |
8172 | __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) |
8173 | __pyx_empty_bytes = PyBytes_FromStringAndSize("" , 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) |
8174 | __pyx_empty_unicode = PyUnicode_FromStringAndSize("" , 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) |
8175 | #ifdef __Pyx_CyFunction_USED |
8176 | if (__pyx_CyFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) |
8177 | #endif |
8178 | #ifdef __Pyx_FusedFunction_USED |
8179 | if (__pyx_FusedFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) |
8180 | #endif |
8181 | #ifdef __Pyx_Coroutine_USED |
8182 | if (__pyx_Coroutine_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) |
8183 | #endif |
8184 | #ifdef __Pyx_Generator_USED |
8185 | if (__pyx_Generator_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) |
8186 | #endif |
8187 | #ifdef __Pyx_AsyncGen_USED |
8188 | if (__pyx_AsyncGen_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) |
8189 | #endif |
8190 | #ifdef __Pyx_StopAsyncIteration_USED |
8191 | if (__pyx_StopAsyncIteration_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) |
8192 | #endif |
8193 | /*--- Library function declarations ---*/ |
8194 | /*--- Threads initialization code ---*/ |
8195 | #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS |
8196 | PyEval_InitThreads(); |
8197 | #endif |
8198 | /*--- Initialize various global constants etc. ---*/ |
8199 | if (__Pyx_InitConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) |
8200 | stringtab_initialized = 1; |
8201 | if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) |
8202 | #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) |
8203 | if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) |
8204 | #endif |
8205 | if (__pyx_module_is_main_tensorflow__python__framework__fast_tensor_util) { |
8206 | if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) |
8207 | } |
8208 | #if PY_MAJOR_VERSION >= 3 |
8209 | { |
8210 | PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) |
8211 | if (!PyDict_GetItemString(modules, "tensorflow.python.framework.fast_tensor_util" )) { |
8212 | if (unlikely((PyDict_SetItemString(modules, "tensorflow.python.framework.fast_tensor_util" , __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) |
8213 | } |
8214 | } |
8215 | #endif |
8216 | /*--- Builtin init code ---*/ |
8217 | if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) |
8218 | /*--- Constants init code ---*/ |
8219 | if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) |
8220 | /*--- Global type/function init code ---*/ |
8221 | (void)__Pyx_modinit_global_init_code(); |
8222 | (void)__Pyx_modinit_variable_export_code(); |
8223 | (void)__Pyx_modinit_function_export_code(); |
8224 | (void)__Pyx_modinit_type_init_code(); |
8225 | if (unlikely((__Pyx_modinit_type_import_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error) |
8226 | (void)__Pyx_modinit_variable_import_code(); |
8227 | (void)__Pyx_modinit_function_import_code(); |
8228 | /*--- Execution code ---*/ |
8229 | #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) |
8230 | if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) |
8231 | #endif |
8232 | |
8233 | /* "tensorflow/python/framework/fast_tensor_util.pyx":4 |
8234 | * #cython: wraparound=False |
8235 | * #cython: infer_types=True |
8236 | * import numpy as np # <<<<<<<<<<<<<< |
8237 | * cimport numpy as np |
8238 | * |
8239 | */ |
8240 | __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_n_s_numpy, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4, __pyx_L1_error) |
8241 | __Pyx_GOTREF(__pyx_t_2); |
8242 | if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_2) < 0) __PYX_ERR(0, 4, __pyx_L1_error) |
8243 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
8244 | |
8245 | /* "tensorflow/python/framework/fast_tensor_util.pyx":7 |
8246 | * cimport numpy as np |
8247 | * |
8248 | * from tensorflow.python.util import compat # <<<<<<<<<<<<<< |
8249 | * |
8250 | * def AppendBFloat16ArrayToTensorProto( |
8251 | */ |
8252 | __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 7, __pyx_L1_error) |
8253 | __Pyx_GOTREF(__pyx_t_2); |
8254 | __Pyx_INCREF(__pyx_n_s_compat); |
8255 | __Pyx_GIVEREF(__pyx_n_s_compat); |
8256 | PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_compat); |
8257 | __pyx_t_3 = __Pyx_Import(__pyx_n_s_tensorflow_python_util, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 7, __pyx_L1_error) |
8258 | __Pyx_GOTREF(__pyx_t_3); |
8259 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
8260 | __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_compat); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 7, __pyx_L1_error) |
8261 | __Pyx_GOTREF(__pyx_t_2); |
8262 | if (PyDict_SetItem(__pyx_d, __pyx_n_s_compat, __pyx_t_2) < 0) __PYX_ERR(0, 7, __pyx_L1_error) |
8263 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
8264 | __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
8265 | |
8266 | /* "tensorflow/python/framework/fast_tensor_util.pyx":9 |
8267 | * from tensorflow.python.util import compat |
8268 | * |
8269 | * def AppendBFloat16ArrayToTensorProto( # <<<<<<<<<<<<<< |
8270 | * tensor_proto, np.ndarray[np.uint16_t, ndim=1] nparray): |
8271 | * cdef long i, n |
8272 | */ |
8273 | __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_10tensorflow_6python_9framework_16fast_tensor_util_1AppendBFloat16ArrayToTensorProto, 0, __pyx_n_s_AppendBFloat16ArrayToTensorProto, NULL, __pyx_n_s_tensorflow_python_framework_fast_2, __pyx_d, ((PyObject *)__pyx_codeobj__6)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 9, __pyx_L1_error) |
8274 | __Pyx_GOTREF(__pyx_t_3); |
8275 | if (PyDict_SetItem(__pyx_d, __pyx_n_s_AppendBFloat16ArrayToTensorProto, __pyx_t_3) < 0) __PYX_ERR(0, 9, __pyx_L1_error) |
8276 | __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
8277 | |
8278 | /* "tensorflow/python/framework/fast_tensor_util.pyx":17 |
8279 | * |
8280 | * |
8281 | * def AppendFloat16ArrayToTensorProto( # <<<<<<<<<<<<<< |
8282 | * # For numpy, npy_half is a typedef for npy_uint16, |
8283 | * # see: https://github.com/numpy/numpy/blob/master/doc/source/reference/c-api.coremath.rst#half-precision-functions |
8284 | */ |
8285 | __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_10tensorflow_6python_9framework_16fast_tensor_util_3AppendFloat16ArrayToTensorProto, 0, __pyx_n_s_AppendFloat16ArrayToTensorProto, NULL, __pyx_n_s_tensorflow_python_framework_fast_2, __pyx_d, ((PyObject *)__pyx_codeobj__7)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 17, __pyx_L1_error) |
8286 | __Pyx_GOTREF(__pyx_t_3); |
8287 | if (PyDict_SetItem(__pyx_d, __pyx_n_s_AppendFloat16ArrayToTensorProto, __pyx_t_3) < 0) __PYX_ERR(0, 17, __pyx_L1_error) |
8288 | __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
8289 | |
8290 | /* "tensorflow/python/framework/fast_tensor_util.pyx":29 |
8291 | * |
8292 | * |
8293 | * def AppendFloat32ArrayToTensorProto( # <<<<<<<<<<<<<< |
8294 | * tensor_proto, np.ndarray[np.float32_t, ndim=1] nparray): |
8295 | * cdef long i, n |
8296 | */ |
8297 | __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_10tensorflow_6python_9framework_16fast_tensor_util_5AppendFloat32ArrayToTensorProto, 0, __pyx_n_s_AppendFloat32ArrayToTensorProto, NULL, __pyx_n_s_tensorflow_python_framework_fast_2, __pyx_d, ((PyObject *)__pyx_codeobj__8)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 29, __pyx_L1_error) |
8298 | __Pyx_GOTREF(__pyx_t_3); |
8299 | if (PyDict_SetItem(__pyx_d, __pyx_n_s_AppendFloat32ArrayToTensorProto, __pyx_t_3) < 0) __PYX_ERR(0, 29, __pyx_L1_error) |
8300 | __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
8301 | |
8302 | /* "tensorflow/python/framework/fast_tensor_util.pyx":37 |
8303 | * |
8304 | * |
8305 | * def AppendFloat64ArrayToTensorProto( # <<<<<<<<<<<<<< |
8306 | * tensor_proto, np.ndarray[np.float64_t, ndim=1] nparray): |
8307 | * cdef long i, n |
8308 | */ |
8309 | __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_10tensorflow_6python_9framework_16fast_tensor_util_7AppendFloat64ArrayToTensorProto, 0, __pyx_n_s_AppendFloat64ArrayToTensorProto, NULL, __pyx_n_s_tensorflow_python_framework_fast_2, __pyx_d, ((PyObject *)__pyx_codeobj__9)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 37, __pyx_L1_error) |
8310 | __Pyx_GOTREF(__pyx_t_3); |
8311 | if (PyDict_SetItem(__pyx_d, __pyx_n_s_AppendFloat64ArrayToTensorProto, __pyx_t_3) < 0) __PYX_ERR(0, 37, __pyx_L1_error) |
8312 | __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
8313 | |
8314 | /* "tensorflow/python/framework/fast_tensor_util.pyx":45 |
8315 | * |
8316 | * |
8317 | * def AppendInt32ArrayToTensorProto( # <<<<<<<<<<<<<< |
8318 | * tensor_proto, np.ndarray[np.int32_t, ndim=1] nparray): |
8319 | * cdef long i, n |
8320 | */ |
8321 | __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_10tensorflow_6python_9framework_16fast_tensor_util_9AppendInt32ArrayToTensorProto, 0, __pyx_n_s_AppendInt32ArrayToTensorProto, NULL, __pyx_n_s_tensorflow_python_framework_fast_2, __pyx_d, ((PyObject *)__pyx_codeobj__10)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 45, __pyx_L1_error) |
8322 | __Pyx_GOTREF(__pyx_t_3); |
8323 | if (PyDict_SetItem(__pyx_d, __pyx_n_s_AppendInt32ArrayToTensorProto, __pyx_t_3) < 0) __PYX_ERR(0, 45, __pyx_L1_error) |
8324 | __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
8325 | |
8326 | /* "tensorflow/python/framework/fast_tensor_util.pyx":52 |
8327 | * tensor_proto.int_val.append(nparray[i]) |
8328 | * |
8329 | * def AppendUInt32ArrayToTensorProto( # <<<<<<<<<<<<<< |
8330 | * tensor_proto, np.ndarray[np.uint32_t, ndim=1] nparray): |
8331 | * cdef long i, n |
8332 | */ |
8333 | __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_10tensorflow_6python_9framework_16fast_tensor_util_11AppendUInt32ArrayToTensorProto, 0, __pyx_n_s_AppendUInt32ArrayToTensorProto, NULL, __pyx_n_s_tensorflow_python_framework_fast_2, __pyx_d, ((PyObject *)__pyx_codeobj__11)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 52, __pyx_L1_error) |
8334 | __Pyx_GOTREF(__pyx_t_3); |
8335 | if (PyDict_SetItem(__pyx_d, __pyx_n_s_AppendUInt32ArrayToTensorProto, __pyx_t_3) < 0) __PYX_ERR(0, 52, __pyx_L1_error) |
8336 | __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
8337 | |
8338 | /* "tensorflow/python/framework/fast_tensor_util.pyx":59 |
8339 | * tensor_proto.uint32_val.append(nparray[i]) |
8340 | * |
8341 | * def AppendInt64ArrayToTensorProto( # <<<<<<<<<<<<<< |
8342 | * tensor_proto, np.ndarray[np.int64_t, ndim=1] nparray): |
8343 | * cdef long i, n |
8344 | */ |
8345 | __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_10tensorflow_6python_9framework_16fast_tensor_util_13AppendInt64ArrayToTensorProto, 0, __pyx_n_s_AppendInt64ArrayToTensorProto, NULL, __pyx_n_s_tensorflow_python_framework_fast_2, __pyx_d, ((PyObject *)__pyx_codeobj__12)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 59, __pyx_L1_error) |
8346 | __Pyx_GOTREF(__pyx_t_3); |
8347 | if (PyDict_SetItem(__pyx_d, __pyx_n_s_AppendInt64ArrayToTensorProto, __pyx_t_3) < 0) __PYX_ERR(0, 59, __pyx_L1_error) |
8348 | __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
8349 | |
8350 | /* "tensorflow/python/framework/fast_tensor_util.pyx":66 |
8351 | * tensor_proto.int64_val.append(nparray[i]) |
8352 | * |
8353 | * def AppendUInt64ArrayToTensorProto( # <<<<<<<<<<<<<< |
8354 | * tensor_proto, np.ndarray[np.uint64_t, ndim=1] nparray): |
8355 | * cdef long i, n |
8356 | */ |
8357 | __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_10tensorflow_6python_9framework_16fast_tensor_util_15AppendUInt64ArrayToTensorProto, 0, __pyx_n_s_AppendUInt64ArrayToTensorProto, NULL, __pyx_n_s_tensorflow_python_framework_fast_2, __pyx_d, ((PyObject *)__pyx_codeobj__13)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 66, __pyx_L1_error) |
8358 | __Pyx_GOTREF(__pyx_t_3); |
8359 | if (PyDict_SetItem(__pyx_d, __pyx_n_s_AppendUInt64ArrayToTensorProto, __pyx_t_3) < 0) __PYX_ERR(0, 66, __pyx_L1_error) |
8360 | __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
8361 | |
8362 | /* "tensorflow/python/framework/fast_tensor_util.pyx":73 |
8363 | * tensor_proto.uint64_val.append(nparray[i]) |
8364 | * |
8365 | * def AppendUInt8ArrayToTensorProto( # <<<<<<<<<<<<<< |
8366 | * tensor_proto, np.ndarray[np.uint8_t, ndim=1] nparray): |
8367 | * cdef long i, n |
8368 | */ |
8369 | __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_10tensorflow_6python_9framework_16fast_tensor_util_17AppendUInt8ArrayToTensorProto, 0, __pyx_n_s_AppendUInt8ArrayToTensorProto, NULL, __pyx_n_s_tensorflow_python_framework_fast_2, __pyx_d, ((PyObject *)__pyx_codeobj__14)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 73, __pyx_L1_error) |
8370 | __Pyx_GOTREF(__pyx_t_3); |
8371 | if (PyDict_SetItem(__pyx_d, __pyx_n_s_AppendUInt8ArrayToTensorProto, __pyx_t_3) < 0) __PYX_ERR(0, 73, __pyx_L1_error) |
8372 | __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
8373 | |
8374 | /* "tensorflow/python/framework/fast_tensor_util.pyx":81 |
8375 | * |
8376 | * |
8377 | * def AppendUInt16ArrayToTensorProto( # <<<<<<<<<<<<<< |
8378 | * tensor_proto, np.ndarray[np.uint16_t, ndim=1] nparray): |
8379 | * cdef long i, n |
8380 | */ |
8381 | __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_10tensorflow_6python_9framework_16fast_tensor_util_19AppendUInt16ArrayToTensorProto, 0, __pyx_n_s_AppendUInt16ArrayToTensorProto, NULL, __pyx_n_s_tensorflow_python_framework_fast_2, __pyx_d, ((PyObject *)__pyx_codeobj__15)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 81, __pyx_L1_error) |
8382 | __Pyx_GOTREF(__pyx_t_3); |
8383 | if (PyDict_SetItem(__pyx_d, __pyx_n_s_AppendUInt16ArrayToTensorProto, __pyx_t_3) < 0) __PYX_ERR(0, 81, __pyx_L1_error) |
8384 | __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
8385 | |
8386 | /* "tensorflow/python/framework/fast_tensor_util.pyx":89 |
8387 | * |
8388 | * |
8389 | * def AppendInt16ArrayToTensorProto( # <<<<<<<<<<<<<< |
8390 | * tensor_proto, np.ndarray[np.int16_t, ndim=1] nparray): |
8391 | * cdef long i, n |
8392 | */ |
8393 | __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_10tensorflow_6python_9framework_16fast_tensor_util_21AppendInt16ArrayToTensorProto, 0, __pyx_n_s_AppendInt16ArrayToTensorProto, NULL, __pyx_n_s_tensorflow_python_framework_fast_2, __pyx_d, ((PyObject *)__pyx_codeobj__16)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 89, __pyx_L1_error) |
8394 | __Pyx_GOTREF(__pyx_t_3); |
8395 | if (PyDict_SetItem(__pyx_d, __pyx_n_s_AppendInt16ArrayToTensorProto, __pyx_t_3) < 0) __PYX_ERR(0, 89, __pyx_L1_error) |
8396 | __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
8397 | |
8398 | /* "tensorflow/python/framework/fast_tensor_util.pyx":97 |
8399 | * |
8400 | * |
8401 | * def AppendInt8ArrayToTensorProto( # <<<<<<<<<<<<<< |
8402 | * tensor_proto, np.ndarray[np.int8_t, ndim=1] nparray): |
8403 | * cdef long i, n |
8404 | */ |
8405 | __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_10tensorflow_6python_9framework_16fast_tensor_util_23AppendInt8ArrayToTensorProto, 0, __pyx_n_s_AppendInt8ArrayToTensorProto, NULL, __pyx_n_s_tensorflow_python_framework_fast_2, __pyx_d, ((PyObject *)__pyx_codeobj__17)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 97, __pyx_L1_error) |
8406 | __Pyx_GOTREF(__pyx_t_3); |
8407 | if (PyDict_SetItem(__pyx_d, __pyx_n_s_AppendInt8ArrayToTensorProto, __pyx_t_3) < 0) __PYX_ERR(0, 97, __pyx_L1_error) |
8408 | __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
8409 | |
8410 | /* "tensorflow/python/framework/fast_tensor_util.pyx":105 |
8411 | * |
8412 | * |
8413 | * def AppendComplex64ArrayToTensorProto( # <<<<<<<<<<<<<< |
8414 | * tensor_proto, np.ndarray[np.complex64_t, ndim=1] nparray): |
8415 | * cdef long i, n |
8416 | */ |
8417 | __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_10tensorflow_6python_9framework_16fast_tensor_util_25AppendComplex64ArrayToTensorProto, 0, __pyx_n_s_AppendComplex64ArrayToTensorProt, NULL, __pyx_n_s_tensorflow_python_framework_fast_2, __pyx_d, ((PyObject *)__pyx_codeobj__18)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 105, __pyx_L1_error) |
8418 | __Pyx_GOTREF(__pyx_t_3); |
8419 | if (PyDict_SetItem(__pyx_d, __pyx_n_s_AppendComplex64ArrayToTensorProt, __pyx_t_3) < 0) __PYX_ERR(0, 105, __pyx_L1_error) |
8420 | __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
8421 | |
8422 | /* "tensorflow/python/framework/fast_tensor_util.pyx":114 |
8423 | * |
8424 | * |
8425 | * def AppendComplex128ArrayToTensorProto( # <<<<<<<<<<<<<< |
8426 | * tensor_proto, np.ndarray[np.complex128_t, ndim=1] nparray): |
8427 | * cdef long i, n |
8428 | */ |
8429 | __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_10tensorflow_6python_9framework_16fast_tensor_util_27AppendComplex128ArrayToTensorProto, 0, __pyx_n_s_AppendComplex128ArrayToTensorPro, NULL, __pyx_n_s_tensorflow_python_framework_fast_2, __pyx_d, ((PyObject *)__pyx_codeobj__19)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 114, __pyx_L1_error) |
8430 | __Pyx_GOTREF(__pyx_t_3); |
8431 | if (PyDict_SetItem(__pyx_d, __pyx_n_s_AppendComplex128ArrayToTensorPro, __pyx_t_3) < 0) __PYX_ERR(0, 114, __pyx_L1_error) |
8432 | __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
8433 | |
8434 | /* "tensorflow/python/framework/fast_tensor_util.pyx":123 |
8435 | * |
8436 | * |
8437 | * def AppendObjectArrayToTensorProto(tensor_proto, np.ndarray nparray): # <<<<<<<<<<<<<< |
8438 | * cdef long i, n |
8439 | * n = nparray.size |
8440 | */ |
8441 | __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_10tensorflow_6python_9framework_16fast_tensor_util_29AppendObjectArrayToTensorProto, 0, __pyx_n_s_AppendObjectArrayToTensorProto, NULL, __pyx_n_s_tensorflow_python_framework_fast_2, __pyx_d, ((PyObject *)__pyx_codeobj__20)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 123, __pyx_L1_error) |
8442 | __Pyx_GOTREF(__pyx_t_3); |
8443 | if (PyDict_SetItem(__pyx_d, __pyx_n_s_AppendObjectArrayToTensorProto, __pyx_t_3) < 0) __PYX_ERR(0, 123, __pyx_L1_error) |
8444 | __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
8445 | |
8446 | /* "tensorflow/python/framework/fast_tensor_util.pyx":130 |
8447 | * |
8448 | * |
8449 | * def AppendBoolArrayToTensorProto(tensor_proto, nparray): # <<<<<<<<<<<<<< |
8450 | * cdef long i, n |
8451 | * n = nparray.size |
8452 | */ |
8453 | __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_10tensorflow_6python_9framework_16fast_tensor_util_31AppendBoolArrayToTensorProto, 0, __pyx_n_s_AppendBoolArrayToTensorProto, NULL, __pyx_n_s_tensorflow_python_framework_fast_2, __pyx_d, ((PyObject *)__pyx_codeobj__21)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 130, __pyx_L1_error) |
8454 | __Pyx_GOTREF(__pyx_t_3); |
8455 | if (PyDict_SetItem(__pyx_d, __pyx_n_s_AppendBoolArrayToTensorProto, __pyx_t_3) < 0) __PYX_ERR(0, 130, __pyx_L1_error) |
8456 | __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
8457 | |
8458 | /* "tensorflow/python/framework/fast_tensor_util.pyx":1 |
8459 | * #cython: boundscheck=False # <<<<<<<<<<<<<< |
8460 | * #cython: wraparound=False |
8461 | * #cython: infer_types=True |
8462 | */ |
8463 | __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1, __pyx_L1_error) |
8464 | __Pyx_GOTREF(__pyx_t_3); |
8465 | if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_3) < 0) __PYX_ERR(0, 1, __pyx_L1_error) |
8466 | __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
8467 | |
8468 | /* "../../../../../../../tmp/venv-3.10/lib/python3.10/site-packages/numpy/__init__.cython-30.pxd":1048 |
8469 | * |
8470 | * |
8471 | * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<< |
8472 | * """ |
8473 | * returns the unit part of the dtype for a numpy datetime64 object. |
8474 | */ |
8475 | |
8476 | /*--- Wrapped vars code ---*/ |
8477 | |
8478 | goto __pyx_L0; |
8479 | __pyx_L1_error:; |
8480 | __Pyx_XDECREF(__pyx_t_2); |
8481 | __Pyx_XDECREF(__pyx_t_3); |
8482 | if (__pyx_m) { |
8483 | if (__pyx_d && stringtab_initialized) { |
8484 | __Pyx_AddTraceback("init tensorflow.python.framework.fast_tensor_util" , __pyx_clineno, __pyx_lineno, __pyx_filename); |
8485 | } |
8486 | #if !CYTHON_USE_MODULE_STATE |
8487 | Py_CLEAR(__pyx_m); |
8488 | #endif |
8489 | } else if (!PyErr_Occurred()) { |
8490 | PyErr_SetString(PyExc_ImportError, "init tensorflow.python.framework.fast_tensor_util" ); |
8491 | } |
8492 | __pyx_L0:; |
8493 | __Pyx_RefNannyFinishContext(); |
8494 | #if CYTHON_PEP489_MULTI_PHASE_INIT |
8495 | return (__pyx_m != NULL) ? 0 : -1; |
8496 | #elif PY_MAJOR_VERSION >= 3 |
8497 | return __pyx_m; |
8498 | #else |
8499 | return; |
8500 | #endif |
8501 | } |
8502 | /* #### Code section: cleanup_globals ### */ |
8503 | /* #### Code section: cleanup_module ### */ |
8504 | /* #### Code section: main_method ### */ |
8505 | /* #### Code section: utility_code_pragmas ### */ |
8506 | #if _MSC_VER |
8507 | #pragma warning( push ) |
8508 | /* Warning 4127: conditional expression is constant |
8509 | * Cython uses constant conditional expressions to allow in inline functions to be optimized at |
8510 | * compile-time, so this warning is not useful |
8511 | */ |
8512 | #pragma warning( disable : 4127 ) |
8513 | #endif |
8514 | |
8515 | |
8516 | |
8517 | /* #### Code section: utility_code_def ### */ |
8518 | |
8519 | /* --- Runtime support code --- */ |
8520 | /* Refnanny */ |
8521 | #if CYTHON_REFNANNY |
8522 | static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { |
8523 | PyObject *m = NULL, *p = NULL; |
8524 | void *r = NULL; |
8525 | m = PyImport_ImportModule(modname); |
8526 | if (!m) goto end; |
8527 | p = PyObject_GetAttrString(m, "RefNannyAPI" ); |
8528 | if (!p) goto end; |
8529 | r = PyLong_AsVoidPtr(p); |
8530 | end: |
8531 | Py_XDECREF(p); |
8532 | Py_XDECREF(m); |
8533 | return (__Pyx_RefNannyAPIStruct *)r; |
8534 | } |
8535 | #endif |
8536 | |
8537 | /* PyErrExceptionMatches */ |
8538 | #if CYTHON_FAST_THREAD_STATE |
8539 | static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { |
8540 | Py_ssize_t i, n; |
8541 | n = PyTuple_GET_SIZE(tuple); |
8542 | #if PY_MAJOR_VERSION >= 3 |
8543 | for (i=0; i<n; i++) { |
8544 | if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1; |
8545 | } |
8546 | #endif |
8547 | for (i=0; i<n; i++) { |
8548 | if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1; |
8549 | } |
8550 | return 0; |
8551 | } |
8552 | static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) { |
8553 | PyObject *exc_type = tstate->curexc_type; |
8554 | if (exc_type == err) return 1; |
8555 | if (unlikely(!exc_type)) return 0; |
8556 | if (unlikely(PyTuple_Check(err))) |
8557 | return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); |
8558 | return __Pyx_PyErr_GivenExceptionMatches(exc_type, err); |
8559 | } |
8560 | #endif |
8561 | |
8562 | /* PyErrFetchRestore */ |
8563 | #if CYTHON_FAST_THREAD_STATE |
8564 | static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { |
8565 | PyObject *tmp_type, *tmp_value, *tmp_tb; |
8566 | tmp_type = tstate->curexc_type; |
8567 | tmp_value = tstate->curexc_value; |
8568 | tmp_tb = tstate->curexc_traceback; |
8569 | tstate->curexc_type = type; |
8570 | tstate->curexc_value = value; |
8571 | tstate->curexc_traceback = tb; |
8572 | Py_XDECREF(tmp_type); |
8573 | Py_XDECREF(tmp_value); |
8574 | Py_XDECREF(tmp_tb); |
8575 | } |
8576 | static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { |
8577 | *type = tstate->curexc_type; |
8578 | *value = tstate->curexc_value; |
8579 | *tb = tstate->curexc_traceback; |
8580 | tstate->curexc_type = 0; |
8581 | tstate->curexc_value = 0; |
8582 | tstate->curexc_traceback = 0; |
8583 | } |
8584 | #endif |
8585 | |
8586 | /* PyObjectGetAttrStr */ |
8587 | #if CYTHON_USE_TYPE_SLOTS |
8588 | static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { |
8589 | PyTypeObject* tp = Py_TYPE(obj); |
8590 | if (likely(tp->tp_getattro)) |
8591 | return tp->tp_getattro(obj, attr_name); |
8592 | #if PY_MAJOR_VERSION < 3 |
8593 | if (likely(tp->tp_getattr)) |
8594 | return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); |
8595 | #endif |
8596 | return PyObject_GetAttr(obj, attr_name); |
8597 | } |
8598 | #endif |
8599 | |
8600 | /* PyObjectGetAttrStrNoError */ |
8601 | static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { |
8602 | __Pyx_PyThreadState_declare |
8603 | __Pyx_PyThreadState_assign |
8604 | if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) |
8605 | __Pyx_PyErr_Clear(); |
8606 | } |
8607 | static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { |
8608 | PyObject *result; |
8609 | #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1 |
8610 | PyTypeObject* tp = Py_TYPE(obj); |
8611 | if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { |
8612 | return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); |
8613 | } |
8614 | #endif |
8615 | result = __Pyx_PyObject_GetAttrStr(obj, attr_name); |
8616 | if (unlikely(!result)) { |
8617 | __Pyx_PyObject_GetAttrStr_ClearAttributeError(); |
8618 | } |
8619 | return result; |
8620 | } |
8621 | |
8622 | /* GetBuiltinName */ |
8623 | static PyObject *__Pyx_GetBuiltinName(PyObject *name) { |
8624 | PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_b, name); |
8625 | if (unlikely(!result) && !PyErr_Occurred()) { |
8626 | PyErr_Format(PyExc_NameError, |
8627 | #if PY_MAJOR_VERSION >= 3 |
8628 | "name '%U' is not defined" , name); |
8629 | #else |
8630 | "name '%.200s' is not defined" , PyString_AS_STRING(name)); |
8631 | #endif |
8632 | } |
8633 | return result; |
8634 | } |
8635 | |
8636 | /* TupleAndListFromArray */ |
8637 | #if CYTHON_COMPILING_IN_CPYTHON |
8638 | static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) { |
8639 | PyObject *v; |
8640 | Py_ssize_t i; |
8641 | for (i = 0; i < length; i++) { |
8642 | v = dest[i] = src[i]; |
8643 | Py_INCREF(v); |
8644 | } |
8645 | } |
8646 | static CYTHON_INLINE PyObject * |
8647 | __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n) |
8648 | { |
8649 | PyObject *res; |
8650 | if (n <= 0) { |
8651 | Py_INCREF(__pyx_empty_tuple); |
8652 | return __pyx_empty_tuple; |
8653 | } |
8654 | res = PyTuple_New(n); |
8655 | if (unlikely(res == NULL)) return NULL; |
8656 | __Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n); |
8657 | return res; |
8658 | } |
8659 | static CYTHON_INLINE PyObject * |
8660 | __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n) |
8661 | { |
8662 | PyObject *res; |
8663 | if (n <= 0) { |
8664 | return PyList_New(0); |
8665 | } |
8666 | res = PyList_New(n); |
8667 | if (unlikely(res == NULL)) return NULL; |
8668 | __Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n); |
8669 | return res; |
8670 | } |
8671 | #endif |
8672 | |
8673 | /* BytesEquals */ |
8674 | static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { |
8675 | #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API |
8676 | return PyObject_RichCompareBool(s1, s2, equals); |
8677 | #else |
8678 | if (s1 == s2) { |
8679 | return (equals == Py_EQ); |
8680 | } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { |
8681 | const char *ps1, *ps2; |
8682 | Py_ssize_t length = PyBytes_GET_SIZE(s1); |
8683 | if (length != PyBytes_GET_SIZE(s2)) |
8684 | return (equals == Py_NE); |
8685 | ps1 = PyBytes_AS_STRING(s1); |
8686 | ps2 = PyBytes_AS_STRING(s2); |
8687 | if (ps1[0] != ps2[0]) { |
8688 | return (equals == Py_NE); |
8689 | } else if (length == 1) { |
8690 | return (equals == Py_EQ); |
8691 | } else { |
8692 | int result; |
8693 | #if CYTHON_USE_UNICODE_INTERNALS |
8694 | Py_hash_t hash1, hash2; |
8695 | hash1 = ((PyBytesObject*)s1)->ob_shash; |
8696 | hash2 = ((PyBytesObject*)s2)->ob_shash; |
8697 | if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { |
8698 | return (equals == Py_NE); |
8699 | } |
8700 | #endif |
8701 | result = memcmp(ps1, ps2, (size_t)length); |
8702 | return (equals == Py_EQ) ? (result == 0) : (result != 0); |
8703 | } |
8704 | } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { |
8705 | return (equals == Py_NE); |
8706 | } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { |
8707 | return (equals == Py_NE); |
8708 | } else { |
8709 | int result; |
8710 | PyObject* py_result = PyObject_RichCompare(s1, s2, equals); |
8711 | if (!py_result) |
8712 | return -1; |
8713 | result = __Pyx_PyObject_IsTrue(py_result); |
8714 | Py_DECREF(py_result); |
8715 | return result; |
8716 | } |
8717 | #endif |
8718 | } |
8719 | |
8720 | /* UnicodeEquals */ |
8721 | static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { |
8722 | #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API |
8723 | return PyObject_RichCompareBool(s1, s2, equals); |
8724 | #else |
8725 | #if PY_MAJOR_VERSION < 3 |
8726 | PyObject* owned_ref = NULL; |
8727 | #endif |
8728 | int s1_is_unicode, s2_is_unicode; |
8729 | if (s1 == s2) { |
8730 | goto return_eq; |
8731 | } |
8732 | s1_is_unicode = PyUnicode_CheckExact(s1); |
8733 | s2_is_unicode = PyUnicode_CheckExact(s2); |
8734 | #if PY_MAJOR_VERSION < 3 |
8735 | if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) { |
8736 | owned_ref = PyUnicode_FromObject(s2); |
8737 | if (unlikely(!owned_ref)) |
8738 | return -1; |
8739 | s2 = owned_ref; |
8740 | s2_is_unicode = 1; |
8741 | } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) { |
8742 | owned_ref = PyUnicode_FromObject(s1); |
8743 | if (unlikely(!owned_ref)) |
8744 | return -1; |
8745 | s1 = owned_ref; |
8746 | s1_is_unicode = 1; |
8747 | } else if (((!s2_is_unicode) & (!s1_is_unicode))) { |
8748 | return __Pyx_PyBytes_Equals(s1, s2, equals); |
8749 | } |
8750 | #endif |
8751 | if (s1_is_unicode & s2_is_unicode) { |
8752 | Py_ssize_t length; |
8753 | int kind; |
8754 | void *data1, *data2; |
8755 | if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) |
8756 | return -1; |
8757 | length = __Pyx_PyUnicode_GET_LENGTH(s1); |
8758 | if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) { |
8759 | goto return_ne; |
8760 | } |
8761 | #if CYTHON_USE_UNICODE_INTERNALS |
8762 | { |
8763 | Py_hash_t hash1, hash2; |
8764 | #if CYTHON_PEP393_ENABLED |
8765 | hash1 = ((PyASCIIObject*)s1)->hash; |
8766 | hash2 = ((PyASCIIObject*)s2)->hash; |
8767 | #else |
8768 | hash1 = ((PyUnicodeObject*)s1)->hash; |
8769 | hash2 = ((PyUnicodeObject*)s2)->hash; |
8770 | #endif |
8771 | if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { |
8772 | goto return_ne; |
8773 | } |
8774 | } |
8775 | #endif |
8776 | kind = __Pyx_PyUnicode_KIND(s1); |
8777 | if (kind != __Pyx_PyUnicode_KIND(s2)) { |
8778 | goto return_ne; |
8779 | } |
8780 | data1 = __Pyx_PyUnicode_DATA(s1); |
8781 | data2 = __Pyx_PyUnicode_DATA(s2); |
8782 | if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { |
8783 | goto return_ne; |
8784 | } else if (length == 1) { |
8785 | goto return_eq; |
8786 | } else { |
8787 | int result = memcmp(data1, data2, (size_t)(length * kind)); |
8788 | #if PY_MAJOR_VERSION < 3 |
8789 | Py_XDECREF(owned_ref); |
8790 | #endif |
8791 | return (equals == Py_EQ) ? (result == 0) : (result != 0); |
8792 | } |
8793 | } else if ((s1 == Py_None) & s2_is_unicode) { |
8794 | goto return_ne; |
8795 | } else if ((s2 == Py_None) & s1_is_unicode) { |
8796 | goto return_ne; |
8797 | } else { |
8798 | int result; |
8799 | PyObject* py_result = PyObject_RichCompare(s1, s2, equals); |
8800 | #if PY_MAJOR_VERSION < 3 |
8801 | Py_XDECREF(owned_ref); |
8802 | #endif |
8803 | if (!py_result) |
8804 | return -1; |
8805 | result = __Pyx_PyObject_IsTrue(py_result); |
8806 | Py_DECREF(py_result); |
8807 | return result; |
8808 | } |
8809 | return_eq: |
8810 | #if PY_MAJOR_VERSION < 3 |
8811 | Py_XDECREF(owned_ref); |
8812 | #endif |
8813 | return (equals == Py_EQ); |
8814 | return_ne: |
8815 | #if PY_MAJOR_VERSION < 3 |
8816 | Py_XDECREF(owned_ref); |
8817 | #endif |
8818 | return (equals == Py_NE); |
8819 | #endif |
8820 | } |
8821 | |
8822 | /* fastcall */ |
8823 | #if CYTHON_METH_FASTCALL |
8824 | static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s) |
8825 | { |
8826 | Py_ssize_t i, n = PyTuple_GET_SIZE(kwnames); |
8827 | for (i = 0; i < n; i++) |
8828 | { |
8829 | if (s == PyTuple_GET_ITEM(kwnames, i)) return kwvalues[i]; |
8830 | } |
8831 | for (i = 0; i < n; i++) |
8832 | { |
8833 | int eq = __Pyx_PyUnicode_Equals(s, PyTuple_GET_ITEM(kwnames, i), Py_EQ); |
8834 | if (unlikely(eq != 0)) { |
8835 | if (unlikely(eq < 0)) return NULL; // error |
8836 | return kwvalues[i]; |
8837 | } |
8838 | } |
8839 | return NULL; // not found (no exception set) |
8840 | } |
8841 | #endif |
8842 | |
8843 | /* RaiseArgTupleInvalid */ |
8844 | static void __Pyx_RaiseArgtupleInvalid( |
8845 | const char* func_name, |
8846 | int exact, |
8847 | Py_ssize_t num_min, |
8848 | Py_ssize_t num_max, |
8849 | Py_ssize_t num_found) |
8850 | { |
8851 | Py_ssize_t num_expected; |
8852 | const char *more_or_less; |
8853 | if (num_found < num_min) { |
8854 | num_expected = num_min; |
8855 | more_or_less = "at least" ; |
8856 | } else { |
8857 | num_expected = num_max; |
8858 | more_or_less = "at most" ; |
8859 | } |
8860 | if (exact) { |
8861 | more_or_less = "exactly" ; |
8862 | } |
8863 | PyErr_Format(PyExc_TypeError, |
8864 | "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)" , |
8865 | func_name, more_or_less, num_expected, |
8866 | (num_expected == 1) ? "" : "s" , num_found); |
8867 | } |
8868 | |
8869 | /* RaiseDoubleKeywords */ |
8870 | static void __Pyx_RaiseDoubleKeywordsError( |
8871 | const char* func_name, |
8872 | PyObject* kw_name) |
8873 | { |
8874 | PyErr_Format(PyExc_TypeError, |
8875 | #if PY_MAJOR_VERSION >= 3 |
8876 | "%s() got multiple values for keyword argument '%U'" , func_name, kw_name); |
8877 | #else |
8878 | "%s() got multiple values for keyword argument '%s'" , func_name, |
8879 | PyString_AsString(kw_name)); |
8880 | #endif |
8881 | } |
8882 | |
8883 | /* ParseKeywords */ |
8884 | static int __Pyx_ParseOptionalKeywords( |
8885 | PyObject *kwds, |
8886 | PyObject *const *kwvalues, |
8887 | PyObject **argnames[], |
8888 | PyObject *kwds2, |
8889 | PyObject *values[], |
8890 | Py_ssize_t num_pos_args, |
8891 | const char* function_name) |
8892 | { |
8893 | PyObject *key = 0, *value = 0; |
8894 | Py_ssize_t pos = 0; |
8895 | PyObject*** name; |
8896 | PyObject*** first_kw_arg = argnames + num_pos_args; |
8897 | int kwds_is_tuple = CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds)); |
8898 | while (1) { |
8899 | if (kwds_is_tuple) { |
8900 | if (pos >= PyTuple_GET_SIZE(kwds)) break; |
8901 | key = PyTuple_GET_ITEM(kwds, pos); |
8902 | value = kwvalues[pos]; |
8903 | pos++; |
8904 | } |
8905 | else |
8906 | { |
8907 | if (!PyDict_Next(kwds, &pos, &key, &value)) break; |
8908 | } |
8909 | name = first_kw_arg; |
8910 | while (*name && (**name != key)) name++; |
8911 | if (*name) { |
8912 | values[name-argnames] = value; |
8913 | continue; |
8914 | } |
8915 | name = first_kw_arg; |
8916 | #if PY_MAJOR_VERSION < 3 |
8917 | if (likely(PyString_Check(key))) { |
8918 | while (*name) { |
8919 | if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) |
8920 | && _PyString_Eq(**name, key)) { |
8921 | values[name-argnames] = value; |
8922 | break; |
8923 | } |
8924 | name++; |
8925 | } |
8926 | if (*name) continue; |
8927 | else { |
8928 | PyObject*** argname = argnames; |
8929 | while (argname != first_kw_arg) { |
8930 | if ((**argname == key) || ( |
8931 | (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) |
8932 | && _PyString_Eq(**argname, key))) { |
8933 | goto arg_passed_twice; |
8934 | } |
8935 | argname++; |
8936 | } |
8937 | } |
8938 | } else |
8939 | #endif |
8940 | if (likely(PyUnicode_Check(key))) { |
8941 | while (*name) { |
8942 | int cmp = ( |
8943 | #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 |
8944 | (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : |
8945 | #endif |
8946 | PyUnicode_Compare(**name, key) |
8947 | ); |
8948 | if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; |
8949 | if (cmp == 0) { |
8950 | values[name-argnames] = value; |
8951 | break; |
8952 | } |
8953 | name++; |
8954 | } |
8955 | if (*name) continue; |
8956 | else { |
8957 | PyObject*** argname = argnames; |
8958 | while (argname != first_kw_arg) { |
8959 | int cmp = (**argname == key) ? 0 : |
8960 | #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 |
8961 | (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : |
8962 | #endif |
8963 | PyUnicode_Compare(**argname, key); |
8964 | if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; |
8965 | if (cmp == 0) goto arg_passed_twice; |
8966 | argname++; |
8967 | } |
8968 | } |
8969 | } else |
8970 | goto invalid_keyword_type; |
8971 | if (kwds2) { |
8972 | if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; |
8973 | } else { |
8974 | goto invalid_keyword; |
8975 | } |
8976 | } |
8977 | return 0; |
8978 | arg_passed_twice: |
8979 | __Pyx_RaiseDoubleKeywordsError(function_name, key); |
8980 | goto bad; |
8981 | invalid_keyword_type: |
8982 | PyErr_Format(PyExc_TypeError, |
8983 | "%.200s() keywords must be strings" , function_name); |
8984 | goto bad; |
8985 | invalid_keyword: |
8986 | #if PY_MAJOR_VERSION < 3 |
8987 | PyErr_Format(PyExc_TypeError, |
8988 | "%.200s() got an unexpected keyword argument '%.200s'" , |
8989 | function_name, PyString_AsString(key)); |
8990 | #else |
8991 | PyErr_Format(PyExc_TypeError, |
8992 | "%s() got an unexpected keyword argument '%U'" , |
8993 | function_name, key); |
8994 | #endif |
8995 | bad: |
8996 | return -1; |
8997 | } |
8998 | |
8999 | /* ArgTypeTest */ |
9000 | static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) |
9001 | { |
9002 | __Pyx_TypeName type_name; |
9003 | __Pyx_TypeName obj_type_name; |
9004 | if (unlikely(!type)) { |
9005 | PyErr_SetString(PyExc_SystemError, "Missing type object" ); |
9006 | return 0; |
9007 | } |
9008 | else if (exact) { |
9009 | #if PY_MAJOR_VERSION == 2 |
9010 | if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; |
9011 | #endif |
9012 | } |
9013 | else { |
9014 | if (likely(__Pyx_TypeCheck(obj, type))) return 1; |
9015 | } |
9016 | type_name = __Pyx_PyType_GetName(type); |
9017 | obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); |
9018 | PyErr_Format(PyExc_TypeError, |
9019 | "Argument '%.200s' has incorrect type (expected " __Pyx_FMT_TYPENAME |
9020 | ", got " __Pyx_FMT_TYPENAME ")" , name, type_name, obj_type_name); |
9021 | __Pyx_DECREF_TypeName(type_name); |
9022 | __Pyx_DECREF_TypeName(obj_type_name); |
9023 | return 0; |
9024 | } |
9025 | |
9026 | /* IsLittleEndian */ |
9027 | static CYTHON_INLINE int __Pyx_Is_Little_Endian(void) |
9028 | { |
9029 | union { |
9030 | uint32_t u32; |
9031 | uint8_t u8[4]; |
9032 | } S; |
9033 | S.u32 = 0x01020304; |
9034 | return S.u8[0] == 4; |
9035 | } |
9036 | |
9037 | /* BufferFormatCheck */ |
9038 | static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, |
9039 | __Pyx_BufFmt_StackElem* stack, |
9040 | __Pyx_TypeInfo* type) { |
9041 | stack[0].field = &ctx->root; |
9042 | stack[0].parent_offset = 0; |
9043 | ctx->root.type = type; |
9044 | ctx->root.name = "buffer dtype" ; |
9045 | ctx->root.offset = 0; |
9046 | ctx->head = stack; |
9047 | ctx->head->field = &ctx->root; |
9048 | ctx->fmt_offset = 0; |
9049 | ctx->head->parent_offset = 0; |
9050 | ctx->new_packmode = '@'; |
9051 | ctx->enc_packmode = '@'; |
9052 | ctx->new_count = 1; |
9053 | ctx->enc_count = 0; |
9054 | ctx->enc_type = 0; |
9055 | ctx->is_complex = 0; |
9056 | ctx->is_valid_array = 0; |
9057 | ctx->struct_alignment = 0; |
9058 | while (type->typegroup == 'S') { |
9059 | ++ctx->head; |
9060 | ctx->head->field = type->fields; |
9061 | ctx->head->parent_offset = 0; |
9062 | type = type->fields->type; |
9063 | } |
9064 | } |
9065 | static int __Pyx_BufFmt_ParseNumber(const char** ts) { |
9066 | int count; |
9067 | const char* t = *ts; |
9068 | if (*t < '0' || *t > '9') { |
9069 | return -1; |
9070 | } else { |
9071 | count = *t++ - '0'; |
9072 | while (*t >= '0' && *t <= '9') { |
9073 | count *= 10; |
9074 | count += *t++ - '0'; |
9075 | } |
9076 | } |
9077 | *ts = t; |
9078 | return count; |
9079 | } |
9080 | static int __Pyx_BufFmt_ExpectNumber(const char **ts) { |
9081 | int number = __Pyx_BufFmt_ParseNumber(ts); |
9082 | if (number == -1) |
9083 | PyErr_Format(PyExc_ValueError,\ |
9084 | "Does not understand character buffer dtype format string ('%c')" , **ts); |
9085 | return number; |
9086 | } |
9087 | static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) { |
9088 | PyErr_Format(PyExc_ValueError, |
9089 | "Unexpected format string character: '%c'" , ch); |
9090 | } |
9091 | static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { |
9092 | switch (ch) { |
9093 | case '?': return "'bool'" ; |
9094 | case 'c': return "'char'" ; |
9095 | case 'b': return "'signed char'" ; |
9096 | case 'B': return "'unsigned char'" ; |
9097 | case 'h': return "'short'" ; |
9098 | case 'H': return "'unsigned short'" ; |
9099 | case 'i': return "'int'" ; |
9100 | case 'I': return "'unsigned int'" ; |
9101 | case 'l': return "'long'" ; |
9102 | case 'L': return "'unsigned long'" ; |
9103 | case 'q': return "'long long'" ; |
9104 | case 'Q': return "'unsigned long long'" ; |
9105 | case 'f': return (is_complex ? "'complex float'" : "'float'" ); |
9106 | case 'd': return (is_complex ? "'complex double'" : "'double'" ); |
9107 | case 'g': return (is_complex ? "'complex long double'" : "'long double'" ); |
9108 | case 'T': return "a struct" ; |
9109 | case 'O': return "Python object" ; |
9110 | case 'P': return "a pointer" ; |
9111 | case 's': case 'p': return "a string" ; |
9112 | case 0: return "end" ; |
9113 | default: return "unparseable format string" ; |
9114 | } |
9115 | } |
9116 | static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { |
9117 | switch (ch) { |
9118 | case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; |
9119 | case 'h': case 'H': return 2; |
9120 | case 'i': case 'I': case 'l': case 'L': return 4; |
9121 | case 'q': case 'Q': return 8; |
9122 | case 'f': return (is_complex ? 8 : 4); |
9123 | case 'd': return (is_complex ? 16 : 8); |
9124 | case 'g': { |
9125 | PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g').." ); |
9126 | return 0; |
9127 | } |
9128 | case 'O': case 'P': return sizeof(void*); |
9129 | default: |
9130 | __Pyx_BufFmt_RaiseUnexpectedChar(ch); |
9131 | return 0; |
9132 | } |
9133 | } |
9134 | static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) { |
9135 | switch (ch) { |
9136 | case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; |
9137 | case 'h': case 'H': return sizeof(short); |
9138 | case 'i': case 'I': return sizeof(int); |
9139 | case 'l': case 'L': return sizeof(long); |
9140 | #ifdef HAVE_LONG_LONG |
9141 | case 'q': case 'Q': return sizeof(PY_LONG_LONG); |
9142 | #endif |
9143 | case 'f': return sizeof(float) * (is_complex ? 2 : 1); |
9144 | case 'd': return sizeof(double) * (is_complex ? 2 : 1); |
9145 | case 'g': return sizeof(long double) * (is_complex ? 2 : 1); |
9146 | case 'O': case 'P': return sizeof(void*); |
9147 | default: { |
9148 | __Pyx_BufFmt_RaiseUnexpectedChar(ch); |
9149 | return 0; |
9150 | } |
9151 | } |
9152 | } |
9153 | typedef struct { char c; short x; } __Pyx_st_short; |
9154 | typedef struct { char c; int x; } __Pyx_st_int; |
9155 | typedef struct { char c; long x; } __Pyx_st_long; |
9156 | typedef struct { char c; float x; } __Pyx_st_float; |
9157 | typedef struct { char c; double x; } __Pyx_st_double; |
9158 | typedef struct { char c; long double x; } __Pyx_st_longdouble; |
9159 | typedef struct { char c; void *x; } __Pyx_st_void_p; |
9160 | #ifdef HAVE_LONG_LONG |
9161 | typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong; |
9162 | #endif |
9163 | static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, int is_complex) { |
9164 | CYTHON_UNUSED_VAR(is_complex); |
9165 | switch (ch) { |
9166 | case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; |
9167 | case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short); |
9168 | case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int); |
9169 | case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long); |
9170 | #ifdef HAVE_LONG_LONG |
9171 | case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG); |
9172 | #endif |
9173 | case 'f': return sizeof(__Pyx_st_float) - sizeof(float); |
9174 | case 'd': return sizeof(__Pyx_st_double) - sizeof(double); |
9175 | case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double); |
9176 | case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*); |
9177 | default: |
9178 | __Pyx_BufFmt_RaiseUnexpectedChar(ch); |
9179 | return 0; |
9180 | } |
9181 | } |
9182 | /* These are for computing the padding at the end of the struct to align |
9183 | on the first member of the struct. This will probably the same as above, |
9184 | but we don't have any guarantees. |
9185 | */ |
9186 | typedef struct { short x; char c; } __Pyx_pad_short; |
9187 | typedef struct { int x; char c; } __Pyx_pad_int; |
9188 | typedef struct { long x; char c; } __Pyx_pad_long; |
9189 | typedef struct { float x; char c; } __Pyx_pad_float; |
9190 | typedef struct { double x; char c; } __Pyx_pad_double; |
9191 | typedef struct { long double x; char c; } __Pyx_pad_longdouble; |
9192 | typedef struct { void *x; char c; } __Pyx_pad_void_p; |
9193 | #ifdef HAVE_LONG_LONG |
9194 | typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong; |
9195 | #endif |
9196 | static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, int is_complex) { |
9197 | CYTHON_UNUSED_VAR(is_complex); |
9198 | switch (ch) { |
9199 | case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; |
9200 | case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short); |
9201 | case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int); |
9202 | case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long); |
9203 | #ifdef HAVE_LONG_LONG |
9204 | case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG); |
9205 | #endif |
9206 | case 'f': return sizeof(__Pyx_pad_float) - sizeof(float); |
9207 | case 'd': return sizeof(__Pyx_pad_double) - sizeof(double); |
9208 | case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double); |
9209 | case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*); |
9210 | default: |
9211 | __Pyx_BufFmt_RaiseUnexpectedChar(ch); |
9212 | return 0; |
9213 | } |
9214 | } |
9215 | static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) { |
9216 | switch (ch) { |
9217 | case 'c': |
9218 | return 'H'; |
9219 | case 'b': case 'h': case 'i': |
9220 | case 'l': case 'q': case 's': case 'p': |
9221 | return 'I'; |
9222 | case '?': case 'B': case 'H': case 'I': case 'L': case 'Q': |
9223 | return 'U'; |
9224 | case 'f': case 'd': case 'g': |
9225 | return (is_complex ? 'C' : 'R'); |
9226 | case 'O': |
9227 | return 'O'; |
9228 | case 'P': |
9229 | return 'P'; |
9230 | default: { |
9231 | __Pyx_BufFmt_RaiseUnexpectedChar(ch); |
9232 | return 0; |
9233 | } |
9234 | } |
9235 | } |
9236 | static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) { |
9237 | if (ctx->head == NULL || ctx->head->field == &ctx->root) { |
9238 | const char* expected; |
9239 | const char* quote; |
9240 | if (ctx->head == NULL) { |
9241 | expected = "end" ; |
9242 | quote = "" ; |
9243 | } else { |
9244 | expected = ctx->head->field->type->name; |
9245 | quote = "'" ; |
9246 | } |
9247 | PyErr_Format(PyExc_ValueError, |
9248 | "Buffer dtype mismatch, expected %s%s%s but got %s" , |
9249 | quote, expected, quote, |
9250 | __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex)); |
9251 | } else { |
9252 | __Pyx_StructField* field = ctx->head->field; |
9253 | __Pyx_StructField* parent = (ctx->head - 1)->field; |
9254 | PyErr_Format(PyExc_ValueError, |
9255 | "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'" , |
9256 | field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex), |
9257 | parent->type->name, field->name); |
9258 | } |
9259 | } |
9260 | static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { |
9261 | char group; |
9262 | size_t size, offset, arraysize = 1; |
9263 | if (ctx->enc_type == 0) return 0; |
9264 | if (ctx->head->field->type->arraysize[0]) { |
9265 | int i, ndim = 0; |
9266 | if (ctx->enc_type == 's' || ctx->enc_type == 'p') { |
9267 | ctx->is_valid_array = ctx->head->field->type->ndim == 1; |
9268 | ndim = 1; |
9269 | if (ctx->enc_count != ctx->head->field->type->arraysize[0]) { |
9270 | PyErr_Format(PyExc_ValueError, |
9271 | "Expected a dimension of size %zu, got %zu" , |
9272 | ctx->head->field->type->arraysize[0], ctx->enc_count); |
9273 | return -1; |
9274 | } |
9275 | } |
9276 | if (!ctx->is_valid_array) { |
9277 | PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d" , |
9278 | ctx->head->field->type->ndim, ndim); |
9279 | return -1; |
9280 | } |
9281 | for (i = 0; i < ctx->head->field->type->ndim; i++) { |
9282 | arraysize *= ctx->head->field->type->arraysize[i]; |
9283 | } |
9284 | ctx->is_valid_array = 0; |
9285 | ctx->enc_count = 1; |
9286 | } |
9287 | group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex); |
9288 | do { |
9289 | __Pyx_StructField* field = ctx->head->field; |
9290 | __Pyx_TypeInfo* type = field->type; |
9291 | if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') { |
9292 | size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex); |
9293 | } else { |
9294 | size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex); |
9295 | } |
9296 | if (ctx->enc_packmode == '@') { |
9297 | size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex); |
9298 | size_t align_mod_offset; |
9299 | if (align_at == 0) return -1; |
9300 | align_mod_offset = ctx->fmt_offset % align_at; |
9301 | if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset; |
9302 | if (ctx->struct_alignment == 0) |
9303 | ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type, |
9304 | ctx->is_complex); |
9305 | } |
9306 | if (type->size != size || type->typegroup != group) { |
9307 | if (type->typegroup == 'C' && type->fields != NULL) { |
9308 | size_t parent_offset = ctx->head->parent_offset + field->offset; |
9309 | ++ctx->head; |
9310 | ctx->head->field = type->fields; |
9311 | ctx->head->parent_offset = parent_offset; |
9312 | continue; |
9313 | } |
9314 | if ((type->typegroup == 'H' || group == 'H') && type->size == size) { |
9315 | } else { |
9316 | __Pyx_BufFmt_RaiseExpected(ctx); |
9317 | return -1; |
9318 | } |
9319 | } |
9320 | offset = ctx->head->parent_offset + field->offset; |
9321 | if (ctx->fmt_offset != offset) { |
9322 | PyErr_Format(PyExc_ValueError, |
9323 | "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected" , |
9324 | (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset); |
9325 | return -1; |
9326 | } |
9327 | ctx->fmt_offset += size; |
9328 | if (arraysize) |
9329 | ctx->fmt_offset += (arraysize - 1) * size; |
9330 | --ctx->enc_count; |
9331 | while (1) { |
9332 | if (field == &ctx->root) { |
9333 | ctx->head = NULL; |
9334 | if (ctx->enc_count != 0) { |
9335 | __Pyx_BufFmt_RaiseExpected(ctx); |
9336 | return -1; |
9337 | } |
9338 | break; |
9339 | } |
9340 | ctx->head->field = ++field; |
9341 | if (field->type == NULL) { |
9342 | --ctx->head; |
9343 | field = ctx->head->field; |
9344 | continue; |
9345 | } else if (field->type->typegroup == 'S') { |
9346 | size_t parent_offset = ctx->head->parent_offset + field->offset; |
9347 | if (field->type->fields->type == NULL) continue; |
9348 | field = field->type->fields; |
9349 | ++ctx->head; |
9350 | ctx->head->field = field; |
9351 | ctx->head->parent_offset = parent_offset; |
9352 | break; |
9353 | } else { |
9354 | break; |
9355 | } |
9356 | } |
9357 | } while (ctx->enc_count); |
9358 | ctx->enc_type = 0; |
9359 | ctx->is_complex = 0; |
9360 | return 0; |
9361 | } |
9362 | static PyObject * |
9363 | __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp) |
9364 | { |
9365 | const char *ts = *tsp; |
9366 | int i = 0, number, ndim; |
9367 | ++ts; |
9368 | if (ctx->new_count != 1) { |
9369 | PyErr_SetString(PyExc_ValueError, |
9370 | "Cannot handle repeated arrays in format string" ); |
9371 | return NULL; |
9372 | } |
9373 | if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; |
9374 | ndim = ctx->head->field->type->ndim; |
9375 | while (*ts && *ts != ')') { |
9376 | switch (*ts) { |
9377 | case ' ': case '\f': case '\r': case '\n': case '\t': case '\v': continue; |
9378 | default: break; |
9379 | } |
9380 | number = __Pyx_BufFmt_ExpectNumber(&ts); |
9381 | if (number == -1) return NULL; |
9382 | if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i]) |
9383 | return PyErr_Format(PyExc_ValueError, |
9384 | "Expected a dimension of size %zu, got %d" , |
9385 | ctx->head->field->type->arraysize[i], number); |
9386 | if (*ts != ',' && *ts != ')') |
9387 | return PyErr_Format(PyExc_ValueError, |
9388 | "Expected a comma in format string, got '%c'" , *ts); |
9389 | if (*ts == ',') ts++; |
9390 | i++; |
9391 | } |
9392 | if (i != ndim) |
9393 | return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d" , |
9394 | ctx->head->field->type->ndim, i); |
9395 | if (!*ts) { |
9396 | PyErr_SetString(PyExc_ValueError, |
9397 | "Unexpected end of format string, expected ')'" ); |
9398 | return NULL; |
9399 | } |
9400 | ctx->is_valid_array = 1; |
9401 | ctx->new_count = 1; |
9402 | *tsp = ++ts; |
9403 | return Py_None; |
9404 | } |
9405 | static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) { |
9406 | int got_Z = 0; |
9407 | while (1) { |
9408 | switch(*ts) { |
9409 | case 0: |
9410 | if (ctx->enc_type != 0 && ctx->head == NULL) { |
9411 | __Pyx_BufFmt_RaiseExpected(ctx); |
9412 | return NULL; |
9413 | } |
9414 | if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; |
9415 | if (ctx->head != NULL) { |
9416 | __Pyx_BufFmt_RaiseExpected(ctx); |
9417 | return NULL; |
9418 | } |
9419 | return ts; |
9420 | case ' ': |
9421 | case '\r': |
9422 | case '\n': |
9423 | ++ts; |
9424 | break; |
9425 | case '<': |
9426 | if (!__Pyx_Is_Little_Endian()) { |
9427 | PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler" ); |
9428 | return NULL; |
9429 | } |
9430 | ctx->new_packmode = '='; |
9431 | ++ts; |
9432 | break; |
9433 | case '>': |
9434 | case '!': |
9435 | if (__Pyx_Is_Little_Endian()) { |
9436 | PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler" ); |
9437 | return NULL; |
9438 | } |
9439 | ctx->new_packmode = '='; |
9440 | ++ts; |
9441 | break; |
9442 | case '=': |
9443 | case '@': |
9444 | case '^': |
9445 | ctx->new_packmode = *ts++; |
9446 | break; |
9447 | case 'T': |
9448 | { |
9449 | const char* ts_after_sub; |
9450 | size_t i, struct_count = ctx->new_count; |
9451 | size_t struct_alignment = ctx->struct_alignment; |
9452 | ctx->new_count = 1; |
9453 | ++ts; |
9454 | if (*ts != '{') { |
9455 | PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'" ); |
9456 | return NULL; |
9457 | } |
9458 | if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; |
9459 | ctx->enc_type = 0; |
9460 | ctx->enc_count = 0; |
9461 | ctx->struct_alignment = 0; |
9462 | ++ts; |
9463 | ts_after_sub = ts; |
9464 | for (i = 0; i != struct_count; ++i) { |
9465 | ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts); |
9466 | if (!ts_after_sub) return NULL; |
9467 | } |
9468 | ts = ts_after_sub; |
9469 | if (struct_alignment) ctx->struct_alignment = struct_alignment; |
9470 | } |
9471 | break; |
9472 | case '}': |
9473 | { |
9474 | size_t alignment = ctx->struct_alignment; |
9475 | ++ts; |
9476 | if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; |
9477 | ctx->enc_type = 0; |
9478 | if (alignment && ctx->fmt_offset % alignment) { |
9479 | ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment); |
9480 | } |
9481 | } |
9482 | return ts; |
9483 | case 'x': |
9484 | if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; |
9485 | ctx->fmt_offset += ctx->new_count; |
9486 | ctx->new_count = 1; |
9487 | ctx->enc_count = 0; |
9488 | ctx->enc_type = 0; |
9489 | ctx->enc_packmode = ctx->new_packmode; |
9490 | ++ts; |
9491 | break; |
9492 | case 'Z': |
9493 | got_Z = 1; |
9494 | ++ts; |
9495 | if (*ts != 'f' && *ts != 'd' && *ts != 'g') { |
9496 | __Pyx_BufFmt_RaiseUnexpectedChar('Z'); |
9497 | return NULL; |
9498 | } |
9499 | CYTHON_FALLTHROUGH; |
9500 | case '?': case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I': |
9501 | case 'l': case 'L': case 'q': case 'Q': |
9502 | case 'f': case 'd': case 'g': |
9503 | case 'O': case 'p': |
9504 | if ((ctx->enc_type == *ts) && (got_Z == ctx->is_complex) && |
9505 | (ctx->enc_packmode == ctx->new_packmode) && (!ctx->is_valid_array)) { |
9506 | ctx->enc_count += ctx->new_count; |
9507 | ctx->new_count = 1; |
9508 | got_Z = 0; |
9509 | ++ts; |
9510 | break; |
9511 | } |
9512 | CYTHON_FALLTHROUGH; |
9513 | case 's': |
9514 | if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; |
9515 | ctx->enc_count = ctx->new_count; |
9516 | ctx->enc_packmode = ctx->new_packmode; |
9517 | ctx->enc_type = *ts; |
9518 | ctx->is_complex = got_Z; |
9519 | ++ts; |
9520 | ctx->new_count = 1; |
9521 | got_Z = 0; |
9522 | break; |
9523 | case ':': |
9524 | ++ts; |
9525 | while(*ts != ':') ++ts; |
9526 | ++ts; |
9527 | break; |
9528 | case '(': |
9529 | if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL; |
9530 | break; |
9531 | default: |
9532 | { |
9533 | int number = __Pyx_BufFmt_ExpectNumber(&ts); |
9534 | if (number == -1) return NULL; |
9535 | ctx->new_count = (size_t)number; |
9536 | } |
9537 | } |
9538 | } |
9539 | } |
9540 | |
9541 | /* BufferGetAndValidate */ |
9542 | static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { |
9543 | if (unlikely(info->buf == NULL)) return; |
9544 | if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL; |
9545 | __Pyx_ReleaseBuffer(info); |
9546 | } |
9547 | static void __Pyx_ZeroBuffer(Py_buffer* buf) { |
9548 | buf->buf = NULL; |
9549 | buf->obj = NULL; |
9550 | buf->strides = __Pyx_zeros; |
9551 | buf->shape = __Pyx_zeros; |
9552 | buf->suboffsets = __Pyx_minusones; |
9553 | } |
9554 | static int __Pyx__GetBufferAndValidate( |
9555 | Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, |
9556 | int nd, int cast, __Pyx_BufFmt_StackElem* stack) |
9557 | { |
9558 | buf->buf = NULL; |
9559 | if (unlikely(__Pyx_GetBuffer(obj, buf, flags) == -1)) { |
9560 | __Pyx_ZeroBuffer(buf); |
9561 | return -1; |
9562 | } |
9563 | if (unlikely(buf->ndim != nd)) { |
9564 | PyErr_Format(PyExc_ValueError, |
9565 | "Buffer has wrong number of dimensions (expected %d, got %d)" , |
9566 | nd, buf->ndim); |
9567 | goto fail; |
9568 | } |
9569 | if (!cast) { |
9570 | __Pyx_BufFmt_Context ctx; |
9571 | __Pyx_BufFmt_Init(&ctx, stack, dtype); |
9572 | if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail; |
9573 | } |
9574 | if (unlikely((size_t)buf->itemsize != dtype->size)) { |
9575 | PyErr_Format(PyExc_ValueError, |
9576 | "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)" , |
9577 | buf->itemsize, (buf->itemsize > 1) ? "s" : "" , |
9578 | dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : "" ); |
9579 | goto fail; |
9580 | } |
9581 | if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones; |
9582 | return 0; |
9583 | fail:; |
9584 | __Pyx_SafeReleaseBuffer(buf); |
9585 | return -1; |
9586 | } |
9587 | |
9588 | /* PyFunctionFastCall */ |
9589 | #if CYTHON_FAST_PYCALL && !CYTHON_VECTORCALL |
9590 | static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, |
9591 | PyObject *globals) { |
9592 | PyFrameObject *f; |
9593 | PyThreadState *tstate = __Pyx_PyThreadState_Current; |
9594 | PyObject **fastlocals; |
9595 | Py_ssize_t i; |
9596 | PyObject *result; |
9597 | assert(globals != NULL); |
9598 | /* XXX Perhaps we should create a specialized |
9599 | PyFrame_New() that doesn't take locals, but does |
9600 | take builtins without sanity checking them. |
9601 | */ |
9602 | assert(tstate != NULL); |
9603 | f = PyFrame_New(tstate, co, globals, NULL); |
9604 | if (f == NULL) { |
9605 | return NULL; |
9606 | } |
9607 | fastlocals = __Pyx_PyFrame_GetLocalsplus(f); |
9608 | for (i = 0; i < na; i++) { |
9609 | Py_INCREF(*args); |
9610 | fastlocals[i] = *args++; |
9611 | } |
9612 | result = PyEval_EvalFrameEx(f,0); |
9613 | ++tstate->recursion_depth; |
9614 | Py_DECREF(f); |
9615 | --tstate->recursion_depth; |
9616 | return result; |
9617 | } |
9618 | static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) { |
9619 | PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); |
9620 | PyObject *globals = PyFunction_GET_GLOBALS(func); |
9621 | PyObject *argdefs = PyFunction_GET_DEFAULTS(func); |
9622 | PyObject *closure; |
9623 | #if PY_MAJOR_VERSION >= 3 |
9624 | PyObject *kwdefs; |
9625 | #endif |
9626 | PyObject *kwtuple, **k; |
9627 | PyObject **d; |
9628 | Py_ssize_t nd; |
9629 | Py_ssize_t nk; |
9630 | PyObject *result; |
9631 | assert(kwargs == NULL || PyDict_Check(kwargs)); |
9632 | nk = kwargs ? PyDict_Size(kwargs) : 0; |
9633 | if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object" ))) { |
9634 | return NULL; |
9635 | } |
9636 | if ( |
9637 | #if PY_MAJOR_VERSION >= 3 |
9638 | co->co_kwonlyargcount == 0 && |
9639 | #endif |
9640 | likely(kwargs == NULL || nk == 0) && |
9641 | co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { |
9642 | if (argdefs == NULL && co->co_argcount == nargs) { |
9643 | result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals); |
9644 | goto done; |
9645 | } |
9646 | else if (nargs == 0 && argdefs != NULL |
9647 | && co->co_argcount == Py_SIZE(argdefs)) { |
9648 | /* function called with no arguments, but all parameters have |
9649 | a default value: use default values as arguments .*/ |
9650 | args = &PyTuple_GET_ITEM(argdefs, 0); |
9651 | result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals); |
9652 | goto done; |
9653 | } |
9654 | } |
9655 | if (kwargs != NULL) { |
9656 | Py_ssize_t pos, i; |
9657 | kwtuple = PyTuple_New(2 * nk); |
9658 | if (kwtuple == NULL) { |
9659 | result = NULL; |
9660 | goto done; |
9661 | } |
9662 | k = &PyTuple_GET_ITEM(kwtuple, 0); |
9663 | pos = i = 0; |
9664 | while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) { |
9665 | Py_INCREF(k[i]); |
9666 | Py_INCREF(k[i+1]); |
9667 | i += 2; |
9668 | } |
9669 | nk = i / 2; |
9670 | } |
9671 | else { |
9672 | kwtuple = NULL; |
9673 | k = NULL; |
9674 | } |
9675 | closure = PyFunction_GET_CLOSURE(func); |
9676 | #if PY_MAJOR_VERSION >= 3 |
9677 | kwdefs = PyFunction_GET_KW_DEFAULTS(func); |
9678 | #endif |
9679 | if (argdefs != NULL) { |
9680 | d = &PyTuple_GET_ITEM(argdefs, 0); |
9681 | nd = Py_SIZE(argdefs); |
9682 | } |
9683 | else { |
9684 | d = NULL; |
9685 | nd = 0; |
9686 | } |
9687 | #if PY_MAJOR_VERSION >= 3 |
9688 | result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL, |
9689 | args, (int)nargs, |
9690 | k, (int)nk, |
9691 | d, (int)nd, kwdefs, closure); |
9692 | #else |
9693 | result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL, |
9694 | args, (int)nargs, |
9695 | k, (int)nk, |
9696 | d, (int)nd, closure); |
9697 | #endif |
9698 | Py_XDECREF(kwtuple); |
9699 | done: |
9700 | Py_LeaveRecursiveCall(); |
9701 | return result; |
9702 | } |
9703 | #endif |
9704 | |
9705 | /* PyObjectCall */ |
9706 | #if CYTHON_COMPILING_IN_CPYTHON |
9707 | static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { |
9708 | PyObject *result; |
9709 | ternaryfunc call = Py_TYPE(func)->tp_call; |
9710 | if (unlikely(!call)) |
9711 | return PyObject_Call(func, arg, kw); |
9712 | if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object" ))) |
9713 | return NULL; |
9714 | result = (*call)(func, arg, kw); |
9715 | Py_LeaveRecursiveCall(); |
9716 | if (unlikely(!result) && unlikely(!PyErr_Occurred())) { |
9717 | PyErr_SetString( |
9718 | PyExc_SystemError, |
9719 | "NULL result without error in PyObject_Call" ); |
9720 | } |
9721 | return result; |
9722 | } |
9723 | #endif |
9724 | |
9725 | /* PyObjectCallMethO */ |
9726 | #if CYTHON_COMPILING_IN_CPYTHON |
9727 | static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { |
9728 | PyObject *self, *result; |
9729 | PyCFunction cfunc; |
9730 | cfunc = PyCFunction_GET_FUNCTION(func); |
9731 | self = PyCFunction_GET_SELF(func); |
9732 | if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object" ))) |
9733 | return NULL; |
9734 | result = cfunc(self, arg); |
9735 | Py_LeaveRecursiveCall(); |
9736 | if (unlikely(!result) && unlikely(!PyErr_Occurred())) { |
9737 | PyErr_SetString( |
9738 | PyExc_SystemError, |
9739 | "NULL result without error in PyObject_Call" ); |
9740 | } |
9741 | return result; |
9742 | } |
9743 | #endif |
9744 | |
9745 | /* PyObjectFastCall */ |
9746 | static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs) { |
9747 | PyObject *argstuple; |
9748 | PyObject *result; |
9749 | size_t i; |
9750 | argstuple = PyTuple_New((Py_ssize_t)nargs); |
9751 | if (unlikely(!argstuple)) return NULL; |
9752 | for (i = 0; i < nargs; i++) { |
9753 | Py_INCREF(args[i]); |
9754 | PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]); |
9755 | } |
9756 | result = __Pyx_PyObject_Call(func, argstuple, kwargs); |
9757 | Py_DECREF(argstuple); |
9758 | return result; |
9759 | } |
9760 | static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t _nargs, PyObject *kwargs) { |
9761 | Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs); |
9762 | #if CYTHON_COMPILING_IN_CPYTHON |
9763 | if (nargs == 0 && kwargs == NULL) { |
9764 | #ifdef __Pyx_CyFunction_USED |
9765 | if (__Pyx_IsCyOrPyCFunction(func)) |
9766 | #else |
9767 | if (PyCFunction_Check(func)) |
9768 | #endif |
9769 | { |
9770 | if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { |
9771 | return __Pyx_PyObject_CallMethO(func, NULL); |
9772 | } |
9773 | } |
9774 | } |
9775 | else if (nargs == 1 && kwargs == NULL) { |
9776 | if (PyCFunction_Check(func)) |
9777 | { |
9778 | if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { |
9779 | return __Pyx_PyObject_CallMethO(func, args[0]); |
9780 | } |
9781 | } |
9782 | } |
9783 | #endif |
9784 | #if PY_VERSION_HEX < 0x030800B1 |
9785 | #if CYTHON_FAST_PYCCALL |
9786 | if (PyCFunction_Check(func)) { |
9787 | if (kwargs) { |
9788 | return _PyCFunction_FastCallDict(func, args, nargs, kwargs); |
9789 | } else { |
9790 | return _PyCFunction_FastCallKeywords(func, args, nargs, NULL); |
9791 | } |
9792 | } |
9793 | #if PY_VERSION_HEX >= 0x030700A1 |
9794 | if (!kwargs && __Pyx_IS_TYPE(func, &PyMethodDescr_Type)) { |
9795 | return _PyMethodDescr_FastCallKeywords(func, args, nargs, NULL); |
9796 | } |
9797 | #endif |
9798 | #endif |
9799 | #if CYTHON_FAST_PYCALL |
9800 | if (PyFunction_Check(func)) { |
9801 | return __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs); |
9802 | } |
9803 | #endif |
9804 | #endif |
9805 | #if CYTHON_VECTORCALL |
9806 | vectorcallfunc f = _PyVectorcall_Function(func); |
9807 | if (f) { |
9808 | return f(func, args, (size_t)nargs, kwargs); |
9809 | } |
9810 | #elif defined(__Pyx_CyFunction_USED) && CYTHON_BACKPORT_VECTORCALL |
9811 | if (__Pyx_CyFunction_CheckExact(func)) { |
9812 | __pyx_vectorcallfunc f = __Pyx_CyFunction_func_vectorcall(func); |
9813 | if (f) return f(func, args, (size_t)nargs, kwargs); |
9814 | } |
9815 | #endif |
9816 | if (nargs == 0) { |
9817 | return __Pyx_PyObject_Call(func, __pyx_empty_tuple, kwargs); |
9818 | } |
9819 | return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs); |
9820 | } |
9821 | |
9822 | /* PyObjectCall2Args */ |
9823 | static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { |
9824 | PyObject *args[3] = {NULL, arg1, arg2}; |
9825 | return __Pyx_PyObject_FastCall(function, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); |
9826 | } |
9827 | |
9828 | /* PyObjectCallOneArg */ |
9829 | static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { |
9830 | PyObject *args[2] = {NULL, arg}; |
9831 | return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); |
9832 | } |
9833 | |
9834 | /* PyObjectGetMethod */ |
9835 | static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) { |
9836 | PyObject *attr; |
9837 | #if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP |
9838 | __Pyx_TypeName type_name; |
9839 | PyTypeObject *tp = Py_TYPE(obj); |
9840 | PyObject *descr; |
9841 | descrgetfunc f = NULL; |
9842 | PyObject **dictptr, *dict; |
9843 | int meth_found = 0; |
9844 | assert (*method == NULL); |
9845 | if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) { |
9846 | attr = __Pyx_PyObject_GetAttrStr(obj, name); |
9847 | goto try_unpack; |
9848 | } |
9849 | if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) { |
9850 | return 0; |
9851 | } |
9852 | descr = _PyType_Lookup(tp, name); |
9853 | if (likely(descr != NULL)) { |
9854 | Py_INCREF(descr); |
9855 | #if defined(Py_TPFLAGS_METHOD_DESCRIPTOR) && Py_TPFLAGS_METHOD_DESCRIPTOR |
9856 | if (__Pyx_PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_METHOD_DESCRIPTOR)) |
9857 | #elif PY_MAJOR_VERSION >= 3 |
9858 | #ifdef __Pyx_CyFunction_USED |
9859 | if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr))) |
9860 | #else |
9861 | if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type))) |
9862 | #endif |
9863 | #else |
9864 | #ifdef __Pyx_CyFunction_USED |
9865 | if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr))) |
9866 | #else |
9867 | if (likely(PyFunction_Check(descr))) |
9868 | #endif |
9869 | #endif |
9870 | { |
9871 | meth_found = 1; |
9872 | } else { |
9873 | f = Py_TYPE(descr)->tp_descr_get; |
9874 | if (f != NULL && PyDescr_IsData(descr)) { |
9875 | attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); |
9876 | Py_DECREF(descr); |
9877 | goto try_unpack; |
9878 | } |
9879 | } |
9880 | } |
9881 | dictptr = _PyObject_GetDictPtr(obj); |
9882 | if (dictptr != NULL && (dict = *dictptr) != NULL) { |
9883 | Py_INCREF(dict); |
9884 | attr = __Pyx_PyDict_GetItemStr(dict, name); |
9885 | if (attr != NULL) { |
9886 | Py_INCREF(attr); |
9887 | Py_DECREF(dict); |
9888 | Py_XDECREF(descr); |
9889 | goto try_unpack; |
9890 | } |
9891 | Py_DECREF(dict); |
9892 | } |
9893 | if (meth_found) { |
9894 | *method = descr; |
9895 | return 1; |
9896 | } |
9897 | if (f != NULL) { |
9898 | attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); |
9899 | Py_DECREF(descr); |
9900 | goto try_unpack; |
9901 | } |
9902 | if (likely(descr != NULL)) { |
9903 | *method = descr; |
9904 | return 0; |
9905 | } |
9906 | type_name = __Pyx_PyType_GetName(tp); |
9907 | PyErr_Format(PyExc_AttributeError, |
9908 | #if PY_MAJOR_VERSION >= 3 |
9909 | "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'" , |
9910 | type_name, name); |
9911 | #else |
9912 | "'" __Pyx_FMT_TYPENAME "' object has no attribute '%.400s'" , |
9913 | type_name, PyString_AS_STRING(name)); |
9914 | #endif |
9915 | __Pyx_DECREF_TypeName(type_name); |
9916 | return 0; |
9917 | #else |
9918 | attr = __Pyx_PyObject_GetAttrStr(obj, name); |
9919 | goto try_unpack; |
9920 | #endif |
9921 | try_unpack: |
9922 | #if CYTHON_UNPACK_METHODS |
9923 | if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) { |
9924 | PyObject *function = PyMethod_GET_FUNCTION(attr); |
9925 | Py_INCREF(function); |
9926 | Py_DECREF(attr); |
9927 | *method = function; |
9928 | return 1; |
9929 | } |
9930 | #endif |
9931 | *method = attr; |
9932 | return 0; |
9933 | } |
9934 | |
9935 | /* PyObjectCallMethod1 */ |
9936 | static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) { |
9937 | PyObject *result = __Pyx_PyObject_CallOneArg(method, arg); |
9938 | Py_DECREF(method); |
9939 | return result; |
9940 | } |
9941 | static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) { |
9942 | PyObject *method = NULL, *result; |
9943 | int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method); |
9944 | if (likely(is_method)) { |
9945 | result = __Pyx_PyObject_Call2Args(method, obj, arg); |
9946 | Py_DECREF(method); |
9947 | return result; |
9948 | } |
9949 | if (unlikely(!method)) return NULL; |
9950 | return __Pyx__PyObject_CallMethod1(method, arg); |
9951 | } |
9952 | |
9953 | /* append */ |
9954 | static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) { |
9955 | if (likely(PyList_CheckExact(L))) { |
9956 | if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return -1; |
9957 | } else { |
9958 | PyObject* retval = __Pyx_PyObject_CallMethod1(L, __pyx_n_s_append, x); |
9959 | if (unlikely(!retval)) |
9960 | return -1; |
9961 | Py_DECREF(retval); |
9962 | } |
9963 | return 0; |
9964 | } |
9965 | |
9966 | /* PyDictVersioning */ |
9967 | #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS |
9968 | static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { |
9969 | PyObject *dict = Py_TYPE(obj)->tp_dict; |
9970 | return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; |
9971 | } |
9972 | static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { |
9973 | PyObject **dictptr = NULL; |
9974 | Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; |
9975 | if (offset) { |
9976 | #if CYTHON_COMPILING_IN_CPYTHON |
9977 | dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); |
9978 | #else |
9979 | dictptr = _PyObject_GetDictPtr(obj); |
9980 | #endif |
9981 | } |
9982 | return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; |
9983 | } |
9984 | static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { |
9985 | PyObject *dict = Py_TYPE(obj)->tp_dict; |
9986 | if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) |
9987 | return 0; |
9988 | return obj_dict_version == __Pyx_get_object_dict_version(obj); |
9989 | } |
9990 | #endif |
9991 | |
9992 | /* GetModuleGlobalName */ |
9993 | #if CYTHON_USE_DICT_VERSIONS |
9994 | static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) |
9995 | #else |
9996 | static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) |
9997 | #endif |
9998 | { |
9999 | PyObject *result; |
10000 | #if !CYTHON_AVOID_BORROWED_REFS |
10001 | #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 |
10002 | result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash); |
10003 | __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) |
10004 | if (likely(result)) { |
10005 | return __Pyx_NewRef(result); |
10006 | } else if (unlikely(PyErr_Occurred())) { |
10007 | return NULL; |
10008 | } |
10009 | #elif CYTHON_COMPILING_IN_LIMITED_API |
10010 | if (unlikely(!__pyx_m)) { |
10011 | return NULL; |
10012 | } |
10013 | result = PyObject_GetAttr(__pyx_m, name); |
10014 | if (likely(result)) { |
10015 | return result; |
10016 | } |
10017 | #else |
10018 | result = PyDict_GetItem(__pyx_d, name); |
10019 | __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) |
10020 | if (likely(result)) { |
10021 | return __Pyx_NewRef(result); |
10022 | } |
10023 | #endif |
10024 | #else |
10025 | result = PyObject_GetItem(__pyx_d, name); |
10026 | __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) |
10027 | if (likely(result)) { |
10028 | return __Pyx_NewRef(result); |
10029 | } |
10030 | PyErr_Clear(); |
10031 | #endif |
10032 | return __Pyx_GetBuiltinName(name); |
10033 | } |
10034 | |
10035 | /* GetItemInt */ |
10036 | static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { |
10037 | PyObject *r; |
10038 | if (unlikely(!j)) return NULL; |
10039 | r = PyObject_GetItem(o, j); |
10040 | Py_DECREF(j); |
10041 | return r; |
10042 | } |
10043 | static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, |
10044 | CYTHON_NCP_UNUSED int wraparound, |
10045 | CYTHON_NCP_UNUSED int boundscheck) { |
10046 | #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS |
10047 | Py_ssize_t wrapped_i = i; |
10048 | if (wraparound & unlikely(i < 0)) { |
10049 | wrapped_i += PyList_GET_SIZE(o); |
10050 | } |
10051 | if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) { |
10052 | PyObject *r = PyList_GET_ITEM(o, wrapped_i); |
10053 | Py_INCREF(r); |
10054 | return r; |
10055 | } |
10056 | return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); |
10057 | #else |
10058 | return PySequence_GetItem(o, i); |
10059 | #endif |
10060 | } |
10061 | static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, |
10062 | CYTHON_NCP_UNUSED int wraparound, |
10063 | CYTHON_NCP_UNUSED int boundscheck) { |
10064 | #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS |
10065 | Py_ssize_t wrapped_i = i; |
10066 | if (wraparound & unlikely(i < 0)) { |
10067 | wrapped_i += PyTuple_GET_SIZE(o); |
10068 | } |
10069 | if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) { |
10070 | PyObject *r = PyTuple_GET_ITEM(o, wrapped_i); |
10071 | Py_INCREF(r); |
10072 | return r; |
10073 | } |
10074 | return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); |
10075 | #else |
10076 | return PySequence_GetItem(o, i); |
10077 | #endif |
10078 | } |
10079 | static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, |
10080 | CYTHON_NCP_UNUSED int wraparound, |
10081 | CYTHON_NCP_UNUSED int boundscheck) { |
10082 | #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS |
10083 | if (is_list || PyList_CheckExact(o)) { |
10084 | Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); |
10085 | if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) { |
10086 | PyObject *r = PyList_GET_ITEM(o, n); |
10087 | Py_INCREF(r); |
10088 | return r; |
10089 | } |
10090 | } |
10091 | else if (PyTuple_CheckExact(o)) { |
10092 | Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); |
10093 | if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) { |
10094 | PyObject *r = PyTuple_GET_ITEM(o, n); |
10095 | Py_INCREF(r); |
10096 | return r; |
10097 | } |
10098 | } else { |
10099 | PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping; |
10100 | PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence; |
10101 | if (mm && mm->mp_subscript) { |
10102 | PyObject *r, *key = PyInt_FromSsize_t(i); |
10103 | if (unlikely(!key)) return NULL; |
10104 | r = mm->mp_subscript(o, key); |
10105 | Py_DECREF(key); |
10106 | return r; |
10107 | } |
10108 | if (likely(sm && sm->sq_item)) { |
10109 | if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) { |
10110 | Py_ssize_t l = sm->sq_length(o); |
10111 | if (likely(l >= 0)) { |
10112 | i += l; |
10113 | } else { |
10114 | if (!PyErr_ExceptionMatches(PyExc_OverflowError)) |
10115 | return NULL; |
10116 | PyErr_Clear(); |
10117 | } |
10118 | } |
10119 | return sm->sq_item(o, i); |
10120 | } |
10121 | } |
10122 | #else |
10123 | if (is_list || PySequence_Check(o)) { |
10124 | return PySequence_GetItem(o, i); |
10125 | } |
10126 | #endif |
10127 | return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); |
10128 | } |
10129 | |
10130 | /* GetTopmostException */ |
10131 | #if CYTHON_USE_EXC_INFO_STACK |
10132 | static _PyErr_StackItem * |
10133 | __Pyx_PyErr_GetTopmostException(PyThreadState *tstate) |
10134 | { |
10135 | _PyErr_StackItem *exc_info = tstate->exc_info; |
10136 | while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) && |
10137 | exc_info->previous_item != NULL) |
10138 | { |
10139 | exc_info = exc_info->previous_item; |
10140 | } |
10141 | return exc_info; |
10142 | } |
10143 | #endif |
10144 | |
10145 | /* SaveResetException */ |
10146 | #if CYTHON_FAST_THREAD_STATE |
10147 | static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { |
10148 | #if CYTHON_USE_EXC_INFO_STACK |
10149 | _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); |
10150 | *type = exc_info->exc_type; |
10151 | *value = exc_info->exc_value; |
10152 | *tb = exc_info->exc_traceback; |
10153 | #else |
10154 | *type = tstate->exc_type; |
10155 | *value = tstate->exc_value; |
10156 | *tb = tstate->exc_traceback; |
10157 | #endif |
10158 | Py_XINCREF(*type); |
10159 | Py_XINCREF(*value); |
10160 | Py_XINCREF(*tb); |
10161 | } |
10162 | static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { |
10163 | PyObject *tmp_type, *tmp_value, *tmp_tb; |
10164 | #if CYTHON_USE_EXC_INFO_STACK |
10165 | _PyErr_StackItem *exc_info = tstate->exc_info; |
10166 | tmp_type = exc_info->exc_type; |
10167 | tmp_value = exc_info->exc_value; |
10168 | tmp_tb = exc_info->exc_traceback; |
10169 | exc_info->exc_type = type; |
10170 | exc_info->exc_value = value; |
10171 | exc_info->exc_traceback = tb; |
10172 | #else |
10173 | tmp_type = tstate->exc_type; |
10174 | tmp_value = tstate->exc_value; |
10175 | tmp_tb = tstate->exc_traceback; |
10176 | tstate->exc_type = type; |
10177 | tstate->exc_value = value; |
10178 | tstate->exc_traceback = tb; |
10179 | #endif |
10180 | Py_XDECREF(tmp_type); |
10181 | Py_XDECREF(tmp_value); |
10182 | Py_XDECREF(tmp_tb); |
10183 | } |
10184 | #endif |
10185 | |
10186 | /* GetException */ |
10187 | #if CYTHON_FAST_THREAD_STATE |
10188 | static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) |
10189 | #else |
10190 | static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) |
10191 | #endif |
10192 | { |
10193 | PyObject *local_type, *local_value, *local_tb; |
10194 | #if CYTHON_FAST_THREAD_STATE |
10195 | PyObject *tmp_type, *tmp_value, *tmp_tb; |
10196 | local_type = tstate->curexc_type; |
10197 | local_value = tstate->curexc_value; |
10198 | local_tb = tstate->curexc_traceback; |
10199 | tstate->curexc_type = 0; |
10200 | tstate->curexc_value = 0; |
10201 | tstate->curexc_traceback = 0; |
10202 | #else |
10203 | PyErr_Fetch(&local_type, &local_value, &local_tb); |
10204 | #endif |
10205 | PyErr_NormalizeException(&local_type, &local_value, &local_tb); |
10206 | #if CYTHON_FAST_THREAD_STATE |
10207 | if (unlikely(tstate->curexc_type)) |
10208 | #else |
10209 | if (unlikely(PyErr_Occurred())) |
10210 | #endif |
10211 | goto bad; |
10212 | #if PY_MAJOR_VERSION >= 3 |
10213 | if (local_tb) { |
10214 | if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) |
10215 | goto bad; |
10216 | } |
10217 | #endif |
10218 | Py_XINCREF(local_tb); |
10219 | Py_XINCREF(local_type); |
10220 | Py_XINCREF(local_value); |
10221 | *type = local_type; |
10222 | *value = local_value; |
10223 | *tb = local_tb; |
10224 | #if CYTHON_FAST_THREAD_STATE |
10225 | #if CYTHON_USE_EXC_INFO_STACK |
10226 | { |
10227 | _PyErr_StackItem *exc_info = tstate->exc_info; |
10228 | tmp_type = exc_info->exc_type; |
10229 | tmp_value = exc_info->exc_value; |
10230 | tmp_tb = exc_info->exc_traceback; |
10231 | exc_info->exc_type = local_type; |
10232 | exc_info->exc_value = local_value; |
10233 | exc_info->exc_traceback = local_tb; |
10234 | } |
10235 | #else |
10236 | tmp_type = tstate->exc_type; |
10237 | tmp_value = tstate->exc_value; |
10238 | tmp_tb = tstate->exc_traceback; |
10239 | tstate->exc_type = local_type; |
10240 | tstate->exc_value = local_value; |
10241 | tstate->exc_traceback = local_tb; |
10242 | #endif |
10243 | Py_XDECREF(tmp_type); |
10244 | Py_XDECREF(tmp_value); |
10245 | Py_XDECREF(tmp_tb); |
10246 | #else |
10247 | PyErr_SetExcInfo(local_type, local_value, local_tb); |
10248 | #endif |
10249 | return 0; |
10250 | bad: |
10251 | *type = 0; |
10252 | *value = 0; |
10253 | *tb = 0; |
10254 | Py_XDECREF(local_type); |
10255 | Py_XDECREF(local_value); |
10256 | Py_XDECREF(local_tb); |
10257 | return -1; |
10258 | } |
10259 | |
10260 | /* RaiseException */ |
10261 | #if PY_MAJOR_VERSION < 3 |
10262 | static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { |
10263 | __Pyx_PyThreadState_declare |
10264 | CYTHON_UNUSED_VAR(cause); |
10265 | Py_XINCREF(type); |
10266 | if (!value || value == Py_None) |
10267 | value = NULL; |
10268 | else |
10269 | Py_INCREF(value); |
10270 | if (!tb || tb == Py_None) |
10271 | tb = NULL; |
10272 | else { |
10273 | Py_INCREF(tb); |
10274 | if (!PyTraceBack_Check(tb)) { |
10275 | PyErr_SetString(PyExc_TypeError, |
10276 | "raise: arg 3 must be a traceback or None" ); |
10277 | goto raise_error; |
10278 | } |
10279 | } |
10280 | if (PyType_Check(type)) { |
10281 | #if CYTHON_COMPILING_IN_PYPY |
10282 | if (!value) { |
10283 | Py_INCREF(Py_None); |
10284 | value = Py_None; |
10285 | } |
10286 | #endif |
10287 | PyErr_NormalizeException(&type, &value, &tb); |
10288 | } else { |
10289 | if (value) { |
10290 | PyErr_SetString(PyExc_TypeError, |
10291 | "instance exception may not have a separate value" ); |
10292 | goto raise_error; |
10293 | } |
10294 | value = type; |
10295 | type = (PyObject*) Py_TYPE(type); |
10296 | Py_INCREF(type); |
10297 | if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { |
10298 | PyErr_SetString(PyExc_TypeError, |
10299 | "raise: exception class must be a subclass of BaseException" ); |
10300 | goto raise_error; |
10301 | } |
10302 | } |
10303 | __Pyx_PyThreadState_assign |
10304 | __Pyx_ErrRestore(type, value, tb); |
10305 | return; |
10306 | raise_error: |
10307 | Py_XDECREF(value); |
10308 | Py_XDECREF(type); |
10309 | Py_XDECREF(tb); |
10310 | return; |
10311 | } |
10312 | #else |
10313 | static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { |
10314 | PyObject* owned_instance = NULL; |
10315 | if (tb == Py_None) { |
10316 | tb = 0; |
10317 | } else if (tb && !PyTraceBack_Check(tb)) { |
10318 | PyErr_SetString(PyExc_TypeError, |
10319 | "raise: arg 3 must be a traceback or None" ); |
10320 | goto bad; |
10321 | } |
10322 | if (value == Py_None) |
10323 | value = 0; |
10324 | if (PyExceptionInstance_Check(type)) { |
10325 | if (value) { |
10326 | PyErr_SetString(PyExc_TypeError, |
10327 | "instance exception may not have a separate value" ); |
10328 | goto bad; |
10329 | } |
10330 | value = type; |
10331 | type = (PyObject*) Py_TYPE(value); |
10332 | } else if (PyExceptionClass_Check(type)) { |
10333 | PyObject *instance_class = NULL; |
10334 | if (value && PyExceptionInstance_Check(value)) { |
10335 | instance_class = (PyObject*) Py_TYPE(value); |
10336 | if (instance_class != type) { |
10337 | int is_subclass = PyObject_IsSubclass(instance_class, type); |
10338 | if (!is_subclass) { |
10339 | instance_class = NULL; |
10340 | } else if (unlikely(is_subclass == -1)) { |
10341 | goto bad; |
10342 | } else { |
10343 | type = instance_class; |
10344 | } |
10345 | } |
10346 | } |
10347 | if (!instance_class) { |
10348 | PyObject *args; |
10349 | if (!value) |
10350 | args = PyTuple_New(0); |
10351 | else if (PyTuple_Check(value)) { |
10352 | Py_INCREF(value); |
10353 | args = value; |
10354 | } else |
10355 | args = PyTuple_Pack(1, value); |
10356 | if (!args) |
10357 | goto bad; |
10358 | owned_instance = PyObject_Call(type, args, NULL); |
10359 | Py_DECREF(args); |
10360 | if (!owned_instance) |
10361 | goto bad; |
10362 | value = owned_instance; |
10363 | if (!PyExceptionInstance_Check(value)) { |
10364 | PyErr_Format(PyExc_TypeError, |
10365 | "calling %R should have returned an instance of " |
10366 | "BaseException, not %R" , |
10367 | type, Py_TYPE(value)); |
10368 | goto bad; |
10369 | } |
10370 | } |
10371 | } else { |
10372 | PyErr_SetString(PyExc_TypeError, |
10373 | "raise: exception class must be a subclass of BaseException" ); |
10374 | goto bad; |
10375 | } |
10376 | if (cause) { |
10377 | PyObject *fixed_cause; |
10378 | if (cause == Py_None) { |
10379 | fixed_cause = NULL; |
10380 | } else if (PyExceptionClass_Check(cause)) { |
10381 | fixed_cause = PyObject_CallObject(cause, NULL); |
10382 | if (fixed_cause == NULL) |
10383 | goto bad; |
10384 | } else if (PyExceptionInstance_Check(cause)) { |
10385 | fixed_cause = cause; |
10386 | Py_INCREF(fixed_cause); |
10387 | } else { |
10388 | PyErr_SetString(PyExc_TypeError, |
10389 | "exception causes must derive from " |
10390 | "BaseException" ); |
10391 | goto bad; |
10392 | } |
10393 | PyException_SetCause(value, fixed_cause); |
10394 | } |
10395 | PyErr_SetObject(type, value); |
10396 | if (tb) { |
10397 | #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API |
10398 | PyObject *tmp_type, *tmp_value, *tmp_tb; |
10399 | PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); |
10400 | Py_INCREF(tb); |
10401 | PyErr_Restore(tmp_type, tmp_value, tb); |
10402 | Py_XDECREF(tmp_tb); |
10403 | #else |
10404 | PyThreadState *tstate = __Pyx_PyThreadState_Current; |
10405 | PyObject* tmp_tb = tstate->curexc_traceback; |
10406 | if (tb != tmp_tb) { |
10407 | Py_INCREF(tb); |
10408 | tstate->curexc_traceback = tb; |
10409 | Py_XDECREF(tmp_tb); |
10410 | } |
10411 | #endif |
10412 | } |
10413 | bad: |
10414 | Py_XDECREF(owned_instance); |
10415 | return; |
10416 | } |
10417 | #endif |
10418 | |
10419 | /* TypeImport */ |
10420 | #ifndef __PYX_HAVE_RT_ImportType |
10421 | #define __PYX_HAVE_RT_ImportType |
10422 | static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name, |
10423 | size_t size, enum __Pyx_ImportType_CheckSize check_size) |
10424 | { |
10425 | PyObject *result = 0; |
10426 | char warning[200]; |
10427 | Py_ssize_t basicsize; |
10428 | #if CYTHON_COMPILING_IN_LIMITED_API |
10429 | PyObject *py_basicsize; |
10430 | #endif |
10431 | result = PyObject_GetAttrString(module, class_name); |
10432 | if (!result) |
10433 | goto bad; |
10434 | if (!PyType_Check(result)) { |
10435 | PyErr_Format(PyExc_TypeError, |
10436 | "%.200s.%.200s is not a type object" , |
10437 | module_name, class_name); |
10438 | goto bad; |
10439 | } |
10440 | #if !CYTHON_COMPILING_IN_LIMITED_API |
10441 | basicsize = ((PyTypeObject *)result)->tp_basicsize; |
10442 | #else |
10443 | py_basicsize = PyObject_GetAttrString(result, "__basicsize__" ); |
10444 | if (!py_basicsize) |
10445 | goto bad; |
10446 | basicsize = PyLong_AsSsize_t(py_basicsize); |
10447 | Py_DECREF(py_basicsize); |
10448 | py_basicsize = 0; |
10449 | if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) |
10450 | goto bad; |
10451 | #endif |
10452 | if ((size_t)basicsize < size) { |
10453 | PyErr_Format(PyExc_ValueError, |
10454 | "%.200s.%.200s size changed, may indicate binary incompatibility. " |
10455 | "Expected %zd from C header, got %zd from PyObject" , |
10456 | module_name, class_name, size, basicsize); |
10457 | goto bad; |
10458 | } |
10459 | if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) { |
10460 | PyErr_Format(PyExc_ValueError, |
10461 | "%.200s.%.200s size changed, may indicate binary incompatibility. " |
10462 | "Expected %zd from C header, got %zd from PyObject" , |
10463 | module_name, class_name, size, basicsize); |
10464 | goto bad; |
10465 | } |
10466 | else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) { |
10467 | PyOS_snprintf(warning, sizeof(warning), |
10468 | "%s.%s size changed, may indicate binary incompatibility. " |
10469 | "Expected %zd from C header, got %zd from PyObject" , |
10470 | module_name, class_name, size, basicsize); |
10471 | if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; |
10472 | } |
10473 | return (PyTypeObject *)result; |
10474 | bad: |
10475 | Py_XDECREF(result); |
10476 | return NULL; |
10477 | } |
10478 | #endif |
10479 | |
10480 | /* Import */ |
10481 | static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { |
10482 | PyObject *module = 0; |
10483 | PyObject *empty_dict = 0; |
10484 | PyObject *empty_list = 0; |
10485 | #if PY_MAJOR_VERSION < 3 |
10486 | PyObject *py_import; |
10487 | py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); |
10488 | if (unlikely(!py_import)) |
10489 | goto bad; |
10490 | if (!from_list) { |
10491 | empty_list = PyList_New(0); |
10492 | if (unlikely(!empty_list)) |
10493 | goto bad; |
10494 | from_list = empty_list; |
10495 | } |
10496 | #endif |
10497 | empty_dict = PyDict_New(); |
10498 | if (unlikely(!empty_dict)) |
10499 | goto bad; |
10500 | { |
10501 | #if PY_MAJOR_VERSION >= 3 |
10502 | if (level == -1) { |
10503 | if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) { |
10504 | #if CYTHON_COMPILING_IN_LIMITED_API |
10505 | module = PyImport_ImportModuleLevelObject( |
10506 | name, empty_dict, empty_dict, from_list, 1); |
10507 | #else |
10508 | module = PyImport_ImportModuleLevelObject( |
10509 | name, __pyx_d, empty_dict, from_list, 1); |
10510 | #endif |
10511 | if (unlikely(!module)) { |
10512 | if (unlikely(!PyErr_ExceptionMatches(PyExc_ImportError))) |
10513 | goto bad; |
10514 | PyErr_Clear(); |
10515 | } |
10516 | } |
10517 | level = 0; |
10518 | } |
10519 | #endif |
10520 | if (!module) { |
10521 | #if PY_MAJOR_VERSION < 3 |
10522 | PyObject *py_level = PyInt_FromLong(level); |
10523 | if (unlikely(!py_level)) |
10524 | goto bad; |
10525 | module = PyObject_CallFunctionObjArgs(py_import, |
10526 | name, __pyx_d, empty_dict, from_list, py_level, (PyObject *)NULL); |
10527 | Py_DECREF(py_level); |
10528 | #else |
10529 | #if CYTHON_COMPILING_IN_LIMITED_API |
10530 | module = PyImport_ImportModuleLevelObject( |
10531 | name, empty_dict, empty_dict, from_list, level); |
10532 | #else |
10533 | module = PyImport_ImportModuleLevelObject( |
10534 | name, __pyx_d, empty_dict, from_list, level); |
10535 | #endif |
10536 | #endif |
10537 | } |
10538 | } |
10539 | bad: |
10540 | Py_XDECREF(empty_dict); |
10541 | Py_XDECREF(empty_list); |
10542 | #if PY_MAJOR_VERSION < 3 |
10543 | Py_XDECREF(py_import); |
10544 | #endif |
10545 | return module; |
10546 | } |
10547 | |
10548 | /* ImportDottedModule */ |
10549 | #if PY_MAJOR_VERSION >= 3 |
10550 | static PyObject *__Pyx__ImportDottedModule_Error(PyObject *name, PyObject *parts_tuple, Py_ssize_t count) { |
10551 | PyObject *partial_name = NULL, *slice = NULL, *sep = NULL; |
10552 | if (unlikely(PyErr_Occurred())) { |
10553 | PyErr_Clear(); |
10554 | } |
10555 | if (likely(PyTuple_GET_SIZE(parts_tuple) == count)) { |
10556 | partial_name = name; |
10557 | } else { |
10558 | slice = PySequence_GetSlice(parts_tuple, 0, count); |
10559 | if (unlikely(!slice)) |
10560 | goto bad; |
10561 | sep = PyUnicode_FromStringAndSize("." , 1); |
10562 | if (unlikely(!sep)) |
10563 | goto bad; |
10564 | partial_name = PyUnicode_Join(sep, slice); |
10565 | } |
10566 | PyErr_Format( |
10567 | #if PY_MAJOR_VERSION < 3 |
10568 | PyExc_ImportError, |
10569 | "No module named '%s'" , PyString_AS_STRING(partial_name)); |
10570 | #else |
10571 | #if PY_VERSION_HEX >= 0x030600B1 |
10572 | PyExc_ModuleNotFoundError, |
10573 | #else |
10574 | PyExc_ImportError, |
10575 | #endif |
10576 | "No module named '%U'" , partial_name); |
10577 | #endif |
10578 | bad: |
10579 | Py_XDECREF(sep); |
10580 | Py_XDECREF(slice); |
10581 | Py_XDECREF(partial_name); |
10582 | return NULL; |
10583 | } |
10584 | #endif |
10585 | #if PY_MAJOR_VERSION >= 3 |
10586 | static PyObject *__Pyx__ImportDottedModule_Lookup(PyObject *name) { |
10587 | PyObject *imported_module; |
10588 | #if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400) |
10589 | PyObject *modules = PyImport_GetModuleDict(); |
10590 | if (unlikely(!modules)) |
10591 | return NULL; |
10592 | imported_module = __Pyx_PyDict_GetItemStr(modules, name); |
10593 | Py_XINCREF(imported_module); |
10594 | #else |
10595 | imported_module = PyImport_GetModule(name); |
10596 | #endif |
10597 | return imported_module; |
10598 | } |
10599 | #endif |
10600 | static PyObject *__Pyx__ImportDottedModule(PyObject *name, PyObject *parts_tuple) { |
10601 | #if PY_MAJOR_VERSION < 3 |
10602 | PyObject *module, *from_list, *star = __pyx_n_s__3; |
10603 | CYTHON_UNUSED_VAR(parts_tuple); |
10604 | from_list = PyList_New(1); |
10605 | if (unlikely(!from_list)) |
10606 | return NULL; |
10607 | Py_INCREF(star); |
10608 | PyList_SET_ITEM(from_list, 0, star); |
10609 | module = __Pyx_Import(name, from_list, 0); |
10610 | Py_DECREF(from_list); |
10611 | return module; |
10612 | #else |
10613 | Py_ssize_t i, nparts; |
10614 | PyObject *imported_module; |
10615 | PyObject *module = __Pyx_Import(name, NULL, 0); |
10616 | if (!parts_tuple || unlikely(!module)) |
10617 | return module; |
10618 | imported_module = __Pyx__ImportDottedModule_Lookup(name); |
10619 | if (likely(imported_module)) { |
10620 | Py_DECREF(module); |
10621 | return imported_module; |
10622 | } |
10623 | PyErr_Clear(); |
10624 | nparts = PyTuple_GET_SIZE(parts_tuple); |
10625 | for (i=1; i < nparts && module; i++) { |
10626 | PyObject *part, *submodule; |
10627 | #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS |
10628 | part = PyTuple_GET_ITEM(parts_tuple, i); |
10629 | #else |
10630 | part = PySequence_ITEM(parts_tuple, i); |
10631 | #endif |
10632 | submodule = __Pyx_PyObject_GetAttrStrNoError(module, part); |
10633 | #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) |
10634 | Py_DECREF(part); |
10635 | #endif |
10636 | Py_DECREF(module); |
10637 | module = submodule; |
10638 | } |
10639 | if (likely(module)) |
10640 | return module; |
10641 | return __Pyx__ImportDottedModule_Error(name, parts_tuple, i); |
10642 | #endif |
10643 | } |
10644 | static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple) { |
10645 | #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030400B1 |
10646 | PyObject *module = __Pyx__ImportDottedModule_Lookup(name); |
10647 | if (likely(module)) { |
10648 | PyObject *spec = __Pyx_PyObject_GetAttrStrNoError(module, __pyx_n_s_spec); |
10649 | if (likely(spec)) { |
10650 | PyObject *unsafe = __Pyx_PyObject_GetAttrStrNoError(spec, __pyx_n_s_initializing); |
10651 | if (likely(!unsafe || !__Pyx_PyObject_IsTrue(unsafe))) { |
10652 | Py_DECREF(spec); |
10653 | spec = NULL; |
10654 | } |
10655 | Py_XDECREF(unsafe); |
10656 | } |
10657 | if (likely(!spec)) { |
10658 | PyErr_Clear(); |
10659 | return module; |
10660 | } |
10661 | Py_DECREF(spec); |
10662 | Py_DECREF(module); |
10663 | } else if (PyErr_Occurred()) { |
10664 | PyErr_Clear(); |
10665 | } |
10666 | #endif |
10667 | return __Pyx__ImportDottedModule(name, parts_tuple); |
10668 | } |
10669 | |
10670 | /* ImportFrom */ |
10671 | static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { |
10672 | PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); |
10673 | if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { |
10674 | const char* module_name_str = 0; |
10675 | PyObject* module_name = 0; |
10676 | PyObject* module_dot = 0; |
10677 | PyObject* full_name = 0; |
10678 | PyErr_Clear(); |
10679 | module_name_str = PyModule_GetName(module); |
10680 | if (unlikely(!module_name_str)) { goto modbad; } |
10681 | module_name = PyUnicode_FromString(module_name_str); |
10682 | if (unlikely(!module_name)) { goto modbad; } |
10683 | module_dot = PyUnicode_Concat(module_name, __pyx_kp_u__4); |
10684 | if (unlikely(!module_dot)) { goto modbad; } |
10685 | full_name = PyUnicode_Concat(module_dot, name); |
10686 | if (unlikely(!full_name)) { goto modbad; } |
10687 | #if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400) |
10688 | { |
10689 | PyObject *modules = PyImport_GetModuleDict(); |
10690 | if (unlikely(!modules)) |
10691 | goto modbad; |
10692 | value = PyObject_GetItem(modules, full_name); |
10693 | } |
10694 | #else |
10695 | value = PyImport_GetModule(full_name); |
10696 | #endif |
10697 | modbad: |
10698 | Py_XDECREF(full_name); |
10699 | Py_XDECREF(module_dot); |
10700 | Py_XDECREF(module_name); |
10701 | } |
10702 | if (unlikely(!value)) { |
10703 | PyErr_Format(PyExc_ImportError, |
10704 | #if PY_MAJOR_VERSION < 3 |
10705 | "cannot import name %.230s" , PyString_AS_STRING(name)); |
10706 | #else |
10707 | "cannot import name %S" , name); |
10708 | #endif |
10709 | } |
10710 | return value; |
10711 | } |
10712 | |
10713 | /* FixUpExtensionType */ |
10714 | #if CYTHON_USE_TYPE_SPECS |
10715 | static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) { |
10716 | #if PY_VERSION_HEX > 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API |
10717 | (void) spec; |
10718 | (void) type; |
10719 | #else |
10720 | const PyType_Slot *slot = spec->slots; |
10721 | while (slot && slot->slot && slot->slot != Py_tp_members) |
10722 | slot++; |
10723 | if (slot && slot->slot == Py_tp_members) { |
10724 | int changed = 0; |
10725 | #if !(PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON) |
10726 | const |
10727 | #endif |
10728 | PyMemberDef *memb = (PyMemberDef*) slot->pfunc; |
10729 | while (memb && memb->name) { |
10730 | if (memb->name[0] == '_' && memb->name[1] == '_') { |
10731 | #if PY_VERSION_HEX < 0x030900b1 |
10732 | if (strcmp(memb->name, "__weaklistoffset__" ) == 0) { |
10733 | assert(memb->type == T_PYSSIZET); |
10734 | assert(memb->flags == READONLY); |
10735 | type->tp_weaklistoffset = memb->offset; |
10736 | changed = 1; |
10737 | } |
10738 | else if (strcmp(memb->name, "__dictoffset__" ) == 0) { |
10739 | assert(memb->type == T_PYSSIZET); |
10740 | assert(memb->flags == READONLY); |
10741 | type->tp_dictoffset = memb->offset; |
10742 | changed = 1; |
10743 | } |
10744 | #if CYTHON_METH_FASTCALL |
10745 | else if (strcmp(memb->name, "__vectorcalloffset__" ) == 0) { |
10746 | assert(memb->type == T_PYSSIZET); |
10747 | assert(memb->flags == READONLY); |
10748 | #if PY_VERSION_HEX >= 0x030800b4 |
10749 | type->tp_vectorcall_offset = memb->offset; |
10750 | #else |
10751 | type->tp_print = (printfunc) memb->offset; |
10752 | #endif |
10753 | changed = 1; |
10754 | } |
10755 | #endif |
10756 | #else |
10757 | if ((0)); |
10758 | #endif |
10759 | #if PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON |
10760 | else if (strcmp(memb->name, "__module__" ) == 0) { |
10761 | PyObject *descr; |
10762 | assert(memb->type == T_OBJECT); |
10763 | assert(memb->flags == 0 || memb->flags == READONLY); |
10764 | descr = PyDescr_NewMember(type, memb); |
10765 | if (unlikely(!descr)) |
10766 | return -1; |
10767 | if (unlikely(PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr) < 0)) { |
10768 | Py_DECREF(descr); |
10769 | return -1; |
10770 | } |
10771 | Py_DECREF(descr); |
10772 | changed = 1; |
10773 | } |
10774 | #endif |
10775 | } |
10776 | memb++; |
10777 | } |
10778 | if (changed) |
10779 | PyType_Modified(type); |
10780 | } |
10781 | #endif |
10782 | return 0; |
10783 | } |
10784 | #endif |
10785 | |
10786 | /* FetchCommonType */ |
10787 | static PyObject *__Pyx_FetchSharedCythonABIModule(void) { |
10788 | PyObject *abi_module = PyImport_AddModule((char*) __PYX_ABI_MODULE_NAME); |
10789 | if (!abi_module) return NULL; |
10790 | Py_INCREF(abi_module); |
10791 | return abi_module; |
10792 | } |
10793 | static int __Pyx_VerifyCachedType(PyObject *cached_type, |
10794 | const char *name, |
10795 | Py_ssize_t basicsize, |
10796 | Py_ssize_t expected_basicsize) { |
10797 | if (!PyType_Check(cached_type)) { |
10798 | PyErr_Format(PyExc_TypeError, |
10799 | "Shared Cython type %.200s is not a type object" , name); |
10800 | return -1; |
10801 | } |
10802 | if (basicsize != expected_basicsize) { |
10803 | PyErr_Format(PyExc_TypeError, |
10804 | "Shared Cython type %.200s has the wrong size, try recompiling" , |
10805 | name); |
10806 | return -1; |
10807 | } |
10808 | return 0; |
10809 | } |
10810 | #if !CYTHON_USE_TYPE_SPECS |
10811 | static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { |
10812 | PyObject* abi_module; |
10813 | const char* object_name; |
10814 | PyTypeObject *cached_type = NULL; |
10815 | abi_module = __Pyx_FetchSharedCythonABIModule(); |
10816 | if (!abi_module) return NULL; |
10817 | object_name = strrchr(type->tp_name, '.'); |
10818 | object_name = object_name ? object_name+1 : type->tp_name; |
10819 | cached_type = (PyTypeObject*) PyObject_GetAttrString(abi_module, object_name); |
10820 | if (cached_type) { |
10821 | if (__Pyx_VerifyCachedType( |
10822 | (PyObject *)cached_type, |
10823 | object_name, |
10824 | cached_type->tp_basicsize, |
10825 | type->tp_basicsize) < 0) { |
10826 | goto bad; |
10827 | } |
10828 | goto done; |
10829 | } |
10830 | if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; |
10831 | PyErr_Clear(); |
10832 | if (PyType_Ready(type) < 0) goto bad; |
10833 | if (PyObject_SetAttrString(abi_module, object_name, (PyObject *)type) < 0) |
10834 | goto bad; |
10835 | Py_INCREF(type); |
10836 | cached_type = type; |
10837 | done: |
10838 | Py_DECREF(abi_module); |
10839 | return cached_type; |
10840 | bad: |
10841 | Py_XDECREF(cached_type); |
10842 | cached_type = NULL; |
10843 | goto done; |
10844 | } |
10845 | #else |
10846 | static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases) { |
10847 | PyObject *abi_module, *cached_type = NULL; |
10848 | const char* object_name = strrchr(spec->name, '.'); |
10849 | object_name = object_name ? object_name+1 : spec->name; |
10850 | abi_module = __Pyx_FetchSharedCythonABIModule(); |
10851 | if (!abi_module) return NULL; |
10852 | cached_type = PyObject_GetAttrString(abi_module, object_name); |
10853 | if (cached_type) { |
10854 | Py_ssize_t basicsize; |
10855 | #if CYTHON_COMPILING_IN_LIMITED_API |
10856 | PyObject *py_basicsize; |
10857 | py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__" ); |
10858 | if (unlikely(!py_basicsize)) goto bad; |
10859 | basicsize = PyLong_AsSsize_t(py_basicsize); |
10860 | Py_DECREF(py_basicsize); |
10861 | py_basicsize = 0; |
10862 | if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; |
10863 | #else |
10864 | basicsize = likely(PyType_Check(cached_type)) ? ((PyTypeObject*) cached_type)->tp_basicsize : -1; |
10865 | #endif |
10866 | if (__Pyx_VerifyCachedType( |
10867 | cached_type, |
10868 | object_name, |
10869 | basicsize, |
10870 | spec->basicsize) < 0) { |
10871 | goto bad; |
10872 | } |
10873 | goto done; |
10874 | } |
10875 | if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; |
10876 | PyErr_Clear(); |
10877 | (void) module; |
10878 | cached_type = __Pyx_PyType_FromModuleAndSpec(abi_module, spec, bases); |
10879 | if (unlikely(!cached_type)) goto bad; |
10880 | if (unlikely(__Pyx_fix_up_extension_type_from_spec(spec, (PyTypeObject *) cached_type) < 0)) goto bad; |
10881 | if (PyObject_SetAttrString(abi_module, object_name, cached_type) < 0) goto bad; |
10882 | done: |
10883 | Py_DECREF(abi_module); |
10884 | assert(cached_type == NULL || PyType_Check(cached_type)); |
10885 | return (PyTypeObject *) cached_type; |
10886 | bad: |
10887 | Py_XDECREF(cached_type); |
10888 | cached_type = NULL; |
10889 | goto done; |
10890 | } |
10891 | #endif |
10892 | |
10893 | /* PyVectorcallFastCallDict */ |
10894 | #if CYTHON_METH_FASTCALL |
10895 | static PyObject *__Pyx_PyVectorcall_FastCallDict_kw(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) |
10896 | { |
10897 | PyObject *res = NULL; |
10898 | PyObject *kwnames; |
10899 | PyObject **newargs; |
10900 | PyObject **kwvalues; |
10901 | Py_ssize_t i, pos; |
10902 | size_t j; |
10903 | PyObject *key, *value; |
10904 | unsigned long keys_are_strings; |
10905 | Py_ssize_t nkw = PyDict_GET_SIZE(kw); |
10906 | newargs = (PyObject **)PyMem_Malloc((nargs + (size_t)nkw) * sizeof(args[0])); |
10907 | if (unlikely(newargs == NULL)) { |
10908 | PyErr_NoMemory(); |
10909 | return NULL; |
10910 | } |
10911 | for (j = 0; j < nargs; j++) newargs[j] = args[j]; |
10912 | kwnames = PyTuple_New(nkw); |
10913 | if (unlikely(kwnames == NULL)) { |
10914 | PyMem_Free(newargs); |
10915 | return NULL; |
10916 | } |
10917 | kwvalues = newargs + nargs; |
10918 | pos = i = 0; |
10919 | keys_are_strings = Py_TPFLAGS_UNICODE_SUBCLASS; |
10920 | while (PyDict_Next(kw, &pos, &key, &value)) { |
10921 | keys_are_strings &= Py_TYPE(key)->tp_flags; |
10922 | Py_INCREF(key); |
10923 | Py_INCREF(value); |
10924 | PyTuple_SET_ITEM(kwnames, i, key); |
10925 | kwvalues[i] = value; |
10926 | i++; |
10927 | } |
10928 | if (unlikely(!keys_are_strings)) { |
10929 | PyErr_SetString(PyExc_TypeError, "keywords must be strings" ); |
10930 | goto cleanup; |
10931 | } |
10932 | res = vc(func, newargs, nargs, kwnames); |
10933 | cleanup: |
10934 | Py_DECREF(kwnames); |
10935 | for (i = 0; i < nkw; i++) |
10936 | Py_DECREF(kwvalues[i]); |
10937 | PyMem_Free(newargs); |
10938 | return res; |
10939 | } |
10940 | static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) |
10941 | { |
10942 | if (likely(kw == NULL) || PyDict_GET_SIZE(kw) == 0) { |
10943 | return vc(func, args, nargs, NULL); |
10944 | } |
10945 | return __Pyx_PyVectorcall_FastCallDict_kw(func, vc, args, nargs, kw); |
10946 | } |
10947 | #endif |
10948 | |
10949 | /* CythonFunctionShared */ |
10950 | static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj) { |
10951 | #if PY_VERSION_HEX < 0x030900B1 |
10952 | __Pyx_Py_XDECREF_SET( |
10953 | __Pyx_CyFunction_GetClassObj(f), |
10954 | ((classobj) ? __Pyx_NewRef(classobj) : NULL)); |
10955 | #else |
10956 | __Pyx_Py_XDECREF_SET( |
10957 | ((PyCMethodObject *) (f))->mm_class, |
10958 | (PyTypeObject*)((classobj) ? __Pyx_NewRef(classobj) : NULL)); |
10959 | #endif |
10960 | } |
10961 | static PyObject * |
10962 | __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, void *closure) |
10963 | { |
10964 | CYTHON_UNUSED_VAR(closure); |
10965 | if (unlikely(op->func_doc == NULL)) { |
10966 | if (((PyCFunctionObject*)op)->m_ml->ml_doc) { |
10967 | #if PY_MAJOR_VERSION >= 3 |
10968 | op->func_doc = PyUnicode_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); |
10969 | #else |
10970 | op->func_doc = PyString_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); |
10971 | #endif |
10972 | if (unlikely(op->func_doc == NULL)) |
10973 | return NULL; |
10974 | } else { |
10975 | Py_INCREF(Py_None); |
10976 | return Py_None; |
10977 | } |
10978 | } |
10979 | Py_INCREF(op->func_doc); |
10980 | return op->func_doc; |
10981 | } |
10982 | static int |
10983 | __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, void *context) |
10984 | { |
10985 | CYTHON_UNUSED_VAR(context); |
10986 | if (value == NULL) { |
10987 | value = Py_None; |
10988 | } |
10989 | Py_INCREF(value); |
10990 | __Pyx_Py_XDECREF_SET(op->func_doc, value); |
10991 | return 0; |
10992 | } |
10993 | static PyObject * |
10994 | __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, void *context) |
10995 | { |
10996 | CYTHON_UNUSED_VAR(context); |
10997 | if (unlikely(op->func_name == NULL)) { |
10998 | #if PY_MAJOR_VERSION >= 3 |
10999 | op->func_name = PyUnicode_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name); |
11000 | #else |
11001 | op->func_name = PyString_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name); |
11002 | #endif |
11003 | if (unlikely(op->func_name == NULL)) |
11004 | return NULL; |
11005 | } |
11006 | Py_INCREF(op->func_name); |
11007 | return op->func_name; |
11008 | } |
11009 | static int |
11010 | __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, void *context) |
11011 | { |
11012 | CYTHON_UNUSED_VAR(context); |
11013 | #if PY_MAJOR_VERSION >= 3 |
11014 | if (unlikely(value == NULL || !PyUnicode_Check(value))) |
11015 | #else |
11016 | if (unlikely(value == NULL || !PyString_Check(value))) |
11017 | #endif |
11018 | { |
11019 | PyErr_SetString(PyExc_TypeError, |
11020 | "__name__ must be set to a string object" ); |
11021 | return -1; |
11022 | } |
11023 | Py_INCREF(value); |
11024 | __Pyx_Py_XDECREF_SET(op->func_name, value); |
11025 | return 0; |
11026 | } |
11027 | static PyObject * |
11028 | __Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, void *context) |
11029 | { |
11030 | CYTHON_UNUSED_VAR(context); |
11031 | Py_INCREF(op->func_qualname); |
11032 | return op->func_qualname; |
11033 | } |
11034 | static int |
11035 | __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, void *context) |
11036 | { |
11037 | CYTHON_UNUSED_VAR(context); |
11038 | #if PY_MAJOR_VERSION >= 3 |
11039 | if (unlikely(value == NULL || !PyUnicode_Check(value))) |
11040 | #else |
11041 | if (unlikely(value == NULL || !PyString_Check(value))) |
11042 | #endif |
11043 | { |
11044 | PyErr_SetString(PyExc_TypeError, |
11045 | "__qualname__ must be set to a string object" ); |
11046 | return -1; |
11047 | } |
11048 | Py_INCREF(value); |
11049 | __Pyx_Py_XDECREF_SET(op->func_qualname, value); |
11050 | return 0; |
11051 | } |
11052 | static PyObject * |
11053 | __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, void *context) |
11054 | { |
11055 | CYTHON_UNUSED_VAR(context); |
11056 | if (unlikely(op->func_dict == NULL)) { |
11057 | op->func_dict = PyDict_New(); |
11058 | if (unlikely(op->func_dict == NULL)) |
11059 | return NULL; |
11060 | } |
11061 | Py_INCREF(op->func_dict); |
11062 | return op->func_dict; |
11063 | } |
11064 | static int |
11065 | __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, void *context) |
11066 | { |
11067 | CYTHON_UNUSED_VAR(context); |
11068 | if (unlikely(value == NULL)) { |
11069 | PyErr_SetString(PyExc_TypeError, |
11070 | "function's dictionary may not be deleted" ); |
11071 | return -1; |
11072 | } |
11073 | if (unlikely(!PyDict_Check(value))) { |
11074 | PyErr_SetString(PyExc_TypeError, |
11075 | "setting function's dictionary to a non-dict" ); |
11076 | return -1; |
11077 | } |
11078 | Py_INCREF(value); |
11079 | __Pyx_Py_XDECREF_SET(op->func_dict, value); |
11080 | return 0; |
11081 | } |
11082 | static PyObject * |
11083 | __Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, void *context) |
11084 | { |
11085 | CYTHON_UNUSED_VAR(context); |
11086 | Py_INCREF(op->func_globals); |
11087 | return op->func_globals; |
11088 | } |
11089 | static PyObject * |
11090 | __Pyx_CyFunction_get_closure(__pyx_CyFunctionObject *op, void *context) |
11091 | { |
11092 | CYTHON_UNUSED_VAR(op); |
11093 | CYTHON_UNUSED_VAR(context); |
11094 | Py_INCREF(Py_None); |
11095 | return Py_None; |
11096 | } |
11097 | static PyObject * |
11098 | __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, void *context) |
11099 | { |
11100 | PyObject* result = (op->func_code) ? op->func_code : Py_None; |
11101 | CYTHON_UNUSED_VAR(context); |
11102 | Py_INCREF(result); |
11103 | return result; |
11104 | } |
11105 | static int |
11106 | __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { |
11107 | int result = 0; |
11108 | PyObject *res = op->defaults_getter((PyObject *) op); |
11109 | if (unlikely(!res)) |
11110 | return -1; |
11111 | #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS |
11112 | op->defaults_tuple = PyTuple_GET_ITEM(res, 0); |
11113 | Py_INCREF(op->defaults_tuple); |
11114 | op->defaults_kwdict = PyTuple_GET_ITEM(res, 1); |
11115 | Py_INCREF(op->defaults_kwdict); |
11116 | #else |
11117 | op->defaults_tuple = PySequence_ITEM(res, 0); |
11118 | if (unlikely(!op->defaults_tuple)) result = -1; |
11119 | else { |
11120 | op->defaults_kwdict = PySequence_ITEM(res, 1); |
11121 | if (unlikely(!op->defaults_kwdict)) result = -1; |
11122 | } |
11123 | #endif |
11124 | Py_DECREF(res); |
11125 | return result; |
11126 | } |
11127 | static int |
11128 | __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { |
11129 | CYTHON_UNUSED_VAR(context); |
11130 | if (!value) { |
11131 | value = Py_None; |
11132 | } else if (unlikely(value != Py_None && !PyTuple_Check(value))) { |
11133 | PyErr_SetString(PyExc_TypeError, |
11134 | "__defaults__ must be set to a tuple object" ); |
11135 | return -1; |
11136 | } |
11137 | PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__defaults__ will not " |
11138 | "currently affect the values used in function calls" , 1); |
11139 | Py_INCREF(value); |
11140 | __Pyx_Py_XDECREF_SET(op->defaults_tuple, value); |
11141 | return 0; |
11142 | } |
11143 | static PyObject * |
11144 | __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, void *context) { |
11145 | PyObject* result = op->defaults_tuple; |
11146 | CYTHON_UNUSED_VAR(context); |
11147 | if (unlikely(!result)) { |
11148 | if (op->defaults_getter) { |
11149 | if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; |
11150 | result = op->defaults_tuple; |
11151 | } else { |
11152 | result = Py_None; |
11153 | } |
11154 | } |
11155 | Py_INCREF(result); |
11156 | return result; |
11157 | } |
11158 | static int |
11159 | __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { |
11160 | CYTHON_UNUSED_VAR(context); |
11161 | if (!value) { |
11162 | value = Py_None; |
11163 | } else if (unlikely(value != Py_None && !PyDict_Check(value))) { |
11164 | PyErr_SetString(PyExc_TypeError, |
11165 | "__kwdefaults__ must be set to a dict object" ); |
11166 | return -1; |
11167 | } |
11168 | PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__kwdefaults__ will not " |
11169 | "currently affect the values used in function calls" , 1); |
11170 | Py_INCREF(value); |
11171 | __Pyx_Py_XDECREF_SET(op->defaults_kwdict, value); |
11172 | return 0; |
11173 | } |
11174 | static PyObject * |
11175 | __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, void *context) { |
11176 | PyObject* result = op->defaults_kwdict; |
11177 | CYTHON_UNUSED_VAR(context); |
11178 | if (unlikely(!result)) { |
11179 | if (op->defaults_getter) { |
11180 | if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; |
11181 | result = op->defaults_kwdict; |
11182 | } else { |
11183 | result = Py_None; |
11184 | } |
11185 | } |
11186 | Py_INCREF(result); |
11187 | return result; |
11188 | } |
11189 | static int |
11190 | __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, void *context) { |
11191 | CYTHON_UNUSED_VAR(context); |
11192 | if (!value || value == Py_None) { |
11193 | value = NULL; |
11194 | } else if (unlikely(!PyDict_Check(value))) { |
11195 | PyErr_SetString(PyExc_TypeError, |
11196 | "__annotations__ must be set to a dict object" ); |
11197 | return -1; |
11198 | } |
11199 | Py_XINCREF(value); |
11200 | __Pyx_Py_XDECREF_SET(op->func_annotations, value); |
11201 | return 0; |
11202 | } |
11203 | static PyObject * |
11204 | __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, void *context) { |
11205 | PyObject* result = op->func_annotations; |
11206 | CYTHON_UNUSED_VAR(context); |
11207 | if (unlikely(!result)) { |
11208 | result = PyDict_New(); |
11209 | if (unlikely(!result)) return NULL; |
11210 | op->func_annotations = result; |
11211 | } |
11212 | Py_INCREF(result); |
11213 | return result; |
11214 | } |
11215 | static PyObject * |
11216 | __Pyx_CyFunction_get_is_coroutine(__pyx_CyFunctionObject *op, void *context) { |
11217 | int is_coroutine; |
11218 | CYTHON_UNUSED_VAR(context); |
11219 | if (op->func_is_coroutine) { |
11220 | return __Pyx_NewRef(op->func_is_coroutine); |
11221 | } |
11222 | is_coroutine = op->flags & __Pyx_CYFUNCTION_COROUTINE; |
11223 | #if PY_VERSION_HEX >= 0x03050000 |
11224 | if (is_coroutine) { |
11225 | PyObject *module, *fromlist, *marker = __pyx_n_s_is_coroutine; |
11226 | fromlist = PyList_New(1); |
11227 | if (unlikely(!fromlist)) return NULL; |
11228 | Py_INCREF(marker); |
11229 | PyList_SET_ITEM(fromlist, 0, marker); |
11230 | module = PyImport_ImportModuleLevelObject(__pyx_n_s_asyncio_coroutines, NULL, NULL, fromlist, 0); |
11231 | Py_DECREF(fromlist); |
11232 | if (unlikely(!module)) goto ignore; |
11233 | op->func_is_coroutine = __Pyx_PyObject_GetAttrStr(module, marker); |
11234 | Py_DECREF(module); |
11235 | if (likely(op->func_is_coroutine)) { |
11236 | return __Pyx_NewRef(op->func_is_coroutine); |
11237 | } |
11238 | ignore: |
11239 | PyErr_Clear(); |
11240 | } |
11241 | #endif |
11242 | op->func_is_coroutine = __Pyx_PyBool_FromLong(is_coroutine); |
11243 | return __Pyx_NewRef(op->func_is_coroutine); |
11244 | } |
11245 | static PyGetSetDef __pyx_CyFunction_getsets[] = { |
11246 | {(char *) "func_doc" , (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, |
11247 | {(char *) "__doc__" , (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, |
11248 | {(char *) "func_name" , (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, |
11249 | {(char *) "__name__" , (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, |
11250 | {(char *) "__qualname__" , (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0}, |
11251 | {(char *) "func_dict" , (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, |
11252 | {(char *) "__dict__" , (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, |
11253 | {(char *) "func_globals" , (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, |
11254 | {(char *) "__globals__" , (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, |
11255 | {(char *) "func_closure" , (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, |
11256 | {(char *) "__closure__" , (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, |
11257 | {(char *) "func_code" , (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, |
11258 | {(char *) "__code__" , (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, |
11259 | {(char *) "func_defaults" , (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, |
11260 | {(char *) "__defaults__" , (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, |
11261 | {(char *) "__kwdefaults__" , (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0}, |
11262 | {(char *) "__annotations__" , (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0}, |
11263 | {(char *) "_is_coroutine" , (getter)__Pyx_CyFunction_get_is_coroutine, 0, 0, 0}, |
11264 | {0, 0, 0, 0, 0} |
11265 | }; |
11266 | static PyMemberDef __pyx_CyFunction_members[] = { |
11267 | {(char *) "__module__" , T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0}, |
11268 | #if CYTHON_USE_TYPE_SPECS |
11269 | {(char *) "__dictoffset__" , T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0}, |
11270 | #if CYTHON_METH_FASTCALL |
11271 | #if CYTHON_BACKPORT_VECTORCALL |
11272 | {(char *) "__vectorcalloffset__" , T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_vectorcall), READONLY, 0}, |
11273 | #else |
11274 | {(char *) "__vectorcalloffset__" , T_PYSSIZET, offsetof(PyCFunctionObject, vectorcall), READONLY, 0}, |
11275 | #endif |
11276 | #endif |
11277 | #if PY_VERSION_HEX < 0x030500A0 |
11278 | {(char *) "__weaklistoffset__" , T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_weakreflist), READONLY, 0}, |
11279 | #else |
11280 | {(char *) "__weaklistoffset__" , T_PYSSIZET, offsetof(PyCFunctionObject, m_weakreflist), READONLY, 0}, |
11281 | #endif |
11282 | #endif |
11283 | {0, 0, 0, 0, 0} |
11284 | }; |
11285 | static PyObject * |
11286 | __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, PyObject *args) |
11287 | { |
11288 | CYTHON_UNUSED_VAR(args); |
11289 | #if PY_MAJOR_VERSION >= 3 |
11290 | Py_INCREF(m->func_qualname); |
11291 | return m->func_qualname; |
11292 | #else |
11293 | return PyString_FromString(((PyCFunctionObject*)m)->m_ml->ml_name); |
11294 | #endif |
11295 | } |
11296 | static PyMethodDef __pyx_CyFunction_methods[] = { |
11297 | {"__reduce__" , (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0}, |
11298 | {0, 0, 0, 0} |
11299 | }; |
11300 | #if PY_VERSION_HEX < 0x030500A0 |
11301 | #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist) |
11302 | #else |
11303 | #define __Pyx_CyFunction_weakreflist(cyfunc) (((PyCFunctionObject*)cyfunc)->m_weakreflist) |
11304 | #endif |
11305 | static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname, |
11306 | PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { |
11307 | PyCFunctionObject *cf = (PyCFunctionObject*) op; |
11308 | if (unlikely(op == NULL)) |
11309 | return NULL; |
11310 | op->flags = flags; |
11311 | __Pyx_CyFunction_weakreflist(op) = NULL; |
11312 | cf->m_ml = ml; |
11313 | cf->m_self = (PyObject *) op; |
11314 | Py_XINCREF(closure); |
11315 | op->func_closure = closure; |
11316 | Py_XINCREF(module); |
11317 | cf->m_module = module; |
11318 | op->func_dict = NULL; |
11319 | op->func_name = NULL; |
11320 | Py_INCREF(qualname); |
11321 | op->func_qualname = qualname; |
11322 | op->func_doc = NULL; |
11323 | #if PY_VERSION_HEX < 0x030900B1 |
11324 | op->func_classobj = NULL; |
11325 | #else |
11326 | ((PyCMethodObject*)op)->mm_class = NULL; |
11327 | #endif |
11328 | op->func_globals = globals; |
11329 | Py_INCREF(op->func_globals); |
11330 | Py_XINCREF(code); |
11331 | op->func_code = code; |
11332 | op->defaults_pyobjects = 0; |
11333 | op->defaults_size = 0; |
11334 | op->defaults = NULL; |
11335 | op->defaults_tuple = NULL; |
11336 | op->defaults_kwdict = NULL; |
11337 | op->defaults_getter = NULL; |
11338 | op->func_annotations = NULL; |
11339 | op->func_is_coroutine = NULL; |
11340 | #if CYTHON_METH_FASTCALL |
11341 | switch (ml->ml_flags & (METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O | METH_KEYWORDS | METH_METHOD)) { |
11342 | case METH_NOARGS: |
11343 | __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_NOARGS; |
11344 | break; |
11345 | case METH_O: |
11346 | __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_O; |
11347 | break; |
11348 | case METH_METHOD | METH_FASTCALL | METH_KEYWORDS: |
11349 | __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD; |
11350 | break; |
11351 | case METH_FASTCALL | METH_KEYWORDS: |
11352 | __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS; |
11353 | break; |
11354 | case METH_VARARGS | METH_KEYWORDS: |
11355 | __Pyx_CyFunction_func_vectorcall(op) = NULL; |
11356 | break; |
11357 | default: |
11358 | PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction" ); |
11359 | Py_DECREF(op); |
11360 | return NULL; |
11361 | } |
11362 | #endif |
11363 | return (PyObject *) op; |
11364 | } |
11365 | static int |
11366 | __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) |
11367 | { |
11368 | Py_CLEAR(m->func_closure); |
11369 | Py_CLEAR(((PyCFunctionObject*)m)->m_module); |
11370 | Py_CLEAR(m->func_dict); |
11371 | Py_CLEAR(m->func_name); |
11372 | Py_CLEAR(m->func_qualname); |
11373 | Py_CLEAR(m->func_doc); |
11374 | Py_CLEAR(m->func_globals); |
11375 | Py_CLEAR(m->func_code); |
11376 | #if PY_VERSION_HEX < 0x030900B1 |
11377 | Py_CLEAR(__Pyx_CyFunction_GetClassObj(m)); |
11378 | #else |
11379 | { |
11380 | PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class; |
11381 | ((PyCMethodObject *) (m))->mm_class = NULL; |
11382 | Py_XDECREF(cls); |
11383 | } |
11384 | #endif |
11385 | Py_CLEAR(m->defaults_tuple); |
11386 | Py_CLEAR(m->defaults_kwdict); |
11387 | Py_CLEAR(m->func_annotations); |
11388 | Py_CLEAR(m->func_is_coroutine); |
11389 | if (m->defaults) { |
11390 | PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); |
11391 | int i; |
11392 | for (i = 0; i < m->defaults_pyobjects; i++) |
11393 | Py_XDECREF(pydefaults[i]); |
11394 | PyObject_Free(m->defaults); |
11395 | m->defaults = NULL; |
11396 | } |
11397 | return 0; |
11398 | } |
11399 | static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m) |
11400 | { |
11401 | if (__Pyx_CyFunction_weakreflist(m) != NULL) |
11402 | PyObject_ClearWeakRefs((PyObject *) m); |
11403 | __Pyx_CyFunction_clear(m); |
11404 | __Pyx_PyHeapTypeObject_GC_Del(m); |
11405 | } |
11406 | static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) |
11407 | { |
11408 | PyObject_GC_UnTrack(m); |
11409 | __Pyx__CyFunction_dealloc(m); |
11410 | } |
11411 | static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg) |
11412 | { |
11413 | Py_VISIT(m->func_closure); |
11414 | Py_VISIT(((PyCFunctionObject*)m)->m_module); |
11415 | Py_VISIT(m->func_dict); |
11416 | Py_VISIT(m->func_name); |
11417 | Py_VISIT(m->func_qualname); |
11418 | Py_VISIT(m->func_doc); |
11419 | Py_VISIT(m->func_globals); |
11420 | Py_VISIT(m->func_code); |
11421 | Py_VISIT(__Pyx_CyFunction_GetClassObj(m)); |
11422 | Py_VISIT(m->defaults_tuple); |
11423 | Py_VISIT(m->defaults_kwdict); |
11424 | Py_VISIT(m->func_is_coroutine); |
11425 | if (m->defaults) { |
11426 | PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); |
11427 | int i; |
11428 | for (i = 0; i < m->defaults_pyobjects; i++) |
11429 | Py_VISIT(pydefaults[i]); |
11430 | } |
11431 | return 0; |
11432 | } |
11433 | static PyObject* |
11434 | __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) |
11435 | { |
11436 | #if PY_MAJOR_VERSION >= 3 |
11437 | return PyUnicode_FromFormat("<cyfunction %U at %p>" , |
11438 | op->func_qualname, (void *)op); |
11439 | #else |
11440 | return PyString_FromFormat("<cyfunction %s at %p>" , |
11441 | PyString_AsString(op->func_qualname), (void *)op); |
11442 | #endif |
11443 | } |
11444 | static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) { |
11445 | PyCFunctionObject* f = (PyCFunctionObject*)func; |
11446 | PyCFunction meth = f->m_ml->ml_meth; |
11447 | Py_ssize_t size; |
11448 | switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) { |
11449 | case METH_VARARGS: |
11450 | if (likely(kw == NULL || PyDict_Size(kw) == 0)) |
11451 | return (*meth)(self, arg); |
11452 | break; |
11453 | case METH_VARARGS | METH_KEYWORDS: |
11454 | return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw); |
11455 | case METH_NOARGS: |
11456 | if (likely(kw == NULL || PyDict_Size(kw) == 0)) { |
11457 | size = PyTuple_GET_SIZE(arg); |
11458 | if (likely(size == 0)) |
11459 | return (*meth)(self, NULL); |
11460 | PyErr_Format(PyExc_TypeError, |
11461 | "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)" , |
11462 | f->m_ml->ml_name, size); |
11463 | return NULL; |
11464 | } |
11465 | break; |
11466 | case METH_O: |
11467 | if (likely(kw == NULL || PyDict_Size(kw) == 0)) { |
11468 | size = PyTuple_GET_SIZE(arg); |
11469 | if (likely(size == 1)) { |
11470 | PyObject *result, *arg0; |
11471 | #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS |
11472 | arg0 = PyTuple_GET_ITEM(arg, 0); |
11473 | #else |
11474 | arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL; |
11475 | #endif |
11476 | result = (*meth)(self, arg0); |
11477 | #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) |
11478 | Py_DECREF(arg0); |
11479 | #endif |
11480 | return result; |
11481 | } |
11482 | PyErr_Format(PyExc_TypeError, |
11483 | "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)" , |
11484 | f->m_ml->ml_name, size); |
11485 | return NULL; |
11486 | } |
11487 | break; |
11488 | default: |
11489 | PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction" ); |
11490 | return NULL; |
11491 | } |
11492 | PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments" , |
11493 | f->m_ml->ml_name); |
11494 | return NULL; |
11495 | } |
11496 | static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { |
11497 | return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw); |
11498 | } |
11499 | static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) { |
11500 | PyObject *result; |
11501 | __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func; |
11502 | #if CYTHON_METH_FASTCALL |
11503 | __pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc); |
11504 | if (vc) { |
11505 | #if CYTHON_ASSUME_SAFE_MACROS |
11506 | return __Pyx_PyVectorcall_FastCallDict(func, vc, &PyTuple_GET_ITEM(args, 0), (size_t)PyTuple_GET_SIZE(args), kw); |
11507 | #else |
11508 | (void) &__Pyx_PyVectorcall_FastCallDict; |
11509 | return PyVectorcall_Call(func, args, kw); |
11510 | #endif |
11511 | } |
11512 | #endif |
11513 | if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { |
11514 | Py_ssize_t argc; |
11515 | PyObject *new_args; |
11516 | PyObject *self; |
11517 | argc = PyTuple_GET_SIZE(args); |
11518 | new_args = PyTuple_GetSlice(args, 1, argc); |
11519 | if (unlikely(!new_args)) |
11520 | return NULL; |
11521 | self = PyTuple_GetItem(args, 0); |
11522 | if (unlikely(!self)) { |
11523 | Py_DECREF(new_args); |
11524 | return NULL; |
11525 | } |
11526 | result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw); |
11527 | Py_DECREF(new_args); |
11528 | } else { |
11529 | result = __Pyx_CyFunction_Call(func, args, kw); |
11530 | } |
11531 | return result; |
11532 | } |
11533 | #if CYTHON_METH_FASTCALL |
11534 | static CYTHON_INLINE int __Pyx_CyFunction_Vectorcall_CheckArgs(__pyx_CyFunctionObject *cyfunc, Py_ssize_t nargs, PyObject *kwnames) |
11535 | { |
11536 | int ret = 0; |
11537 | if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { |
11538 | if (unlikely(nargs < 1)) { |
11539 | PyErr_Format(PyExc_TypeError, "%.200s() needs an argument" , |
11540 | ((PyCFunctionObject*)cyfunc)->m_ml->ml_name); |
11541 | return -1; |
11542 | } |
11543 | ret = 1; |
11544 | } |
11545 | if (unlikely(kwnames) && unlikely(PyTuple_GET_SIZE(kwnames))) { |
11546 | PyErr_Format(PyExc_TypeError, |
11547 | "%.200s() takes no keyword arguments" , ((PyCFunctionObject*)cyfunc)->m_ml->ml_name); |
11548 | return -1; |
11549 | } |
11550 | return ret; |
11551 | } |
11552 | static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) |
11553 | { |
11554 | __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; |
11555 | PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; |
11556 | #if CYTHON_BACKPORT_VECTORCALL |
11557 | Py_ssize_t nargs = (Py_ssize_t)nargsf; |
11558 | #else |
11559 | Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); |
11560 | #endif |
11561 | PyObject *self; |
11562 | switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { |
11563 | case 1: |
11564 | self = args[0]; |
11565 | args += 1; |
11566 | nargs -= 1; |
11567 | break; |
11568 | case 0: |
11569 | self = ((PyCFunctionObject*)cyfunc)->m_self; |
11570 | break; |
11571 | default: |
11572 | return NULL; |
11573 | } |
11574 | if (unlikely(nargs != 0)) { |
11575 | PyErr_Format(PyExc_TypeError, |
11576 | "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)" , |
11577 | def->ml_name, nargs); |
11578 | return NULL; |
11579 | } |
11580 | return def->ml_meth(self, NULL); |
11581 | } |
11582 | static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) |
11583 | { |
11584 | __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; |
11585 | PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; |
11586 | #if CYTHON_BACKPORT_VECTORCALL |
11587 | Py_ssize_t nargs = (Py_ssize_t)nargsf; |
11588 | #else |
11589 | Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); |
11590 | #endif |
11591 | PyObject *self; |
11592 | switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { |
11593 | case 1: |
11594 | self = args[0]; |
11595 | args += 1; |
11596 | nargs -= 1; |
11597 | break; |
11598 | case 0: |
11599 | self = ((PyCFunctionObject*)cyfunc)->m_self; |
11600 | break; |
11601 | default: |
11602 | return NULL; |
11603 | } |
11604 | if (unlikely(nargs != 1)) { |
11605 | PyErr_Format(PyExc_TypeError, |
11606 | "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)" , |
11607 | def->ml_name, nargs); |
11608 | return NULL; |
11609 | } |
11610 | return def->ml_meth(self, args[0]); |
11611 | } |
11612 | static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) |
11613 | { |
11614 | __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; |
11615 | PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; |
11616 | #if CYTHON_BACKPORT_VECTORCALL |
11617 | Py_ssize_t nargs = (Py_ssize_t)nargsf; |
11618 | #else |
11619 | Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); |
11620 | #endif |
11621 | PyObject *self; |
11622 | switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { |
11623 | case 1: |
11624 | self = args[0]; |
11625 | args += 1; |
11626 | nargs -= 1; |
11627 | break; |
11628 | case 0: |
11629 | self = ((PyCFunctionObject*)cyfunc)->m_self; |
11630 | break; |
11631 | default: |
11632 | return NULL; |
11633 | } |
11634 | return ((_PyCFunctionFastWithKeywords)(void(*)(void))def->ml_meth)(self, args, nargs, kwnames); |
11635 | } |
11636 | static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) |
11637 | { |
11638 | __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; |
11639 | PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; |
11640 | PyTypeObject *cls = (PyTypeObject *) __Pyx_CyFunction_GetClassObj(cyfunc); |
11641 | #if CYTHON_BACKPORT_VECTORCALL |
11642 | Py_ssize_t nargs = (Py_ssize_t)nargsf; |
11643 | #else |
11644 | Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); |
11645 | #endif |
11646 | PyObject *self; |
11647 | switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { |
11648 | case 1: |
11649 | self = args[0]; |
11650 | args += 1; |
11651 | nargs -= 1; |
11652 | break; |
11653 | case 0: |
11654 | self = ((PyCFunctionObject*)cyfunc)->m_self; |
11655 | break; |
11656 | default: |
11657 | return NULL; |
11658 | } |
11659 | return ((__Pyx_PyCMethod)(void(*)(void))def->ml_meth)(self, cls, args, nargs, kwnames); |
11660 | } |
11661 | #endif |
11662 | #if CYTHON_USE_TYPE_SPECS |
11663 | static PyType_Slot __pyx_CyFunctionType_slots[] = { |
11664 | {Py_tp_dealloc, (void *)__Pyx_CyFunction_dealloc}, |
11665 | {Py_tp_repr, (void *)__Pyx_CyFunction_repr}, |
11666 | {Py_tp_call, (void *)__Pyx_CyFunction_CallAsMethod}, |
11667 | {Py_tp_traverse, (void *)__Pyx_CyFunction_traverse}, |
11668 | {Py_tp_clear, (void *)__Pyx_CyFunction_clear}, |
11669 | {Py_tp_methods, (void *)__pyx_CyFunction_methods}, |
11670 | {Py_tp_members, (void *)__pyx_CyFunction_members}, |
11671 | {Py_tp_getset, (void *)__pyx_CyFunction_getsets}, |
11672 | {Py_tp_descr_get, (void *)__Pyx_PyMethod_New}, |
11673 | {0, 0}, |
11674 | }; |
11675 | static PyType_Spec __pyx_CyFunctionType_spec = { |
11676 | __PYX_TYPE_MODULE_PREFIX "cython_function_or_method" , |
11677 | sizeof(__pyx_CyFunctionObject), |
11678 | 0, |
11679 | #ifdef Py_TPFLAGS_METHOD_DESCRIPTOR |
11680 | Py_TPFLAGS_METHOD_DESCRIPTOR | |
11681 | #endif |
11682 | #if (defined(_Py_TPFLAGS_HAVE_VECTORCALL) && CYTHON_METH_FASTCALL) |
11683 | _Py_TPFLAGS_HAVE_VECTORCALL | |
11684 | #endif |
11685 | Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, |
11686 | __pyx_CyFunctionType_slots |
11687 | }; |
11688 | #else |
11689 | static PyTypeObject __pyx_CyFunctionType_type = { |
11690 | PyVarObject_HEAD_INIT(0, 0) |
11691 | __PYX_TYPE_MODULE_PREFIX "cython_function_or_method" , |
11692 | sizeof(__pyx_CyFunctionObject), |
11693 | 0, |
11694 | (destructor) __Pyx_CyFunction_dealloc, |
11695 | #if !CYTHON_METH_FASTCALL |
11696 | 0, |
11697 | #elif CYTHON_BACKPORT_VECTORCALL |
11698 | (printfunc)offsetof(__pyx_CyFunctionObject, func_vectorcall), |
11699 | #else |
11700 | offsetof(PyCFunctionObject, vectorcall), |
11701 | #endif |
11702 | 0, |
11703 | 0, |
11704 | #if PY_MAJOR_VERSION < 3 |
11705 | 0, |
11706 | #else |
11707 | 0, |
11708 | #endif |
11709 | (reprfunc) __Pyx_CyFunction_repr, |
11710 | 0, |
11711 | 0, |
11712 | 0, |
11713 | 0, |
11714 | __Pyx_CyFunction_CallAsMethod, |
11715 | 0, |
11716 | 0, |
11717 | 0, |
11718 | 0, |
11719 | #ifdef Py_TPFLAGS_METHOD_DESCRIPTOR |
11720 | Py_TPFLAGS_METHOD_DESCRIPTOR | |
11721 | #endif |
11722 | #ifdef _Py_TPFLAGS_HAVE_VECTORCALL |
11723 | _Py_TPFLAGS_HAVE_VECTORCALL | |
11724 | #endif |
11725 | Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, |
11726 | 0, |
11727 | (traverseproc) __Pyx_CyFunction_traverse, |
11728 | (inquiry) __Pyx_CyFunction_clear, |
11729 | 0, |
11730 | #if PY_VERSION_HEX < 0x030500A0 |
11731 | offsetof(__pyx_CyFunctionObject, func_weakreflist), |
11732 | #else |
11733 | offsetof(PyCFunctionObject, m_weakreflist), |
11734 | #endif |
11735 | 0, |
11736 | 0, |
11737 | __pyx_CyFunction_methods, |
11738 | __pyx_CyFunction_members, |
11739 | __pyx_CyFunction_getsets, |
11740 | 0, |
11741 | 0, |
11742 | __Pyx_PyMethod_New, |
11743 | 0, |
11744 | offsetof(__pyx_CyFunctionObject, func_dict), |
11745 | 0, |
11746 | 0, |
11747 | 0, |
11748 | 0, |
11749 | 0, |
11750 | 0, |
11751 | 0, |
11752 | 0, |
11753 | 0, |
11754 | 0, |
11755 | 0, |
11756 | 0, |
11757 | #if PY_VERSION_HEX >= 0x030400a1 |
11758 | 0, |
11759 | #endif |
11760 | #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) |
11761 | 0, |
11762 | #endif |
11763 | #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 |
11764 | 0, |
11765 | #endif |
11766 | #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 |
11767 | 0, |
11768 | #endif |
11769 | }; |
11770 | #endif |
11771 | static int __pyx_CyFunction_init(PyObject *module) { |
11772 | #if CYTHON_USE_TYPE_SPECS |
11773 | __pyx_CyFunctionType = __Pyx_FetchCommonTypeFromSpec(module, &__pyx_CyFunctionType_spec, NULL); |
11774 | #else |
11775 | (void) module; |
11776 | __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type); |
11777 | #endif |
11778 | if (unlikely(__pyx_CyFunctionType == NULL)) { |
11779 | return -1; |
11780 | } |
11781 | return 0; |
11782 | } |
11783 | static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) { |
11784 | __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; |
11785 | m->defaults = PyObject_Malloc(size); |
11786 | if (unlikely(!m->defaults)) |
11787 | return PyErr_NoMemory(); |
11788 | memset(m->defaults, 0, size); |
11789 | m->defaults_pyobjects = pyobjects; |
11790 | m->defaults_size = size; |
11791 | return m->defaults; |
11792 | } |
11793 | static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) { |
11794 | __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; |
11795 | m->defaults_tuple = tuple; |
11796 | Py_INCREF(tuple); |
11797 | } |
11798 | static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) { |
11799 | __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; |
11800 | m->defaults_kwdict = dict; |
11801 | Py_INCREF(dict); |
11802 | } |
11803 | static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) { |
11804 | __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; |
11805 | m->func_annotations = dict; |
11806 | Py_INCREF(dict); |
11807 | } |
11808 | |
11809 | /* CythonFunction */ |
11810 | static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname, |
11811 | PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { |
11812 | PyObject *op = __Pyx_CyFunction_Init( |
11813 | PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType), |
11814 | ml, flags, qualname, closure, module, globals, code |
11815 | ); |
11816 | if (likely(op)) { |
11817 | PyObject_GC_Track(op); |
11818 | } |
11819 | return op; |
11820 | } |
11821 | |
11822 | /* CLineInTraceback */ |
11823 | #ifndef CYTHON_CLINE_IN_TRACEBACK |
11824 | static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) { |
11825 | PyObject *use_cline; |
11826 | PyObject *ptype, *pvalue, *ptraceback; |
11827 | #if CYTHON_COMPILING_IN_CPYTHON |
11828 | PyObject **cython_runtime_dict; |
11829 | #endif |
11830 | if (unlikely(!__pyx_cython_runtime)) { |
11831 | return c_line; |
11832 | } |
11833 | __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); |
11834 | #if CYTHON_COMPILING_IN_CPYTHON |
11835 | cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime); |
11836 | if (likely(cython_runtime_dict)) { |
11837 | __PYX_PY_DICT_LOOKUP_IF_MODIFIED( |
11838 | use_cline, *cython_runtime_dict, |
11839 | __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback)) |
11840 | } else |
11841 | #endif |
11842 | { |
11843 | PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStrNoError(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); |
11844 | if (use_cline_obj) { |
11845 | use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True; |
11846 | Py_DECREF(use_cline_obj); |
11847 | } else { |
11848 | PyErr_Clear(); |
11849 | use_cline = NULL; |
11850 | } |
11851 | } |
11852 | if (!use_cline) { |
11853 | c_line = 0; |
11854 | (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); |
11855 | } |
11856 | else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) { |
11857 | c_line = 0; |
11858 | } |
11859 | __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); |
11860 | return c_line; |
11861 | } |
11862 | #endif |
11863 | |
11864 | /* CodeObjectCache */ |
11865 | #if !CYTHON_COMPILING_IN_LIMITED_API |
11866 | static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { |
11867 | int start = 0, mid = 0, end = count - 1; |
11868 | if (end >= 0 && code_line > entries[end].code_line) { |
11869 | return count; |
11870 | } |
11871 | while (start < end) { |
11872 | mid = start + (end - start) / 2; |
11873 | if (code_line < entries[mid].code_line) { |
11874 | end = mid; |
11875 | } else if (code_line > entries[mid].code_line) { |
11876 | start = mid + 1; |
11877 | } else { |
11878 | return mid; |
11879 | } |
11880 | } |
11881 | if (code_line <= entries[mid].code_line) { |
11882 | return mid; |
11883 | } else { |
11884 | return mid + 1; |
11885 | } |
11886 | } |
11887 | static PyCodeObject *__pyx_find_code_object(int code_line) { |
11888 | PyCodeObject* code_object; |
11889 | int pos; |
11890 | if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { |
11891 | return NULL; |
11892 | } |
11893 | pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); |
11894 | if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { |
11895 | return NULL; |
11896 | } |
11897 | code_object = __pyx_code_cache.entries[pos].code_object; |
11898 | Py_INCREF(code_object); |
11899 | return code_object; |
11900 | } |
11901 | static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { |
11902 | int pos, i; |
11903 | __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; |
11904 | if (unlikely(!code_line)) { |
11905 | return; |
11906 | } |
11907 | if (unlikely(!entries)) { |
11908 | entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); |
11909 | if (likely(entries)) { |
11910 | __pyx_code_cache.entries = entries; |
11911 | __pyx_code_cache.max_count = 64; |
11912 | __pyx_code_cache.count = 1; |
11913 | entries[0].code_line = code_line; |
11914 | entries[0].code_object = code_object; |
11915 | Py_INCREF(code_object); |
11916 | } |
11917 | return; |
11918 | } |
11919 | pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); |
11920 | if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { |
11921 | PyCodeObject* tmp = entries[pos].code_object; |
11922 | entries[pos].code_object = code_object; |
11923 | Py_DECREF(tmp); |
11924 | return; |
11925 | } |
11926 | if (__pyx_code_cache.count == __pyx_code_cache.max_count) { |
11927 | int new_max = __pyx_code_cache.max_count + 64; |
11928 | entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( |
11929 | __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry)); |
11930 | if (unlikely(!entries)) { |
11931 | return; |
11932 | } |
11933 | __pyx_code_cache.entries = entries; |
11934 | __pyx_code_cache.max_count = new_max; |
11935 | } |
11936 | for (i=__pyx_code_cache.count; i>pos; i--) { |
11937 | entries[i] = entries[i-1]; |
11938 | } |
11939 | entries[pos].code_line = code_line; |
11940 | entries[pos].code_object = code_object; |
11941 | __pyx_code_cache.count++; |
11942 | Py_INCREF(code_object); |
11943 | } |
11944 | #endif |
11945 | |
11946 | /* AddTraceback */ |
11947 | #include "compile.h" |
11948 | #include "frameobject.h" |
11949 | #include "traceback.h" |
11950 | #if CYTHON_COMPILING_IN_LIMITED_API |
11951 | static void __Pyx_AddTraceback(const char *funcname, int c_line, |
11952 | int py_line, const char *filename) { |
11953 | if (c_line) { |
11954 | (void) __pyx_cfilenm; |
11955 | c_line = __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line); |
11956 | } |
11957 | _PyTraceback_Add(funcname, filename, c_line ? -c_line : py_line); |
11958 | } |
11959 | #else |
11960 | static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( |
11961 | const char *funcname, int c_line, |
11962 | int py_line, const char *filename) { |
11963 | PyCodeObject *py_code = NULL; |
11964 | PyObject *py_funcname = NULL; |
11965 | #if PY_MAJOR_VERSION < 3 |
11966 | PyObject *py_srcfile = NULL; |
11967 | py_srcfile = PyString_FromString(filename); |
11968 | if (!py_srcfile) goto bad; |
11969 | #endif |
11970 | if (c_line) { |
11971 | #if PY_MAJOR_VERSION < 3 |
11972 | py_funcname = PyString_FromFormat( "%s (%s:%d)" , funcname, __pyx_cfilenm, c_line); |
11973 | if (!py_funcname) goto bad; |
11974 | #else |
11975 | py_funcname = PyUnicode_FromFormat( "%s (%s:%d)" , funcname, __pyx_cfilenm, c_line); |
11976 | if (!py_funcname) goto bad; |
11977 | funcname = PyUnicode_AsUTF8(py_funcname); |
11978 | if (!funcname) goto bad; |
11979 | #endif |
11980 | } |
11981 | else { |
11982 | #if PY_MAJOR_VERSION < 3 |
11983 | py_funcname = PyString_FromString(funcname); |
11984 | if (!py_funcname) goto bad; |
11985 | #endif |
11986 | } |
11987 | #if PY_MAJOR_VERSION < 3 |
11988 | py_code = __Pyx_PyCode_New( |
11989 | 0, |
11990 | 0, |
11991 | 0, |
11992 | 0, |
11993 | 0, |
11994 | 0, |
11995 | __pyx_empty_bytes, /*PyObject *code,*/ |
11996 | __pyx_empty_tuple, /*PyObject *consts,*/ |
11997 | __pyx_empty_tuple, /*PyObject *names,*/ |
11998 | __pyx_empty_tuple, /*PyObject *varnames,*/ |
11999 | __pyx_empty_tuple, /*PyObject *freevars,*/ |
12000 | __pyx_empty_tuple, /*PyObject *cellvars,*/ |
12001 | py_srcfile, /*PyObject *filename,*/ |
12002 | py_funcname, /*PyObject *name,*/ |
12003 | py_line, |
12004 | __pyx_empty_bytes /*PyObject *lnotab*/ |
12005 | ); |
12006 | Py_DECREF(py_srcfile); |
12007 | #else |
12008 | py_code = PyCode_NewEmpty(filename, funcname, py_line); |
12009 | #endif |
12010 | Py_XDECREF(py_funcname); // XDECREF since it's only set on Py3 if cline |
12011 | return py_code; |
12012 | bad: |
12013 | Py_XDECREF(py_funcname); |
12014 | #if PY_MAJOR_VERSION < 3 |
12015 | Py_XDECREF(py_srcfile); |
12016 | #endif |
12017 | return NULL; |
12018 | } |
12019 | static void __Pyx_AddTraceback(const char *funcname, int c_line, |
12020 | int py_line, const char *filename) { |
12021 | PyCodeObject *py_code = 0; |
12022 | PyFrameObject *py_frame = 0; |
12023 | PyThreadState *tstate = __Pyx_PyThreadState_Current; |
12024 | if (c_line) { |
12025 | c_line = __Pyx_CLineForTraceback(tstate, c_line); |
12026 | } |
12027 | py_code = __pyx_find_code_object(c_line ? -c_line : py_line); |
12028 | if (!py_code) { |
12029 | py_code = __Pyx_CreateCodeObjectForTraceback( |
12030 | funcname, c_line, py_line, filename); |
12031 | if (!py_code) goto bad; |
12032 | __pyx_insert_code_object(c_line ? -c_line : py_line, py_code); |
12033 | } |
12034 | py_frame = PyFrame_New( |
12035 | tstate, /*PyThreadState *tstate,*/ |
12036 | py_code, /*PyCodeObject *code,*/ |
12037 | __pyx_d, /*PyObject *globals,*/ |
12038 | 0 /*PyObject *locals*/ |
12039 | ); |
12040 | if (!py_frame) goto bad; |
12041 | __Pyx_PyFrame_SetLineNumber(py_frame, py_line); |
12042 | PyTraceBack_Here(py_frame); |
12043 | bad: |
12044 | Py_XDECREF(py_code); |
12045 | Py_XDECREF(py_frame); |
12046 | } |
12047 | #endif |
12048 | |
12049 | #if PY_MAJOR_VERSION < 3 |
12050 | static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { |
12051 | __Pyx_TypeName obj_type_name; |
12052 | if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags); |
12053 | obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); |
12054 | PyErr_Format(PyExc_TypeError, |
12055 | "'" __Pyx_FMT_TYPENAME "' does not have the buffer interface" , |
12056 | obj_type_name); |
12057 | __Pyx_DECREF_TypeName(obj_type_name); |
12058 | return -1; |
12059 | } |
12060 | static void __Pyx_ReleaseBuffer(Py_buffer *view) { |
12061 | PyObject *obj = view->obj; |
12062 | if (!obj) return; |
12063 | if (PyObject_CheckBuffer(obj)) { |
12064 | PyBuffer_Release(view); |
12065 | return; |
12066 | } |
12067 | if ((0)) {} |
12068 | view->obj = NULL; |
12069 | Py_DECREF(obj); |
12070 | } |
12071 | #endif |
12072 | |
12073 | |
12074 | /* CIntFromPyVerify */ |
12075 | #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ |
12076 | __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) |
12077 | #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ |
12078 | __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) |
12079 | #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ |
12080 | {\ |
12081 | func_type value = func_value;\ |
12082 | if (sizeof(target_type) < sizeof(func_type)) {\ |
12083 | if (unlikely(value != (func_type) (target_type) value)) {\ |
12084 | func_type zero = 0;\ |
12085 | if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ |
12086 | return (target_type) -1;\ |
12087 | if (is_unsigned && unlikely(value < zero))\ |
12088 | goto raise_neg_overflow;\ |
12089 | else\ |
12090 | goto raise_overflow;\ |
12091 | }\ |
12092 | }\ |
12093 | return (target_type) value;\ |
12094 | } |
12095 | |
12096 | /* Declarations */ |
12097 | #if CYTHON_CCOMPLEX |
12098 | #ifdef __cplusplus |
12099 | static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { |
12100 | return ::std::complex< float >(x, y); |
12101 | } |
12102 | #else |
12103 | static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { |
12104 | return x + y*(__pyx_t_float_complex)_Complex_I; |
12105 | } |
12106 | #endif |
12107 | #else |
12108 | static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { |
12109 | __pyx_t_float_complex z; |
12110 | z.real = x; |
12111 | z.imag = y; |
12112 | return z; |
12113 | } |
12114 | #endif |
12115 | |
12116 | /* Arithmetic */ |
12117 | #if CYTHON_CCOMPLEX |
12118 | #else |
12119 | static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { |
12120 | return (a.real == b.real) && (a.imag == b.imag); |
12121 | } |
12122 | static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { |
12123 | __pyx_t_float_complex z; |
12124 | z.real = a.real + b.real; |
12125 | z.imag = a.imag + b.imag; |
12126 | return z; |
12127 | } |
12128 | static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { |
12129 | __pyx_t_float_complex z; |
12130 | z.real = a.real - b.real; |
12131 | z.imag = a.imag - b.imag; |
12132 | return z; |
12133 | } |
12134 | static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { |
12135 | __pyx_t_float_complex z; |
12136 | z.real = a.real * b.real - a.imag * b.imag; |
12137 | z.imag = a.real * b.imag + a.imag * b.real; |
12138 | return z; |
12139 | } |
12140 | #if 1 |
12141 | static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { |
12142 | if (b.imag == 0) { |
12143 | return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real); |
12144 | } else if (fabsf(b.real) >= fabsf(b.imag)) { |
12145 | if (b.real == 0 && b.imag == 0) { |
12146 | return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag); |
12147 | } else { |
12148 | float r = b.imag / b.real; |
12149 | float s = (float)(1.0) / (b.real + b.imag * r); |
12150 | return __pyx_t_float_complex_from_parts( |
12151 | (a.real + a.imag * r) * s, (a.imag - a.real * r) * s); |
12152 | } |
12153 | } else { |
12154 | float r = b.real / b.imag; |
12155 | float s = (float)(1.0) / (b.imag + b.real * r); |
12156 | return __pyx_t_float_complex_from_parts( |
12157 | (a.real * r + a.imag) * s, (a.imag * r - a.real) * s); |
12158 | } |
12159 | } |
12160 | #else |
12161 | static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { |
12162 | if (b.imag == 0) { |
12163 | return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real); |
12164 | } else { |
12165 | float denom = b.real * b.real + b.imag * b.imag; |
12166 | return __pyx_t_float_complex_from_parts( |
12167 | (a.real * b.real + a.imag * b.imag) / denom, |
12168 | (a.imag * b.real - a.real * b.imag) / denom); |
12169 | } |
12170 | } |
12171 | #endif |
12172 | static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) { |
12173 | __pyx_t_float_complex z; |
12174 | z.real = -a.real; |
12175 | z.imag = -a.imag; |
12176 | return z; |
12177 | } |
12178 | static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) { |
12179 | return (a.real == 0) && (a.imag == 0); |
12180 | } |
12181 | static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) { |
12182 | __pyx_t_float_complex z; |
12183 | z.real = a.real; |
12184 | z.imag = -a.imag; |
12185 | return z; |
12186 | } |
12187 | #if 1 |
12188 | static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) { |
12189 | #if !defined(HAVE_HYPOT) || defined(_MSC_VER) |
12190 | return sqrtf(z.real*z.real + z.imag*z.imag); |
12191 | #else |
12192 | return hypotf(z.real, z.imag); |
12193 | #endif |
12194 | } |
12195 | static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { |
12196 | __pyx_t_float_complex z; |
12197 | float r, lnr, theta, z_r, z_theta; |
12198 | if (b.imag == 0 && b.real == (int)b.real) { |
12199 | if (b.real < 0) { |
12200 | float denom = a.real * a.real + a.imag * a.imag; |
12201 | a.real = a.real / denom; |
12202 | a.imag = -a.imag / denom; |
12203 | b.real = -b.real; |
12204 | } |
12205 | switch ((int)b.real) { |
12206 | case 0: |
12207 | z.real = 1; |
12208 | z.imag = 0; |
12209 | return z; |
12210 | case 1: |
12211 | return a; |
12212 | case 2: |
12213 | return __Pyx_c_prod_float(a, a); |
12214 | case 3: |
12215 | z = __Pyx_c_prod_float(a, a); |
12216 | return __Pyx_c_prod_float(z, a); |
12217 | case 4: |
12218 | z = __Pyx_c_prod_float(a, a); |
12219 | return __Pyx_c_prod_float(z, z); |
12220 | } |
12221 | } |
12222 | if (a.imag == 0) { |
12223 | if (a.real == 0) { |
12224 | return a; |
12225 | } else if (b.imag == 0) { |
12226 | z.real = powf(a.real, b.real); |
12227 | z.imag = 0; |
12228 | return z; |
12229 | } else if (a.real > 0) { |
12230 | r = a.real; |
12231 | theta = 0; |
12232 | } else { |
12233 | r = -a.real; |
12234 | theta = atan2f(0.0, -1.0); |
12235 | } |
12236 | } else { |
12237 | r = __Pyx_c_abs_float(a); |
12238 | theta = atan2f(a.imag, a.real); |
12239 | } |
12240 | lnr = logf(r); |
12241 | z_r = expf(lnr * b.real - theta * b.imag); |
12242 | z_theta = theta * b.real + lnr * b.imag; |
12243 | z.real = z_r * cosf(z_theta); |
12244 | z.imag = z_r * sinf(z_theta); |
12245 | return z; |
12246 | } |
12247 | #endif |
12248 | #endif |
12249 | |
12250 | /* Declarations */ |
12251 | #if CYTHON_CCOMPLEX |
12252 | #ifdef __cplusplus |
12253 | static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { |
12254 | return ::std::complex< double >(x, y); |
12255 | } |
12256 | #else |
12257 | static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { |
12258 | return x + y*(__pyx_t_double_complex)_Complex_I; |
12259 | } |
12260 | #endif |
12261 | #else |
12262 | static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { |
12263 | __pyx_t_double_complex z; |
12264 | z.real = x; |
12265 | z.imag = y; |
12266 | return z; |
12267 | } |
12268 | #endif |
12269 | |
12270 | /* Arithmetic */ |
12271 | #if CYTHON_CCOMPLEX |
12272 | #else |
12273 | static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { |
12274 | return (a.real == b.real) && (a.imag == b.imag); |
12275 | } |
12276 | static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { |
12277 | __pyx_t_double_complex z; |
12278 | z.real = a.real + b.real; |
12279 | z.imag = a.imag + b.imag; |
12280 | return z; |
12281 | } |
12282 | static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { |
12283 | __pyx_t_double_complex z; |
12284 | z.real = a.real - b.real; |
12285 | z.imag = a.imag - b.imag; |
12286 | return z; |
12287 | } |
12288 | static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { |
12289 | __pyx_t_double_complex z; |
12290 | z.real = a.real * b.real - a.imag * b.imag; |
12291 | z.imag = a.real * b.imag + a.imag * b.real; |
12292 | return z; |
12293 | } |
12294 | #if 1 |
12295 | static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { |
12296 | if (b.imag == 0) { |
12297 | return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real); |
12298 | } else if (fabs(b.real) >= fabs(b.imag)) { |
12299 | if (b.real == 0 && b.imag == 0) { |
12300 | return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag); |
12301 | } else { |
12302 | double r = b.imag / b.real; |
12303 | double s = (double)(1.0) / (b.real + b.imag * r); |
12304 | return __pyx_t_double_complex_from_parts( |
12305 | (a.real + a.imag * r) * s, (a.imag - a.real * r) * s); |
12306 | } |
12307 | } else { |
12308 | double r = b.real / b.imag; |
12309 | double s = (double)(1.0) / (b.imag + b.real * r); |
12310 | return __pyx_t_double_complex_from_parts( |
12311 | (a.real * r + a.imag) * s, (a.imag * r - a.real) * s); |
12312 | } |
12313 | } |
12314 | #else |
12315 | static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { |
12316 | if (b.imag == 0) { |
12317 | return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real); |
12318 | } else { |
12319 | double denom = b.real * b.real + b.imag * b.imag; |
12320 | return __pyx_t_double_complex_from_parts( |
12321 | (a.real * b.real + a.imag * b.imag) / denom, |
12322 | (a.imag * b.real - a.real * b.imag) / denom); |
12323 | } |
12324 | } |
12325 | #endif |
12326 | static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) { |
12327 | __pyx_t_double_complex z; |
12328 | z.real = -a.real; |
12329 | z.imag = -a.imag; |
12330 | return z; |
12331 | } |
12332 | static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) { |
12333 | return (a.real == 0) && (a.imag == 0); |
12334 | } |
12335 | static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) { |
12336 | __pyx_t_double_complex z; |
12337 | z.real = a.real; |
12338 | z.imag = -a.imag; |
12339 | return z; |
12340 | } |
12341 | #if 1 |
12342 | static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) { |
12343 | #if !defined(HAVE_HYPOT) || defined(_MSC_VER) |
12344 | return sqrt(z.real*z.real + z.imag*z.imag); |
12345 | #else |
12346 | return hypot(z.real, z.imag); |
12347 | #endif |
12348 | } |
12349 | static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { |
12350 | __pyx_t_double_complex z; |
12351 | double r, lnr, theta, z_r, z_theta; |
12352 | if (b.imag == 0 && b.real == (int)b.real) { |
12353 | if (b.real < 0) { |
12354 | double denom = a.real * a.real + a.imag * a.imag; |
12355 | a.real = a.real / denom; |
12356 | a.imag = -a.imag / denom; |
12357 | b.real = -b.real; |
12358 | } |
12359 | switch ((int)b.real) { |
12360 | case 0: |
12361 | z.real = 1; |
12362 | z.imag = 0; |
12363 | return z; |
12364 | case 1: |
12365 | return a; |
12366 | case 2: |
12367 | return __Pyx_c_prod_double(a, a); |
12368 | case 3: |
12369 | z = __Pyx_c_prod_double(a, a); |
12370 | return __Pyx_c_prod_double(z, a); |
12371 | case 4: |
12372 | z = __Pyx_c_prod_double(a, a); |
12373 | return __Pyx_c_prod_double(z, z); |
12374 | } |
12375 | } |
12376 | if (a.imag == 0) { |
12377 | if (a.real == 0) { |
12378 | return a; |
12379 | } else if (b.imag == 0) { |
12380 | z.real = pow(a.real, b.real); |
12381 | z.imag = 0; |
12382 | return z; |
12383 | } else if (a.real > 0) { |
12384 | r = a.real; |
12385 | theta = 0; |
12386 | } else { |
12387 | r = -a.real; |
12388 | theta = atan2(0.0, -1.0); |
12389 | } |
12390 | } else { |
12391 | r = __Pyx_c_abs_double(a); |
12392 | theta = atan2(a.imag, a.real); |
12393 | } |
12394 | lnr = log(r); |
12395 | z_r = exp(lnr * b.real - theta * b.imag); |
12396 | z_theta = theta * b.real + lnr * b.imag; |
12397 | z.real = z_r * cos(z_theta); |
12398 | z.imag = z_r * sin(z_theta); |
12399 | return z; |
12400 | } |
12401 | #endif |
12402 | #endif |
12403 | |
12404 | /* CIntToPy */ |
12405 | static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { |
12406 | #ifdef __Pyx_HAS_GCC_DIAGNOSTIC |
12407 | #pragma GCC diagnostic push |
12408 | #pragma GCC diagnostic ignored "-Wconversion" |
12409 | #endif |
12410 | const long neg_one = (long) -1, const_zero = (long) 0; |
12411 | #ifdef __Pyx_HAS_GCC_DIAGNOSTIC |
12412 | #pragma GCC diagnostic pop |
12413 | #endif |
12414 | const int is_unsigned = neg_one > const_zero; |
12415 | if (is_unsigned) { |
12416 | if (sizeof(long) < sizeof(long)) { |
12417 | return PyInt_FromLong((long) value); |
12418 | } else if (sizeof(long) <= sizeof(unsigned long)) { |
12419 | return PyLong_FromUnsignedLong((unsigned long) value); |
12420 | #ifdef HAVE_LONG_LONG |
12421 | } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { |
12422 | return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); |
12423 | #endif |
12424 | } |
12425 | } else { |
12426 | if (sizeof(long) <= sizeof(long)) { |
12427 | return PyInt_FromLong((long) value); |
12428 | #ifdef HAVE_LONG_LONG |
12429 | } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { |
12430 | return PyLong_FromLongLong((PY_LONG_LONG) value); |
12431 | #endif |
12432 | } |
12433 | } |
12434 | { |
12435 | int one = 1; int little = (int)*(unsigned char *)&one; |
12436 | unsigned char *bytes = (unsigned char *)&value; |
12437 | return _PyLong_FromByteArray(bytes, sizeof(long), |
12438 | little, !is_unsigned); |
12439 | } |
12440 | } |
12441 | |
12442 | /* CIntFromPy */ |
12443 | static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { |
12444 | #ifdef __Pyx_HAS_GCC_DIAGNOSTIC |
12445 | #pragma GCC diagnostic push |
12446 | #pragma GCC diagnostic ignored "-Wconversion" |
12447 | #endif |
12448 | const long neg_one = (long) -1, const_zero = (long) 0; |
12449 | #ifdef __Pyx_HAS_GCC_DIAGNOSTIC |
12450 | #pragma GCC diagnostic pop |
12451 | #endif |
12452 | const int is_unsigned = neg_one > const_zero; |
12453 | #if PY_MAJOR_VERSION < 3 |
12454 | if (likely(PyInt_Check(x))) { |
12455 | if ((sizeof(long) < sizeof(long))) { |
12456 | __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) |
12457 | } else { |
12458 | long val = PyInt_AS_LONG(x); |
12459 | if (is_unsigned && unlikely(val < 0)) { |
12460 | goto raise_neg_overflow; |
12461 | } |
12462 | return (long) val; |
12463 | } |
12464 | } else |
12465 | #endif |
12466 | if (likely(PyLong_Check(x))) { |
12467 | if (is_unsigned) { |
12468 | #if CYTHON_USE_PYLONG_INTERNALS |
12469 | const digit* digits = ((PyLongObject*)x)->ob_digit; |
12470 | switch (Py_SIZE(x)) { |
12471 | case 0: return (long) 0; |
12472 | case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0]) |
12473 | case 2: |
12474 | if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { |
12475 | if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { |
12476 | __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) |
12477 | } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) { |
12478 | return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); |
12479 | } |
12480 | } |
12481 | break; |
12482 | case 3: |
12483 | if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { |
12484 | if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { |
12485 | __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) |
12486 | } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) { |
12487 | return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); |
12488 | } |
12489 | } |
12490 | break; |
12491 | case 4: |
12492 | if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { |
12493 | if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { |
12494 | __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]))) |
12495 | } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) { |
12496 | return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); |
12497 | } |
12498 | } |
12499 | break; |
12500 | } |
12501 | #endif |
12502 | #if CYTHON_COMPILING_IN_CPYTHON |
12503 | if (unlikely(Py_SIZE(x) < 0)) { |
12504 | goto raise_neg_overflow; |
12505 | } |
12506 | #else |
12507 | { |
12508 | int result = PyObject_RichCompareBool(x, Py_False, Py_LT); |
12509 | if (unlikely(result < 0)) |
12510 | return (long) -1; |
12511 | if (unlikely(result == 1)) |
12512 | goto raise_neg_overflow; |
12513 | } |
12514 | #endif |
12515 | if ((sizeof(long) <= sizeof(unsigned long))) { |
12516 | __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) |
12517 | #ifdef HAVE_LONG_LONG |
12518 | } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) { |
12519 | __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) |
12520 | #endif |
12521 | } |
12522 | } else { |
12523 | #if CYTHON_USE_PYLONG_INTERNALS |
12524 | const digit* digits = ((PyLongObject*)x)->ob_digit; |
12525 | switch (Py_SIZE(x)) { |
12526 | case 0: return (long) 0; |
12527 | case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0])) |
12528 | case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0]) |
12529 | case -2: |
12530 | if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) { |
12531 | if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { |
12532 | __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) |
12533 | } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { |
12534 | return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); |
12535 | } |
12536 | } |
12537 | break; |
12538 | case 2: |
12539 | if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { |
12540 | if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { |
12541 | __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) |
12542 | } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { |
12543 | return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); |
12544 | } |
12545 | } |
12546 | break; |
12547 | case -3: |
12548 | if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { |
12549 | if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { |
12550 | __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) |
12551 | } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { |
12552 | return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); |
12553 | } |
12554 | } |
12555 | break; |
12556 | case 3: |
12557 | if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { |
12558 | if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { |
12559 | __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) |
12560 | } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { |
12561 | return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); |
12562 | } |
12563 | } |
12564 | break; |
12565 | case -4: |
12566 | if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { |
12567 | if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { |
12568 | __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]))) |
12569 | } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { |
12570 | return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); |
12571 | } |
12572 | } |
12573 | break; |
12574 | case 4: |
12575 | if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { |
12576 | if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { |
12577 | __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]))) |
12578 | } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { |
12579 | return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); |
12580 | } |
12581 | } |
12582 | break; |
12583 | } |
12584 | #endif |
12585 | if ((sizeof(long) <= sizeof(long))) { |
12586 | __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) |
12587 | #ifdef HAVE_LONG_LONG |
12588 | } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) { |
12589 | __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) |
12590 | #endif |
12591 | } |
12592 | } |
12593 | { |
12594 | #if (CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) && !defined(_PyLong_AsByteArray) |
12595 | PyErr_SetString(PyExc_RuntimeError, |
12596 | "_PyLong_AsByteArray() not available, cannot convert large numbers" ); |
12597 | #else |
12598 | long val; |
12599 | PyObject *v = __Pyx_PyNumber_IntOrLong(x); |
12600 | #if PY_MAJOR_VERSION < 3 |
12601 | if (likely(v) && !PyLong_Check(v)) { |
12602 | PyObject *tmp = v; |
12603 | v = PyNumber_Long(tmp); |
12604 | Py_DECREF(tmp); |
12605 | } |
12606 | #endif |
12607 | if (likely(v)) { |
12608 | int one = 1; int is_little = (int)*(unsigned char *)&one; |
12609 | unsigned char *bytes = (unsigned char *)&val; |
12610 | int ret = _PyLong_AsByteArray((PyLongObject *)v, |
12611 | bytes, sizeof(val), |
12612 | is_little, !is_unsigned); |
12613 | Py_DECREF(v); |
12614 | if (likely(!ret)) |
12615 | return val; |
12616 | } |
12617 | #endif |
12618 | return (long) -1; |
12619 | } |
12620 | } else { |
12621 | long val; |
12622 | PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); |
12623 | if (!tmp) return (long) -1; |
12624 | val = __Pyx_PyInt_As_long(tmp); |
12625 | Py_DECREF(tmp); |
12626 | return val; |
12627 | } |
12628 | raise_overflow: |
12629 | PyErr_SetString(PyExc_OverflowError, |
12630 | "value too large to convert to long" ); |
12631 | return (long) -1; |
12632 | raise_neg_overflow: |
12633 | PyErr_SetString(PyExc_OverflowError, |
12634 | "can't convert negative value to long" ); |
12635 | return (long) -1; |
12636 | } |
12637 | |
12638 | /* CIntToPy */ |
12639 | static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_uint16(npy_uint16 value) { |
12640 | #ifdef __Pyx_HAS_GCC_DIAGNOSTIC |
12641 | #pragma GCC diagnostic push |
12642 | #pragma GCC diagnostic ignored "-Wconversion" |
12643 | #endif |
12644 | const npy_uint16 neg_one = (npy_uint16) -1, const_zero = (npy_uint16) 0; |
12645 | #ifdef __Pyx_HAS_GCC_DIAGNOSTIC |
12646 | #pragma GCC diagnostic pop |
12647 | #endif |
12648 | const int is_unsigned = neg_one > const_zero; |
12649 | if (is_unsigned) { |
12650 | if (sizeof(npy_uint16) < sizeof(long)) { |
12651 | return PyInt_FromLong((long) value); |
12652 | } else if (sizeof(npy_uint16) <= sizeof(unsigned long)) { |
12653 | return PyLong_FromUnsignedLong((unsigned long) value); |
12654 | #ifdef HAVE_LONG_LONG |
12655 | } else if (sizeof(npy_uint16) <= sizeof(unsigned PY_LONG_LONG)) { |
12656 | return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); |
12657 | #endif |
12658 | } |
12659 | } else { |
12660 | if (sizeof(npy_uint16) <= sizeof(long)) { |
12661 | return PyInt_FromLong((long) value); |
12662 | #ifdef HAVE_LONG_LONG |
12663 | } else if (sizeof(npy_uint16) <= sizeof(PY_LONG_LONG)) { |
12664 | return PyLong_FromLongLong((PY_LONG_LONG) value); |
12665 | #endif |
12666 | } |
12667 | } |
12668 | { |
12669 | int one = 1; int little = (int)*(unsigned char *)&one; |
12670 | unsigned char *bytes = (unsigned char *)&value; |
12671 | return _PyLong_FromByteArray(bytes, sizeof(npy_uint16), |
12672 | little, !is_unsigned); |
12673 | } |
12674 | } |
12675 | |
12676 | /* CIntToPy */ |
12677 | static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_int32(npy_int32 value) { |
12678 | #ifdef __Pyx_HAS_GCC_DIAGNOSTIC |
12679 | #pragma GCC diagnostic push |
12680 | #pragma GCC diagnostic ignored "-Wconversion" |
12681 | #endif |
12682 | const npy_int32 neg_one = (npy_int32) -1, const_zero = (npy_int32) 0; |
12683 | #ifdef __Pyx_HAS_GCC_DIAGNOSTIC |
12684 | #pragma GCC diagnostic pop |
12685 | #endif |
12686 | const int is_unsigned = neg_one > const_zero; |
12687 | if (is_unsigned) { |
12688 | if (sizeof(npy_int32) < sizeof(long)) { |
12689 | return PyInt_FromLong((long) value); |
12690 | } else if (sizeof(npy_int32) <= sizeof(unsigned long)) { |
12691 | return PyLong_FromUnsignedLong((unsigned long) value); |
12692 | #ifdef HAVE_LONG_LONG |
12693 | } else if (sizeof(npy_int32) <= sizeof(unsigned PY_LONG_LONG)) { |
12694 | return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); |
12695 | #endif |
12696 | } |
12697 | } else { |
12698 | if (sizeof(npy_int32) <= sizeof(long)) { |
12699 | return PyInt_FromLong((long) value); |
12700 | #ifdef HAVE_LONG_LONG |
12701 | } else if (sizeof(npy_int32) <= sizeof(PY_LONG_LONG)) { |
12702 | return PyLong_FromLongLong((PY_LONG_LONG) value); |
12703 | #endif |
12704 | } |
12705 | } |
12706 | { |
12707 | int one = 1; int little = (int)*(unsigned char *)&one; |
12708 | unsigned char *bytes = (unsigned char *)&value; |
12709 | return _PyLong_FromByteArray(bytes, sizeof(npy_int32), |
12710 | little, !is_unsigned); |
12711 | } |
12712 | } |
12713 | |
12714 | /* CIntToPy */ |
12715 | static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_uint32(npy_uint32 value) { |
12716 | #ifdef __Pyx_HAS_GCC_DIAGNOSTIC |
12717 | #pragma GCC diagnostic push |
12718 | #pragma GCC diagnostic ignored "-Wconversion" |
12719 | #endif |
12720 | const npy_uint32 neg_one = (npy_uint32) -1, const_zero = (npy_uint32) 0; |
12721 | #ifdef __Pyx_HAS_GCC_DIAGNOSTIC |
12722 | #pragma GCC diagnostic pop |
12723 | #endif |
12724 | const int is_unsigned = neg_one > const_zero; |
12725 | if (is_unsigned) { |
12726 | if (sizeof(npy_uint32) < sizeof(long)) { |
12727 | return PyInt_FromLong((long) value); |
12728 | } else if (sizeof(npy_uint32) <= sizeof(unsigned long)) { |
12729 | return PyLong_FromUnsignedLong((unsigned long) value); |
12730 | #ifdef HAVE_LONG_LONG |
12731 | } else if (sizeof(npy_uint32) <= sizeof(unsigned PY_LONG_LONG)) { |
12732 | return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); |
12733 | #endif |
12734 | } |
12735 | } else { |
12736 | if (sizeof(npy_uint32) <= sizeof(long)) { |
12737 | return PyInt_FromLong((long) value); |
12738 | #ifdef HAVE_LONG_LONG |
12739 | } else if (sizeof(npy_uint32) <= sizeof(PY_LONG_LONG)) { |
12740 | return PyLong_FromLongLong((PY_LONG_LONG) value); |
12741 | #endif |
12742 | } |
12743 | } |
12744 | { |
12745 | int one = 1; int little = (int)*(unsigned char *)&one; |
12746 | unsigned char *bytes = (unsigned char *)&value; |
12747 | return _PyLong_FromByteArray(bytes, sizeof(npy_uint32), |
12748 | little, !is_unsigned); |
12749 | } |
12750 | } |
12751 | |
12752 | /* CIntToPy */ |
12753 | static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_int64(npy_int64 value) { |
12754 | #ifdef __Pyx_HAS_GCC_DIAGNOSTIC |
12755 | #pragma GCC diagnostic push |
12756 | #pragma GCC diagnostic ignored "-Wconversion" |
12757 | #endif |
12758 | const npy_int64 neg_one = (npy_int64) -1, const_zero = (npy_int64) 0; |
12759 | #ifdef __Pyx_HAS_GCC_DIAGNOSTIC |
12760 | #pragma GCC diagnostic pop |
12761 | #endif |
12762 | const int is_unsigned = neg_one > const_zero; |
12763 | if (is_unsigned) { |
12764 | if (sizeof(npy_int64) < sizeof(long)) { |
12765 | return PyInt_FromLong((long) value); |
12766 | } else if (sizeof(npy_int64) <= sizeof(unsigned long)) { |
12767 | return PyLong_FromUnsignedLong((unsigned long) value); |
12768 | #ifdef HAVE_LONG_LONG |
12769 | } else if (sizeof(npy_int64) <= sizeof(unsigned PY_LONG_LONG)) { |
12770 | return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); |
12771 | #endif |
12772 | } |
12773 | } else { |
12774 | if (sizeof(npy_int64) <= sizeof(long)) { |
12775 | return PyInt_FromLong((long) value); |
12776 | #ifdef HAVE_LONG_LONG |
12777 | } else if (sizeof(npy_int64) <= sizeof(PY_LONG_LONG)) { |
12778 | return PyLong_FromLongLong((PY_LONG_LONG) value); |
12779 | #endif |
12780 | } |
12781 | } |
12782 | { |
12783 | int one = 1; int little = (int)*(unsigned char *)&one; |
12784 | unsigned char *bytes = (unsigned char *)&value; |
12785 | return _PyLong_FromByteArray(bytes, sizeof(npy_int64), |
12786 | little, !is_unsigned); |
12787 | } |
12788 | } |
12789 | |
12790 | /* CIntToPy */ |
12791 | static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_uint64(npy_uint64 value) { |
12792 | #ifdef __Pyx_HAS_GCC_DIAGNOSTIC |
12793 | #pragma GCC diagnostic push |
12794 | #pragma GCC diagnostic ignored "-Wconversion" |
12795 | #endif |
12796 | const npy_uint64 neg_one = (npy_uint64) -1, const_zero = (npy_uint64) 0; |
12797 | #ifdef __Pyx_HAS_GCC_DIAGNOSTIC |
12798 | #pragma GCC diagnostic pop |
12799 | #endif |
12800 | const int is_unsigned = neg_one > const_zero; |
12801 | if (is_unsigned) { |
12802 | if (sizeof(npy_uint64) < sizeof(long)) { |
12803 | return PyInt_FromLong((long) value); |
12804 | } else if (sizeof(npy_uint64) <= sizeof(unsigned long)) { |
12805 | return PyLong_FromUnsignedLong((unsigned long) value); |
12806 | #ifdef HAVE_LONG_LONG |
12807 | } else if (sizeof(npy_uint64) <= sizeof(unsigned PY_LONG_LONG)) { |
12808 | return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); |
12809 | #endif |
12810 | } |
12811 | } else { |
12812 | if (sizeof(npy_uint64) <= sizeof(long)) { |
12813 | return PyInt_FromLong((long) value); |
12814 | #ifdef HAVE_LONG_LONG |
12815 | } else if (sizeof(npy_uint64) <= sizeof(PY_LONG_LONG)) { |
12816 | return PyLong_FromLongLong((PY_LONG_LONG) value); |
12817 | #endif |
12818 | } |
12819 | } |
12820 | { |
12821 | int one = 1; int little = (int)*(unsigned char *)&one; |
12822 | unsigned char *bytes = (unsigned char *)&value; |
12823 | return _PyLong_FromByteArray(bytes, sizeof(npy_uint64), |
12824 | little, !is_unsigned); |
12825 | } |
12826 | } |
12827 | |
12828 | /* CIntToPy */ |
12829 | static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_uint8(npy_uint8 value) { |
12830 | #ifdef __Pyx_HAS_GCC_DIAGNOSTIC |
12831 | #pragma GCC diagnostic push |
12832 | #pragma GCC diagnostic ignored "-Wconversion" |
12833 | #endif |
12834 | const npy_uint8 neg_one = (npy_uint8) -1, const_zero = (npy_uint8) 0; |
12835 | #ifdef __Pyx_HAS_GCC_DIAGNOSTIC |
12836 | #pragma GCC diagnostic pop |
12837 | #endif |
12838 | const int is_unsigned = neg_one > const_zero; |
12839 | if (is_unsigned) { |
12840 | if (sizeof(npy_uint8) < sizeof(long)) { |
12841 | return PyInt_FromLong((long) value); |
12842 | } else if (sizeof(npy_uint8) <= sizeof(unsigned long)) { |
12843 | return PyLong_FromUnsignedLong((unsigned long) value); |
12844 | #ifdef HAVE_LONG_LONG |
12845 | } else if (sizeof(npy_uint8) <= sizeof(unsigned PY_LONG_LONG)) { |
12846 | return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); |
12847 | #endif |
12848 | } |
12849 | } else { |
12850 | if (sizeof(npy_uint8) <= sizeof(long)) { |
12851 | return PyInt_FromLong((long) value); |
12852 | #ifdef HAVE_LONG_LONG |
12853 | } else if (sizeof(npy_uint8) <= sizeof(PY_LONG_LONG)) { |
12854 | return PyLong_FromLongLong((PY_LONG_LONG) value); |
12855 | #endif |
12856 | } |
12857 | } |
12858 | { |
12859 | int one = 1; int little = (int)*(unsigned char *)&one; |
12860 | unsigned char *bytes = (unsigned char *)&value; |
12861 | return _PyLong_FromByteArray(bytes, sizeof(npy_uint8), |
12862 | little, !is_unsigned); |
12863 | } |
12864 | } |
12865 | |
12866 | /* CIntToPy */ |
12867 | static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_int16(npy_int16 value) { |
12868 | #ifdef __Pyx_HAS_GCC_DIAGNOSTIC |
12869 | #pragma GCC diagnostic push |
12870 | #pragma GCC diagnostic ignored "-Wconversion" |
12871 | #endif |
12872 | const npy_int16 neg_one = (npy_int16) -1, const_zero = (npy_int16) 0; |
12873 | #ifdef __Pyx_HAS_GCC_DIAGNOSTIC |
12874 | #pragma GCC diagnostic pop |
12875 | #endif |
12876 | const int is_unsigned = neg_one > const_zero; |
12877 | if (is_unsigned) { |
12878 | if (sizeof(npy_int16) < sizeof(long)) { |
12879 | return PyInt_FromLong((long) value); |
12880 | } else if (sizeof(npy_int16) <= sizeof(unsigned long)) { |
12881 | return PyLong_FromUnsignedLong((unsigned long) value); |
12882 | #ifdef HAVE_LONG_LONG |
12883 | } else if (sizeof(npy_int16) <= sizeof(unsigned PY_LONG_LONG)) { |
12884 | return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); |
12885 | #endif |
12886 | } |
12887 | } else { |
12888 | if (sizeof(npy_int16) <= sizeof(long)) { |
12889 | return PyInt_FromLong((long) value); |
12890 | #ifdef HAVE_LONG_LONG |
12891 | } else if (sizeof(npy_int16) <= sizeof(PY_LONG_LONG)) { |
12892 | return PyLong_FromLongLong((PY_LONG_LONG) value); |
12893 | #endif |
12894 | } |
12895 | } |
12896 | { |
12897 | int one = 1; int little = (int)*(unsigned char *)&one; |
12898 | unsigned char *bytes = (unsigned char *)&value; |
12899 | return _PyLong_FromByteArray(bytes, sizeof(npy_int16), |
12900 | little, !is_unsigned); |
12901 | } |
12902 | } |
12903 | |
12904 | /* CIntToPy */ |
12905 | static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_int8(npy_int8 value) { |
12906 | #ifdef __Pyx_HAS_GCC_DIAGNOSTIC |
12907 | #pragma GCC diagnostic push |
12908 | #pragma GCC diagnostic ignored "-Wconversion" |
12909 | #endif |
12910 | const npy_int8 neg_one = (npy_int8) -1, const_zero = (npy_int8) 0; |
12911 | #ifdef __Pyx_HAS_GCC_DIAGNOSTIC |
12912 | #pragma GCC diagnostic pop |
12913 | #endif |
12914 | const int is_unsigned = neg_one > const_zero; |
12915 | if (is_unsigned) { |
12916 | if (sizeof(npy_int8) < sizeof(long)) { |
12917 | return PyInt_FromLong((long) value); |
12918 | } else if (sizeof(npy_int8) <= sizeof(unsigned long)) { |
12919 | return PyLong_FromUnsignedLong((unsigned long) value); |
12920 | #ifdef HAVE_LONG_LONG |
12921 | } else if (sizeof(npy_int8) <= sizeof(unsigned PY_LONG_LONG)) { |
12922 | return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); |
12923 | #endif |
12924 | } |
12925 | } else { |
12926 | if (sizeof(npy_int8) <= sizeof(long)) { |
12927 | return PyInt_FromLong((long) value); |
12928 | #ifdef HAVE_LONG_LONG |
12929 | } else if (sizeof(npy_int8) <= sizeof(PY_LONG_LONG)) { |
12930 | return PyLong_FromLongLong((PY_LONG_LONG) value); |
12931 | #endif |
12932 | } |
12933 | } |
12934 | { |
12935 | int one = 1; int little = (int)*(unsigned char *)&one; |
12936 | unsigned char *bytes = (unsigned char *)&value; |
12937 | return _PyLong_FromByteArray(bytes, sizeof(npy_int8), |
12938 | little, !is_unsigned); |
12939 | } |
12940 | } |
12941 | |
12942 | /* FormatTypeName */ |
12943 | #if CYTHON_COMPILING_IN_LIMITED_API |
12944 | static __Pyx_TypeName |
12945 | __Pyx_PyType_GetName(PyTypeObject* tp) |
12946 | { |
12947 | PyObject *name = __Pyx_PyObject_GetAttrStr((PyObject *)tp, |
12948 | __pyx_n_s_name); |
12949 | if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) { |
12950 | PyErr_Clear(); |
12951 | Py_XSETREF(name, __Pyx_NewRef(__pyx_n_s__22)); |
12952 | } |
12953 | return name; |
12954 | } |
12955 | #endif |
12956 | |
12957 | /* CIntFromPy */ |
12958 | static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { |
12959 | #ifdef __Pyx_HAS_GCC_DIAGNOSTIC |
12960 | #pragma GCC diagnostic push |
12961 | #pragma GCC diagnostic ignored "-Wconversion" |
12962 | #endif |
12963 | const int neg_one = (int) -1, const_zero = (int) 0; |
12964 | #ifdef __Pyx_HAS_GCC_DIAGNOSTIC |
12965 | #pragma GCC diagnostic pop |
12966 | #endif |
12967 | const int is_unsigned = neg_one > const_zero; |
12968 | #if PY_MAJOR_VERSION < 3 |
12969 | if (likely(PyInt_Check(x))) { |
12970 | if ((sizeof(int) < sizeof(long))) { |
12971 | __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) |
12972 | } else { |
12973 | long val = PyInt_AS_LONG(x); |
12974 | if (is_unsigned && unlikely(val < 0)) { |
12975 | goto raise_neg_overflow; |
12976 | } |
12977 | return (int) val; |
12978 | } |
12979 | } else |
12980 | #endif |
12981 | if (likely(PyLong_Check(x))) { |
12982 | if (is_unsigned) { |
12983 | #if CYTHON_USE_PYLONG_INTERNALS |
12984 | const digit* digits = ((PyLongObject*)x)->ob_digit; |
12985 | switch (Py_SIZE(x)) { |
12986 | case 0: return (int) 0; |
12987 | case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0]) |
12988 | case 2: |
12989 | if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { |
12990 | if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { |
12991 | __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) |
12992 | } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) { |
12993 | return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); |
12994 | } |
12995 | } |
12996 | break; |
12997 | case 3: |
12998 | if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { |
12999 | if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { |
13000 | __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) |
13001 | } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) { |
13002 | return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); |
13003 | } |
13004 | } |
13005 | break; |
13006 | case 4: |
13007 | if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { |
13008 | if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { |
13009 | __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]))) |
13010 | } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) { |
13011 | return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); |
13012 | } |
13013 | } |
13014 | break; |
13015 | } |
13016 | #endif |
13017 | #if CYTHON_COMPILING_IN_CPYTHON |
13018 | if (unlikely(Py_SIZE(x) < 0)) { |
13019 | goto raise_neg_overflow; |
13020 | } |
13021 | #else |
13022 | { |
13023 | int result = PyObject_RichCompareBool(x, Py_False, Py_LT); |
13024 | if (unlikely(result < 0)) |
13025 | return (int) -1; |
13026 | if (unlikely(result == 1)) |
13027 | goto raise_neg_overflow; |
13028 | } |
13029 | #endif |
13030 | if ((sizeof(int) <= sizeof(unsigned long))) { |
13031 | __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) |
13032 | #ifdef HAVE_LONG_LONG |
13033 | } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) { |
13034 | __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) |
13035 | #endif |
13036 | } |
13037 | } else { |
13038 | #if CYTHON_USE_PYLONG_INTERNALS |
13039 | const digit* digits = ((PyLongObject*)x)->ob_digit; |
13040 | switch (Py_SIZE(x)) { |
13041 | case 0: return (int) 0; |
13042 | case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0])) |
13043 | case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0]) |
13044 | case -2: |
13045 | if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) { |
13046 | if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { |
13047 | __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) |
13048 | } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { |
13049 | return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); |
13050 | } |
13051 | } |
13052 | break; |
13053 | case 2: |
13054 | if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { |
13055 | if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { |
13056 | __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) |
13057 | } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { |
13058 | return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); |
13059 | } |
13060 | } |
13061 | break; |
13062 | case -3: |
13063 | if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { |
13064 | if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { |
13065 | __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) |
13066 | } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { |
13067 | return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); |
13068 | } |
13069 | } |
13070 | break; |
13071 | case 3: |
13072 | if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { |
13073 | if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { |
13074 | __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) |
13075 | } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { |
13076 | return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); |
13077 | } |
13078 | } |
13079 | break; |
13080 | case -4: |
13081 | if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { |
13082 | if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { |
13083 | __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]))) |
13084 | } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { |
13085 | return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); |
13086 | } |
13087 | } |
13088 | break; |
13089 | case 4: |
13090 | if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { |
13091 | if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { |
13092 | __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]))) |
13093 | } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { |
13094 | return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); |
13095 | } |
13096 | } |
13097 | break; |
13098 | } |
13099 | #endif |
13100 | if ((sizeof(int) <= sizeof(long))) { |
13101 | __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) |
13102 | #ifdef HAVE_LONG_LONG |
13103 | } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) { |
13104 | __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) |
13105 | #endif |
13106 | } |
13107 | } |
13108 | { |
13109 | #if (CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) && !defined(_PyLong_AsByteArray) |
13110 | PyErr_SetString(PyExc_RuntimeError, |
13111 | "_PyLong_AsByteArray() not available, cannot convert large numbers" ); |
13112 | #else |
13113 | int val; |
13114 | PyObject *v = __Pyx_PyNumber_IntOrLong(x); |
13115 | #if PY_MAJOR_VERSION < 3 |
13116 | if (likely(v) && !PyLong_Check(v)) { |
13117 | PyObject *tmp = v; |
13118 | v = PyNumber_Long(tmp); |
13119 | Py_DECREF(tmp); |
13120 | } |
13121 | #endif |
13122 | if (likely(v)) { |
13123 | int one = 1; int is_little = (int)*(unsigned char *)&one; |
13124 | unsigned char *bytes = (unsigned char *)&val; |
13125 | int ret = _PyLong_AsByteArray((PyLongObject *)v, |
13126 | bytes, sizeof(val), |
13127 | is_little, !is_unsigned); |
13128 | Py_DECREF(v); |
13129 | if (likely(!ret)) |
13130 | return val; |
13131 | } |
13132 | #endif |
13133 | return (int) -1; |
13134 | } |
13135 | } else { |
13136 | int val; |
13137 | PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); |
13138 | if (!tmp) return (int) -1; |
13139 | val = __Pyx_PyInt_As_int(tmp); |
13140 | Py_DECREF(tmp); |
13141 | return val; |
13142 | } |
13143 | raise_overflow: |
13144 | PyErr_SetString(PyExc_OverflowError, |
13145 | "value too large to convert to int" ); |
13146 | return (int) -1; |
13147 | raise_neg_overflow: |
13148 | PyErr_SetString(PyExc_OverflowError, |
13149 | "can't convert negative value to int" ); |
13150 | return (int) -1; |
13151 | } |
13152 | |
13153 | /* FastTypeChecks */ |
13154 | #if CYTHON_COMPILING_IN_CPYTHON |
13155 | static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { |
13156 | while (a) { |
13157 | a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*); |
13158 | if (a == b) |
13159 | return 1; |
13160 | } |
13161 | return b == &PyBaseObject_Type; |
13162 | } |
13163 | static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { |
13164 | PyObject *mro; |
13165 | if (a == b) return 1; |
13166 | mro = a->tp_mro; |
13167 | if (likely(mro)) { |
13168 | Py_ssize_t i, n; |
13169 | n = PyTuple_GET_SIZE(mro); |
13170 | for (i = 0; i < n; i++) { |
13171 | if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b) |
13172 | return 1; |
13173 | } |
13174 | return 0; |
13175 | } |
13176 | return __Pyx_InBases(a, b); |
13177 | } |
13178 | static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) { |
13179 | PyObject *mro; |
13180 | if (cls == a || cls == b) return 1; |
13181 | mro = cls->tp_mro; |
13182 | if (likely(mro)) { |
13183 | Py_ssize_t i, n; |
13184 | n = PyTuple_GET_SIZE(mro); |
13185 | for (i = 0; i < n; i++) { |
13186 | PyObject *base = PyTuple_GET_ITEM(mro, i); |
13187 | if (base == (PyObject *)a || base == (PyObject *)b) |
13188 | return 1; |
13189 | } |
13190 | return 0; |
13191 | } |
13192 | return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b); |
13193 | } |
13194 | #if PY_MAJOR_VERSION == 2 |
13195 | static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) { |
13196 | PyObject *exception, *value, *tb; |
13197 | int res; |
13198 | __Pyx_PyThreadState_declare |
13199 | __Pyx_PyThreadState_assign |
13200 | __Pyx_ErrFetch(&exception, &value, &tb); |
13201 | res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0; |
13202 | if (unlikely(res == -1)) { |
13203 | PyErr_WriteUnraisable(err); |
13204 | res = 0; |
13205 | } |
13206 | if (!res) { |
13207 | res = PyObject_IsSubclass(err, exc_type2); |
13208 | if (unlikely(res == -1)) { |
13209 | PyErr_WriteUnraisable(err); |
13210 | res = 0; |
13211 | } |
13212 | } |
13213 | __Pyx_ErrRestore(exception, value, tb); |
13214 | return res; |
13215 | } |
13216 | #else |
13217 | static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { |
13218 | if (exc_type1) { |
13219 | return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2); |
13220 | } else { |
13221 | return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); |
13222 | } |
13223 | } |
13224 | #endif |
13225 | static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { |
13226 | Py_ssize_t i, n; |
13227 | assert(PyExceptionClass_Check(exc_type)); |
13228 | n = PyTuple_GET_SIZE(tuple); |
13229 | #if PY_MAJOR_VERSION >= 3 |
13230 | for (i=0; i<n; i++) { |
13231 | if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1; |
13232 | } |
13233 | #endif |
13234 | for (i=0; i<n; i++) { |
13235 | PyObject *t = PyTuple_GET_ITEM(tuple, i); |
13236 | #if PY_MAJOR_VERSION < 3 |
13237 | if (likely(exc_type == t)) return 1; |
13238 | #endif |
13239 | if (likely(PyExceptionClass_Check(t))) { |
13240 | if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1; |
13241 | } else { |
13242 | } |
13243 | } |
13244 | return 0; |
13245 | } |
13246 | static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) { |
13247 | if (likely(err == exc_type)) return 1; |
13248 | if (likely(PyExceptionClass_Check(err))) { |
13249 | if (likely(PyExceptionClass_Check(exc_type))) { |
13250 | return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type); |
13251 | } else if (likely(PyTuple_Check(exc_type))) { |
13252 | return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type); |
13253 | } else { |
13254 | } |
13255 | } |
13256 | return PyErr_GivenExceptionMatches(err, exc_type); |
13257 | } |
13258 | static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) { |
13259 | assert(PyExceptionClass_Check(exc_type1)); |
13260 | assert(PyExceptionClass_Check(exc_type2)); |
13261 | if (likely(err == exc_type1 || err == exc_type2)) return 1; |
13262 | if (likely(PyExceptionClass_Check(err))) { |
13263 | return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2); |
13264 | } |
13265 | return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2)); |
13266 | } |
13267 | #endif |
13268 | |
13269 | /* CheckBinaryVersion */ |
13270 | static int __Pyx_check_binary_version(void) { |
13271 | char ctversion[4], rtversion[4]; |
13272 | PyOS_snprintf(ctversion, 4, "%d.%d" , PY_MAJOR_VERSION, PY_MINOR_VERSION); |
13273 | PyOS_snprintf(rtversion, 4, "%s" , Py_GetVersion()); |
13274 | if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { |
13275 | char message[200]; |
13276 | PyOS_snprintf(message, sizeof(message), |
13277 | "compile time version %s of module '%.100s' " |
13278 | "does not match runtime version %s" , |
13279 | ctversion, __Pyx_MODULE_NAME, rtversion); |
13280 | return PyErr_WarnEx(NULL, message, 1); |
13281 | } |
13282 | return 0; |
13283 | } |
13284 | |
13285 | /* InitStrings */ |
13286 | #if PY_MAJOR_VERSION >= 3 |
13287 | static int __Pyx_InitString(__Pyx_StringTabEntry t, PyObject **str) { |
13288 | if (t.is_unicode | t.is_str) { |
13289 | if (t.intern) { |
13290 | *str = PyUnicode_InternFromString(t.s); |
13291 | } else if (t.encoding) { |
13292 | *str = PyUnicode_Decode(t.s, t.n - 1, t.encoding, NULL); |
13293 | } else { |
13294 | *str = PyUnicode_FromStringAndSize(t.s, t.n - 1); |
13295 | } |
13296 | } else { |
13297 | *str = PyBytes_FromStringAndSize(t.s, t.n - 1); |
13298 | } |
13299 | if (!*str) |
13300 | return -1; |
13301 | if (PyObject_Hash(*str) == -1) |
13302 | return -1; |
13303 | return 0; |
13304 | } |
13305 | #endif |
13306 | #if !CYTHON_COMPILING_IN_LIMITED_API |
13307 | static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { |
13308 | while (t->p) { |
13309 | #if PY_MAJOR_VERSION >= 3 |
13310 | __Pyx_InitString(*t, t->p); |
13311 | #else |
13312 | if (t->is_unicode) { |
13313 | *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); |
13314 | } else if (t->intern) { |
13315 | *t->p = PyString_InternFromString(t->s); |
13316 | } else { |
13317 | *t->p = PyString_FromStringAndSize(t->s, t->n - 1); |
13318 | } |
13319 | if (!*t->p) |
13320 | return -1; |
13321 | if (PyObject_Hash(*t->p) == -1) |
13322 | return -1; |
13323 | #endif |
13324 | ++t; |
13325 | } |
13326 | return 0; |
13327 | } |
13328 | #endif |
13329 | |
13330 | static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { |
13331 | return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str)); |
13332 | } |
13333 | static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) { |
13334 | Py_ssize_t ignore; |
13335 | return __Pyx_PyObject_AsStringAndSize(o, &ignore); |
13336 | } |
13337 | #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT |
13338 | #if !CYTHON_PEP393_ENABLED |
13339 | static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { |
13340 | char* defenc_c; |
13341 | PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); |
13342 | if (!defenc) return NULL; |
13343 | defenc_c = PyBytes_AS_STRING(defenc); |
13344 | #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII |
13345 | { |
13346 | char* end = defenc_c + PyBytes_GET_SIZE(defenc); |
13347 | char* c; |
13348 | for (c = defenc_c; c < end; c++) { |
13349 | if ((unsigned char) (*c) >= 128) { |
13350 | PyUnicode_AsASCIIString(o); |
13351 | return NULL; |
13352 | } |
13353 | } |
13354 | } |
13355 | #endif |
13356 | *length = PyBytes_GET_SIZE(defenc); |
13357 | return defenc_c; |
13358 | } |
13359 | #else |
13360 | static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { |
13361 | if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL; |
13362 | #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII |
13363 | if (likely(PyUnicode_IS_ASCII(o))) { |
13364 | *length = PyUnicode_GET_LENGTH(o); |
13365 | return PyUnicode_AsUTF8(o); |
13366 | } else { |
13367 | PyUnicode_AsASCIIString(o); |
13368 | return NULL; |
13369 | } |
13370 | #else |
13371 | return PyUnicode_AsUTF8AndSize(o, length); |
13372 | #endif |
13373 | } |
13374 | #endif |
13375 | #endif |
13376 | static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { |
13377 | #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT |
13378 | if ( |
13379 | #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII |
13380 | __Pyx_sys_getdefaultencoding_not_ascii && |
13381 | #endif |
13382 | PyUnicode_Check(o)) { |
13383 | return __Pyx_PyUnicode_AsStringAndSize(o, length); |
13384 | } else |
13385 | #endif |
13386 | #if (!CYTHON_COMPILING_IN_PYPY && !CYTHON_COMPILING_IN_LIMITED_API) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) |
13387 | if (PyByteArray_Check(o)) { |
13388 | *length = PyByteArray_GET_SIZE(o); |
13389 | return PyByteArray_AS_STRING(o); |
13390 | } else |
13391 | #endif |
13392 | { |
13393 | char* result; |
13394 | int r = PyBytes_AsStringAndSize(o, &result, length); |
13395 | if (unlikely(r < 0)) { |
13396 | return NULL; |
13397 | } else { |
13398 | return result; |
13399 | } |
13400 | } |
13401 | } |
13402 | static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { |
13403 | int is_true = x == Py_True; |
13404 | if (is_true | (x == Py_False) | (x == Py_None)) return is_true; |
13405 | else return PyObject_IsTrue(x); |
13406 | } |
13407 | static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) { |
13408 | int retval; |
13409 | if (unlikely(!x)) return -1; |
13410 | retval = __Pyx_PyObject_IsTrue(x); |
13411 | Py_DECREF(x); |
13412 | return retval; |
13413 | } |
13414 | static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) { |
13415 | __Pyx_TypeName result_type_name = __Pyx_PyType_GetName(Py_TYPE(result)); |
13416 | #if PY_MAJOR_VERSION >= 3 |
13417 | if (PyLong_Check(result)) { |
13418 | if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, |
13419 | "__int__ returned non-int (type " __Pyx_FMT_TYPENAME "). " |
13420 | "The ability to return an instance of a strict subclass of int is deprecated, " |
13421 | "and may be removed in a future version of Python." , |
13422 | result_type_name)) { |
13423 | __Pyx_DECREF_TypeName(result_type_name); |
13424 | Py_DECREF(result); |
13425 | return NULL; |
13426 | } |
13427 | __Pyx_DECREF_TypeName(result_type_name); |
13428 | return result; |
13429 | } |
13430 | #endif |
13431 | PyErr_Format(PyExc_TypeError, |
13432 | "__%.4s__ returned non-%.4s (type " __Pyx_FMT_TYPENAME ")" , |
13433 | type_name, type_name, result_type_name); |
13434 | __Pyx_DECREF_TypeName(result_type_name); |
13435 | Py_DECREF(result); |
13436 | return NULL; |
13437 | } |
13438 | static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) { |
13439 | #if CYTHON_USE_TYPE_SLOTS |
13440 | PyNumberMethods *m; |
13441 | #endif |
13442 | const char *name = NULL; |
13443 | PyObject *res = NULL; |
13444 | #if PY_MAJOR_VERSION < 3 |
13445 | if (likely(PyInt_Check(x) || PyLong_Check(x))) |
13446 | #else |
13447 | if (likely(PyLong_Check(x))) |
13448 | #endif |
13449 | return __Pyx_NewRef(x); |
13450 | #if CYTHON_USE_TYPE_SLOTS |
13451 | m = Py_TYPE(x)->tp_as_number; |
13452 | #if PY_MAJOR_VERSION < 3 |
13453 | if (m && m->nb_int) { |
13454 | name = "int" ; |
13455 | res = m->nb_int(x); |
13456 | } |
13457 | else if (m && m->nb_long) { |
13458 | name = "long" ; |
13459 | res = m->nb_long(x); |
13460 | } |
13461 | #else |
13462 | if (likely(m && m->nb_int)) { |
13463 | name = "int" ; |
13464 | res = m->nb_int(x); |
13465 | } |
13466 | #endif |
13467 | #else |
13468 | if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) { |
13469 | res = PyNumber_Int(x); |
13470 | } |
13471 | #endif |
13472 | if (likely(res)) { |
13473 | #if PY_MAJOR_VERSION < 3 |
13474 | if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) { |
13475 | #else |
13476 | if (unlikely(!PyLong_CheckExact(res))) { |
13477 | #endif |
13478 | return __Pyx_PyNumber_IntOrLongWrongResultType(res, name); |
13479 | } |
13480 | } |
13481 | else if (!PyErr_Occurred()) { |
13482 | PyErr_SetString(PyExc_TypeError, |
13483 | "an integer is required" ); |
13484 | } |
13485 | return res; |
13486 | } |
13487 | static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { |
13488 | Py_ssize_t ival; |
13489 | PyObject *x; |
13490 | #if PY_MAJOR_VERSION < 3 |
13491 | if (likely(PyInt_CheckExact(b))) { |
13492 | if (sizeof(Py_ssize_t) >= sizeof(long)) |
13493 | return PyInt_AS_LONG(b); |
13494 | else |
13495 | return PyInt_AsSsize_t(b); |
13496 | } |
13497 | #endif |
13498 | if (likely(PyLong_CheckExact(b))) { |
13499 | #if CYTHON_USE_PYLONG_INTERNALS |
13500 | const digit* digits = ((PyLongObject*)b)->ob_digit; |
13501 | const Py_ssize_t size = Py_SIZE(b); |
13502 | if (likely(__Pyx_sst_abs(size) <= 1)) { |
13503 | ival = likely(size) ? digits[0] : 0; |
13504 | if (size == -1) ival = -ival; |
13505 | return ival; |
13506 | } else { |
13507 | switch (size) { |
13508 | case 2: |
13509 | if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { |
13510 | return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); |
13511 | } |
13512 | break; |
13513 | case -2: |
13514 | if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { |
13515 | return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); |
13516 | } |
13517 | break; |
13518 | case 3: |
13519 | if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { |
13520 | return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); |
13521 | } |
13522 | break; |
13523 | case -3: |
13524 | if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { |
13525 | return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); |
13526 | } |
13527 | break; |
13528 | case 4: |
13529 | if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { |
13530 | 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])); |
13531 | } |
13532 | break; |
13533 | case -4: |
13534 | if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { |
13535 | 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])); |
13536 | } |
13537 | break; |
13538 | } |
13539 | } |
13540 | #endif |
13541 | return PyLong_AsSsize_t(b); |
13542 | } |
13543 | x = PyNumber_Index(b); |
13544 | if (!x) return -1; |
13545 | ival = PyInt_AsSsize_t(x); |
13546 | Py_DECREF(x); |
13547 | return ival; |
13548 | } |
13549 | static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) { |
13550 | if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) { |
13551 | return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o); |
13552 | #if PY_MAJOR_VERSION < 3 |
13553 | } else if (likely(PyInt_CheckExact(o))) { |
13554 | return PyInt_AS_LONG(o); |
13555 | #endif |
13556 | } else { |
13557 | Py_ssize_t ival; |
13558 | PyObject *x; |
13559 | x = PyNumber_Index(o); |
13560 | if (!x) return -1; |
13561 | ival = PyInt_AsLong(x); |
13562 | Py_DECREF(x); |
13563 | return ival; |
13564 | } |
13565 | } |
13566 | static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { |
13567 | return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False); |
13568 | } |
13569 | static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { |
13570 | return PyInt_FromSize_t(ival); |
13571 | } |
13572 | |
13573 | |
13574 | /* #### Code section: utility_code_pragmas_end ### */ |
13575 | #if _MSV_VER |
13576 | #pragma warning( pop ) |
13577 | #endif |
13578 | |
13579 | |
13580 | |
13581 | /* #### Code section: end ### */ |
13582 | #endif /* Py_PYTHON_H */ |
13583 | |