ML Middleware
ModusToolbox Machine Learning Middleware Library
All Data Structures Functions Variables Modules
Utils_API

Functions

int mtb_ml_utils_find_max (const MTB_ML_DATA_T *in, int size)
 : This function finds the maximum value in an array and return its index. More...
 
int mtb_ml_utils_find_max_int32 (const int32_t *in, int size)
 : This function finds the maximum value in an int32_t array and return its index. More...
 
cy_rslt_t mtb_ml_utils_print_model_info (const mtb_ml_model_t *obj)
 : Print detailed model info More...
 
cy_rslt_t mtb_ml_utils_model_quantize (const mtb_ml_model_t *obj, const float *input_data, MTB_ML_DATA_T *quantized_values)
 : Quantizes float data for model input. This function will always attempt to quantize the provided input data. In order to properly use this function the end user must give the mtb ml model object, pointer to the input data of floating point values and a pointer to a input buffer to contain all quantized values. More...
 
cy_rslt_t mtb_ml_utils_model_dequantize (const mtb_ml_model_t *obj, float *dequantized_values)
 : Dequantize model's output if it is quantized More...
 

Detailed Description

Function Documentation

◆ mtb_ml_utils_find_max()

int mtb_ml_utils_find_max ( const MTB_ML_DATA_T *  in,
int  size 
)

: This function finds the maximum value in an array and return its index.

Parameters
[in]in: Pointer of the array
[in]size: size of the array
Returns
: The index of maximum value : -1 if input paramter is invalid.

◆ mtb_ml_utils_find_max_int32()

int mtb_ml_utils_find_max_int32 ( const int32_t *  in,
int  size 
)

: This function finds the maximum value in an int32_t array and return its index.

Parameters
[in]in: Pointer of the array
[in]size: size of the array
Returns
: The index of maximum value : -1 if input paramter is invalid.

◆ mtb_ml_utils_model_dequantize()

cy_rslt_t mtb_ml_utils_model_dequantize ( const mtb_ml_model_t obj,
float *  dequantized_values 
)

: Dequantize model's output if it is quantized

Parameters
[in]obj: Pointer of model object.
[out]dequantized_values: pointer of dequantized_values
Returns
: MTB_ML_RESULT_SUCCESS - success : MTB_ML_RESULT_BAD_ARG - if input paramter is invalid.

◆ mtb_ml_utils_model_quantize()

cy_rslt_t mtb_ml_utils_model_quantize ( const mtb_ml_model_t obj,
const float *  input_data,
MTB_ML_DATA_T *  quantized_values 
)

: Quantizes float data for model input. This function will always attempt to quantize the provided input data. In order to properly use this function the end user must give the mtb ml model object, pointer to the input data of floating point values and a pointer to a input buffer to contain all quantized values.

Parameters
[in]obj: Pointer of model object.
[in]input_data: Pointer to input floating point data
[out]quantized_values: Input buffer to contain all quantized values. Its size should be allocated to match the number of input nodes within the model.
Returns
: MTB_ML_RESULT_SUCCESS - success : MTB_ML_RESULT_BAD_ARG - if an input parameter is invalid.

◆ mtb_ml_utils_print_model_info()

cy_rslt_t mtb_ml_utils_print_model_info ( const mtb_ml_model_t obj)

: Print detailed model info

Parameters
[in]obj: Pointer of model object.
Returns
: MTB_ML_RESULT_SUCCESS - success : MTB_ML_RESULT_BAD_ARG - if input paramter is invalid.