Machine Learning model APIs and structures#
Model handle structure and init/run/deinit functions for embedded TensorFlow Lite Micro models.
Modules#
Functions#
Load the model flatbuffer and initialize the interpreter for inference.
Run one inference pass on a loaded model.
Unload the model and release interpreter resources held by handle.
Function Documentation#
sl_ml_model_init#
sl_status_t sl_ml_model_init (sl_ml_model_handle_t * handle)
Load the model flatbuffer and initialize the interpreter for inference.
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| sl_ml_model_handle_t * | [in] | handle | Pointer to an initialized handle structure; must not be NULL. |
If the model is already loaded, returns SL_STATUS_OK without reloading the flatbuffer.
To reload the same handle, call sl_ml_model_deinit first, then sl_ml_model_init.
Returns
sl_status_tindicating whether the model loaded successfully.
Return values
SL_STATUS_OK: The model loaded successfully, or was already loaded.
SL_STATUS_INVALID_PARAMETER: handle
SL_STATUS_FAIL: Interpreter setup or tensor allocation failed.
sl_ml_model_run#
sl_status_t sl_ml_model_run (sl_ml_model_handle_t * handle)
Run one inference pass on a loaded model.
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| sl_ml_model_handle_t * | [in] | handle | Pointer to a loaded model handle; must not be NULL. |
Returns
sl_status_tindicating whether inference completed successfully.
Return values
SL_STATUS_OK: Inference completed successfully.
SL_STATUS_INVALID_PARAMETER: handle
SL_STATUS_NOT_INITIALIZED
SL_STATUS_FAIL: The TFLM
sl_ml_model_deinit#
sl_status_t sl_ml_model_deinit (sl_ml_model_handle_t * handle)
Unload the model and release interpreter resources held by handle.
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| sl_ml_model_handle_t * | [in] | handle | Pointer to the model handle to unload; must not be NULL. |
Returns
sl_status_tindicating whether the model was unloaded successfully.
Return values
SL_STATUS_OK: The model was loaded and has been unloaded.
SL_STATUS_NOT_INITIALIZED: The model was not loaded;
SL_STATUS_INVALID_PARAMETER: handle