Files
detections/engines/inference_engine.pyx
T
Oleksandr Bezdieniezhnykh fc57d677b4 Refactor type casting in Cython files for improved clarity and consistency
- Updated various Cython files to explicitly cast types, enhancing type safety and readability.
- Adjusted the `engine_name` property in `InferenceEngine` and its subclasses to be set directly in the constructor.
- Modified the `request` method in `_SessionWithBase` to accept `*args` for better flexibility.
- Ensured proper type casting for return values in methods across multiple classes, including `Inference`, `CoreMLEngine`, and `TensorRTEngine`.

These changes aim to streamline the codebase and improve maintainability by enforcing consistent type usage.
2026-03-30 06:17:16 +03:00

26 lines
701 B
Cython

cdef class InferenceEngine:
def __init__(self, model_bytes: bytes, batch_size: int = 1, **kwargs):
self.batch_size = batch_size
self.engine_name = <str>"onnx"
@staticmethod
def get_engine_filename():
return None
@staticmethod
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")
cdef int get_batch_size(self):
return <int>self.batch_size
cdef run(self, input_data):
raise NotImplementedError("Subclass must implement run")