summaryrefslogtreecommitdiff
path: root/tests/use_case/ad/InferenceTestAD.cc
diff options
context:
space:
mode:
Diffstat (limited to 'tests/use_case/ad/InferenceTestAD.cc')
-rw-r--r--tests/use_case/ad/InferenceTestAD.cc29
1 files changed, 20 insertions, 9 deletions
diff --git a/tests/use_case/ad/InferenceTestAD.cc b/tests/use_case/ad/InferenceTestAD.cc
index b87699d..d5e21c2 100644
--- a/tests/use_case/ad/InferenceTestAD.cc
+++ b/tests/use_case/ad/InferenceTestAD.cc
@@ -19,7 +19,7 @@
#include <random>
#include "AdModel.hpp"
-#include "AdGoldenInput.hpp"
+#include "TestData_ad.hpp"
#include "hal.h"
#include "TensorFlowLiteMicro.hpp"
@@ -27,6 +27,8 @@
#define AD_IN_FEATURE_VEC_DATA_SIZE (1024)
#endif /* AD_FEATURE_VEC_DATA_SIZE */
+using namespace test;
+
bool RunInference(arm::app::Model& model, const int8_t vec[])
{
TfLiteTensor *inputTensor = model.GetInputTensor(0);
@@ -67,7 +69,7 @@ void TestInference(const T *input_goldenFV, const T *output_goldenFV, arm::app::
TfLiteTensor *outputTensor = model.GetOutputTensor(0);
REQUIRE(outputTensor);
- REQUIRE(outputTensor->bytes == AD_OUT_FEATURE_VEC_DATA_SIZE);
+ REQUIRE(outputTensor->bytes == OFM_DATA_SIZE);
auto tensorData = tflite::GetTensorData<T>(outputTensor);
REQUIRE(tensorData);
@@ -77,7 +79,7 @@ void TestInference(const T *input_goldenFV, const T *output_goldenFV, arm::app::
}
}
-TEST_CASE("Running random inference with TensorFlow Lite Micro and AdModel Int8", "[AD][.]")
+TEST_CASE("Running random inference with TensorFlow Lite Micro and AdModel Int8", "[AD]")
{
arm::app::AdModel model{};
@@ -88,13 +90,22 @@ TEST_CASE("Running random inference with TensorFlow Lite Micro and AdModel Int8"
REQUIRE(RunInferenceRandom(model));
}
-TEST_CASE("Running golden vector inference with TensorFlow Lite Micro and AdModel Int8", "[AD][.]")
+TEST_CASE("Running golden vector inference with TensorFlow Lite Micro and AdModel Int8", "[AD]")
{
- arm::app::AdModel model{};
+ for (uint32_t i = 0 ; i < NUMBER_OF_FM_FILES; ++i) {
+ auto input_goldenFV = get_ifm_data_array(i);;
+ auto output_goldenFV = get_ofm_data_array(i);
- REQUIRE_FALSE(model.IsInited());
- REQUIRE(model.Init());
- REQUIRE(model.IsInited());
+ DYNAMIC_SECTION("Executing inference with re-init")
+ {
+ arm::app::AdModel model{};
+
+ REQUIRE_FALSE(model.IsInited());
+ REQUIRE(model.Init());
+ REQUIRE(model.IsInited());
- TestInference(ad_golden_input, ad_golden_out, model);
+ TestInference<int8_t>(input_goldenFV, output_goldenFV, model);
+
+ }
+ }
} \ No newline at end of file