forked from nudt_dsp/netrans
66 lines
1.6 KiB
C
66 lines
1.6 KiB
C
/****************************************************************************
|
|
* Generated by NETRANS #NETRANS_VERSION#
|
|
* Match ovxlib #OVXLIB_VERSION#
|
|
*
|
|
* Neural Network application loop header file
|
|
****************************************************************************/
|
|
#ifndef _VNN_LOOP_H_
|
|
#define _VNN_LOOP_H_
|
|
|
|
#include "vsi_nn_pub.h"
|
|
|
|
#ifndef SAFE_FREE
|
|
#define SAFE_FREE(_PTR) {if((_PTR) != NULL){free(_PTR); (_PTR) = NULL;}}
|
|
#endif
|
|
|
|
#ifndef VSI_SAFE_FREE
|
|
#define VSI_SAFE_FREE(_PTR) {if((_PTR) != NULL){vsi_nn_Free(_PTR); (_PTR) = NULL;}}
|
|
#endif
|
|
|
|
/*-------------------------------------------
|
|
Procedure to prepare input data, return FALSE
|
|
to end loop
|
|
-------------------------------------------*/
|
|
typedef vsi_bool (*prepare_input_data_func_type)
|
|
(
|
|
vsi_nn_graph_t* graph,
|
|
uint32_t iteration,
|
|
void* user_data
|
|
);
|
|
|
|
/*-------------------------------------------
|
|
Procedure to process output data, return FALSE
|
|
to end loop
|
|
-------------------------------------------*/
|
|
typedef vsi_bool (*process_output_data_func_type)
|
|
(
|
|
vsi_nn_graph_t* graph,
|
|
uint32_t iteration,
|
|
void* user_data
|
|
);
|
|
|
|
uint32_t load_bin_data
|
|
(
|
|
const char* fname,
|
|
uint8_t** buffer_ptr,
|
|
uint32_t* buffer_sz
|
|
);
|
|
|
|
uint32_t load_tensor_data_fp32
|
|
(
|
|
const char* fname,
|
|
uint8_t** buffer_ptr,
|
|
uint32_t* buffer_sz
|
|
);
|
|
|
|
vsi_status conditional_loop
|
|
(
|
|
vsi_nn_graph_t *graph,
|
|
prepare_input_data_func_type prepare_input_data_func,
|
|
process_output_data_func_type process_output_data_func,
|
|
void* user_data
|
|
);
|
|
|
|
#endif /* _VNN_LOOP_H_ */
|
|
|