|
int | Cy_ML_Model_Inference (void *modelPt, void *input, void *output, int *in_out_q) |
| : Cy_ML_Model_Inference() is the API function to perform NN inference. More...
|
|
int | Cy_ML_Model_Parse (char *fn_prms, cy_stc_ml_model_info_t *mdl_infoPt) |
| : Cy_ML_Model_Parse() is the API function to parse NN model parameters to get basic info. More...
|
|
int | Cy_ML_Model_Init (void **dPt_container, char *fn_prms, char *fn_ptr, char *persistent_mem, char *scratch_mem, cy_stc_ml_model_info_t *mdl_infoPt) |
| : Cy_ML_Model_Init() is the API function to parse NN model and initialize CY data container before start inference. More...
|
|
int | Cy_ML_Rnn_State_Control (void *modelPt, int rnn_status, int window_size) |
| : Cy_ML_Rnn_State_Control() is the API function to rest recurrent NN state, inference engine will reset Rnn state when this API is called. More...
|
|
int | Cy_ML_Profile_Get_Tsc (uint32_t *val) |
| : Cy_ML_Profile_Get_Tsc() is an API function to read time stamp counter (TSC) . More...
|
|
int | Cy_ML_Profile_Init (void *modelPt, cy_en_ml_profile_config_t config, cy_ml_cb_fun cb_func, void *cb_arg) |
| : Initialize profile configuration. More...
|
|
int | Cy_ML_Profile_Control (void *modelPt, cy_en_ml_profile_config_t config) |
| : Update profile configuration. More...
|
|
int | Cy_ML_Profile_Print (void *modelPt) |
| : Print profile log. More...
|
|
int Cy_ML_Model_Inference |
( |
void * |
modelPt, |
|
|
void * |
input, |
|
|
void * |
output, |
|
|
int * |
in_out_q |
|
) |
| |
: Cy_ML_Model_Inference() is the API function to perform NN inference.
CY NN inference API function targeted for PSoC6 embedded ML application. CY NN inference supports floating-point and fixed-point data format. When doing floating-point inference, input data and output data are in floating-point format. When doing fixed-point inference, input data can be either 16-bit or 8-bit fixed-point. Its inference output will be 8-bit fixed-point when both input data and NN weight are 8-bit, otherwise it will be 16-bit fixed-point. The parameter in_ou_q shall be set to input data fixed-point Q factor at the start of function call, and it will be equal to output data fixed-point Q factor at the end of the function call.
- Parameters
-
[in] | modelPt | : Pointer to CY parsed NN model data container |
[in] | input | : Input data pointer |
[out] | output | : Inference output data pointer |
[in,out] | in_out_q | : Pointer to input data and output data fixed-point Q factor; not applicable (i.e. not used) to floating-point |
- Returns
- : Return 0 when success, otherwise return following error code CY_ML_ERR_INVALID_ARGUMENT if input or output argument is invalid CY_ML_ERR_OTHER_INPUT_MISSING or error code from specific inference engine module. Please note error code is 8bit LSB, line number where the error happened in code is in 16bit MSB, and its layer index if applicable will be at bit 8 to 15 in the combined 32bit return value.
int Cy_ML_Model_Init |
( |
void ** |
dPt_container, |
|
|
char * |
fn_prms, |
|
|
char * |
fn_ptr, |
|
|
char * |
persistent_mem, |
|
|
char * |
scratch_mem, |
|
|
cy_stc_ml_model_info_t * |
mdl_infoPt |
|
) |
| |
: Cy_ML_Model_Init() is the API function to parse NN model and initialize CY data container before start inference.
From the API inputs, it parses NN model and initializes CY data container. For floating-point NN model, its weights and biases shall be in floating-point stored in buffer pointer by parameter fn_ptr. For fixed-point NN mode, its weights and biases can be either 16-bit or 8-bit format stored in buffer pointer by parameter fn_ptr.
- Parameters
-
[out] | dPt_container | : Pointer to CY parsed NN model data container pointer |
[in] | fn_prms | : CY parsed NN model parameter buffer pointer |
[in] | fn_ptr | : NN model weights and biases buffer pointer |
[in] | persistent_mem | : Pointer to allocated persistent memory |
[in] | scratch_mem | : Pointer to allocated scratch memory |
[in] | mdl_infoPt | : Pointer to cy_stc_ml_model_info_t structure |
- Returns
- : Return 0 when success, otherwise return error code Return CY_ML_ERR_INVALID_ARGUMENT if input or output argument is invalid, Otherwise return other errors: e.g. CY_ML_ERR_OTHER_INPUT_MISSING if the other input is missing in ADD layer Please note error code is 8bit LSB, line number where the error happened in code is in 16bit MSB, and its layer index if applicable will be at bit 8 to 15 in the combined 32bit return value.
int Cy_ML_Rnn_State_Control |
( |
void * |
modelPt, |
|
|
int |
rnn_status, |
|
|
int |
window_size |
|
) |
| |
: Cy_ML_Rnn_State_Control() is the API function to rest recurrent NN state, inference engine will reset Rnn state when this API is called.
This API is used to control RNN state. This API can be called after initilization. if one only time reset is desired, use this API to 1) reset the network, and then 2) clear the reset with this API. If the NN model is not recurrent type network. This API will do nothing.
- Parameters
-
[out] | modelPt | : Pointer to CY parsed NN model data container pointer |
[in] | rnn_status | : Recurrent NN reset (1) or clear (0) |
[in] | window_size | : Recurrent NN reset window size |
- Returns
- : Return 0 when success, otherwise return error code Return CY_ML_ERR_INVALID_ARGUMENT if input argument is invalid.