Drop duplicated BindBackend function 10/255810/1
authorInki Dae <inki.dae@samsung.com>
Wed, 24 Mar 2021 03:55:02 +0000 (12:55 +0900)
committerInki Dae <inki.dae@samsung.com>
Wed, 24 Mar 2021 03:55:02 +0000 (12:55 +0900)
Change-Id: I5cbdb64420ce07e5cba9941bd3d76a14c3e90552
Signed-off-by: Inki Dae <inki.dae@samsung.com>
include/inference_engine_common_impl.h
src/inference_engine_common_impl.cpp
test/src/inference_engine_tc.cpp

index 3c09b027d11e97d189b38564e78508518b3c3968..63cfe7b628e1c10c8d1a041cb5fd9b8b2f5c6510 100644 (file)
@@ -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.
index 9eee40f4954134a164ba9d2e9991912e29df5428..325fd3731755b83f17f2d5364a770ff2e1af713b 100644 (file)
@@ -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");
index b66c684017a61680200f1485deee6f416be7cba5..10172006e547fb2be66a80a2a5f85e543ab9fb4f 100644 (file)
@@ -47,7 +47,6 @@ typedef std::tuple<std::string, int, int, int, int, int,
                                   std::vector<std::string>, std::vector<std::string>,
                                   std::vector<std::string>, std::vector<int> >
                ParamType_Many;
-typedef std::tuple<int> ParamType_One_Int;
 
 class InferenceEngineTestCase_G1 : public testing::TestWithParam<ParamType_One>
 {};
@@ -62,12 +61,6 @@ class InferenceEngineTestCase_G5 : public testing::TestWithParam<ParamType_Six>
 {};
 class InferenceEngineTestCase_G6 : public testing::TestWithParam<ParamType_Many>
 {};
-class InferenceEngineTestCase_G7
-               : public testing::TestWithParam<ParamType_One_Int>
-{};
-class InferenceEngineTestCase_G8
-               : public testing::TestWithParam<ParamType_One_Int>
-{};
 
 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<InferenceEngineCommon>();
-       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<InferenceEngineCommon>();
-       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 */
-                                                               ));