From: Tae-Young Chung Date: Mon, 16 Jan 2023 06:09:15 +0000 (+0900) Subject: Add flex delegate X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Fsandbox%2Ftyzeroy%2Fflex;p=platform%2Fcore%2Fmultimedia%2Finference-engine-tflite.git Add flex delegate Signed-off-by: Tae-Young Chung --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 8c520ef..78394f0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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} diff --git a/packaging/inference-engine-tflite.spec b/packaging/inference-engine-tflite.spec index 566eae8..4fd6ca1 100644 --- a/packaging/inference-engine-tflite.spec +++ b/packaging/inference-engine-tflite.spec @@ -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 diff --git a/src/inference_engine_tflite.cpp b/src/inference_engine_tflite.cpp index 8f22bd9..1633674 100644 --- a/src/inference_engine_tflite.cpp +++ b/src/inference_engine_tflite.cpp @@ -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()); diff --git a/src/inference_engine_tflite_private.h b/src/inference_engine_tflite_private.h index d491500..9d4c2a4 100644 --- a/src/inference_engine_tflite_private.h +++ b/src/inference_engine_tflite_private.h @@ -19,10 +19,9 @@ #include -#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 #include