10
10
/**
11
11
* @file Common example runner functions
12
12
*
13
- * @brief Set of functions(runners) to organize MLI Library examples in a common way
13
+ * @brief Set of functions(runners) to organize MLI Library examples in a common
14
+ * way
14
15
*/
15
16
16
- #include <stdint.h>
17
-
18
17
#include "mli_api.h"
19
- #include "tests_aux.h"
20
18
#include "mli_config.h"
19
+ #include "tests_aux.h"
20
+
21
+ #include <stdint.h>
21
22
22
23
#ifdef __cplusplus
23
24
extern "C" {
@@ -42,39 +43,48 @@ typedef void (*model_inference_t)(const char *);
42
43
* @detail Function calls sequentially *preprocess* function for
43
44
* input data and *inference* function passing
44
45
* *inf_param* to it.
45
- * After inference it calls measure_ref_to_pred function for ref_out and model_output.
46
+ * After inference it calls measure_ref_to_pred function for ref_out and
47
+ * model_output.
46
48
*
47
- * @param[in] data_in - Array with input data. Must be applicable for *preprocess* function
48
- * @param[in] ref_out - Array with model reference output for provided input (data_in).
49
- * Against this data error measurements will be calculated
50
- * @param[in/out] model_input - Pointer to MLI tensor structure for *inference* input.
51
- * Must be applicable for *preprocess* function and used by *inference* function
52
- * @param[in/out] model_output - Pointer to MLI tensor structure for *inference* output.
53
- * Must be used by *inference* function
54
- * @param[in] preprocess - data preprocessor function. will be called before inference function
49
+ * @param[in] data_in - Array with input data. Must be applicable for
50
+ * *preprocess* function
51
+ * @param[in] ref_out - Array with model reference output for provided input
52
+ * (data_in). Against this data error measurements will be calculated
53
+ * @param[in/out] model_input - Pointer to MLI tensor structure for *inference*
54
+ * input. Must be applicable for *preprocess* function and used by *inference*
55
+ * function
56
+ * @param[in/out] model_output - Pointer to MLI tensor structure for *inference*
57
+ * output. Must be used by *inference* function
58
+ * @param[in] preprocess - data preprocessor function. will be called before
59
+ * inference function
55
60
* @param[in] inference - model inference function. Will be called once
56
61
* @param[in] inf_param - Parameter for passing to the inference function
57
62
*
58
63
* @return Operation status code (tests_aux.h)
59
64
*/
60
65
enum test_status model_run_single_in (const void * data_in , const float * ref_out ,
61
- mli_tensor * model_input ,
62
- mli_tensor * model_output , preproc_func_t preprocess ,
63
- model_inference_t inference , const char * inf_param );
66
+ mli_tensor * model_input ,
67
+ mli_tensor * model_output ,
68
+ preproc_func_t preprocess ,
69
+ model_inference_t inference ,
70
+ const char * inf_param );
64
71
65
72
/** @brief Run preprocessor and inference function in cycle
66
73
* for all input dataset with accuracy calculation
67
74
*
68
- * @detail Function opens input_idx_path dataset and for each entiti calls sequentially *preprocess*
69
- * and *inference* function passing *inf_param* to it. It also calculates accuracy according
70
- * to labels_idx_path file and print intermediate result after passing each 10% of all data
75
+ * @detail Function opens input_idx_path dataset and for each entiti calls
76
+ * sequentially *preprocess* and *inference* function passing *inf_param* to it.
77
+ * It also calculates accuracy according to labels_idx_path file and print
78
+ * intermediate result after passing each 10% of all data
71
79
*
72
80
* @param[in] input_idx_path - path to IDX dataset file for the model
73
- * @param[in] labels_idx_path - path to IDX reference labels of *input_idx_path* dataset
74
- * @param[in/out] model_input - Pointer to MLI tensor structure for *inference* input.
75
- * Must be applicable for *preprocess* function and used by *inference* function
76
- * @param[in/out] model_output - Pointer to MLI tensor structure for *inference* output.
77
- * Must be used by *inference* function
81
+ * @param[in] labels_idx_path - path to IDX reference labels of *input_idx_path*
82
+ * dataset
83
+ * @param[in/out] model_input - Pointer to MLI tensor structure for *inference*
84
+ * input. Must be applicable for *preprocess* function and used by *inference*
85
+ * function
86
+ * @param[in/out] model_output - Pointer to MLI tensor structure for *inference*
87
+ * output. Must be used by *inference* function
78
88
* @param[in] preprocess - data preprocessor function.
79
89
* will be called in cycle for each input from dataset.
80
90
* @param[in] inference - model inference function.
@@ -83,25 +93,27 @@ enum test_status model_run_single_in(const void *data_in, const float *ref_out,
83
93
*
84
94
* @return Operation status code (tests_aux.h)
85
95
*/
86
- enum test_status model_run_acc_on_idx_base (const char * input_idx_path , const char * labels_idx_path ,
87
- mli_tensor * model_input , mli_tensor * model_output ,
88
- preproc_func_t preprocess , model_inference_t inference ,
89
- const char * inf_param );
96
+ enum test_status
97
+ model_run_acc_on_idx_base (const char * input_idx_path ,
98
+ const char * labels_idx_path , mli_tensor * model_input ,
99
+ mli_tensor * model_output , preproc_func_t preprocess ,
100
+ model_inference_t inference , const char * inf_param );
90
101
91
- /** @brief Run preprocessor and inference function in cycle for all input dataset.
92
- * Outputs result to the IDX file
102
+ /** @brief Run preprocessor and inference function in cycle for all input
103
+ * dataset. Outputs result to the IDX file
93
104
*
94
- * @detail Function opens input_idx_path dataset and calls sequentially *preprocess*
95
- * and *inference* function for each entiti passing *inf_param* to it.
96
- * It fills output_idx_path by model_output values of each inference.
105
+ * @detail Function opens input_idx_path dataset and calls sequentially
106
+ * *preprocess* and *inference* function for each entiti passing *inf_param* to
107
+ * it. It fills output_idx_path by model_output values of each inference.
97
108
*
98
109
* @param[in] input_idx_path - path to IDX dataset file for the model
99
- * @param[in] output_idx_path - path to output IDX file for storing results of each inference
100
- * @param[in/out] model_input - Pointer to MLI tensor structure for *inference* input.
101
- * Must be applicable for *preprocess* function
102
- * and used by *inference* function
103
- * @param[in/out] model_output - Pointer to MLI tensor structure for *inference* output.
104
- * Must be used by *inference* function
110
+ * @param[in] output_idx_path - path to output IDX file for storing results of
111
+ * each inference
112
+ * @param[in/out] model_input - Pointer to MLI tensor structure for *inference*
113
+ * input. Must be applicable for *preprocess* function and used by *inference*
114
+ * function
115
+ * @param[in/out] model_output - Pointer to MLI tensor structure for *inference*
116
+ * output. Must be used by *inference* function
105
117
* @param[in] preprocess - data preprocessor function.
106
118
* will be called in cycle for each input from dataset.
107
119
* @param[in] inference - model inference function.
@@ -111,10 +123,12 @@ enum test_status model_run_acc_on_idx_base(const char *input_idx_path, const cha
111
123
* @return Operation status code (tests_aux.h)
112
124
*/
113
125
enum test_status model_run_idx_base_to_idx_out (const char * input_idx_path ,
114
- const char * output_idx_path ,
115
- mli_tensor * model_input , mli_tensor * model_output ,
116
- preproc_func_t preprocess , model_inference_t inference ,
117
- const char * inf_param );
126
+ const char * output_idx_path ,
127
+ mli_tensor * model_input ,
128
+ mli_tensor * model_output ,
129
+ preproc_func_t preprocess ,
130
+ model_inference_t inference ,
131
+ const char * inf_param );
118
132
119
133
#if (PLATFORM == V2DSP_XY )
120
134
#define FAST_TYPE (t ) __xy t
0 commit comments