Add flex delegate sandbox/tyzeroy/flex
authorTae-Young Chung <ty83.chung@samsung.com>
Mon, 16 Jan 2023 06:09:15 +0000 (15:09 +0900)
committerTae-Young Chung <ty83.chung@samsung.com>
Wed, 18 Jan 2023 08:25:08 +0000 (17:25 +0900)
Signed-off-by: Tae-Young Chung <ty83.chung@samsung.com>
CMakeLists.txt
packaging/inference-engine-tflite.spec
src/inference_engine_tflite.cpp
src/inference_engine_tflite_private.h

index 8c520ef98d3512dc1c71d30066f87ede21ffbeb0..78394f04f84888a17fc4cd29423f3ece3347aa12 100644 (file)
@@ -8,7 +8,7 @@ SET(CMAKE_INSTALL_PREFIX /usr)
 SET(PREFIX ${CMAKE_INSTALL_PREFIX})
 
 SET(INC_DIR "${PROJECT_SOURCE_DIR}/include")
-SET(dependents "dlog inference-engine-interface-common tensorflow2-lite")
+SET(dependents "dlog inference-engine-interface-common")
 
 INCLUDE(FindPkgConfig)
 pkg_check_modules(${fw_name} REQUIRED ${dependents})
@@ -23,10 +23,10 @@ ENDFOREACH(flag)
 #Remove leading whitespace POLICY CMP0004
 STRING(REGEX REPLACE "^ " "" EXTRA_LDFLAGS ${EXTRA_LDFLAGS})
 
-SET(CMAKE_C_FLAGS "-I./include -I./include/headers ${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -w")
+SET(CMAKE_C_FLAGS "-I./include -I./include/headers ${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}  -fPIC -Wall -w")
 SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
 
-SET(CMAKE_CXX_FLAGS "-I./include -I./include/headers -I/usr/include/tensorflow2/tensorflow ${CMAKE_CXX_FLAGS} ${EXTRA_CXXFLAGS} -fPIC")
+SET(CMAKE_CXX_FLAGS "-I./include -I./include/headers -I/usr/include/tensorflow ${CMAKE_CXX_FLAGS} ${EXTRA_CXXFLAGS} -fPIC")
 SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g --w")
 
 ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
@@ -38,6 +38,7 @@ aux_source_directory(src SOURCES)
 ADD_LIBRARY(${fw_name} SHARED ${SOURCES})
 
 TARGET_LINK_LIBRARIES(${fw_name} ${EXTRA_LDFLAGS})
+TARGET_LINK_LIBRARIES(${fw_name} -Wl,--no-as-needed tensorflowlite tensorflowlite_flex)
 
 
 SET_TARGET_PROPERTIES(${fw_name}
index 566eae8062a31f4dd01d0f722e8f18b403be5887..4fd6ca1b988da0c6c9b1145cb4e8f24caf1774fb 100644 (file)
@@ -13,7 +13,6 @@ BuildRequires: pkgconfig(dlog)
 BuildRequires: pkgconfig(inference-engine-interface-common)
 BuildRequires: coregl-devel
 BuildRequires: flatbuffers-devel
-BuildRequires: tensorflow2-lite-devel
 
 %description
 Tensorflow-Lite based implementation of inference-engine-interface
index 8f22bd996a7272eff890f2e33c4240a6558cb583..1633674fadc387e79b8fe721480c8ce6f558843d 100644 (file)
@@ -115,22 +115,8 @@ namespace TFLiteImpl
 
                LOGI("Inferece targets are: [%d]", mTargetTypes);
 
-               if (mTargetTypes == INFERENCE_TARGET_GPU) {
-                       TfLiteGpuDelegateOptionsV2 options = TfLiteGpuDelegateOptionsV2Default();
-                       TfLiteDelegate *delegate = TfLiteGpuDelegateV2Create(&options);
-                       if (!delegate){
-                               LOGE("Failed to GPU delegate");
-                               return INFERENCE_ENGINE_ERROR_INVALID_OPERATION;
-                       }
-
-                       if (mInterpreter->ModifyGraphWithDelegate(delegate) != kTfLiteOk)
-                       {
-                               LOGE("Failed to construct GPU delegate");
-                               return INFERENCE_ENGINE_ERROR_INVALID_OPERATION;
-                       }
-               }
-
                mInterpreter->SetNumThreads(MV_INFERENCE_TFLITE_MAX_THREAD_NUM);
+
                LOGI("mInterpreter->tensors_size() :[%zu]",
                         mInterpreter->tensors_size());
 
index d4915007a49a0cda4a869da8378a5e57930617a4..9d4c2a41394e28db2681db9a6e6ae5c51bd97aec 100644 (file)
 
 #include <inference_engine_common.h>
 
-#include "tensorflow2/lite/delegates/gpu/delegate.h"
-#include "tensorflow2/lite/kernels/register.h"
-#include "tensorflow2/lite/model.h"
-#include "tensorflow2/lite/optional_debug_tools.h"
+#include "tensorflow/lite/kernels/register.h"
+#include "tensorflow/lite/model.h"
+#include "tensorflow/lite/optional_debug_tools.h"
 
 #include <memory>
 #include <dlog.h>