Refactor inference and AI configuration handling

- Updated the `Inference` class to replace the `get_onnx_engine_bytes` method with `download_model`, allowing for dynamic model loading based on a specified filename.
- Modified the `convert_and_upload_model` method to accept `source_bytes` instead of `onnx_engine_bytes`, enhancing flexibility in model conversion.
- Introduced a new property `engine_name` to the `Inference` class for better access to engine details.
- Adjusted the `AIRecognitionConfig` structure to include a new method pointer `from_dict`, improving configuration handling.
- Updated various test cases to reflect changes in model paths and timeout settings, ensuring consistency and reliability in testing.
This commit is contained in:
Oleksandr Bezdieniezhnykh
2026-03-30 00:22:56 +03:00
parent 6269a7485c
commit 27f4aceb52
25 changed files with 40974 additions and 6172 deletions
+1705 -4030
View File
File diff suppressed because it is too large Load Diff
+2 -3
View File
@@ -4,9 +4,8 @@ from engines.inference_engine cimport InferenceEngine
cdef class CoreMLEngine(InferenceEngine):
cdef object model
cdef str input_name
cdef tuple input_shape
cdef list _output_names
cdef int img_width
cdef int img_height
cdef tuple get_input_shape(self)
cdef int get_batch_size(self)
+39 -53
View File
@@ -1,6 +1,7 @@
from engines.inference_engine cimport InferenceEngine
cimport constants_inf
import numpy as np
from PIL import Image
import io
import os
import tempfile
@@ -21,18 +22,12 @@ cdef class CoreMLEngine(InferenceEngine):
model_path, compute_units=ct.ComputeUnit.ALL)
spec = self.model.get_spec()
input_desc = spec.description.input[0]
self.input_name = input_desc.name
img_input = spec.description.input[0]
self.img_width = int(img_input.type.imageType.width)
self.img_height = int(img_input.type.imageType.height)
self.batch_size = 1
array_type = input_desc.type.multiArrayType
self.input_shape = tuple(int(s) for s in array_type.shape)
if len(self.input_shape) == 4:
self.batch_size = self.input_shape[0] if self.input_shape[0] > 0 else batch_size
self._output_names = [o.name for o in spec.description.output]
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}')
constants_inf.log(<str>f'CoreML model: {self.img_width}x{self.img_height}')
@property
def engine_name(self):
@@ -42,38 +37,6 @@ cdef class CoreMLEngine(InferenceEngine):
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()
@@ -86,17 +49,40 @@ cdef class CoreMLEngine(InferenceEngine):
raise ValueError("No .mlpackage or .mlmodel found in zip")
cdef tuple get_input_shape(self):
return self.input_shape[2], self.input_shape[3]
return self.img_height, self.img_width
cdef int get_batch_size(self):
return self.batch_size
return 1
cdef run(self, input_data):
prediction = self.model.predict({self.input_name: input_data})
results = []
for name in self._output_names:
val = prediction[name]
if not isinstance(val, np.ndarray):
val = np.array(val)
results.append(val)
return results
cdef int w = self.img_width
cdef int h = self.img_height
blob = input_data[0]
img_array = np.clip(blob * 255.0, 0, 255).astype(np.uint8)
img_array = np.transpose(img_array, (1, 2, 0))
pil_img = Image.fromarray(img_array, 'RGB')
pred = self.model.predict({
'image': pil_img,
'iouThreshold': 0.45,
'confidenceThreshold': 0.25,
})
coords = pred.get('coordinates', np.empty((0, 4), dtype=np.float32))
confs = pred.get('confidence', np.empty((0, 80), dtype=np.float32))
if coords.size == 0:
return [np.zeros((1, 0, 6), dtype=np.float32)]
cx, cy, bw, bh = coords[:, 0], coords[:, 1], coords[:, 2], coords[:, 3]
x1 = (cx - bw / 2) * w
y1 = (cy - bh / 2) * h
x2 = (cx + bw / 2) * w
y2 = (cy + bh / 2) * h
class_ids = np.argmax(confs, axis=1).astype(np.float32)
conf_values = np.max(confs, axis=1)
dets = np.stack([x1, y1, x2, y2, conf_values, class_ids], axis=1)
return [dets[np.newaxis, :, :]]
+216 -121
View File
@@ -4,7 +4,7 @@
{
"distutils": {
"include_dirs": [
"/Users/obezdienie001/dev/azaion/suite/detections/.venv/lib/python3.13/site-packages/numpy/_core/include"
"/Users/obezdienie001/dev/azaion/suite/detections/.venv-e2e/lib/python3.13/site-packages/numpy/_core/include"
],
"name": "engines.inference_engine",
"sources": [
@@ -2310,13 +2310,13 @@ 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_source_bytes[] = "source_bytes";
static const char __pyx_k_staticmethod[] = "staticmethod";
static const char __pyx_k_stringsource[] = "<stringsource>";
static const char __pyx_k_use_setstate[] = "use_setstate";
@@ -2324,11 +2324,12 @@ 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_convert_from_source[] = "convert_from_source";
static const char __pyx_k_get_engine_filename[] = "get_engine_filename";
static const char __pyx_k_get_source_filename[] = "get_source_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";
@@ -2338,19 +2339,21 @@ static const char __pyx_k_InferenceEngine___reduce_cython[] = "InferenceEngine._
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_convert_from_sou[] = "InferenceEngine.convert_from_source";
static const char __pyx_k_InferenceEngine_get_engine_filen[] = "InferenceEngine.get_engine_filename";
static const char __pyx_k_InferenceEngine_get_source_filen[] = "InferenceEngine.get_source_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_4get_source_filename(void); /* proto */
static PyObject *__pyx_pf_7engines_16inference_engine_15InferenceEngine_6convert_from_source(PyObject *__pyx_v_source_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_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_15InferenceEngine_8__reduce_cython__(struct __pyx_obj_7engines_16inference_engine_InferenceEngine *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7engines_16inference_engine_15InferenceEngine_10__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 ### */
@@ -2395,8 +2398,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[5];
PyObject *__pyx_string_tab[60];
PyObject *__pyx_codeobj_tab[6];
PyObject *__pyx_string_tab[62];
PyObject *__pyx_int_1;
PyObject *__pyx_int_58356475;
PyObject *__pyx_int_123928923;
@@ -2443,61 +2446,63 @@ 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_InferenceEngine_convert_from_onn __pyx_string_tab[5]
#define __pyx_n_u_InferenceEngine_convert_from_sou __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]
#define __pyx_n_u_InferenceEngine_get_source_filen __pyx_string_tab[7]
#define __pyx_n_u_NotImplementedError __pyx_string_tab[8]
#define __pyx_kp_u_Note_that_Cython_is_deliberately __pyx_string_tab[9]
#define __pyx_n_u_PickleError __pyx_string_tab[10]
#define __pyx_kp_u_Subclass_must_implement_get_inpu __pyx_string_tab[11]
#define __pyx_kp_u_Subclass_must_implement_run __pyx_string_tab[12]
#define __pyx_kp_u__2 __pyx_string_tab[13]
#define __pyx_kp_u_add_note __pyx_string_tab[14]
#define __pyx_n_u_asyncio_coroutines __pyx_string_tab[15]
#define __pyx_n_u_batch_size __pyx_string_tab[16]
#define __pyx_n_u_cline_in_traceback __pyx_string_tab[17]
#define __pyx_n_u_convert_from_source __pyx_string_tab[18]
#define __pyx_n_u_dict __pyx_string_tab[19]
#define __pyx_n_u_dict_2 __pyx_string_tab[20]
#define __pyx_kp_u_disable __pyx_string_tab[21]
#define __pyx_kp_u_enable __pyx_string_tab[22]
#define __pyx_n_u_engines_inference_engine __pyx_string_tab[23]
#define __pyx_kp_u_engines_inference_engine_pyx __pyx_string_tab[24]
#define __pyx_n_u_func __pyx_string_tab[25]
#define __pyx_kp_u_gc __pyx_string_tab[26]
#define __pyx_n_u_get_engine_filename __pyx_string_tab[27]
#define __pyx_n_u_get_source_filename __pyx_string_tab[28]
#define __pyx_n_u_getstate __pyx_string_tab[29]
#define __pyx_n_u_is_coroutine __pyx_string_tab[30]
#define __pyx_kp_u_isenabled __pyx_string_tab[31]
#define __pyx_n_u_main __pyx_string_tab[32]
#define __pyx_n_u_model_bytes __pyx_string_tab[33]
#define __pyx_n_u_module __pyx_string_tab[34]
#define __pyx_n_u_name __pyx_string_tab[35]
#define __pyx_n_u_new __pyx_string_tab[36]
#define __pyx_n_u_onnx __pyx_string_tab[37]
#define __pyx_n_u_pickle __pyx_string_tab[38]
#define __pyx_n_u_pop __pyx_string_tab[39]
#define __pyx_n_u_pyx_PickleError __pyx_string_tab[40]
#define __pyx_n_u_pyx_checksum __pyx_string_tab[41]
#define __pyx_n_u_pyx_result __pyx_string_tab[42]
#define __pyx_n_u_pyx_state __pyx_string_tab[43]
#define __pyx_n_u_pyx_type __pyx_string_tab[44]
#define __pyx_n_u_pyx_unpickle_InferenceEngine __pyx_string_tab[45]
#define __pyx_n_u_pyx_vtable __pyx_string_tab[46]
#define __pyx_n_u_qualname __pyx_string_tab[47]
#define __pyx_n_u_reduce __pyx_string_tab[48]
#define __pyx_n_u_reduce_cython __pyx_string_tab[49]
#define __pyx_n_u_reduce_ex __pyx_string_tab[50]
#define __pyx_n_u_self __pyx_string_tab[51]
#define __pyx_n_u_set_name __pyx_string_tab[52]
#define __pyx_n_u_setstate __pyx_string_tab[53]
#define __pyx_n_u_setstate_cython __pyx_string_tab[54]
#define __pyx_n_u_source_bytes __pyx_string_tab[55]
#define __pyx_n_u_state __pyx_string_tab[56]
#define __pyx_n_u_staticmethod __pyx_string_tab[57]
#define __pyx_kp_u_stringsource __pyx_string_tab[58]
#define __pyx_n_u_test __pyx_string_tab[59]
#define __pyx_n_u_update __pyx_string_tab[60]
#define __pyx_n_u_use_setstate __pyx_string_tab[61]
/* #### Code section: module_state_clear ### */
#if CYTHON_USE_MODULE_STATE
static CYTHON_SMALL_CODE int __pyx_m_clear(PyObject *m) {
@@ -2521,8 +2526,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<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]); }
for (int i=0; i<6; ++i) { Py_CLEAR(clear_module_state->__pyx_codeobj_tab[i]); }
for (int i=0; i<62; ++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);
@@ -2550,8 +2555,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<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]); }
for (int i=0; i<6; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_codeobj_tab[i]); }
for (int i=0; i<62; ++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);
@@ -2776,22 +2781,82 @@ static PyObject *__pyx_pf_7engines_16inference_engine_15InferenceEngine_2get_eng
/* Python wrapper */
static PyObject *__pyx_pw_7engines_16inference_engine_15InferenceEngine_5convert_from_onnx(CYTHON_UNUSED PyObject *__pyx_self,
static PyObject *__pyx_pw_7engines_16inference_engine_15InferenceEngine_5get_source_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_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,
static PyMethodDef __pyx_mdef_7engines_16inference_engine_15InferenceEngine_5get_source_filename = {"get_source_filename", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7engines_16inference_engine_15InferenceEngine_5get_source_filename, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7engines_16inference_engine_15InferenceEngine_5get_source_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
) {
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 *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("get_source_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_source_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_source_filename", __pyx_kwds); return NULL;}
__pyx_r = __pyx_pf_7engines_16inference_engine_15InferenceEngine_4get_source_filename();
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_7engines_16inference_engine_15InferenceEngine_4get_source_filename(void) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("get_source_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_7convert_from_source(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_7convert_from_source = {"convert_from_source", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7engines_16inference_engine_15InferenceEngine_7convert_from_source, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7engines_16inference_engine_15InferenceEngine_7convert_from_source(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_source_bytes = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
@@ -2802,7 +2867,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds
int __pyx_clineno = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("convert_from_onnx (wrapper)", 0);
__Pyx_RefNannySetupContext("convert_from_source (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_SIZE
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
@@ -2812,46 +2877,46 @@ PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_onnx_bytes,0};
PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_source_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 (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 17, __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)
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 17, __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)
if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "convert_from_source", 0) < 0) __PYX_ERR(0, 17, __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) }
if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("convert_from_source", 1, 1, 1, i); __PYX_ERR(0, 17, __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)
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 17, __pyx_L3_error)
}
__pyx_v_onnx_bytes = ((PyObject*)values[0]);
__pyx_v_source_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_RaiseArgtupleInvalid("convert_from_source", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 17, __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_AddTraceback("engines.inference_engine.InferenceEngine.convert_from_source", __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);
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_source_bytes), (&PyBytes_Type), 1, "source_bytes", 1))) __PYX_ERR(0, 18, __pyx_L1_error)
__pyx_r = __pyx_pf_7engines_16inference_engine_15InferenceEngine_6convert_from_source(__pyx_v_source_bytes);
/* function exit code */
goto __pyx_L0;
@@ -2870,14 +2935,14 @@ PyObject *__pyx_args, PyObject *__pyx_kwds
return __pyx_r;
}
static PyObject *__pyx_pf_7engines_16inference_engine_15InferenceEngine_4convert_from_onnx(PyObject *__pyx_v_onnx_bytes) {
static PyObject *__pyx_pf_7engines_16inference_engine_15InferenceEngine_6convert_from_source(PyObject *__pyx_v_source_bytes) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("convert_from_onnx", 0);
__Pyx_RefNannySetupContext("convert_from_source", 0);
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_onnx_bytes);
__pyx_r = __pyx_v_onnx_bytes;
__Pyx_INCREF(__pyx_v_source_bytes);
__pyx_r = __pyx_v_source_bytes;
goto __pyx_L0;
@@ -2910,12 +2975,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, 18, __pyx_L1_error)
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __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, 18, __pyx_L1_error)
__PYX_ERR(0, 22, __pyx_L1_error)
/* function exit code */
@@ -2965,12 +3030,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, 24, __pyx_L1_error)
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 28, __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, 24, __pyx_L1_error)
__PYX_ERR(0, 28, __pyx_L1_error)
/* function exit code */
@@ -3063,15 +3128,15 @@ static int __pyx_pf_7engines_16inference_engine_15InferenceEngine_10batch_size_2
/* Python wrapper */
static PyObject *__pyx_pw_7engines_16inference_engine_15InferenceEngine_7__reduce_cython__(PyObject *__pyx_v_self,
static PyObject *__pyx_pw_7engines_16inference_engine_15InferenceEngine_9__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_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,
static PyMethodDef __pyx_mdef_7engines_16inference_engine_15InferenceEngine_9__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7engines_16inference_engine_15InferenceEngine_9__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7engines_16inference_engine_15InferenceEngine_9__reduce_cython__(PyObject *__pyx_v_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
@@ -3097,14 +3162,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_6__reduce_cython__(((struct __pyx_obj_7engines_16inference_engine_InferenceEngine *)__pyx_v_self));
__pyx_r = __pyx_pf_7engines_16inference_engine_15InferenceEngine_8__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_6__reduce_cython__(struct __pyx_obj_7engines_16inference_engine_InferenceEngine *__pyx_v_self) {
static PyObject *__pyx_pf_7engines_16inference_engine_15InferenceEngine_8__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;
@@ -3237,15 +3302,15 @@ static PyObject *__pyx_pf_7engines_16inference_engine_15InferenceEngine_6__reduc
/* Python wrapper */
static PyObject *__pyx_pw_7engines_16inference_engine_15InferenceEngine_9__setstate_cython__(PyObject *__pyx_v_self,
static PyObject *__pyx_pw_7engines_16inference_engine_15InferenceEngine_11__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_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,
static PyMethodDef __pyx_mdef_7engines_16inference_engine_15InferenceEngine_11__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7engines_16inference_engine_15InferenceEngine_11__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7engines_16inference_engine_15InferenceEngine_11__setstate_cython__(PyObject *__pyx_v_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
@@ -3311,7 +3376,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__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);
__pyx_r = __pyx_pf_7engines_16inference_engine_15InferenceEngine_10__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) {
@@ -3321,7 +3386,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds
return __pyx_r;
}
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) {
static PyObject *__pyx_pf_7engines_16inference_engine_15InferenceEngine_10__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;
@@ -3676,9 +3741,10 @@ static int __pyx_setprop_7engines_16inference_engine_15InferenceEngine_batch_siz
static PyMethodDef __pyx_methods_7engines_16inference_engine_InferenceEngine[] = {
{"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},
{"get_source_filename", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7engines_16inference_engine_15InferenceEngine_5get_source_filename, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
{"convert_from_source", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7engines_16inference_engine_15InferenceEngine_7convert_from_source, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
{"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7engines_16inference_engine_15InferenceEngine_9__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
{"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7engines_16inference_engine_15InferenceEngine_11__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
{0, 0, 0, 0}
};
@@ -4202,14 +4268,14 @@ __Pyx_RefNannySetupContext("PyInit_inference_engine", 0);
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_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7engines_16inference_engine_15InferenceEngine_5get_source_filename, __Pyx_CYFUNCTION_STATICMETHOD | __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_InferenceEngine_get_source_filen, 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)
if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_7engines_16inference_engine_InferenceEngine, __pyx_mstate_global->__pyx_n_u_get_source_filename, __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_GetNameInClass(__pyx_t_3, (PyObject*)__pyx_mstate_global->__pyx_ptype_7engines_16inference_engine_InferenceEngine, __pyx_mstate_global->__pyx_n_u_get_source_filename); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 13, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_6 = 1;
{
@@ -4221,20 +4287,42 @@ __Pyx_RefNannySetupContext("PyInit_inference_engine", 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)
if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_7engines_16inference_engine_InferenceEngine, __pyx_mstate_global->__pyx_n_u_get_source_filename, __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_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7engines_16inference_engine_15InferenceEngine_7convert_from_source, __Pyx_CYFUNCTION_STATICMETHOD | __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_InferenceEngine_convert_from_sou, 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(0, 17, __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_source, __pyx_t_2) < 0) __PYX_ERR(0, 17, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_5 = NULL;
__Pyx_INCREF(__pyx_builtin_staticmethod);
__pyx_t_3 = __pyx_builtin_staticmethod;
__Pyx_GetNameInClass(__pyx_t_4, (PyObject*)__pyx_mstate_global->__pyx_ptype_7engines_16inference_engine_InferenceEngine, __pyx_mstate_global->__pyx_n_u_convert_from_source); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 17, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_6 = 1;
{
PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_4};
__pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __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_source, __pyx_t_2) < 0) __PYX_ERR(0, 17, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7engines_16inference_engine_15InferenceEngine_9__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[3])); 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_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_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7engines_16inference_engine_15InferenceEngine_11__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[4])); 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[4])); 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[5])); 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;
@@ -4310,8 +4398,9 @@ 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_convert_from_sou, sizeof(__pyx_k_InferenceEngine_convert_from_sou), 0, 1, 1}, /* PyObject cname: __pyx_n_u_InferenceEngine_convert_from_sou */
{__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_InferenceEngine_get_source_filen, sizeof(__pyx_k_InferenceEngine_get_source_filen), 0, 1, 1}, /* PyObject cname: __pyx_n_u_InferenceEngine_get_source_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 */
@@ -4322,7 +4411,7 @@ 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_convert_from_source, sizeof(__pyx_k_convert_from_source), 0, 1, 1}, /* PyObject cname: __pyx_n_u_convert_from_source */
{__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 */
@@ -4332,6 +4421,7 @@ static const __Pyx_StringTabEntry __pyx_string_tab[] = {
{__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_get_source_filename, sizeof(__pyx_k_get_source_filename), 0, 1, 1}, /* PyObject cname: __pyx_n_u_get_source_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 */
@@ -4341,7 +4431,6 @@ static const __Pyx_StringTabEntry __pyx_string_tab[] = {
{__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 */
@@ -4359,6 +4448,7 @@ static const __Pyx_StringTabEntry __pyx_string_tab[] = {
{__pyx_k_set_name, sizeof(__pyx_k_set_name), 0, 1, 1}, /* PyObject cname: __pyx_n_u_set_name */
{__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_source_bytes, sizeof(__pyx_k_source_bytes), 0, 1, 1}, /* PyObject cname: __pyx_n_u_source_bytes */
{__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 */
@@ -4375,7 +4465,7 @@ 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_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)
__pyx_builtin_NotImplementedError = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_NotImplementedError); if (!__pyx_builtin_NotImplementedError) __PYX_ERR(0, 22, __pyx_L1_error)
return 0;
__pyx_L1_error:;
return -1;
@@ -4442,24 +4532,29 @@ static int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate) {
__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 = {0, 0, 0, 0, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 13, 7};
PyObject* const varnames[] = {0};
__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_get_source_filename, __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, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 17, 7};
PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_source_bytes};
__pyx_mstate_global->__pyx_codeobj_tab[2] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_engines_inference_engine_pyx, __pyx_mstate->__pyx_n_u_convert_from_source, __pyx_k_A_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[2])) 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[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;
__pyx_mstate_global->__pyx_codeobj_tab[3] = __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[3])) 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[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;
__pyx_mstate_global->__pyx_codeobj_tab[4] = __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[4])) 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[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;
__pyx_mstate_global->__pyx_codeobj_tab[5] = __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[5])) goto bad;
}
Py_DECREF(tuple_dedup_map);
return 0;
+6 -2
View File
@@ -11,8 +11,12 @@ cdef class InferenceEngine:
return None
@staticmethod
def convert_from_onnx(bytes onnx_bytes):
return onnx_bytes
def get_source_filename():
return None
@staticmethod
def convert_from_source(bytes source_bytes):
return source_bytes
cdef tuple get_input_shape(self):
raise NotImplementedError("Subclass must implement get_input_shape")
+6 -1
View File
@@ -88,7 +88,12 @@ cdef class TensorRTEngine(InferenceEngine):
return None
@staticmethod
def convert_from_onnx(bytes onnx_model):
def get_source_filename():
import constants_inf
return constants_inf.AI_ONNX_MODEL_FILE
@staticmethod
def convert_from_source(bytes onnx_model):
workspace_bytes = int(TensorRTEngine.get_gpu_memory_bytes(0) * 0.9)
explicit_batch_flag = 1 << int(trt.NetworkDefinitionCreationFlag.EXPLICIT_BATCH)