fix some cython code

This commit is contained in:
Oleksandr Bezdieniezhnykh
2026-03-29 21:18:18 +03:00
parent ad5530b9ef
commit 6269a7485c
32 changed files with 17108 additions and 2728 deletions
+23 -3
View File
@@ -1,3 +1,7 @@
import platform
import sys
def _check_tensor_gpu_index():
try:
import pynvml
@@ -21,12 +25,28 @@ def _check_tensor_gpu_index():
pass
def _is_apple_silicon():
if sys.platform != "darwin" or platform.machine() != "arm64":
return False
try:
import coremltools
return True
except ImportError:
return False
tensor_gpu_index = _check_tensor_gpu_index()
def create_engine(model_bytes: bytes, batch_size: int = 1):
def _select_engine_class():
if tensor_gpu_index > -1:
from engines.tensorrt_engine import TensorRTEngine
return TensorRTEngine(model_bytes, batch_size)
return TensorRTEngine
if _is_apple_silicon():
from engines.coreml_engine import CoreMLEngine
return CoreMLEngine
from engines.onnx_engine import OnnxEngine
return OnnxEngine(model_bytes, batch_size)
return OnnxEngine
EngineClass = _select_engine_class()
+2812 -630
View File
File diff suppressed because it is too large Load Diff
+56 -3
View File
@@ -1,6 +1,10 @@
from engines.inference_engine cimport InferenceEngine
cimport constants_inf
import numpy as np
import io
import os
import tempfile
import zipfile
cdef class CoreMLEngine(InferenceEngine):
@@ -11,9 +15,7 @@ cdef class CoreMLEngine(InferenceEngine):
model_path = kwargs.get('model_path')
if model_path is None:
raise ValueError(
"CoreMLEngine requires model_path kwarg "
"pointing to a .mlpackage or .mlmodel")
model_path = self._extract_from_zip(model_bytes)
self.model = ct.models.MLModel(
model_path, compute_units=ct.ComputeUnit.ALL)
@@ -32,6 +34,57 @@ cdef class CoreMLEngine(InferenceEngine):
constants_inf.log(<str>f'CoreML model: input={self.input_name} shape={self.input_shape}')
constants_inf.log(<str>f'CoreML outputs: {self._output_names}')
@property
def engine_name(self):
return "coreml"
@staticmethod
def get_engine_filename():
return "azaion_coreml.zip"
@staticmethod
def convert_from_onnx(bytes onnx_bytes):
import coremltools as ct
with tempfile.NamedTemporaryFile(suffix='.onnx', delete=False) as f:
f.write(onnx_bytes)
onnx_path = f.name
try:
constants_inf.log(<str>'Converting ONNX to CoreML...')
model = ct.convert(
onnx_path,
compute_units=ct.ComputeUnit.ALL,
minimum_deployment_target=ct.target.macOS13,
)
with tempfile.TemporaryDirectory() as tmpdir:
pkg_path = os.path.join(tmpdir, "azaion.mlpackage")
model.save(pkg_path)
buf = io.BytesIO()
with zipfile.ZipFile(buf, 'w', zipfile.ZIP_DEFLATED) as zf:
for root, dirs, files in os.walk(pkg_path):
for fname in files:
file_path = os.path.join(root, fname)
arcname = os.path.relpath(file_path, tmpdir)
zf.write(file_path, arcname)
constants_inf.log(<str>'CoreML conversion done!')
return buf.getvalue()
finally:
os.unlink(onnx_path)
@staticmethod
def _extract_from_zip(model_bytes):
tmpdir = tempfile.mkdtemp()
buf = io.BytesIO(model_bytes)
with zipfile.ZipFile(buf, 'r') as zf:
zf.extractall(tmpdir)
for item in os.listdir(tmpdir):
if item.endswith('.mlpackage') or item.endswith('.mlmodel'):
return os.path.join(tmpdir, item)
raise ValueError("No .mlpackage or .mlmodel found in zip")
cdef tuple get_input_shape(self):
return self.input_shape[2], self.input_shape[3]
+436 -103
View File
@@ -4,7 +4,7 @@
{
"distutils": {
"include_dirs": [
"/Users/obezdienie001/dev/azaion/suite/detections/.venv-e2e/lib/python3.13/site-packages/numpy/_core/include"
"/Users/obezdienie001/dev/azaion/suite/detections/.venv/lib/python3.13/site-packages/numpy/_core/include"
],
"name": "engines.inference_engine",
"sources": [
@@ -1838,12 +1838,12 @@ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
__Pyx__ArgTypeTest(obj, type, name, exact))
static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);
/* RaiseException.proto */
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
/* RejectKeywords.proto */
static void __Pyx_RejectKeywords(const char* function_name, PyObject *kwds);
/* RaiseException.proto */
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
/* GetAttr3.proto */
static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);
@@ -2095,6 +2095,10 @@ static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
PyObject *module, PyObject *globals,
PyObject* code);
/* GetNameInClass.proto */
#define __Pyx_GetNameInClass(var, nmspace, name) (var) = __Pyx__GetNameInClass(nmspace, name)
static PyObject *__Pyx__GetNameInClass(PyObject *nmspace, PyObject *name);
/* CLineInTraceback.proto */
#if CYTHON_CLINE_IN_TRACEBACK && CYTHON_CLINE_IN_TRACEBACK_RUNTIME
static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
@@ -2271,11 +2275,13 @@ int __pyx_module_is_main_engines__inference_engine = 0;
/* Implementation of "engines.inference_engine" */
/* #### Code section: global_var ### */
static PyObject *__pyx_builtin_staticmethod;
static PyObject *__pyx_builtin_NotImplementedError;
/* #### Code section: string_decls ### */
static const char __pyx_k_[] = ".";
static const char __pyx_k__2[] = "?";
static const char __pyx_k_gc[] = "gc";
static const char __pyx_k_A_q[] = "\200A\340\010\017\210q";
static const char __pyx_k_QfA[] = "\200\001\330\004-\250Q\250f\260A";
static const char __pyx_k_new[] = "__new__";
static const char __pyx_k_pop[] = "pop";
@@ -2283,6 +2289,7 @@ static const char __pyx_k_dict[] = "__dict__";
static const char __pyx_k_func[] = "__func__";
static const char __pyx_k_main[] = "__main__";
static const char __pyx_k_name[] = "__name__";
static const char __pyx_k_onnx[] = "onnx";
static const char __pyx_k_self[] = "self";
static const char __pyx_k_test[] = "__test__";
static const char __pyx_k_state[] = "state";
@@ -2303,37 +2310,47 @@ static const char __pyx_k_isenabled[] = "isenabled";
static const char __pyx_k_pyx_state[] = "__pyx_state";
static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
static const char __pyx_k_batch_size[] = "batch_size";
static const char __pyx_k_onnx_bytes[] = "onnx_bytes";
static const char __pyx_k_pyx_result[] = "__pyx_result";
static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
static const char __pyx_k_PickleError[] = "PickleError";
static const char __pyx_k_model_bytes[] = "model_bytes";
static const char __pyx_k_is_coroutine[] = "_is_coroutine";
static const char __pyx_k_pyx_checksum[] = "__pyx_checksum";
static const char __pyx_k_staticmethod[] = "staticmethod";
static const char __pyx_k_stringsource[] = "<stringsource>";
static const char __pyx_k_use_setstate[] = "use_setstate";
static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
static const char __pyx_k_InferenceEngine[] = "InferenceEngine";
static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError";
static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
static const char __pyx_k_convert_from_onnx[] = "convert_from_onnx";
static const char __pyx_k_asyncio_coroutines[] = "asyncio.coroutines";
static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
static const char __pyx_k_NotImplementedError[] = "NotImplementedError";
static const char __pyx_k_get_engine_filename[] = "get_engine_filename";
static const char __pyx_k_engines_inference_engine[] = "engines.inference_engine";
static const char __pyx_k_hk_A_1_uuwwx_1_7_1_2DNRS_1[] = "\200\001\360\006\000\005\010\200\177\220h\230k\250\033\260A\330\010\r\210^\2301\330\010\016\320\016!\320!u\320uw\320wx\330\004\023\220?\240(\250!\2501\330\004\007\200|\2207\230!\330\0101\260\021\3202D\300N\320RS\330\004\013\2101";
static const char __pyx_k_Subclass_must_implement_run[] = "Subclass must implement run";
static const char __pyx_k_engines_inference_engine_pyx[] = "engines/inference_engine.pyx";
static const char __pyx_k_pyx_unpickle_InferenceEngine[] = "__pyx_unpickle_InferenceEngine";
static const char __pyx_k_InferenceEngine___reduce_cython[] = "InferenceEngine.__reduce_cython__";
static const char __pyx_k_T_G1F_a_vWA_q_q_q_0_AWKwa_0_AWK[] = "\200\001\360\010\000\005\016\210T\220\021\330\004\014\210G\2201\220F\230,\240a\330\004\007\200v\210W\220A\330\010\022\220!\330\010\027\220q\340\010\027\220q\330\004\007\200q\330\010\017\320\0170\260\004\260A\260W\270K\300w\310a\340\010\017\320\0170\260\004\260A\260W\270K\300q";
static const char __pyx_k_Incompatible_checksums_0x_x_vs_0[] = "Incompatible checksums (0x%x vs (0x37a72fb, 0x763015b, 0xe11ccd4) = (batch_size))";
static const char __pyx_k_InferenceEngine___setstate_cytho[] = "InferenceEngine.__setstate_cython__";
static const char __pyx_k_InferenceEngine_convert_from_onn[] = "InferenceEngine.convert_from_onnx";
static const char __pyx_k_InferenceEngine_get_engine_filen[] = "InferenceEngine.get_engine_filename";
static const char __pyx_k_Note_that_Cython_is_deliberately[] = "Note that Cython is deliberately stricter than PEP-484 and rejects subclasses of builtin types. If you need to pass subclasses then set the 'annotation_typing' directive to False.";
static const char __pyx_k_Subclass_must_implement_get_inpu[] = "Subclass must implement get_input_shape";
/* #### Code section: decls ### */
static int __pyx_pf_7engines_16inference_engine_15InferenceEngine___init__(struct __pyx_obj_7engines_16inference_engine_InferenceEngine *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_model_bytes, PyObject *__pyx_v_batch_size, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_7engines_16inference_engine_15InferenceEngine_11engine_name___get__(CYTHON_UNUSED struct __pyx_obj_7engines_16inference_engine_InferenceEngine *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7engines_16inference_engine_15InferenceEngine_2get_engine_filename(void); /* proto */
static PyObject *__pyx_pf_7engines_16inference_engine_15InferenceEngine_4convert_from_onnx(PyObject *__pyx_v_onnx_bytes); /* proto */
static PyObject *__pyx_pf_7engines_16inference_engine_15InferenceEngine_10batch_size___get__(struct __pyx_obj_7engines_16inference_engine_InferenceEngine *__pyx_v_self); /* proto */
static int __pyx_pf_7engines_16inference_engine_15InferenceEngine_10batch_size_2__set__(struct __pyx_obj_7engines_16inference_engine_InferenceEngine *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_7engines_16inference_engine_15InferenceEngine_2__reduce_cython__(struct __pyx_obj_7engines_16inference_engine_InferenceEngine *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7engines_16inference_engine_15InferenceEngine_4__setstate_cython__(struct __pyx_obj_7engines_16inference_engine_InferenceEngine *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_7engines_16inference_engine_15InferenceEngine_6__reduce_cython__(struct __pyx_obj_7engines_16inference_engine_InferenceEngine *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7engines_16inference_engine_15InferenceEngine_8__setstate_cython__(struct __pyx_obj_7engines_16inference_engine_InferenceEngine *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_7engines_16inference_engine___pyx_unpickle_InferenceEngine(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_tp_new_7engines_16inference_engine_InferenceEngine(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
/* #### Code section: late_includes ### */
@@ -2378,8 +2395,8 @@ typedef struct {
PyTypeObject *__pyx_ptype_7engines_16inference_engine_InferenceEngine;
__Pyx_CachedCFunction __pyx_umethod_PyDict_Type_pop;
PyObject *__pyx_tuple[1];
PyObject *__pyx_codeobj_tab[3];
PyObject *__pyx_string_tab[52];
PyObject *__pyx_codeobj_tab[5];
PyObject *__pyx_string_tab[60];
PyObject *__pyx_int_1;
PyObject *__pyx_int_58356475;
PyObject *__pyx_int_123928923;
@@ -2426,53 +2443,61 @@ static __pyx_mstatetype * const __pyx_mstate_global = &__pyx_mstate_global_stati
#define __pyx_n_u_InferenceEngine __pyx_string_tab[2]
#define __pyx_n_u_InferenceEngine___reduce_cython __pyx_string_tab[3]
#define __pyx_n_u_InferenceEngine___setstate_cytho __pyx_string_tab[4]
#define __pyx_n_u_NotImplementedError __pyx_string_tab[5]
#define __pyx_kp_u_Note_that_Cython_is_deliberately __pyx_string_tab[6]
#define __pyx_n_u_PickleError __pyx_string_tab[7]
#define __pyx_kp_u_Subclass_must_implement_get_inpu __pyx_string_tab[8]
#define __pyx_kp_u_Subclass_must_implement_run __pyx_string_tab[9]
#define __pyx_kp_u__2 __pyx_string_tab[10]
#define __pyx_kp_u_add_note __pyx_string_tab[11]
#define __pyx_n_u_asyncio_coroutines __pyx_string_tab[12]
#define __pyx_n_u_batch_size __pyx_string_tab[13]
#define __pyx_n_u_cline_in_traceback __pyx_string_tab[14]
#define __pyx_n_u_dict __pyx_string_tab[15]
#define __pyx_n_u_dict_2 __pyx_string_tab[16]
#define __pyx_kp_u_disable __pyx_string_tab[17]
#define __pyx_kp_u_enable __pyx_string_tab[18]
#define __pyx_n_u_engines_inference_engine __pyx_string_tab[19]
#define __pyx_n_u_func __pyx_string_tab[20]
#define __pyx_kp_u_gc __pyx_string_tab[21]
#define __pyx_n_u_getstate __pyx_string_tab[22]
#define __pyx_n_u_is_coroutine __pyx_string_tab[23]
#define __pyx_kp_u_isenabled __pyx_string_tab[24]
#define __pyx_n_u_main __pyx_string_tab[25]
#define __pyx_n_u_model_bytes __pyx_string_tab[26]
#define __pyx_n_u_module __pyx_string_tab[27]
#define __pyx_n_u_name __pyx_string_tab[28]
#define __pyx_n_u_new __pyx_string_tab[29]
#define __pyx_n_u_pickle __pyx_string_tab[30]
#define __pyx_n_u_pop __pyx_string_tab[31]
#define __pyx_n_u_pyx_PickleError __pyx_string_tab[32]
#define __pyx_n_u_pyx_checksum __pyx_string_tab[33]
#define __pyx_n_u_pyx_result __pyx_string_tab[34]
#define __pyx_n_u_pyx_state __pyx_string_tab[35]
#define __pyx_n_u_pyx_type __pyx_string_tab[36]
#define __pyx_n_u_pyx_unpickle_InferenceEngine __pyx_string_tab[37]
#define __pyx_n_u_pyx_vtable __pyx_string_tab[38]
#define __pyx_n_u_qualname __pyx_string_tab[39]
#define __pyx_n_u_reduce __pyx_string_tab[40]
#define __pyx_n_u_reduce_cython __pyx_string_tab[41]
#define __pyx_n_u_reduce_ex __pyx_string_tab[42]
#define __pyx_n_u_self __pyx_string_tab[43]
#define __pyx_n_u_set_name __pyx_string_tab[44]
#define __pyx_n_u_setstate __pyx_string_tab[45]
#define __pyx_n_u_setstate_cython __pyx_string_tab[46]
#define __pyx_n_u_state __pyx_string_tab[47]
#define __pyx_kp_u_stringsource __pyx_string_tab[48]
#define __pyx_n_u_test __pyx_string_tab[49]
#define __pyx_n_u_update __pyx_string_tab[50]
#define __pyx_n_u_use_setstate __pyx_string_tab[51]
#define __pyx_n_u_InferenceEngine_convert_from_onn __pyx_string_tab[5]
#define __pyx_n_u_InferenceEngine_get_engine_filen __pyx_string_tab[6]
#define __pyx_n_u_NotImplementedError __pyx_string_tab[7]
#define __pyx_kp_u_Note_that_Cython_is_deliberately __pyx_string_tab[8]
#define __pyx_n_u_PickleError __pyx_string_tab[9]
#define __pyx_kp_u_Subclass_must_implement_get_inpu __pyx_string_tab[10]
#define __pyx_kp_u_Subclass_must_implement_run __pyx_string_tab[11]
#define __pyx_kp_u__2 __pyx_string_tab[12]
#define __pyx_kp_u_add_note __pyx_string_tab[13]
#define __pyx_n_u_asyncio_coroutines __pyx_string_tab[14]
#define __pyx_n_u_batch_size __pyx_string_tab[15]
#define __pyx_n_u_cline_in_traceback __pyx_string_tab[16]
#define __pyx_n_u_convert_from_onnx __pyx_string_tab[17]
#define __pyx_n_u_dict __pyx_string_tab[18]
#define __pyx_n_u_dict_2 __pyx_string_tab[19]
#define __pyx_kp_u_disable __pyx_string_tab[20]
#define __pyx_kp_u_enable __pyx_string_tab[21]
#define __pyx_n_u_engines_inference_engine __pyx_string_tab[22]
#define __pyx_kp_u_engines_inference_engine_pyx __pyx_string_tab[23]
#define __pyx_n_u_func __pyx_string_tab[24]
#define __pyx_kp_u_gc __pyx_string_tab[25]
#define __pyx_n_u_get_engine_filename __pyx_string_tab[26]
#define __pyx_n_u_getstate __pyx_string_tab[27]
#define __pyx_n_u_is_coroutine __pyx_string_tab[28]
#define __pyx_kp_u_isenabled __pyx_string_tab[29]
#define __pyx_n_u_main __pyx_string_tab[30]
#define __pyx_n_u_model_bytes __pyx_string_tab[31]
#define __pyx_n_u_module __pyx_string_tab[32]
#define __pyx_n_u_name __pyx_string_tab[33]
#define __pyx_n_u_new __pyx_string_tab[34]
#define __pyx_n_u_onnx __pyx_string_tab[35]
#define __pyx_n_u_onnx_bytes __pyx_string_tab[36]
#define __pyx_n_u_pickle __pyx_string_tab[37]
#define __pyx_n_u_pop __pyx_string_tab[38]
#define __pyx_n_u_pyx_PickleError __pyx_string_tab[39]
#define __pyx_n_u_pyx_checksum __pyx_string_tab[40]
#define __pyx_n_u_pyx_result __pyx_string_tab[41]
#define __pyx_n_u_pyx_state __pyx_string_tab[42]
#define __pyx_n_u_pyx_type __pyx_string_tab[43]
#define __pyx_n_u_pyx_unpickle_InferenceEngine __pyx_string_tab[44]
#define __pyx_n_u_pyx_vtable __pyx_string_tab[45]
#define __pyx_n_u_qualname __pyx_string_tab[46]
#define __pyx_n_u_reduce __pyx_string_tab[47]
#define __pyx_n_u_reduce_cython __pyx_string_tab[48]
#define __pyx_n_u_reduce_ex __pyx_string_tab[49]
#define __pyx_n_u_self __pyx_string_tab[50]
#define __pyx_n_u_set_name __pyx_string_tab[51]
#define __pyx_n_u_setstate __pyx_string_tab[52]
#define __pyx_n_u_setstate_cython __pyx_string_tab[53]
#define __pyx_n_u_state __pyx_string_tab[54]
#define __pyx_n_u_staticmethod __pyx_string_tab[55]
#define __pyx_kp_u_stringsource __pyx_string_tab[56]
#define __pyx_n_u_test __pyx_string_tab[57]
#define __pyx_n_u_update __pyx_string_tab[58]
#define __pyx_n_u_use_setstate __pyx_string_tab[59]
/* #### Code section: module_state_clear ### */
#if CYTHON_USE_MODULE_STATE
static CYTHON_SMALL_CODE int __pyx_m_clear(PyObject *m) {
@@ -2496,8 +2521,8 @@ static CYTHON_SMALL_CODE int __pyx_m_clear(PyObject *m) {
Py_CLEAR(clear_module_state->__pyx_ptype_7engines_16inference_engine_InferenceEngine);
Py_CLEAR(clear_module_state->__pyx_type_7engines_16inference_engine_InferenceEngine);
for (int i=0; i<1; ++i) { Py_CLEAR(clear_module_state->__pyx_tuple[i]); }
for (int i=0; i<3; ++i) { Py_CLEAR(clear_module_state->__pyx_codeobj_tab[i]); }
for (int i=0; i<52; ++i) { Py_CLEAR(clear_module_state->__pyx_string_tab[i]); }
for (int i=0; i<5; ++i) { Py_CLEAR(clear_module_state->__pyx_codeobj_tab[i]); }
for (int i=0; i<60; ++i) { Py_CLEAR(clear_module_state->__pyx_string_tab[i]); }
Py_CLEAR(clear_module_state->__pyx_int_1);
Py_CLEAR(clear_module_state->__pyx_int_58356475);
Py_CLEAR(clear_module_state->__pyx_int_123928923);
@@ -2525,8 +2550,8 @@ static CYTHON_SMALL_CODE int __pyx_m_traverse(PyObject *m, visitproc visit, void
Py_VISIT(traverse_module_state->__pyx_ptype_7engines_16inference_engine_InferenceEngine);
Py_VISIT(traverse_module_state->__pyx_type_7engines_16inference_engine_InferenceEngine);
for (int i=0; i<1; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_tuple[i]); }
for (int i=0; i<3; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_codeobj_tab[i]); }
for (int i=0; i<52; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_string_tab[i]); }
for (int i=0; i<5; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_codeobj_tab[i]); }
for (int i=0; i<60; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_string_tab[i]); }
__Pyx_VISIT_CONST(traverse_module_state->__pyx_int_1);
__Pyx_VISIT_CONST(traverse_module_state->__pyx_int_58356475);
__Pyx_VISIT_CONST(traverse_module_state->__pyx_int_123928923);
@@ -2656,6 +2681,214 @@ static int __pyx_pf_7engines_16inference_engine_15InferenceEngine___init__(struc
}
/* Python wrapper */
static PyObject *__pyx_pw_7engines_16inference_engine_15InferenceEngine_11engine_name_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7engines_16inference_engine_15InferenceEngine_11engine_name_1__get__(PyObject *__pyx_v_self) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_7engines_16inference_engine_15InferenceEngine_11engine_name___get__(((struct __pyx_obj_7engines_16inference_engine_InferenceEngine *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_7engines_16inference_engine_15InferenceEngine_11engine_name___get__(CYTHON_UNUSED struct __pyx_obj_7engines_16inference_engine_InferenceEngine *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__", 0);
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_onnx);
__pyx_r = __pyx_mstate_global->__pyx_n_u_onnx;
goto __pyx_L0;
/* function exit code */
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_7engines_16inference_engine_15InferenceEngine_3get_engine_filename(CYTHON_UNUSED PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_7engines_16inference_engine_15InferenceEngine_3get_engine_filename = {"get_engine_filename", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7engines_16inference_engine_15InferenceEngine_3get_engine_filename, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7engines_16inference_engine_15InferenceEngine_3get_engine_filename(CYTHON_UNUSED PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("get_engine_filename (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_SIZE
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("get_engine_filename", 1, 0, 0, __pyx_nargs); return NULL; }
const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
if (unlikely(__pyx_kwds_len < 0)) return NULL;
if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("get_engine_filename", __pyx_kwds); return NULL;}
__pyx_r = __pyx_pf_7engines_16inference_engine_15InferenceEngine_2get_engine_filename();
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_7engines_16inference_engine_15InferenceEngine_2get_engine_filename(void) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("get_engine_filename", 0);
__Pyx_XDECREF(__pyx_r);
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
/* function exit code */
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_7engines_16inference_engine_15InferenceEngine_5convert_from_onnx(CYTHON_UNUSED PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_7engines_16inference_engine_15InferenceEngine_5convert_from_onnx = {"convert_from_onnx", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7engines_16inference_engine_15InferenceEngine_5convert_from_onnx, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7engines_16inference_engine_15InferenceEngine_5convert_from_onnx(CYTHON_UNUSED PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_onnx_bytes = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject* values[1] = {0};
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("convert_from_onnx (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_SIZE
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_onnx_bytes,0};
const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 13, __pyx_L3_error)
if (__pyx_kwds_len > 0) {
switch (__pyx_nargs) {
case 1:
values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 13, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "convert_from_onnx", 0) < 0) __PYX_ERR(0, 13, __pyx_L3_error)
for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("convert_from_onnx", 1, 1, 1, i); __PYX_ERR(0, 13, __pyx_L3_error) }
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 13, __pyx_L3_error)
}
__pyx_v_onnx_bytes = ((PyObject*)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("convert_from_onnx", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 13, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
__Pyx_AddTraceback("engines.inference_engine.InferenceEngine.convert_from_onnx", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_onnx_bytes), (&PyBytes_Type), 1, "onnx_bytes", 1))) __PYX_ERR(0, 14, __pyx_L1_error)
__pyx_r = __pyx_pf_7engines_16inference_engine_15InferenceEngine_4convert_from_onnx(__pyx_v_onnx_bytes);
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
goto __pyx_L7_cleaned_up;
__pyx_L0:;
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
__pyx_L7_cleaned_up:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_7engines_16inference_engine_15InferenceEngine_4convert_from_onnx(PyObject *__pyx_v_onnx_bytes) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("convert_from_onnx", 0);
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_onnx_bytes);
__pyx_r = __pyx_v_onnx_bytes;
goto __pyx_L0;
/* function exit code */
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_f_7engines_16inference_engine_15InferenceEngine_get_input_shape(CYTHON_UNUSED struct __pyx_obj_7engines_16inference_engine_InferenceEngine *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -2677,12 +2910,12 @@ static PyObject *__pyx_f_7engines_16inference_engine_15InferenceEngine_get_input
__pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error)
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
}
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__PYX_ERR(0, 6, __pyx_L1_error)
__PYX_ERR(0, 18, __pyx_L1_error)
/* function exit code */
@@ -2732,12 +2965,12 @@ static PyObject *__pyx_f_7engines_16inference_engine_15InferenceEngine_run(CYTHO
__pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 12, __pyx_L1_error)
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 24, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
}
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__PYX_ERR(0, 12, __pyx_L1_error)
__PYX_ERR(0, 24, __pyx_L1_error)
/* function exit code */
@@ -2830,15 +3063,15 @@ static int __pyx_pf_7engines_16inference_engine_15InferenceEngine_10batch_size_2
/* Python wrapper */
static PyObject *__pyx_pw_7engines_16inference_engine_15InferenceEngine_3__reduce_cython__(PyObject *__pyx_v_self,
static PyObject *__pyx_pw_7engines_16inference_engine_15InferenceEngine_7__reduce_cython__(PyObject *__pyx_v_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_7engines_16inference_engine_15InferenceEngine_3__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7engines_16inference_engine_15InferenceEngine_3__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7engines_16inference_engine_15InferenceEngine_3__reduce_cython__(PyObject *__pyx_v_self,
static PyMethodDef __pyx_mdef_7engines_16inference_engine_15InferenceEngine_7__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7engines_16inference_engine_15InferenceEngine_7__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7engines_16inference_engine_15InferenceEngine_7__reduce_cython__(PyObject *__pyx_v_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
@@ -2864,14 +3097,14 @@ PyObject *__pyx_args, PyObject *__pyx_kwds
const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
if (unlikely(__pyx_kwds_len < 0)) return NULL;
if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
__pyx_r = __pyx_pf_7engines_16inference_engine_15InferenceEngine_2__reduce_cython__(((struct __pyx_obj_7engines_16inference_engine_InferenceEngine *)__pyx_v_self));
__pyx_r = __pyx_pf_7engines_16inference_engine_15InferenceEngine_6__reduce_cython__(((struct __pyx_obj_7engines_16inference_engine_InferenceEngine *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_7engines_16inference_engine_15InferenceEngine_2__reduce_cython__(struct __pyx_obj_7engines_16inference_engine_InferenceEngine *__pyx_v_self) {
static PyObject *__pyx_pf_7engines_16inference_engine_15InferenceEngine_6__reduce_cython__(struct __pyx_obj_7engines_16inference_engine_InferenceEngine *__pyx_v_self) {
PyObject *__pyx_v_state = 0;
PyObject *__pyx_v__dict = 0;
int __pyx_v_use_setstate;
@@ -3004,15 +3237,15 @@ static PyObject *__pyx_pf_7engines_16inference_engine_15InferenceEngine_2__reduc
/* Python wrapper */
static PyObject *__pyx_pw_7engines_16inference_engine_15InferenceEngine_5__setstate_cython__(PyObject *__pyx_v_self,
static PyObject *__pyx_pw_7engines_16inference_engine_15InferenceEngine_9__setstate_cython__(PyObject *__pyx_v_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_7engines_16inference_engine_15InferenceEngine_5__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7engines_16inference_engine_15InferenceEngine_5__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7engines_16inference_engine_15InferenceEngine_5__setstate_cython__(PyObject *__pyx_v_self,
static PyMethodDef __pyx_mdef_7engines_16inference_engine_15InferenceEngine_9__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7engines_16inference_engine_15InferenceEngine_9__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7engines_16inference_engine_15InferenceEngine_9__setstate_cython__(PyObject *__pyx_v_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
@@ -3078,7 +3311,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_7engines_16inference_engine_15InferenceEngine_4__setstate_cython__(((struct __pyx_obj_7engines_16inference_engine_InferenceEngine *)__pyx_v_self), __pyx_v___pyx_state);
__pyx_r = __pyx_pf_7engines_16inference_engine_15InferenceEngine_8__setstate_cython__(((struct __pyx_obj_7engines_16inference_engine_InferenceEngine *)__pyx_v_self), __pyx_v___pyx_state);
/* function exit code */
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
@@ -3088,7 +3321,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds
return __pyx_r;
}
static PyObject *__pyx_pf_7engines_16inference_engine_15InferenceEngine_4__setstate_cython__(struct __pyx_obj_7engines_16inference_engine_InferenceEngine *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
static PyObject *__pyx_pf_7engines_16inference_engine_15InferenceEngine_8__setstate_cython__(struct __pyx_obj_7engines_16inference_engine_InferenceEngine *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
@@ -3423,6 +3656,10 @@ static void __pyx_tp_dealloc_7engines_16inference_engine_InferenceEngine(PyObjec
#endif
}
static PyObject *__pyx_getprop_7engines_16inference_engine_15InferenceEngine_engine_name(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_pw_7engines_16inference_engine_15InferenceEngine_11engine_name_1__get__(o);
}
static PyObject *__pyx_getprop_7engines_16inference_engine_15InferenceEngine_batch_size(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_pw_7engines_16inference_engine_15InferenceEngine_10batch_size_1__get__(o);
}
@@ -3438,12 +3675,15 @@ static int __pyx_setprop_7engines_16inference_engine_15InferenceEngine_batch_siz
}
static PyMethodDef __pyx_methods_7engines_16inference_engine_InferenceEngine[] = {
{"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7engines_16inference_engine_15InferenceEngine_3__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
{"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7engines_16inference_engine_15InferenceEngine_5__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
{"get_engine_filename", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7engines_16inference_engine_15InferenceEngine_3get_engine_filename, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
{"convert_from_onnx", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7engines_16inference_engine_15InferenceEngine_5convert_from_onnx, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
{"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7engines_16inference_engine_15InferenceEngine_7__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
{"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7engines_16inference_engine_15InferenceEngine_9__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
{0, 0, 0, 0}
};
static struct PyGetSetDef __pyx_getsets_7engines_16inference_engine_InferenceEngine[] = {
{"engine_name", __pyx_getprop_7engines_16inference_engine_15InferenceEngine_engine_name, 0, 0, 0},
{"batch_size", __pyx_getprop_7engines_16inference_engine_15InferenceEngine_batch_size, __pyx_setprop_7engines_16inference_engine_15InferenceEngine_batch_size, 0, 0},
{0, 0, 0, 0, 0}
};
@@ -3830,6 +4070,10 @@ static CYTHON_SMALL_CODE int __pyx_pymod_exec_inference_engine(PyObject *__pyx_p
__pyx_mstatetype *__pyx_mstate = NULL;
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
size_t __pyx_t_6;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
@@ -3936,17 +4180,61 @@ __Pyx_RefNannySetupContext("PyInit_inference_engine", 0);
(void)__Pyx_modinit_function_import_code(__pyx_mstate);
/*--- Execution code ---*/
__pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7engines_16inference_engine_15InferenceEngine_3__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_InferenceEngine___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_engines_inference_engine, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1, __pyx_L1_error)
__pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7engines_16inference_engine_15InferenceEngine_3get_engine_filename, __Pyx_CYFUNCTION_STATICMETHOD | __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_InferenceEngine_get_engine_filen, NULL, __pyx_mstate_global->__pyx_n_u_engines_inference_engine, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 9, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_7engines_16inference_engine_InferenceEngine, __pyx_mstate_global->__pyx_n_u_get_engine_filename, __pyx_t_2) < 0) __PYX_ERR(0, 9, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_3 = NULL;
__Pyx_INCREF(__pyx_builtin_staticmethod);
__pyx_t_4 = __pyx_builtin_staticmethod;
__Pyx_GetNameInClass(__pyx_t_5, (PyObject*)__pyx_mstate_global->__pyx_ptype_7engines_16inference_engine_InferenceEngine, __pyx_mstate_global->__pyx_n_u_get_engine_filename); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 9, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_6 = 1;
{
PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_5};
__pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 9, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
}
if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_7engines_16inference_engine_InferenceEngine, __pyx_mstate_global->__pyx_n_u_get_engine_filename, __pyx_t_2) < 0) __PYX_ERR(0, 9, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7engines_16inference_engine_15InferenceEngine_5convert_from_onnx, __Pyx_CYFUNCTION_STATICMETHOD | __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_InferenceEngine_convert_from_onn, NULL, __pyx_mstate_global->__pyx_n_u_engines_inference_engine, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[1])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 13, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_7engines_16inference_engine_InferenceEngine, __pyx_mstate_global->__pyx_n_u_convert_from_onnx, __pyx_t_2) < 0) __PYX_ERR(0, 13, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_4 = NULL;
__Pyx_INCREF(__pyx_builtin_staticmethod);
__pyx_t_5 = __pyx_builtin_staticmethod;
__Pyx_GetNameInClass(__pyx_t_3, (PyObject*)__pyx_mstate_global->__pyx_ptype_7engines_16inference_engine_InferenceEngine, __pyx_mstate_global->__pyx_n_u_convert_from_onnx); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 13, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_6 = 1;
{
PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_3};
__pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 13, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
}
if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_7engines_16inference_engine_InferenceEngine, __pyx_mstate_global->__pyx_n_u_convert_from_onnx, __pyx_t_2) < 0) __PYX_ERR(0, 13, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7engines_16inference_engine_15InferenceEngine_7__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_InferenceEngine___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_engines_inference_engine, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[2])); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_7engines_16inference_engine_InferenceEngine, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_2) < 0) __PYX_ERR(2, 1, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7engines_16inference_engine_15InferenceEngine_5__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_InferenceEngine___setstate_cytho, NULL, __pyx_mstate_global->__pyx_n_u_engines_inference_engine, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[1])); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 16, __pyx_L1_error)
__pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7engines_16inference_engine_15InferenceEngine_9__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_InferenceEngine___setstate_cytho, NULL, __pyx_mstate_global->__pyx_n_u_engines_inference_engine, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[3])); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 16, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_7engines_16inference_engine_InferenceEngine, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_2) < 0) __PYX_ERR(2, 16, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7engines_16inference_engine_1__pyx_unpickle_InferenceEngine, 0, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_InferenceEngine, NULL, __pyx_mstate_global->__pyx_n_u_engines_inference_engine, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[2])); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1, __pyx_L1_error)
__pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7engines_16inference_engine_1__pyx_unpickle_InferenceEngine, 0, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_InferenceEngine, NULL, __pyx_mstate_global->__pyx_n_u_engines_inference_engine, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[4])); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_InferenceEngine, __pyx_t_2) < 0) __PYX_ERR(2, 1, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
@@ -3961,6 +4249,9 @@ __Pyx_RefNannySetupContext("PyInit_inference_engine", 0);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
if (__pyx_m) {
if (__pyx_mstate->__pyx_d && stringtab_initialized) {
__Pyx_AddTraceback("init engines.inference_engine", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -4019,6 +4310,8 @@ static const __Pyx_StringTabEntry __pyx_string_tab[] = {
{__pyx_k_InferenceEngine, sizeof(__pyx_k_InferenceEngine), 0, 1, 1}, /* PyObject cname: __pyx_n_u_InferenceEngine */
{__pyx_k_InferenceEngine___reduce_cython, sizeof(__pyx_k_InferenceEngine___reduce_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_InferenceEngine___reduce_cython */
{__pyx_k_InferenceEngine___setstate_cytho, sizeof(__pyx_k_InferenceEngine___setstate_cytho), 0, 1, 1}, /* PyObject cname: __pyx_n_u_InferenceEngine___setstate_cytho */
{__pyx_k_InferenceEngine_convert_from_onn, sizeof(__pyx_k_InferenceEngine_convert_from_onn), 0, 1, 1}, /* PyObject cname: __pyx_n_u_InferenceEngine_convert_from_onn */
{__pyx_k_InferenceEngine_get_engine_filen, sizeof(__pyx_k_InferenceEngine_get_engine_filen), 0, 1, 1}, /* PyObject cname: __pyx_n_u_InferenceEngine_get_engine_filen */
{__pyx_k_NotImplementedError, sizeof(__pyx_k_NotImplementedError), 0, 1, 1}, /* PyObject cname: __pyx_n_u_NotImplementedError */
{__pyx_k_Note_that_Cython_is_deliberately, sizeof(__pyx_k_Note_that_Cython_is_deliberately), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Note_that_Cython_is_deliberately */
{__pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 1, 1}, /* PyObject cname: __pyx_n_u_PickleError */
@@ -4029,13 +4322,16 @@ static const __Pyx_StringTabEntry __pyx_string_tab[] = {
{__pyx_k_asyncio_coroutines, sizeof(__pyx_k_asyncio_coroutines), 0, 1, 1}, /* PyObject cname: __pyx_n_u_asyncio_coroutines */
{__pyx_k_batch_size, sizeof(__pyx_k_batch_size), 0, 1, 1}, /* PyObject cname: __pyx_n_u_batch_size */
{__pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 1, 1}, /* PyObject cname: __pyx_n_u_cline_in_traceback */
{__pyx_k_convert_from_onnx, sizeof(__pyx_k_convert_from_onnx), 0, 1, 1}, /* PyObject cname: __pyx_n_u_convert_from_onnx */
{__pyx_k_dict, sizeof(__pyx_k_dict), 0, 1, 1}, /* PyObject cname: __pyx_n_u_dict */
{__pyx_k_dict_2, sizeof(__pyx_k_dict_2), 0, 1, 1}, /* PyObject cname: __pyx_n_u_dict_2 */
{__pyx_k_disable, sizeof(__pyx_k_disable), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_disable */
{__pyx_k_enable, sizeof(__pyx_k_enable), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_enable */
{__pyx_k_engines_inference_engine, sizeof(__pyx_k_engines_inference_engine), 0, 1, 1}, /* PyObject cname: __pyx_n_u_engines_inference_engine */
{__pyx_k_engines_inference_engine_pyx, sizeof(__pyx_k_engines_inference_engine_pyx), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_engines_inference_engine_pyx */
{__pyx_k_func, sizeof(__pyx_k_func), 0, 1, 1}, /* PyObject cname: __pyx_n_u_func */
{__pyx_k_gc, sizeof(__pyx_k_gc), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_gc */
{__pyx_k_get_engine_filename, sizeof(__pyx_k_get_engine_filename), 0, 1, 1}, /* PyObject cname: __pyx_n_u_get_engine_filename */
{__pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 1, 1}, /* PyObject cname: __pyx_n_u_getstate */
{__pyx_k_is_coroutine, sizeof(__pyx_k_is_coroutine), 0, 1, 1}, /* PyObject cname: __pyx_n_u_is_coroutine */
{__pyx_k_isenabled, sizeof(__pyx_k_isenabled), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_isenabled */
@@ -4044,6 +4340,8 @@ static const __Pyx_StringTabEntry __pyx_string_tab[] = {
{__pyx_k_module, sizeof(__pyx_k_module), 0, 1, 1}, /* PyObject cname: __pyx_n_u_module */
{__pyx_k_name, sizeof(__pyx_k_name), 0, 1, 1}, /* PyObject cname: __pyx_n_u_name */
{__pyx_k_new, sizeof(__pyx_k_new), 0, 1, 1}, /* PyObject cname: __pyx_n_u_new */
{__pyx_k_onnx, sizeof(__pyx_k_onnx), 0, 1, 1}, /* PyObject cname: __pyx_n_u_onnx */
{__pyx_k_onnx_bytes, sizeof(__pyx_k_onnx_bytes), 0, 1, 1}, /* PyObject cname: __pyx_n_u_onnx_bytes */
{__pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pickle */
{__pyx_k_pop, sizeof(__pyx_k_pop), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pop */
{__pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pyx_PickleError */
@@ -4062,6 +4360,7 @@ static const __Pyx_StringTabEntry __pyx_string_tab[] = {
{__pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 1, 1}, /* PyObject cname: __pyx_n_u_setstate */
{__pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_setstate_cython */
{__pyx_k_state, sizeof(__pyx_k_state), 0, 1, 1}, /* PyObject cname: __pyx_n_u_state */
{__pyx_k_staticmethod, sizeof(__pyx_k_staticmethod), 0, 1, 1}, /* PyObject cname: __pyx_n_u_staticmethod */
{__pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_stringsource */
{__pyx_k_test, sizeof(__pyx_k_test), 0, 1, 1}, /* PyObject cname: __pyx_n_u_test */
{__pyx_k_update, sizeof(__pyx_k_update), 0, 1, 1}, /* PyObject cname: __pyx_n_u_update */
@@ -4075,7 +4374,8 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry const *t, PyObject **target, c
static int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate) {
CYTHON_UNUSED_VAR(__pyx_mstate);
__pyx_builtin_NotImplementedError = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_NotImplementedError); if (!__pyx_builtin_NotImplementedError) __PYX_ERR(0, 6, __pyx_L1_error)
__pyx_builtin_staticmethod = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_staticmethod); if (!__pyx_builtin_staticmethod) __PYX_ERR(0, 9, __pyx_L1_error)
__pyx_builtin_NotImplementedError = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_NotImplementedError); if (!__pyx_builtin_NotImplementedError) __PYX_ERR(0, 18, __pyx_L1_error)
return 0;
__pyx_L1_error:;
return -1;
@@ -4136,20 +4436,30 @@ static PyObject* __Pyx_PyCode_New(
static int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate) {
PyObject* tuple_dedup_map = PyDict_New();
if (unlikely(!tuple_dedup_map)) return -1;
{
const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 0, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 9, 7};
PyObject* const varnames[] = {0};
__pyx_mstate_global->__pyx_codeobj_tab[0] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_engines_inference_engine_pyx, __pyx_mstate->__pyx_n_u_get_engine_filename, __pyx_k_A_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[0])) goto bad;
}
{
const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 13, 7};
PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_onnx_bytes};
__pyx_mstate_global->__pyx_codeobj_tab[1] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_engines_inference_engine_pyx, __pyx_mstate->__pyx_n_u_convert_from_onnx, __pyx_k_A_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[1])) goto bad;
}
{
const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 87};
PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_state, __pyx_mstate->__pyx_n_u_dict_2, __pyx_mstate->__pyx_n_u_use_setstate};
__pyx_mstate_global->__pyx_codeobj_tab[0] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_k_T_G1F_a_vWA_q_q_q_0_AWKwa_0_AWK, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[0])) goto bad;
__pyx_mstate_global->__pyx_codeobj_tab[2] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_k_T_G1F_a_vWA_q_q_q_0_AWKwa_0_AWK, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[2])) goto bad;
}
{
const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 16, 11};
PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
__pyx_mstate_global->__pyx_codeobj_tab[1] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_k_QfA, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[1])) goto bad;
__pyx_mstate_global->__pyx_codeobj_tab[3] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_k_QfA, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[3])) goto bad;
}
{
const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 77};
PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pyx_type, __pyx_mstate->__pyx_n_u_pyx_checksum, __pyx_mstate->__pyx_n_u_pyx_state, __pyx_mstate->__pyx_n_u_pyx_PickleError, __pyx_mstate->__pyx_n_u_pyx_result};
__pyx_mstate_global->__pyx_codeobj_tab[2] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_pyx_unpickle_InferenceEngine, __pyx_k_hk_A_1_uuwwx_1_7_1_2DNRS_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[2])) goto bad;
__pyx_mstate_global->__pyx_codeobj_tab[4] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_pyx_unpickle_InferenceEngine, __pyx_k_hk_A_1_uuwwx_1_7_1_2DNRS_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[4])) goto bad;
}
Py_DECREF(tuple_dedup_map);
return 0;
@@ -5446,6 +5756,27 @@ static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *nam
return 0;
}
/* RejectKeywords */
static void __Pyx_RejectKeywords(const char* function_name, PyObject *kwds) {
PyObject *key = NULL;
if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds))) {
key = __Pyx_PySequence_ITEM(kwds, 0);
} else {
Py_ssize_t pos = 0;
#if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments)
if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return;
#endif
PyDict_Next(kwds, &pos, &key, NULL);
Py_INCREF(key);
}
if (likely(key)) {
PyErr_Format(PyExc_TypeError,
"%s() got an unexpected keyword argument '%U'",
function_name, key);
Py_DECREF(key);
}
}
/* RaiseException */
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
PyObject* owned_instance = NULL;
@@ -5554,27 +5885,6 @@ bad:
return;
}
/* RejectKeywords */
static void __Pyx_RejectKeywords(const char* function_name, PyObject *kwds) {
PyObject *key = NULL;
if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds))) {
key = __Pyx_PySequence_ITEM(kwds, 0);
} else {
Py_ssize_t pos = 0;
#if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments)
if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return;
#endif
PyDict_Next(kwds, &pos, &key, NULL);
Py_INCREF(key);
}
if (likely(key)) {
PyErr_Format(PyExc_TypeError,
"%s() got an unexpected keyword argument '%U'",
function_name, key);
Py_DECREF(key);
}
}
/* GetAttr3 */
#if __PYX_LIMITED_VERSION_HEX < 0x030d0000
static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
@@ -7815,6 +8125,29 @@ static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qual
return op;
}
/* GetNameInClass */
static PyObject *__Pyx__GetNameInClass(PyObject *nmspace, PyObject *name) {
PyObject *result;
PyObject *dict;
assert(PyType_Check(nmspace));
#if CYTHON_USE_TYPE_SLOTS
dict = ((PyTypeObject*)nmspace)->tp_dict;
Py_XINCREF(dict);
#else
dict = PyObject_GetAttr(nmspace, __pyx_mstate_global->__pyx_n_u_dict);
#endif
if (likely(dict)) {
result = PyObject_GetItem(dict, name);
Py_DECREF(dict);
if (result) {
return result;
}
}
PyErr_Clear();
__Pyx_GetModuleGlobalNameUncached(result, name);
return result;
}
/* CLineInTraceback */
#if CYTHON_CLINE_IN_TRACEBACK && CYTHON_CLINE_IN_TRACEBACK_RUNTIME
static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) {
+12
View File
@@ -2,6 +2,18 @@ cdef class InferenceEngine:
def __init__(self, model_bytes: bytes, batch_size: int = 1, **kwargs):
self.batch_size = batch_size
@property
def engine_name(self):
return "onnx"
@staticmethod
def get_engine_filename():
return None
@staticmethod
def convert_from_onnx(bytes onnx_bytes):
return onnx_bytes
cdef tuple get_input_shape(self):
raise NotImplementedError("Subclass must implement get_input_shape")
+1 -1
View File
@@ -4,7 +4,7 @@
{
"distutils": {
"include_dirs": [
"/Users/obezdienie001/dev/azaion/suite/detections/.venv-e2e/lib/python3.13/site-packages/numpy/_core/include"
"/Users/obezdienie001/dev/azaion/suite/detections/.venv/lib/python3.13/site-packages/numpy/_core/include"
],
"name": "engines.onnx_engine",
"sources": [
+7 -2
View File
@@ -72,10 +72,15 @@ cdef class TensorRTEngine(InferenceEngine):
pass
return 2 * 1024 * 1024 * 1024 if total_memory is None else total_memory # default 2 Gb
@property
def engine_name(self):
return "tensorrt"
@staticmethod
def get_engine_filename(int device_id):
def get_engine_filename():
try:
device = cuda.Device(device_id)
from engines import tensor_gpu_index
device = cuda.Device(max(tensor_gpu_index, 0))
sm_count = device.multiprocessor_count
cc_major, cc_minor = device.compute_capability()
return f"azaion.cc_{cc_major}.{cc_minor}_sm_{sm_count}.engine"