disable tflite parser support 55/285955/3 accepted/tizen/unified/20221226.070017
authorInki Dae <inki.dae@samsung.com>
Fri, 23 Dec 2022 05:25:57 +0000 (14:25 +0900)
committerInki Dae <inki.dae@samsung.com>
Fri, 23 Dec 2022 06:54:44 +0000 (15:54 +0900)
Change-Id: I0d9c2d7dfef04df0bc4f8e08c2de5a5306a4fc9f
Signed-off-by: Inki Dae <inki.dae@samsung.com>
CMakeLists.txt
packaging/inference-engine-armnn.spec
src/inference_engine_armnn.cpp
src/inference_engine_armnn_private.h

index b00cc3b50261c249ff076b60fb4ede28b5f192cd..3860aa1185bb9c761f1be5334f8c0e8503485eba 100644 (file)
@@ -41,6 +41,11 @@ IF (${ARMNN_GRAPH_DEBUG})
     ADD_DEFINITIONS(-DGRAPH_DEBUG)
 ENDIF()
 
+IF (${ARMNN_TFLITE_PARSER_SUPPORT})
+    MESSAGE("TFlite parser support enabled.")
+       ADD_DEFINITIONS(-DTFLITE_PARSER_SUPPORT)
+ENDIF()
+
 ADD_DEFINITIONS(-DARMNN_LOG_LEVEL=${ARMNN_LOG_LEVEL})
 
 SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=${LIB_INSTALL_DIR}")
index 177e4d4a0598b2f712a9c90a1bccb98b35fe7bfa..2a34d8dd9feb9c73567e6a5a7e12fb1f01746d58 100644 (file)
@@ -16,7 +16,7 @@ BuildRequires: pkgconfig(armnn)
 
 # Log levels of ARMNN_LOG
 # Trace = 0, Debug = 1, Info = 2, Warning = 3, Error = 4, Fatal = 5
-%define build_options -DARMNN_GRAPH_DEBUG=0 -DARMNN_LOG_LEVEL=2
+%define build_options -DARMNN_GRAPH_DEBUG=0 -DARMNN_LOG_LEVEL=2 -DARMNN_TFLITE_PARSER_SUPPORT=0
 
 %description
 ARM Neural Network Runtime based implementation of inference-engine-interface
index 5409b44c90a32d6a535b7893a17709de3d8f2e78..651ca928b34555575156944382bd636e397681ba 100644 (file)
 
 #include <armnn/ArmNN.hpp>
 #include <armnn/backends/ITensorHandle.hpp>
+
+#if TFLITE_PARSER_SUPPORT
 #include <armnnTfLiteParser/ITfLiteParser.hpp>
+#endif
 
 #define LOG_LEVEL      ARMNN_LOG_LEVEL
 
@@ -137,6 +140,7 @@ namespace ARMNNImpl
                return INFERENCE_ENGINE_ERROR_NONE;
        }
 
+#if TFLITE_PARSER_SUPPORT
        int InferenceARMNN::CreateTfLiteNetwork(std::string model_path)
        {
                LOGI("ENTER");
@@ -203,6 +207,7 @@ namespace ARMNNImpl
 
                return INFERENCE_ENGINE_ERROR_NONE;
        }
+#endif // TFLITE_PARSER_SUPPORT
 
        int InferenceARMNN::CreateNetwork(std::vector<std::string> model_paths,
                                                                          inference_model_format_e model_format)
@@ -221,13 +226,8 @@ namespace ARMNNImpl
                int ret = INFERENCE_ENGINE_ERROR_NONE;
 
                switch ((int) model_format) {
-               case INFERENCE_MODEL_CAFFE:
-               case INFERENCE_MODEL_TF:
-               case INFERENCE_MODEL_ONNX:
-                       ret = INFERENCE_ENGINE_ERROR_NOT_SUPPORTED_FORMAT;
-                       // TODO. Call a proper parser.
-                       break;
                case INFERENCE_MODEL_TFLITE:
+#if TFLITE_PARSER_SUPPORT
                        std::string model_path = model_paths[0];
                        if (access(model_path.c_str(), F_OK)) {
                                LOGE("modelFilePath in [%s] ", model_path.c_str());
@@ -237,6 +237,17 @@ namespace ARMNNImpl
 
                        LOGI("It will try to load %s model file", model_path.c_str());
                        return CreateTfLiteNetwork(model_path);
+#endif
+               case INFERENCE_MODEL_CAFFE:
+               case INFERENCE_MODEL_TF:
+               case INFERENCE_MODEL_ONNX:
+                       ret = INFERENCE_ENGINE_ERROR_NOT_SUPPORTED_FORMAT;
+                       // TODO. Call a proper parser.
+                       break;
+               default:
+                       LOGE("Model format %d not supported.", static_cast<int>(model_format));
+                       ret = INFERENCE_ENGINE_ERROR_NOT_SUPPORTED_FORMAT;
+                       break;
                }
 
                LOGE("Model format not supported.");
index b1f98c3614958dd086a61fb2128803d8926f61a0..3de836638793d9a23845bcf0ba07146731719eda 100644 (file)
@@ -23,7 +23,6 @@
 #include <dlog.h>
 
 #include <armnn/ArmNN.hpp>
-#include <armnnTfLiteParser/ITfLiteParser.hpp>
 
 /**
 * @file inference_engine_armnn_private.h