maccel.model_variant_handle.ModelVariantHandle Class Reference#
|
Runtime Library v0.30
Mobilint SDK qb
|
Handle to a specific variant of a loaded model. More...
Public Member Functions | |
| __init__ (self, _cMaccel.ModelVariantHandle _model_variant_handle) | |
| from_cpp (cls, _cMaccel.ModelVariantHandle _model_variant_handle) | |
| int | get_variant_idx (self) |
| Returns the index of this model variant. | |
| List[_Shape] | get_model_input_shape (self) |
| Returns the input shape for this model variant. | |
| List[_Shape] | get_model_output_shape (self) |
| Returns the output shape for this model variant. | |
| List[BufferInfo] | get_input_buffer_info (self) |
| Returns the input buffer information for this variant. | |
| List[BufferInfo] | get_output_buffer_info (self) |
| Returns the output buffer information for this variant. | |
| List[Scale] | get_input_scale (self) |
| Returns the input quantization scale(s) for this variant. | |
| List[Scale] | get_output_scale (self) |
| Returns the output quantization scale(s) for this variant. | |
| List[Buffer] | acquire_input_buffer (self, List[List[int]] seqlens=[]) |
| Buffer Management API. | |
| List[Buffer] | acquire_output_buffer (self, List[List[int]] seqlens=[]) |
| Buffer Management API. | |
| None | release_buffer (self, List[Buffer] buffer) |
| Buffer Management API. | |
| None | reposition_inputs (self, List[np.ndarray] inputs, List[Buffer] input_bufs, List[List[int]] seqlens=[]) |
| Reposition input. | |
| None | reposition_outputs (self, List[Buffer] output_bufs, List[np.ndarray] outputs, List[List[int]] seqlens=[]) |
| Reposition output. | |
Protected Attributes | |
| _model_variant_handle = _model_variant_handle | |
| List[_Shape] | _output_shape = self.get_model_output_shape() |
Detailed Description
Handle to a specific variant of a loaded model.
This class provides access to variant-specific information such as input/output shapes, buffer information, and quantization scales. It also offers APIs for managing inference buffers, consistent with the interface of the Model class.
Objects of this class are obtained via Model.get_model_variant_handle().
Definition at line 17 of file model_variant_handle.py.
Constructor & Destructor Documentation
◆ __init__()
| maccel.model_variant_handle.ModelVariantHandle.__init__ | ( | self, | |
| _cMaccel.ModelVariantHandle | _model_variant_handle ) |
Definition at line 28 of file model_variant_handle.py.
Member Function Documentation
◆ from_cpp()
| maccel.model_variant_handle.ModelVariantHandle.from_cpp | ( | cls, | |
| _cMaccel.ModelVariantHandle | _model_variant_handle ) |
Definition at line 33 of file model_variant_handle.py.
◆ get_variant_idx()
| int maccel.model_variant_handle.ModelVariantHandle.get_variant_idx | ( | self | ) |
Returns the index of this model variant.
- Returns
- Index of the model variant.
Definition at line 36 of file model_variant_handle.py.
◆ get_model_input_shape()
| List[_Shape] maccel.model_variant_handle.ModelVariantHandle.get_model_input_shape | ( | self | ) |
Returns the input shape for this model variant.
- Returns
- model variant's input shape.
Definition at line 44 of file model_variant_handle.py.
◆ get_model_output_shape()
| List[_Shape] maccel.model_variant_handle.ModelVariantHandle.get_model_output_shape | ( | self | ) |
Returns the output shape for this model variant.
- Returns
- model variant's output shape.
Definition at line 52 of file model_variant_handle.py.
◆ get_input_buffer_info()
| List[BufferInfo] maccel.model_variant_handle.ModelVariantHandle.get_input_buffer_info | ( | self | ) |
Returns the input buffer information for this variant.
- Returns
- A list of input buffer information.
Definition at line 60 of file model_variant_handle.py.
◆ get_output_buffer_info()
| List[BufferInfo] maccel.model_variant_handle.ModelVariantHandle.get_output_buffer_info | ( | self | ) |
Returns the output buffer information for this variant.
- Returns
- A list of output buffer information.
Definition at line 71 of file model_variant_handle.py.
◆ get_input_scale()
| List[Scale] maccel.model_variant_handle.ModelVariantHandle.get_input_scale | ( | self | ) |
Returns the input quantization scale(s) for this variant.
- Returns
- A list of input scales.
Definition at line 82 of file model_variant_handle.py.
◆ get_output_scale()
| List[Scale] maccel.model_variant_handle.ModelVariantHandle.get_output_scale | ( | self | ) |
Returns the output quantization scale(s) for this variant.
- Returns
- A list of output scales.
Definition at line 90 of file model_variant_handle.py.
◆ acquire_input_buffer()
| List[Buffer] maccel.model_variant_handle.ModelVariantHandle.acquire_input_buffer | ( | self, | |
| List[List[int]] | seqlens = [] ) |
Buffer Management API.
Acquires list of Buffer for input. These API is required when calling Model.infer_buffer().
- Note
- These APIs are intended for advanced use and follow the same buffer management interface as the Model class.
Definition at line 100 of file model_variant_handle.py.
◆ acquire_output_buffer()
| List[Buffer] maccel.model_variant_handle.ModelVariantHandle.acquire_output_buffer | ( | self, | |
| List[List[int]] | seqlens = [] ) |
Buffer Management API.
Acquires list of Buffer for output. These API is required when calling Model.infer_buffer().
- Note
- These APIs are intended for advanced use and follow the same buffer management interface as the Model class.
Definition at line 114 of file model_variant_handle.py.
◆ release_buffer()
| None maccel.model_variant_handle.ModelVariantHandle.release_buffer | ( | self, | |
| List[Buffer] | buffer ) |
Buffer Management API.
Deallocate acquired Input/Output buffer
- Note
- These APIs are intended for advanced use and follow the same buffer management interface as the Model class.
Definition at line 128 of file model_variant_handle.py.
◆ reposition_inputs()
| None maccel.model_variant_handle.ModelVariantHandle.reposition_inputs | ( | self, | |
| List[np.ndarray] | inputs, | ||
| List[Buffer] | input_bufs, | ||
| List[List[int]] | seqlens = [] ) |
Reposition input.
Definition at line 139 of file model_variant_handle.py.
◆ reposition_outputs()
| None maccel.model_variant_handle.ModelVariantHandle.reposition_outputs | ( | self, | |
| List[Buffer] | output_bufs, | ||
| List[np.ndarray] | outputs, | ||
| List[List[int]] | seqlens = [] ) |
Reposition output.
Definition at line 151 of file model_variant_handle.py.
Member Data Documentation
◆ _model_variant_handle
|
protected |
Definition at line 29 of file model_variant_handle.py.
◆ _output_shape
|
protected |
Definition at line 30 of file model_variant_handle.py.
The documentation for this class was generated from the following file:
Generated by