tflite π
Tensorflow Lite operations.
TFLiteMixin π
Mixin providing Tensorflow Lite operations for a Session
.
This mixin is intended to be used in combination with BaseSession
and should not be instantiated on its own.
Intended usage
class Session(BaseSession, TensorflowLiteMixin): ...
tflite_model_delete π
Performs the Tensorflow Lite model deletion operation.
Wraps the vaccel_tflite_session_delete()
C operation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
| Resource | A resource with the model to unload. | required |
Returns:
Type | Description |
---|---|
None | The status of the operation execution. |
Raises:
Type | Description |
---|---|
RuntimeError | If the |
FFIError | If the C operation fails. |
Source code in vaccel/ops/tflite.py
tflite_model_load π
Performs the Tensorflow Lite model loading operation.
Wraps the vaccel_tflite_session_load()
C operation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
| Resource | A resource with the model to load. | required |
Raises:
Type | Description |
---|---|
RuntimeError | If the |
FFIError | If the C operation fails. |
Source code in vaccel/ops/tflite.py
tflite_model_run π
tflite_model_run(
resource: Resource, in_tensors: list[Tensor], nr_out_tensors: int = 1
) -> (list[Tensor], int)
Performs the Tensorflow Lite model run operation.
Wraps the vaccel_tflite_session_run()
C operation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
| Resource | A resource with the model to run. | required |
| list[Tensor] | The input tensors for the inference. | required |
| int | The number of output tensors. Defaults to 1. | 1 |
Returns:
Type | Description |
---|---|
(list[Tensor], int) | A tuple containing: - The output tensors - The status of the operation execution. |
Raises:
Type | Description |
---|---|
RuntimeError | If the |
FFIError | If the C operation fails. |
Source code in vaccel/ops/tflite.py
Tensor π
Bases: CType
Wrapper for the struct vaccel_tflite_tensor
C object.
Manages the creation and initialization of a C struct vaccel_tflite_tensor
and provides access to it through Python properties.
Inherits
CType: Abstract base class for defining C data types.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
| list[int] | The dims to be passed to the C struct. | required |
| TensorType | The data_type to be passed to the C struct. | required |
| list[Any] | The data to be passed to the C struct. | required |
Source code in vaccel/ops/tflite.py
data property
π
data_type property
π
The tensor data type.
Returns:
Type | Description |
---|---|
TensorType | The data type of the tensor. |
dims property
π
value property
π
Returns the value of the underlying C struct.
Returns:
Type | Description |
---|---|
CData | The dereferenced 'struct vaccel_tflite_tensor` |
empty classmethod
π
empty() -> Tensor
Initializes a new empty Tensor
object.
The object a NULL pointer in place of the C struct.
Returns:
Type | Description |
---|---|
Tensor | A new |
Source code in vaccel/ops/tflite.py
from_c_obj classmethod
π
Initializes a new Tensor
object from an existing C struct.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
| CData | A pointer to a | required |
Returns:
Type | Description |
---|---|
Tensor | A new |