From: Inki Dae Date: Wed, 24 Mar 2021 03:55:02 +0000 (+0900) Subject: Drop duplicated BindBackend function X-Git-Tag: submit/tizen/20210325.014337~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f9908c562bb8096f2d946637b512543200ca369f;p=platform%2Fcore%2Fmultimedia%2Finference-engine-interface.git Drop duplicated BindBackend function Change-Id: I5cbdb64420ce07e5cba9941bd3d76a14c3e90552 Signed-off-by: Inki Dae --- diff --git a/include/inference_engine_common_impl.h b/include/inference_engine_common_impl.h index 3c09b02..63cfe7b 100644 --- a/include/inference_engine_common_impl.h +++ b/include/inference_engine_common_impl.h @@ -63,19 +63,6 @@ namespace Common */ int BindBackend(inference_engine_config *config); - /** - * @brief Load a backend engine library with a given backend type. - * @details This callback loads a backend engine library with a given backend type. - * In order to find a backend engine library corresponding to the given backend type, - * this function makes a full name of the library file with given backend type. - * After that, it opens the library file by calling dlopen function to find a entry point - * function - EngineInit - of a actual backend library. - * - * @since_tizen 6.0 - * @param[in] backend_type A eumeration value which indicates one of backend types - refer to inference_backend_type_e. - */ - int BindBackend(int backend_type, int device_type); - /** * @brief Unload a backend engine library. * @details This callback unload a backend engine library. diff --git a/src/inference_engine_common_impl.cpp b/src/inference_engine_common_impl.cpp index 9eee40f..325fd37 100644 --- a/src/inference_engine_common_impl.cpp +++ b/src/inference_engine_common_impl.cpp @@ -416,60 +416,6 @@ namespace Common return INFERENCE_ENGINE_ERROR_NONE; } - int InferenceEngineCommon::BindBackend(int backend_type, int device_type) - { - LOGI("ENTER"); - - if (mBackendHandle) { - LOGE("Already backend engine has been initialized."); - return INFERENCE_ENGINE_ERROR_INVALID_OPERATION; - } - - if (backend_type <= INFERENCE_BACKEND_NONE || - backend_type >= INFERENCE_BACKEND_MAX) { - LOGE("Backend type is invalid."); - return INFERENCE_ENGINE_ERROR_INVALID_PARAMETER; - } - - if (mUseProfiler == true) { - // Memory usage will be measured between BindBackend ~ UnbindBackend callbacks. - mProfiler.Start(IE_PROFILER_MEMORY); - } - - std::string backendNameTable[INFERENCE_BACKEND_MAX] = { - [INFERENCE_BACKEND_OPENCV] = "opencv", - [INFERENCE_BACKEND_TFLITE] = "tflite", - [INFERENCE_BACKEND_ARMNN] = "armnn", - [INFERENCE_BACKEND_MLAPI] = "mlapi", - [INFERENCE_BACKEND_ONE] = "mlapi" - }; - - int api_fw_type; - - // For two backend types - MLAPI and ONE, MLAPI will be used as API framework in default. - // And for all NPU devices passed with INFERENCE_TARGET_CUSTOM type, MLAPI will be used as API framework in default. - if (UseMLAPI(backend_type, device_type)) - api_fw_type = INFERENCE_BACKEND_MLAPI; - else - api_fw_type = backend_type; - - std::string backendLibName = - "libinference-engine-" + backendNameTable[api_fw_type] + ".so"; - - int ret = InitBackendEngine(backendLibName, backend_type, device_type); - if (ret != INFERENCE_ENGINE_ERROR_NONE) { - return ret; - } - - if (mUseProfiler == true) { - mProfiler.AddBackendName(backendNameTable[backend_type]); - } - - LOGI("LEAVE"); - - return INFERENCE_ENGINE_ERROR_NONE; - } - void InferenceEngineCommon::UnbindBackend(void) { LOGW("ENTER"); diff --git a/test/src/inference_engine_tc.cpp b/test/src/inference_engine_tc.cpp index b66c684..1017200 100644 --- a/test/src/inference_engine_tc.cpp +++ b/test/src/inference_engine_tc.cpp @@ -47,7 +47,6 @@ typedef std::tuple, std::vector, std::vector, std::vector > ParamType_Many; -typedef std::tuple ParamType_One_Int; class InferenceEngineTestCase_G1 : public testing::TestWithParam {}; @@ -62,12 +61,6 @@ class InferenceEngineTestCase_G5 : public testing::TestWithParam {}; class InferenceEngineTestCase_G6 : public testing::TestWithParam {}; -class InferenceEngineTestCase_G7 - : public testing::TestWithParam -{}; -class InferenceEngineTestCase_G8 - : public testing::TestWithParam -{}; static auto InferenceEngineInit_One_Param = [](InferenceEngineCommon *engine, std::string &backend_name) -> int { @@ -654,40 +647,6 @@ TEST_P(InferenceEngineTestCase_G6, Inference_P) models.clear(); } -TEST_P(InferenceEngineTestCase_G7, Bind_P) -{ - int backend_type; - - std::tie(backend_type) = GetParam(); - - auto engine = std::make_unique(); - ASSERT_TRUE(engine); - - int ret = engine->LoadConfigFile(); - ASSERT_EQ(ret, INFERENCE_ENGINE_ERROR_NONE); - - ret = engine->BindBackend(backend_type, INFERENCE_TARGET_CPU); - ASSERT_EQ(ret, INFERENCE_ENGINE_ERROR_NONE); - - engine->UnbindBackend(); -} - -TEST_P(InferenceEngineTestCase_G8, Bind_N) -{ - int backend_type; - - std::tie(backend_type) = GetParam(); - - auto engine = std::make_unique(); - ASSERT_TRUE(engine); - - int ret = engine->LoadConfigFile(); - ASSERT_EQ(ret, INFERENCE_ENGINE_ERROR_NONE); - - ret = engine->BindBackend(backend_type, 0); - ASSERT_EQ(ret, INFERENCE_ENGINE_ERROR_INVALID_PARAMETER); -} - INSTANTIATE_TEST_CASE_P(Prefix, InferenceEngineTestCase_G1, testing::Values( // parameter order : backend name @@ -927,27 +886,3 @@ INSTANTIATE_TEST_CASE_P( { 955 }) /* TODO */ )); - -INSTANTIATE_TEST_CASE_P(Prefix, InferenceEngineTestCase_G7, - testing::Values( - // parameter order : backend type - // ARMNN. - ParamType_One_Int(INFERENCE_BACKEND_ARMNN), - // TFLITE. - ParamType_One_Int(INFERENCE_BACKEND_TFLITE), - // OPENCV. - ParamType_One_Int(INFERENCE_BACKEND_OPENCV), - // ML Single API for NNStreamer with On-device Neural Engine tensor filter. - ParamType_One_Int(INFERENCE_BACKEND_ONE), - // ML Single API for NNStreamer with Vinvante NPU. - ParamType_One_Int(INFERENCE_BACKEND_MLAPI) - /* TODO */ - )); - -INSTANTIATE_TEST_CASE_P(Prefix, InferenceEngineTestCase_G8, - testing::Values( - // parameter order : backend type - // Wrong backend type. - ParamType_One_Int(-1) - /* TODO */ - ));