#include "tensor_filter_tensorflow_lite_core.h"
#include "tensor_common.h"
-/**
- * @brief nnapi hw type string
- */
-static const char *nnapi_hw_string[] = {
- [NNAPI_CPU] = "cpu",
- [NNAPI_GPU] = "gpu",
- [NNAPI_NPU] = "npu",
- [NNAPI_UNKNOWN] = "unknown",
- NULL
-};
-
void init_filter_tflite (void) __attribute__ ((constructor));
void fini_filter_tflite (void) __attribute__ ((destructor));
#define DBG FALSE
#endif
+
/**
* @brief TFLiteCore creator
* @param _model_path : the logical path to '{model_name}.tffile' file
}
}
#endif
-
- g_message ("interpreter->UseNNAPI: %d" , use_nnapi);
+ g_message ("interpreter->UseNNAPI( %s : %s )" , use_nnapi?"true":"false", nnapi_hw_string[accel]);
/** set allocation type to dynamic for in/out tensors */
int tensor_idx;
extern "C"
{
#endif
+/**
+ * @brief nnapi hw type string
+ */
+ static const char *nnapi_hw_string[] = {
+ [NNAPI_CPU] = "cpu",
+ [NNAPI_GPU] = "gpu",
+ [NNAPI_NPU] = "npu",
+ [NNAPI_UNKNOWN] = "unknown",
+ NULL
+ };
void *tflite_core_new (const char *_model_path, nnapi_hw hw);
void tflite_core_delete (void * tflite);
# Fail test for invalid output properties
gstTest "--gst-plugin-path=${PATH_TO_PLUGIN} filesrc location=${PATH_TO_IMAGE} ! pngdec ! videoscale ! imagefreeze ! videoconvert ! video/x-raw,format=RGB,framerate=0/1 ! tensor_converter ! tensor_filter framework=tensorflow-lite model=${PATH_TO_MODEL} output=1:7 outputtype=int8 ! filesink location=tensorfilter.out.log" 3F_n 0 1 $PERFORMANCE
+# Property reading test for nnapi
+gstTest "--gst-plugin-path=${PATH_TO_PLUGIN} filesrc location=${PATH_TO_IMAGE} ! pngdec ! videoscale ! imagefreeze ! videoconvert ! video/x-raw,format=RGB,framerate=0/1 ! tensor_converter ! tensor_filter framework=tensorflow-lite model=${PATH_TO_MODEL} nnapi=true:cpu ! filesink location=tensorfilter.out.log" 2-1 1 0 $PERFORMANCE 2> info
+cat info | grep "true : cpu"
+testResult $? 2-1 "Golden test comparison" 0 1
+
+# Property reading test for nnapi
+gstTest "--gst-plugin-path=${PATH_TO_PLUGIN} filesrc location=${PATH_TO_IMAGE} ! pngdec ! videoscale ! imagefreeze ! videoconvert ! video/x-raw,format=RGB,framerate=0/1 ! tensor_converter ! tensor_filter framework=tensorflow-lite model=${PATH_TO_MODEL} nnapi=true ! filesink location=tensorfilter.out.log" 2-2 1 0 $PERFORMANCE 2> info
+cat info | grep "true : cpu"
+testResult $? 2-2 "Golden test comparison" 0 1
+
+# Property reading test for nnapi
+gstTest "--gst-plugin-path=${PATH_TO_PLUGIN} filesrc location=${PATH_TO_IMAGE} ! pngdec ! videoscale ! imagefreeze ! videoconvert ! video/x-raw,format=RGB,framerate=0/1 ! tensor_converter ! tensor_filter framework=tensorflow-lite model=${PATH_TO_MODEL} nnapi=true:gpu ! filesink location=tensorfilter.out.log" 2-3 1 0 $PERFORMANCE 2> info
+cat info | grep "true : gpu"
+testResult $? 2-3 "Golden test comparison" 0 1
+
report