[Application] Fix Resnet Application -ENABLE_TFLITE_INTERPRETER CASES
authorDongHak Park <donghak.park@samsung.com>
Mon, 24 Apr 2023 10:30:53 +0000 (19:30 +0900)
committerJijoong Moon <jijoong.moon@samsung.com>
Thu, 11 May 2023 00:11:43 +0000 (09:11 +0900)
Now TFLITE Interpreter is not support loss : cross type
So in Resnet Application we made some macro to make them mse and there was some wrong part

in ResNet Application there was another macro for ENABLE_TEST GTEST's result assume that Application use cross loss

For Correct Result Fix some #if statement

TODO :  even if fix this situation TEST still failed regardless of tflite export releated code

Signed-off-by: DongHak Park <donghak.park@samsung.com>
Applications/Resnet/jni/main.cpp

index 9282c67..074f453 100644 (file)
@@ -199,7 +199,7 @@ std::vector<LayerHandle> createResnet18Graph() {
 /// @todo update createResnet18 to be more generic
 ModelHandle createResnet18() {
 /// @todo support "LOSS : cross" for TF_Lite Exporter
-#if defined(ENABLE_TEST)
+#if (defined(ENABLE_TFLITE_INTERPRETER) && !defined(ENABLE_TEST))
   ModelHandle model = ml::train::createModel(ml::train::ModelType::NEURAL_NET,
                                              {withKey("loss", "mse")});
 #else
@@ -270,9 +270,10 @@ void createAndRun(unsigned int epochs, unsigned int batch_size,
   model->train();
 
 #if defined(ENABLE_TEST)
-  model->exports(ml::train::ExportMethods::METHOD_TFLITE, "resnet_test.tflite");
   training_loss = model->getTrainingLoss();
   validation_loss = model->getValidationLoss();
+#elif defined(ENABLE_TFLITE_INTERPRETER)
+  model->exports(ml::train::ExportMethods::METHOD_TFLITE, "resnet_test.tflite");
 #endif
 }