diff --git a/.ci/azure/linux.yml b/.ci/azure/linux.yml index 1060f3f7a68..4c8d7340f0f 100644 --- a/.ci/azure/linux.yml +++ b/.ci/azure/linux.yml @@ -117,9 +117,9 @@ jobs: # For running Python API tests python3 -m pip install -r $(REPO_DIR)/inference-engine/ie_bridges/python/src/requirements-dev.txt # For running PaddlePaddle frontend unit tests - python3 -m pip install -r $(REPO_DIR)/ngraph/test/frontend/paddlepaddle/requirements_dev.txt + python3 -m pip install -r $(REPO_DIR)/src/core/tests/frontend/paddlepaddle/requirements_dev.txt # For running ONNX frontend unit tests - python3 -m pip install -r $(REPO_DIR)/ngraph/test/requirements_test_onnx.txt + python3 -m pip install -r $(REPO_DIR)/src/core/tests/requirements_test_onnx.txt # For MO unit tests python3 -m pip install -r $(REPO_DIR)/model-optimizer/requirements.txt python3 -m pip install -r $(REPO_DIR)/model-optimizer/requirements_dev.txt diff --git a/.ci/azure/linux_lohika.yml b/.ci/azure/linux_lohika.yml index dca5cbc4c28..8d9e8e2b735 100644 --- a/.ci/azure/linux_lohika.yml +++ b/.ci/azure/linux_lohika.yml @@ -86,9 +86,9 @@ jobs: # For running Python API tests python3 -m pip install -r $(REPO_DIR)/inference-engine/ie_bridges/python/src/requirements-dev.txt # For running PaddlePaddle frontend unit tests - python3 -m pip install -r $(REPO_DIR)/ngraph/test/frontend/paddlepaddle/requirements_dev.txt + python3 -m pip install -r $(REPO_DIR)/src/core/tests/frontend/paddlepaddle/requirements_dev.txt # For running ONNX frontend unit tests - python3 -m pip install -r $(REPO_DIR)/ngraph/test/requirements_test_onnx.txt + python3 -m pip install -r $(REPO_DIR)/src/core/tests/requirements_test_onnx.txt # For MO unit tests python3 -m pip install -r $(REPO_DIR)/model-optimizer/requirements.txt python3 -m pip install -r $(REPO_DIR)/model-optimizer/requirements_dev.txt diff --git a/.ci/azure/linux_ngraph_onnx.yml b/.ci/azure/linux_ngraph_onnx.yml index 6858024e877..f8166f26b4d 100644 --- a/.ci/azure/linux_ngraph_onnx.yml +++ b/.ci/azure/linux_ngraph_onnx.yml @@ -79,7 +79,7 @@ jobs: workingDirectory: $(WORK_DIR) displayName: 'Install dependencies' - - script: runtime/bindings/python/tests/test_onnx/model_zoo_preprocess.sh -d $(MODELS_DIR)/models_data -o -s "$(ONNX_MODEL_ZOO_SHA)" + - script: src/bindings/python/tests/test_onnx/model_zoo_preprocess.sh -d $(MODELS_DIR)/models_data -o -s "$(ONNX_MODEL_ZOO_SHA)" displayName: 'Update models' condition: ne(variables['BUILD_TYPE'], 'Debug') diff --git a/.ci/azure/mac.yml b/.ci/azure/mac.yml index 517f2b93dd1..bf61f09c8b2 100644 --- a/.ci/azure/mac.yml +++ b/.ci/azure/mac.yml @@ -84,7 +84,7 @@ jobs: - script: | brew install cython brew install automake - python3 -m pip install -r $(REPO_DIR)/ngraph/test/requirements_test_onnx.txt + python3 -m pip install -r $(REPO_DIR)/src/core/tests/requirements_test_onnx.txt # Speed up build brew install ninja # Speed up tests diff --git a/.ci/azure/windows.yml b/.ci/azure/windows.yml index 07d62f33878..9f7b1256bad 100644 --- a/.ci/azure/windows.yml +++ b/.ci/azure/windows.yml @@ -110,9 +110,9 @@ jobs: rem For running Python API tests python -m pip install -r $(REPO_DIR)\inference-engine\ie_bridges\python\src\requirements-dev.txt rem For running PaddlePaddle frontend unit tests - python -m pip install -r $(REPO_DIR)\ngraph\test\frontend\paddlepaddle\requirements_dev.txt + python -m pip install -r $(REPO_DIR)\src\core\tests\frontend\paddlepaddle\requirements_dev.txt rem For running ONNX frontend unit tests - python -m pip install -r $(REPO_DIR)\ngraph\test\requirements_test_onnx.txt + python -m pip install -r $(REPO_DIR)\src\core\tests\requirements_test_onnx.txt rem For MO unit tests python -m pip install -r $(REPO_DIR)\model-optimizer\requirements.txt python -m pip install -r $(REPO_DIR)\model-optimizer\requirements_dev.txt @@ -132,7 +132,7 @@ jobs: - script: | set PATH=$(WORK_DIR)\ninja-win;%PATH% - call "$(MSVS_VARS_PATH)" && $(CMAKE_CMD) -GNinja -DENABLE_ONEDNN_FOR_GPU=OFF -DENABLE_GNA=$(CMAKE_BUILD_SHARED_LIBS) -DENABLE_CLDNN=$(CMAKE_BUILD_SHARED_LIBS) -DENABLE_GAPI_PREPROCESSING=$(CMAKE_BUILD_SHARED_LIBS) -DBUILD_SHARED_LIBS=$(CMAKE_BUILD_SHARED_LIBS) -DENABLE_REQUIREMENTS_INSTALL=OFF -DENABLE_FASTER_BUILD=ON -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DENABLE_TESTS=ON -DENABLE_STRICT_DEPENDENCIES=OFF -DENABLE_PYTHON=ON -DPYTHON_EXECUTABLE="C:\hostedtoolcache\windows\Python\3.7.6\x64\python.exe" -DPYTHON_INCLUDE_DIR="C:\hostedtoolcache\windows\Python\3.7.6\x64\include" -DPYTHON_LIBRARY="C:\hostedtoolcache\windows\Python\3.7.6\x64\libs\python37.lib" -DIE_EXTRA_MODULES=$(OPENVINO_CONTRIB_REPO_DIR)\modules -DCMAKE_C_COMPILER:PATH="$(MSVC_COMPILER_PATH)" -DCMAKE_CXX_COMPILER:PATH="$(MSVC_COMPILER_PATH)" $(REPO_DIR) + call "$(MSVS_VARS_PATH)" && $(CMAKE_CMD) -G "Ninja Multi-Config" -DENABLE_ONEDNN_FOR_GPU=OFF -DENABLE_GNA=$(CMAKE_BUILD_SHARED_LIBS) -DENABLE_CLDNN=$(CMAKE_BUILD_SHARED_LIBS) -DENABLE_GAPI_PREPROCESSING=$(CMAKE_BUILD_SHARED_LIBS) -DBUILD_SHARED_LIBS=$(CMAKE_BUILD_SHARED_LIBS) -DENABLE_REQUIREMENTS_INSTALL=OFF -DENABLE_FASTER_BUILD=ON -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DENABLE_TESTS=ON -DENABLE_STRICT_DEPENDENCIES=OFF -DENABLE_PYTHON=ON -DPYTHON_EXECUTABLE="C:\hostedtoolcache\windows\Python\3.7.6\x64\python.exe" -DPYTHON_INCLUDE_DIR="C:\hostedtoolcache\windows\Python\3.7.6\x64\include" -DPYTHON_LIBRARY="C:\hostedtoolcache\windows\Python\3.7.6\x64\libs\python37.lib" -DIE_EXTRA_MODULES=$(OPENVINO_CONTRIB_REPO_DIR)\modules -DCMAKE_C_COMPILER:PATH="$(MSVC_COMPILER_PATH)" -DCMAKE_CXX_COMPILER:PATH="$(MSVC_COMPILER_PATH)" $(REPO_DIR) workingDirectory: $(BUILD_DIR) displayName: 'CMake' @@ -210,12 +210,10 @@ jobs: - script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\paddlepaddle_tests --gtest_print_time=1 --gtest_output=xml:TEST-PaddlePaddle.xml displayName: 'PaddlePaddle Frontend UT' continueOnError: false - condition: eq(variables['CMAKE_BUILD_SHARED_LIBS'], 'ON') - script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\tensorflow_tests --gtest_print_time=1 --gtest_output=xml:TEST-Tensorflow.xml displayName: 'Tensorflow Frontend UT' continueOnError: false - condition: eq(variables['CMAKE_BUILD_SHARED_LIBS'], 'ON') - script: | set PATH=$(IB_DIR);%PATH% diff --git a/.ci/openvino-onnx/Dockerfile b/.ci/openvino-onnx/Dockerfile index 0992ea21220..c4b56c2c7b4 100644 --- a/.ci/openvino-onnx/Dockerfile +++ b/.ci/openvino-onnx/Dockerfile @@ -72,7 +72,7 @@ RUN cmake .. \ RUN make -j $(nproc) install # Run tests via tox -WORKDIR /openvino/runtime/bindings/python +WORKDIR /openvino/src/bindings/python ENV OpenVINO_DIR=/openvino/dist/runtime/cmake ENV LD_LIBRARY_PATH=/openvino/dist/runtime/lib:/openvino/dist/runtime/3rdparty/tbb/lib ENV PYTHONPATH=/openvino/bin/intel64/${BUILD_TYPE}/lib/python_api/python3.8:${PYTHONPATH} diff --git a/.ci/openvino-onnx/Jenkinsfile b/.ci/openvino-onnx/Jenkinsfile index cfe866c23eb..6b8b19193d4 100644 --- a/.ci/openvino-onnx/Jenkinsfile +++ b/.ci/openvino-onnx/Jenkinsfile @@ -93,7 +93,7 @@ def prepare_repository(String workdir) { def updateModels() { sh """ - ./runtime/bindings/python/tests/test_onnx/model_zoo_preprocess.sh -d ${HOME}/ONNX_CI/models_data -o -s ${ONNX_MODEL_ZOO_SHA} + ./src/bindings/python/tests/test_onnx/model_zoo_preprocess.sh -d ${HOME}/ONNX_CI/models_data -o -s ${ONNX_MODEL_ZOO_SHA} """ } @@ -210,4 +210,4 @@ pipeline { } } -} \ No newline at end of file +} diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 863c4603442..036611ee975 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -4,7 +4,7 @@ version: 2 updates: # Enable version updates for nGraph Python API - package-ecosystem: pip - directory: "/runtime/bindings/python" + directory: "/src/bindings/python" schedule: interval: weekly day: monday diff --git a/.gitmodules b/.gitmodules index 128209adef3..e9174b4e3ac 100644 --- a/.gitmodules +++ b/.gitmodules @@ -44,8 +44,8 @@ [submodule "thirdparty/protobuf"] path = thirdparty/protobuf/protobuf url = https://github.com/protocolbuffers/protobuf.git -[submodule "runtime/bindings/python/thirdparty/pybind11"] - path = runtime/bindings/python/thirdparty/pybind11 +[submodule "src/bindings/python/thirdparty/pybind11"] + path = src/bindings/python/thirdparty/pybind11 url = https://github.com/pybind/pybind11.git [submodule "thirdparty/ittapi/ittapi"] path = thirdparty/ittapi/ittapi diff --git a/CMakeLists.txt b/CMakeLists.txt index 8ada4c8cfdd..c73e5f52b4f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,10 +32,12 @@ endif() # resolving dependencies for the project message (STATUS "PROJECT ............................... " ${PROJECT_NAME}) +message (STATUS "CMAKE_VERSION ......................... " ${CMAKE_VERSION}) message (STATUS "CMAKE_BINARY_DIR ...................... " ${CMAKE_BINARY_DIR}) message (STATUS "OpenVINO_SOURCE_DIR ................... " ${OpenVINO_SOURCE_DIR}) message (STATUS "CMAKE_GENERATOR ....................... " ${CMAKE_GENERATOR}) message (STATUS "CMAKE_C_COMPILER_ID ................... " ${CMAKE_C_COMPILER_ID}) +message (STATUS "CMAKE_CXX_COMPILER_ID ................. " ${CMAKE_CXX_COMPILER_ID}) message (STATUS "CMAKE_BUILD_TYPE ...................... " ${CMAKE_BUILD_TYPE}) message (STATUS "CMAKE_TOOLCHAIN_FILE .................. " ${CMAKE_TOOLCHAIN_FILE}) @@ -91,11 +93,11 @@ ie_cpack_add_component(ngraph_dev REQUIRED DEPENDS ngraph) include(cmake/test_model_zoo.cmake) add_subdirectory(thirdparty) -add_subdirectory(openvino) -add_subdirectory(ngraph) -add_subdirectory(inference-engine) -add_subdirectory(runtime) +add_subdirectory(inference-engine/thirdparty) +add_subdirectory(inference-engine/src) +add_subdirectory(src) add_subdirectory(samples) +add_subdirectory(inference-engine) include(cmake/extra_modules.cmake) add_subdirectory(model-optimizer) add_subdirectory(docs) diff --git a/CODEOWNERS b/CODEOWNERS index 9dd779166a0..2fc110e3bed 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -19,24 +19,26 @@ azure-pipelines.yml @openvinotoolkit/openvino-admins # IE Core: /inference-engine/ @openvinotoolkit/openvino-ie-maintainers /inference-engine/ie_bridges/python @openvinotoolkit/openvino-ie-python-api-maintainers -/inference-engine/src/transformations/ @GlebKazantaev @ilyachur -/inference-engine/src/legacy_api/ @openvinotoolkit/openvino-ngraph-maintainers -/inference-engine/src/readers/ @openvinotoolkit/openvino-ngraph-maintainers +/src/common/transformations/ @GlebKazantaev @ilyachur +/src/common/legacy/ @openvinotoolkit/openvino-ngraph-maintainers +/src/common/ @openvinotoolkit/openvino-ie-maintainers +/inference-engine/tests_deprecated/readers/ @openvinotoolkit/openvino-ngraph-maintainers # IE CPU: /inference-engine/src/mkldnn_plugin/ @openvinotoolkit/openvino-ie-cpu-maintainers @openvinotoolkit/openvino-ie-cpu-developers -/inference-engine/src/low_precision_transformations/ @openvinotoolkit/openvino-ie-cpu-maintainers @openvinotoolkit/openvino-ie-cpu-developers +/src/common/low_precision_transformations/ @openvinotoolkit/openvino-ie-cpu-maintainers @openvinotoolkit/openvino-ie-cpu-developers /inference-engine/thirdparty/mkl-dnn/ @openvinotoolkit/openvino-ie-cpu-maintainers @openvinotoolkit/openvino-ie-cpu-developers # IE GPU: /inference-engine/src/cldnn_engine/ @openvinotoolkit/openvino-ie-gpu-maintainers @openvinotoolkit/openvino-ie-gpu-developers -/inference-engine/src/inference_engine/include/gpu/ @openvinotoolkit/openvino-ie-gpu-maintainers @openvinotoolkit/openvino-ie-gpu-developers -/inference-engine/src/inference_engine/include/cldnn/ @openvinotoolkit/openvino-ie-gpu-maintainers @openvinotoolkit/openvino-ie-gpu-developers +/src/inference/include/ie/gpu/ @openvinotoolkit/openvino-ie-gpu-maintainers @openvinotoolkit/openvino-ie-gpu-developers +/src/inference/include/ie/cldnn/ @openvinotoolkit/openvino-ie-gpu-maintainers @openvinotoolkit/openvino-ie-gpu-developers +/src/inference/include/openvino/runtime/gpu/ @openvinotoolkit/openvino-ie-gpu-maintainers @openvinotoolkit/openvino-ie-gpu-developers /inference-engine/thirdparty/clDNN/ @openvinotoolkit/openvino-ie-gpu-maintainers @openvinotoolkit/openvino-ie-gpu-developers # IE VPU: /inference-engine/src/vpu/ @openvinotoolkit/openvino-ie-vpu-maintainers -/inference-engine/src/inference_engine/include/vpu/ @openvinotoolkit/openvino-ie-vpu-maintainers +/src/inference/include/ie/vpu/ @openvinotoolkit/openvino-ie-vpu-maintainers /inference-engine/thirdparty/movidius/ @openvinotoolkit/openvino-ie-vpu-maintainers /inference-engine/tests_deprecated/unit/engines/vpu/ @openvinotoolkit/openvino-ie-vpu-maintainers @openvinotoolkit/openvino-ie-tests-maintainers /inference-engine/tests_deprecated/functional/vpu/ @openvinotoolkit/openvino-ie-vpu-maintainers @openvinotoolkit/openvino-ie-tests-maintainers @@ -48,11 +50,11 @@ azure-pipelines.yml @openvinotoolkit/openvino-admins # IE GNA: /inference-engine/src/gna_plugin/ @openvinotoolkit/openvino-ie-gna-maintainers -/inference-engine/src/inference_engine/include/gna/ @openvinotoolkit/openvino-ie-gna-maintainers +/src/inference/include/ie/gna/ @openvinotoolkit/openvino-ie-gna-maintainers # IE MULTI: /inference-engine/src/multi_device/ @openvinotoolkit/openvino-ie-multi-maintainers -/inference-engine/src/inference_engine/include/multi-device/ @openvinotoolkit/openvino-ie-multi-maintainers +/src/inference/include/ie/multi-device/ @openvinotoolkit/openvino-ie-multi-maintainers # IE Tests: /inference-engine/tests/ @openvinotoolkit/openvino-ie-tests-maintainers @@ -64,7 +66,8 @@ azure-pipelines.yml @openvinotoolkit/openvino-admins /model-optimizer/ @openvinotoolkit/openvino-mo-maintainers # nGraph: -/ngraph/ @openvinotoolkit/openvino-ngraph-maintainers +/src/core/ @openvinotoolkit/openvino-ngraph-maintainers +/src/frontends/ @openvinotoolkit/openvino-ngraph-maintainers # POT Tools /tools/pot/ @openvinotoolkit/openvino-pot-maintainers diff --git a/cmake/coverage.cmake b/cmake/coverage.cmake index 137acbb8993..1bff5026081 100644 --- a/cmake/coverage.cmake +++ b/cmake/coverage.cmake @@ -12,88 +12,82 @@ ie_coverage_capture(INFO_FILE "openvino" # Generate reports -ie_coverage_extract(INPUT "openvino" OUTPUT "inference_engine" - PATTERNS "${OV_COVERAGE_BASE_DIRECTORY}/inference_engine/*" - "${OV_COVERAGE_BASE_DIRECTORY}/plugin_api/*") +ie_coverage_extract(INPUT "openvino" OUTPUT "inference" + PATTERNS "${OV_COVERAGE_BASE_DIRECTORY}/src/inference/*") + ie_coverage_genhtml(INFO_FILE "inference_engine" PREFIX "${OV_COVERAGE_BASE_DIRECTORY}") -ie_coverage_extract(INPUT "openvino" OUTPUT "inference_engine_ir_v10_reader" - PATTERNS "${OV_COVERAGE_BASE_DIRECTORY}/readers/ir_reader/*" - "${OV_COVERAGE_BASE_DIRECTORY}/readers/reader_api/*") -ie_coverage_genhtml(INFO_FILE "inference_engine_ir_v10_reader" - PREFIX "${OV_COVERAGE_BASE_DIRECTORY}") - ie_coverage_extract(INPUT "openvino" OUTPUT "inference_engine_legacy" - PATTERNS "${OV_COVERAGE_BASE_DIRECTORY}/legacy_api/*") + PATTERNS "${OV_COVERAGE_BASE_DIRECTORY}/src/common/legacy/*") ie_coverage_genhtml(INFO_FILE "inference_engine_legacy" PREFIX "${OV_COVERAGE_BASE_DIRECTORY}") -ie_coverage_extract(INPUT "openvino" OUTPUT "hetero_plugin" - PATTERNS "${OV_COVERAGE_BASE_DIRECTORY}/hetero_plugin/*") -ie_coverage_genhtml(INFO_FILE "hetero_plugin" +ie_coverage_extract(INPUT "openvino" OUTPUT "ov_hetero_plugin" + PATTERNS "${OV_COVERAGE_BASE_DIRECTORY}/src/plugins/hetero/*") +ie_coverage_genhtml(INFO_FILE "ov_hetero_plugin" PREFIX "${OV_COVERAGE_BASE_DIRECTORY}") ie_coverage_extract(INPUT "openvino" OUTPUT "multi_device" - PATTERNS "${OV_COVERAGE_BASE_DIRECTORY}/multi_device/*") + PATTERNS "${OV_COVERAGE_BASE_DIRECTORY}/inference-engine/src/multi_device/*") ie_coverage_genhtml(INFO_FILE "multi_device" PREFIX "${OV_COVERAGE_BASE_DIRECTORY}") ie_coverage_extract(INPUT "openvino" OUTPUT "preprocessing" - PATTERNS "${OV_COVERAGE_BASE_DIRECTORY}/preprocessing/*") + PATTERNS "${OV_COVERAGE_BASE_DIRECTORY}src/common/preprocessing/*") ie_coverage_genhtml(INFO_FILE "preprocessing" PREFIX "${OV_COVERAGE_BASE_DIRECTORY}") ie_coverage_extract(INPUT "openvino" OUTPUT "inference_engine_transformations" - PATTERNS "${OV_COVERAGE_BASE_DIRECTORY}/inference_engine_transformations/*") + PATTERNS "${OV_COVERAGE_BASE_DIRECTORY}/src/common/transformations/*") ie_coverage_genhtml(INFO_FILE "inference_engine_transformations" PREFIX "${OV_COVERAGE_BASE_DIRECTORY}") ie_coverage_extract(INPUT "openvino" OUTPUT "inference_engine_snippets" - PATTERNS "${OV_COVERAGE_BASE_DIRECTORY}/snippets/*") + PATTERNS "${OV_COVERAGE_BASE_DIRECTORY}/src/common/snippets/*") ie_coverage_genhtml(INFO_FILE "inference_engine_snippets" PREFIX "${OV_COVERAGE_BASE_DIRECTORY}") ie_coverage_extract(INPUT "openvino" OUTPUT "low_precision_transformations" - PATTERNS "${OV_COVERAGE_BASE_DIRECTORY}/low_precision_transformations/*") + PATTERNS "${OV_COVERAGE_BASE_DIRECTORY}/src/common/low_precision_transformations/*") ie_coverage_genhtml(INFO_FILE "low_precision_transformations" PREFIX "${OV_COVERAGE_BASE_DIRECTORY}") ie_coverage_extract(INPUT "openvino" OUTPUT "template_plugin" - PATTERNS "${OV_COVERAGE_BASE_DIRECTORY}/template_plugin/*") + PATTERNS "${OV_COVERAGE_BASE_DIRECTORY}/docs/template_plugin/*") ie_coverage_genhtml(INFO_FILE "template_plugin" PREFIX "${OV_COVERAGE_BASE_DIRECTORY}") if(ENABLE_MKL_DNN) ie_coverage_extract(INPUT "openvino" OUTPUT "mkldnn_plugin" - PATTERNS "${OV_COVERAGE_BASE_DIRECTORY}/mkldnn_plugin/*") + PATTERNS "${OV_COVERAGE_BASE_DIRECTORY}/inference-engine/src/mkldnn_plugin/*") ie_coverage_genhtml(INFO_FILE "mkldnn_plugin" PREFIX "${OV_COVERAGE_BASE_DIRECTORY}") endif() if(ENABLE_CLDNN) ie_coverage_extract(INPUT "openvino" OUTPUT "cldnn_engine" - PATTERNS "${OV_COVERAGE_BASE_DIRECTORY}/cldnn_engine/*") + PATTERNS "${OV_COVERAGE_BASE_DIRECTORY}/inference-engine/src/cldnn_engine/*") ie_coverage_genhtml(INFO_FILE "cldnn_engine" PREFIX "${OV_COVERAGE_BASE_DIRECTORY}") endif() if(ENABLE_GNA) ie_coverage_extract(INPUT "openvino" OUTPUT "gna_plugin" - PATTERNS "${OV_COVERAGE_BASE_DIRECTORY}/gna_plugin/*") + PATTERNS "${OV_COVERAGE_BASE_DIRECTORY}/inference-engine/src/gna_plugin/*") ie_coverage_genhtml(INFO_FILE "gna_plugin" PREFIX "${OV_COVERAGE_BASE_DIRECTORY}") endif() -ie_coverage_extract(INPUT "openvino" OUTPUT "ngraph" - PATTERNS "${OV_COVERAGE_BASE_DIRECTORY}/ngraph/core/*") -ie_coverage_genhtml(INFO_FILE "ngraph" +ie_coverage_extract(INPUT "openvino" OUTPUT "core" + PATTERNS "${OV_COVERAGE_BASE_DIRECTORY}/src/core/*") +ie_coverage_genhtml(INFO_FILE "core" PREFIX "${OV_COVERAGE_BASE_DIRECTORY}") if(NGRAPH_ONNX_FRONTEND_ENABLE) ie_coverage_extract(INPUT "openvino" OUTPUT "onnx" - PATTERNS "${OV_COVERAGE_BASE_DIRECTORY}/ngraph/frontend/onnx/*" - "${OV_COVERAGE_BASE_DIRECTORY}/ngraph/frontend/onnx/*") + PATTERNS "${OV_COVERAGE_BASE_DIRECTORY}/src/frontends/onnx/*" + "${OV_COVERAGE_BASE_DIRECTORY}/src/frontends/onnx/*") ie_coverage_genhtml(INFO_FILE "onnx" PREFIX "${OV_COVERAGE_BASE_DIRECTORY}") endif() diff --git a/cmake/dependencies.cmake b/cmake/dependencies.cmake index 9104bcd9923..8472af490b7 100644 --- a/cmake/dependencies.cmake +++ b/cmake/dependencies.cmake @@ -265,7 +265,7 @@ else() reset_deps_cache(OpenCV_DIR) endif() -include(${IE_MAIN_SOURCE_DIR}/cmake/ie_parallel.cmake) +include(${OpenVINO_SOURCE_DIR}/cmake/ie_parallel.cmake) if(ENABLE_GNA) reset_deps_cache( diff --git a/cmake/developer_package/IEDevScriptsConfig.cmake b/cmake/developer_package/IEDevScriptsConfig.cmake index bb7327ea144..fcd8726f923 100644 --- a/cmake/developer_package/IEDevScriptsConfig.cmake +++ b/cmake/developer_package/IEDevScriptsConfig.cmake @@ -106,17 +106,11 @@ else() set(BIN_FOLDER "bin/${ARCH_FOLDER}") endif() -if(NOT DEFINED CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL "") - message(STATUS "CMAKE_BUILD_TYPE not defined, 'Release' will be used") - set(CMAKE_BUILD_TYPE "Release") -else() - set(RELEASE_TYPES "Debug" "Release" "RelWithDebInfo" "MinSizeRel") - list(FIND RELEASE_TYPES ${CMAKE_BUILD_TYPE} INDEX_FOUND) - if (INDEX_FOUND EQUAL -1) - message(FATAL_ERROR "CMAKE_BUILD_TYPE must be one of Debug, Release, RelWithDebInfo, or MinSizeRel") - endif() +set(CMAKE_BUILD_TYPE "Release" CACHE STRING "CMake build type") +set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Release;Debug;RelWithDebInfo;MinSizeRel") +if(CMAKE_GENERATOR MATCHES "^Ninja Multi-Config$") + set(CMAKE_DEFAULT_BUILD_TYPE "Release" CACHE STRING "CMake default build type") endif() -message(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}") if(USE_BUILD_TYPE_SUBFOLDER) set(BIN_FOLDER "${BIN_FOLDER}/${CMAKE_BUILD_TYPE}") @@ -152,8 +146,8 @@ endif() set(CMAKE_DEBUG_POSTFIX ${IE_DEBUG_POSTFIX}) set(CMAKE_RELEASE_POSTFIX ${IE_RELEASE_POSTFIX}) -if (MSVC OR CMAKE_GENERATOR STREQUAL "Xcode") - # Support CMake multiconfiguration for Visual Studio or Xcode build +# Support CMake multi-configuration for Visual Studio / Ninja or Xcode build +if (OV_GENERATOR_MULTI_CONFIG) set(IE_BUILD_POSTFIX $<$:${IE_DEBUG_POSTFIX}>$<$:${IE_RELEASE_POSTFIX}>) else () if (CMAKE_BUILD_TYPE STREQUAL "Debug") @@ -162,7 +156,6 @@ else () set(IE_BUILD_POSTFIX ${IE_RELEASE_POSTFIX}) endif() endif() - add_definitions(-DIE_BUILD_POSTFIX=\"${IE_BUILD_POSTFIX}\") if(NOT UNIX) @@ -235,6 +228,7 @@ include(api_validator/api_validator) include(vs_version/vs_version) include(plugins/plugins) +include(frontends/frontends) include(add_ie_target) include(CMakePackageConfigHelpers) diff --git a/cmake/developer_package/api_validator/api_validator.cmake b/cmake/developer_package/api_validator/api_validator.cmake index ed168178fe3..d58ba745742 100644 --- a/cmake/developer_package/api_validator/api_validator.cmake +++ b/cmake/developer_package/api_validator/api_validator.cmake @@ -96,7 +96,7 @@ function(_ie_add_api_validator_post_build_step) get_target_property(IS_IMPORTED ${target} IMPORTED) get_target_property(orig_target ${target} ALIASED_TARGET) if(IS_IMPORTED) - get_target_property(target_location ${target} LOCATION) + get_target_property(target_location ${target} LOCATION) get_filename_component(target_name "${target_location}" NAME_WE) elseif(TARGET "${orig_target}") set(target_name ${orig_target}) @@ -107,10 +107,14 @@ function(_ie_add_api_validator_post_build_step) foreach(target IN LISTS API_VALIDATOR_TARGETS) api_validator_get_target_name() - set(output_file "${CMAKE_BINARY_DIR}/api_validator/${target_name}.txt") + if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.21 AND OV_GENERATOR_MULTI_CONFIG) + set(output_file "${CMAKE_BINARY_DIR}/api_validator/$/${target_name}.txt") + else() + set(output_file "${CMAKE_BINARY_DIR}/api_validator/${target_name}.txt") + endif() add_custom_command(TARGET ${API_VALIDATOR_TARGET} POST_BUILD - COMMAND ${CMAKE_COMMAND} + COMMAND ${CMAKE_COMMAND} --config $ -D UWP_API_VALIDATOR=${UWP_API_VALIDATOR} -D UWP_API_VALIDATOR_TARGET=$ -D UWP_API_VALIDATOR_APIS=${UWP_API_VALIDATOR_APIS} diff --git a/cmake/developer_package/compile_flags/os_flags.cmake b/cmake/developer_package/compile_flags/os_flags.cmake index a6b3ac4ee43..e3945d9ecc4 100644 --- a/cmake/developer_package/compile_flags/os_flags.cmake +++ b/cmake/developer_package/compile_flags/os_flags.cmake @@ -28,6 +28,8 @@ macro(disable_deprecated_warnings) message(WARNING "Unsupported CXX compiler ${CMAKE_CXX_COMPILER_ID}") endif() + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${ie_c_cxx_deprecated}") + set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${ie_c_cxx_deprecated}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ie_c_cxx_deprecated}") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ie_c_cxx_deprecated}") endmacro() @@ -42,7 +44,9 @@ macro(ie_deprecated_no_errors) set(ie_c_cxx_deprecated_no_errors "/Qdiag-warning:1478,1786") elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") # show 4996 only for /w4 - set(ie_c_cxx_deprecated_no_errors "/w44996") + set(ie_c_cxx_deprecated_no_errors "/wd4996") + # WA for VPUX plugin + set(ie_c_cxx_deprecated_no_errors "${ie_c_cxx_deprecated_no_errors} /wd4146 /wd4703") endif() else() if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") @@ -56,6 +60,8 @@ macro(ie_deprecated_no_errors) endif() endif() + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${ie_c_cxx_deprecated_no_errors}") + set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${ie_c_cxx_deprecated_no_errors}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ie_c_cxx_deprecated_no_errors}") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ie_c_cxx_deprecated_no_errors}") endmacro() diff --git a/cmake/developer_package/compile_flags/sdl.cmake b/cmake/developer_package/compile_flags/sdl.cmake index 7690a9031d8..0b2a8c7d510 100644 --- a/cmake/developer_package/compile_flags/sdl.cmake +++ b/cmake/developer_package/compile_flags/sdl.cmake @@ -2,49 +2,47 @@ # SPDX-License-Identifier: Apache-2.0 # -if (CMAKE_BUILD_TYPE STREQUAL "Release") - if(UNIX) - set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} -Wformat -Wformat-security") - if (NOT ENABLE_SANITIZER) - # ASan does not support fortification https://github.com/google/sanitizers/issues/247 - set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} -D_FORTIFY_SOURCE=2") - endif() - if(NOT APPLE) - set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -pie") - endif() - - if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - set(IE_LINKER_FLAGS "${IE_LINKER_FLAGS} -z noexecstack -z relro -z now") - if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9) - set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} -fstack-protector-all") - else() - set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} -fstack-protector-strong") - endif() - if (NOT ENABLE_SANITIZER) - set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} -s") - endif() - elseif(OV_COMPILER_IS_CLANG) - set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} -fstack-protector-all") - elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") - if (NOT ENABLE_SANITIZER) - set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} -Wl,--strip-all") - endif() - set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} -fstack-protector-strong") - set(IE_LINKER_FLAGS "${IE_LINKER_FLAGS} -z noexecstack -z relro -z now") - endif() - else() - if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") - set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} /sdl") - endif() - set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} /guard:cf") - if(ENABLE_INTEGRITYCHECK) - set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /INTEGRITYCHECK") - endif() +if(UNIX) + set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} -Wformat -Wformat-security") + if (NOT ENABLE_SANITIZER) + # ASan does not support fortification https://github.com/google/sanitizers/issues/247 + set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} -D_FORTIFY_SOURCE=2") + endif() + if(NOT APPLE) + set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -pie") endif() - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${IE_C_CXX_FLAGS}") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${IE_C_CXX_FLAGS}") - set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} ${IE_LINKER_FLAGS}") - set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} ${IE_LINKER_FLAGS}") - set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${IE_LINKER_FLAGS}") + if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + set(IE_LINKER_FLAGS "${IE_LINKER_FLAGS} -z noexecstack -z relro -z now") + if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9) + set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} -fstack-protector-all") + else() + set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} -fstack-protector-strong") + endif() + if (NOT ENABLE_SANITIZER) + set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} -s") + endif() + elseif(OV_COMPILER_IS_CLANG) + set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} -fstack-protector-all") + elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") + if (NOT ENABLE_SANITIZER) + set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} -Wl,--strip-all") + endif() + set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} -fstack-protector-strong") + set(IE_LINKER_FLAGS "${IE_LINKER_FLAGS} -z noexecstack -z relro -z now") + endif() +else() + if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} /sdl") + endif() + set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} /guard:cf") + if(ENABLE_INTEGRITYCHECK) + set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /INTEGRITYCHECK") + endif() endif() + +set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${IE_C_CXX_FLAGS}") +set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${IE_C_CXX_FLAGS}") +set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} ${IE_LINKER_FLAGS}") +set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} ${IE_LINKER_FLAGS}") +set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${IE_LINKER_FLAGS}") diff --git a/cmake/developer_package/features.cmake b/cmake/developer_package/features.cmake index a0d4d17db32..a35b53bc630 100644 --- a/cmake/developer_package/features.cmake +++ b/cmake/developer_package/features.cmake @@ -11,10 +11,10 @@ ie_dependent_option (ENABLE_LTO "Enable Link Time Optimization" OFF "LINUX;NOT C ie_option (OS_FOLDER "create OS dedicated folder in output" OFF) -if(UNIX) - ie_option(USE_BUILD_TYPE_SUBFOLDER "Create dedicated sub-folder per build type for output binaries" ON) -else() +if(OV_GENERATOR_MULTI_CONFIG) ie_option(USE_BUILD_TYPE_SUBFOLDER "Create dedicated sub-folder per build type for output binaries" OFF) +else() + ie_option(USE_BUILD_TYPE_SUBFOLDER "Create dedicated sub-folder per build type for output binaries" ON) endif() # FIXME: ARM cross-compiler generates several "false positive" warnings regarding __builtin_memcpy buffer overflow diff --git a/cmake/developer_package/frontends/create_frontends_hpp.cmake b/cmake/developer_package/frontends/create_frontends_hpp.cmake new file mode 100644 index 00000000000..a4f972ac00f --- /dev/null +++ b/cmake/developer_package/frontends/create_frontends_hpp.cmake @@ -0,0 +1,34 @@ +# Copyright (C) 2018-2021 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 +# + +foreach(var OV_FRONTENDS_HPP_HEADER_IN OV_FRONTENDS_HPP_HEADER FRONTEND_NAMES) + if(NOT DEFINED ${var}) + message(FATAL_ERROR "${var} is required, but not defined") + endif() +endforeach() + +# configure variables + +set(OV_FRONTEND_DECLARATIONS "") +set(OV_FRONTEND_MAP_DEFINITION " FrontendsStaticRegistry registry = {") + +foreach(frontend IN LISTS FRONTEND_NAMES) + # common + set(_OV_FRONTEND_DATA_FUNC "GetFrontEndData${frontend}") + set(_OV_VERSION_FUNC "GetAPIVersion${frontend}") + + # declarations + set(OV_FRONTEND_DECLARATIONS "${OV_FRONTEND_DECLARATIONS} +ov::frontend::FrontEndVersion ${_OV_VERSION_FUNC}(); +void* ${_OV_FRONTEND_DATA_FUNC}();") + + set(OV_FRONTEND_MAP_DEFINITION "${OV_FRONTEND_MAP_DEFINITION} + { Value { ${_OV_FRONTEND_DATA_FUNC}, ${_OV_VERSION_FUNC} } },") +endforeach() + +set(OV_FRONTEND_MAP_DEFINITION "${OV_FRONTEND_MAP_DEFINITION} + }; + return registry;") + +configure_file("${OV_FRONTENDS_HPP_HEADER_IN}" "${OV_FRONTENDS_HPP_HEADER}" @ONLY) diff --git a/cmake/developer_package/frontends/frontends.cmake b/cmake/developer_package/frontends/frontends.cmake new file mode 100644 index 00000000000..4fa8084d35d --- /dev/null +++ b/cmake/developer_package/frontends/frontends.cmake @@ -0,0 +1,241 @@ +# Copyright (C) 2018-2021 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 +# + +set(FRONTEND_INSTALL_INCLUDE "runtime/include/ngraph/frontend") +set(FRONTEND_NAME_SUFFIX "_ov_frontend") + +set(FRONTEND_NAMES "" CACHE INTERNAL "") + +if(NOT TARGET ov_frontends) + add_custom_target(ov_frontends) +endif() + +# +# ov_target_link_frontends() +# +function(ov_target_link_frontends TARGET_NAME) + if(BUILD_SHARED_LIBS) + return() + endif() + + foreach(name IN LISTS FRONTEND_NAMES) + set(frontend_target_name "${name}${FRONTEND_NAME_SUFFIX}") + target_link_libraries(${TARGET_NAME} PRIVATE ${frontend_target_name}) + endforeach() +endfunction() + +# +# ov_generate_frontends_hpp() +# +function(ov_generate_frontends_hpp) + if(BUILD_SHARED_LIBS) + return() + endif() + + # add frontends to libraries including ov_frontends.hpp + ov_target_link_frontends(frontend_common) + + set(ov_frontends_hpp "${CMAKE_BINARY_DIR}/src/frontends/common/src/ov_frontends.hpp") + set(frontends_hpp_in "${IEDevScripts_DIR}/frontends/ov_frontends.hpp.in") + + add_custom_command(OUTPUT "${ov_frontends_hpp}" + COMMAND + "${CMAKE_COMMAND}" + -D "OV_FRONTENDS_HPP_HEADER_IN=${frontends_hpp_in}" + -D "OV_FRONTENDS_HPP_HEADER=${ov_frontends_hpp}" + -D "FRONTEND_NAMES=${FRONTEND_NAMES}" + -P "${IEDevScripts_DIR}/frontends/create_frontends_hpp.cmake" + DEPENDS + "${frontends_hpp_in}" + "${IEDevScripts_DIR}/frontends/create_frontends_hpp.cmake" + COMMENT + "Generate ov_frontends.hpp for static build" + VERBATIM) + + # for some reason dependency on source files does not work + # so, we have to use explicit target and make it dependency for frontend_common + add_custom_target(_ov_frontends_hpp DEPENDS ${ov_frontends_hpp}) + add_dependencies(frontend_common _ov_frontends_hpp) + + # add dependency for object files + get_target_property(sources frontend_common::static SOURCES) + foreach(source IN LISTS sources) + if("${source}" MATCHES "\\$\\") + # object library + set(obj_library ${CMAKE_MATCH_1}) + get_target_property(obj_sources ${obj_library} SOURCES) + list(APPEND all_sources ${obj_sources}) + else() + # usual source + list(APPEND all_sources ${source}) + endif() + endforeach() + + # add dependency on header file generation for all inference_engine source files + set_source_files_properties(${all_sources} PROPERTIES OBJECT_DEPENDS ${ov_frontends_hpp}) +endfunction() + +unset(protobuf_lite_installed CACHE) +unset(protobuf_installed CACHE) + +# +# ov_add_frontend(NAME +# FILEDESCRIPTION +# [LINKABLE_FRONTEND] +# [SKIP_INSTALL] +# [PROTOBUF_LITE] +# [LINK_LIBRARIES ]) +# +macro(ov_add_frontend) + set(options LINKABLE_FRONTEND PROTOBUF_LITE SKIP_NCC_STYLE SKIP_INSTALL) + set(oneValueArgs NAME FILEDESCRIPTION) + set(multiValueArgs LINK_LIBRARIES PROTO_FILES) + cmake_parse_arguments(OV_FRONTEND "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + foreach(prop NAME FILEDESCRIPTION) + if(NOT DEFINED OV_FRONTEND_${prop}) + message(FATAL_ERROR "Frontend ${prop} property is not defined") + endif() + endforeach() + + set(TARGET_NAME "${OV_FRONTEND_NAME}${FRONTEND_NAME_SUFFIX}") + + list(APPEND FRONTEND_NAMES ${OV_FRONTEND_NAME}) + set(FRONTEND_NAMES "${FRONTEND_NAMES}" CACHE INTERNAL "" FORCE) + + file(GLOB_RECURSE LIBRARY_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) + file(GLOB_RECURSE LIBRARY_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/src/*.hpp) + file(GLOB_RECURSE LIBRARY_PUBLIC_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include/*.hpp) + + set(${TARGET_NAME}_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include) + + # Create named folders for the sources within the .vcproj + # Empty name lists them directly under the .vcproj + + source_group("src" FILES ${LIBRARY_SRC}) + source_group("include" FILES ${LIBRARY_HEADERS}) + source_group("public include" FILES ${LIBRARY_PUBLIC_HEADERS}) + + # Generate protobuf file on build time for each '.proto' file in src/proto + file(GLOB proto_files ${CMAKE_CURRENT_SOURCE_DIR}/src/proto/*.proto) + + foreach(INFILE IN LISTS proto_files) + get_filename_component(FILE_DIR ${INFILE} DIRECTORY) + get_filename_component(FILE_WE ${INFILE} NAME_WE) + set(OUTPUT_PB_SRC ${CMAKE_CURRENT_BINARY_DIR}/${FILE_WE}.pb.cc) + set(OUTPUT_PB_HEADER ${CMAKE_CURRENT_BINARY_DIR}/${FILE_WE}.pb.h) + set(GENERATED_PROTO ${INFILE}) + add_custom_command( + OUTPUT "${OUTPUT_PB_SRC}" "${OUTPUT_PB_HEADER}" + COMMAND ${PROTOC_EXECUTABLE} ARGS --cpp_out ${CMAKE_CURRENT_BINARY_DIR} -I ${FILE_DIR} ${FILE_WE}.proto + DEPENDS ${PROTOC_EXECUTABLE} ${GENERATED_PROTO} + COMMENT "Running C++ protocol buffer compiler (${PROTOC_EXECUTABLE}) on ${GENERATED_PROTO}" + VERBATIM + COMMAND_EXPAND_LISTS) + list(APPEND PROTO_SRCS "${OUTPUT_PB_SRC}") + list(APPEND PROTO_HDRS "${OUTPUT_PB_HEADER}") + endforeach() + + # Disable all warnings for generated code + set_source_files_properties(${PROTO_SRCS} ${PROTO_HDRS} PROPERTIES COMPILE_OPTIONS -w GENERATED TRUE) + + # Create library + add_library(${TARGET_NAME} ${LIBRARY_SRC} ${LIBRARY_HEADERS} ${LIBRARY_PUBLIC_HEADERS} ${PROTO_SRCS} ${PROTO_HDRS}) + + if(OV_FRONTEND_LINKABLE_FRONTEND) + # create beautiful alias + add_library(openvino::frontend::${OV_FRONTEND_NAME} ALIAS ${TARGET_NAME}) + endif() + + if(NOT BUILD_SHARED_LIBS) + # override default function names + target_compile_definitions(${TARGET_NAME} PRIVATE + "-DGetFrontEndData=GetFrontEndData${OV_FRONTEND_NAME}" + "-DGetAPIVersion=GetAPIVersion${OV_FRONTEND_NAME}") + endif() + + if(OV_FRONTEND_SKIP_NCC_STYLE) + # frontend's CMakeLists.txt must define its own custom 'ov_ncc_naming_style' step + else() + ov_ncc_naming_style(FOR_TARGET ${TARGET_NAME} + INCLUDE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include" + ADDITIONAL_INCLUDE_DIRECTORIES + $) + endif() + + target_include_directories(${TARGET_NAME} + PUBLIC + $ + PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/src + ${CMAKE_CURRENT_BINARY_DIR}) + + ie_add_vs_version_file(NAME ${TARGET_NAME} + FILEDESCRIPTION ${OV_FRONTEND_FILEDESCRIPTION}) + + ie_add_api_validator_post_build_step(TARGET ${TARGET_NAME}) + + target_link_libraries(${TARGET_NAME} PRIVATE frontend_common::static ${OV_FRONTEND_LINK_LIBRARIES}) + + # WA for TF frontends which always requires protobuf (not protobuf-lite) + # if TF FE is built in static mode, use protobuf for all other FEs + if(FORCE_FRONTENDS_USE_PROTOBUF) + set(OV_FRONTEND_PROTOBUF_LITE OFF) + endif() + + if(proto_files) + if(OV_FRONTEND_PROTOBUF_LITE) + if(NOT protobuf_lite_installed) + ov_install_static_lib(${Protobuf_LITE_LIBRARIES} ngraph) + set(protobuf_lite_installed ON CACHE INTERNAL "" FORCE) + endif() + link_system_libraries(${TARGET_NAME} PRIVATE ${Protobuf_LITE_LIBRARIES}) + else() + if(NOT protobuf_installed) + ov_install_static_lib(${Protobuf_LIBRARIES} ngraph) + set(protobuf_installed ON CACHE INTERNAL "" FORCE) + endif() + link_system_libraries(${TARGET_NAME} PRIVATE ${Protobuf_LIBRARIES}) + endif() + + # prptobuf generated code emits -Wsuggest-override error + if(SUGGEST_OVERRIDE_SUPPORTED) + target_compile_options(${TARGET_NAME} PRIVATE -Wno-suggest-override) + endif() + endif() + + add_clang_format_target(${TARGET_NAME}_clang FOR_TARGETS ${TARGET_NAME} + EXCLUDE_PATTERNS ${PROTO_SRCS} ${PROTO_HDRS}) + + add_dependencies(ov_frontends ${TARGET_NAME}) + + if(NOT OV_FRONTEND_SKIP_INSTALL) + if(BUILD_SHARED_LIBS) + if(OV_FRONTEND_LINKABLE_FRONTEND) + set(export_set EXPORT OpenVINOTargets) + endif() + install(TARGETS ${TARGET_NAME} ${export_set} + RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT ngraph + ARCHIVE DESTINATION ${IE_CPACK_ARCHIVE_PATH} COMPONENT ngraph + LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT ngraph) + else() + ov_install_static_lib(${TARGET_NAME} ngraph) + endif() + + if(OV_FRONTEND_LINKABLE_FRONTEND) + # install -dev part + install(DIRECTORY ${${TARGET_NAME}_INCLUDE_DIR}/${OV_FRONTEND_NAME}_frontend + DESTINATION ${FRONTEND_INSTALL_INCLUDE} + COMPONENT ngraph_dev + FILES_MATCHING PATTERN "*.hpp") + + set_target_properties(${TARGET_NAME} PROPERTIES EXPORT_NAME frontend::${OV_FRONTEND_NAME}) + export(TARGETS ${TARGET_NAME} NAMESPACE openvino:: + APPEND FILE "${CMAKE_BINARY_DIR}/OpenVINOTargets.cmake") + endif() + else() + # skipped frontend has to be installed in static libraries case + ov_install_static_lib(${TARGET_NAME} ngraph) + endif() +endmacro() diff --git a/cmake/developer_package/frontends/ov_frontends.hpp.in b/cmake/developer_package/frontends/ov_frontends.hpp.in new file mode 100644 index 00000000000..0293054160d --- /dev/null +++ b/cmake/developer_package/frontends/ov_frontends.hpp.in @@ -0,0 +1,27 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include "common/frontend.hpp" + +@OV_FRONTEND_DECLARATIONS@ + +namespace { + +using GetFrontEndDataFunc = void*(); +using GetAPIVersionFunc = ov::frontend::FrontEndVersion(); + +struct Value { + GetFrontEndDataFunc* m_dataFunc; + GetAPIVersionFunc* m_versionFunc; +}; + +using FrontendsStaticRegistry = std::vector; + +const FrontendsStaticRegistry getStaticFrontendsRegistry() { +@OV_FRONTEND_MAP_DEFINITION@ +} + +} // namespace diff --git a/cmake/developer_package/ncc_naming_style/openvino.style b/cmake/developer_package/ncc_naming_style/openvino.style index 4f9df1dfebd..f983b8b84ad 100644 --- a/cmake/developer_package/ncc_naming_style/openvino.style +++ b/cmake/developer_package/ncc_naming_style/openvino.style @@ -12,7 +12,7 @@ TemplateNonTypeParameter: '^\w*$' ClassTemplate: '^([A-Z][\w]+|element_type_traits)$' TemplateTypeParameter: '^\w*$' ParameterName: '^\w*$' -FunctionTemplate: '^(operator.+|\w+)$' +FunctionTemplate: '^(operator.+|[\w]+|Impl<.*>)$' TypeAliasName: '^\w+$' VariableReference: '^\w+$' @@ -25,7 +25,7 @@ TypedefName: '^.*$' CxxDynamicCastExpression: '^.*$' # not needed values -ClassTemplatePartialSpecialization: 'XXXX' +ClassTemplatePartialSpecialization: '^.*$' ConversionFunction: '^.*$' UsingDirective: 'XXXX' ClassAccessSpecifier: '^.*$' # looks like can be fixed @@ -64,9 +64,9 @@ GenericSelectionExpression: 'XXXX' GnuNullExpression: 'XXXX' CxxStaticCastExpression: '^.*$' CxxReinterpretCastExpression: '^.*$' -CxxConstCastExpression: 'XXXX' +CxxConstCastExpression: '^.*$' CxxFunctionalCastExpression: '^.*$' -CxxTypeidExpression: 'XXXX' +CxxTypeidExpression: '^.*$' CxxBoolLiteralExpression: '^.*$' CxxNullPointerLiteralExpression: '^.*$' CxxThisExpression: '^.*$' diff --git a/cmake/developer_package/plugins/plugins.cmake b/cmake/developer_package/plugins/plugins.cmake index 268b90fced6..caef045711f 100644 --- a/cmake/developer_package/plugins/plugins.cmake +++ b/cmake/developer_package/plugins/plugins.cmake @@ -75,8 +75,6 @@ function(ie_add_plugin) target_compile_definitions(${IE_PLUGIN_NAME} PRIVATE IE_CREATE_EXTENSION=CreateExtensionShared${IE_PLUGIN_DEVICE_NAME}) endif() - # install static plugins - ov_install_static_lib(${IE_PLUGIN_NAME} core) endif() ie_add_vs_version_file(NAME ${IE_PLUGIN_NAME} @@ -137,13 +135,17 @@ function(ie_add_plugin) endif() # install rules - if(NOT IE_PLUGIN_SKIP_INSTALL) + if(NOT IE_PLUGIN_SKIP_INSTALL OR NOT BUILD_SHARED_LIBS) string(TOLOWER "${IE_PLUGIN_DEVICE_NAME}" install_component) ie_cpack_add_component(${install_component} REQUIRED DEPENDS core) - install(TARGETS ${IE_PLUGIN_NAME} - LIBRARY DESTINATION ${IE_CPACK_RUNTIME_PATH} - COMPONENT ${install_component}) + if(BUILD_SHARED_LIBS) + install(TARGETS ${IE_PLUGIN_NAME} + LIBRARY DESTINATION ${IE_CPACK_RUNTIME_PATH} + COMPONENT ${install_component}) + else() + ov_install_static_lib(${IE_PLUGIN_NAME} ${install_component}) + endif() endif() endif() @@ -244,12 +246,18 @@ macro(ie_register_plugins_dynamic) VERBATIM) endmacro() +# +# ie_register_plugins() +# macro(ie_register_plugins) if(BUILD_SHARED_LIBS) ie_register_plugins_dynamic(${ARGN}) endif() endmacro() +# +# ie_target_link_plugins() +# function(ie_target_link_plugins TARGET_NAME) if(BUILD_SHARED_LIBS) return() @@ -311,7 +319,7 @@ function(ie_generate_plugins_hpp) ie_target_link_plugins(inference_engine_s) endif() - set(ie_plugins_hpp "${CMAKE_BINARY_DIR}/inference-engine/src/inference_engine/ie_plugins.hpp") + set(ie_plugins_hpp "${CMAKE_BINARY_DIR}/src/inference/ie_plugins.hpp") set(plugins_hpp_in "${IEDevScripts_DIR}/plugins/plugins.hpp.in") add_custom_command(OUTPUT "${ie_plugins_hpp}" @@ -332,8 +340,8 @@ function(ie_generate_plugins_hpp) # for some reason dependency on source files does not work # so, we have to use explicit target and make it dependency for inference_engine - add_custom_target(ie_generate_hpp DEPENDS ${ie_plugins_hpp}) - add_dependencies(inference_engine ie_generate_hpp) + add_custom_target(_ie_plugins_hpp DEPENDS ${ie_plugins_hpp}) + add_dependencies(inference_engine _ie_plugins_hpp) # add dependency for object files get_target_property(sources inference_engine SOURCES) diff --git a/cmake/developer_package/target_flags.cmake b/cmake/developer_package/target_flags.cmake index d4fd9837647..a359937a702 100644 --- a/cmake/developer_package/target_flags.cmake +++ b/cmake/developer_package/target_flags.cmake @@ -61,3 +61,5 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "^(Apple)?Clang$") else() set(OV_COMPILER_IS_CLANG OFF) endif() + +get_property(OV_GENERATOR_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) diff --git a/cmake/developer_package/version.cmake b/cmake/developer_package/version.cmake index e8d4fdb3d3d..3f51cc1f336 100644 --- a/cmake/developer_package/version.cmake +++ b/cmake/developer_package/version.cmake @@ -44,12 +44,12 @@ macro(ie_parse_ci_build_number) return() endif() - set(ie_version_hpp "${OpenVINO_SOURCE_DIR}/inference-engine/src/inference_engine/include/ie/ie_version.hpp") + set(ie_version_hpp "${OpenVINO_SOURCE_DIR}/src/inference/include/ie/ie_version.hpp") if(NOT EXISTS ${ie_version_hpp}) message(FATAL_ERROR "File ie_version.hpp with IE_VERSION definitions is not found") endif() - set(ov_version_hpp "${OpenVINO_SOURCE_DIR}/ngraph/core/include/openvino/core/version.hpp") + set(ov_version_hpp "${OpenVINO_SOURCE_DIR}/src/core/include/openvino/core/version.hpp") if(NOT EXISTS ${ov_version_hpp}) message(FATAL_ERROR "File openvino/core/version.hpp with OPENVINO_VERSION definitions is not found") endif() diff --git a/cmake/extra_modules.cmake b/cmake/extra_modules.cmake index d72497749ac..3b22125d009 100644 --- a/cmake/extra_modules.cmake +++ b/cmake/extra_modules.cmake @@ -6,7 +6,7 @@ function(ie_generate_dev_package_config) # dummy check that OpenCV is here find_package(OpenCV QUIET) - set(all_dev_targets gflags ie_libraries) + set(all_dev_targets gflags ov_runtime_libraries) foreach(component IN LISTS openvino_export_components) # export all targets with prefix and use them during extra modules build export(TARGETS ${${component}} NAMESPACE IE:: @@ -102,7 +102,7 @@ openvino_developer_export_targets(COMPONENT ngraph TARGETS ngraph_backend interp ie_generate_dev_package_config() # extra modules must be registered after inference_engine library -# and all other IE common libraries (ie_libraries) are creared +# and all other IE common libraries (ov_runtime_libraries) are creared # because 'register_extra_modules' creates fake InferenceEngineDeveloperPackageConfig.cmake # with all imported developer targets register_extra_modules() diff --git a/cmake/features.cmake b/cmake/features.cmake index 0c030b55ddd..c19296d1b73 100644 --- a/cmake/features.cmake +++ b/cmake/features.cmake @@ -163,13 +163,19 @@ ie_dependent_option(NGRAPH_PDPD_FRONTEND_ENABLE "Enable PaddlePaddle FrontEnd" O ie_option(NGRAPH_IR_FRONTEND_ENABLE "Enable IR FrontEnd" ON) ie_dependent_option(NGRAPH_TF_FRONTEND_ENABLE "Enable TensorFlow FrontEnd" ON "protoc_available" OFF) ie_dependent_option(NGRAPH_USE_SYSTEM_PROTOBUF "Use system protobuf" OFF - "NGRAPH_ONNX_FRONTEND_ENABLE OR NGRAPH_PDPD_FRONTEND_ENABLE OR NGRAPH_TF_FRONTEND_ENABLE" OFF) + "NGRAPH_ONNX_FRONTEND_ENABLE OR NGRAPH_PDPD_FRONTEND_ENABLE OR NGRAPH_TF_FRONTEND_ENABLE;BUILD_SHARED_LIBS" OFF) ie_dependent_option(NGRAPH_UNIT_TEST_ENABLE "Enables ngraph unit tests" ON "ENABLE_TESTS;NOT ANDROID" OFF) ie_dependent_option(NGRAPH_UNIT_TEST_BACKENDS_ENABLE "Control the building of unit tests using backends" ON "NGRAPH_UNIT_TEST_ENABLE" OFF) ie_option(OPENVINO_DEBUG_ENABLE "Enable output for OPENVINO_DEBUG statements" OFF) ie_option(ENABLE_REQUIREMENTS_INSTALL "Dynamic dependencies install" ON) +if(NOT BUILD_SHARED_LIBS AND NGRAPH_TF_FRONTEND_ENABLE) + set(FORCE_FRONTENDS_USE_PROTOBUF ON) +else() + set(FORCE_FRONTENDS_USE_PROTOBUF OFF) +endif() + # WA for ngraph python build on Windows debug list(REMOVE_ITEM IE_OPTIONS NGRAPH_UNIT_TEST_ENABLE NGRAPH_UNIT_TEST_BACKENDS_ENABLE) diff --git a/inference-engine/cmake/ie_parallel.cmake b/cmake/ie_parallel.cmake similarity index 100% rename from inference-engine/cmake/ie_parallel.cmake rename to cmake/ie_parallel.cmake diff --git a/cmake/templates/InferenceEngineDeveloperPackageConfig.cmake.in b/cmake/templates/InferenceEngineDeveloperPackageConfig.cmake.in index 0f1f0d5e374..bf7f04d8f93 100644 --- a/cmake/templates/InferenceEngineDeveloperPackageConfig.cmake.in +++ b/cmake/templates/InferenceEngineDeveloperPackageConfig.cmake.in @@ -45,7 +45,7 @@ find_dependency(InferenceEngine NO_DEFAULT_PATH) find_dependency(ngraph - PATHS "${CMAKE_CURRENT_LIST_DIR}/ngraph" + PATHS "${CMAKE_CURRENT_LIST_DIR}/src/core" NO_CMAKE_FIND_ROOT_PATH NO_DEFAULT_PATH) diff --git a/cmake/test_model_zoo.cmake b/cmake/test_model_zoo.cmake index c8ec6691ca9..a9f6356826a 100644 --- a/cmake/test_model_zoo.cmake +++ b/cmake/test_model_zoo.cmake @@ -5,7 +5,7 @@ set_property(GLOBAL PROPERTY JOB_POOLS four_jobs=4) function(ov_model_convert SRC DST OUT) - set(onnx_gen_script ${OpenVINO_SOURCE_DIR}/ngraph/test/models/onnx/onnx_prototxt_converter.py) + set(onnx_gen_script ${OpenVINO_SOURCE_DIR}/src/core/tests/models/onnx/onnx_prototxt_converter.py) file(GLOB_RECURSE prototxt_models RELATIVE "${SRC}" "${SRC}/*.prototxt") file(GLOB_RECURSE xml_models RELATIVE "${SRC}" "${SRC}/*.xml") @@ -62,8 +62,8 @@ function(ov_model_convert SRC DST OUT) set(${OUT} ${files} PARENT_SCOPE) endfunction() -ov_model_convert("${CMAKE_CURRENT_SOURCE_DIR}/ngraph/test" - "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_model_zoo/ngraph" +ov_model_convert("${CMAKE_CURRENT_SOURCE_DIR}/src/core/tests" + "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_model_zoo/core" onnx_out_files) set(rel_path "inference-engine/tests/functional/plugin/shared/models") @@ -117,7 +117,7 @@ if(ENABLE_TESTS) list(APPEND args --use-feature=2020-resolver) endif() - set(reqs "${OpenVINO_SOURCE_DIR}/ngraph/test/requirements_test_onnx.txt") + set(reqs "${OpenVINO_SOURCE_DIR}/src/core/tests/requirements_test_onnx.txt") add_custom_target(test_pip_prerequsites ALL "${PYTHON_EXECUTABLE}" -m pip install ${args} -r ${reqs} COMMENT "Install requirements_test.txt" diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index b2ccee1dcdd..b0cbcdf899d 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -65,13 +65,14 @@ function(build_docs) set(DOCS_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}") set(DOXYGEN_DIR "${OpenVINO_SOURCE_DIR}/docs/doxygen") set(IE_SOURCE_DIR "${OpenVINO_SOURCE_DIR}/inference-engine") + set(OV_INFERENCE_DIR "${OpenVINO_SOURCE_DIR}/src/inference") set(PYTHON_API_IN "${IE_SOURCE_DIR}/ie_bridges/python/src/openvino/inference_engine/ie_api.pyx") set(PYTHON_API_OUT "${DOCS_BUILD_DIR}/python_api/ie_api.pyx") - set(C_API "${IE_SOURCE_DIR}/ie_bridges/c/include") + set(C_API "${OpenVINO_SOURCE_DIR}/bindings/c/include") set(PLUGIN_API_DIR "${DOCS_BUILD_DIR}/IE_PLUGIN_DG") - set(NGRAPH_DIR "${OpenVINO_SOURCE_DIR}/ngraph") - set(NGRAPH_PY_DIR "${OpenVINO_SOURCE_DIR}/runtime/bindings/python/src/compatibility/ngraph/") - set(NGRAPH_CPP_DIR "${NGRAPH_DIR}/core/include/" "${NGRAPH_DIR}/frontend/onnx_import/include") + set(CORE_DIR "${OpenVINO_SOURCE_DIR}/src/core") + set(FRONTENDS_DIR "${OpenVINO_SOURCE_DIR}/src/frontends") + set(NGRAPH_PY_DIR "${OpenVINO_SOURCE_DIR}/src/bindings/python/src/compatibility/ngraph/") # Preprocessing scripts set(DOXY_MD_FILTER "${DOXYGEN_DIR}/doxy_md_filter.py") @@ -222,10 +223,10 @@ function(build_docs) "${OpenVINO_SOURCE_DIR}/inference-engine/*.png" "${OpenVINO_SOURCE_DIR}/inference-engine/*.gif" "${OpenVINO_SOURCE_DIR}/inference-engine/*.jpg" - "${OpenVINO_SOURCE_DIR}/runtime/*.md" - "${OpenVINO_SOURCE_DIR}/runtime/*.png" - "${OpenVINO_SOURCE_DIR}/runtime/*.gif" - "${OpenVINO_SOURCE_DIR}/runtime/*.jpg" + "${OpenVINO_SOURCE_DIR}/src/*.md" + "${OpenVINO_SOURCE_DIR}/src/*.png" + "${OpenVINO_SOURCE_DIR}/src/*.gif" + "${OpenVINO_SOURCE_DIR}/src/*.jpg" "${OpenVINO_SOURCE_DIR}/samples/*.md" "${OpenVINO_SOURCE_DIR}/samples/*.png" "${OpenVINO_SOURCE_DIR}/samples/*.gif" diff --git a/docs/IE_DG/Deep_Learning_Inference_Engine_DevGuide.md b/docs/IE_DG/Deep_Learning_Inference_Engine_DevGuide.md index 9abaca6c1c9..ff0367313f0 100644 --- a/docs/IE_DG/Deep_Learning_Inference_Engine_DevGuide.md +++ b/docs/IE_DG/Deep_Learning_Inference_Engine_DevGuide.md @@ -70,7 +70,7 @@ The table below shows the plugin libraries and additional dependencies for Linux | MYRIAD | `libmyriadPlugin.so` | `libusb.so`, | `myriadPlugin.dll` | `usb.dll` | `libmyriadPlugin.so` | `libusb.dylib` | | HDDL | `libHDDLPlugin.so` | `libbsl.so`, `libhddlapi.so`, `libmvnc-hddl.so` | `HDDLPlugin.dll` | `bsl.dll`, `hddlapi.dll`, `json-c.dll`, `libcrypto-1_1-x64.dll`, `libssl-1_1-x64.dll`, `mvnc-hddl.dll` | Is not supported | - | | GNA | `libGNAPlugin.so` | `libgna.so`, | `GNAPlugin.dll` | `gna.dll` | Is not supported | - | -| HETERO | `libHeteroPlugin.so` | Same as for selected plugins | `HeteroPlugin.dll` | Same as for selected plugins | `libHeteroPlugin.so` | Same as for selected plugins | +| HETERO | `libov_hetero_plugin.so` | Same as for selected plugins | `ov_hetero_plugin.dll` | Same as for selected plugins | `libov_hetero_plugin.so` | Same as for selected plugins | | MULTI | `libMultiDevicePlugin.so` | Same as for selected plugins | `MultiDevicePlugin.dll` | Same as for selected plugins | `libMultiDevicePlugin.so` | Same as for selected plugins | > **NOTE**: All plugin libraries also depend on core Inference Engine libraries. diff --git a/docs/IE_DG/PythonPackage_Overview.md b/docs/IE_DG/PythonPackage_Overview.md index a86a146d7fe..19f97d4c235 100644 --- a/docs/IE_DG/PythonPackage_Overview.md +++ b/docs/IE_DG/PythonPackage_Overview.md @@ -7,7 +7,7 @@ The OpenVINO™ Python\* package available in the `/python/python3. The OpenVINO™ Python\* package includes the following sub-packages: - - [openvino.inference_engine](../../runtime/bindings/python/docs/api_overview.md) - Python\* wrapper on OpenVINO™ Inference Engine. + - [openvino.inference_engine](../../src/bindings/python/docs/api_overview.md) - Python\* wrapper on OpenVINO™ Inference Engine. - `openvino.tools.accuracy_checker` - Measure accuracy. - `openvino.tools.benchmark` - Measure latency and throughput. diff --git a/docs/IE_DG/inference_engine_intro.md b/docs/IE_DG/inference_engine_intro.md index cd703b1a3ee..0ead43f773e 100644 --- a/docs/IE_DG/inference_engine_intro.md +++ b/docs/IE_DG/inference_engine_intro.md @@ -75,7 +75,7 @@ The table below shows the plugin libraries and additional dependencies for Linux | MYRIAD | `libmyriadPlugin.so` | `libusb.so`, | `myriadPlugin.dll` | `usb.dll` | `libmyriadPlugin.so` | `libusb.dylib` | | HDDL | `libHDDLPlugin.so` | `libbsl.so`, `libhddlapi.so`, `libmvnc-hddl.so` | `HDDLPlugin.dll` | `bsl.dll`, `hddlapi.dll`, `json-c.dll`, `libcrypto-1_1-x64.dll`, `libssl-1_1-x64.dll`, `mvnc-hddl.dll` | Is not supported | - | | GNA | `libGNAPlugin.so` | `libgna.so`, | `GNAPlugin.dll` | `gna.dll` | Is not supported | - | -| HETERO | `libHeteroPlugin.so` | Same as for selected plugins | `HeteroPlugin.dll` | Same as for selected plugins | `libHeteroPlugin.so` | Same as for selected plugins | +| HETERO | `libov_hetero_plugin.so` | Same as for selected plugins | `ov_hetero_plugin.dll` | Same as for selected plugins | `libov_hetero_plugin.so` | Same as for selected plugins | | MULTI | `libMultiDevicePlugin.so` | Same as for selected plugins | `MultiDevicePlugin.dll` | Same as for selected plugins | `libMultiDevicePlugin.so` | Same as for selected plugins | > **NOTE**: All plugin libraries also depend on core Inference Engine libraries. diff --git a/docs/IE_PLUGIN_DG/Doxyfile b/docs/IE_PLUGIN_DG/Doxyfile index 8c275fe9f0c..a9367a25888 100644 --- a/docs/IE_PLUGIN_DG/Doxyfile +++ b/docs/IE_PLUGIN_DG/Doxyfile @@ -781,9 +781,9 @@ WARN_LOGFILE = # Note: If this tag is empty the current directory is searched. INPUT = . \ - ../../inference-engine/src/transformations/include/transformations \ - ../../inference-engine/src/plugin_api \ - ../../openvino/itt/include/openvino + ../../src/common/transformations/include/transformations \ + ../../src/inference/dev_api \ + ../../src/common/itt/include/openvino # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses diff --git a/docs/MO_DG/prepare_model/convert_model/tf_specific/Convert_GNMT_From_Tensorflow.md b/docs/MO_DG/prepare_model/convert_model/tf_specific/Convert_GNMT_From_Tensorflow.md index 989290b8f8a..18a770d32e1 100644 --- a/docs/MO_DG/prepare_model/convert_model/tf_specific/Convert_GNMT_From_Tensorflow.md +++ b/docs/MO_DG/prepare_model/convert_model/tf_specific/Convert_GNMT_From_Tensorflow.md @@ -274,4 +274,4 @@ exec_net = ie.load_network(network=net, device_name="CPU") result_ie = exec_net.infer(input_data) ``` -For more information about Python API, refer to [Inference Engine Python API Overview](../../../../../runtime/bindings/python/docs/api_overview.md). +For more information about Python API, refer to [Inference Engine Python API Overview](../../../../../src/bindings/python/docs/api_overview.md). diff --git a/docs/doxygen/doxygen-ignore.txt b/docs/doxygen/doxygen-ignore.txt index f623f4826e1..77e59419d8f 100644 --- a/docs/doxygen/doxygen-ignore.txt +++ b/docs/doxygen/doxygen-ignore.txt @@ -1,6 +1,5 @@ openvino/samples/cpp/hello_reshape_ssd/README.md openvino/docs/index.md -inference-engine/include/ie_icnn_network.hpp openvino/docs/get_started/get_started_dl_workbench.md openvino/docs/get_started/get_started_linux.md openvino/docs/get_started/get_started_raspbian.md @@ -10,29 +9,13 @@ openvino/docs/HOWTO/Custom_Layers_Guide.md openvino/docs/install_guides/deployment-manager-tool.md openvino/docs/MO_DG/prepare_model/customize_model_optimizer/Customize_Model_Optimizer.md openvino/docs/ovsa/ovsa_get_started.md -openvino/inference-engine/ie_bridges/c/docs/api_overview.md -inference-engine/include/cpp/ie_infer_request.hpp -inference-engine/include/ie_parallel.hpp -inference-engine/include/gpu/gpu_context_api_ocl.hpp -inference-engine/include/gpu/gpu_context_api_va.hpp -inference-engine/include/ie_plugin_config.hpp -inference-engine/include/ie_unicode.hpp -inference-engine/include/vpu/myriad_config.hpp -inference-engine/include/vpu/vpu_config.hpp -inference-engine/include/vpu/vpu_plugin_config.hpp +openvino/src/bindings/c/docs/api_overview.md openvino/docs/benchmarks/performance_int8_vs_fp32.md openvino/docs/get_started/get_started_macos.md -inference-engine/include/details/ie_so_pointer.hpp -inference-engine/include/ie_compound_blob.h -inference-engine/include/ie_data.h -inference-engine/include/ie_blob.h -inference-engine/include/ie_precision.hpp -inference-engine/include/ie_remote_context.hpp -inference-engine/include/gpu/gpu_context_api_dx.hpp build/docs/openvino_docs.xml openvino/docs/install_guides/installing-openvino-linux-ivad-vpu.md -inference-engine/src/inference_engine/include/ie/ie_parallel.hpp -inference-engine/src/inference_engine/include/ie/ie_plugin_config.hpp -inference-engine/src/inference_engine/include/ie/vpu/myriad_config.hpp -inference-engine/src/inference_engine/include/ie/vpu/vpu_config.hpp -inference-engine/src/inference_engine/include/ie/vpu/vpu_plugin_config.hpp +src/inference/include/ie/ie_parallel.hpp +src/inference/include/ie/ie_plugin_config.hpp +src/inference/include/ie/vpu/myriad_config.hpp +src/inference/include/ie/vpu/vpu_config.hpp +src/inference/include/ie/vpu/vpu_plugin_config.hpp diff --git a/docs/doxygen/ie_docs.config b/docs/doxygen/ie_docs.config index d8050d0e4a5..fd5ca445ceb 100644 --- a/docs/doxygen/ie_docs.config +++ b/docs/doxygen/ie_docs.config @@ -824,7 +824,7 @@ WARN_LOGFILE = "@DOCS_BUILD_DIR@/ie_docs.log" # Note: If this tag is empty the current directory is searched. INPUT = "@DOCS_BUILD_DIR@" \ - "@IE_SOURCE_DIR@/src/inference_engine/include" + "@OV_INFERENCE_DIR@/include" # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses diff --git a/docs/doxygen/ie_plugin_api.config b/docs/doxygen/ie_plugin_api.config index 470d2dd845a..b6c72a139e6 100644 --- a/docs/doxygen/ie_plugin_api.config +++ b/docs/doxygen/ie_plugin_api.config @@ -24,9 +24,9 @@ GENERATE_TAGFILE = "@DOCS_BUILD_DIR@/ie_plugin_api.tag" EXTRACT_LOCAL_CLASSES = NO INPUT = "@DOCS_BUILD_DIR@/docs/IE_PLUGIN_DG" \ - "@IE_SOURCE_DIR@/src/plugin_api" \ - "@IE_SOURCE_DIR@/src/transformations/include" \ - "@OpenVINO_SOURCE_DIR@/openvino/itt/include/openvino" + "@OV_INFERENCE_DIR@/dev_api" \ + "@OpenVINO_SOURCE_DIR@/src/common/transformations/include" \ + "@OpenVINO_SOURCE_DIR@/src/common/itt/include/openvino" RECURSIVE = YES diff --git a/docs/doxygen/ngraph_cpp_api.config b/docs/doxygen/ngraph_cpp_api.config index 2b0b50b6d70..5ee7a2d6f24 100644 --- a/docs/doxygen/ngraph_cpp_api.config +++ b/docs/doxygen/ngraph_cpp_api.config @@ -28,9 +28,9 @@ FILE_PATTERNS = *.cpp \ LAYOUT_FILE = "@NGRAPH_CPP_LAYOUT_BUILD@" -INPUT = "@NGRAPH_DIR@/core/include/" \ - "@NGRAPH_DIR@/frontend/onnx/frontend/include/" \ - "@NGRAPH_DIR@/frontend/paddlepaddle/frontend/include/" +INPUT = "@CORE_DIR@/core/include/" \ + "@FRONTENDS_DIR@/onnx/frontend/include/" \ + "@FRONTENDS_DIR@/paddlepaddle/frontend/include/" HTML_OUTPUT = "@NGRAPH_CPP_OUTPUT@" diff --git a/docs/nGraph_DG/nGraphTransformation.md b/docs/nGraph_DG/nGraphTransformation.md index e46f0dd8a02..03777180ad8 100644 --- a/docs/nGraph_DG/nGraphTransformation.md +++ b/docs/nGraph_DG/nGraphTransformation.md @@ -11,7 +11,7 @@ Before creating a transformation, do the following: ### Transformation Library Structure Transformation library is independent from Inference Engine target library named as `inference_engine_transformations` -and is located in the `inference-engine/src/transformations` directory. +and is located in the `src/common/transformations` directory. Transformations root directory contains two folders: * `ngraph_ops` - Contains internal opset operations that are common for plugins. diff --git a/docs/nGraph_DG/nGraph_debug_capabilities.md b/docs/nGraph_DG/nGraph_debug_capabilities.md index bda4dff150c..971db2eeaed 100644 --- a/docs/nGraph_DG/nGraph_debug_capabilities.md +++ b/docs/nGraph_DG/nGraph_debug_capabilities.md @@ -14,3 +14,5 @@ std::shared_ptr nGraph; ... ngraph::pass::VisualizeTree("after.png").run_on_function(nGraph); // Visualize the nGraph function to an image ``` + +> **NOTE**: Graphviz is required for visualization to image. diff --git a/docs/snippets/InferenceEngine_Caching3.cpp b/docs/snippets/InferenceEngine_Caching3.cpp index ce91a798552..282d07b1dc9 100644 --- a/docs/snippets/InferenceEngine_Caching3.cpp +++ b/docs/snippets/InferenceEngine_Caching3.cpp @@ -14,7 +14,7 @@ using namespace InferenceEngine; auto it = std::find(keys.begin(), keys.end(), METRIC_KEY(IMPORT_EXPORT_SUPPORT)); // If metric 'IMPORT_EXPORT_SUPPORT' exists, check it's value - bool cachingSupported = (it != keys.end()) && ie.GetMetric(deviceName, METRIC_KEY(IMPORT_EXPORT_SUPPORT)); + bool cachingSupported = (it != keys.end()) && ie.GetMetric(deviceName, METRIC_KEY(IMPORT_EXPORT_SUPPORT)).as(); //! [part3] return 0; } diff --git a/docs/template_plugin/tests/functional/CMakeLists.txt b/docs/template_plugin/tests/functional/CMakeLists.txt index 16db218346d..0a0309992b6 100644 --- a/docs/template_plugin/tests/functional/CMakeLists.txt +++ b/docs/template_plugin/tests/functional/CMakeLists.txt @@ -21,7 +21,7 @@ addIeTargetTest( ) if(ENABLE_HETERO) - add_dependencies(${TARGET_NAME} HeteroPlugin) + add_dependencies(${TARGET_NAME} ov_hetero_plugin) endif() find_package(OpenCV QUIET COMPONENTS core imgproc) diff --git a/docs/template_plugin/tests/functional/op_reference/matrix_nms.cpp b/docs/template_plugin/tests/functional/op_reference/matrix_nms.cpp new file mode 100644 index 00000000000..0f56d574fa4 --- /dev/null +++ b/docs/template_plugin/tests/functional/op_reference/matrix_nms.cpp @@ -0,0 +1,481 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include + +#include "openvino/opsets/opset8.hpp" +#include "openvino/opsets/opset1.hpp" +#include "base_reference_test.hpp" + +using namespace reference_tests; +using namespace ov; + +namespace { +struct MatrixNmsParams { + MatrixNmsParams( + const opset8::MatrixNms::Attributes& attrs, + const Tensor& boxes, const Tensor& scores, + const Tensor& expectedSelectedScores, const Tensor& expectedSelectedIndices, + const Tensor& expectedValidOutputs, const std::string& testcaseName = "") : + attrs(attrs), + boxes(boxes), scores(scores), + expectedSelectedScores(expectedSelectedScores), expectedSelectedIndices(expectedSelectedIndices), + expectedValidOutputs(expectedValidOutputs), testcaseName(testcaseName) {} + + opset8::MatrixNms::Attributes attrs; + Tensor boxes; + Tensor scores; + Tensor expectedSelectedScores; + Tensor expectedSelectedIndices; + Tensor expectedValidOutputs; + std::string testcaseName; +}; + +class ReferenceMatrixNmsTest : public testing::TestWithParam, public CommonReferenceTest { +public: + void SetUp() override { + auto params = GetParam(); + function = CreateFunction(params); + inputData = {params.boxes.data, params.scores.data}; + refOutData = {params.expectedSelectedScores.data, + params.expectedSelectedIndices.data, + params.expectedValidOutputs.data}; + } + + static std::string getTestCaseName(const testing::TestParamInfo& obj) { + auto param = obj.param; + std::ostringstream result; + result << "bType=" << param.boxes.type; + result << "_bShape=" << param.boxes.shape; + result << "_sType=" << param.scores.type; + result << "_sShape=" << param.scores.shape; + result << "_escType=" << param.expectedSelectedScores.type; + result << "_escShape=" << param.expectedSelectedScores.shape; + result << "_esiType=" << param.expectedSelectedIndices.type; + result << "_esiShape=" << param.expectedSelectedIndices.shape; + result << "_evoType=" << param.expectedValidOutputs.type; + if (param.testcaseName != "") { + result << "_evoShape=" << param.expectedValidOutputs.shape; + result << "_=" << param.testcaseName; + } else { + result << "_evoShape=" << param.expectedValidOutputs.shape; + } + return result.str(); + } + +private: + static std::shared_ptr CreateFunction(const MatrixNmsParams& params) { + const auto boxes = std::make_shared(params.boxes.type, PartialShape::dynamic()); + const auto scores = std::make_shared(params.scores.type, PartialShape::dynamic()); + const auto nms = std::make_shared(boxes, scores, params.attrs); + const auto f = std::make_shared(nms->outputs(), ParameterVector{boxes, scores}); + return f; + } +}; + +TEST_P(ReferenceMatrixNmsTest, CompareWithRefs) { + Exec(); +} + +template +std::vector generateParams() { + using T = typename element_type_traits::value_type; + using T_TH = typename element_type_traits::value_type; + using T_IND = typename element_type_traits::value_type; + std::vector params { + MatrixNmsParams( + { + opset8::MatrixNms::SortResultType::SCORE, // sort_result_type + false, // sort_result_across_batch + ET_IND, // output_type + 0.0f, // score_threshold + 3, // nms_top_k + -1, // keep_top_k + 0, // background_class + opset8::MatrixNms::DecayFunction::LINEAR, // decay_function + 2.0f, // gaussian_sigma + 0.0f, // post_threshold + true, // normalized + }, + Tensor(ET, {1, 6, 4}, std::vector{ + 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, + 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0}), // boxes + Tensor(ET_TH, {1, 2, 6}, std::vector{ + 0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3}), // scores + Tensor(ET_TH, {3, 6}, std::vector{ + 1.00, 0.95, 0.00, 0.00, 1.00, 1.00, 1.00, 0.8, 0.00, + 10.00, 1.00, 11.00, 1.00, 0.13636364, 0.0, 0.1, 1.0, 1.1}), // expected_selected_scores + Tensor(ET_IND, {3, 1}, std::vector{0, 3, 1}), // expected_selected_indices + Tensor(ET_IND, {1}, std::vector{3}), // expected_valid_outputs + "matrix_nms_output_type_i64"), + MatrixNmsParams( + { + opset8::MatrixNms::SortResultType::SCORE, // sort_result_type + false, // sort_result_across_batch + ET_IND, // output_type + 0.0f, // score_threshold + 3, // nms_top_k + -1, // keep_top_k + 0, // background_class + opset8::MatrixNms::DecayFunction::LINEAR, // decay_function + 2.0f, // gaussian_sigma + 0.0f, // post_threshold + true, // normalized + }, + Tensor(ET, {1, 6, 4}, std::vector{ + 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, + 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0}), // boxes + Tensor(ET_TH, {1, 2, 6}, std::vector{ + 0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3}), // scores + Tensor(ET_TH, {3, 6}, std::vector{ + 1.00, 0.95, 0.00, 0.00, 1.00, 1.00, 1.00, 0.8, 0.00, + 10.00, 1.00, 11.00, 1.00, 0.13636364, 0.0, 0.1, 1.0, 1.1}), // expected_selected_scores + Tensor(ET_IND, {3, 1}, std::vector{0, 3, 1}), // expected_selected_indices + Tensor(ET_IND, {1}, std::vector{3}), // expected_valid_outputs + "matrix_nms_output_type_i32"), + MatrixNmsParams( + { + opset8::MatrixNms::SortResultType::SCORE, // sort_result_type + false, // sort_result_across_batch + ET_IND, // output_type + 0.0f, // score_threshold + 3, // nms_top_k + -1, // keep_top_k + 0, // background_class + opset8::MatrixNms::DecayFunction::GAUSSIAN, // decay_function + 2.0f, // gaussian_sigma + 0.0f, // post_threshold + true, // normalized + }, + Tensor(ET, {1, 6, 4}, std::vector{ + 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, + 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0}), // boxes + Tensor(ET_TH, {1, 2, 6}, std::vector{ + 0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3}), // scores + Tensor(ET_TH, {3, 6}, std::vector{ + 1.00, 0.95, 0.00, 0.00, 1.00, 1.00, 1.00, 0.8, 0.00, + 10.00, 1.00, 11.00, 1.00, 0.1966116, 0.0, 0.1, 1.0, 1.1}), // expected_selected_scores + Tensor(ET_IND, {3, 1}, std::vector{0, 3, 1}), // expected_selected_indices + Tensor(ET_IND, {1}, std::vector{3}), // expected_valid_outputs + "matrix_nms_gaussian"), + MatrixNmsParams( + { + opset8::MatrixNms::SortResultType::SCORE, // sort_result_type + false, // sort_result_across_batch + ET_IND, // output_type + 0.0f, // score_threshold + 3, // nms_top_k + -1, // keep_top_k + 0, // background_class + opset8::MatrixNms::DecayFunction::LINEAR, // decay_function + 2.0f, // gaussian_sigma + 0.0f, // post_threshold + true, // normalized + }, + Tensor(ET, {2, 6, 4}, std::vector{ + 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, + 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0, + 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, + 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0}), // boxes + Tensor(ET_TH, {2, 2, 6}, std::vector{ + 0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3, + 0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3}), // scores + Tensor(ET_TH, {6, 6}, std::vector{ + 1.00, 0.95, 0.00, 0.00, 1.00, 1.00, 1.00, 0.8, 0.00, 10.00, 1.00, 11.00, 1.00, 0.13636364, 0.0, 0.1, 1.0, 1.1, + 1.00, 0.95, 0.00, 0.00, 1.00, 1.00, 1.00, 0.8, 0.00, 10.00, 1.00, 11.00, 1.00, 0.13636364, 0.0, 0.1, 1.0, 1.1}), + // expected_selected_scores + Tensor(ET_IND, {6, 1}, std::vector{0, 3, 1, 6, 9, 7}), // expected_selected_indices + Tensor(ET_IND, {2}, std::vector{3, 3}), // expected_valid_outputs + "matrix_nms_two_batches_two_classes"), + MatrixNmsParams( + { + opset8::MatrixNms::SortResultType::SCORE, // sort_result_type + true, // sort_result_across_batch + ET_IND, // output_type + 0.0f, // score_threshold + 3, // nms_top_k + -1, // keep_top_k + -1, // background_class + opset8::MatrixNms::DecayFunction::LINEAR, // decay_function + 2.0f, // gaussian_sigma + 0.5f, // post_threshold + true, // normalized + }, + Tensor(ET, {2, 6, 4}, std::vector{ + 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, + 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0, + 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, + 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0}), // boxes + Tensor(ET_TH, {2, 2, 6}, std::vector{ + 0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3, + 0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3}), // scores + Tensor(ET_TH, {8, 6}, std::vector{ + 0.00, 0.95, 0.00, 10.00, 1.00, 11.00, + 1.00, 0.95, 0.00, 0.00, 1.00, 1.00, + 0.00, 0.95, 0.00, 10.00, 1.00, 11.00, + 1.00, 0.95, 0.00, 0.00, 1.00, 1.00, + 0.00, 0.90, 0.00, 0.00, 1.00, 1.00, + 0.00, 0.90, 0.00, 0.00, 1.00, 1.00, + 1.00, 0.80, 0.00, 10.00, 1.00, 11.00, + 1.00, 0.80, 0.00, 10.00, 1.00, 11.00}), // expected_selected_scores + Tensor(ET_IND, {8, 1}, std::vector{3, 0, 9, 6, 0, 6, 3, 9}), // expected_selected_indices + Tensor(ET_IND, {2}, std::vector{4, 4}), // expected_valid_outputs + "matrix_nms_two_batches_two_classes_by_score_cross_batch"), + MatrixNmsParams( + { + opset8::MatrixNms::SortResultType::CLASSID, // sort_result_type + true, // sort_result_across_batch + ET_IND, // output_type + 0.0f, // score_threshold + 3, // nms_top_k + -1, // keep_top_k + -1, // background_class + opset8::MatrixNms::DecayFunction::LINEAR, // decay_function + 2.0f, // gaussian_sigma + 0.5f, // post_threshold + true, // normalized + }, + Tensor(ET, {2, 6, 4}, std::vector{ + 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, + 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0, + 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, + 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0}), // boxes + Tensor(ET_TH, {2, 2, 6}, std::vector{ + 0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3, + 0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3}), // scores + Tensor(ET_TH, {8, 6}, std::vector{ + 0.00, 0.95, 0.00, 10.00, 1.00, 11.00, + 0.00, 0.90, 0.00, 0.00, 1.00, 1.00, + 0.00, 0.95, 0.00, 10.00, 1.00, 11.00, + 0.00, 0.90, 0.00, 0.00, 1.00, 1.00, + 1.00, 0.95, 0.00, 0.00, 1.00, 1.00, + 1.00, 0.80, 0.00, 10.00, 1.00, 11.00, + 1.00, 0.95, 0.00, 0.00, 1.00, 1.00, + 1.00, 0.80, 0.00, 10.00, 1.00, 11.00}), // expected_selected_scores + Tensor(ET_IND, {8, 1}, std::vector{3, 0, 9, 6, 0, 3, 6, 9}), // expected_selected_indices + Tensor(ET_IND, {2}, std::vector{4, 4}), // expected_valid_outputs + "matrix_nms_two_batches_two_classes_by_classid_cross_batch"), + MatrixNmsParams( + { + opset8::MatrixNms::SortResultType::CLASSID, // sort_result_type + false, // sort_result_across_batch + ET_IND, // output_type + 0.0f, // score_threshold + 3, // nms_top_k + 3, // keep_top_k + 0, // background_class + opset8::MatrixNms::DecayFunction::LINEAR, // decay_function + 2.0f, // gaussian_sigma + 0.0f, // post_threshold + true, // normalized + }, + Tensor(ET, {2, 6, 4}, std::vector{ + 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, + 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0, + 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, + 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0}), // boxes + Tensor(ET_TH, {2, 2, 6}, std::vector{ + 0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3, + 0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3}), // scores + Tensor(ET_TH, {6, 6}, std::vector{ + 1.00, 0.95, 0.00, 0.00, 1.00, 1.00, 1.00, 0.8, 0.00, 10.00, 1.00, 11.00, 1.00, 0.13636364, 0.0, 0.1, 1.0, 1.1, + 1.00, 0.95, 0.00, 0.00, 1.00, 1.00, 1.00, 0.8, 0.00, 10.00, 1.00, 11.00, 1.00, 0.13636364, 0.0, 0.1, 1.0, 1.1}), + // expected_selected_scores + Tensor(ET_IND, {6, 1}, std::vector{0, 3, 1, 6, 9, 7}), // expected_selected_indices + Tensor(ET_IND, {2}, std::vector{3, 3}), // expected_valid_outputs + "matrix_nms_by_keep_top_k"), + MatrixNmsParams( + { + opset8::MatrixNms::SortResultType::SCORE, // sort_result_type + false, // sort_result_across_batch + ET_IND, // output_type + 0.0f, // score_threshold + 3, // nms_top_k + -1, // keep_top_k + -1, // background_class + opset8::MatrixNms::DecayFunction::LINEAR, // decay_function + 2.0f, // gaussian_sigma + 0.0f, // post_threshold + true, // normalized + }, + Tensor(ET, {1, 6, 4}, std::vector{ + 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, + 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0}), // boxes + Tensor(ET_TH, {1, 2, 6}, std::vector{ + 0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3}), // scores + Tensor(ET_TH, {6, 6}, std::vector{ + 0.00, 0.95, 0.0, 10.0, 1.0, 11.0, 1.00, 0.95, 0.0, 0.0, 1.0, 1.0, 0.00, 0.9, 0.0, 0.0, 1.0, 1.0, + 1.00, 0.8, 0.0, 10.0, 1.0, 11.0, 0.00, 0.13636364, 0.0, 0.1, 1.0, 1.1, 1.00, 0.13636364, 0.0, 0.1, 1.0, 1.1}), + // expected_selected_scores + Tensor(ET_IND, {6, 1}, std::vector{3, 0, 0, 3, 1, 1}), // expected_selected_indices + Tensor(ET_IND, {1}, std::vector{6}), // expected_valid_outputs + "matrix_nms_background"), + MatrixNmsParams( + { + opset8::MatrixNms::SortResultType::SCORE, // sort_result_type + false, // sort_result_across_batch + ET_IND, // output_type + 0.0f, // score_threshold + 3, // nms_top_k + -1, // keep_top_k + -1, // background_class + opset8::MatrixNms::DecayFunction::LINEAR, // decay_function + 2.0f, // gaussian_sigma + 0.0f, // post_threshold + true, // normalized + }, + Tensor(ET, {1, 6, 4}, std::vector{ + 1.0, 1.0, 0.0, 0.0, 0.0, 0.1, 1.0, 1.1, 0.0, 0.9, 1.0, -0.1, + 0.0, 10.0, 1.0, 11.0, 1.0, 10.1, 0.0, 11.1, 1.0, 101.0, 0.0, 100.0}), // boxes + Tensor(ET_TH, {1, 1, 6}, std::vector{ + 0.9, 0.75, 0.6, 0.95, 0.5, 0.3}), // scores + Tensor(ET_TH, {3, 6}, std::vector{ + 0.00, 0.95, 0.0, 10.0, 1.0, 11.0, 0.00, 0.9, 1.0, 1.0, 0.0, 0.0, 0.00, 0.75, 0.0, 0.1, 1.0, 1.1}), + // expected_selected_scores + Tensor(ET_IND, {3, 1}, std::vector{3, 0, 1}), // expected_selected_indices + Tensor(ET_IND, {1}, std::vector{3}), // expected_valid_outputs + "matrix_nms_flipped_coordinates"), + MatrixNmsParams( + { + opset8::MatrixNms::SortResultType::SCORE, // sort_result_type + false, // sort_result_across_batch + ET_IND, // output_type + 0.0f, // score_threshold + 3, // nms_top_k + -1, // keep_top_k + -1, // background_class + opset8::MatrixNms::DecayFunction::LINEAR, // decay_function + 2.0f, // gaussian_sigma + 0.8f, // post_threshold + true, // normalized + }, + Tensor(ET, {1, 6, 4}, std::vector{ + 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, + 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0}), // boxes + Tensor(ET_TH, {1, 1, 6}, std::vector{ + 0.9, 0.75, 0.6, 0.95, 0.5, 0.3}), // scores + Tensor(ET_TH, {2, 6}, std::vector{ + 0.00, 0.95, 0.00, 10.00, 1.00, 11.00, 0.00, 0.9, 0.00, 0.00, 1.00, 1.00}), + // expected_selected_scores + Tensor(ET_IND, {2, 1}, std::vector{3, 0}), // expected_selected_indices + Tensor(ET_IND, {1}, std::vector{2}), // expected_valid_outputs + "matrix_nms_post_threshold"), + MatrixNmsParams( + { + opset8::MatrixNms::SortResultType::SCORE, // sort_result_type + false, // sort_result_across_batch + ET_IND, // output_type + 0.0f, // score_threshold + 3, // nms_top_k + -1, // keep_top_k + -1, // background_class + opset8::MatrixNms::DecayFunction::LINEAR, // decay_function + 2.0f, // gaussian_sigma + 0.3f, // post_threshold + true, // normalized + }, + Tensor(ET, {1, 10, 4}, std::vector{ + 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, + 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, + 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0}), // boxes + Tensor(ET_TH, {1, 1, 10}, std::vector{ + 0.4, 0.01, 0.2, 0.09, 0.15, 0.05, 0.02, 0.03, 0.05, 0.0}), // scores + Tensor(ET_TH, {1, 6}, std::vector{ + 0.00, 0.40, 0.00, 0.00, 1.00, 1.00}), // expected_selected_scores + Tensor(ET_IND, {1, 1}, std::vector{0}), // expected_selected_indices + Tensor(ET_IND, {1}, std::vector{1}), // expected_valid_outputs + "matrix_nms_identical_boxes"), + MatrixNmsParams( + { + opset8::MatrixNms::SortResultType::SCORE, // sort_result_type + false, // sort_result_across_batch + ET_IND, // output_type + 0.0f, // score_threshold + 2, // nms_top_k + -1, // keep_top_k + -1, // background_class + opset8::MatrixNms::DecayFunction::LINEAR, // decay_function + 2.0f, // gaussian_sigma + 0.0f, // post_threshold + true, // normalized + }, + Tensor(ET, {1, 6, 4}, std::vector{ + 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, + 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0}), // boxes + Tensor(ET_TH, {1, 1, 6}, std::vector{ + 0.9, 0.75, 0.6, 0.95, 0.5, 0.3}), // scores + Tensor(ET_TH, {2, 6}, std::vector{ + 0.00, 0.95, 0.00, 10.00, 1.00, 11.00, 0.00, 0.90, 0.00, 0.00, 1.00, 1.00}), + // expected_selected_scores + Tensor(ET_IND, {2, 1}, std::vector{3, 0}), // expected_selected_indices + Tensor(ET_IND, {1}, std::vector{2}), // expected_valid_outputs + "matrix_nms_nms_top_k"), + MatrixNmsParams( + { + opset8::MatrixNms::SortResultType::SCORE, // sort_result_type + false, // sort_result_across_batch + ET_IND, // output_type + 0.0f, // score_threshold + 3, // nms_top_k + -1, // keep_top_k + -1, // background_class + opset8::MatrixNms::DecayFunction::LINEAR, // decay_function + 2.0f, // gaussian_sigma + 0.0f, // post_threshold + true, // normalized + }, + Tensor(ET, {1, 1, 4}, std::vector{0.0, 0.0, 1.0, 1.0}), // boxes + Tensor(ET_TH, {1, 1, 1}, std::vector{0.9}), // scores + Tensor(ET_TH, {1, 6}, std::vector{ + 0.00, 0.90, 0.00, 0.00, 1.00, 1.00}), // expected_selected_scores + Tensor(ET_IND, {1, 1}, std::vector{0}), // expected_selected_indices + Tensor(ET_IND, {1}, std::vector{1}), // expected_valid_outputs + "matrix_nms_single_box"), + MatrixNmsParams( + { + opset8::MatrixNms::SortResultType::SCORE, // sort_result_type + false, // sort_result_across_batch + ET_IND, // output_type + 2.0f, // score_threshold + 3, // nms_top_k + -1, // keep_top_k + -1, // background_class + opset8::MatrixNms::DecayFunction::LINEAR, // decay_function + 2.0f, // gaussian_sigma + 0.0f, // post_threshold + true, // normalized + }, + Tensor(ET, {1, 6, 4}, std::vector{ + 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, + 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0}), // boxes + Tensor(ET_TH, {1, 1, 6}, std::vector{ + 0.9, 0.75, 0.6, 0.95, 0.5, 0.3}), // scores + Tensor(ET_TH, {0, 6}, std::vector{}), // expected_selected_scores + Tensor(ET_IND, {0, 1}, std::vector{}), // expected_selected_indices + Tensor(ET_IND, {1}, std::vector{0}), // expected_valid_outputs + "matrix_nms_no_output"), + }; + return params; +} + +std::vector generateCombinedParams() { + const std::vector> generatedParams { + generateParams(), + generateParams(), + generateParams(), + generateParams(), + generateParams(), + generateParams(), + }; + std::vector combinedParams; + + for (const auto& params : generatedParams) { + combinedParams.insert(combinedParams.end(), params.begin(), params.end()); + } + return combinedParams; +} + +INSTANTIATE_TEST_SUITE_P(smoke_MatrixNms_With_Hardcoded_Refs, ReferenceMatrixNmsTest, + testing::ValuesIn(generateCombinedParams()), ReferenceMatrixNmsTest::getTestCaseName); +} // namespace \ No newline at end of file diff --git a/docs/template_plugin/tests/functional/op_reference/multiclass_nms.cpp b/docs/template_plugin/tests/functional/op_reference/multiclass_nms.cpp new file mode 100644 index 00000000000..730675a8a12 --- /dev/null +++ b/docs/template_plugin/tests/functional/op_reference/multiclass_nms.cpp @@ -0,0 +1,567 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include + +#include "openvino/op/multiclass_nms.hpp" +#include "base_reference_test.hpp" + +using namespace reference_tests; +using namespace ov; + +namespace { +struct MulticlassNmsParams { + MulticlassNmsParams( + const int nms_top_k, + const float iou_threshold, + const float score_threshold, + const op::v8::MulticlassNms::SortResultType sort_result_type, + const int keep_top_k, + const int background_class, + const float nms_eta, + const ov::element::Type output_type, + const bool sort_result_across_batch, + const bool normalized, + const Tensor& boxes, const Tensor& scores, + const Tensor& expectedSelectedScores, const Tensor& expectedSelectedIndices, + const Tensor& expectedValidOutputs, const std::string& testcaseName = "") : + nms_top_k(nms_top_k), + iou_threshold(iou_threshold), + score_threshold(score_threshold), + sort_result_type(sort_result_type), + keep_top_k(keep_top_k), + background_class(background_class), + nms_eta(nms_eta), + output_type(output_type), + sort_result_across_batch(sort_result_across_batch), + normalized(normalized), + boxes(boxes), scores(scores), + expectedSelectedScores(expectedSelectedScores), expectedSelectedIndices(expectedSelectedIndices), + expectedValidOutputs(expectedValidOutputs), testcaseName(testcaseName) {} + + int nms_top_k; + float iou_threshold; + float score_threshold; + op::v8::MulticlassNms::SortResultType sort_result_type; + int keep_top_k; + int background_class; + float nms_eta; + ov::element::Type output_type; + + bool sort_result_across_batch = false; + bool normalized = true; + + Tensor boxes; + Tensor scores; + Tensor expectedSelectedScores; + Tensor expectedSelectedIndices; + Tensor expectedValidOutputs; + std::string testcaseName; +}; + +class ReferenceMulticlassNmsTest : public testing::TestWithParam, public CommonReferenceTest { +public: + void SetUp() override { + auto params = GetParam(); + function = CreateFunction(params); + inputData = {params.boxes.data, params.scores.data}; + refOutData = {params.expectedSelectedScores.data, + params.expectedSelectedIndices.data, + params.expectedValidOutputs.data}; + } + + static std::string getTestCaseName(const testing::TestParamInfo& obj) { + auto param = obj.param; + std::ostringstream result; + result << "bType=" << param.boxes.type; + result << "_bShape=" << param.boxes.shape; + result << "_sType=" << param.scores.type; + result << "_sShape=" << param.scores.shape; + result << "_escType=" << param.expectedSelectedScores.type; + result << "_escShape=" << param.expectedSelectedScores.shape; + result << "_esiType=" << param.expectedSelectedIndices.type; + result << "_esiShape=" << param.expectedSelectedIndices.shape; + result << "_evoType=" << param.expectedValidOutputs.type; + if (param.testcaseName != "") { + result << "_evoShape=" << param.expectedValidOutputs.shape; + result << "_=" << param.testcaseName; + } else { + result << "_evoShape=" << param.expectedValidOutputs.shape; + } + return result.str(); + } + +private: + static std::shared_ptr CreateFunction(const MulticlassNmsParams& params) { + op::v8::MulticlassNms::Attributes attrs; + attrs.nms_top_k = params.nms_top_k; + attrs.iou_threshold = params.iou_threshold; + attrs.score_threshold = params.score_threshold; + attrs.sort_result_type = params.sort_result_type; + attrs.keep_top_k = params.keep_top_k; + attrs.background_class = params.background_class; + attrs.nms_eta = params.nms_eta; + attrs.output_type = params.output_type; + attrs.sort_result_across_batch = params.sort_result_across_batch; + attrs.normalized = params.normalized; + const auto boxes = std::make_shared(params.boxes.type, PartialShape::dynamic()); + const auto scores = std::make_shared(params.scores.type, PartialShape::dynamic()); + const auto nms = std::make_shared(boxes, scores, attrs); + const auto f = std::make_shared(nms->outputs(), ParameterVector{boxes, scores}); + return f; + } +}; + +TEST_P(ReferenceMulticlassNmsTest, CompareWithRefs) { + Exec(); +} + +template +std::vector generateParams() { + using T = typename element_type_traits::value_type; + using T_TH = typename element_type_traits::value_type; + using T_IND = typename element_type_traits::value_type; + std::vector params { + MulticlassNmsParams( + 3, // nms_top_k + 0.5f, // iou_threshold + 0.0f, // score_threshold + op::v8::MulticlassNms::SortResultType::SCORE, // sort_result_type + -1, // keep_top_k + -1, // background_class + 1.0f, // nms_eta + ET_IND, // output_type + false, // sort_result_across_batch + true, // normalized + Tensor(ET, {1, 6, 4}, std::vector{ + 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, + 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0}), // boxes + Tensor(ET_TH, {1, 2, 6}, std::vector{ + 0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3}), // scores + Tensor(ET_TH, {4, 6}, std::vector{ + 0.00, 0.95, 0.00, 10.00, 1.00, 11.00, 1.00, 0.95, + 0.00, 0.00, 1.00, 1.00, 0.00, 0.90, 0.00, 0.00, + 1.00, 1.00, 1.00, 0.80, 0.00, 10.00, 1.00, 11.00}), // expected_selected_scores + Tensor(ET_IND, {4, 1}, std::vector{3, 0, 0, 3}), // expected_selected_indices + Tensor(ET_IND, {1}, std::vector{4}), // expected_valid_outputs + "multiclass_nms_by_score"), + MulticlassNmsParams( + 3, // nms_top_k + 0.5f, // iou_threshold + 0.0f, // score_threshold + op::v8::MulticlassNms::SortResultType::CLASSID, // sort_result_type + -1, // keep_top_k + -1, // background_class + 1.0f, // nms_eta + ET_IND, // output_type + false, // sort_result_across_batch + true, // normalized + Tensor(ET, {1, 6, 4}, std::vector{ + 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, + 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0}), // boxes + Tensor(ET_TH, {1, 2, 6}, std::vector{ + 0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3}), // scores + Tensor(ET_TH, {4, 6}, std::vector{ + 0.00, 0.95, 0.00, 10.00, 1.00, 11.00, 0.00, 0.90, + 0.00, 0.00, 1.00, 1.00, 1.00, 0.95, 0.00, 0.00, + 1.00, 1.00, 1.00, 0.80, 0.00, 10.00, 1.00, 11.00}), // expected_selected_scores + Tensor(ET_IND, {4, 1}, std::vector{3, 0, 0, 3}), // expected_selected_indices + Tensor(ET_IND, {1}, std::vector{4}), // expected_valid_outputs + "multiclass_nms_by_class_id"), + MulticlassNmsParams( + 3, // nms_top_k + 0.5f, // iou_threshold + 0.0f, // score_threshold + op::v8::MulticlassNms::SortResultType::CLASSID, // sort_result_type + -1, // keep_top_k + -1, // background_class + 1.0f, // nms_eta + ET_IND, // output_type + false, // sort_result_across_batch + true, // normalized + Tensor(ET, {1, 6, 4}, std::vector{ + 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, + 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0}), // boxes + Tensor(ET_TH, {1, 2, 6}, std::vector{ + 0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3}), // scores + Tensor(ET_TH, {4, 6}, std::vector{ + 0.00, 0.95, 0.00, 10.00, 1.00, 11.00, 0.00, 0.90, + 0.00, 0.00, 1.00, 1.00, 1.00, 0.95, 0.00, 0.00, + 1.00, 1.00, 1.00, 0.80, 0.00, 10.00, 1.00, 11.00}), // expected_selected_scores + Tensor(ET_IND, {4, 1}, std::vector{3, 0, 0, 3}), // expected_selected_indices + Tensor(ET_IND, {1}, std::vector{4}), // expected_valid_outputs + "multiclass_nms_output_type_i32"), + MulticlassNmsParams( + 3, // nms_top_k + 0.5f, // iou_threshold + 0.0f, // score_threshold + op::v8::MulticlassNms::SortResultType::SCORE, // sort_result_type + -1, // keep_top_k + -1, // background_class + 1.0f, // nms_eta + ET_IND, // output_type + false, // sort_result_across_batch + true, // normalized + Tensor(ET, {2, 6, 4}, std::vector{ + 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, + 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0, + 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, + 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0}), // boxes + Tensor(ET_TH, {2, 2, 6}, std::vector{ + 0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3, + 0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3}), // scores + Tensor(ET_TH, {8, 6}, std::vector{ + 0.00, 0.95, 0.00, 10.00, 1.00, 11.00, 1.00, 0.95, 0.00, 0.00, 1.00, 1.00, + 0.00, 0.90, 0.00, 0.00, 1.00, 1.00, 1.00, 0.80, 0.00, 10.00, 1.00, 11.00, + 0.00, 0.95, 0.00, 10.00, 1.00, 11.00, 1.00, 0.95, 0.00, 0.00, 1.00, 1.00, + 0.00, 0.90, 0.00, 0.00, 1.00, 1.00, 1.00, 0.80, 0.00, 10.00, 1.00, 11.00}), + // expected_selected_scores + Tensor(ET_IND, {8, 1}, std::vector{3, 0, 0, 3, 9, 6, 6, 9}), // expected_selected_indices + Tensor(ET_IND, {2}, std::vector{4, 4}), // expected_valid_outputs + "multiclass_nms_two_batches_two_classes_by_score"), + MulticlassNmsParams( + 3, // nms_top_k + 0.5f, // iou_threshold + 0.0f, // score_threshold + op::v8::MulticlassNms::SortResultType::CLASSID, // sort_result_type + -1, // keep_top_k + -1, // background_class + 1.0f, // nms_eta + ET_IND, // output_type + false, // sort_result_across_batch + true, // normalized + Tensor(ET, {2, 6, 4}, std::vector{ + 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, + 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0, + 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, + 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0}), // boxes + Tensor(ET_TH, {2, 2, 6}, std::vector{ + 0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3, + 0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3}), // scores + Tensor(ET_TH, {8, 6}, std::vector{ + 0.00, 0.95, 0.00, 10.00, 1.00, 11.00, 0.00, 0.90, 0.00, 0.00, 1.00, 1.00, + 1.00, 0.95, 0.00, 0.00, 1.00, 1.00, 1.00, 0.80, 0.00, 10.00, 1.00, 11.00, + 0.00, 0.95, 0.00, 10.00, 1.00, 11.00, 0.00, 0.90, 0.00, 0.00, 1.00, 1.00, + 1.00, 0.95, 0.00, 0.00, 1.00, 1.00, 1.00, 0.80, 0.00, 10.00, 1.00, 11.00}), + // expected_selected_scores + Tensor(ET_IND, {8, 1}, std::vector{3, 0, 0, 3, 9, 6, 6, 9}), // expected_selected_indices + Tensor(ET_IND, {2}, std::vector{4, 4}), // expected_valid_outputs + "multiclass_nms_two_batches_two_classes_by_class_id"), + MulticlassNmsParams( + 3, // nms_top_k + 0.5f, // iou_threshold + 0.0f, // score_threshold + op::v8::MulticlassNms::SortResultType::SCORE, // sort_result_type + -1, // keep_top_k + -1, // background_class + 1.0f, // nms_eta + ET_IND, // output_type + true, // sort_result_across_batch + true, // normalized + Tensor(ET, {2, 6, 4}, std::vector{ + 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, + 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0, + 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, + 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0}), // boxes + Tensor(ET_TH, {2, 2, 6}, std::vector{ + 0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3, + 0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3}), // scores + Tensor(ET_TH, {8, 6}, std::vector{ + 0.00, 0.95, 0.00, 10.00, 1.00, 11.00, + 1.00, 0.95, 0.00, 0.00, 1.00, 1.00, + 0.00, 0.95, 0.00, 10.00, 1.00, 11.00, + 1.00, 0.95, 0.00, 0.00, 1.00, 1.00, + 0.00, 0.90, 0.00, 0.00, 1.00, 1.00, + 0.00, 0.90, 0.00, 0.00, 1.00, 1.00, + 1.00, 0.80, 0.00, 10.00, 1.00, 11.00, + 1.00, 0.80, 0.00, 10.00, 1.00, 11.00}), // expected_selected_scores + Tensor(ET_IND, {8, 1}, std::vector{3, 0, 9, 6, 0, 6, 3, 9}), // expected_selected_indices + Tensor(ET_IND, {2}, std::vector{4, 4}), // expected_valid_outputs + "multiclass_nms_two_batches_two_classes_by_score_cross_batch"), + MulticlassNmsParams( + 3, // nms_top_k + 0.5f, // iou_threshold + 0.0f, // score_threshold + op::v8::MulticlassNms::SortResultType::CLASSID, // sort_result_type + -1, // keep_top_k + -1, // background_class + 1.0f, // nms_eta + ET_IND, // output_type + true, // sort_result_across_batch + true, // normalized + Tensor(ET, {2, 6, 4}, std::vector{ + 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, + 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0, + 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, + 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0}), // boxes + Tensor(ET_TH, {2, 2, 6}, std::vector{ + 0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3, + 0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3}), // scores + Tensor(ET_TH, {8, 6}, std::vector{ + 0.00, 0.95, 0.00, 10.00, 1.00, 11.00, + 0.00, 0.90, 0.00, 0.00, 1.00, 1.00, + 0.00, 0.95, 0.00, 10.00, 1.00, 11.00, + 0.00, 0.90, 0.00, 0.00, 1.00, 1.00, + 1.00, 0.95, 0.00, 0.00, 1.00, 1.00, + 1.00, 0.80, 0.00, 10.00, 1.00, 11.00, + 1.00, 0.95, 0.00, 0.00, 1.00, 1.00, + 1.00, 0.80, 0.00, 10.00, 1.00, 11.00}), // expected_selected_scores + Tensor(ET_IND, {8, 1}, std::vector{3, 0, 9, 6, 0, 3, 6, 9}), // expected_selected_indices + Tensor(ET_IND, {2}, std::vector{4, 4}), // expected_valid_outputs + "multiclass_nms_two_batches_two_classes_by_class_id_cross_batch"), + MulticlassNmsParams( + 3, // nms_top_k + 0.5f, // iou_threshold + 0.0f, // score_threshold + op::v8::MulticlassNms::SortResultType::SCORE, // sort_result_type + -1, // keep_top_k + -1, // background_class + 1.0f, // nms_eta + ET_IND, // output_type + false, // sort_result_across_batch + true, // normalized + Tensor(ET, {1, 6, 4}, std::vector{ + 1.0, 1.0, 0.0, 0.0, 0.0, 0.1, 1.0, 1.1, 0.0, 0.9, 1.0, -0.1, + 0.0, 10.0, 1.0, 11.0, 1.0, 10.1, 0.0, 11.1, 1.0, 101.0, 0.0, 100.0}), // boxes + Tensor(ET_TH, {1, 1, 6}, std::vector{ + 0.9, 0.75, 0.6, 0.95, 0.5, 0.3}), // scores + Tensor(ET_TH, {3, 6}, std::vector{ + 0.00, 0.95, 0.00, 10.00, 1.00, 11.00, 0.00, 0.90, 1.00, 1.00, 0.00, 0.00, 0.00, 0.75, 0.00, 0.10, 1.00, 1.10}), + // expected_selected_scores + Tensor(ET_IND, {3, 1}, std::vector{3, 0, 1}), // expected_selected_indices + Tensor(ET_IND, {1}, std::vector{3}), // expected_valid_outputs + "multiclass_nms_flipped_coordinates"), + MulticlassNmsParams( + 3, // nms_top_k + 0.5f, // iou_threshold + 0.0f, // score_threshold + op::v8::MulticlassNms::SortResultType::SCORE, // sort_result_type + -1, // keep_top_k + -1, // background_class + 1.0f, // nms_eta + ET_IND, // output_type + false, // sort_result_across_batch + true, // normalized + Tensor(ET, {1, 10, 4}, std::vector{ + 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, + 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, + 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0}), // boxes + Tensor(ET_TH, {1, 1, 10}, std::vector{ + 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9}), // scores + Tensor(ET_TH, {1, 6}, std::vector{ + 0.00, 0.90, 0.00, 0.00, 1.00, 1.00}), + // expected_selected_scores + Tensor(ET_IND, {1, 1}, std::vector{0}), // expected_selected_indices + Tensor(ET_IND, {1}, std::vector{1}), // expected_valid_outputs + "multiclass_nms_identical_boxes"), + MulticlassNmsParams( + 2, // nms_top_k + 0.5f, // iou_threshold + 0.0f, // score_threshold + op::v8::MulticlassNms::SortResultType::SCORE, // sort_result_type + -1, // keep_top_k + -1, // background_class + 1.0f, // nms_eta + ET_IND, // output_type + false, // sort_result_across_batch + true, // normalized + Tensor(ET, {1, 6, 4}, std::vector{ + 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, + 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0}), // boxes + Tensor(ET_TH, {1, 1, 6}, std::vector{ + 0.9, 0.75, 0.6, 0.95, 0.5, 0.3}), // scores + Tensor(ET_TH, {2, 6}, std::vector{ + 0.00, 0.95, 0.00, 10.00, 1.00, 11.00, 0.00, 0.90, 0.00, 0.00, 1.00, 1.00}), + // expected_selected_scores + Tensor(ET_IND, {2, 1}, std::vector{3, 0}), // expected_selected_indices + Tensor(ET_IND, {1}, std::vector{2}), // expected_valid_outputs + "multiclass_nms_limit_output_size"), + MulticlassNmsParams( + 3, // nms_top_k + 0.5f, // iou_threshold + 0.0f, // score_threshold + op::v8::MulticlassNms::SortResultType::SCORE, // sort_result_type + -1, // keep_top_k + -1, // background_class + 1.0f, // nms_eta + ET_IND, // output_type + false, // sort_result_across_batch + true, // normalized + Tensor(ET, {1, 1, 4}, std::vector{0.0, 0.0, 1.0, 1.0}), // boxes + Tensor(ET_TH, {1, 1, 1}, std::vector{0.9}), // scores + Tensor(ET_TH, {1, 6}, std::vector{ + 0.00, 0.90, 0.00, 0.00, 1.00, 1.00}), // expected_selected_scores + Tensor(ET_IND, {1, 1}, std::vector{0}), // expected_selected_indices + Tensor(ET_IND, {1}, std::vector{1}), // expected_valid_outputs + "multiclass_nms_single_box"), + MulticlassNmsParams( + 3, // nms_top_k + 0.2f, // iou_threshold + 0.0f, // score_threshold + op::v8::MulticlassNms::SortResultType::SCORE, // sort_result_type + -1, // keep_top_k + -1, // background_class + 1.0f, // nms_eta + ET_IND, // output_type + false, // sort_result_across_batch + true, // normalized + Tensor(ET, {1, 6, 4}, std::vector{ + 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, + 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0}), // boxes + Tensor(ET_TH, {1, 1, 6}, std::vector{ + 0.9, 0.75, 0.6, 0.95, 0.5, 0.3}), // scores + Tensor(ET_TH, {2, 6}, std::vector{ + 0.00, 0.95, 0.00, 10.00, 1.00, 11.00, 0.00, 0.90, 0.00, 0.00, 1.00, 1.00}), + // expected_selected_scores + Tensor(ET_IND, {2, 1}, std::vector{3, 0}), // expected_selected_indices + Tensor(ET_IND, {1}, std::vector{2}), // expected_valid_outputs + "multiclass_nms_by_IOU"), + MulticlassNmsParams( + 3, // nms_top_k + 0.5f, // iou_threshold + 0.95f, // score_threshold + op::v8::MulticlassNms::SortResultType::SCORE, // sort_result_type + -1, // keep_top_k + -1, // background_class + 1.0f, // nms_eta + ET_IND, // output_type + false, // sort_result_across_batch + true, // normalized + Tensor(ET, {1, 6, 4}, std::vector{ + 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, + 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0}), // boxes + Tensor(ET_TH, {1, 1, 6}, std::vector{ + 0.9, 0.75, 0.6, 0.95, 0.5, 0.3}), // scores + Tensor(ET_TH, {1, 6}, std::vector{ + 0.00, 0.95, 0.00, 10.00, 1.00, 11.00}), // expected_selected_scores + Tensor(ET_IND, {1, 1}, std::vector{3}), // expected_selected_indices + Tensor(ET_IND, {1}, std::vector{1}), // expected_valid_outputs + "multiclass_nms_by_IOU_and_scores"), + MulticlassNmsParams( + 3, // nms_top_k + 0.5f, // iou_threshold + 2.0f, // score_threshold + op::v8::MulticlassNms::SortResultType::SCORE, // sort_result_type + -1, // keep_top_k + -1, // background_class + 1.0f, // nms_eta + ET_IND, // output_type + false, // sort_result_across_batch + true, // normalized + Tensor(ET, {1, 6, 4}, std::vector{ + 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, + 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0}), // boxes + Tensor(ET_TH, {1, 1, 6}, std::vector{ + 0.9, 0.75, 0.6, 0.95, 0.5, 0.3}), // scores + Tensor(ET_TH, {0, 6}, std::vector{}), // expected_selected_scores + Tensor(ET_IND, {0, 1}, std::vector{}), // expected_selected_indices + Tensor(ET_IND, {1}, std::vector{0}), // expected_valid_outputs + "multiclass_nms_no_output"), + MulticlassNmsParams( + 3, // nms_top_k + 0.5f, // iou_threshold + 0.0f, // score_threshold + op::v8::MulticlassNms::SortResultType::CLASSID, // sort_result_type + -1, // keep_top_k + 0, // background_class + 1.0f, // nms_eta + ET_IND, // output_type + false, // sort_result_across_batch + true, // normalized + Tensor(ET, {2, 6, 4}, std::vector{ + 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, + 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0, + 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, + 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0}), // boxes + Tensor(ET_TH, {2, 2, 6}, std::vector{ + 0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3, + 0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3}), // scores + Tensor(ET_TH, {4, 6}, std::vector{ + 1.00, 0.95, 0.00, 0.00, 1.00, 1.00, 1.00, 0.80, 0.00, 10.00, 1.00, 11.00, + 1.00, 0.95, 0.00, 0.00, 1.00, 1.00, 1.00, 0.80, 0.00, 10.00, 1.00, 11.00}), + // expected_selected_scores + Tensor(ET_IND, {4, 1}, std::vector{0, 3, 6, 9}), // expected_selected_indices + Tensor(ET_IND, {2}, std::vector{2, 2}), // expected_valid_outputs + "multiclass_nms_by_background"), + MulticlassNmsParams( + 3, // nms_top_k + 0.5f, // iou_threshold + 0.0f, // score_threshold + op::v8::MulticlassNms::SortResultType::CLASSID, // sort_result_type + 3, // keep_top_k + -1, // background_class + 1.0f, // nms_eta + ET_IND, // output_type + false, // sort_result_across_batch + true, // normalized + Tensor(ET, {2, 6, 4}, std::vector{ + 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, + 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0, + 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, + 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0}), // boxes + Tensor(ET_TH, {2, 2, 6}, std::vector{ + 0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3, + 0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3}), // scores + Tensor(ET_TH, {6, 6}, std::vector{ + 0.00, 0.95, 0.00, 10.00, 1.00, 11.00, 0.00, 0.90, 0.00, + 0.00, 1.00, 1.00, 1.00, 0.95, 0.00, 0.00, 1.00, 1.00, + 0.00, 0.95, 0.00, 10.00, 1.00, 11.00, 0.00, 0.90, 0.00, + 0.00, 1.00, 1.00, 1.00, 0.95, 0.00, 0.00, 1.00, 1.00}), // expected_selected_scores + Tensor(ET_IND, {6, 1}, std::vector{3, 0, 0, 9, 6, 6}), // expected_selected_indices + Tensor(ET_IND, {2}, std::vector{3, 3}), // expected_valid_outputs + "multiclass_nms_by_keep_top_k"), + MulticlassNmsParams( + -1, // nms_top_k + 1.0f, // iou_threshold + 0.0f, // score_threshold + op::v8::MulticlassNms::SortResultType::CLASSID, // sort_result_type + -1, // keep_top_k + -1, // background_class + 0.1f, // nms_eta + ET_IND, // output_type + false, // sort_result_across_batch + true, // normalized + Tensor(ET, {2, 6, 4}, std::vector{ + 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, + 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0, + 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, + 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0}), // boxes + Tensor(ET_TH, {2, 2, 6}, std::vector{ + 0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3, + 0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3}), // scores + Tensor(ET_TH, {12, 6}, std::vector{ + 0.00, 0.95, 0.00, 10.00, 1.00, 11.00, 0.00, 0.90, 0.00, 0.00, 1.00, 1.00, 0.00, 0.30, 0.00, + 100.00, 1.00, 101.00, 1.00, 0.95, 0.00, 0.00, 1.00, 1.00, 1.00, 0.80, 0.00, 10.00, 1.00, 11.00, + 1.00, 0.30, 0.00, 100.00, 1.00, 101.00, 0.00, 0.95, 0.00, 10.00, 1.00, 11.00, 0.00, 0.90, 0.00, + 0.00, 1.00, 1.00, 0.00, 0.30, 0.00, 100.00, 1.00, 101.00, 1.00, 0.95, 0.00, 0.00, 1.00, 1.00, + 1.00, 0.80, 0.00, 10.00, 1.00, 11.00, 1.00, 0.30, 0.00, 100.00, 1.00, 101.00}), + // expected_selected_scores + Tensor(ET_IND, {12, 1}, std::vector{ + 3, 0, 5, 0, 3, 5, 9, 6, 11, 6, 9, 11}), // expected_selected_indices + Tensor(ET_IND, {2}, std::vector{6, 6}), // expected_valid_outputs + "multiclass_nms_by_nms_eta"), + }; + return params; +} + +std::vector generateCombinedParams() { + const std::vector> generatedParams { + generateParams(), + generateParams(), + generateParams(), + generateParams(), + generateParams(), + generateParams(), + }; + std::vector combinedParams; + + for (const auto& params : generatedParams) { + combinedParams.insert(combinedParams.end(), params.begin(), params.end()); + } + return combinedParams; +} + +INSTANTIATE_TEST_SUITE_P(smoke_MulticlassNms_With_Hardcoded_Refs, ReferenceMulticlassNmsTest, + testing::ValuesIn(generateCombinedParams()), ReferenceMulticlassNmsTest::getTestCaseName); +} // namespace \ No newline at end of file diff --git a/docs/template_plugin/tests/functional/op_reference/non_max_suppression.cpp b/docs/template_plugin/tests/functional/op_reference/non_max_suppression.cpp new file mode 100644 index 00000000000..0e0b7a5e0fa --- /dev/null +++ b/docs/template_plugin/tests/functional/op_reference/non_max_suppression.cpp @@ -0,0 +1,489 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include + +#include "openvino/op/non_max_suppression.hpp" +#include "openvino/op/constant.hpp" +#include "base_reference_test.hpp" + +using namespace reference_tests; +using namespace ov; + +namespace { +struct NonMaxSuppressionParams { + NonMaxSuppressionParams( + const Tensor& boxes, const Tensor& scores, + const Tensor& maxOutputBoxesPerClass, const Tensor& iouThreshold, const Tensor& scoreThreshold, + const Tensor& softNmsSigma, const op::v5::NonMaxSuppression::BoxEncodingType boxEncoding, + const Tensor& expectedSelectedIndices, const Tensor& expectedSelectedScores, + const Tensor& expectedValidOutputs, const std::string& testcaseName = "") : + boxes(boxes), scores(scores), + maxOutputBoxesPerClass(maxOutputBoxesPerClass), iouThreshold(iouThreshold), scoreThreshold(scoreThreshold), + softNmsSigma(softNmsSigma), boxEncoding(boxEncoding), + expectedSelectedIndices(expectedSelectedIndices), expectedSelectedScores(expectedSelectedScores), + expectedValidOutputs(expectedValidOutputs), testcaseName(testcaseName) {} + + Tensor boxes; + Tensor scores; + Tensor maxOutputBoxesPerClass; + Tensor iouThreshold; + Tensor scoreThreshold; + Tensor softNmsSigma; + op::v5::NonMaxSuppression::BoxEncodingType boxEncoding; + Tensor expectedSelectedIndices; + Tensor expectedSelectedScores; + Tensor expectedValidOutputs; + std::string testcaseName; +}; + +class ReferenceNonMaxSuppressionTest : public testing::TestWithParam, public CommonReferenceTest { +public: + void SetUp() override { + auto params = GetParam(); + function = CreateFunction(params); + inputData = {params.boxes.data, params.scores.data}; + refOutData = {params.expectedSelectedIndices.data, + params.expectedSelectedScores.data, + params.expectedValidOutputs.data}; + } + + static std::string getTestCaseName(const testing::TestParamInfo& obj) { + auto param = obj.param; + std::ostringstream result; + result << "bType=" << param.boxes.type; + result << "_bShape=" << param.boxes.shape; + result << "_sType=" << param.scores.type; + result << "_sShape=" << param.scores.shape; + result << "_escType=" << param.expectedSelectedScores.type; + result << "_escShape=" << param.expectedSelectedScores.shape; + result << "_esiType=" << param.expectedSelectedIndices.type; + result << "_esiShape=" << param.expectedSelectedIndices.shape; + result << "_evoType=" << param.expectedValidOutputs.type; + if (param.testcaseName != "") { + result << "_evoShape=" << param.expectedValidOutputs.shape; + result << "_=" << param.testcaseName; + } else { + result << "_evoShape=" << param.expectedValidOutputs.shape; + } + return result.str(); + } + +private: + static std::shared_ptr CreateFunction(const NonMaxSuppressionParams& params) { + const auto boxes = std::make_shared(params.boxes.type, params.boxes.shape); + const auto scores = std::make_shared(params.scores.type, params.scores.shape); + const auto max_output_boxes_per_class = std::make_shared( + params.maxOutputBoxesPerClass.type, params.maxOutputBoxesPerClass.shape, params.maxOutputBoxesPerClass.data.data()); + const auto iou_threshold = std::make_shared( + params.iouThreshold.type, params.iouThreshold.shape, params.iouThreshold.data.data()); + const auto score_threshold = std::make_shared( + params.scoreThreshold.type, params.scoreThreshold.shape, params.scoreThreshold.data.data()); + const auto soft_nms_sigma = std::make_shared( + params.softNmsSigma.type, params.softNmsSigma.shape, params.softNmsSigma.data.data()); + const auto nms = std::make_shared(boxes, + scores, + max_output_boxes_per_class, + iou_threshold, + score_threshold, + soft_nms_sigma, + params.boxEncoding, + false); + const auto f = std::make_shared(nms->outputs(), ParameterVector{boxes, scores}); + return f; + } +}; + +class ReferenceNonMaxSuppressionTestWithoutConstants : public ReferenceNonMaxSuppressionTest { +public: + void SetUp() override { + auto params = GetParam(); + function = CreateFunction(params); + inputData = {params.boxes.data, params.scores.data, params.maxOutputBoxesPerClass.data, + params.iouThreshold.data, params.scoreThreshold.data, params.softNmsSigma.data}; + refOutData = {params.expectedSelectedIndices.data, + params.expectedSelectedScores.data, + params.expectedValidOutputs.data}; + } + + static std::string getTestCaseName(const testing::TestParamInfo& obj) { + auto param = obj.param; + std::ostringstream result; + result << "bType=" << param.boxes.type; + result << "_bShape=" << param.boxes.shape; + result << "_sType=" << param.scores.type; + result << "_sShape=" << param.scores.shape; + result << "_escType=" << param.expectedSelectedScores.type; + result << "_escShape=" << param.expectedSelectedScores.shape; + result << "_esiType=" << param.expectedSelectedIndices.type; + result << "_esiShape=" << param.expectedSelectedIndices.shape; + result << "_evoType=" << param.expectedValidOutputs.type; + if (param.testcaseName != "") { + result << "_evoShape=" << param.expectedValidOutputs.shape; + result << "_=" << param.testcaseName; + } else { + result << "_evoShape=" << param.expectedValidOutputs.shape; + } + return result.str(); + } + +private: + static std::shared_ptr CreateFunction(const NonMaxSuppressionParams& params) { + const auto boxes = std::make_shared(params.boxes.type, params.boxes.shape); + const auto scores = std::make_shared(params.scores.type, params.scores.shape); + const auto max_output_boxes_per_class = std::make_shared( + params.maxOutputBoxesPerClass.type, params.maxOutputBoxesPerClass.shape); + const auto iou_threshold = std::make_shared( + params.iouThreshold.type, params.iouThreshold.shape); + const auto score_threshold = std::make_shared( + params.scoreThreshold.type, params.scoreThreshold.shape); + const auto soft_nms_sigma = std::make_shared( + params.softNmsSigma.type, params.softNmsSigma.shape); + const auto nms = std::make_shared(boxes, + scores, + max_output_boxes_per_class, + iou_threshold, + score_threshold, + soft_nms_sigma, + params.boxEncoding, + false); + const auto f = std::make_shared(nms->outputs(), + ParameterVector{boxes, scores, max_output_boxes_per_class, + iou_threshold, score_threshold, soft_nms_sigma}); + return f; + } +}; + +TEST_P(ReferenceNonMaxSuppressionTest, CompareWithRefs) { + Exec(); +} + +TEST_P(ReferenceNonMaxSuppressionTestWithoutConstants, CompareWithRefs) { + Exec(); +} + +template +std::vector generateParams() { + using T = typename element_type_traits::value_type; + using T_BOX = typename element_type_traits::value_type; + using T_TH = typename element_type_traits::value_type; + using T_IND = typename element_type_traits::value_type; + std::vector params { + NonMaxSuppressionParams( + // boxes + Tensor(ET, {1, 6, 4}, std::vector{ + 0.5, 0.5, 1.0, 1.0, 0.5, 0.6, 1.0, 1.0, 0.5, 0.4, 1.0, 1.0, + 0.5, 10.5, 1.0, 1.0, 0.5, 10.6, 1.0, 1.0, 0.5, 100.5, 1.0, 1.0}), + // scores + Tensor(ET, {1, 1, 6}, std::vector{ + 0.9, 0.75, 0.6, 0.95, 0.5, 0.3}), + // max_output_boxes_per_class + Tensor(ET_BOX, {}, std::vector{3}), + // iou_threshold + Tensor(ET_TH, {}, std::vector{0.5f}), + // score_threshold + Tensor(ET_TH, {}, std::vector{0.0f}), + // soft_nms_sigma + Tensor(ET_TH, {}, std::vector{0.0f}), + // box_encoding + op::v5::NonMaxSuppression::BoxEncodingType::CENTER, + // selected_indices + Tensor(ET_IND, {3, 3}, std::vector{ + 0, 0, 3, 0, 0, 0, 0, 0, 5}), + // selected_scores + Tensor(ET_TH, {3, 3}, std::vector{ + 0.0, 0.0, 0.95, 0.0, 0.0, 0.9, 0.0, 0.0, 0.3}), + // valid_outputs + Tensor(ET_IND, {1}, std::vector{3}), + "nonmaxsuppression_center_point_box_format"), + NonMaxSuppressionParams( + // boxes + Tensor(ET, {1, 6, 4}, std::vector{ + 1.0, 1.0, 0.0, 0.0, 0.0, 0.1, 1.0, 1.1, 0.0, 0.9, 1.0, -0.1, + 0.0, 10.0, 1.0, 11.0, 1.0, 10.1, 0.0, 11.1, 1.0, 101.0, 0.0, 100.0}), + // scores + Tensor(ET, {1, 1, 6}, std::vector{ + 0.9, 0.75, 0.6, 0.95, 0.5, 0.3}), + // max_output_boxes_per_class + Tensor(ET_BOX, {}, std::vector{3}), + // iou_threshold + Tensor(ET_TH, {}, std::vector{0.5f}), + // score_threshold + Tensor(ET_TH, {}, std::vector{0.0f}), + // soft_nms_sigma + Tensor(ET_TH, {}, std::vector{0.0f}), + // box_encoding + op::v5::NonMaxSuppression::BoxEncodingType::CORNER, + // selected_indices + Tensor(ET_IND, {3, 3}, std::vector{ + 0, 0, 3, 0, 0, 0, 0, 0, 5}), + // selected_scores + Tensor(ET_TH, {3, 3}, std::vector{ + 0.0, 0.0, 0.95, 0.0, 0.0, 0.9, 0.0, 0.0, 0.3}), + // valid_outputs + Tensor(ET_IND, {1}, std::vector{3}), + "nonmaxsuppression_flipped_coordinates"), + NonMaxSuppressionParams( + // boxes + Tensor(ET, {1, 10, 4}, std::vector{ + 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, + 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, + 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0}), + // scores + Tensor(ET, {1, 1, 10}, std::vector{ + 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9}), + // max_output_boxes_per_class + Tensor(ET_BOX, {}, std::vector{3}), + // iou_threshold + Tensor(ET_TH, {}, std::vector{0.5f}), + // score_threshold + Tensor(ET_TH, {}, std::vector{0.0f}), + // soft_nms_sigma + Tensor(ET_TH, {}, std::vector{0.0f}), + // box_encoding + op::v5::NonMaxSuppression::BoxEncodingType::CORNER, + // selected_indices + Tensor(ET_IND, {1, 3}, std::vector{0, 0, 0}), + // selected_scores + Tensor(ET_TH, {1, 3}, std::vector{0.0, 0.0, 0.9}), + // valid_outputs + Tensor(ET_IND, {1}, std::vector{1}), + "nonmaxsuppression_identical_boxes"), + NonMaxSuppressionParams( + // boxes + Tensor(ET, {1, 6, 4}, std::vector{ + 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, + 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0}), + // scores + Tensor(ET, {1, 1, 6}, std::vector{ + 0.9, 0.75, 0.6, 0.95, 0.5, 0.3}), + // max_output_boxes_per_class + Tensor(ET_BOX, {}, std::vector{2}), + // iou_threshold + Tensor(ET_TH, {}, std::vector{0.5f}), + // score_threshold + Tensor(ET_TH, {}, std::vector{0.0f}), + // soft_nms_sigma + Tensor(ET_TH, {}, std::vector{0.0f}), + // box_encoding + op::v5::NonMaxSuppression::BoxEncodingType::CORNER, + // selected_indices + Tensor(ET_IND, {2, 3}, std::vector{0, 0, 3, 0, 0, 0}), + // selected_scores + Tensor(ET_TH, {2, 3}, std::vector{ + 0.0, 0.0, 0.95, 0.0, 0.0, 0.9}), + // valid_outputs + Tensor(ET_IND, {1}, std::vector{2}), + "nonmaxsuppression_limit_output_size"), + NonMaxSuppressionParams( + // boxes + Tensor(ET, {1, 1, 4}, std::vector{0.0, 0.0, 1.0, 1.0}), + // scores + Tensor(ET, {1, 1, 1}, std::vector{0.9}), + // max_output_boxes_per_class + Tensor(ET_BOX, {}, std::vector{3}), + // iou_threshold + Tensor(ET_TH, {}, std::vector{0.5f}), + // score_threshold + Tensor(ET_TH, {}, std::vector{0.0f}), + // soft_nms_sigma + Tensor(ET_TH, {}, std::vector{0.0f}), + // box_encoding + op::v5::NonMaxSuppression::BoxEncodingType::CORNER, + // selected_indices + Tensor(ET_IND, {1, 3}, std::vector{0, 0, 0}), + // selected_scores + Tensor(ET_TH, {1, 3}, std::vector{0.0, 0.0, 0.9}), + // valid_outputs + Tensor(ET_IND, {1}, std::vector{1}), + "nonmaxsuppression_single_box"), + NonMaxSuppressionParams( + // boxes + Tensor(ET, {1, 6, 4}, std::vector{ + 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, + 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0}), + // scores + Tensor(ET, {1, 1, 6}, std::vector{ + 0.9, 0.75, 0.6, 0.95, 0.5, 0.3}), + // max_output_boxes_per_class + Tensor(ET_BOX, {}, std::vector{3}), + // iou_threshold + Tensor(ET_TH, {}, std::vector{0.5f}), + // score_threshold + Tensor(ET_TH, {}, std::vector{0.0f}), + // soft_nms_sigma + Tensor(ET_TH, {}, std::vector{0.0f}), + // box_encoding + op::v5::NonMaxSuppression::BoxEncodingType::CORNER, + // selected_indices + Tensor(ET_IND, {3, 3}, std::vector{ + 0, 0, 3, 0, 0, 0, 0, 0, 5}), + // selected_scores + Tensor(ET_TH, {3, 3}, std::vector{ + 0.0, 0.0, 0.95, 0.0, 0.0, 0.9, 0.0, 0.0, 0.3}), + // valid_outputs + Tensor(ET_IND, {1}, std::vector{3}), + "nonmaxsuppression_suppress_by_IOU"), + NonMaxSuppressionParams( + // boxes + Tensor(ET, {1, 6, 4}, std::vector{ + 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, + 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0}), + // scores + Tensor(ET, {1, 1, 6}, std::vector{ + 0.9, 0.75, 0.6, 0.95, 0.5, 0.3}), + // max_output_boxes_per_class + Tensor(ET_BOX, {}, std::vector{3}), + // iou_threshold + Tensor(ET_TH, {}, std::vector{0.5f}), + // score_threshold + Tensor(ET_TH, {}, std::vector{0.4f}), + // soft_nms_sigma + Tensor(ET_TH, {}, std::vector{0.0f}), + // box_encoding + op::v5::NonMaxSuppression::BoxEncodingType::CORNER, + // selected_indices + Tensor(ET_IND, {2, 3}, std::vector{ + 0, 0, 3, 0, 0, 0}), + // selected_scores + Tensor(ET_TH, {2, 3}, std::vector{ + 0.0, 0.0, 0.95, 0.0, 0.0, 0.9}), + // valid_outputs + Tensor(ET_IND, {1}, std::vector{2}), + "nonmaxsuppression_suppress_by_IOU_and_scores"), + NonMaxSuppressionParams( + // boxes + Tensor(ET, {2, 6, 4}, std::vector{ + 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, + 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0, + 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, + 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0}), + // scores + Tensor(ET, {2, 1, 6}, std::vector{ + 0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.9, 0.75, 0.6, 0.95, 0.5, 0.3}), + // max_output_boxes_per_class + Tensor(ET_BOX, {}, std::vector{2}), + // iou_threshold + Tensor(ET_TH, {}, std::vector{0.5f}), + // score_threshold + Tensor(ET_TH, {}, std::vector{0.0f}), + // soft_nms_sigma + Tensor(ET_TH, {}, std::vector{0.0f}), + // box_encoding + op::v5::NonMaxSuppression::BoxEncodingType::CORNER, + // selected_indices + Tensor(ET_IND, {4, 3}, std::vector{ + 0, 0, 3, 0, 0, 0, 1, 0, 3, 1, 0, 0}), + // selected_scores + Tensor(ET_TH, {4, 3}, std::vector{ + 0.0, 0.0, 0.95, 0.0, 0.0, 0.9, 1.0, 0.0, 0.95, 1.0, 0.0, 0.9}), + // valid_outputs + Tensor(ET_IND, {1}, std::vector{4}), + "nonmaxsuppression_two_batches"), + NonMaxSuppressionParams( + // boxes + Tensor(ET, {1, 6, 4}, std::vector{ + 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, + 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0}), + // scores + Tensor(ET, {1, 2, 6}, std::vector{ + 0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.9, 0.75, 0.6, 0.95, 0.5, 0.3}), + // max_output_boxes_per_class + Tensor(ET_BOX, {}, std::vector{2}), + // iou_threshold + Tensor(ET_TH, {}, std::vector{0.5f}), + // score_threshold + Tensor(ET_TH, {}, std::vector{0.0f}), + // soft_nms_sigma + Tensor(ET_TH, {}, std::vector{0.0f}), + // box_encoding + op::v5::NonMaxSuppression::BoxEncodingType::CORNER, + // selected_indices + Tensor(ET_IND, {4, 3}, std::vector{ + 0, 0, 3, 0, 0, 0, 0, 1, 3, 0, 1, 0}), + // selected_scores + Tensor(ET_TH, {4, 3}, std::vector{ + 0.0, 0.0, 0.95, 0.0, 0.0, 0.9, 0.0, 1.0, 0.95, 0.0, 1.0, 0.9}), + // valid_outputs + Tensor(ET_IND, {1}, std::vector{4}), + "nonmaxsuppression_two_classes"), + }; + return params; +} + +std::vector generateCombinedParams() { + const std::vector> generatedParams { + generateParams(), + generateParams(), + generateParams(), + generateParams(), + generateParams(), + generateParams(), + }; + std::vector combinedParams; + + for (const auto& params : generatedParams) { + combinedParams.insert(combinedParams.end(), params.begin(), params.end()); + } + return combinedParams; +} + +template +std::vector generateParamsWithoutConstants() { + using T = typename element_type_traits::value_type; + using T_BOX = typename element_type_traits::value_type; + using T_TH = typename element_type_traits::value_type; + using T_IND = typename element_type_traits::value_type; + std::vector params { + NonMaxSuppressionParams( + // boxes + Tensor(ET, {1, 6, 4}, std::vector{ + 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.1f, 1.0f, 1.1f, 0.0f, -0.1f, 1.0f, 0.9f, + 0.0f, 10.0f, 1.0f, 11.0f, 0.0f, 10.1f, 1.0f, 11.1f, 0.0f, 100.0f, 1.0f, 101.0f}), + // scores + Tensor(ET, {1, 1, 6}, std::vector{ + 0.9f, 0.75f, 0.6f, 0.95f, 0.5f, 0.3f}), + // max_output_boxes_per_class + Tensor(ET_BOX, {1}, std::vector{1}), + // iou_threshold + Tensor(ET_TH, {1}, std::vector{0.4f}), + // score_threshold + Tensor(ET_TH, {1}, std::vector{0.2f}), + // soft_nms_sigma + Tensor(ET_TH, {1}, std::vector{0.0f}), + // box_encoding + op::v5::NonMaxSuppression::BoxEncodingType::CORNER, + // selected_indices + Tensor(ET_IND, {1, 3}, std::vector{0, 0, 3}), + // selected_scores + Tensor(ET_TH, {1, 3}, std::vector{0.0f, 0.0f, 0.95f}), + // valid_outputs + Tensor(ET_IND, {1}, std::vector{1}), + "nonmaxsuppression_suppress_by_IOU_and_scores_without_constants"), + }; + return params; +} + +std::vector generateCombinedParamsWithoutConstants() { + const std::vector> generatedParams { + generateParamsWithoutConstants(), + generateParamsWithoutConstants(), + generateParamsWithoutConstants(), + generateParamsWithoutConstants(), + generateParamsWithoutConstants(), + generateParamsWithoutConstants(), + }; + std::vector combinedParams; + + for (const auto& params : generatedParams) { + combinedParams.insert(combinedParams.end(), params.begin(), params.end()); + } + return combinedParams; +} + +INSTANTIATE_TEST_SUITE_P(smoke_NonMaxSuppression_With_Hardcoded_Refs, ReferenceNonMaxSuppressionTest, + testing::ValuesIn(generateCombinedParams()), ReferenceNonMaxSuppressionTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_NonMaxSuppression_With_Hardcoded_Refs, ReferenceNonMaxSuppressionTestWithoutConstants, + testing::ValuesIn(generateCombinedParamsWithoutConstants()), ReferenceNonMaxSuppressionTest::getTestCaseName); +} // namespace \ No newline at end of file diff --git a/docs/template_plugin/tests/functional/op_reference/prior_box.cpp b/docs/template_plugin/tests/functional/op_reference/prior_box.cpp index e24ae7a72b0..b382373a1a9 100644 --- a/docs/template_plugin/tests/functional/op_reference/prior_box.cpp +++ b/docs/template_plugin/tests/functional/op_reference/prior_box.cpp @@ -2,11 +2,12 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "openvino/op/prior_box.hpp" + #include -#include "openvino/op/prior_box.hpp" #include "base_reference_test.hpp" -#include "openvino/opsets/opset1.hpp" +#include "openvino/op/constant.hpp" using namespace reference_tests; using namespace ov; @@ -17,9 +18,11 @@ struct PriorBoxParams { PriorBoxParams(const std::vector& min_size, const std::vector& aspect_ratio, const bool scale_all_size, - const ov::Shape& layerShapeShape, const ov::Shape& imageShapeShape, + const ov::Shape& layerShapeShape, + const ov::Shape& imageShapeShape, const ov::element::Type& iType, - const std::vector& layerShapeValues, const std::vector& imageShapeValues, + const std::vector& layerShapeValues, + const std::vector& imageShapeValues, const std::vector& oValues, const std::string& testcaseName = "") : layerShapeShape(layerShapeShape), @@ -30,10 +33,10 @@ struct PriorBoxParams { imageShapeData(CreateTensor(iType, imageShapeValues)), refData(CreateTensor(outType, oValues)), testcaseName(testcaseName) { - attrs.min_size = min_size; - attrs.aspect_ratio = aspect_ratio; - attrs.scale_all_sizes = scale_all_size; - } + attrs.min_size = min_size; + attrs.aspect_ratio = aspect_ratio; + attrs.scale_all_sizes = scale_all_size; + } ov::op::v0::PriorBox::Attributes attrs; ov::Shape layerShapeShape; @@ -46,6 +49,46 @@ struct PriorBoxParams { std::string testcaseName; }; +struct PriorBoxV8Params { + template + PriorBoxV8Params(const std::vector& min_size, + const std::vector& max_size, + const std::vector& aspect_ratio, + const bool scale_all_size, + const bool min_max_aspect_ratios_order, + const ov::Shape& layerShapeShape, + const ov::Shape& imageShapeShape, + const ov::element::Type& iType, + const std::vector& layerShapeValues, + const std::vector& imageShapeValues, + const std::vector& oValues, + const std::string& testcaseName = "") + : layerShapeShape(layerShapeShape), + imageShapeShape(imageShapeShape), + inType(iType), + outType(ov::element::Type_t::f32), + layerShapeData(CreateTensor(iType, layerShapeValues)), + imageShapeData(CreateTensor(iType, imageShapeValues)), + refData(CreateTensor(outType, oValues)), + testcaseName(testcaseName) { + attrs.min_size = min_size; + attrs.max_size = max_size; + attrs.aspect_ratio = aspect_ratio; + attrs.scale_all_sizes = scale_all_size; + attrs.min_max_aspect_ratios_order = min_max_aspect_ratios_order; + } + + ov::op::v8::PriorBox::Attributes attrs; + ov::Shape layerShapeShape; + ov::Shape imageShapeShape; + ov::element::Type inType; + ov::element::Type outType; + ov::runtime::Tensor layerShapeData; + ov::runtime::Tensor imageShapeData; + ov::runtime::Tensor refData; + std::string testcaseName; +}; + class ReferencePriorBoxLayerTest : public testing::TestWithParam, public CommonReferenceTest { public: void SetUp() override { @@ -68,10 +111,43 @@ public: private: static std::shared_ptr CreateFunction(const PriorBoxParams& params) { - auto LS = std::make_shared(params.inType, params.layerShapeShape, params.layerShapeData.data()); - auto IS = std::make_shared(params.inType, params.imageShapeShape, params.imageShapeData.data()); + auto LS = + std::make_shared(params.inType, params.layerShapeShape, params.layerShapeData.data()); + auto IS = + std::make_shared(params.inType, params.imageShapeShape, params.imageShapeData.data()); const auto PriorBox = std::make_shared(LS, IS, params.attrs); - return std::make_shared(NodeVector {PriorBox}, ParameterVector {}); + return std::make_shared(NodeVector{PriorBox}, ParameterVector{}); + } +}; + +class ReferencePriorBoxV8LayerTest : public testing::TestWithParam, public CommonReferenceTest { +public: + void SetUp() override { + auto params = GetParam(); + function = CreateFunction(params); + inputData = {}; + refOutData = {params.refData}; + } + static std::string getTestCaseName(const testing::TestParamInfo& obj) { + auto param = obj.param; + std::ostringstream result; + result << "layerShapeShape=" << param.layerShapeShape << "_"; + result << "imageShapeShape=" << param.imageShapeShape << "_"; + result << "iType=" << param.inType << "_"; + result << "oType=" << param.outType; + if (param.testcaseName != "") + result << "_" << param.testcaseName; + return result.str(); + } + +private: + static std::shared_ptr CreateFunction(const PriorBoxV8Params& params) { + auto LS = + std::make_shared(params.inType, params.layerShapeShape, params.layerShapeData.data()); + auto IS = + std::make_shared(params.inType, params.imageShapeShape, params.imageShapeData.data()); + const auto PriorBoxV8 = std::make_shared(LS, IS, params.attrs); + return std::make_shared(NodeVector{PriorBoxV8}, ParameterVector{}); } }; @@ -79,13 +155,20 @@ TEST_P(ReferencePriorBoxLayerTest, CompareWithRefs) { Exec(); } +TEST_P(ReferencePriorBoxV8LayerTest, CompareWithRefs) { + Exec(); +} + template std::vector generatePriorBoxFloatParams() { using T = typename element_type_traits::value_type; - std::vector priorBoxParams { - PriorBoxParams({2.0f}, {1.5f}, false, - {2}, {2}, + std::vector priorBoxParams{ + PriorBoxParams({2.0f}, + {1.5f}, + false, + {2}, + {2}, IN_ET, std::vector{2, 2}, std::vector{10, 10}, @@ -101,8 +184,37 @@ std::vector generatePriorBoxFloatParams() { return priorBoxParams; } +template +std::vector generatePriorBoxV8FloatParams() { + using T = typename element_type_traits::value_type; + + std::vector priorBoxV8Params{ + PriorBoxV8Params( + {2.0f}, + {5.0f}, + {1.5f}, + true, + false, + {2}, + {2}, + IN_ET, + std::vector{2, 2}, + std::vector{10, 10}, + std::vector{ + 0.15, 0.15, 0.35, 0.35, 0.127526, 0.16835, 0.372474, 0.33165, 0.0918861, 0.0918861, 0.408114, 0.408114, + 0.65, 0.15, 0.85, 0.35, 0.627526, 0.16835, 0.872474, 0.33165, 0.591886, 0.0918861, 0.908114, 0.408114, + 0.15, 0.65, 0.35, 0.85, 0.127526, 0.66835, 0.372474, 0.83165, 0.0918861, 0.591886, 0.408114, 0.908114, + 0.65, 0.65, 0.85, 0.85, 0.627526, 0.66835, 0.872474, 0.83165, 0.591886, 0.591886, 0.908114, 0.908114, + 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, + 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, + 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, + 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1}), + }; + return priorBoxV8Params; +} + std::vector generatePriorBoxCombinedParams() { - const std::vector> priorBoxTypeParams { + const std::vector> priorBoxTypeParams{ generatePriorBoxFloatParams(), generatePriorBoxFloatParams(), generatePriorBoxFloatParams(), @@ -111,7 +223,7 @@ std::vector generatePriorBoxCombinedParams() { generatePriorBoxFloatParams(), generatePriorBoxFloatParams(), generatePriorBoxFloatParams(), - }; + }; std::vector combinedParams; for (const auto& params : priorBoxTypeParams) { @@ -120,7 +232,32 @@ std::vector generatePriorBoxCombinedParams() { return combinedParams; } -INSTANTIATE_TEST_SUITE_P(smoke_PriorBox_With_Hardcoded_Refs, ReferencePriorBoxLayerTest, - testing::ValuesIn(generatePriorBoxCombinedParams()), ReferencePriorBoxLayerTest::getTestCaseName); +std::vector generatePriorBoxV8CombinedParams() { + const std::vector> priorBoxV8TypeParams{ + generatePriorBoxV8FloatParams(), + generatePriorBoxV8FloatParams(), + generatePriorBoxV8FloatParams(), + generatePriorBoxV8FloatParams(), + generatePriorBoxV8FloatParams(), + generatePriorBoxV8FloatParams(), + generatePriorBoxV8FloatParams(), + generatePriorBoxV8FloatParams(), + }; + std::vector combinedParams; -} // namespace \ No newline at end of file + for (const auto& params : priorBoxV8TypeParams) { + combinedParams.insert(combinedParams.end(), params.begin(), params.end()); + } + return combinedParams; +} + +INSTANTIATE_TEST_SUITE_P(smoke_PriorBox_With_Hardcoded_Refs, + ReferencePriorBoxLayerTest, + testing::ValuesIn(generatePriorBoxCombinedParams()), + ReferencePriorBoxLayerTest::getTestCaseName); + +INSTANTIATE_TEST_SUITE_P(smoke_PriorBoxV8_With_Hardcoded_Refs, + ReferencePriorBoxV8LayerTest, + testing::ValuesIn(generatePriorBoxV8CombinedParams()), + ReferencePriorBoxV8LayerTest::getTestCaseName); +} // namespace \ No newline at end of file diff --git a/docs/template_plugin/tests/functional/shared_tests_instances/behavior/plugin/core_integration.cpp b/docs/template_plugin/tests/functional/shared_tests_instances/behavior/plugin/core_integration.cpp index 765b28d3bab..78cf8bfaecf 100644 --- a/docs/template_plugin/tests/functional/shared_tests_instances/behavior/plugin/core_integration.cpp +++ b/docs/template_plugin/tests/functional/shared_tests_instances/behavior/plugin/core_integration.cpp @@ -130,10 +130,10 @@ TEST_F(IEClassGetConfigTestTEMPLATE, smoke_GetConfigNoThrow) { std::string defaultDeviceID = ie.GetConfig(deviceName, CONFIG_KEY(DEVICE_ID)); std::cout << CONFIG_KEY(DEVICE_ID) << " : " << defaultDeviceID << std::endl; } else if (CONFIG_KEY(PERF_COUNT) == confKey) { - bool defaultPerfCount = ie.GetConfig(deviceName, CONFIG_KEY(PERF_COUNT)); + bool defaultPerfCount = ie.GetConfig(deviceName, CONFIG_KEY(PERF_COUNT)).as(); std::cout << CONFIG_KEY(PERF_COUNT) << " : " << defaultPerfCount << std::endl; } else if (CONFIG_KEY(EXCLUSIVE_ASYNC_REQUESTS) == confKey) { - bool defaultExclusive = ie.GetConfig(deviceName, CONFIG_KEY(EXCLUSIVE_ASYNC_REQUESTS)); + bool defaultExclusive = ie.GetConfig(deviceName, CONFIG_KEY(EXCLUSIVE_ASYNC_REQUESTS)).as(); std::cout << CONFIG_KEY(EXCLUSIVE_ASYNC_REQUESTS) << " : " << defaultExclusive << std::endl; } } diff --git a/docs/template_plugin/tests/functional/skip_tests_config.cpp b/docs/template_plugin/tests/functional/skip_tests_config.cpp index bc20772d640..e7e16f48f62 100644 --- a/docs/template_plugin/tests/functional/skip_tests_config.cpp +++ b/docs/template_plugin/tests/functional/skip_tests_config.cpp @@ -100,6 +100,12 @@ std::vector disabledTestPatterns() { R"(.*ReferenceTopKTest.*aType=f64.*)", // CVS-63947 R"(.*ReferenceConcatTest.*concat_zero_.*)", + // CVS-64119 + R"(.*ReferenceMatrixNmsTest.*esiType=i64.*evoType=i64.*)", + // CVS-64121 + R"(.*ReferenceMulticlassNmsTest.*esiType=i64.*evoType=i64.*)", + // CVS-64096 + R"(.*ReferenceNonMaxSuppressionTest.*esiType=i32.*evoType=i32.*)", }; #ifdef _WIN32 diff --git a/inference-engine/CMakeLists.txt b/inference-engine/CMakeLists.txt index 71d80f1f974..2e935e206d1 100644 --- a/inference-engine/CMakeLists.txt +++ b/inference-engine/CMakeLists.txt @@ -4,10 +4,6 @@ project(InferenceEngine) -add_subdirectory(thirdparty) -add_subdirectory(src) -add_subdirectory(ie_bridges/c) - if(ENABLE_PYTHON) add_subdirectory(ie_bridges/python) endif() diff --git a/inference-engine/ie_bridges/python/cmake/UseCython.cmake b/inference-engine/ie_bridges/python/cmake/UseCython.cmake index 08939b3ad4f..4aa1b482798 100644 --- a/inference-engine/ie_bridges/python/cmake/UseCython.cmake +++ b/inference-engine/ie_bridges/python/cmake/UseCython.cmake @@ -230,10 +230,7 @@ function( compile_pyx _name generated_file ) set( no_docstrings_arg "--no-docstrings" ) endif() - if( "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" OR - "${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo" ) - set( cython_debug_arg "--gdb" ) - endif() + set( cython_debug_arg "$<$,$>:--gdb>" ) if( "${PYTHONLIBS_VERSION_STRING}" MATCHES "^3." ) set( version_arg "-3" ) diff --git a/inference-engine/ie_bridges/python/wheel/CMakeLists.txt b/inference-engine/ie_bridges/python/wheel/CMakeLists.txt index 211e6349237..61d4a5bf2f5 100644 --- a/inference-engine/ie_bridges/python/wheel/CMakeLists.txt +++ b/inference-engine/ie_bridges/python/wheel/CMakeLists.txt @@ -47,7 +47,7 @@ endif() # create target for openvino.wheel set(openvino_wheel_deps ie_api offline_transformations_api) -foreach(_target ie_libraries ie_plugins _pyngraph pyopenvino) +foreach(_target ov_runtime_libraries ie_plugins _pyngraph pyopenvino) if(TARGET ${_target}) list(APPEND openvino_wheel_deps ${_target}) endif() diff --git a/inference-engine/src/CMakeLists.txt b/inference-engine/src/CMakeLists.txt index 2731b049a6f..b9b0fa3ac21 100644 --- a/inference-engine/src/CMakeLists.txt +++ b/inference-engine/src/CMakeLists.txt @@ -7,14 +7,8 @@ if(CMAKE_COMPILER_IS_GNUCXX) ie_add_compiler_flags(-Wmissing-declarations) endif() -add_subdirectory(transformations) - -add_subdirectory(low_precision_transformations) - add_subdirectory(offline_transformations) -add_subdirectory(snippets) - if(ENABLE_MKL_DNN) add_subdirectory(mkldnn_plugin) endif() @@ -31,10 +25,6 @@ if(ENABLE_GNA) add_subdirectory(gna_plugin) endif() -if(ENABLE_HETERO) - add_subdirectory(hetero_plugin) -endif() - if(ENABLE_MULTI) add_subdirectory(multi_device) endif() @@ -43,42 +33,3 @@ if(ENABLE_BATCH) add_subdirectory(auto_batch) endif() - -add_subdirectory(inference_engine) - -add_subdirectory(legacy_api) - -add_subdirectory(readers) - -add_subdirectory(preprocessing) - -# add a custom target to build all Inference Engine Core libraries - -add_custom_target(ie_libraries ALL - DEPENDS inference_engine_transformations inference_engine_legacy - inference_engine inference_engine_preproc - inference_engine_lp_transformations inference_engine_snippets) - -if(ENABLE_IR_V7_READER) - add_dependencies(ie_libraries inference_engine_ir_v7_reader) -endif() - -if(NGRAPH_IR_FRONTEND_ENABLE) - if(BUILD_SHARED_LIBS) - add_dependencies(ie_libraries ir_ov_frontend) - endif() - # use this one once CVS-69781 is fixed - # add_dependencies(inference_engine ir_ov_frontend) -endif() - -if(NGRAPH_ONNX_FRONTEND_ENABLE) - add_dependencies(inference_engine onnx_ov_frontend) -endif() - -if(NGRAPH_PDPD_FRONTEND_ENABLE) - add_dependencies(inference_engine paddlepaddle_ov_frontend) -endif() - -if(NGRAPH_TF_FRONTEND_ENABLE) - add_dependencies(inference_engine tensorflow_ov_frontend) -endif() diff --git a/inference-engine/src/cldnn_engine/CMakeLists.txt b/inference-engine/src/cldnn_engine/CMakeLists.txt index 58b7536e63e..cab62ab79ea 100644 --- a/inference-engine/src/cldnn_engine/CMakeLists.txt +++ b/inference-engine/src/cldnn_engine/CMakeLists.txt @@ -26,9 +26,8 @@ ie_add_plugin(NAME ${TARGET_NAME} SOURCES ${MAIN_SRC} ${LIBRARY_HEADERS} VERSION_DEFINES_FOR cldnn_engine.cpp) -if(CMAKE_BUILD_TYPE STREQUAL "Release") - target_compile_options(${TARGET_NAME} PRIVATE -Os) -endif() +target_compile_options(${TARGET_NAME} PRIVATE + $<$:$,/Os,-Os>>) target_link_libraries(${TARGET_NAME} PRIVATE clDNN_lib pugixml::static inference_engine_transformations diff --git a/inference-engine/src/cldnn_engine/cldnn_graph.cpp b/inference-engine/src/cldnn_engine/cldnn_graph.cpp index 0727747030f..567f209257c 100644 --- a/inference-engine/src/cldnn_engine/cldnn_graph.cpp +++ b/inference-engine/src/cldnn_engine/cldnn_graph.cpp @@ -84,8 +84,6 @@ void CLDNNGraph::Build() { m_networks.emplace_back(network); } - UpdateImplementationsMap(); - GPU_DEBUG_GET_INSTANCE(debug_config); GPU_DEBUG_IF(!debug_config->dry_run_path.empty()) { CNNNetwork net(GetExecGraphInfo()); @@ -545,49 +543,6 @@ bool CLDNNGraph::IsLoaded() const { return GetNetwork() != nullptr; } -void CLDNNGraph::UpdateImplementationsMap() { - OV_ITT_SCOPED_TASK(itt::domains::CLDNNPlugin, "CLDNNGraph::UpdateImplementationsMap"); - if (m_config.useProfiling) { - auto extractImplementationFromInfo = [](const std::string& info) -> std::string { - std::string def_implementation = "undef"; - std::string impl_section = "implementation :"; - std::string::size_type pos = info.find(impl_section); - if (pos == std::string::npos) { - return def_implementation; - } - - std::string::size_type end_pos = info.find(',', pos); - if (end_pos == std::string::npos) { - return def_implementation; - } - - std::string::size_type length = end_pos - pos - impl_section.size(); - - auto trim = [](const std::string& str) { - size_t first = str.find_first_not_of(' '); - if (std::string::npos == first) { - return str; - } - size_t last = str.find_last_not_of(' '); - return str.substr(first, (last - first + 1)); - }; - std::string tmp = trim(info.substr(pos + impl_section.size(), length)); - - return tmp.length() > 1 ? tmp : def_implementation; - }; - - // Parse primitive info and extract implementation name. - for (auto& id : profilingIDs) { - std::string prim_info = ""; - try { - prim_info = GetNetwork()->get_primitive_info(id); - } catch (std::exception& /*e*/) { } - - implementationsMap.insert({id, extractImplementationFromInfo(prim_info)}); - } - } -} - std::map CLDNNGraph::GetPerformanceCounts() const { OV_ITT_SCOPED_TASK(itt::domains::CLDNNPlugin, "CLDNNGraph::GetPerformanceCounts"); std::map result; @@ -632,7 +587,7 @@ std::map CLDNNGraph::G static const std::string cpuExecType("CPU"); cpuExecType.copy(extPerfEntry.exec_type, cpuExecType.length()); // Override execType as CPU } else { - std::string impl = implementationsMap.at(primId); + std::string impl = GetNetwork()->get_implementation_info(primId); impl.copy(extPerfEntry.exec_type, impl.length()); } @@ -659,8 +614,10 @@ std::map CLDNNGraph::G allIds.erase(std::find(allIds.begin(), allIds.end(), id)); } } - if (!kernelId.empty()) - implementationsMap.at(kernelId).copy(extPerfEntry.exec_type, implementationsMap.at(kernelId).length()); + if (!kernelId.empty()) { + std::string impl_info = GetNetwork()->get_implementation_info(kernelId); + std::memcpy(extPerfEntry.exec_type, &impl_info[0], impl_info.length()); + } } getUpperCaseName(perfCounter.layerType).copy(extPerfEntry.layer_type, perfCounter.layerType.length()); diff --git a/inference-engine/src/cldnn_engine/cldnn_graph.h b/inference-engine/src/cldnn_engine/cldnn_graph.h index 27a9a3f029a..d2a4cf95084 100644 --- a/inference-engine/src/cldnn_engine/cldnn_graph.h +++ b/inference-engine/src/cldnn_engine/cldnn_graph.h @@ -88,7 +88,6 @@ protected: std::map> prevPrimitiveIDs; std::map> perfMap; - std::map implementationsMap; std::vector profilingIDs; std::map outputDims; @@ -99,7 +98,6 @@ protected: std::shared_ptr BuildNetwork(std::shared_ptr program); void Build(); void UpdateLayersMaps(); - void UpdateImplementationsMap(); std::shared_ptr GetExecGraphInfoByPrimitivesInfo(std::vector& pi, bool filter_const_primitives = true); }; diff --git a/inference-engine/src/cldnn_engine/cldnn_transformations_pipeline.cpp b/inference-engine/src/cldnn_engine/cldnn_transformations_pipeline.cpp index 68353d8268b..50a280ed2d6 100644 --- a/inference-engine/src/cldnn_engine/cldnn_transformations_pipeline.cpp +++ b/inference-engine/src/cldnn_engine/cldnn_transformations_pipeline.cpp @@ -35,6 +35,9 @@ #include #include "transformations/common_optimizations/convert_quantize_dequantize.hpp" #include "transformations/common_optimizations/convert_compression_only_to_legacy.hpp" +#include +#include + #include #include #include @@ -120,6 +123,8 @@ void TransformationsPipeline::apply(std::shared_ptr func) { manager.register_pass(); manager.register_pass(); + manager.register_pass(); + manager.register_pass(); if (!config.enable_loop_unrolling) { manager.register_pass(); diff --git a/inference-engine/src/cldnn_engine/ops/constant.cpp b/inference-engine/src/cldnn_engine/ops/constant.cpp index 26e8c2845ee..3e8648ddc0a 100644 --- a/inference-engine/src/cldnn_engine/ops/constant.cpp +++ b/inference-engine/src/cldnn_engine/ops/constant.cpp @@ -22,35 +22,6 @@ namespace CLDNNPlugin { -struct ConstProperties { - bool isWeights; - bool hasGroupDimension; - bool reversedChannelsOrder; -}; - -static ConstProperties getConstProperties(const std::shared_ptr& op) { - for (size_t i = 0; i < op->get_output_size(); i++) { - auto outTensors = op->get_output_target_inputs(i); - for (auto& t : outTensors) { - auto outOp = t.get_node(); - if (dynamic_cast(outOp)) { - return {t.get_index() == 1, false, false}; - } else if (dynamic_cast(outOp)) { - return {t.get_index() == 1, false, false}; - } else if (auto castedOp = dynamic_cast(outOp)) { - return {t.get_index() == 2, castedOp->get_group() > 1, false}; - } else if (dynamic_cast(outOp)) { - return {t.get_index() == 1, true, false}; - } else if (dynamic_cast(outOp)) { - return {t.get_index() == 1, false, true}; - } else if (dynamic_cast(outOp)) { - return {t.get_index() == 1, true, true}; - } - } - } - return {false, false, false}; -} - static cldnn::tensor getConstTensor(const ngraph::Shape constDims) { cldnn::tensor constTensor; switch (constDims.size()) { @@ -78,71 +49,103 @@ static cldnn::tensor getConstTensor(const ngraph::Shape constDims) { return constTensor; } +struct ConstProperties { + bool needsBatchInterpretation; + bool swapOI; + bool hasGroupDimension; +}; + +static void createClDnnConstant(Program& p, const ngraph::Shape& constDims, const std::shared_ptr& op, const ConstProperties& props); + static void CreateConstantOp(Program& p, const std::shared_ptr& op) { - auto constDims = op->get_shape(); - cldnn::tensor constTensor = getConstTensor(constDims); + const auto& constDims = op->get_shape(); + auto constUsers = op->get_output_target_inputs(0); + size_t numConstUsers = constUsers.size(); + + std::unordered_map, ConstProperties> consts = { + {op, {false, false, false}} + }; + + // handleConvWeights function is executed when one of the constant users is ConvolutionBackpropData or GroupConvolutionBackpropData. + // In that case, we mark that constant's O and I dimensions need to be swapped. + auto handleConvWeights = [&op] (ngraph::Node* conv, std::unordered_map, ConstProperties>& consts, + size_t& numConstUsers, bool hasGroupDimension) { + // If constant has multiple users - create its copy and replace 'conv' weights with the copy. + // This is to make sure that dimension change doesn't break other users of the constant node. + // It is a shallow copy, but that's fine since in createClDnnConstant + // every constant created here, gets memcopied to a brand new cldnn::memory. + if (numConstUsers > 1) { + auto constant = std::make_shared(*(op.get())); + conv->input(1).replace_source_output(constant); + consts.insert({constant, {false, true, hasGroupDimension}}); + numConstUsers--; + } else { + consts[op].swapOI = true; + consts[op].hasGroupDimension = hasGroupDimension; + } + }; // WA to inconsistency between input and const 1d tensors // For Concat along batch we go with batch interpretation // For Gather input we go with batch interpretation - bool needsBatchInterpretation = false; - if (constDims.size() == 1) { - for (size_t i = 0; i < op->get_output_size(); i++) { - auto outTensors = op->get_output_target_inputs(i); - - for (auto& t : outTensors) { - auto outOp = t.get_node(); - if (auto castedOp = dynamic_cast(outOp)) { - if (castedOp->get_axis() == 0) { - needsBatchInterpretation = true; - break; - } - } else if (ngraph::op::is_binary_elementwise_arithmetic(outOp) || - ngraph::op::is_binary_elementwise_logical(outOp) || - ngraph::is_type(outOp)) { - bool all_inputs_1d = true; - for (size_t j = 0; j < outOp->get_input_size(); j++) { - auto& in_shape = outOp->get_input_shape(j); - if (in_shape.size() > 1) - all_inputs_1d = false; - } - needsBatchInterpretation = all_inputs_1d; - break; - } else if (ngraph::is_type(outOp) || - ngraph::is_type(outOp) || - ngraph::is_type(outOp)) { - needsBatchInterpretation = true; - break; - } + // Also check if constant users is a backprop convolution - in that case O and I need to be swapped. + for (auto& node : constUsers) { + auto outOp = node.get_node(); + if (auto castedOp = dynamic_cast(outOp)) { + if (castedOp->get_axis() == 0) { + consts[op].needsBatchInterpretation = constDims.size() == 1; } + } else if (ngraph::op::is_binary_elementwise_arithmetic(outOp) || + ngraph::op::is_binary_elementwise_logical(outOp) || + ngraph::is_type(outOp)) { + bool all_inputs_1d = true; + for (size_t j = 0; j < outOp->get_input_size(); j++) { + auto& in_shape = outOp->get_input_shape(j); + if (in_shape.size() > 1) + all_inputs_1d = false; + } + consts[op].needsBatchInterpretation = all_inputs_1d && constDims.size() == 1; + } else if (ngraph::is_type(outOp) || + ngraph::is_type(outOp) || + ngraph::is_type(outOp)) { + consts[op].needsBatchInterpretation = constDims.size() == 1; + } else if (ngraph::is_type(outOp) && node.get_index() == 1) { + handleConvWeights(outOp, consts, numConstUsers, false); + } else if (ngraph::is_type(outOp) && node.get_index() == 1) { + handleConvWeights(outOp, consts, numConstUsers, true); } } - if (needsBatchInterpretation) { + for (auto& it : consts) { + createClDnnConstant(p, constDims, it.first, it.second); + } +} + +void createClDnnConstant(Program& p, const ngraph::Shape& constDims, const std::shared_ptr& op, const ConstProperties& props) { + cldnn::tensor constTensor = getConstTensor(constDims); + auto constFormat = DefaultFormatForDims(constDims.size()); + + if (props.needsBatchInterpretation) { constTensor.batch[0] = constTensor.count(); constTensor.feature[0] = 1; } - auto constFormat = DefaultFormatForDims(op->get_output_shape(0).size()); - auto prop = getConstProperties(op); - // If constDims has a dimension = 0, then create tensor with single value // TODO: check if dim=0 is a valid case if (std::accumulate(constDims.begin(), constDims.end(), 1, std::multiplies()) == 0) constTensor = cldnn::tensor{1}; // Swap O and I dimensions to match expected deconvolution weights format - bool swap_oi = prop.isWeights && prop.reversedChannelsOrder; size_t inputFeatureElements = 1; size_t outputFeatureElements = 1; size_t groups = 1; - if (swap_oi) { - size_t expected_min_rank = 2 + (prop.hasGroupDimension ? 1 : 0); + auto newDims = constDims; + if (props.swapOI) { + size_t expected_min_rank = 2 + (props.hasGroupDimension ? 1 : 0); if (expected_min_rank > constDims.size()) IE_THROW() << "Invalid constant properties or shape"; - auto newDims = constDims; - if (prop.hasGroupDimension) { + if (props.hasGroupDimension) { std::swap(newDims[2], newDims[1]); inputFeatureElements = newDims[2]; outputFeatureElements = newDims[1]; @@ -164,8 +167,7 @@ static void CreateConstantOp(Program& p, const std::shared_ptrget_data_ptr(); - - auto bufIter = p.blobMemCache.find(std::make_pair(data, constDims)); + auto bufIter = p.blobMemCache.find(std::make_pair(data, newDims)); if (bufIter != p.blobMemCache.end()) { constPrimID = bufIter->second; @@ -181,9 +183,9 @@ static void CreateConstantOp(Program& p, const std::shared_ptrget_friendly_name())); - p.blobMemCache[std::make_pair(data, constDims)] = initialconstPrimID; + p.blobMemCache[std::make_pair(data, newDims)] = initialconstPrimID; constPrimID = initialconstPrimID; } diff --git a/inference-engine/src/cldnn_engine/ops/convolution.cpp b/inference-engine/src/cldnn_engine/ops/convolution.cpp index ac654e9c2e5..dd053634a7d 100644 --- a/inference-engine/src/cldnn_engine/ops/convolution.cpp +++ b/inference-engine/src/cldnn_engine/ops/convolution.cpp @@ -39,19 +39,19 @@ static ConvoltuionParameters GetConvolutionParameters(const ngraph::CoordinateDi switch (strides.size()) { case 3: { stride = cldnn::tensor(cldnn::batch(1), cldnn::feature(1), cldnn::spatial(strides[2], strides[1], strides[0])); - padding = cldnn::tensor(cldnn::batch(0), cldnn::feature(0), cldnn::spatial(pads_begin[2], pads_begin[1], pads_begin[0])); + padding = cldnn::tensor({0, 0, TensorValue(pads_begin[2]), TensorValue(pads_begin[1]), TensorValue(pads_begin[0])}, 0); dilation = cldnn::tensor(cldnn::batch(1), cldnn::feature(1), cldnn::spatial(dilations[2], dilations[1], dilations[0])); break; } case 2: { stride = cldnn::tensor(cldnn::batch(1), cldnn::feature(1), cldnn::spatial(strides[1], strides[0], 1)); - padding = cldnn::tensor(cldnn::batch(0), cldnn::feature(0), cldnn::spatial(pads_begin[1], pads_begin[0], 0)); + padding = cldnn::tensor({0, 0, TensorValue(pads_begin[1]), TensorValue(pads_begin[0])}, 0); dilation = cldnn::tensor(cldnn::batch(1), cldnn::feature(1), cldnn::spatial(dilations[1], dilations[0], 1)); break; } case 1: { stride = cldnn::tensor(cldnn::batch(1), cldnn::feature(1), cldnn::spatial(strides[0], 1, 1)); - padding = cldnn::tensor(cldnn::batch(0), cldnn::feature(0), cldnn::spatial(pads_begin[0], 0, 0)); + padding = cldnn::tensor({0, 0, TensorValue(pads_begin[0]), 0}, 0); dilation = cldnn::tensor(cldnn::batch(1), cldnn::feature(1), cldnn::spatial(dilations[0], 1, 1)); break; } diff --git a/inference-engine/src/cldnn_engine/ops/gather_nd.cpp b/inference-engine/src/cldnn_engine/ops/gather_nd.cpp index 06760d291a8..ba29fb765fc 100644 --- a/inference-engine/src/cldnn_engine/ops/gather_nd.cpp +++ b/inference-engine/src/cldnn_engine/ops/gather_nd.cpp @@ -17,6 +17,7 @@ static void CreateGatherNDOp(Program& p, const std::shared_ptr(op->get_input_shape(0).size()); int32_t indices_rank = static_cast(op->get_input_shape(1).size()); auto batch_dims = op->get_batch_dims(); @@ -24,6 +25,7 @@ static void CreateGatherNDOp(Program& p, const std::shared_ptr(op->get_input_shape(0).size()); int32_t indices_rank = static_cast(op->get_input_shape(1).size()); auto batch_dims = op->get_batch_dims(); @@ -47,6 +50,7 @@ static void CreateGatherNDOp(Program& p, const std::shared_ptrget_friendly_name()); p.AddPrimitive(cropPrim); - p.AddPrimitiveToProfiler(layerName, op); + auto last_layer_primitive = layerName; // Reshape in case of deleting of axis if (!shrink_axis_mask.empty()) { @@ -226,7 +226,9 @@ static void CreateStridedSliceOp(Program& p, const std::shared_ptrget_friendly_name()); p.AddPrimitive(reshapePrim); p.AddInnerPrimitiveToProfiler(reshapeOutName, layerName, op); + last_layer_primitive = reshapeOutName; } + p.AddPrimitiveToProfiler(op, last_layer_primitive); return; } while (false); diff --git a/inference-engine/src/gna_plugin/gna_graph_patterns.hpp b/inference-engine/src/gna_plugin/gna_graph_patterns.hpp index 24109c5a8a8..bfc90890043 100644 --- a/inference-engine/src/gna_plugin/gna_graph_patterns.hpp +++ b/inference-engine/src/gna_plugin/gna_graph_patterns.hpp @@ -13,8 +13,62 @@ namespace GNAPluginNS { /** - * @brief searchs for a pattern: Permute(0,3,1,2) -> ... -> Convolution -> ... -> Permute(0,2,3,1) or - * Reshape -> ... -> Convolution -> ... -> Permute(0,2,3,1) if Convolution has only one input dimension not equal to 1 + * @brief checks if it's a reshape from 4d to 3d tensor inserted after convolution + * @param layer Non-functional layer + */ +inline bool IsReshapeFrom4dTo3d(InferenceEngine::CNNLayerPtr layer) { + if (!LayerInfo(layer).isNonFunctional()) { + return false; + } + + auto input_dims = layer->insData[0].lock()->getDims(); + auto output_dims = layer->outData[0]->getDims(); + // If H input dimension is not 1, it can't be just skipped during reshape to 3d + size_t h_dim = input_dims[2]; + if (input_dims.size() != 4 || output_dims.size() != 3 || h_dim != 1) { + return false; + } + + input_dims.erase(std::begin(input_dims) + 2); + if (input_dims != output_dims) { + return false; + } + + return true; +} + +/** + * @brief checks if it's a reshape from 3d to 4d tensor inserted before convolution + * @param layer Non-functional layer + */ +inline bool IsReshapeFrom3dTo4d(InferenceEngine::CNNLayerPtr layer) { + if (!LayerInfo(layer).isNonFunctional()) { + return false; + } + + auto input_dims = layer->insData[0].lock()->getDims(); + auto output_dims = layer->outData[0]->getDims(); + if (input_dims.size() != 3 || output_dims.size() != 4) { + return false; + } + + input_dims.insert(std::begin(input_dims) + 2, 1); + if (input_dims != output_dims) { + return false; + } + + return true; +} + +/** + * @brief searchs for a pattern: Permute(NHWC->NCHW) -> ... -> Convolution -> ... -> Permute(NCHW->NHWC) or + * Reshape(NHWC->NCHW) -> ... -> Convolution -> ... -> Reshape(NCHW->NHWC) if Convolution has only one input/output + * dimension not equal to 1, + * if the original convolution layout is 3d, 3d->4d/4d->3d reshapes will be inserted before/after the convolution, + * so the possible patterns will be: + * Permute(NWC->NCW) -> ... -> Reshape(NCW ->NCHW) -> Convolution -> Reshape(NCHW->NCW) ... -> Permute(NCW->NWC) or + * Reshape(NWC->NCW) -> ... -> Reshape(NCW ->NCHW) -> Convolution -> Reshape(NCHW->NCW) ... -> Reshape(NCW->NWC) + * if Convolution has only one input/output dimension not equal to 1. * @param layer convolution layer * @return the found permutations before and after convolution */ @@ -35,8 +89,10 @@ inline std::pair Fin auto next = getInputTo(layer->outData.front()).begin()->second; // Permute is inserted before Reshape by MO in NHWC models, so we need to find either permute, or reshape, or output - while (!LayerInfo(next).isPermute() && !LayerInfo(next).isNonFunctional() && !LayerInfo(next).isOutput() && - next->outData.size() == 1) { + while (!LayerInfo(next).isPermute() && !LayerInfo(next).isOutput() && next->outData.size() == 1) { + if (LayerInfo(next).isNonFunctional() && !IsReshapeFrom4dTo3d(next) && !IsReshapeFrom3dTo4d(next)) { + break; + } auto input_to = getInputTo(next->outData.front()); if (input_to.size() != 1) break; next = input_to.begin()->second; @@ -44,8 +100,11 @@ inline std::pair Fin // Check if the found layer is NCHW to NHWC permute or has 1D data, if it's not just skip this convolution if (LayerInfo(next).isPermute()) { - if (next->outData[0]->getLayout() != InferenceEngine::Layout::NCHW || - next->GetParamAsInts("order") != GetPermuteOrder(InferenceEngine::Layout::NCHW, InferenceEngine::Layout::NHWC)) { + const auto layout = next->outData[0]->getLayout(); + const auto order = next->GetParamAsInts("order"); + if (layout != InferenceEngine::Layout::NCHW && layout != InferenceEngine::Layout::CHW || + order != GetPermuteOrder(InferenceEngine::Layout::NCHW, InferenceEngine::Layout::NHWC) && + order != std::vector{0, 2, 1} /* NCW to NWC */) { return std::make_pair(nullptr, nullptr); } } else if (LayerInfo(next).isReshape()) { @@ -54,9 +113,11 @@ inline std::pair Fin } // Check if reshape is expected for this pattern: // the next layer has the both, height and width dimensions > 1 - if (next->outData[0]->getDims().size() != 4 || - GetDataDimSize(next->insData[0].lock(), InferenceEngine::DataDimName::H) != 1 || - GetDataDimSize(next->insData[0].lock(), InferenceEngine::DataDimName::W) != 1) { + auto in_dim_size = next->insData[0].lock()->getDims().size(); + IE_ASSERT(in_dim_size == 3 || in_dim_size == 4); + size_t height = in_dim_size == 3 ? 1 : GetDataDimSize(next->insData[0].lock(), InferenceEngine::DataDimName::H); + size_t width = GetDataDimSize(next->insData[0].lock(), InferenceEngine::DataDimName::W); + if (next->outData[0]->getDims().size() < 3 || height != 1 || width != 1) { return std::make_pair(nullptr, nullptr); } } else { @@ -66,14 +127,19 @@ inline std::pair Fin // Permute is inserted after Reshape by MO in NHWC models, so we need to find either permute, or reshape, or input auto parent = InferenceEngine::CNNNetPrevLayer(layer); auto prev = parent; - while (!LayerInfo(prev).isPermute() && !LayerInfo(prev).isNonFunctional() && !LayerInfo(prev).isInput() && - InferenceEngine::CNNNetHasPrevLayer(prev.get())) { + while (!LayerInfo(prev).isPermute() && !LayerInfo(prev).isInput() && InferenceEngine::CNNNetHasPrevLayer(prev.get())) { + if (LayerInfo(prev).isNonFunctional() && !IsReshapeFrom4dTo3d(prev) && !IsReshapeFrom3dTo4d(prev)) { + break; + } prev = InferenceEngine::CNNNetPrevLayer(prev); } // Check if the found layer is NHWC to NCHW permute or has 1D data, if it's not just skip this convolution if (LayerInfo(prev).isPermute()) { - if (prev->outData[0]->getLayout() != InferenceEngine::Layout::NCHW || - prev->GetParamAsInts("order") != GetPermuteOrder(InferenceEngine::Layout::NHWC, InferenceEngine::Layout::NCHW)) { + const auto layout = prev->outData[0]->getLayout(); + const auto order = prev->GetParamAsInts("order"); + if (layout != InferenceEngine::Layout::NCHW && layout != InferenceEngine::Layout::CHW || + order != GetPermuteOrder(InferenceEngine::Layout::NHWC, InferenceEngine::Layout::NCHW) && + order != std::vector{0, 2, 1} /* NWC to NCW */) { return std::make_pair(nullptr, nullptr); } } else if (LayerInfo(prev).isReshape()) { @@ -82,10 +148,12 @@ inline std::pair Fin } // Check if reshape is expected for this pattern: // the previous layer has number of channels > 1 and one of height/width dimensions is also > 1 - if (parent->insData[0].lock()->getDims().size() != 4 || - GetDataDimSize(parent->outData[0], InferenceEngine::DataDimName::C) != 1 && - (GetDataDimSize(parent->outData[0], InferenceEngine::DataDimName::H) != 1 || - GetDataDimSize(parent->outData[0], InferenceEngine::DataDimName::W) != 1)) { + size_t out_dims_size = parent->outData[0]->getDims().size(); + IE_ASSERT(out_dims_size == 3 || out_dims_size == 4); + size_t channels = GetDataDimSize(parent->outData[0], out_dims_size - 1); + size_t height = out_dims_size == 3 ? 1 : GetDataDimSize(parent->outData[0], InferenceEngine::DataDimName::H); + size_t width = GetDataDimSize(parent->outData[0], InferenceEngine::DataDimName::W); + if (parent->insData[0].lock()->getDims().size() < 3 || channels != 1 && (height != 1 || width != 1)) { return std::make_pair(nullptr, nullptr); } } else { diff --git a/inference-engine/src/gna_plugin/optimizer/gna_pass_manager.cpp b/inference-engine/src/gna_plugin/optimizer/gna_pass_manager.cpp index 732d53dcfb9..7cc085151df 100644 --- a/inference-engine/src/gna_plugin/optimizer/gna_pass_manager.cpp +++ b/inference-engine/src/gna_plugin/optimizer/gna_pass_manager.cpp @@ -648,27 +648,39 @@ void RemovePermutationsNHWCToNCHWPass::run() { auto pattern_start = layers.first; auto pattern_end = layers.second; - auto setNHWCOrder = [](InferenceEngine::DataPtr data) { - if (data->getLayout() == Layout::NHWC) return; + auto getTransposedLayout = [](InferenceEngine::DataPtr data) { + size_t dims_size = data->getDims().size(); + if (dims_size < 3 || dims_size > 4) { + THROW_GNA_EXCEPTION << data->getName() << + " unexpected dimensions size in Permute - Conv - Permute pattern"; + } + return dims_size == 4 ? Layout::NHWC : Layout::HWC; + }; + + auto setTransposedOrder = [getTransposedLayout](InferenceEngine::DataPtr data) { + auto layout = getTransposedLayout(data); + if (data->getLayout() == layout) return; + auto dims = data->getDims(); - auto order = GetPermuteOrder(Layout::NCHW, Layout::NHWC); + auto order = dims.size() == 4 ? GetPermuteOrder(Layout::NCHW, Layout::NHWC) : + std::vector{0, 2, 1}; InferenceEngine::SizeVector new_dims; for (int i = 0; i < dims.size(); ++i) { new_dims.push_back(dims[order[i]]); } data->setDims(new_dims); - data->setLayout(Layout::NHWC); + data->setLayout(layout); }; auto input_to = getInputTo(pattern_start->outData[0]); IE_ASSERT(!input_to.empty()); auto current_layer = input_to.begin()->second; - setNHWCOrder(current_layer->input()); + setTransposedOrder(current_layer->input()); std::function propogateNHWCOrderRecursive = - [pattern_end, &propogateNHWCOrderRecursive, &setNHWCOrder](CNNLayerPtr current_layer) { + [pattern_end, &propogateNHWCOrderRecursive, &setTransposedOrder](CNNLayerPtr current_layer) { if (current_layer == pattern_end) return; for (size_t i = 0; i < current_layer->outData.size(); ++i) { - setNHWCOrder(current_layer->outData[i]); + setTransposedOrder(current_layer->outData[i]); auto input_to = getInputTo(current_layer->outData[i]); IE_ASSERT(!input_to.empty()); propogateNHWCOrderRecursive(input_to.begin()->second); @@ -682,7 +694,7 @@ void RemovePermutationsNHWCToNCHWPass::run() { for (auto before_output : layer_before_permute->outData) { if (areEqualDatas(pattern_start->input(), before_output)) { output = before_output; - output->setLayout(Layout::NHWC); + output->setLayout(getTransposedLayout(output)); break; } } @@ -693,7 +705,7 @@ void RemovePermutationsNHWCToNCHWPass::run() { if (!pattern_end->outData.empty() && !getInputTo(pattern_end->outData.front()).empty()) { auto layer_after_permute = getInputTo(pattern_end->outData.front()).begin()->second; - layer_after_permute->input()->setLayout(Layout::NHWC); + layer_after_permute->input()->setLayout(getTransposedLayout(layer_after_permute->input())); } } diff --git a/inference-engine/src/hetero_plugin/hetero_executable_network.hpp b/inference-engine/src/hetero_plugin/hetero_executable_network.hpp deleted file mode 100644 index f7ecbe5ea46..00000000000 --- a/inference-engine/src/hetero_plugin/hetero_executable_network.hpp +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (C) 2018-2021 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -/** - * @brief a header file for ExecutableNetwork - * @file hetero_executable_network.hpp - */ -#pragma once - -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "hetero_infer_request.hpp" -#include "ie_icore.hpp" -#include "hetero_async_infer_request.hpp" - -namespace HeteroPlugin { - -class Engine; - -/** - * @class ExecutableNetwork - * @brief Interface of executable network - */ -class HeteroExecutableNetwork : public InferenceEngine::ExecutableNetworkThreadSafeDefault { -public: - typedef std::shared_ptr Ptr; - - /** - * @brief constructor - */ - HeteroExecutableNetwork(const InferenceEngine::CNNNetwork& network, - const std::map& config, - Engine* plugin); - /** - * @brief Import from opened file constructor - */ - HeteroExecutableNetwork(std::istream& heteroModel, - const std::map& config, - Engine* plugin); - - InferenceEngine::IInferRequestInternal::Ptr CreateInferRequestImpl(InferenceEngine::InputsDataMap networkInputs, - InferenceEngine::OutputsDataMap networkOutputs) override; - InferenceEngine::IInferRequestInternal::Ptr CreateInferRequestImpl(const std::vector>& inputs, - const std::vector>& outputs) override; - - - InferenceEngine::IInferRequestInternal::Ptr CreateInferRequest() override; - - InferenceEngine::Parameter GetConfig(const std::string &name) const override; - - InferenceEngine::Parameter GetMetric(const std::string &name) const override; - - void Export(std::ostream& modelFile) override; - -private: - void InitCNNImpl(const InferenceEngine::CNNNetwork& network); - void InitNgraph(const InferenceEngine::CNNNetwork& network); - - struct NetworkDesc { - std::string _device; - InferenceEngine::CNNNetwork _clonedNetwork; - InferenceEngine::SoExecutableNetworkInternal _network; - }; - - std::vector _networks; - Engine* _heteroPlugin; - std::string _name; - std::map _config; - std::unordered_map _blobNameMap; -}; - -} // namespace HeteroPlugin diff --git a/inference-engine/src/inference_engine/include/openvino/runtime/parameter.hpp b/inference-engine/src/inference_engine/include/openvino/runtime/parameter.hpp deleted file mode 100644 index 026b0fd4dff..00000000000 --- a/inference-engine/src/inference_engine/include/openvino/runtime/parameter.hpp +++ /dev/null @@ -1,360 +0,0 @@ -// Copyright (C) 2018-2021 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -/** - * @brief A header file for the Parameter class - * @file openvino/runtime/parameter.hpp - */ -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "openvino/core/except.hpp" -#include "openvino/runtime/common.hpp" - -namespace ov { -namespace runtime { - -/** - * @brief This class represents an object to work with different parameters - * - */ -class OPENVINO_RUNTIME_API Parameter { -public: - /** - * @brief Default constructor - */ - Parameter() = default; - - /** - * @brief Move constructor - * - * @param parameter Parameter object - */ - Parameter(Parameter&& parameter) noexcept { - std::swap(ptr, parameter.ptr); - } - - /** - * @brief Copy constructor - * - * @param parameter Parameter object - */ - Parameter(const Parameter& parameter) { - *this = parameter; - } - - /** - * @brief Constructor creates parameter with object - * - * @tparam T Parameter type - * @tparam U Identity type-transformation - * @param parameter object - */ - template ::type, Parameter>::value && - !std::is_abstract::type>::value>::type> - Parameter(T&& parameter) { - static_assert(!std::is_same::type, Parameter>::value, "To prevent recursion"); - ptr = new RealData::type>(std::forward(parameter)); - } - - /** - * @brief Constructor creates string parameter from char * - * - * @param str char array - */ - Parameter(const char* str) : Parameter(std::string(str)) {} - - /** - * @brief Destructor - */ - virtual ~Parameter(); - - /** - * Copy operator for Parameter - * @param parameter Parameter object - * @return Parameter - */ - Parameter& operator=(const Parameter& parameter) { - if (this == ¶meter) { - return *this; - } - clear(); - if (!parameter.empty()) - ptr = parameter.ptr->copy(); - return *this; - } - - /** - * Remove a value from parameter - */ - void clear() { - delete ptr; - ptr = nullptr; - } - - /** - * Checks that parameter contains a value - * @return false if parameter contains a value else false - */ - bool empty() const noexcept { - return nullptr == ptr; - } - - /** - * Checks the type of value - * @tparam T Type of value - * @return true if type of value is correct - */ - template - bool is() const { - return empty() ? false : ptr->is(typeid(T)); - } - - /** - * Dynamic cast to specified type - * @tparam T type - * @return casted object - */ - template - T&& as() && { - return std::move(dyn_cast(ptr)); - } - - /** - * Dynamic cast to specified type - * @tparam T type - * @return casted object - */ - template - T& as() & { - return dyn_cast(ptr); - } - /** - * Dynamic cast to specified type - * @tparam T type - * @return casted object - */ - template - const T& as() const& { - return dyn_cast(ptr); - } - - /** - * Dynamic cast to specified type - * @tparam T type - * @return casted object - */ - template - operator T &&() && { - return std::move(dyn_cast::type>(ptr)); - } - - /** - * Dynamic cast to specified type - * @tparam T type - * @return casted object - */ - template - operator T&() & { - return dyn_cast::type>(ptr); - } - - /** - * Dynamic cast to specified type - * @tparam T type - * @return casted object - */ - template - operator const T&() const& { - return dyn_cast::type>(ptr); - } - - /** - * Dynamic cast to specified type - * @tparam T type - * @return casted object - */ - template - operator T&() const& { - return dyn_cast::type>(ptr); - } - - /** - * @brief The comparison operator for the Parameter - * - * @param rhs object to compare - * @return true if objects are equal - */ - bool operator==(const Parameter& rhs) const { - return *ptr == *(rhs.ptr); - } - /** - * @brief The comparison operator for the Parameter - * - * @param rhs object to compare - * @return true if objects aren't equal - */ - bool operator!=(const Parameter& rhs) const { - return !(*this == rhs); - } - - /** - * @brief Prints underlying object to the given output stream. - * Uses operator<< if it is defined, leaves stream unchanged otherwise. - * In case of empty parameter or nullptr stream immediately returns. - * - * @param object Object to be printed to the given output stream. - * @param stream Output stream object will be printed to. - */ - friend void PrintTo(const Parameter& object, std::ostream* stream) { - if (object.empty() || !stream) { - return; - } - object.ptr->print(*stream); - } - -private: - template - struct CheckOperatorEqual { - template - static auto test(U*) -> decltype(std::declval() == std::declval()) { - return false; - } - - template - static auto test(...) -> std::false_type { - return {}; - } - - using type = typename std::is_same(nullptr))>::type; - }; - - template - struct HasOperatorEqual : CheckOperatorEqual::type {}; - - template - struct CheckOutputStreamOperator { - template - static auto test(W*) -> decltype(std::declval() << std::declval(), std::true_type()) { - return {}; - } - - template - static auto test(...) -> std::false_type { - return {}; - } - - using type = typename std::is_same(nullptr))>::type; - }; - - template - struct HasOutputStreamOperator : CheckOutputStreamOperator::type {}; - - struct Any { -#ifdef __ANDROID__ - virtual ~Any(); -#else - virtual ~Any() = default; -#endif - virtual bool is(const std::type_info&) const = 0; - virtual Any* copy() const = 0; - virtual bool operator==(const Any& rhs) const = 0; - virtual void print(std::ostream&) const = 0; - }; - - template - struct RealData : Any, std::tuple { - using std::tuple::tuple; - - bool is(const std::type_info& id) const override { - return id == typeid(T); - } - Any* copy() const override { - return new RealData{get()}; - } - - T& get() & { - return std::get<0>(*static_cast*>(this)); - } - - const T& get() const& { - return std::get<0>(*static_cast*>(this)); - } - - template - typename std::enable_if::value, bool>::type equal(const Any& left, const Any& rhs) const { - throw ov::Exception("Parameter doesn't contain equal operator"); - } - - template - typename std::enable_if::value, bool>::type equal(const Any& left, const Any& rhs) const { - return dyn_cast(&left) == dyn_cast(&rhs); - } - - bool operator==(const Any& rhs) const override { - return rhs.is(typeid(T)) && equal(*this, rhs); - } - - template ::value, bool>::type = true> - void print(std::ostream& stream, const U& object) const {} - - template ::value, bool>::type = true> - void print(std::ostream& stream, const U& object) const { - stream << object; - } - - void print(std::ostream& stream) const override { - print(stream, get()); - } - }; - - template - static T& dyn_cast(Any* obj) { - OPENVINO_ASSERT(obj != nullptr, "Parameter is empty!"); - return dynamic_cast&>(*obj).get(); - } - - template - static const T& dyn_cast(const Any* obj) { - OPENVINO_ASSERT(obj != nullptr, "Parameter is empty!"); - return dynamic_cast&>(*obj).get(); - } - - Any* ptr = nullptr; -}; - -/** - * @brief An std::map object containing parameters - */ -using ParamMap = std::map; - -#ifdef __ANDROID__ -extern template struct OPENVINO_RUNTIME_API ov::runtime::Parameter::RealData; -extern template struct OPENVINO_RUNTIME_API ov::runtime::Parameter::RealData; -extern template struct OPENVINO_RUNTIME_API ov::runtime::Parameter::RealData; -extern template struct OPENVINO_RUNTIME_API ov::runtime::Parameter::RealData; -extern template struct OPENVINO_RUNTIME_API ov::runtime::Parameter::RealData; -extern template struct OPENVINO_RUNTIME_API ov::runtime::Parameter::RealData; -extern template struct OPENVINO_RUNTIME_API ov::runtime::Parameter::RealData>; -extern template struct OPENVINO_RUNTIME_API ov::runtime::Parameter::RealData>; -extern template struct OPENVINO_RUNTIME_API ov::runtime::Parameter::RealData>; -extern template struct OPENVINO_RUNTIME_API ov::runtime::Parameter::RealData>; -extern template struct OPENVINO_RUNTIME_API - ov::runtime::Parameter::RealData>; -#endif - -} // namespace runtime - -} // namespace ov diff --git a/inference-engine/src/mkldnn_plugin/memory_desc/cpu_memory_desc_utils.cpp b/inference-engine/src/mkldnn_plugin/memory_desc/cpu_memory_desc_utils.cpp index ffb09da736b..38dd1220e29 100644 --- a/inference-engine/src/mkldnn_plugin/memory_desc/cpu_memory_desc_utils.cpp +++ b/inference-engine/src/mkldnn_plugin/memory_desc/cpu_memory_desc_utils.cpp @@ -113,11 +113,12 @@ std::shared_ptr MemoryDescUtils::makeDummyDesc(const MemoryDesc &des } Shape MemoryDescUtils::makeDummyShape(const Shape &shape, Dim dummyVal) { + const auto& minDims = shape.getMinDims(); const auto& maxDims = shape.getMaxDims(); const auto& dims = shape.getDims(); VectorDims dummyDims(dims.size()); for (size_t i = 0; i < dims.size(); ++i) { - dummyDims[i] = dims[i] == Shape::UNDEFINED_DIM ? std::min(maxDims[i], dummyVal) : dims[i]; + dummyDims[i] = dims[i] == Shape::UNDEFINED_DIM ? std::min(maxDims[i], std::max(minDims[i], dummyVal)) : dims[i]; } return Shape(dummyDims); } diff --git a/inference-engine/src/mkldnn_plugin/mkldnn/iml_type_mapper.cpp b/inference-engine/src/mkldnn_plugin/mkldnn/iml_type_mapper.cpp index ebbebaa5dc3..adfe783f25c 100644 --- a/inference-engine/src/mkldnn_plugin/mkldnn/iml_type_mapper.cpp +++ b/inference-engine/src/mkldnn_plugin/mkldnn/iml_type_mapper.cpp @@ -22,11 +22,15 @@ impl_desc_type MKLDNNPlugin::parse_impl_name(std::string impl_desc_name) { SEARCH_WORD(ref); SEARCH_WORD(jit); - SEARCH_WORD(gemm); + SEARCH_WORD(brgconv); + SEARCH_WORD(brgemm); + if ((res & impl_desc_type::brgemm) != impl_desc_type::brgemm) + SEARCH_WORD(gemm); SEARCH_WORD(blas); SEARCH_WORD(sse42); SEARCH_WORD_2(sse41, sse42); SEARCH_WORD(avx2); + SEARCH_WORD(amx); SEARCH_WORD(avx512); SEARCH_WORD(any); SEARCH_WORD(_1x1); @@ -82,6 +86,28 @@ const char* MKLDNNPlugin::impl_type_to_string(impl_desc_type type) { CASE(jit_avx_dw); CASE(jit_sse42_dw); CASE(jit_uni_dw); + CASE(jit_avx512_amx); + CASE(jit_avx512_amx_1x1); + CASE(jit_avx512_amx_dw); + CASE(brgconv_avx512); + CASE(brgconv_avx2); + CASE(brgconv_avx); + CASE(brgconv_sse42); + CASE(brgconv_uni); + CASE(brgconv_avx512_amx); + CASE(brgconv_avx512_1x1); + CASE(brgconv_avx2_1x1); + CASE(brgconv_avx_1x1); + CASE(brgconv_sse42_1x1); + CASE(brgconv_uni_1x1); + CASE(brgconv_avx512_amx_1x1); + CASE(brgemm_avx512); + CASE(brgemm_avx2); + CASE(brgemm_avx); + CASE(brgemm_sse42); + CASE(brgemm_uni); + CASE(brgemm_avx512_amx); + #undef CASE return "unknown"; } diff --git a/inference-engine/src/mkldnn_plugin/mkldnn/iml_type_mapper.h b/inference-engine/src/mkldnn_plugin/mkldnn/iml_type_mapper.h index 207c51c76e8..9cd5529eca4 100644 --- a/inference-engine/src/mkldnn_plugin/mkldnn/iml_type_mapper.h +++ b/inference-engine/src/mkldnn_plugin/mkldnn/iml_type_mapper.h @@ -12,25 +12,29 @@ enum impl_desc_type { unknown = 0x00000000, undef, // Optimization approach - simple = 1<<6, - ref = 1<<7, - jit = 1<<8, - gemm = 1<<9, + simple = 1<<6, + ref = 1<<7, + jit = 1<<8, + gemm = 1<<9, + brgconv = 1<<10, + brgemm = 1<<11, // CPU version - sse42 = 1<<10, - avx = 1<<11, - avx2 = 1<<12, - avx512 = 1<<13, - blas = 1<<14, - any = 1<<15, - uni = 1<<16, + sse42 = 1<<12, + avx = 1<<13, + avx2 = 1<<14, + avx512 = 1<<15, + amx = 1<<16, + blas = 1<<17, + any = 1<<18, + uni = 1<<19, // Other specificator - _1x1 = 1<<17, - _dw = 1<<18, + _1x1 = 1<<20, + _dw = 1<<21, // Other info - reorder = 1<<19, + reorder = 1<<22, // winograd - winograd = 1<<20, + winograd = 1<<23, + // real types ref_any = ref | any, @@ -49,18 +53,42 @@ enum impl_desc_type { jit_avx = jit | avx, jit_sse42 = jit | sse42, jit_uni = jit | uni, + jit_avx512_amx = jit | avx512 | amx, jit_avx512_1x1 = jit | avx512 | _1x1, jit_avx2_1x1 = jit | avx2 | _1x1, jit_avx_1x1 = jit | avx | _1x1, jit_sse42_1x1 = jit | sse42 | _1x1, jit_uni_1x1 = jit | uni | _1x1, + jit_avx512_amx_1x1 = jit | avx512 | amx | _1x1, jit_avx512_dw = jit | avx512 | _dw, jit_avx2_dw = jit | avx2 | _dw, jit_avx_dw = jit | avx | _dw, jit_sse42_dw = jit | sse42 | _dw, jit_uni_dw = jit | uni | _dw, + jit_avx512_amx_dw = jit | avx512 | amx | _dw, + + brgconv_avx512 = brgconv | avx512, + brgconv_avx2 = brgconv | avx2, + brgconv_avx = brgconv | avx, + brgconv_sse42 = brgconv | sse42, + brgconv_uni = brgconv | uni, + brgconv_avx512_amx = brgconv | avx512 | amx, + + brgconv_avx512_1x1 = brgconv | avx512 | _1x1, + brgconv_avx2_1x1 = brgconv | avx2 | _1x1, + brgconv_avx_1x1 = brgconv | avx | _1x1, + brgconv_sse42_1x1 = brgconv | sse42 | _1x1, + brgconv_uni_1x1 = brgconv | uni | _1x1, + brgconv_avx512_amx_1x1 = brgconv | avx512 | amx | _1x1, + + brgemm_avx512 = brgemm | avx512, + brgemm_avx2 = brgemm | avx2, + brgemm_avx = brgemm | avx, + brgemm_sse42 = brgemm | sse42, + brgemm_uni = brgemm | uni, + brgemm_avx512_amx = brgemm | avx512 | amx, }; const char * impl_type_to_string(impl_desc_type type); diff --git a/inference-engine/src/mkldnn_plugin/mkldnn_graph_optimizer.cpp b/inference-engine/src/mkldnn_plugin/mkldnn_graph_optimizer.cpp index 04360eafef7..7ea97eca345 100644 --- a/inference-engine/src/mkldnn_plugin/mkldnn_graph_optimizer.cpp +++ b/inference-engine/src/mkldnn_plugin/mkldnn_graph_optimizer.cpp @@ -17,6 +17,7 @@ #include "nodes/mkldnn_mvn_node.h" #include #include "nodes/mkldnn_interpolate_node.h" +#include "nodes/mkldnn_reduce_node.h" #include "nodes/mkldnn_input_node.h" #include "nodes/mkldnn_rnn.h" #include "nodes/common/cpu_convert.h" @@ -137,6 +138,10 @@ void MKLDNNGraphOptimizer::ApplyCommonGraphOptimizations(MKLDNNGraph &graph) { FuseNormalizeL2AndSimpleOperation(graph); graph.RemoveDroppedNodes(); + OV_ITT_SCOPE_NEXT(FIRST_INFERENCE, taskChain, "FuseReduceAndSimpleOperation"); + FuseReduceAndSimpleOperation(graph); + graph.RemoveDroppedNodes(); + OV_ITT_SCOPE_NEXT(FIRST_INFERENCE, taskChain, "FuseEltwiseAndSimple"); FuseEltwiseAndSimple(graph); graph.RemoveDroppedNodes(); @@ -1352,6 +1357,46 @@ void MKLDNNGraphOptimizer::FuseNormalizeL2AndSimpleOperation(MKLDNNGraph &graph) } } +void MKLDNNGraphOptimizer::FuseReduceAndSimpleOperation(MKLDNNGraph &graph) { + auto& graphNodes = graph.GetNodes(); + + auto isSuitableParentNode = [](MKLDNNNodePtr node) { + return node->getType() == Reduce && node->getChildEdges().size() == 1; + }; + + auto parent = graphNodes.begin(); + while (parent != graphNodes.end()) { + auto parentNode = *parent; + if (!isSuitableParentNode(parentNode)) { + parent++; + continue; + } + + auto childNode = parentNode->getChildEdgeAt(0)->getChild(); + if (!parentNode->canFuse(childNode)) { + parent++; + continue; + } + + childNode->fuseInto(parentNode); + + if (childNode->getType() == FakeQuantize || childNode->getType() == Eltwise) { + auto parentEdges = childNode->parentEdges; + for (auto &parentEdge : parentEdges) { + auto p_edge = parentEdge.lock(); + if (p_edge == nullptr) + IE_THROW() << "Cannot get parent edge " << childNode->getName(); + if (p_edge->getParent()->getType() == Reduce) + continue; + + graph.RemoveEdge(p_edge); + } + } + + graph.DropNode(childNode); + } +} + void MKLDNNGraphOptimizer::FuseEltwiseAndSimple(MKLDNNGraph &graph) { auto& graphNodes = graph.GetNodes(); @@ -1918,7 +1963,7 @@ void MKLDNNGraphOptimizer::MergeTransposeAndReorder(MKLDNNGraph &graph) { void MKLDNNGraphOptimizer::reshapeRnnSeq(MKLDNNGraph &graph) { auto& graphNodes = graph.GetNodes(); - auto isSutableParentNode = [](MKLDNNNodePtr node) { + auto isSuitableParentNode = [](MKLDNNNodePtr node) { if (node->type != RNNSeq) return false; auto rnnNode = std::dynamic_pointer_cast(node); @@ -1927,7 +1972,7 @@ void MKLDNNGraphOptimizer::reshapeRnnSeq(MKLDNNGraph &graph) { for (size_t i = 0; i < graphNodes.size(); i++) { auto parentNode = graphNodes[i]; - if (!isSutableParentNode(parentNode)) { + if (!isSuitableParentNode(parentNode)) { continue; } diff --git a/inference-engine/src/mkldnn_plugin/mkldnn_graph_optimizer.h b/inference-engine/src/mkldnn_plugin/mkldnn_graph_optimizer.h index e5615a1541b..0b896da6272 100644 --- a/inference-engine/src/mkldnn_plugin/mkldnn_graph_optimizer.h +++ b/inference-engine/src/mkldnn_plugin/mkldnn_graph_optimizer.h @@ -32,6 +32,7 @@ private: void FuseMVNAndSimpleOperation(MKLDNNGraph &graph); void FuseInterpolateAndSimpleOperation(MKLDNNGraph &graph); void FuseNormalizeL2AndSimpleOperation(MKLDNNGraph &graph); + void FuseReduceAndSimpleOperation(MKLDNNGraph &graph); void DropDoubleReorders(MKLDNNGraph& graph); void FuseConvolutionAndZeroPoints(MKLDNNGraph &graph); diff --git a/inference-engine/src/mkldnn_plugin/mkldnn_node.cpp b/inference-engine/src/mkldnn_plugin/mkldnn_node.cpp index 97169290492..0fda2ab04fb 100644 --- a/inference-engine/src/mkldnn_plugin/mkldnn_node.cpp +++ b/inference-engine/src/mkldnn_plugin/mkldnn_node.cpp @@ -391,9 +391,12 @@ std::string MKLDNNNode::getPrimitiveDescriptorType() { SEARCH_TYPE(reorder); SEARCH_TYPE(jit); SEARCH_TYPE(gemm); + SEARCH_TYPE(brgconv); + SEARCH_TYPE(brgemm); SEARCH_TYPE(ref); SEARCH_TYPE(avx512); + SEARCH_TYPE(amx); SEARCH_TYPE(avx2); SEARCH_TYPE(avx); SEARCH_TYPE(sse42); @@ -521,10 +524,17 @@ void MKLDNNNode::redefineOutputMemory(const std::vector &newOutputSh } for (size_t i = 0; i < outputShapes.size(); i++) { const auto edges = getChildEdgesAtPort(i); - const auto memDesc = getBaseMemDescAtOutputPort(i)->cloneWithNewDims(newOutputShapes[i]); + + // avoid 0D shape incompatible + auto newOutputShape = newOutputShapes[i]; + if (newOutputShape.empty()) { + newOutputShape.push_back(1); + } + + const auto memDesc = getBaseMemDescAtOutputPort(i)->cloneWithNewDims(newOutputShape); const auto &currDesc = edges[0]->getMemory().getDesc(); - if (currDesc.getShape().isStatic() && currDesc.getShape().getStaticDims() == newOutputShapes[i]) + if (currDesc.getShape().isStatic() && currDesc.getShape().getStaticDims() == newOutputShape) continue; // this path neccesary if there are several edges per one port @@ -838,6 +848,14 @@ void MKLDNNNode::cleanup() { const std::vector& MKLDNNNode::getPrimitivesPriority() { std::vector priorities = { impl_desc_type::unknown, + impl_desc_type::brgconv_avx512_amx_1x1, + impl_desc_type::brgconv_avx512_amx, + impl_desc_type::jit_avx512_amx_dw, + impl_desc_type::jit_avx512_amx_1x1, + impl_desc_type::jit_avx512_amx, + // Brgconv kernels disabled in order to prevent perf degradations on non AMX HW +// impl_desc_type::brgconv_avx512_1x1, +// impl_desc_type::brgconv_avx512, impl_desc_type::jit_uni_dw, impl_desc_type::jit_uni_1x1, impl_desc_type::jit_uni, @@ -1285,6 +1303,19 @@ bool MKLDNNNode::inputShapesDefined() const { return true; } +bool MKLDNNNode::outputShapesDefined() const { + for (size_t i = 0; i < outputShapes.size(); i++) { + if (!getChildEdgesAtPort(i)[0]->getMemory().getDesc().isDefined()) { + return false; + } + } + return true; +} + +bool MKLDNNNode::shapesDefined() const { + return inputShapesDefined() && outputShapesDefined(); +} + bool MKLDNNNode::needPrepareParams() const { return inputShapesModified(); } diff --git a/inference-engine/src/mkldnn_plugin/mkldnn_node.h b/inference-engine/src/mkldnn_plugin/mkldnn_node.h index 0747a642e40..6406101a878 100644 --- a/inference-engine/src/mkldnn_plugin/mkldnn_node.h +++ b/inference-engine/src/mkldnn_plugin/mkldnn_node.h @@ -707,6 +707,8 @@ protected: bool isDynamic = false; bool inputShapesDefined() const; + bool outputShapesDefined() const; + bool shapesDefined() const; void updateLastInputDims(); bool inputShapesModified() const; diff --git a/inference-engine/src/mkldnn_plugin/mkldnn_plugin.cpp b/inference-engine/src/mkldnn_plugin/mkldnn_plugin.cpp index 5b99b3ab14f..2be7158a929 100644 --- a/inference-engine/src/mkldnn_plugin/mkldnn_plugin.cpp +++ b/inference-engine/src/mkldnn_plugin/mkldnn_plugin.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -70,6 +71,7 @@ #include #include #include +#include #include #include #include @@ -313,7 +315,35 @@ static void TransformationUpToCPUSpecificOpSet(std::shared_ptr for (size_t i = 0; i < node->get_output_size(); i++) { const auto outputs = node->get_output_target_inputs(i); for (const auto &out : outputs) { - if (out.get_node()->get_type_info() != ngraph::op::v0::Result::get_type_info_static()) { + if (!ngraph::op::is_output(out.get_node())) { + return false; + } + } + } + return true; + }); + + // TODO [DS NMS]: remove when nodes from models where nms is not last node in model supports DS + pass_config->set_callback( + [](const_node_ptr &node) -> bool { + for (size_t i = 0; i < node->get_output_size(); i++) { + const auto outputs = node->get_output_target_inputs(i); + for (const auto &out : outputs) { + if (!ngraph::op::is_output(out.get_node())) { + return false; + } + } + } + return true; + }); + + // TODO [DS NMS]: remove when nodes from models where nms is not last node in model supports DS + pass_config->set_callback( + [](const_node_ptr &node) -> bool { + for (size_t i = 0; i < node->get_output_size(); i++) { + const auto outputs = node->get_output_target_inputs(i); + for (const auto &out : outputs) { + if (!ngraph::op::is_output(out.get_node())) { return false; } } @@ -337,6 +367,10 @@ static void TransformationUpToCPUSpecificOpSet(std::shared_ptr pass_config->disable(); pass_config->disable(); pass_config->disable(); + pass_config->disable(); + pass_config->disable(); + pass_config->disable(); + pass_config->disable(); pass_config->enable(); pass_config->enable(); diff --git a/inference-engine/src/mkldnn_plugin/ngraph_transformations/convert_to_cpu_specific_opset.hpp b/inference-engine/src/mkldnn_plugin/ngraph_transformations/convert_to_cpu_specific_opset.hpp index d8c997d2746..3118d3457e7 100644 --- a/inference-engine/src/mkldnn_plugin/ngraph_transformations/convert_to_cpu_specific_opset.hpp +++ b/inference-engine/src/mkldnn_plugin/ngraph_transformations/convert_to_cpu_specific_opset.hpp @@ -32,7 +32,6 @@ inline void ConvertToCPUSpecificOpset(std::shared_ptr &nGraphF manager.register_pass(); manager.register_pass(); manager.register_pass(); - manager.register_pass(); manager.register_pass(); manager.register_pass(); manager.register_pass(); diff --git a/inference-engine/src/mkldnn_plugin/nodes/common/tile_broadcast_utils.cpp b/inference-engine/src/mkldnn_plugin/nodes/common/tile_broadcast_utils.cpp new file mode 100644 index 00000000000..d93a25196c6 --- /dev/null +++ b/inference-engine/src/mkldnn_plugin/nodes/common/tile_broadcast_utils.cpp @@ -0,0 +1,243 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "tile_broadcast_utils.h" + +#include "cpu_memcpy.h" +#include "ie_parallel.hpp" +#include +#include "memory_desc/dnnl_blocked_memory_desc.h" + +using namespace InferenceEngine; +using namespace MKLDNNPlugin; + +VectorDims TileBroadcastCommon::calculateDenseStrides(const VectorDims &dims) { + VectorDims strides(dims.size(), 1); + + for (int i = strides.size() - 2; i >= 0; i--) { + strides[i] = strides[i + 1] * dims[i + 1]; + } + + return strides; +} + +void TileBroadcastCommon::fillOptimizedDimsAndSrcStrides(const VectorDims& srcBlockedDims, const VectorDims& blockedRepeats, + VectorDims& optimizedDims, VectorDims& optimizedSrcStrides) { + optimizedDims.clear(); + optimizedSrcStrides.clear(); + VectorDims srcBlockedStrides = calculateDenseStrides(srcBlockedDims); + + for (int i = 0; i < srcBlockedDims.size(); i++) { + optimizedDims.push_back(blockedRepeats[i]); + optimizedDims.push_back(srcBlockedDims[i]); + optimizedSrcStrides.push_back(0); + optimizedSrcStrides.push_back(srcBlockedStrides[i]); + } + + int i = 1; + while (i < optimizedDims.size() - 1) { + if (optimizedDims[i] == 1) { + optimizedDims[i + 1] *= optimizedDims[i - 1]; + optimizedDims.erase(optimizedDims.begin() + i - 1, optimizedDims.begin() + i + 1); + optimizedSrcStrides.erase(optimizedSrcStrides.begin() + i - 1, optimizedSrcStrides.begin() + i + 1); + } else { + i++; + } + } + + if (optimizedDims[0] == 1 && optimizedDims.size() > 1) { + optimizedDims.erase(optimizedDims.begin()); + optimizedSrcStrides.erase(optimizedSrcStrides.begin()); + } + + if (optimizedDims[optimizedDims.size() - 1] == 1 && optimizedDims.size() > 1) { + optimizedDims.erase(optimizedDims.end() - 1); + optimizedSrcStrides.erase(optimizedSrcStrides.end() - 1); + } +} + +bool TileBroadcastCommon::canBeExecutedInBlockedLayout(VectorDims srcBlockedDims, VectorDims blockedRepeats, + const size_t elemsInBlock) { + if (srcBlockedDims.empty() || blockedRepeats.empty() || elemsInBlock == 0lu || srcBlockedDims[1] == Shape::UNDEFINED_DIM || + (blockedRepeats[1] != 1 && srcBlockedDims[1] % elemsInBlock != 0)) + return false; + + srcBlockedDims[1] = div_up(srcBlockedDims[1], elemsInBlock); + srcBlockedDims.push_back(elemsInBlock); + blockedRepeats.push_back(1); + + VectorDims optimizedDims, optimizedSrcStrides; + fillOptimizedDimsAndSrcStrides(srcBlockedDims, blockedRepeats, optimizedDims, optimizedSrcStrides); + + constexpr size_t maxNDims = 6lu; + return optimizedDims.size() <= maxNDims; +} + +bool TileBroadcastCommon::canBeExecutedInNSPCLayout(VectorDims srcBlockedDims, VectorDims blockedRepeats) { + srcBlockedDims.push_back(srcBlockedDims[1]); + srcBlockedDims.erase(srcBlockedDims.begin() + 1); + blockedRepeats.push_back(blockedRepeats[1]); + blockedRepeats.erase(blockedRepeats.begin() + 1); + + VectorDims optimizedDims, optimizedSrcStrides; + fillOptimizedDimsAndSrcStrides(srcBlockedDims, blockedRepeats, optimizedDims, optimizedSrcStrides); + + constexpr size_t maxNDims = 6lu; + return optimizedDims.size() <= maxNDims; +} + +std::vector TileBroadcastCommon::getSupportedConfigs(const MKLDNNNode *node) { + std::vector supportedPrimitiveDescriptors; + auto precision = node->getOriginalInputPrecisionAtPort(0); + auto dataType = MKLDNNExtensionUtils::IEPrecisionToDataType(precision); + + const auto& srcDims = node->getInputShapeAtPort(0).getDims(); + const auto& inDataShape = node->getInputShapeAtPort(0); + size_t outDataShapeRank = node->getOutputShapeAtPort(0).getRank(); + + NodeConfig config; + if (repeats.size() != outDataShapeRank && !repeats.empty()) + IE_THROW() << node->getTypeStr() << " node with name " << node->getName() << " has incorrect Repeats vector." + "Repeats rank must be equal to output shape rank. Repeats rank: " << repeats.size() << ", output shape rank: " << outDataShapeRank; + + config.dynBatchSupport = false; + config.inConfs.resize(node->getParentEdges().size()); + config.inConfs[0].inPlace = -1; + config.inConfs[0].constant = constMap[0]; + config.inConfs[1].inPlace = -1; + config.inConfs[1].constant = constMap[1]; + config.inConfs[1].desc = std::make_shared(Precision::I32, node->getInputShapeAtPort(1)); + if (config.inConfs.size() == 3) { + config.inConfs[2].inPlace = -1; + config.inConfs[2].constant = constMap[2]; + config.inConfs[2].desc = std::make_shared(Precision::I32, node->getInputShapeAtPort(2)); + } + + config.outConfs.resize(node->getChildEdges().size()); + + auto pushDesc = [&](mkldnn::memory::format_tag inFormat, mkldnn::memory::format_tag outFormat) { + config.inConfs[0].desc = std::make_shared(node->getInputShapeAtPort(0), dataType, inFormat); + for (int i = 0; i < config.outConfs.size(); i++) { + config.outConfs[i].inPlace = -1; + config.outConfs[i].constant = false; + config.outConfs[i].desc = std::make_shared(node->getOutputShapeAtPort(0), dataType, outFormat); + } + supportedPrimitiveDescriptors.push_back({config, impl_desc_type::ref}); + }; + + if (!repeats.empty() && inDataShape.getRank() == outDataShapeRank && (outDataShapeRank == 4 || outDataShapeRank == 5)) { + if (canBeExecutedInBlockedLayout(srcDims, repeats, 16)) { + if (outDataShapeRank == 4) { + pushDesc(mkldnn::memory::format_tag::nChw16c, mkldnn::memory::format_tag::nChw16c); + } else { + pushDesc(mkldnn::memory::format_tag::nCdhw16c, mkldnn::memory::format_tag::nCdhw16c); + } + } + if (canBeExecutedInBlockedLayout(srcDims, repeats, 8)) { + if (outDataShapeRank == 4) { + pushDesc(mkldnn::memory::format_tag::nChw8c, mkldnn::memory::format_tag::nChw8c); + } else { + pushDesc(mkldnn::memory::format_tag::nCdhw8c, mkldnn::memory::format_tag::nCdhw8c); + } + } + if (canBeExecutedInNSPCLayout(srcDims, repeats)) { + if (outDataShapeRank == 4) { + pushDesc(mkldnn::memory::format_tag::nhwc, mkldnn::memory::format_tag::nhwc); + } else { + pushDesc(mkldnn::memory::format_tag::ndhwc, mkldnn::memory::format_tag::ndhwc); + } + } + } + + auto inFmt = MKLDNNExtensionUtils::GetPlainFormatByRank(inDataShape.getRank()); + auto outFmt = MKLDNNExtensionUtils::GetPlainFormatByRank(outDataShapeRank); + if (inFmt == mkldnn::memory::format_tag::undef || outFmt == mkldnn::memory::format_tag::undef) { + config.inConfs[0].desc = std::make_shared(precision, node->getInputShapeAtPort(0)); + for (int i = 0; i < config.outConfs.size(); i++) { + config.outConfs[i].inPlace = -1; + config.outConfs[i].constant = false; + config.outConfs[i].desc = std::make_shared(precision, node->getOutputShapeAtPort(i)); + } + supportedPrimitiveDescriptors.push_back({config, impl_desc_type::ref}); + } else { + pushDesc(inFmt, outFmt); + } + + return supportedPrimitiveDescriptors; +} + +bool TileBroadcastCommon::prepareOptimizedParams(const MKLDNNNode *node, VectorDims& srcBlockedDims, VectorDims& dstBlockedDims) { + while (srcBlockedDims.size() < dstBlockedDims.size()) { + srcBlockedDims.insert(srcBlockedDims.begin(), 1); + } + + VectorDims blockedRepeats = repeats; + // for nC(d)hw16c and nC(d)hw8c layouts + while (blockedRepeats.size() < dstBlockedDims.size()) { + blockedRepeats.push_back(1); + } + // for NSPC layouts + if (node->getBaseMemDescAtInputPort(0)->hasLayoutType(LayoutType::nspc) && one_of(node->getBaseMemDescAtInputPort(0)->getShape().getRank(), 4, 5)) { + blockedRepeats.push_back(blockedRepeats[1]); + blockedRepeats.erase(blockedRepeats.begin() + 1); + } + + VectorDims optimizedDims, optimizedSrcStrides; + fillOptimizedDimsAndSrcStrides(srcBlockedDims, blockedRepeats, optimizedDims, optimizedSrcStrides); + + constexpr size_t maxNDims = 6lu; + if (optimizedDims.size() > maxNDims) + return false; + + while (optimizedDims.size() < maxNDims) { + optimizedDims.insert(optimizedDims.begin(), 1); + optimizedSrcStrides.insert(optimizedSrcStrides.begin(), 1); + } + + VectorDims optimizedDstStrides = calculateDenseStrides(optimizedDims); + + size_t dataSize = node->getSelectedPrimitiveDescriptor()->getConfig().inConfs[0].desc->getPrecision().size(); + for (int i = 0; i < optimizedDims.size(); i++) { + optimizedSrcStrides[i] *= dataSize; + optimizedDstStrides[i] *= dataSize; + } + + optimizedParams.dims = optimizedDims; + optimizedParams.srcStrides = optimizedSrcStrides; + optimizedParams.dstStrides = optimizedDstStrides; + optimizedParams.copySize = optimizedDims[5] * dataSize; + + return true; +} + +void TileBroadcastCommon::optimizedExecute(const MKLDNNMemoryPtr& srcMemory, const MKLDNNMemoryPtr& dstMemory) { + auto srcData = reinterpret_cast(srcMemory->GetPtr()); + auto dstData = reinterpret_cast(dstMemory->GetPtr()); + + if (optimizedParams.srcStrides[5] == 0) { + parallel_for5d(optimizedParams.dims[0], optimizedParams.dims[1], optimizedParams.dims[2], optimizedParams.dims[3], optimizedParams.dims[4], + [&](int i0, int i1, int i2, int i3, int i4) { + auto srcData2 = srcData + (i0 * optimizedParams.srcStrides[0] + i1 * optimizedParams.srcStrides[1] + + i2 * optimizedParams.srcStrides[2] + i3 * optimizedParams.srcStrides[3] + + i4 * optimizedParams.srcStrides[4]); + auto dstData2 = dstData + (i0 * optimizedParams.dstStrides[0] + i1 * optimizedParams.dstStrides[1] + + i2 * optimizedParams.dstStrides[2] + i3 * optimizedParams.dstStrides[3] + + i4 * optimizedParams.dstStrides[4]); + for (int i = 0; i < optimizedParams.dims[5]; i++) { + cpu_memcpy(dstData2 + i * optimizedParams.dstStrides[5], srcData2, optimizedParams.dstStrides[5]); + } + }); + } else { + parallel_for5d(optimizedParams.dims[0], optimizedParams.dims[1], optimizedParams.dims[2], optimizedParams.dims[3], optimizedParams.dims[4], + [&](int i0, int i1, int i2, int i3, int i4) { + auto srcData2 = srcData + (i0 * optimizedParams.srcStrides[0] + i1 * optimizedParams.srcStrides[1] + + i2 * optimizedParams.srcStrides[2] + i3 * optimizedParams.srcStrides[3] + + i4 * optimizedParams.srcStrides[4]); + auto dstData2 = dstData + (i0 * optimizedParams.dstStrides[0] + i1 * optimizedParams.dstStrides[1] + + i2 * optimizedParams.dstStrides[2] + i3 * optimizedParams.dstStrides[3] + + i4 * optimizedParams.dstStrides[4]); + cpu_memcpy(dstData2, srcData2, optimizedParams.copySize); + }); + } +} diff --git a/inference-engine/src/mkldnn_plugin/nodes/common/tile_broadcast_utils.h b/inference-engine/src/mkldnn_plugin/nodes/common/tile_broadcast_utils.h new file mode 100644 index 00000000000..e5a60c81a08 --- /dev/null +++ b/inference-engine/src/mkldnn_plugin/nodes/common/tile_broadcast_utils.h @@ -0,0 +1,43 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include "mkldnn_node.h" + +#include +#include + + +namespace MKLDNNPlugin { + +class TileBroadcastCommon { +protected: + static VectorDims calculateDenseStrides(const VectorDims &dims); + std::vector getSupportedConfigs(const MKLDNNNode *node); + bool prepareOptimizedParams(const MKLDNNNode *node, VectorDims& srcBlockedDims, VectorDims& dstBlockedDims); + + void optimizedExecute(const MKLDNNMemoryPtr& srcMemory, const MKLDNNMemoryPtr& dstMemory); + + VectorDims repeats; + bool optimizedCase = false; + bool constMap[3] = { false }; + mutable bool needPrepareParamsVar = false; + +private: + static void fillOptimizedDimsAndSrcStrides(const VectorDims &srcBlockedDims, const VectorDims &blockedRepeats, + VectorDims &optimizedDims, VectorDims &optimizedSrcStrides); + + static bool canBeExecutedInBlockedLayout(VectorDims srcDims, VectorDims repeats, const size_t elemsInBlock); + static bool canBeExecutedInNSPCLayout(VectorDims srcDims, VectorDims repeats); + + struct { + VectorDims dims; + VectorDims srcStrides; + VectorDims dstStrides; + size_t copySize; + } optimizedParams; +}; + +} // namespace MKLDNNPlugin diff --git a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_adaptive_pooling.cpp b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_adaptive_pooling.cpp index 20819bdd448..7cad050c49a 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_adaptive_pooling.cpp +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_adaptive_pooling.cpp @@ -23,10 +23,6 @@ using namespace mkldnn::impl::cpu::x64; bool MKLDNNAdaptivePoolingNode::isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept { try { - if (isDynamicNgraphNode(op)) { - errorMessage = "Doesn't support op with dynamic shapes"; - return false; - } if (one_of(op->get_type_info(), ngraph::op::v8::AdaptiveAvgPool::get_type_info_static())) { auto adaPool = std::dynamic_pointer_cast(op); if (!adaPool) { @@ -63,6 +59,7 @@ MKLDNNAdaptivePoolingNode::MKLDNNAdaptivePoolingNode(const std::shared_ptr(getParentEdgesAtPort(1)[0]->getMemoryPtr()->GetPtr()); + for (size_t i = 0; i < spatialDimsCount; i++) { + if (spatialDimsValue[i] != newSpatialDimsPtr[i]) + return true; + } + return MKLDNNNode::needShapeInfer(); +} + +std::vector MKLDNNAdaptivePoolingNode::shapeInfer() const { + const auto inputDims = getParentEdgesAtPort(0)[0]->getMemory().GetShape().getStaticDims(); + const auto spatialDims = getParentEdgesAtPort(1)[0]->getMemory().GetShape().getStaticDims(); + const auto inputRank = inputDims.size(); + const auto spatialDimsSize = spatialDims[0]; + + VectorDims outputDims(inputRank); + outputDims[0] = inputDims[0]; + outputDims[1] = inputDims[1]; + auto newSpatialDimsPtr = reinterpret_cast(getParentEdgesAtPort(1)[0]->getMemoryPtr()->GetPtr()); + for (size_t i = 0; i < spatialDimsSize; i++) { + outputDims[i + 2] = newSpatialDimsPtr[i]; + spatialDimsValue[i] = newSpatialDimsPtr[i]; + } + + std::vector result = {}; + result.resize(outputShapes.size(), outputDims); + return result; +} + void MKLDNNAdaptivePoolingNode::initSupportedPrimitiveDescriptors() { if (!supportedPrimitiveDescriptors.empty()) return; @@ -104,7 +127,8 @@ void MKLDNNAdaptivePoolingNode::initSupportedPrimitiveDescriptors() { config.outConfs.resize((algorithm == Algorithm::AdaptivePoolingAvg ? 1 : 2)); std::vector dataFormats{ LayoutType::ncsp }; - if (getInputShapeAtPort(0).getStaticDims()[1] != 1) { + const auto &inDims = getInputShapeAtPort(0).getDims(); + if (inDims[1] != Shape::UNDEFINED_DIM && inDims[1] != 1) { dataFormats.push_back(LayoutType::nspc); dataFormats.push_back(LayoutType::nCsp16c); dataFormats.push_back(LayoutType::nCsp8c); diff --git a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_adaptive_pooling.h b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_adaptive_pooling.h index 77a7e14d87a..c47740e75ec 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_adaptive_pooling.h +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_adaptive_pooling.h @@ -26,10 +26,17 @@ public: private: int spatialDimsCount; + mutable std::vector spatialDimsValue = {}; InferenceEngine::Precision precision = InferenceEngine::Precision::FP32; inline void setBinBorders(size_t *startPtr, size_t *endPtr, size_t idx, size_t inputLength, size_t outputLength); std::string errorPrefix; + +protected: + bool needShapeInfer() const override; + std::vector shapeInfer() const override; + bool needPrepareParams() const override { return false; }; + void executeDynamicImpl(mkldnn::stream strm) override { execute(strm); }; }; } // namespace MKLDNNPlugin diff --git a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_broadcast_node.cpp b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_broadcast_node.cpp index 3b5b561cff3..2930fb71c25 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_broadcast_node.cpp +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_broadcast_node.cpp @@ -17,23 +17,27 @@ using namespace MKLDNNPlugin; using namespace InferenceEngine; -bool MKLDNNBroadcastNode::isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept { +bool MKLDNNBroadcastNode::isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept { try { - if (isDynamicNgraphNode(op)) { - errorMessage = "Doesn't support op with dynamic shapes"; + if (!ov::is_type(op)) { + errorMessage = "Only Broadcast operations from opset1 are supported."; return false; } - const auto broadcast = std::dynamic_pointer_cast(op); - if (!broadcast) { - errorMessage = "Only opset1 Broadcast operation is supported"; + if (!one_of(ov::as_type_ptr(op)->get_broadcast_spec().m_type, + ov::op::AutoBroadcastType::NUMPY, ov::op::AutoBroadcastType::EXPLICIT)) { + errorMessage = "Only NUMPY and EXPLICIT broadcast types are supported."; return false; } - if (broadcast->get_broadcast_spec() != ngraph::op::AutoBroadcastType::NUMPY) { - errorMessage = "Only NUMPY broadcast type is supported"; + if (op->get_input_partial_shape(TARGET_SHAPE_IDX).is_dynamic() || + (op->get_input_size() > AXES_MAPPING_IDX && op->get_input_partial_shape(AXES_MAPPING_IDX).is_dynamic())) { + errorMessage = "Only static shapes are supported for target shape and axes mapping inputs."; return false; } - if (std::dynamic_pointer_cast(broadcast->get_input_node_shared_ptr(BROADCAST_SHAPE)) == nullptr) { - errorMessage = "Only const 'shape' input is supported"; + if (!isDynamicNgraphNode(op) && + (!ov::is_type(op->get_input_node_ptr(TARGET_SHAPE_IDX)) || + (op->get_input_size() > AXES_MAPPING_IDX && + !ov::is_type(op->get_input_node_ptr(AXES_MAPPING_IDX))))) { + errorMessage = "Only constant target shapes and axis mapping inputs are supported for static shapes."; return false; } } catch (...) { @@ -42,91 +46,231 @@ bool MKLDNNBroadcastNode::isSupportedOperation(const std::shared_ptr& op, const mkldnn::engine& eng, +MKLDNNBroadcastNode::MKLDNNBroadcastNode(const std::shared_ptr& op, const mkldnn::engine& eng, MKLDNNWeightsSharing::Ptr &cache) : MKLDNNNode(op, eng, cache) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { IE_THROW(NotImplemented) << errorMessage; } - errorPrefix = "Broadcast node with name '" + op->get_friendly_name() + "'"; - if (op->get_input_size() != 2 || op->get_output_size() != 1) - IE_THROW() << errorPrefix << " has incorrect number of input/output edges! " << op->get_input_size() << "->" << op->get_output_size(); + errorPrefix = "Broadcast node with name '" + op->get_friendly_name() + "' "; + if (op->get_input_size() != 2 && op->get_input_size() != 3) + IE_THROW() << errorPrefix << "has incorrect number of input edges: " << getParentEdges().size(); + if (op->get_output_size() == 0) + IE_THROW() << errorPrefix << "has no output edges."; - SizeVector shape_dims = op->get_input_shape(BROADCAST_SHAPE); - if (shape_dims.size() > 1) - IE_THROW() << errorPrefix << " has incorrect 'shape' input rank: " << shape_dims.size(); + auto broadcastOp = ov::as_type_ptr(op); + if (broadcastOp->get_broadcast_spec().m_type == ov::op::AutoBroadcastType::NUMPY) { + broadcastType = NUMPY; + } else if (broadcastOp->get_broadcast_spec().m_type == ov::op::AutoBroadcastType::EXPLICIT) { + if (op->get_input_size() <= AXES_MAPPING_IDX) + IE_THROW() << errorPrefix << " and EXPLICIT mode must have tree input edges: " << getParentEdges().size(); + broadcastType = EXPLICIT; + } + + if (ov::is_type(op->get_input_node_ptr(TARGET_SHAPE_IDX))) { + constMap[TARGET_SHAPE_IDX] = true; + targetShape = (ov::as_type(op->get_input_node_ptr(TARGET_SHAPE_IDX)))->get_vector(); + } + if (broadcastType == EXPLICIT && + ov::is_type(op->get_input_node_ptr(AXES_MAPPING_IDX))) { + constMap[AXES_MAPPING_IDX] = true; + axesMapping = ov::as_type(op->get_input_node_ptr(AXES_MAPPING_IDX))->get_vector(); + } +} + +void MKLDNNBroadcastNode::getSupportedDescriptors() { + if (!isDynamicNode()) { + const auto& srcDims = getInputShapeAtPort(INPUT_DATA_IDX).getDims(); + repeats.assign(targetShape.begin(), targetShape.end()); + const auto ndims = repeats.size(); + + if (broadcastType == NUMPY) { + for (size_t i = 0lu; i < srcDims.size(); i++) { + repeats[ndims - 1lu - i] /= srcDims[srcDims.size() - 1lu - i]; + } + } else if (broadcastType == EXPLICIT) { + for (size_t i = 0lu; i < axesMapping.size(); i++) { + repeats[axesMapping[i]] /= srcDims[i]; + } + } + needPrepareParamsVar = true; + } } void MKLDNNBroadcastNode::initSupportedPrimitiveDescriptors() { if (!supportedPrimitiveDescriptors.empty()) return; - Precision prec = getOriginalInputPrecisionAtPort(BROADCAST_INPUT); + supportedPrimitiveDescriptors = getSupportedConfigs(this); +} - addSupportedPrimDesc({{LayoutType::ncsp, prec}, - {LayoutType::ncsp, Precision::I32}}, - {{LayoutType::ncsp, prec}}, - impl_desc_type::ref_any); +void MKLDNNBroadcastNode::createPrimitive() { + if (inputShapesDefined()) { + if (needPrepareParams()) + prepareParams(); + updateLastInputDims(); + } +} + +bool MKLDNNBroadcastNode::needPrepareParams() const { + return needPrepareParamsVar; +} + +void MKLDNNBroadcastNode::prepareParams() { + if (!constMap[TARGET_SHAPE_IDX]) { + const auto& targetShapeMem = getParentEdgesAtPort(TARGET_SHAPE_IDX)[0]->getMemory(); + const int32_t* targetShapeData = reinterpret_cast(targetShapeMem.GetPtr()); + targetShape.assign(targetShapeData, targetShapeData + targetShapeMem.getStaticDims()[0]); + } + if (broadcastType == EXPLICIT && !constMap[AXES_MAPPING_IDX]) { + const auto& axesMapMem = getParentEdgesAtPort(AXES_MAPPING_IDX)[0]->getMemory(); + const int32_t* axesMapData = reinterpret_cast(axesMapMem.GetPtr()); + axesMapping.assign(axesMapData, axesMapData + axesMapMem.getStaticDims()[0]); + } + + const auto& srcDims = getParentEdgesAtPort(INPUT_DATA_IDX)[0]->getMemory().GetShape().getStaticDims(); + repeats.assign(targetShape.begin(), targetShape.end()); + const auto ndims = repeats.size(); + + auto srcBlockedDims = getParentEdgeAt(INPUT_DATA_IDX)->getMemory().GetDescWithType()->getBlockDims(); + auto dstBlockedDims = getChildEdgeAt(0)->getMemory().GetDescWithType()->getBlockDims(); + + if (broadcastType == NUMPY) { + for (size_t i = 0lu; i < srcDims.size(); i++) { + repeats[ndims - 1lu - i] /= srcDims[srcDims.size() - 1lu - i]; + } + } else if (broadcastType == EXPLICIT) { + for (size_t i = 0; i < getInputShapeAtPort(AXES_MAPPING_IDX).getDims()[0]; i++) { + repeats[axesMapping[i]] /= srcDims[i]; + } + + SizeVector newSrcBlockedDims = SizeVector(dstBlockedDims.size(), 1); + for (size_t i = 0; i < getInputShapeAtPort(AXES_MAPPING_IDX).getDims()[0]; i++) { + newSrcBlockedDims[axesMapping[i]] = srcBlockedDims[i]; + } + srcBlockedDims = newSrcBlockedDims; + } + + optimizedCase = prepareOptimizedParams(this, srcBlockedDims, dstBlockedDims); +} + +bool MKLDNNBroadcastNode::needShapeInfer() const { + needPrepareParamsVar = true; + if (inputShapesModified()) { + return true; + } + + if (!constMap[TARGET_SHAPE_IDX]) { + if (targetShape.empty()) { + return true; + } + const int32_t* targetShapeData = reinterpret_cast(getParentEdgesAtPort(TARGET_SHAPE_IDX)[0]->getMemory().GetPtr()); + for (size_t i = 0lu; i < targetShape.size(); i++) { + if (targetShape[i] != targetShapeData[i]) { + return true; + } + } + } + if (broadcastType == EXPLICIT && !constMap[AXES_MAPPING_IDX]) { + if (axesMapping.empty()) { + return true; + } + const int32_t* axesMappingData = reinterpret_cast(getParentEdgesAtPort(AXES_MAPPING_IDX)[0]->getMemory().GetPtr()); + for (size_t i = 0lu; i < axesMapping.size(); i++) { + if (axesMapping[i] != axesMappingData[i]) { + return true; + } + } + } + needPrepareParamsVar = false; + return false; +} + +std::vector MKLDNNBroadcastNode::shapeInfer() const { + ngraph::OutputVector inputsForShapeInfer { + std::make_shared(opToShapeInfer->get_input_element_type(INPUT_DATA_IDX), + getParentEdgesAtPort(INPUT_DATA_IDX)[0]->getMemory().GetShape().toPartialShape()), + std::make_shared(ov::element::Type_t::i32, + getParentEdgesAtPort(TARGET_SHAPE_IDX)[0]->getMemory().GetShape().getStaticDims(), + getParentEdgesAtPort(TARGET_SHAPE_IDX)[0]->getMemory().GetPtr()) + }; + if (opToShapeInfer->get_input_size() > AXES_MAPPING_IDX) { + inputsForShapeInfer.push_back(std::make_shared(ov::element::Type_t::i32, + getParentEdgesAtPort(AXES_MAPPING_IDX)[0]->getMemory().GetShape().getStaticDims(), + getParentEdgesAtPort(AXES_MAPPING_IDX)[0]->getMemory().GetPtr())); + } + const auto localShapeInferOp = opToShapeInfer->clone_with_new_inputs(inputsForShapeInfer); + + localShapeInferOp->validate_and_infer_types(); + + std::vector newOutputShapes(outputShapes.size()); + for (size_t i = 0lu; i < newOutputShapes.size(); i++) { + const auto &partShape = localShapeInferOp->get_output_partial_shape(i); + newOutputShapes[i] = partShape.get_shape(); + } + + return newOutputShapes; } void MKLDNNBroadcastNode::execute(mkldnn::stream strm) { - size_t shape_size = (getParentEdgeAt(BROADCAST_SHAPE)->getMemory().getStaticDims())[0]; - SizeVector dst_dims = getChildEdgeAt(0)->getMemory().getStaticDims(); - SizeVector src_dims = getParentEdgeAt(BROADCAST_INPUT)->getMemory().getStaticDims(); + if (optimizedCase) { + optimizedExecute(getParentEdgeAt(INPUT_DATA_IDX)->getMemoryPtr(), getChildEdgeAt(0)->getMemoryPtr()); + } else { + plainExecute(strm); + } +} - auto srcDesc = getParentEdgeAt(BROADCAST_INPUT)->getMemory().GetDescWithType(); - SizeVector srcStrides = srcDesc->getStrides(); - size_t data_size = srcDesc->getPrecision().size(); +void MKLDNNBroadcastNode::plainExecute(mkldnn::stream strm) { + VectorDims srcDims = getParentEdgeAt(INPUT_DATA_IDX)->getMemory().getStaticDims(); + const auto& dstDims = getChildEdgeAt(0)->getMemory().getStaticDims(); + const auto& dataSrcRank = getParentEdgeAt(INPUT_DATA_IDX)->getMemory().GetShape().getRank(); + const auto& dataDstRank = getChildEdgeAt(0)->getMemory().GetShape().getRank(); - if (!src_dims.size()) - src_dims = SizeVector(1, 1); + auto srcDesc = getParentEdgeAt(INPUT_DATA_IDX)->getMemory().GetDescWithType(); + VectorDims srcStrides = srcDesc->getStrides(); + const size_t dataSize = srcDesc->getPrecision().size(); + + if (!dataSrcRank) + srcDims = VectorDims(1, 1); if (!srcStrides.size()) - srcStrides = SizeVector(1, 1); - - if (dst_dims.size() != shape_size) { - IE_THROW() << "Output tensor dimension mismatch"; - } - - if (src_dims.size() > dst_dims.size()) { - IE_THROW() << "Output tensor dimension is smaller then input tensor dimension"; - } + srcStrides = VectorDims(1, 1); auto dstDesc = getChildEdgeAt(0)->getMemory().GetDescWithType(); - InferenceEngine::SizeVector dstStrides = dstDesc->getStrides(); - InferenceEngine::SizeVector src_aligned(dst_dims.size()); - InferenceEngine::SizeVector srcStrides_aligned(dst_dims.size()); - size_t prefix_size = dst_dims.size() - src_dims.size(); - for (size_t i = 0; i < dst_dims.size(); i++) { - if (i < prefix_size) { - src_aligned[i] = 1; - srcStrides_aligned[i] = srcStrides[0]; + VectorDims dstStrides = dstDesc->getStrides(); + VectorDims srcAligned(dataDstRank); + VectorDims srcStridesAligned(dataDstRank); + const size_t prefixSize = dataDstRank - dataSrcRank; + for (size_t i = 0lu; i < dataDstRank; i++) { + if (i < prefixSize) { + srcAligned[i] = 1; + srcStridesAligned[i] = srcStrides[0]; } else { - src_aligned[i] = src_dims[i - prefix_size]; - srcStrides_aligned[i] = srcStrides[i - prefix_size]; + srcAligned[i] = srcDims[i - prefixSize]; + srcStridesAligned[i] = srcStrides[i - prefixSize]; } } - size_t work_amount_dst = dstStrides[0] * dst_dims[0]; - const auto *src_data = reinterpret_cast(getParentEdgeAt(BROADCAST_INPUT)->getMemoryPtr()->GetPtr()); - auto *dst_data = reinterpret_cast(getChildEdgeAt(0)->getMemoryPtr()->GetPtr()); + const size_t workAmountDst = dstStrides[0] * dstDims[0]; + const auto *srcData = reinterpret_cast(getParentEdgeAt(INPUT_DATA_IDX)->getMemoryPtr()->GetPtr()); + auto *dstData = reinterpret_cast(getChildEdgeAt(0)->getMemoryPtr()->GetPtr()); parallel_nt(0, [&](const int ithr, const int nthr) { - size_t i, src_idx, start = 0, end = 0; - SizeVector counters(dst_dims.size(), 0); - splitter(work_amount_dst, nthr, ithr, start, end); - for (int j = dst_dims.size() - 1, i = start; j >= 0; j--) { - counters[j] = i % dst_dims[j]; - i /= dst_dims[j]; + size_t i = 0lu, srcIdx = 0lu, start = 0lu, end = 0lu; + VectorDims counters(dataDstRank, 0); + splitter(workAmountDst, nthr, ithr, start, end); + for (int j = dataDstRank - 1, i = start; j >= 0; j--) { + counters[j] = i % dstDims[j]; + i /= dstDims[j]; } - for (size_t iwork = start * data_size; iwork < end * data_size; iwork += data_size) { - for (i = 0, src_idx = 0; i < dst_dims.size(); ++i) - src_idx += counters[i] ? ((counters[i] % src_aligned[i]) * srcStrides_aligned[i]) : 0; + for (size_t iwork = start * dataSize; iwork < end * dataSize; iwork += dataSize) { + for (i = 0lu, srcIdx = 0lu; i < dataDstRank; ++i) + srcIdx += counters[i] ? ((counters[i] % srcAligned[i]) * srcStridesAligned[i]) : 0; - cpu_memcpy(&dst_data[iwork], &src_data[src_idx * data_size], data_size); + cpu_memcpy(&dstData[iwork], &srcData[srcIdx * dataSize], dataSize); - for (int j = dst_dims.size() - 1; j >= 0; j--) { - counters[j] = (counters[j] + 1) % dst_dims[j]; + for (int j = dataDstRank - 1; j >= 0; j--) { + counters[j] = (counters[j] + 1) % dstDims[j]; if (counters[j] != 0) break; } } diff --git a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_broadcast_node.h b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_broadcast_node.h index 932bded6c7c..4851cf19c9a 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_broadcast_node.h +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_broadcast_node.h @@ -4,29 +4,51 @@ #pragma once -#include -#include -#include +#include "common/tile_broadcast_utils.h" + #include +#include #include + namespace MKLDNNPlugin { -class MKLDNNBroadcastNode : public MKLDNNNode { +class MKLDNNBroadcastNode : public MKLDNNNode, public TileBroadcastCommon { public: - MKLDNNBroadcastNode(const std::shared_ptr& op, const mkldnn::engine& eng, MKLDNNWeightsSharing::Ptr &cache); + MKLDNNBroadcastNode(const std::shared_ptr& op, const mkldnn::engine& eng, MKLDNNWeightsSharing::Ptr &cache); - void getSupportedDescriptors() override {}; + void getSupportedDescriptors() override; void initSupportedPrimitiveDescriptors() override; - void createPrimitive() override {}; + void createPrimitive() override; void execute(mkldnn::stream strm) override; + void executeDynamicImpl(mkldnn::stream strm) override { + execute(strm); + } bool created() const override; - static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; + static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; + +protected: + bool needPrepareParams() const override; + void prepareParams() override; + bool needShapeInfer() const override; + std::vector shapeInfer() const override; private: - static const size_t BROADCAST_INPUT = 0; - static const size_t BROADCAST_SHAPE = 1; + void plainExecute(mkldnn::stream strm); + + enum AutoBroadcastType { + NUMPY, + EXPLICIT + }; + AutoBroadcastType broadcastType; + + static constexpr size_t INPUT_DATA_IDX = 0; + static constexpr size_t TARGET_SHAPE_IDX = 1; + static constexpr size_t AXES_MAPPING_IDX = 2; + + std::vector targetShape; + std::vector axesMapping; std::string errorPrefix; }; diff --git a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_ctc_greedy_decoder_node.cpp b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_ctc_greedy_decoder_node.cpp index bc4e88b3f95..b6881da496f 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_ctc_greedy_decoder_node.cpp +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_ctc_greedy_decoder_node.cpp @@ -14,10 +14,6 @@ using namespace InferenceEngine; bool MKLDNNCTCGreedyDecoderNode::isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept { try { - if (isDynamicNgraphNode(op)) { - errorMessage = "Doesn't support op with dynamic shapes"; - return false; - } const auto greedyDecOp = ngraph::as_type_ptr(op); if (!greedyDecOp) { errorMessage = "Node is not an instance of the CTCGreedyDecoder operation from operation set v0."; @@ -42,8 +38,10 @@ MKLDNNCTCGreedyDecoderNode::MKLDNNCTCGreedyDecoderNode(const std::shared_ptrget_input_shape(DATA_INDEX)[0] != op->get_input_shape(SEQUENCE_LENGTH_INDEX)[0] && - op->get_input_shape(DATA_INDEX)[1] != op->get_input_shape(SEQUENCE_LENGTH_INDEX)[1]) + const auto& dataDims = getInputShapeAtPort(DATA_INDEX).getDims(); + const auto& seqDims = getInputShapeAtPort(SEQUENCE_LENGTH_INDEX).getDims(); + + if (!dimsEqualWeak(dataDims[0], seqDims[0]) || !dimsEqualWeak(dataDims[1], seqDims[1])) IE_THROW() << errorPrefix << "has invalid input shapes."; auto greedyDecOp = ngraph::as_type_ptr(op); @@ -167,4 +165,18 @@ bool MKLDNNCTCGreedyDecoderNode::created() const { return getType() == CTCGreedyDecoder; } +void MKLDNNCTCGreedyDecoderNode::executeDynamicImpl(dnnl::stream strm) { + MKLDNNCTCGreedyDecoderNode::execute(strm); +} + +void MKLDNNCTCGreedyDecoderNode::createPrimitive() { + if (inputShapesDefined()) { + updateLastInputDims(); + } +} + +bool MKLDNNCTCGreedyDecoderNode::needPrepareParams() const { + return false; +} + REG_MKLDNN_PRIM_FOR(MKLDNNCTCGreedyDecoderNode, CTCGreedyDecoder) diff --git a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_ctc_greedy_decoder_node.h b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_ctc_greedy_decoder_node.h index aa42dda6a97..a936d47d75d 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_ctc_greedy_decoder_node.h +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_ctc_greedy_decoder_node.h @@ -15,12 +15,13 @@ public: void getSupportedDescriptors() override {}; void initSupportedPrimitiveDescriptors() override; - void createPrimitive() override {}; + void createPrimitive() override; void execute(mkldnn::stream strm) override; bool created() const override; + void executeDynamicImpl(dnnl::stream strm) override; + bool needPrepareParams() const override; static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; - private: const size_t DATA_INDEX = 0lu; const size_t SEQUENCE_LENGTH_INDEX = 1lu; diff --git a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_ctc_greedy_decoder_seq_len_node.cpp b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_ctc_greedy_decoder_seq_len_node.cpp index ab6a5c79e0a..81e94cee450 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_ctc_greedy_decoder_seq_len_node.cpp +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_ctc_greedy_decoder_seq_len_node.cpp @@ -14,10 +14,6 @@ using namespace InferenceEngine; bool MKLDNNCTCGreedyDecoderSeqLenNode::isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept { try { - if (isDynamicNgraphNode(op)) { - errorMessage = "Doesn't support op with dynamic shapes"; - return false; - } const auto greedyDecOp = ngraph::as_type_ptr(op); if (!greedyDecOp) { errorMessage = "Node is not an instance of the CTCGreedyDecoderSeqLen operation from operation set v6."; @@ -42,7 +38,9 @@ MKLDNNCTCGreedyDecoderSeqLenNode::MKLDNNCTCGreedyDecoderSeqLenNode(const std::sh if (getOriginalOutputsNumber() != 2) IE_THROW() << errorPrefix << "has invalid number of outputs edges: " << getOriginalOutputsNumber(); - if (op->get_input_shape(DATA_INDEX)[0] != op->get_input_shape(SEQUENCE_LENGTH_INDEX)[0]) + const auto& dataDims = getInputShapeAtPort(DATA_INDEX).getDims(); + const auto& seqDims = getInputShapeAtPort(SEQUENCE_LENGTH_INDEX).getDims(); + if (!dimsEqualWeak(dataDims[0], seqDims[0])) IE_THROW() << errorPrefix << "has invalid input shapes."; auto greedyDecOp = ngraph::as_type_ptr(op); @@ -170,4 +168,18 @@ bool MKLDNNCTCGreedyDecoderSeqLenNode::created() const { return getType() == CTCGreedyDecoderSeqLen; } +void MKLDNNCTCGreedyDecoderSeqLenNode::createPrimitive() { + if (inputShapesDefined()) { + updateLastInputDims(); + } +} + +void MKLDNNCTCGreedyDecoderSeqLenNode::executeDynamicImpl(dnnl::stream strm) { + MKLDNNCTCGreedyDecoderSeqLenNode::execute(strm); +} + +bool MKLDNNCTCGreedyDecoderSeqLenNode::needPrepareParams() const { + return false; +} + REG_MKLDNN_PRIM_FOR(MKLDNNCTCGreedyDecoderSeqLenNode, CTCGreedyDecoderSeqLen) diff --git a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_ctc_greedy_decoder_seq_len_node.h b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_ctc_greedy_decoder_seq_len_node.h index 95ef66222c1..023a9e8f409 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_ctc_greedy_decoder_seq_len_node.h +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_ctc_greedy_decoder_seq_len_node.h @@ -15,9 +15,11 @@ public: void getSupportedDescriptors() override {}; void initSupportedPrimitiveDescriptors() override; - void createPrimitive() override {}; + void createPrimitive() override; void execute(mkldnn::stream strm) override; bool created() const override; + void executeDynamicImpl(dnnl::stream strm) override; + bool needPrepareParams() const override; static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; diff --git a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_ctc_loss_node.cpp b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_ctc_loss_node.cpp index d3e0f149c7c..3019cf20e86 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_ctc_loss_node.cpp +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_ctc_loss_node.cpp @@ -13,10 +13,6 @@ using namespace InferenceEngine; bool MKLDNNCTCLossNode::isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept { try { - if (isDynamicNgraphNode(op)) { - errorMessage = "Doesn't support op with dynamic shapes"; - return false; - } const auto ctcLossOp = ngraph::as_type_ptr(op); if (!ctcLossOp) { errorMessage = "Node is not an instance of the CTCLoss operation from operation set v4."; @@ -61,6 +57,14 @@ void MKLDNNCTCLossNode::initSupportedPrimitiveDescriptors() { impl_desc_type::ref_any); } +void MKLDNNCTCLossNode::createPrimitive() { + if (inputShapesDefined()) { + if (needPrepareParams()) + prepareParams(); + updateLastInputDims(); + } +} + void MKLDNNCTCLossNode::execute(mkldnn::stream strm) { StatusCode returnCode = OK; diff --git a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_ctc_loss_node.h b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_ctc_loss_node.h index 8b5a0253b36..b37f4500f3e 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_ctc_loss_node.h +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_ctc_loss_node.h @@ -15,12 +15,15 @@ public: void getSupportedDescriptors() override {}; void initSupportedPrimitiveDescriptors() override; - void createPrimitive() override {}; + void createPrimitive() override; void execute(mkldnn::stream strm) override; bool created() const override; static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; + void executeDynamicImpl(mkldnn::stream strm) override { execute(strm); }; + bool needPrepareParams() const override { return false; }; + private: bool ctcMergeRepeated; bool preprocessCollapseRepeated; diff --git a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_embedding_bag_offset_sum_node.cpp b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_embedding_bag_offset_sum_node.cpp index 0f1c1da89de..86cb02d45d7 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_embedding_bag_offset_sum_node.cpp +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_embedding_bag_offset_sum_node.cpp @@ -13,10 +13,6 @@ using namespace InferenceEngine; bool MKLDNNEmbeddingBagOffsetSumNode::isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept { try { - if (isDynamicNgraphNode(op)) { - errorMessage = "Doesn't support op with dynamic shapes"; - return false; - } const auto embBagOffsetSumOp = ngraph::as_type_ptr(op); if (!embBagOffsetSumOp) { errorMessage = "Node is not an instance of the EmbeddingBagOffsetsSum operation from opset v3."; @@ -35,14 +31,11 @@ MKLDNNEmbeddingBagOffsetSumNode::MKLDNNEmbeddingBagOffsetSumNode(const std::shar IE_THROW(NotImplemented) << errorMessage; } - if (op->get_input_shape(INDICES_IDX).size() != 1) - IE_THROW() << "'" << _layerName << "' layer has indices data with invalid shape."; + if (getInputShapeAtPort(INDICES_IDX).getRank() != 1ul) + IE_THROW() << "'" << _layerName << "' layer has indices data with invalid rank."; - if (op->get_input_shape(OFFSETS_IDX).size() != 1) - IE_THROW() << "'" << _layerName << "' layer's offsets data has invalid shape."; - - _indicesLen = op->get_input_shape(INDICES_IDX)[0]; - _offsetsLen = op->get_input_shape(OFFSETS_IDX)[0]; + if (getInputShapeAtPort(OFFSETS_IDX).getRank() != 1ul) + IE_THROW() << "'" << _layerName << "' layer's offsets data has invalid rank."; } void MKLDNNEmbeddingBagOffsetSumNode::initSupportedPrimitiveDescriptors() { @@ -77,6 +70,20 @@ void MKLDNNEmbeddingBagOffsetSumNode::initSupportedPrimitiveDescriptors() { addSupportedPrimDesc(inDataConfigurators, {{LayoutType::ncsp, inDataPrecision}}, impl_desc_type::ref_any); } +void MKLDNNEmbeddingBagOffsetSumNode::createPrimitive() { + if (inputShapesDefined()) { + if (needPrepareParams()) + prepareParams(); + updateLastInputDims(); + } +} + +void MKLDNNEmbeddingBagOffsetSumNode::prepareParams() { + _indicesLen = getParentEdgesAtPort(INDICES_IDX)[0]->getMemory().getStaticDims()[0]; + _offsetsLen = getParentEdgesAtPort(OFFSETS_IDX)[0]->getMemory().getStaticDims()[0]; + MKLDNNEmbeddingBagSumNode::prepareParams(getParentEdgesAtPort(EMB_TABLE_IDX)[0]->getMemory().getStaticDims()); +} + void MKLDNNEmbeddingBagOffsetSumNode::initFromInputs() { indicesData_ = reinterpret_cast(getParentEdgeAt(INDICES_IDX)->getMemoryPtr()->GetPtr()); offsetsData_ = reinterpret_cast(getParentEdgeAt(OFFSETS_IDX)->getMemoryPtr()->GetPtr()); diff --git a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_embedding_bag_offset_sum_node.h b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_embedding_bag_offset_sum_node.h index 8827ad545d9..a7b3cac7a2e 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_embedding_bag_offset_sum_node.h +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_embedding_bag_offset_sum_node.h @@ -19,12 +19,16 @@ public: void getSupportedDescriptors() override {}; void initSupportedPrimitiveDescriptors() override; - void createPrimitive() override {}; + void createPrimitive() override; void execute(mkldnn::stream strm) override; bool created() const override; static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; +protected: + void prepareParams() override; + void executeDynamicImpl(mkldnn::stream strm) override { execute(strm); } + private: void initFromInputs() override; void getIndices(int embIndex, const int*& indices, size_t& size, int& weightsIdx, bool& withWeight) override; diff --git a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_embedding_bag_packed_sum_node.cpp b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_embedding_bag_packed_sum_node.cpp index d95fbb5ca7a..9dbaad08d80 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_embedding_bag_packed_sum_node.cpp +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_embedding_bag_packed_sum_node.cpp @@ -13,10 +13,6 @@ using namespace InferenceEngine; bool MKLDNNEmbeddingBagPackedSumNode::isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept { try { - if (isDynamicNgraphNode(op)) { - errorMessage = "Doesn't support op with dynamic shapes"; - return false; - } const auto embBagPackedSumOp = ngraph::as_type_ptr(op); if (!embBagPackedSumOp) { errorMessage = "Node is not an instance of the EmbeddingBagPackedSum operation from opset v3."; @@ -35,10 +31,8 @@ MKLDNNEmbeddingBagPackedSumNode::MKLDNNEmbeddingBagPackedSumNode(const std::shar IE_THROW(NotImplemented) << errorMessage; } - if (op->get_input_shape(INDICES_IDX).size() != 2) - IE_THROW() << "'" << _layerName << "' layer has indices data with invalid shape."; - _batch = op->get_input_shape(INDICES_IDX)[0]; - _indicesPerBag = op->get_input_shape(INDICES_IDX)[1]; + if (getInputShapeAtPort(INDICES_IDX).getRank() != 2ul) + IE_THROW() << "'" << _layerName << "' layer has indices data with invalid rank."; } void MKLDNNEmbeddingBagPackedSumNode::initSupportedPrimitiveDescriptors() { @@ -70,6 +64,20 @@ void MKLDNNEmbeddingBagPackedSumNode::initSupportedPrimitiveDescriptors() { addSupportedPrimDesc(inDataConfigurators, {{LayoutType::ncsp, inDataPrecision}}, impl_desc_type::ref_any); } +void MKLDNNEmbeddingBagPackedSumNode::createPrimitive() { + if (inputShapesDefined()) { + if (needPrepareParams()) + prepareParams(); + updateLastInputDims(); + } +} + +void MKLDNNEmbeddingBagPackedSumNode::prepareParams() { + _batch = getParentEdgesAtPort(INDICES_IDX)[0]->getMemory().getStaticDims()[0]; + _indicesPerBag = getParentEdgesAtPort(INDICES_IDX)[0]->getMemory().getStaticDims()[1]; + MKLDNNEmbeddingBagSumNode::prepareParams(getParentEdgesAtPort(EMB_TABLE_IDX)[0]->getMemory().getStaticDims()); +} + void MKLDNNEmbeddingBagPackedSumNode::initFromInputs() { _indices = reinterpret_cast(getParentEdgeAt(INDICES_IDX)->getMemoryPtr()->GetPtr()); } diff --git a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_embedding_bag_packed_sum_node.h b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_embedding_bag_packed_sum_node.h index 9e7053f3e96..fb01897debb 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_embedding_bag_packed_sum_node.h +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_embedding_bag_packed_sum_node.h @@ -19,12 +19,16 @@ public: void getSupportedDescriptors() override {}; void initSupportedPrimitiveDescriptors() override; - void createPrimitive() override {}; + void createPrimitive() override; void execute(mkldnn::stream strm) override; bool created() const override; static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; +protected: + void prepareParams() override; + void executeDynamicImpl(mkldnn::stream strm) override { execute(strm); } + private: void initFromInputs() override; void getIndices(int embIndex, const int*& indices, size_t& size, int& weightsIdx, bool& withWeight) override; diff --git a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_embedding_bag_sum_node.cpp b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_embedding_bag_sum_node.cpp index 853da79accf..a1d54d9db87 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_embedding_bag_sum_node.cpp +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_embedding_bag_sum_node.cpp @@ -34,11 +34,12 @@ MKLDNNEmbeddingBagSumNode::MKLDNNEmbeddingBagSumNode( if (op->get_input_shape(PER_SAMPLE_WEIGHTS_IDX) != op->get_input_shape(INDICES_IDX)) IE_THROW() << logPrefix << "must have equal shapes for indices and per_sample_weights inputs."; } +} - const auto& inDataDims = op->get_input_shape(EMB_TABLE_IDX); +void MKLDNNEmbeddingBagSumNode::prepareParams(const VectorDims& indexStaticShape) { _embDepth = 1lu; - for (size_t i = 1lu; i < inDataDims.size(); i++) { - _embDepth *= inDataDims[i]; + for (size_t i = 1lu; i < indexStaticShape.size(); i++) { + _embDepth *= indexStaticShape[i]; } } diff --git a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_embedding_bag_sum_node.h b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_embedding_bag_sum_node.h index ef5e7ed9a2f..d8f6a6233a3 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_embedding_bag_sum_node.h +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_embedding_bag_sum_node.h @@ -35,6 +35,8 @@ protected: int& weightsIdx, bool& withWeights) = 0; + void prepareParams(const VectorDims& indexStaticShape); + template void processData(const T* srcData, const T* weightsData, T* dstData, const InferenceEngine::SizeVector& inDataDims, const InferenceEngine::SizeVector& outDataDims); diff --git a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_embedding_segments_sum_node.cpp b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_embedding_segments_sum_node.cpp index 6196c6478ac..2dca1793df1 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_embedding_segments_sum_node.cpp +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_embedding_segments_sum_node.cpp @@ -11,12 +11,16 @@ using namespace MKLDNNPlugin; using namespace InferenceEngine; +void MKLDNNEmbeddingSegmentsSumNode::createPrimitive() { + if (inputShapesDefined()) { + if (needPrepareParams()) + prepareParams(); + updateLastInputDims(); + } +} + bool MKLDNNEmbeddingSegmentsSumNode::isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept { try { - if (isDynamicNgraphNode(op)) { - errorMessage = "Doesn't support op with dynamic shapes"; - return false; - } const auto embBagSegSumOp = ngraph::as_type_ptr(op); if (!embBagSegSumOp) { errorMessage = "Node is not an instance of the EmbeddingSegmentsSum operation from opset v3."; @@ -36,13 +40,13 @@ MKLDNNEmbeddingSegmentsSumNode::MKLDNNEmbeddingSegmentsSumNode(const std::shared } std::string errPrefix = std::string("EmbeddingSegmentsSum layer with name '") + _layerName + "' "; - if (op->get_input_shape(INDICES_IDX).size() != 1) - IE_THROW() << errPrefix << "has indices data with invalid shape: " - << op->get_input_shape(INDICES_IDX).size(); + if (getInputShapeAtPort(INDICES_IDX).getRank() != 1ul) + IE_THROW() << errPrefix << "has indices data with invalid rank: " + << getInputShapeAtPort(INDICES_IDX).getRank(); - if (op->get_input_shape(SEGMENT_ID_IDX).size() != 1) - IE_THROW() << errPrefix << "has invalid segmentID data shape: " - << op->get_input_shape(SEGMENT_ID_IDX).size(); + if (getInputShapeAtPort(SEGMENT_ID_IDX).getRank() != 1ul) + IE_THROW() << errPrefix << "has invalid segmentID data rank: " + << getInputShapeAtPort(SEGMENT_ID_IDX).getRank(); } void MKLDNNEmbeddingSegmentsSumNode::initSupportedPrimitiveDescriptors() { @@ -78,6 +82,10 @@ void MKLDNNEmbeddingSegmentsSumNode::initSupportedPrimitiveDescriptors() { addSupportedPrimDesc(inDataConfigurators, {{LayoutType::ncsp, inDataPrecision}}, impl_desc_type::ref_any); } +void MKLDNNEmbeddingSegmentsSumNode::prepareParams() { + MKLDNNEmbeddingBagSumNode::prepareParams(getParentEdgesAtPort(EMB_TABLE_IDX)[0]->getMemory().getStaticDims()); +} + void MKLDNNEmbeddingSegmentsSumNode::initFromInputs() { indices_ = reinterpret_cast(getParentEdgeAt(INDICES_IDX)->getMemoryPtr()->GetPtr()); indicesSize_ = getParentEdgeAt(INDICES_IDX)->getMemory().GetShape().getElementsCount(); diff --git a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_embedding_segments_sum_node.h b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_embedding_segments_sum_node.h index 828d76cf1fb..942d337d099 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_embedding_segments_sum_node.h +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_embedding_segments_sum_node.h @@ -19,12 +19,16 @@ public: void getSupportedDescriptors() override {}; void initSupportedPrimitiveDescriptors() override; - void createPrimitive() override {}; + void createPrimitive() override; void execute(mkldnn::stream strm) override; bool created() const override; static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; +protected: + void prepareParams() override; + void executeDynamicImpl(mkldnn::stream strm) override { execute(strm); } + private: void initFromInputs() override; void getIndices(int embIndex, const int*& indices, size_t& size, int& weightsIdx, bool& withWeight) override; diff --git a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_extract_image_patches_node.cpp b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_extract_image_patches_node.cpp index 9372c2177fa..29faa1dac52 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_extract_image_patches_node.cpp +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_extract_image_patches_node.cpp @@ -270,11 +270,7 @@ private: bool MKLDNNExtractImagePatchesNode::isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept { try { - if (isDynamicNgraphNode(op)) { - errorMessage = "Doesn't support op with dynamic shapes"; - return false; - } - const auto extImgPatcher = std::dynamic_pointer_cast(op); + auto extImgPatcher = ngraph::as_type_ptr(op); if (!extImgPatcher) { errorMessage = "Only opset3 ExtractImagePatches operation is supported"; return false; @@ -302,21 +298,18 @@ MKLDNNExtractImagePatchesNode::MKLDNNExtractImagePatchesNode(const std::shared_p } errorPrefix = "ExtractImagePatches layer with name '" + op->get_friendly_name() + "' "; - const auto extImgPatcher = std::dynamic_pointer_cast(op); + auto extImgPatcher = ngraph::as_type_ptr(op); - if (getOriginalInputsNumber() != 1 || getOriginalOutputsNumber() != 1) + if (inputShapes.size() != 1 || outputShapes.size() != 1) IE_THROW() << errorPrefix << "has incorrect number of input or output edges!" - << " Input: " << getOriginalInputsNumber() << "; Output: " << getOriginalOutputsNumber(); + << " Input: " << inputShapes.size() << "; Output: " << outputShapes.size(); - if (op->get_input_shape(0).size() != 4) - IE_THROW() << errorPrefix << "must have 4D input tensor. Actual: " << op->get_input_shape(0).size(); + if (getInputShapeAtPort(0).getRank() != 4) + IE_THROW() << errorPrefix << "must have 4D input tensor. Actual: " << getInputShapeAtPort(0).getRank(); - if (op->get_output_shape(0).size() != 4) - IE_THROW() << errorPrefix << "must have 4D output tensor. Actual: " << op->get_output_shape(0).size(); + if (getOutputShapeAtPort(0).getRank() != 4) + IE_THROW() << errorPrefix << "must have 4D output tensor. Actual: " << getOutputShapeAtPort(0).getRank(); - auto ksizes = extImgPatcher->get_sizes(); - auto strides = extImgPatcher->get_strides(); - auto rates = extImgPatcher->get_rates(); if (extImgPatcher->get_auto_pad() == ngraph::op::PadType::VALID) { _auto_pad = ExtImgPatcherPadType::VALID; } else if (extImgPatcher->get_auto_pad() == ngraph::op::PadType::SAME_LOWER) { @@ -327,80 +320,46 @@ MKLDNNExtractImagePatchesNode::MKLDNNExtractImagePatchesNode(const std::shared_p IE_THROW() << errorPrefix << "has unsupported pad type: " << extImgPatcher->get_auto_pad(); } - if (ksizes.size() != 2 || strides.size() != 2 || rates.size() != 2) + _ksizes = extImgPatcher->get_sizes();; + _strides = extImgPatcher->get_strides(); + _rates = extImgPatcher->get_rates(); + if (_ksizes.size() != 2 || _strides.size() != 2 || _rates.size() != 2) IE_THROW() << errorPrefix << "must have the following attributes with shape {2}: sizes, strides, rates."; - _ksizes.clear(); - _strides.clear(); - _rates.clear(); - for (const auto& x : ksizes) - _ksizes.push_back(x); - for (const auto& x : strides) - _strides.push_back(x); - for (const auto& x : rates) - _rates.push_back(x); +} - SizeVector in_dims = op->get_input_shape(0); - _pad_left = 0; - _pad_top = 0; - jit_extract_image_patches_params jpp; - jpp.need_padding = false; - if (_auto_pad != ExtImgPatcherPadType::VALID) { - const size_t iheight = in_dims[2]; - const size_t iwidth = in_dims[3]; - const int64_t ihStep = _ksizes[0] + (_rates[0] - 1) * (_ksizes[0] - 1); - const int64_t iwStep = _ksizes[1] + (_rates[1] - 1) * (_ksizes[1] - 1); - - int64_t PW = (std::ceil(1.f * iwidth/_strides[1]) - 1) * _strides[1] + iwStep - iwidth; - int64_t PH = (std::ceil(1.f * iheight/_strides[0]) - 1) * _strides[0] + ihStep - iheight; - - int64_t increment_sign = 0; - if (_auto_pad == ExtImgPatcherPadType::SAME_LOWER) { - increment_sign = 1; - } else if (_auto_pad == ExtImgPatcherPadType::SAME_UPPER) { - increment_sign = -1; - } - - if ((PW > 0) && (PW < iwStep)) { - _pad_left = static_cast((PW + increment_sign * (PW % 2)) / 2); - jpp.need_padding = true; - } - if ((PH > 0) && (PH < ihStep)) { - _pad_top = static_cast((PH + increment_sign * (PH % 2)) / 2); - jpp.need_padding = true; - } +void MKLDNNExtractImagePatchesNode::createPrimitive() { + if (inputShapesDefined()) { + if (needPrepareParams()) + prepareParams(); + updateLastInputDims(); } +} - jpp.IW = in_dims[3]; - SizeVector out_dims = op->get_output_shape(0); - jpp.OH = out_dims[2]; - jpp.OW = out_dims[3]; - jpp.KH = _ksizes[0]; - jpp.KW = _ksizes[1]; - jpp.SH = _strides[0]; - jpp.SW = _strides[1]; - jpp.dtype_size = getOriginalInputPrecisionAtPort(0).size(); - jpp.block_size = 1; +void MKLDNNExtractImagePatchesNode::prepareParams() { + const auto& srcMemPtr0 = getParentEdgeAt(0)->getMemoryPtr(); + const auto& dstMemPtr = getChildEdgeAt(0)->getMemoryPtr(); + if (!srcMemPtr0 || !srcMemPtr0->GetPrimitivePtr()) + IE_THROW() << "Input memory didn't allocate."; + if (!dstMemPtr || !dstMemPtr->GetPrimitivePtr()) + IE_THROW() << "Destination memory didn't allocate."; + if (getSelectedPrimitiveDescriptor() == nullptr) + IE_THROW() << "Preferable primitive descriptor is not set."; - if (mayiuse(x64::avx512_common)) { - jpp.block_size = cpu_isa_traits::vlen / jpp.dtype_size; - extract_image_patches_kernel.reset(new jit_extract_image_patches_kernel(jpp)); - } else if (mayiuse(x64::avx2)) { - jpp.block_size = cpu_isa_traits::vlen / jpp.dtype_size; - extract_image_patches_kernel.reset(new jit_extract_image_patches_kernel(jpp)); - } else if (mayiuse(x64::sse41)) { - jpp.block_size = cpu_isa_traits::vlen / jpp.dtype_size; - extract_image_patches_kernel.reset(new jit_extract_image_patches_kernel(jpp)); + const auto& in_dims = getParentEdgeAt(0)->getMemory().getStaticDims(); + const auto& out_dims = getChildEdgesAtPort(0)[0]->getMemory().getStaticDims(); + const auto prcSize = getOriginalInputPrecisionAtPort(0).size(); + if (mayiuse(x64::sse41)) { + execPtr = std::make_shared(in_dims, out_dims, _ksizes, _strides, _rates, _auto_pad, prcSize); + } else { + execPtr = std::make_shared(in_dims, out_dims, _ksizes, _strides, _rates, _auto_pad, prcSize); } - - if (extract_image_patches_kernel) - extract_image_patches_kernel->create_ker(); } void MKLDNNExtractImagePatchesNode::initSupportedPrimitiveDescriptors() { if (!supportedPrimitiveDescriptors.empty()) return; - precision = getOriginalInputPrecisionAtPort(0); + const auto precision = getOriginalInputPrecisionAtPort(0); if (_supported_precisions_sizes.find(precision.size()) == _supported_precisions_sizes.end()) IE_THROW() << errorPrefix << "has unsupported precision: " << precision.name(); @@ -410,90 +369,208 @@ void MKLDNNExtractImagePatchesNode::initSupportedPrimitiveDescriptors() { } void MKLDNNExtractImagePatchesNode::execute(mkldnn::stream strm) { - const char *src_data = reinterpret_cast(getParentEdgeAt(0)->getMemoryPtr()->GetPtr()); - char *dst_data = reinterpret_cast(getChildEdgesAtPort(0)[0]->getMemoryPtr()->GetPtr()); - const size_t dtype_size = getOriginalInputPrecisionAtPort(0).size(); - - const auto& inDims = getParentEdgeAt(0)->getMemory().getStaticDims(); - const size_t IC = inDims[1]; - const size_t IH = inDims[2]; - const size_t IW = inDims[3]; - - const auto& outDims = getChildEdgesAtPort(0)[0]->getMemory().getStaticDims(); - const size_t OB = outDims[0]; - const size_t OH = outDims[2]; - const size_t OW = outDims[3]; - - const size_t KH = _ksizes[0], KW = _ksizes[1]; - const size_t SH = _strides[0], SW = _strides[1]; - const size_t RH = _rates[0], RW = _rates[1]; - const size_t PT = _pad_top, PL = _pad_left; - - const std::vector istrides = getParentEdgeAt(0)->getMemory().GetDescWithType()->getStrides(); - const std::vector ostrides = getChildEdgesAtPort(0)[0]->getMemory().GetDescWithType()->getStrides(); - const std::vector ostrides_partial = {ostrides[0], KW * IC * ostrides[1], IC * ostrides[1], ostrides[1]}; - - if (extract_image_patches_kernel) { - parallel_for4d(OB, KH, KW, IC, [&](const size_t ob, const size_t kh, const size_t kw, const size_t ic) { - const int64_t ih_start = kh * RH - PT; - const int64_t iw_start = kw * RW - PL; - const size_t ih_lpad = ih_start >= 0 ? 0 : std::ceil(-1.f * ih_start / SH); - const size_t iw_lpad = iw_start >= 0 ? 0 : std::ceil(-1.f * iw_start / SW); - const size_t ih_hpad = std::ceil((IH - 1.f * ih_start) / SH) > OH ? OH : std::ceil((IH - 1.f * ih_start) / SH); - const size_t iw_hpad = std::ceil((IW - 1.f * iw_start) / SW) > OW ? OW : std::ceil((IW - 1.f * iw_start) / SW); - - size_t dst_offset = ob * ostrides_partial[0] + kh * ostrides_partial[1] + kw * ostrides_partial[2] + ic * ostrides_partial[3]; - size_t src_offset = ob * istrides[0] + ic * istrides[1] + ih_start * istrides[2] + iw_start + ih_lpad * SH * IW; - - auto args = jit_extract_image_patches_args(); - args.src = src_data + src_offset * dtype_size; - args.dst = dst_data + dst_offset * dtype_size; - args.h_lo_pad = ih_lpad; - args.h_hi_pad = ih_hpad; - args.w_lo_pad = iw_lpad; - args.w_hi_pad = iw_hpad; - (*extract_image_patches_kernel)(&args); - }); + if (execPtr) { + auto src = getParentEdgeAt(0)->getMemoryPtr()->GetPtr(); + auto dst = getChildEdgesAtPort(0)[0]->getMemoryPtr()->GetPtr(); + const auto inStrides = getParentEdgeAt(0)->getMemory().GetDescWithType()->getStrides(); + const auto outStrides = getChildEdgesAtPort(0)[0]->getMemory().GetDescWithType()->getStrides(); + execPtr->exec(src, dst, inStrides, outStrides); } else { - parallel_for4d(OB, KH, KW, IC, [&](const size_t ob, const size_t kh, const size_t kw, const size_t ic) { - const int64_t iw_start = kw * RW - PL; - const int64_t ih_start = kh * RH - PT; - const size_t ih_lpad = ih_start >= 0 ? 0 : std::ceil(- 1.f * ih_start / SH); - const size_t iw_lpad = iw_start >= 0 ? 0 : std::ceil(- 1.f * iw_start / SW); + IE_THROW() << "Can't execute extract image patches node. Primitive wasn't created"; + } +} - const size_t ih_hpad = std::ceil((IH - 1.f * ih_start) / SH) > OH ? OH : std::ceil((IH + -1.f * ih_start) / SH); - const size_t iw_hpad = std::ceil((IW - 1.f * iw_start) / SW) > OW ? OW : std::ceil((IW - 1.f * iw_start) / SW); +void MKLDNNExtractImagePatchesNode::executeDynamicImpl(mkldnn::stream strm) { + return execute(strm); +} - char *my_dst_ptr = dst_data + - (ob * ostrides_partial[0] + kh * ostrides_partial[1] + kw * ostrides_partial[2] + ic * ostrides_partial[3]) * dtype_size; - const char *my_src_ptr = src_data + (ob * istrides[0] + ic * istrides[1] + ih_start * istrides[2] + iw_start) * dtype_size; +void MKLDNNExtractImagePatchesNode::ExtractImagePatchesRefExecutor::executeReference( + void* src, void* dst, const VectorDims& istrides, const VectorDims& ostrides) const { + const char* src_data = reinterpret_cast(src); + char* dst_data = reinterpret_cast(dst); - size_t num_bytes_to_set = ih_lpad * OW * dtype_size; + const std::vector ostrides_partial = { ostrides[0], jpp.KW * IC * ostrides[1], IC * ostrides[1], ostrides[1] }; + + parallel_for4d(OB, jpp.KH, jpp.KW, IC, [&](const size_t ob, const size_t kh, const size_t kw, const size_t ic) { + const int64_t iw_start = kw * RW - PL; + const int64_t ih_start = kh * RH - PT; + const size_t ih_lpad = ih_start >= 0 ? 0 : std::ceil(-1.f * ih_start / jpp.SH); + const size_t iw_lpad = iw_start >= 0 ? 0 : std::ceil(-1.f * iw_start / jpp.SW); + + const size_t ih_hpad = std::ceil((IH - 1.f * ih_start) / jpp.SH) > jpp.OH ? jpp.OH : std::ceil((IH + -1.f * ih_start) / jpp.SH); + const size_t iw_hpad = std::ceil((jpp.IW - 1.f * iw_start) / jpp.SW) > jpp.OW ? jpp.OW : std::ceil((jpp.IW - 1.f * iw_start) / jpp.SW); + + char* my_dst_ptr = dst_data + + (ob * ostrides_partial[0] + kh * ostrides_partial[1] + kw * ostrides_partial[2] + ic * ostrides_partial[3]) * jpp.dtype_size; + const char* my_src_ptr = src_data + (ob * istrides[0] + ic * istrides[1] + ih_start * istrides[2] + iw_start) * jpp.dtype_size; + + size_t num_bytes_to_set = ih_lpad * jpp.OW * jpp.dtype_size; + memset(my_dst_ptr, 0, num_bytes_to_set); + my_dst_ptr += num_bytes_to_set; + + const char* src_ptr_h_stop = my_src_ptr + ih_hpad * jpp.SH * jpp.IW * jpp.dtype_size; + for (const char* src_h_ptr = my_src_ptr + ih_lpad * jpp.SH * jpp.IW * jpp.dtype_size; + src_h_ptr < src_ptr_h_stop; src_h_ptr += jpp.SH * jpp.IW * jpp.dtype_size) { + num_bytes_to_set = iw_lpad * jpp.dtype_size; memset(my_dst_ptr, 0, num_bytes_to_set); my_dst_ptr += num_bytes_to_set; - const char* src_ptr_h_stop = my_src_ptr + ih_hpad * SH * IW * dtype_size; - for (const char *src_h_ptr = my_src_ptr + ih_lpad * SH * IW * dtype_size; - src_h_ptr < src_ptr_h_stop; src_h_ptr += SH * IW * dtype_size) { - num_bytes_to_set = iw_lpad * dtype_size; - memset(my_dst_ptr, 0, num_bytes_to_set); - my_dst_ptr += num_bytes_to_set; - - const char* src_ptr_w_stop = src_h_ptr + iw_hpad * SW * dtype_size; - for (const char* src_w_ptr = src_h_ptr + iw_lpad * SW * dtype_size; - src_w_ptr < src_ptr_w_stop; src_w_ptr += SW * dtype_size) { - num_bytes_to_set = dtype_size; - memcpy(my_dst_ptr, src_w_ptr, num_bytes_to_set); - my_dst_ptr += num_bytes_to_set; - } - num_bytes_to_set = (OW - iw_hpad) * dtype_size; - memset(my_dst_ptr, 0, num_bytes_to_set); + const char* src_ptr_w_stop = src_h_ptr + iw_hpad * jpp.SW * jpp.dtype_size; + for (const char* src_w_ptr = src_h_ptr + iw_lpad * jpp.SW * jpp.dtype_size; + src_w_ptr < src_ptr_w_stop; src_w_ptr += jpp.SW * jpp.dtype_size) { + num_bytes_to_set = jpp.dtype_size; + memcpy(my_dst_ptr, src_w_ptr, num_bytes_to_set); my_dst_ptr += num_bytes_to_set; } - num_bytes_to_set = (OH - ih_hpad) * OW * dtype_size; + num_bytes_to_set = (jpp.OW - iw_hpad) * jpp.dtype_size; memset(my_dst_ptr, 0, num_bytes_to_set); - }); + my_dst_ptr += num_bytes_to_set; + } + num_bytes_to_set = (jpp.OH - ih_hpad) * jpp.OW * jpp.dtype_size; + memset(my_dst_ptr, 0, num_bytes_to_set); + }); +} + +void MKLDNNExtractImagePatchesNode::ExtractImagePatchesJitExecutor::executeOptimizedGeneric( + void* src, void* dst, const VectorDims& istrides, const VectorDims& ostrides) const { + const char* src_data = reinterpret_cast(src); + char* dst_data = reinterpret_cast(dst); + const auto& jpp = pKernel->jpp; + + const std::vector ostrides_partial = { ostrides[0], jpp.KW * IC * ostrides[1], IC * ostrides[1], ostrides[1] }; + + parallel_for4d(OB, jpp.KH, jpp.KW, IC, [&](const size_t ob, const size_t kh, const size_t kw, const size_t ic) { + const int64_t ih_start = kh * RH - PT; + const int64_t iw_start = kw * RW - PL; + const size_t ih_lpad = ih_start >= 0 ? 0 : std::ceil(-1.f * ih_start / jpp.SH); + const size_t iw_lpad = iw_start >= 0 ? 0 : std::ceil(-1.f * iw_start / jpp.SW); + const size_t ih_hpad = std::ceil((IH - 1.f * ih_start) / jpp.SH) > jpp.OH ? jpp.OH : std::ceil((IH - 1.f * ih_start) / jpp.SH); + const size_t iw_hpad = std::ceil((jpp.IW - 1.f * iw_start) / jpp.SW) > jpp.OW ? jpp.OW : std::ceil((jpp.IW - 1.f * iw_start) / jpp.SW); + + size_t dst_offset = ob * ostrides_partial[0] + kh * ostrides_partial[1] + kw * ostrides_partial[2] + ic * ostrides_partial[3]; + size_t src_offset = ob * istrides[0] + ic * istrides[1] + ih_start * istrides[2] + iw_start + ih_lpad * jpp.SH * jpp.IW; + + auto args = jit_extract_image_patches_args(); + args.src = src_data + src_offset * jpp.dtype_size; + args.dst = dst_data + dst_offset * jpp.dtype_size; + args.h_lo_pad = ih_lpad; + args.h_hi_pad = ih_hpad; + args.w_lo_pad = iw_lpad; + args.w_hi_pad = iw_hpad; + (*pKernel)(&args); + }); +} + +jit_extract_image_patches_params MKLDNNExtractImagePatchesNode::ExtractImagePatchesExecutor::fillJpp( + const VectorDims& inDims, + const VectorDims& outDims, + const VectorDims& kSizes, + const VectorDims& strides, + const VectorDims& rates, + const ExtImgPatcherPadType& padType, + const size_t prcSize) { + jit_extract_image_patches_params jpp{}; + + IC = inDims[1]; + IH = inDims[2]; + jpp.IW = inDims[3]; + + OB = outDims[0]; + jpp.OH = outDims[2]; + jpp.OW = outDims[3]; + + jpp.KH = kSizes[0]; + jpp.KW = kSizes[1]; + + jpp.SH = strides[0]; + jpp.SW = strides[1]; + + RH = rates[0]; + RW = rates[1]; + + PL = 0; + PT = 0; + jpp.need_padding = false; + if (padType != ExtImgPatcherPadType::VALID) { + const int64_t ihStep = kSizes[0] + (rates[0] - 1) * (kSizes[0] - 1); + const int64_t iwStep = kSizes[1] + (rates[1] - 1) * (kSizes[1] - 1); + + int64_t PW = (std::ceil(1.f * jpp.IW / strides[1]) - 1) * strides[1] + iwStep - jpp.IW; + int64_t PH = (std::ceil(1.f * IH / strides[0]) - 1) * strides[0] + ihStep - IH; + + int64_t increment_sign = 0; + if (padType == ExtImgPatcherPadType::SAME_LOWER) { + increment_sign = 1; + } else if (padType == ExtImgPatcherPadType::SAME_UPPER) { + increment_sign = -1; + } + + if ((PW > 0) && (PW < iwStep)) { + PL = static_cast((PW + increment_sign * (PW % 2)) / 2); + jpp.need_padding = true; + } + if ((PH > 0) && (PH < ihStep)) { + PT = static_cast((PH + increment_sign * (PH % 2)) / 2); + jpp.need_padding = true; + } } + + jpp.dtype_size = prcSize; + if (mayiuse(x64::avx512_common)) { + jpp.block_size = cpu_isa_traits::vlen / prcSize; + } else if (mayiuse(x64::avx2)) { + jpp.block_size = cpu_isa_traits::vlen / prcSize; + } else if (mayiuse(x64::sse41)) { + jpp.block_size = cpu_isa_traits::vlen / prcSize; + } else { + jpp.block_size = 1; + } + + return jpp; +} + +MKLDNNExtractImagePatchesNode::ExtractImagePatchesJitExecutor::ExtractImagePatchesJitExecutor( + const VectorDims& inDims, + const VectorDims& outDims, + const VectorDims& kSizes, + const VectorDims& strides, + const VectorDims& rates, + const ExtImgPatcherPadType& padType, + const size_t prcSize) { + auto jpp = fillJpp(inDims, outDims, kSizes, strides, rates, padType, prcSize); + if (mayiuse(x64::avx512_common)) { + pKernel.reset(new jit_extract_image_patches_kernel(jpp)); + } else if (mayiuse(x64::avx2)) { + pKernel.reset(new jit_extract_image_patches_kernel(jpp)); + } else if (mayiuse(x64::sse41)) { + pKernel.reset(new jit_extract_image_patches_kernel(jpp)); + } else { + IE_THROW() << "Can't create jit extract image patches kernel"; + } + + if (pKernel) + pKernel->create_ker(); +} + +void MKLDNNExtractImagePatchesNode::ExtractImagePatchesJitExecutor::exec( + void* src, void* dst, const VectorDims& istrides, const VectorDims& ostrides) { + if (!pKernel) + IE_THROW() << "Can't execute, kernel for extract image patches node is not compiled"; + executeOptimizedGeneric(src, dst, istrides, ostrides); +} + +MKLDNNExtractImagePatchesNode::ExtractImagePatchesRefExecutor::ExtractImagePatchesRefExecutor( + const VectorDims& inDims, + const VectorDims& outDims, + const VectorDims& kSizes, + const VectorDims& strides, + const VectorDims& rates, + const ExtImgPatcherPadType& padType, + const size_t prcSize) : jpp(fillJpp(inDims, outDims, kSizes, strides, rates, padType, prcSize)) {} + +void MKLDNNExtractImagePatchesNode::ExtractImagePatchesRefExecutor::exec( + void* src, void* dst, const VectorDims& istrides, const VectorDims& ostrides) { + executeReference(src, dst, istrides, ostrides); } const std::set MKLDNNExtractImagePatchesNode::_supported_precisions_sizes = {1, 2, 4}; diff --git a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_extract_image_patches_node.h b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_extract_image_patches_node.h index f78730185aa..62df89c9822 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_extract_image_patches_node.h +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_extract_image_patches_node.h @@ -11,7 +11,6 @@ #include namespace MKLDNNPlugin { - struct jit_extract_image_patches_params { size_t IW; size_t OH, OW; @@ -46,10 +45,13 @@ public: void getSupportedDescriptors() override {}; void initSupportedPrimitiveDescriptors() override; - void createPrimitive() override {}; + void createPrimitive() override; void execute(mkldnn::stream strm) override; bool created() const override; + void executeDynamicImpl(mkldnn::stream strm) override; + void prepareParams() override; + static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; private: @@ -62,15 +64,68 @@ private: std::vector _ksizes; std::vector _strides; std::vector _rates; - size_t _pad_left; - size_t _pad_top; - std::shared_ptr extract_image_patches_kernel; static const std::set _supported_precisions_sizes; - ExtImgPatcherPadType _auto_pad; - InferenceEngine::Precision precision; std::string errorPrefix; + + struct ExtractImagePatchesExecutor { + ExtractImagePatchesExecutor() = default; + virtual void exec(void* src, void* dst, const VectorDims& istrides, const VectorDims& ostrides) = 0; + jit_extract_image_patches_params fillJpp( + const VectorDims& inDims, + const VectorDims& outDims, + const VectorDims& kSizes, + const VectorDims& strides, + const VectorDims& rates, + const ExtImgPatcherPadType& padType, + const size_t prcSize); + virtual ~ExtractImagePatchesExecutor() = default; + + protected: + size_t IC = 0; + size_t IH = 0; + size_t OB = 0; + size_t RH = 0; + size_t RW = 0; + size_t PT = 0; + size_t PL = 0; + }; + + using executorPtr = std::shared_ptr; + executorPtr execPtr = nullptr; + + struct ExtractImagePatchesJitExecutor : public ExtractImagePatchesExecutor { + ExtractImagePatchesJitExecutor( + const VectorDims& inDims, + const VectorDims& outDims, + const VectorDims& kSizes, + const VectorDims& strides, + const VectorDims& rates, + const ExtImgPatcherPadType& padType, + const size_t prcSize); + void exec(void* src, void* dst, const VectorDims& istrides, const VectorDims& ostrides) override; + void executeOptimizedGeneric(void* src, void* dst, const VectorDims& istrides, const VectorDims& ostrides) const; + + private: + std::unique_ptr pKernel; + }; + + struct ExtractImagePatchesRefExecutor : public ExtractImagePatchesExecutor { + ExtractImagePatchesRefExecutor( + const VectorDims& inDims, + const VectorDims& outDims, + const VectorDims& kSizes, + const VectorDims& strides, + const VectorDims& rates, + const ExtImgPatcherPadType& padType, + const size_t prcSize); + void exec(void* src, void* dst, const VectorDims& istrides, const VectorDims& ostrides) override; + void executeReference(void* src, void* dst, const VectorDims& istrides, const VectorDims& ostrides) const; + + private: + jit_extract_image_patches_params jpp; + }; }; } // namespace MKLDNNPlugin diff --git a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_fullyconnected_node.cpp b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_fullyconnected_node.cpp index 6226ef03bfb..68bad2f2f92 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_fullyconnected_node.cpp +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_fullyconnected_node.cpp @@ -261,6 +261,15 @@ const std::vector& MKLDNNFullyConnectedNode::getPrimitivesPriori impl_desc_type::jit_sse42, impl_desc_type::ref, }; + + // WA: brgemm kernel contains bug that may lead to segfault in case of added post-ops and unaligned number of channels + size_t simdWidth = 16; + auto inputDims = inputShapes[0].getDims(); + if (inputDims.back() != Shape::UNDEFINED_DIM && inputDims.back() % simdWidth == 0) { + priorities.insert(priorities.begin() + 1, impl_desc_type::brgemm_avx512_amx); + priorities.insert(priorities.begin() + 2, impl_desc_type::brgemm_avx512); + } + for (const auto& impl : priorities) { if (std::find(implPriorities.begin(), implPriorities.end(), impl) == implPriorities.end()) implPriorities.push_back(impl); diff --git a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_interpolate_node.cpp b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_interpolate_node.cpp index 8949bf025d4..d58adc21d81 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_interpolate_node.cpp +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_interpolate_node.cpp @@ -25,6 +25,9 @@ #include #include +#include +#include +#include #include "utils/cpu_utils.hpp" using namespace mkldnn; @@ -1605,7 +1608,7 @@ private: // shapeND: n c d h w // blockND: ncdhw cdhw dhw hw w 1 // index : 0 1 2 3 4 5 -inline SizeVector getBlockND(SizeVector& shape) { +inline SizeVector getBlockND(const SizeVector& shape) { int shapeRank = shape.size(); SizeVector blockND(shapeRank + 1, 1); for (int i = shapeRank - 1; i >= 0; i--) { @@ -1644,11 +1647,6 @@ using ngInterpShapeCalcMode = ngraph::opset4::Interpolate::ShapeCalcMode; bool MKLDNNInterpolateNode::isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept { try { - if (isDynamicNgraphNode(op)) { - errorMessage = "Doesn't support op with dynamic shapes"; - return false; - } - const auto interp = std::dynamic_pointer_cast(op); if (!interp) { errorMessage = "Only opset4 Interpolate operation is supported"; @@ -1683,7 +1681,7 @@ bool MKLDNNInterpolateNode::isSupportedOperation(const std::shared_ptrget_input_shape(DATA_ID).size(); + const size_t dataRank = interp->get_input_partial_shape(DATA_ID).rank().get_length(); if (dataRank < 1 || dataRank > 5) { errorMessage = "Does not support input tensor of rank : " + std::to_string(dataRank); return false; @@ -1694,8 +1692,9 @@ bool MKLDNNInterpolateNode::isSupportedOperation(const std::shared_ptr(interp->get_input_node_shared_ptr(SCALES_ID)) == nullptr) { - errorMessage = "Only const 'scales' input is supported"; + if (!isDynamicNgraphNode(op) && interpShapeCalcMode == ngInterpShapeCalcMode::scales && + !ngraph::is_type(op->get_input_node_ptr(2))) { + errorMessage = "Only const 'scales' input is supported for static shapes"; return false; } @@ -1717,74 +1716,61 @@ MKLDNNInterpolateNode::MKLDNNInterpolateNode(const std::shared_ptr const auto interp = std::dynamic_pointer_cast(op); - if (interp->get_input_size() != 3 && interp->get_input_size() != 4) + const auto numInputs = inputShapes.size(); + if (numInputs != 3 && numInputs != 4) IE_THROW() << errorPrefix << " has incorrect number of input edges"; - if (interp->get_output_size() != 1) + if (outputShapes.size() != 1) IE_THROW() << errorPrefix << " has incorrect number of output edges"; - isAxesSpecified = interp->get_input_size() != 3; + isAxesSpecified = numInputs != 3; const auto &interpAttr = interp->get_attrs(); - const size_t dataRank = interp->get_input_shape(DATA_ID).size(); + const size_t dataRank = getInputShapeAtPort(DATA_ID).getRank(); const auto &interpMode = interpAttr.mode; if (interpMode == ngInterpMode::nearest) { - mode = InterpolateMode::nearest; + interpAttrs.mode = InterpolateMode::nearest; } else if (interpMode == ngInterpMode::linear) { if (dataRank < 5) { - mode = InterpolateMode::linear_onnx; + interpAttrs.mode = InterpolateMode::linear_onnx; } else { - mode = InterpolateMode::linear; + interpAttrs.mode = InterpolateMode::linear; } } else if (interpMode == ngInterpMode::linear_onnx) { - mode = InterpolateMode::linear_onnx; + interpAttrs.mode = InterpolateMode::linear_onnx; } else if (interpMode == ngInterpMode::cubic) { - mode = InterpolateMode::cubic; - } - - switch (dataRank) { - case 1: - case 3: - spatialDimSize = 1; - break; - case 2: - case 4: - spatialDimSize = 2; - break; - case 5: - spatialDimSize = 3; - break; + interpAttrs.mode = InterpolateMode::cubic; } const auto &interpCoordTransMode = interpAttr.coordinate_transformation_mode; if (interpCoordTransMode == ngInterpCoordTransf::half_pixel) { - coordTransMode = InterpolateCoordTransMode::half_pixel; + interpAttrs.coordTransMode = InterpolateCoordTransMode::half_pixel; } else if (interpCoordTransMode == ngInterpCoordTransf::pytorch_half_pixel) { - coordTransMode = InterpolateCoordTransMode::pytorch_half_pixel; + interpAttrs.coordTransMode = InterpolateCoordTransMode::pytorch_half_pixel; } else if (interpCoordTransMode == ngInterpCoordTransf::asymmetric) { - coordTransMode = InterpolateCoordTransMode::asymmetric; + interpAttrs.coordTransMode = InterpolateCoordTransMode::asymmetric; } else if (interpCoordTransMode == ngInterpCoordTransf::tf_half_pixel_for_nn) { - coordTransMode = InterpolateCoordTransMode::tf_half_pixel_for_nn; + interpAttrs.coordTransMode = InterpolateCoordTransMode::tf_half_pixel_for_nn; } else if (interpCoordTransMode == ngInterpCoordTransf::align_corners) { - coordTransMode = InterpolateCoordTransMode::align_corners; + interpAttrs.coordTransMode = InterpolateCoordTransMode::align_corners; } - if (mode == InterpolateMode::nearest) { + if (interpAttrs.mode == InterpolateMode::nearest) { const auto &interpNearestMode = interpAttr.nearest_mode; if (interpNearestMode == ngInterpNearMode::round_prefer_floor) { - nearestMode = InterpolateNearestMode::round_prefer_floor; + interpAttrs.nearestMode = InterpolateNearestMode::round_prefer_floor; } else if (interpNearestMode == ngInterpNearMode::round_prefer_ceil) { - nearestMode = InterpolateNearestMode::round_prefer_ceil; + interpAttrs.nearestMode = InterpolateNearestMode::round_prefer_ceil; } else if (interpNearestMode == ngInterpNearMode::floor) { - nearestMode = InterpolateNearestMode::floor; + interpAttrs.nearestMode = InterpolateNearestMode::floor; } else if (interpNearestMode == ngInterpNearMode::ceil) { - nearestMode = InterpolateNearestMode::ceil; + interpAttrs.nearestMode = InterpolateNearestMode::ceil; } else if (interpNearestMode == ngInterpNearMode::simple) { - nearestMode = InterpolateNearestMode::simple; + interpAttrs.nearestMode = InterpolateNearestMode::simple; } - } else if (mode == InterpolateMode::cubic) { - cubeCoeff = static_cast(interpAttr.cube_coeff); + } else if (interpAttrs.mode == InterpolateMode::cubic) { + interpAttrs.cubeCoeff = static_cast(interpAttr.cube_coeff); } - antialias = interpAttr.antialias; + interpAttrs.antialias = interpAttr.antialias; const auto &interpShapeCalcMode = interpAttr.shape_calculation_mode; if (interpShapeCalcMode == ngInterpShapeCalcMode::scales) { @@ -1794,23 +1780,21 @@ MKLDNNInterpolateNode::MKLDNNInterpolateNode(const std::shared_ptr } if (interpAttr.pads_begin.empty()) { - padBegin.resize(dataRank, 0); + interpAttrs.padBegin.resize(dataRank, 0); } else { - padBegin.resize(interpAttr.pads_begin.size()); + interpAttrs.padBegin.resize(interpAttr.pads_begin.size()); for (size_t i = 0; i < interpAttr.pads_begin.size(); i++) - padBegin[i] = static_cast(interpAttr.pads_begin[i]); + interpAttrs.padBegin[i] = static_cast(interpAttr.pads_begin[i]); } if (interpAttr.pads_end.empty()) { - padEnd.resize(dataRank, 0); + interpAttrs.padEnd.resize(dataRank, 0); } else { - padEnd.resize(interpAttr.pads_end.size()); + interpAttrs.padEnd.resize(interpAttr.pads_end.size()); for (size_t i = 0; i < interpAttr.pads_end.size(); i++) - padEnd[i] = static_cast(interpAttr.pads_end[i]); + interpAttrs.padEnd[i] = static_cast(interpAttr.pads_end[i]); } - scales = std::dynamic_pointer_cast(interp->get_input_node_shared_ptr(SCALES_ID))->cast_vector(); - if (isAxesSpecified) { axes = std::dynamic_pointer_cast(interp->get_input_node_shared_ptr(AXES_ID))->cast_vector(); } else { @@ -1819,10 +1803,6 @@ MKLDNNInterpolateNode::MKLDNNInterpolateNode(const std::shared_ptr axes[i] = i; } } - - if (scales.size() != axes.size()) { - IE_THROW() << errorPrefix << " does not have the same number elements in scales as in axis."; - } } else { IE_THROW(NotImplemented) << errorMessage; } @@ -1835,18 +1815,17 @@ void MKLDNNInterpolateNode::getSupportedDescriptors() { if (getChildEdges().empty()) IE_THROW() << errorPrefix << " has incorrect number of output edges"; - srcDim = getInputShapeAtPort(DATA_ID).getStaticDims(); - int dataRank = srcDim.size(); + int dataRank = getInputShapeAtPort(DATA_ID).getRank(); // get pad - for (int i = 0; i < padBegin.size(); i++) { - if (padBegin[i] != 0) { + for (int i = 0; i < interpAttrs.padBegin.size(); i++) { + if (interpAttrs.padBegin[i] != 0) { hasPad = true; break; } } - for (int i = 0; i < padEnd.size(); i++) { - if (padEnd[i] != 0) { + for (int i = 0; i < interpAttrs.padEnd.size(); i++) { + if (interpAttrs.padEnd[i] != 0) { hasPad = true; break; } @@ -1868,21 +1847,15 @@ void MKLDNNInterpolateNode::getSupportedDescriptors() { return result; }; - padBegin = correctPad(padBegin, dataRank); - padEnd = correctPad(padEnd, dataRank); - srcDimPad = getPaddedInputShape(); - } else { - srcDimPad = srcDim; + interpAttrs.padBegin = correctPad(interpAttrs.padBegin, dataRank); + interpAttrs.padEnd = correctPad(interpAttrs.padEnd, dataRank); } - dstDim = getOutputShapeAtPort(0).getStaticDims(); } void MKLDNNInterpolateNode::initSupportedPrimitiveDescriptors() { if (!supportedPrimitiveDescriptors.empty()) return; - setPostOps(attr, true); - Precision inputPrecision = getOriginalInputPrecisionAtPort(DATA_ID); if ((inputPrecision != Precision::I8) && (inputPrecision != Precision::U8) && (inputPrecision != Precision::BF16)) { inputPrecision = Precision::FP32; @@ -1900,12 +1873,6 @@ void MKLDNNInterpolateNode::initSupportedPrimitiveDescriptors() { inputPrecision = outputPrecision = Precision::FP32; } - srcDataSize = inputPrecision.size(); - dstDataSize = outputPrecision.size(); - - inputPrec = inputPrecision; - outputPrec = outputPrecision; - NodeConfig config; config.dynBatchSupport = false; if (isAxesSpecified) { @@ -1932,36 +1899,117 @@ void MKLDNNInterpolateNode::initSupportedPrimitiveDescriptors() { supportedPrimitiveDescriptors.push_back({config, implDetail}); }; - auto channels = getInputShapeAtPort(DATA_ID).getRank() > 1 ? getInputShapeAtPort(DATA_ID).getStaticDims()[1] : 1; + const auto &dataMinDims = getInputShapeAtPort(DATA_ID).getMinDims(); + bool isBlkApplied = getInputShapeAtPort(DATA_ID).getRank() > 1 && dataMinDims[1] != Shape::UNDEFINED_DIM && dataMinDims[1] > 1; - if (!mayiuse(cpu::x64::sse41) || mode == InterpolateMode::linear) { + if (!mayiuse(cpu::x64::sse41) || interpAttrs.mode == InterpolateMode::linear) { pushDesc(LayoutType::ncsp, ref); } else { // blk and by_channel JIT kernel on sse41 or above machine - if (getInputShapeAtPort(DATA_ID).getRank() == 4 || (getInputShapeAtPort(DATA_ID).getRank() == 5 && mode != InterpolateMode::cubic)) { + if (getInputShapeAtPort(DATA_ID).getRank() == 4 || (getInputShapeAtPort(DATA_ID).getRank() == 5 && interpAttrs.mode != InterpolateMode::cubic)) { if (mayiuse(cpu::x64::avx512_common)) { pushDesc(LayoutType::nspc, jit_avx512); - if (channels != 1) + if (isBlkApplied) pushDesc(LayoutType::nCsp16c, jit_avx512); } else if (mayiuse(cpu::x64::avx2)) { pushDesc(LayoutType::nspc, jit_avx2); - if (channels != 1) + if (isBlkApplied) pushDesc(LayoutType::nCsp8c, jit_avx2); } else { pushDesc(LayoutType::nspc, jit_sse42); - if (channels != 1) + if (isBlkApplied) pushDesc(LayoutType::nCsp8c, jit_sse42); } } // planar for 1.ref on machine without sse41(if no sse41, canFuse() is false). 2.JIT kernel for f32 && avx2(gather).(with fuse) - if (mayiuse(cpu::x64::avx2) && inputPrec == Precision::FP32) { + if (mayiuse(cpu::x64::avx2) && inputPrecision == Precision::FP32) { pushDesc(LayoutType::ncsp, jit_avx2); } } } -void MKLDNNInterpolateNode::createPrimitive() { +bool MKLDNNInterpolateNode::needShapeInfer() const { + if (MKLDNNNode::inputShapesModified()) { + return true; + } + if (shapeCalcMode == InterpolateShapeCalcMode::scales) { + if (lastScales.empty()) { + return true; + } + const float *scales = reinterpret_cast(getParentEdgesAtPort(SCALES_ID)[0]->getMemory().GetPtr()); + for (size_t i = 0; i < lastScales.size(); i++) { + if (lastScales[i] != scales[i]) { + return true; + } + } + } else { + if (lastSizes.empty()) { + return true; + } + const int32_t *sizes = reinterpret_cast(getParentEdgesAtPort(TARGET_SHAPE_ID)[0]->getMemory().GetPtr()); + for (size_t i = 0; i < lastSizes.size(); i++) { + if (sizes[i] != lastSizes[i]) { + return true; + } + } + } + return false; +} + +std::vector MKLDNNInterpolateNode::shapeInfer() const { + std::vector input_shapes = { + getParentEdgesAtPort(DATA_ID)[0]->getMemory().GetShape().getStaticDims(), + getParentEdgesAtPort(TARGET_SHAPE_ID)[0]->getMemory().GetShape().getStaticDims(), + getParentEdgesAtPort(SCALES_ID)[0]->getMemory().GetShape().getStaticDims() + }; + + const size_t port = shapeCalcMode == InterpolateShapeCalcMode::sizes ? TARGET_SHAPE_ID : SCALES_ID; + const auto &memory = getParentEdgesAtPort(port)[0]->getMemory(); + std::map> input_values = { + {port, std::make_shared(InferenceEngine::details::convertPrecision(memory.getDesc().getPrecision()), + memory.getStaticDims(), memory.GetPtr())} + }; + + if (getParentEdges().size() > AXES_ID) { + const auto &memory = getParentEdgesAtPort(AXES_ID)[0]->getMemory(); + input_shapes.push_back(memory.getStaticDims()); + input_values.insert({3, std::make_shared(InferenceEngine::details::convertPrecision(memory.getDesc().getPrecision()), + memory.getStaticDims(), memory.GetPtr())}); + } + + std::vector output_shapes; + shape_inference(opToShapeInfer.get(), input_shapes, output_shapes, input_values); + + std::vector result(output_shapes.size()); + std::transform(output_shapes.begin(), output_shapes.end(), result.begin(), [](const ov::StaticShape& s){ return s.to_shape(); }); + + return result; +} + +void MKLDNNInterpolateNode::executeDynamicImpl(mkldnn::stream strm) { + execute(strm); + + const size_t port = shapeCalcMode == InterpolateShapeCalcMode::sizes ? TARGET_SHAPE_ID : SCALES_ID; + const auto &memory = getParentEdgesAtPort(port)[0]->getMemory(); + if (shapeCalcMode == InterpolateShapeCalcMode::scales) { + const float *scales = reinterpret_cast(memory.GetPtr()); + lastScales.assign(scales, scales + memory.getDesc().getShape().getElementsCount()); + } else { + const int32_t *sizes = reinterpret_cast(memory.GetPtr()); + lastSizes.assign(sizes, sizes + memory.getDesc().getShape().getElementsCount()); + } +} + +bool MKLDNNInterpolateNode::needPrepareParams() const { + return (inputShapesModified() || lastOutputDims != getChildEdgesAtPort(0)[0]->getMemory().getStaticDims()); +} + +void MKLDNNInterpolateNode::prepareParams() { + if (!shapesDefined()) { + IE_THROW() << "Can't prepare params for Interpolate node with name: " << getName() << ", because input/output dims aren't defined"; + } + auto& dstMemPtr = getChildEdgeAt(0)->getMemoryPtr(); auto& srcMemPtr = getParentEdgeAt(DATA_ID)->getMemoryPtr(); auto& tsMemPtr = getParentEdgeAt(TARGET_SHAPE_ID)->getMemoryPtr(); @@ -1982,81 +2030,55 @@ void MKLDNNInterpolateNode::createPrimitive() { if (getSelectedPrimitiveDescriptor() == nullptr) IE_THROW() << errorPrefix << " did not set preferable primitive descriptor"; - auto jcp = jit_interpolate_config_params(); - jcp.mode = mode; - jcp.src_dt = getParentEdgeAt(0)->getMemory().GetDataType(); - jcp.dst_dt = getChildEdgeAt(0)->getMemory().GetDataType(); - jcp.src_data_size = MKLDNNExtensionUtils::sizeOfDataType(jcp.src_dt); - jcp.dst_data_size = MKLDNNExtensionUtils::sizeOfDataType(jcp.dst_dt); - jcp.indices_size = sizeof(int); - size_t dimSize = dstDim.size(); - auto srcDimPad5d = to5Dim(srcDimPad); - auto dstDim5d = to5Dim(dstDim); - jcp.OW = dstDim5d[4]; - jcp.OH = dstDim5d[3]; - jcp.OD = dstDim5d[2]; - jcp.IW = srcDimPad5d[4]; - jcp.IH = srcDimPad5d[3]; - jcp.ID = srcDimPad5d[2]; - jcp.spatial_dim_size = spatialDimSize; + const auto &srcDims = srcMemPtr->getStaticDims(); + const auto &dstDims = dstMemPtr->getStaticDims(); + setPostOps(attr, dstDims, true); - if (getChildEdgeAt(0)->getMemory().getDesc().hasLayoutType(LayoutType::ncsp)) { - jcp.layout = InterpolateLayoutType::planar; - } else if (getChildEdgeAt(0)->getMemory().getDesc().hasLayoutType(LayoutType::nCsp8c) || - getChildEdgeAt(0)->getMemory().getDesc().hasLayoutType(LayoutType::nCsp16c)) { - jcp.layout = InterpolateLayoutType::block; - } else { - jcp.layout = InterpolateLayoutType::by_channel; - } - - configured_for_layout = jcp.layout; - - if (mode == InterpolateMode::nearest || mode == InterpolateMode::linear_onnx || mode == InterpolateMode::cubic) { - if (jcp.layout != InterpolateLayoutType::planar) { - if (mayiuse(cpu::x64::avx512_common)) { - interpolateKernel.reset(new jit_uni_interpolate_kernel_f32(jcp, *attr.get())); - } else if (mayiuse(cpu::x64::avx2)) { - interpolateKernel.reset(new jit_uni_interpolate_kernel_f32(jcp, *attr.get())); - } else if (mayiuse(cpu::x64::sse41)) { - interpolateKernel.reset(new jit_uni_interpolate_kernel_f32(jcp, *attr.get())); - } - } else { - // gather ISA(for planar JIT kernel) for avx2 and fp32 - if (mayiuse(cpu::x64::avx2) && inputPrec == Precision::FP32) { - interpolateKernel.reset(new jit_uni_interpolate_kernel_f32(jcp, *attr.get())); - } - } - if (interpolateKernel) - interpolateKernel->create_ker(); - } - - // build indices table - std::vector dataScales = getScales(); - if (dimSize > 2 && (dataScales[0] != 1.f || dataScales[1] != 1.f)) { + std::vector dataScales = getScales(getPaddedInputShape(srcDims, interpAttrs.padBegin, interpAttrs.padEnd), dstDims); + if (getOutputShapeAtPort(0).getRank() > 2 && (dataScales[0] != 1.f || dataScales[1] != 1.f)) { IE_THROW() << "Interpolate layer only supports resize on spatial dimensions(depth, height and width)"; } + if ((interpAttrs.mode == InterpolateMode::nearest || interpAttrs.mode == InterpolateMode::linear_onnx || interpAttrs.mode == InterpolateMode::cubic) && + ((interpAttrs.layout != InterpolateLayoutType::planar && mayiuse(cpu::x64::sse41)) || + (mayiuse(cpu::x64::avx2) && interpAttrs.inPrc == Precision::FP32))) { + execPtr = std::make_shared(interpAttrs, + srcDims, + dstDims, + dataScales, + attr); + } else { + execPtr = std::make_shared(interpAttrs, + srcDims, + dstDims, + dataScales); + } + lastOutputDims = dstDims; +} - switch (mode) { - case InterpolateMode::nearest: { - buildTblNN(srcDimPad5d, dstDim5d, dataScales, jcp.layout); - break; - } - case InterpolateMode::linear_onnx: { - buildTblLinearOnnx(srcDimPad5d, dstDim5d, dataScales, jcp.layout); - break; - } - case InterpolateMode::linear: { - buildTblLinear(srcDimPad5d, dstDim5d, dataScales, LINEAR_KERNEL, antialias); - break; - } - case InterpolateMode::cubic: { - buildTblCubic(srcDimPad5d, dstDim5d, dataScales, cubeCoeff, jcp.layout); - break; - } - default: { - IE_THROW() << errorPrefix << " does not support interpolate mode:" << mode; - break; - } +void MKLDNNInterpolateNode::createPrimitive() { + auto& srcMemPtr = getParentEdgeAt(DATA_ID)->getMemoryPtr(); + auto& dstMemPtr = getChildEdgesAtPort(0)[0]->getMemoryPtr(); + if (!srcMemPtr || !srcMemPtr->GetPrimitivePtr()) + IE_THROW() << errorPrefix << " did not allocate input memory"; + if (!dstMemPtr || !dstMemPtr->GetPrimitivePtr()) + IE_THROW() << errorPrefix << " did not allocate destination memory"; + + if (dstMemPtr->getDesc().hasLayoutType(LayoutType::ncsp)) { + interpAttrs.layout = InterpolateLayoutType::planar; + } else if (dstMemPtr->getDesc().hasLayoutType(LayoutType::nCsp8c) || + dstMemPtr->getDesc().hasLayoutType(LayoutType::nCsp16c)) { + interpAttrs.layout = InterpolateLayoutType::block; + } else { + interpAttrs.layout = InterpolateLayoutType::by_channel; + } + + interpAttrs.inPrc = srcMemPtr->getDesc().getPrecision(); + interpAttrs.outPrc = dstMemPtr->getDesc().getPrecision(); + + if (shapesDefined()) { + if (needPrepareParams()) + prepareParams(); + updateLastInputDims(); } } @@ -2064,11 +2086,412 @@ inline int clipCoord(int pos, int length) { return std::max(static_cast(0), std::min(pos, length - 1)); } +static inline float triangleCoeff(float x) { + return (std::max)(0.0f, 1 - std::abs(x)); +} + +void MKLDNNInterpolateNode::setPostOps(mkldnn::primitive_attr &attr, const VectorDims &dims, bool initWeights) { + mkldnn::post_ops ops; + + for (auto &node : fusedWith) { + auto* fakeQuantizeNode = dynamic_cast(node.get()); + if (fakeQuantizeNode) { + fakeQuantizeNode->appendPostOps(ops); + continue; + } + + auto* eltwiseNode = dynamic_cast(node.get()); + if (eltwiseNode) { + constexpr int align = 16; + eltwiseNode->appendPostOps(ops, dims, align); + continue; + } + + IE_THROW() << "Fusing of " << NameFromType(node->getType()) << " operation to " << NameFromType(this->getType()) << " node is not implemented"; + } + + attr.set_post_ops(ops); +} + +SizeVector MKLDNNInterpolateNode::getPaddedInputShape(const VectorDims &srcDims, + const std::vector &padBegin, + const std::vector &padEnd) { + SizeVector paddedShape; + int dataRank = srcDims.size(); + for (int i = 0; i < dataRank; i++) { + paddedShape.push_back(srcDims[i] + padBegin[i] + padEnd[i]); + } + return paddedShape; +} + +// get scales of data rank size +// if "scale" version: set scales with input scales, 1.f for other dims not in axis +// if "size" version: scales = shape[target] / shape[input].pad, 1.f for other dims not in axis +// scales is a required input, but should not use input scales when "size" case, which may added eps that lead to inaccurate result, recalculate scales instead. +std::vector MKLDNNInterpolateNode::getScales(const VectorDims &srcDimPad, const VectorDims &dstDim) { + const size_t dataRank = getInputShapeAtPort(DATA_ID).getRank(); + const float *scales = reinterpret_cast(getParentEdgesAtPort(SCALES_ID)[0]->getMemory().GetPtr()); + std::vector fullScales(dataRank, 1.f); + const size_t axesRank = axes.size(); + for (size_t i = 0; i < axesRank; i++) { + int axis = axes[i]; + fullScales[axis] = (shapeCalcMode == InterpolateShapeCalcMode::scales) ? scales[i] : + static_cast(dstDim[axis]) / static_cast(srcDimPad[axis]); + } + return fullScales; +} + +void MKLDNNInterpolateNode::execute(mkldnn::stream strm) { + if (!execPtr) { + IE_THROW() << "Can't execute Interpolate node. Primitive didn't created"; + } + + auto &dstMemPtr = getChildEdgeAt(0)->getMemoryPtr(); + auto &srcMemPtr = getParentEdgeAt(DATA_ID)->getMemoryPtr(); + + uint8_t *dst_data = reinterpret_cast(dstMemPtr->GetPtr()); + const uint8_t *src_data_origin = reinterpret_cast(srcMemPtr->GetData()); + + const auto &srcDim = srcMemPtr->getStaticDims(); + const auto &dstDim = dstMemPtr->getStaticDims(); + size_t dimSize = srcDim.size(); + auto srcDimPad = execPtr->getSrcDimPad5d(); + + const auto srcDim5d = to5Dim(srcDim); + const auto srcDimPad5d = to5Dim(srcDimPad); + const auto dstDim5d = to5Dim(dstDim); + const auto srcDataSize = srcMemPtr->getDesc().getPrecision().size(); + + const uint8_t *src_data = nullptr; + std::vector srcPadded; + if (hasPad) { + int padB0 = (dimSize > 2) ? interpAttrs.padBegin[0] : 0; + int padB1 = (dimSize > 2) ? interpAttrs.padBegin[1] : 0; + int padB2 = (dimSize == 5) ? interpAttrs.padBegin[dimSize - 3] : 0; + int padB3 = interpAttrs.padBegin[dimSize - 2]; + int padB4 = interpAttrs.padBegin[dimSize - 1]; + + SizeVector inShapeBlock = getBlockND(srcDim5d); + SizeVector inShapePadBlock = getBlockND(srcDimPad5d); + + if (interpAttrs.layout == InterpolateLayoutType::planar) { + srcPadded.resize(inShapePadBlock[0] * srcDataSize, 0); + uint8_t *src_data_pad = static_cast(&srcPadded[0]); + parallel_for4d(srcDim5d[0], srcDim5d[1], srcDim5d[2], srcDim5d[3], [&](int n, int c, int d, int h) { + const uint8_t *src = src_data_origin + (inShapeBlock[1] * n + inShapeBlock[2] * c + inShapeBlock[3] * d + inShapeBlock[4] * h) * srcDataSize; + uint8_t *srcPad = src_data_pad + (inShapePadBlock[1] * (n + padB0) + inShapePadBlock[2] * (c + padB1) + + inShapePadBlock[3] * (d + padB2) + inShapePadBlock[4] * (h + padB3) + padB4) * srcDataSize; + cpu_memcpy(srcPad, src, srcDim5d[4] * srcDataSize); + }); + src_data = src_data_pad; + } else if (interpAttrs.layout == InterpolateLayoutType::by_channel) { + srcPadded.resize(inShapePadBlock[0] * srcDataSize, 0); + uint8_t *src_data_pad = static_cast(&srcPadded[0]); + parallel_for4d(srcDim5d[0], srcDim5d[2], srcDim5d[3], srcDim5d[4], [&](int n, int d, int h, int w) { + const uint8_t *src = src_data_origin + (inShapeBlock[1] * n + + (inShapeBlock[3] * d + inShapeBlock[4] * h + inShapeBlock[5] * w) * srcDim5d[1]) * srcDataSize; + uint8_t *srcPad = src_data_pad + (inShapePadBlock[1] * (n + padB0) + (inShapePadBlock[3] * (d + padB2) + + inShapePadBlock[4] * (h + padB3) + inShapePadBlock[5] * (w + padB4)) * srcDimPad5d[1] + padB1) * srcDataSize; + cpu_memcpy(srcPad, src, srcDim5d[1] * srcDataSize); + }); + src_data = src_data_pad; + } else if (interpAttrs.layout == InterpolateLayoutType::block) { + size_t blkSize = mayiuse(cpu::x64::avx512_common) ? 16 : 8; + size_t CB = div_up(srcDimPad5d[1], blkSize); + size_t eltsTotal = srcDimPad5d[0] * CB * srcDimPad5d[2] * srcDimPad5d[3] * srcDimPad5d[4] * blkSize; + srcPadded.resize(eltsTotal * srcDataSize, 0x0); + uint8_t *src_data_pad = static_cast(&srcPadded[0]); + if ((srcDim5d[0] != srcDimPad5d[0]) || (srcDim5d[1] != srcDimPad5d[1])) { + IE_THROW() << "Interpolate layer with name '" << getName() << + "' does not support padding on batch and channel dimensions"; + } + parallel_for5d(srcDim5d[0], CB, srcDim5d[2], srcDim5d[3], srcDim5d[4], [&](int n, int cb, int d, int h, int w) { + const uint8_t *src = src_data_origin + (n * CB * srcDim5d[2] * srcDim5d[3] * srcDim5d[4] * blkSize) * srcDataSize + + (cb * srcDim5d[2] * srcDim5d[3] * srcDim5d[4] * blkSize) * srcDataSize + + (d * srcDim5d[3] * srcDim5d[4] * blkSize) * srcDataSize + + (h * srcDim5d[4] * blkSize) * srcDataSize + + (w * blkSize) * srcDataSize; + uint8_t *srcPad = src_data_pad + (n * CB * srcDimPad5d[2] * srcDimPad5d[3] * srcDimPad5d[4] * blkSize) * srcDataSize + + (cb * srcDimPad5d[2] * srcDimPad5d[3] * srcDimPad5d[4] * blkSize) * srcDataSize + + ((d + padB2) * srcDimPad5d[3] * srcDimPad5d[4] * blkSize) * srcDataSize + + ((h + padB3) * srcDimPad5d[4] * blkSize) * srcDataSize + + ((w + padB4) * blkSize) * srcDataSize; + cpu_memcpy(srcPad, src, blkSize * srcDataSize); + }); + src_data = src_data_pad; + } + } else { + src_data = src_data_origin; + } + + execPtr->exec(src_data, dst_data); +} + +// for ndhwc and nCdhw8c[16c] +// input may be f32/bf16/int8, fused->output varies +void MKLDNNInterpolateNode::InterpolateJitExecutor::NNCGathered(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, + int ID, int IH, int IW, int OD, int OH, int OW) { + int *index_d = static_cast(&indexTable[0]); + int *index_h = static_cast(&indexTable[OD]); + int *index_w = static_cast(&indexTable[OD + OH]); + + bool is_nhwc = (configured_for_layout == by_channel); + + for (int b = 0; b < B; b++) { + if (is_nhwc) { + const uint8_t *in_ptr = in_ptr_ + (IW * IH * ID * C * b) * srcDataSize; + uint8_t *out_ptr = out_ptr_ + (OW * OH * OD * C * b) * dstDataSize; + std::vector index_w_kernel(OW); + for (int ox = 0; ox < OW; ox++) { + index_w_kernel[ox] = index_w[ox] * C * srcDataSize; + } + parallel_for2d(OD, OH, [&](size_t d, size_t h) { + // kernel for C * OW + uint8_t *out_ptr_dh = out_ptr + (C * OW * OH * d + C * OW * h) * dstDataSize; + const uint8_t *in_ptr_dh = in_ptr + (C * IW * IH * index_d[d] + C * IW * index_h[h]) * srcDataSize; + auto arg = jit_interpolate_call_args(); + arg.dst = out_ptr_dh; + arg.src_ptr[0] = in_ptr_dh; + arg.index = static_cast(&(index_w_kernel[0])); + arg.work_amount = C; + arg.oc_off = 0; + (*interpolateKernel)(&arg); + }); + } else { // for blk + int blk_size = mayiuse(cpu::x64::avx512_common) ? 16 : 8; + int CB = div_up(C, blk_size); + const uint8_t *in_ptr = in_ptr_ + (IW * IH * ID * CB * blk_size * b) * srcDataSize; + uint8_t *out_ptr = out_ptr_ + (OW * OH * OD * CB * blk_size * b) * dstDataSize; + std::vector index_w_kernel(OW); + for (int ox = 0; ox < OW; ox++) { + index_w_kernel[ox] = index_w[ox] * blk_size * srcDataSize; + } + parallel_for2d(CB, OD, [&](size_t cb, size_t d) { + uint8_t *out_ptr_cbd = out_ptr + (blk_size * OW * OH * OD * cb + blk_size * OW * OH * d) * dstDataSize; + const uint8_t *in_ptr_cbd = in_ptr + (blk_size * IW * IH * ID * cb + blk_size * IW * IH * index_d[d]) * srcDataSize; + auto arg = jit_interpolate_call_args(); + for (int h = 0; h < OH; h++) { // kernel for blk_size * OW + arg.dst = out_ptr_cbd + blk_size * OW * h * dstDataSize; + arg.src_ptr[0] = in_ptr_cbd + blk_size * IW * index_h[h] * srcDataSize; + arg.index = static_cast(&(index_w_kernel[0])); + arg.work_amount = static_cast(OW); + arg.oc_off = cb * blk_size * sizeof(float); + (*interpolateKernel)(&arg); + } + }); + } + } // batch end +} + +void MKLDNNInterpolateNode::InterpolateJitExecutor::NNPlanar(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, int ID, int IH, int IW, + int OD, int OH, int OW) { + int *index_d = static_cast(&indexTable[0]); + int *index_h = static_cast(&indexTable[OD]); + int *index_w = static_cast(&indexTable[OD + OH]); + + std::vector index_kernel(OH + OW); + // index_h * IW * srcDataSize to reduce and simplify redundant compute + for (int oh = 0; oh < OH; oh++) { + index_kernel[oh] = index_h[oh] * IW * srcDataSize; + } + // index_w * srcDataSize + for (int ow = 0; ow < OW; ow++) { + index_kernel[OH + ow] = index_w[ow] * srcDataSize; + } + + parallel_for3d(B, C, OD, [&](size_t b, size_t c, size_t od) { + const uint8_t *in_ptr = in_ptr_ + (IW * IH * ID * C * b + IW * IH * ID * c + IW * IH * index_d[od]) * srcDataSize; + uint8_t *out_ptr = out_ptr_ + (OW * OH * OD * C * b + OW * OH * OD * c + OW * OH * od) * dstDataSize; + + auto arg = jit_interpolate_call_args(); + arg.src_ptr[0] = in_ptr; + arg.dst = out_ptr; + arg.index = static_cast(&index_kernel[0]); // need index_h and index_w in kernel, it's in continous memory so one param + arg.oc_off = static_cast(c * sizeof(float)); + // work_amount is OH(out loop) and OW(inner loop), can get in kernel from jcp. + (*interpolateKernel)(&arg); + }); +} + +void MKLDNNInterpolateNode::InterpolateJitExecutor::linearOnnxPlanar(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, + int ID, int IH, int IW, int OD, int OH, int OW) { + // FrontTopLeft:0, FrontTopRight:1, FrontBottomLeft:2, FrontBottomRight:3, EndTopLeft:4, EndTopRight:5, EndBottomLeft:6, EndBottomRight:7 + // weight: Left:0, ritht:1, top:2, bottom:3, front:4, end:5 + int *index = static_cast(&indexTable[0]); + int eltInGrid = (spatialDimSize > 2) ? MAX_INPUT_INTERPOLATE : ((spatialDimSize > 1) ? 4 : 2); + int scratchLen = rnd_up(eltInGrid * OW * OH * OD, 16); + float *weight = reinterpret_cast(&indexTable[scratchLen]); + + parallel_for2d(B, C, [&](size_t b, size_t c) { + uint8_t *out_ptr_nc = out_ptr_ + (OH * OW * OD * C * b + OH * OW * OD * c) * dstDataSize; + const uint8_t *in_ptr_nc = in_ptr_ + (IH * IW * ID * C * b + IH * IW * ID * c) * srcDataSize; + auto arg = jit_interpolate_call_args(); + arg.src_ptr[0] = in_ptr_nc; + arg.index = static_cast(&index[0]); + arg.weight_ptr[0] = static_cast(&weight[0]); + arg.dst = out_ptr_nc; + arg.work_amount = OW * OH * OD; + arg.oc_off = static_cast(c * sizeof(float)); + (*interpolateKernel)(&arg); + }); +} + +void MKLDNNInterpolateNode::InterpolateJitExecutor::linearOnnxCGathered(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, int ID, int IH, int IW, + int OD, int OH, int OW) { + // left:OW right:OW Top:OH Bottom:OH Front:OD End:OD + std::vector indexPtr(MAX_INPUT_INTERPOLATE, 0); + std::vector weightPtr(MAX_INPUT_INTERPOLATE, 0); + size_t scratchLen = rnd_up(OW + OW + OH + OH + OD + OD, 16); + indexPtr[0] = static_cast(&indexTable[0]); + indexPtr[1] = static_cast(&indexTable[OW]); + indexPtr[2] = static_cast(&indexTable[2 * OW]); + indexPtr[3] = static_cast(&indexTable[2 * OW + OH]); + indexPtr[4] = static_cast(&indexTable[2 * OW + 2 * OH]); + indexPtr[5] = static_cast(&indexTable[2 * OW + 2 * OH + OD]); + + weightPtr[0] = reinterpret_cast(&indexTable[scratchLen]); + weightPtr[1] = reinterpret_cast(&indexTable[scratchLen + OW]); + weightPtr[2] = reinterpret_cast(&indexTable[scratchLen + 2 * OW]); + weightPtr[3] = reinterpret_cast(&indexTable[scratchLen + 2 * OW + OH]); + weightPtr[4] = reinterpret_cast(&indexTable[scratchLen + 2 * OW + 2 * OH]); + weightPtr[5] = reinterpret_cast(&indexTable[scratchLen + 2 * OW + 2 * OH + OD]); + + bool isByChannel = (configured_for_layout == by_channel) ? true : false; + + int blkSize = mayiuse(cpu::x64::avx512_common) ? 16 : 8; + int CB = isByChannel ? 1 : div_up(C, blkSize); + int CGatherLen = isByChannel ? C : blkSize; + int workAmount = isByChannel ? C : CB; + // n_CB(1)_d_h_w_8[16](c), () for by-channel + int C0 = OW * CGatherLen; + int C1 = OH * C0; + int C2 = OD * C1; + int C3 = CB * C2; + int I0 = IW * CGatherLen; + int I1 = IH * I0; + int I2 = ID * I1; + int I3 = CB * I2; + parallel_for3d(B, OD, OH, [&](size_t b, size_t d, size_t h) { + uint8_t *out_ptr_ndh = out_ptr_ + (C3 * b + C1 * d + C0 * h) * dstDataSize; + + const uint8_t *in_ptr_n = in_ptr_ + (I3 * b) * srcDataSize; + const uint8_t *in_ptr_nf = in_ptr_n + (indexPtr[4][d] * I1) * srcDataSize; + const uint8_t *in_ptr_nft = in_ptr_nf + (indexPtr[2][h] * I0) * srcDataSize; + const uint8_t *in_ptr_nfb = in_ptr_nf + (indexPtr[3][h] * I0) * srcDataSize; + const uint8_t *in_ptr_ne = in_ptr_n + (indexPtr[5][d] * I1) * srcDataSize; + const uint8_t *in_ptr_net = in_ptr_ne + (indexPtr[2][h] * I0) * srcDataSize; + const uint8_t *in_ptr_neb = in_ptr_ne + (indexPtr[3][h] * I0) * srcDataSize; + auto arg = jit_interpolate_call_args(); + for (int w = 0; w < OW; ++w) { + uint8_t *out_ptr_ndhw = out_ptr_ndh + CGatherLen * w * dstDataSize; + + arg.src_ptr[0] = in_ptr_nft + (indexPtr[0][w] * CGatherLen) * srcDataSize; + arg.src_ptr[1] = in_ptr_nft + (indexPtr[1][w] * CGatherLen) * srcDataSize; + arg.src_ptr[2] = in_ptr_nfb + (indexPtr[0][w] * CGatherLen) * srcDataSize; + arg.src_ptr[3] = in_ptr_nfb + (indexPtr[1][w] * CGatherLen) * srcDataSize; + arg.src_ptr[4] = in_ptr_net + (indexPtr[0][w] * CGatherLen) * srcDataSize; + arg.src_ptr[5] = in_ptr_net + (indexPtr[1][w] * CGatherLen) * srcDataSize; + arg.src_ptr[6] = in_ptr_neb + (indexPtr[0][w] * CGatherLen) * srcDataSize; + arg.src_ptr[7] = in_ptr_neb + (indexPtr[1][w] * CGatherLen) * srcDataSize; + arg.weight_ptr[0] = static_cast(&weightPtr[0][w]); + arg.weight_ptr[1] = static_cast(&weightPtr[1][w]); + arg.weight_ptr[2] = static_cast(&weightPtr[2][h]); + arg.weight_ptr[3] = static_cast(&weightPtr[3][h]); + arg.weight_ptr[4] = static_cast(&weightPtr[4][d]); + arg.weight_ptr[5] = static_cast(&weightPtr[5][d]); + arg.dst = out_ptr_ndhw; + arg.work_amount = workAmount; + arg.oc_off = 0; + (*interpolateKernel)(&arg); + } + }); +} + +void MKLDNNInterpolateNode::InterpolateJitExecutor::cubicCGathered(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, int IH, int IW, int OH, int OW) { + const int idxNum = 1; + int *xOrigin = static_cast(&indexTable[0]); + float *xFactor = reinterpret_cast(&indexTable[OW]); + int *yOrigin = static_cast(&indexTable[(CUBIC_GRID_LEN + idxNum) * OW]); + float *yFactor = reinterpret_cast(&indexTable[(CUBIC_GRID_LEN + idxNum) * OW + OH]); + + int blkSize = mayiuse(cpu::x64::avx512_common) ? 16 : 8; + int CB = div_up(C, blkSize); + int CSize = configured_for_layout == InterpolateLayoutType::by_channel ? C : blkSize * CB; + int CGatherLen = configured_for_layout == InterpolateLayoutType::by_channel ? C : blkSize; + int workAmount = configured_for_layout == InterpolateLayoutType::by_channel ? C : CB; + + parallel_for3d(B, OH, OW, [&](size_t b, size_t h, size_t w) { + uint8_t *out_ptr_nhw = out_ptr_ + (OH * OW * CSize * b + OW * CGatherLen * h + CGatherLen * w) * dstDataSize; + const uint8_t *in_ptr_n = in_ptr_ + (IH * IW * CSize * b) * srcDataSize; + + std::vector kernelIndex(CUBIC_GRID_LEN * CUBIC_GRID_LEN); // 16 address offset to src(batch) or src(CB) + int iy = yOrigin[h]; + int ix = xOrigin[w]; + for (int y = iy - 1, i = 0; y <= iy + 2; y++, i++) { + int yInRange = std::max(0, std::min(y, IH - 1)); + yInRange = yInRange * CGatherLen * IW * srcDataSize; + for (int x = ix - 1, j = 0; x <= ix + 2; x++, j++) { + int xInRange = std::max(0, std::min(x, IW - 1)); + xInRange = yInRange + xInRange * CGatherLen * srcDataSize; + kernelIndex[i * CUBIC_GRID_LEN + j] = xInRange; + } + } + auto arg = jit_interpolate_call_args(); + arg.dst = out_ptr_nhw; + arg.src_ptr[0] = in_ptr_n; + arg.index = static_cast(&kernelIndex[0]); + // 0 for weight_W, 1 for weight_H + arg.weight_ptr[0] = static_cast(&xFactor[w * CUBIC_GRID_LEN]); + arg.weight_ptr[1] = static_cast(&yFactor[h * CUBIC_GRID_LEN]); + + // for by channel, src + step, dst + step, process next step on continuous memory + // for blk, src + IW*IH*blkSize, dst + OW*OH*blkSize, process the blkSize on next CB + arg.work_amount = workAmount; + arg.oc_off = 0; + (*interpolateKernel)(&arg); + }); +} + +void MKLDNNInterpolateNode::InterpolateJitExecutor::cubicPlanar(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, int IH, int IW, int OH, int OW) { + int tblAdvance = 0; + int *xOrigin = static_cast(&indexTable[tblAdvance]); + tblAdvance += OW; + float *xFactor = reinterpret_cast(&indexTable[tblAdvance]); + tblAdvance += CUBIC_GRID_LEN * OW; + int *yOrigin = static_cast(&indexTable[tblAdvance]); + tblAdvance += OH; + float *yFactor = reinterpret_cast(&indexTable[tblAdvance]); + + tblAdvance += CUBIC_GRID_LEN * OH; + int *sequenceOH = static_cast(&indexTable[tblAdvance]); + tblAdvance += OW * OH; + int *sequenceOW = static_cast(&indexTable[tblAdvance]); + + parallel_for2d(B, C, [&](size_t n, size_t c) { + const uint8_t *in_ptr_nc = in_ptr_ + (IW * IH * C * n + IW * IH * c) * srcDataSize; + uint8_t *out_ptr_nc = out_ptr_ + (OW * OH * C * n + OW * OH * c) * dstDataSize; + + auto arg = jit_interpolate_call_args(); + arg.dst = out_ptr_nc; + arg.src_ptr[0] = in_ptr_nc; + arg.index = xOrigin; + arg.src_ptr[1] = yOrigin; + arg.src_ptr[2] = static_cast(&sequenceOH[0]); + arg.src_ptr[3] = static_cast(&sequenceOW[0]); + arg.weight_ptr[0] = xFactor; + arg.weight_ptr[1] = yFactor; + arg.work_amount = static_cast(OW * OH); + arg.oc_off = static_cast(c * sizeof(float)); + (*interpolateKernel)(&arg); + }); +} + +// ===================================================================================================================== // index layout: // d_0............d_OD-1, h_0..............h_OH-1, w_0................w_OW-1 -void MKLDNNInterpolateNode::buildTblNN(SizeVector& srcDimPad5d, SizeVector& dstDim5d, - std::vector& dataScales, InterpolateLayoutType layout) { - int dimSize = srcDim.size(); +void MKLDNNInterpolateNode::InterpolateExecutor::buildTblNN(const SizeVector& srcDimPad5d, const SizeVector& dstDim5d, + const std::vector& dataScales, InterpolateLayoutType layout, InterpolateNearestMode nearestMode) { + const int dimSize = dataRank; float fz = (dimSize == 5) ? dataScales[dimSize - 3] : 1.f; float fy = dataScales[dimSize - 2]; float fx = dataScales[dimSize - 1]; @@ -2081,22 +2504,98 @@ void MKLDNNInterpolateNode::buildTblNN(SizeVector& srcDimPad5d, SizeVector& dstD bool isWDownsample = (fx < 1) ? true : false; for (int oz = 0; oz < OD; oz++) { float iz = coordTransToInput(oz, fz, ID, OD); - indexTable[oz] = nearestRound(iz, isDDownsample); + indexTable[oz] = nearestRound(iz, isDDownsample, nearestMode); indexTable[oz] = clipCoord(indexTable[oz], ID); } for (int oy = 0; oy < OH; oy++) { float iy = coordTransToInput(oy, fy, IH, OH); - indexTable[OD + oy] = nearestRound(iy, isHDownsample); + indexTable[OD + oy] = nearestRound(iy, isHDownsample, nearestMode); indexTable[OD + oy] = clipCoord(indexTable[OD + oy], IH); } for (int ox = 0; ox < OW; ox++) { float ix = coordTransToInput(ox, fx, IW, OW); - indexTable[OD + OH + ox] = nearestRound(ix, isWDownsample); + indexTable[OD + OH + ox] = nearestRound(ix, isWDownsample, nearestMode); indexTable[OD + OH + ox] = clipCoord(indexTable[OD + OH + ox], IW); } } -void MKLDNNInterpolateNode::linearOnnxCF(int outCoord, float scale, int inShape, int outShape, int& index0, int& index1, float& weight0, float& weight1) { +// scale is float(outShape) / float(inShape) +// strictly consistent with onnx calc manner(div scale, not multiply inverse), given this is done offline +// the slight precison diff can produce obvious wrong value due to "nearest round" behavior for NN mode +float MKLDNNInterpolateNode::InterpolateExecutor::coordTransToInput(int outCoord, float scale, int inShape, int outShape) const { + if (scale == 1.0f || (inShape == outShape)) { + return outCoord; + } + switch (coordTransMode) { + case InterpolateCoordTransMode::half_pixel: { + return (outCoord + 0.5f) / scale - 0.5f; + break; + } + case InterpolateCoordTransMode::pytorch_half_pixel: { + if (outShape > 1) + return (outCoord + 0.5f) / scale - 0.5f; + else + return 0; + break; + } + case InterpolateCoordTransMode::asymmetric: { + return static_cast(outCoord) / scale; + break; + } + case InterpolateCoordTransMode::tf_half_pixel_for_nn: { + return (outCoord + 0.5f) / scale; + break; + } + case InterpolateCoordTransMode::align_corners: { + if (outShape > 1) + return outCoord * (static_cast(inShape - 1) / static_cast(outShape - 1)); + else + return 0; + break; + } + default: { + IE_THROW() << "errorPrefix" << " does not support specified coordinate transformation mode"; + break; + } + } +} + +int MKLDNNInterpolateNode::InterpolateExecutor::nearestRound(float originCoord, bool isDownsample, InterpolateNearestMode nearestMode) const { + switch (nearestMode) { + case InterpolateNearestMode::round_prefer_floor: { + if (originCoord == (static_cast(originCoord) + 0.5f)) + return static_cast(std::floor(originCoord)); + else + return static_cast(std::round(originCoord)); + break; + } + case InterpolateNearestMode::round_prefer_ceil: { + return static_cast(std::round(originCoord)); + break; + } + case InterpolateNearestMode::floor: { + return static_cast(std::floor(originCoord)); + break; + } + case InterpolateNearestMode::ceil: { + return static_cast(std::ceil(originCoord)); + break; + } + case InterpolateNearestMode::simple: { + if (isDownsample) + return static_cast(std::ceil(originCoord)); + else + return static_cast(originCoord); + } + default: { + IE_THROW() << "errorPrefix" << " does not support specified nearest round mode"; + break; + } + } +} + +void MKLDNNInterpolateNode::InterpolateExecutor::linearOnnxCF(int outCoord, float scale, int inShape, int outShape, + int& index0, int& index1, float& weight0, float& weight1) { float inCoord = coordTransToInput(outCoord, scale, inShape, outShape); inCoord = std::max(0.0f, std::min(inCoord, static_cast(inShape - 1))); index0 = std::min(static_cast(inCoord), inShape - 1); @@ -2110,9 +2609,9 @@ void MKLDNNInterpolateNode::linearOnnxCF(int outCoord, float scale, int inShape, } } -void MKLDNNInterpolateNode::buildTblLinearOnnx(SizeVector& srcDimPad5d, SizeVector& dstDim5d, - std::vector& dataScales, InterpolateLayoutType layout) { - int dimSize = srcDim.size(); +void MKLDNNInterpolateNode::InterpolateExecutor::buildTblLinearOnnx(const SizeVector& srcDimPad5d, const SizeVector& dstDim5d, + const std::vector& dataScales, InterpolateLayoutType layout) { + int dimSize = dataRank; float fz = (spatialDimSize > 2) ? dataScales[dimSize - 3] : 1.f; float fy = (spatialDimSize > 1) ? dataScales[dimSize - 2] : 1.f; float fx = dataScales[dimSize - 1]; @@ -2219,17 +2718,13 @@ void MKLDNNInterpolateNode::buildTblLinearOnnx(SizeVector& srcDimPad5d, SizeVect } } -static inline float triangleCoeff(float x) { - return (std::max)(0.0f, 1 - std::abs(x)); -} - // table layout: // wd .........wd, wh............wh, ww.............ww, id...........id, ih............ih, iw..............iw // | | // wh0.....wh_diameter ih0.....ih_diameter -void MKLDNNInterpolateNode::buildTblLinear(SizeVector& srcDimPad5d, SizeVector& dstDim5d, - std::vector& dataScales, int kernel_width, bool antialias) { - int dimSize = srcDim.size(); +void MKLDNNInterpolateNode::InterpolateExecutor::buildTblLinear(const SizeVector& srcDimPad5d, const SizeVector& dstDim5d, + const std::vector& dataScales, int kernel_width, bool antialias) { + int dimSize = dataRank; float fz = (dimSize == 5) ? dataScales[dimSize - 3] : 1.f; float fy = dataScales[dimSize - 2]; float fx = dataScales[dimSize - 1]; @@ -2304,7 +2799,7 @@ void MKLDNNInterpolateNode::buildTblLinear(SizeVector& srcDimPad5d, SizeVector& } } -std::vector MKLDNNInterpolateNode::getCubicCoeffs(float mantissa, float a) { +std::vector MKLDNNInterpolateNode::InterpolateExecutor::getCubicCoeffs(float mantissa, float a) { float m = std::fabs(mantissa); std::vector coeffs(4, 0.f); @@ -2318,9 +2813,9 @@ std::vector MKLDNNInterpolateNode::getCubicCoeffs(float mantissa, float a // table layout: // OW OW OW OW OW OH OH OH OH OH // x_idx x_weight0 x_weight1 x_weight2 x_weight3 y_idx y_weight0 y_weight1 y_weight2 y_weight3 -void MKLDNNInterpolateNode::buildTblCubic(SizeVector& srcDimPad5d, SizeVector& dstDim5d, std::vector& dataScales, +void MKLDNNInterpolateNode::InterpolateExecutor::buildTblCubic(const SizeVector& srcDimPad5d, const SizeVector& dstDim5d, const std::vector& dataScales, float cubicCoeff, InterpolateLayoutType layout) { - int dimSize = srcDim.size(); + int dimSize = dataRank; float fy = dataScales[dimSize - 2]; float fx = dataScales[dimSize - 1]; int IH = srcDimPad5d[3], IW = srcDimPad5d[4]; @@ -2383,276 +2878,8 @@ void MKLDNNInterpolateNode::buildTblCubic(SizeVector& srcDimPad5d, SizeVector& d } } -void MKLDNNInterpolateNode::setPostOps(mkldnn::primitive_attr &attr, bool initWeights) { - mkldnn::post_ops ops; - - for (auto &node : fusedWith) { - auto* fakeQuantizeNode = dynamic_cast(node.get()); - if (fakeQuantizeNode) { - fakeQuantizeNode->appendPostOps(ops); - continue; - } - - auto* eltwiseNode = dynamic_cast(node.get()); - if (eltwiseNode) { - constexpr int align = 16; - // TODO [DS]: change to shape from memory - eltwiseNode->appendPostOps(ops, getOutputShapeAtPort(0).getStaticDims(), align); - continue; - } - - IE_THROW() << "Fusing of " << NameFromType(node->getType()) << " operation to " << NameFromType(this->getType()) << " node is not implemented"; - } - - attr.set_post_ops(ops); -} - -SizeVector MKLDNNInterpolateNode::getPaddedInputShape() { - SizeVector paddedShape; - int dataRank = srcDim.size(); - for (int i = 0; i < dataRank; i++) { - paddedShape.push_back(srcDim[i] + padBegin[i] + padEnd[i]); - } - return paddedShape; -} - -// get scales of data rank size -// if "scale" version: set scales with input scales, 1.f for other dims not in axis -// if "size" version: scales = shape[target] / shape[input].pad, 1.f for other dims not in axis -// scales is a required input, but should not use input scales when "size" case, which may added eps that lead to inaccurate result, recalculate scales instead. -std::vector MKLDNNInterpolateNode::getScales() { - int dataRank = srcDim.size(); - std::vector fullScales(dataRank, 1.f); - int axesRank = axes.size(); - for (int i = 0; i < axesRank; i++) { - int axis = axes[i]; - fullScales[axis] = (shapeCalcMode == InterpolateShapeCalcMode::scales) ? scales[i] : - static_cast(dstDim[axis]) / static_cast(srcDimPad[axis]); - } - return fullScales; -} - -void MKLDNNInterpolateNode::execute(mkldnn::stream strm) { - auto &dstMemPtr = getChildEdgeAt(0)->getMemoryPtr(); - auto &srcMemPtr = getParentEdgeAt(DATA_ID)->getMemoryPtr(); - - uint8_t *dst_data = reinterpret_cast(dstMemPtr->GetPtr()); - uint8_t *src_data_origin = reinterpret_cast(srcMemPtr->GetData()); - - size_t dimSize = srcDim.size(); - SizeVector srcDimPad = getPaddedInputShape(); - - auto srcDim5d = to5Dim(srcDim); - auto srcDimPad5d = to5Dim(srcDimPad); - auto dstDim5d = to5Dim(dstDim); - - uint8_t *src_data = nullptr; - std::vector srcPadded; - if (hasPad) { - int padB0 = (dimSize > 2) ? padBegin[0] : 0; - int padB1 = (dimSize > 2) ? padBegin[1] : 0; - int padB2 = (dimSize == 5) ? padBegin[dimSize - 3] : 0; - int padB3 = padBegin[dimSize - 2]; - int padB4 = padBegin[dimSize - 1]; - - SizeVector inShapeBlock = getBlockND(srcDim5d); - SizeVector inShapePadBlock = getBlockND(srcDimPad5d); - - if (configured_for_layout == InterpolateLayoutType::planar) { - srcPadded.resize(inShapePadBlock[0] * srcDataSize, 0); - uint8_t *src_data_pad = static_cast(&srcPadded[0]); - parallel_for4d(srcDim5d[0], srcDim5d[1], srcDim5d[2], srcDim5d[3], [&](int n, int c, int d, int h) { - uint8_t *src = src_data_origin + (inShapeBlock[1] * n + inShapeBlock[2] * c + inShapeBlock[3] * d + inShapeBlock[4] * h) * srcDataSize; - uint8_t *srcPad = src_data_pad + (inShapePadBlock[1] * (n + padB0) + inShapePadBlock[2] * (c + padB1) + - inShapePadBlock[3] * (d + padB2) + inShapePadBlock[4] * (h + padB3) + padB4) * srcDataSize; - cpu_memcpy(srcPad, src, srcDim5d[4] * srcDataSize); - }); - src_data = src_data_pad; - } else if (configured_for_layout == InterpolateLayoutType::by_channel) { - srcPadded.resize(inShapePadBlock[0] * srcDataSize, 0); - uint8_t *src_data_pad = static_cast(&srcPadded[0]); - parallel_for4d(srcDim5d[0], srcDim5d[2], srcDim5d[3], srcDim5d[4], [&](int n, int d, int h, int w) { - uint8_t *src = src_data_origin + (inShapeBlock[1] * n + - (inShapeBlock[3] * d + inShapeBlock[4] * h + inShapeBlock[5] * w) * srcDim5d[1]) * srcDataSize; - uint8_t *srcPad = src_data_pad + (inShapePadBlock[1] * (n + padB0) + (inShapePadBlock[3] * (d + padB2) + - inShapePadBlock[4] * (h + padB3) + inShapePadBlock[5] * (w + padB4)) * srcDimPad5d[1] + padB1) * srcDataSize; - cpu_memcpy(srcPad, src, srcDim5d[1] * srcDataSize); - }); - src_data = src_data_pad; - } else if (configured_for_layout == InterpolateLayoutType::block) { - size_t blkSize = mayiuse(cpu::x64::avx512_common) ? 16 : 8; - size_t CB = div_up(srcDimPad5d[1], blkSize); - size_t eltsTotal = srcDimPad5d[0] * CB * srcDimPad5d[2] * srcDimPad5d[3] * srcDimPad5d[4] * blkSize; - srcPadded.resize(eltsTotal * srcDataSize, 0x0); - uint8_t *src_data_pad = static_cast(&srcPadded[0]); - if ((srcDim5d[0] != srcDimPad5d[0]) || (srcDim5d[1] != srcDimPad5d[1])) { - IE_THROW() << "Interpolate layer with name '" << getName() << - "' does not support padding on batch and channel dimensions"; - } - parallel_for5d(srcDim5d[0], CB, srcDim5d[2], srcDim5d[3], srcDim5d[4], [&](int n, int cb, int d, int h, int w) { - uint8_t *src = src_data_origin + (n * CB * srcDim5d[2] * srcDim5d[3] * srcDim5d[4] * blkSize) * srcDataSize - + (cb * srcDim5d[2] * srcDim5d[3] * srcDim5d[4] * blkSize) * srcDataSize - + (d * srcDim5d[3] * srcDim5d[4] * blkSize) * srcDataSize - + (h * srcDim5d[4] * blkSize) * srcDataSize - + (w * blkSize) * srcDataSize; - uint8_t *srcPad = src_data_pad + (n * CB * srcDimPad5d[2] * srcDimPad5d[3] * srcDimPad5d[4] * blkSize) * srcDataSize - + (cb * srcDimPad5d[2] * srcDimPad5d[3] * srcDimPad5d[4] * blkSize) * srcDataSize - + ((d + padB2) * srcDimPad5d[3] * srcDimPad5d[4] * blkSize) * srcDataSize - + ((h + padB3) * srcDimPad5d[4] * blkSize) * srcDataSize - + ((w + padB4) * blkSize) * srcDataSize; - cpu_memcpy(srcPad, src, blkSize * srcDataSize); - }); - src_data = src_data_pad; - } - } else { - src_data = src_data_origin; - } - - size_t N = srcDimPad5d[0], C = srcDimPad5d[1], ID = srcDimPad5d[2], IH = srcDimPad5d[3], IW = srcDimPad5d[4]; - size_t OD = dstDim5d[2], OH = dstDim5d[3], OW = dstDim5d[4]; - std::vector dataScales = getScales(); - if (dimSize > 2 && (dataScales[0] != 1.f || dataScales[1] != 1.f)) { - IE_THROW() << "Interpolate layer only supports resize on spatial dimensions(depth, height and width)"; - } - - switch (mode) { - case InterpolateMode::nearest: { - if (interpolateKernel) { - if (configured_for_layout == InterpolateLayoutType::planar) { - NNPlanar(src_data, dst_data, N, C, ID, IH, IW, OD, OH, OW); - } else { - NNCGathered(src_data, dst_data, N, C, ID, IH, IW, OD, OH, OW); - } - } else { - NNRef(src_data, dst_data, N, C, ID, IH, IW, OD, OH, OW); - } - break; - } - case InterpolateMode::linear_onnx: { - if (interpolateKernel) { - if (configured_for_layout == InterpolateLayoutType::planar) { - linearOnnxPlanar(src_data, dst_data, N, C, ID, IH, IW, OD, OH, OW); - } else { - linearOnnxCGathered(src_data, dst_data, N, C, ID, IH, IW, OD, OH, OW); - } - } else { - linearOnnxRef(src_data, dst_data, N, C, ID, IH, IW, OD, OH, OW); - } - break; - } - case InterpolateMode::cubic: { - if (interpolateKernel) { - if (configured_for_layout == InterpolateLayoutType::planar) { - cubicPlanar(src_data, dst_data, N, C, IH, IW, OH, OW); - } else { - cubicCGathered(src_data, dst_data, N, C, IH, IW, OH, OW); - } - } else { - cubicRef(src_data, dst_data, N, C, IH, IW, OH, OW); - } - break; - } - case InterpolateMode::linear: { - float fz = (dimSize == 5) ? dataScales[dimSize - 3] : 1.f; - float fy = dataScales[dimSize - 2]; - float fx = dataScales[dimSize - 1]; - - bool isDownsample = (fx < 1.f) || (fy < 1.f) || (fz < 1.f); - int kernel_width = 2; - linearInterpolation(src_data, dst_data, N, C, ID, IH, IW, fx, fy, fz, OD, OH, OW, kernel_width, isDownsample && antialias); - break; - } - default: { - IE_THROW() << "Interpolate layer has unsupported interpolate mode: " << mode; - } - } -} - -// for ndhwc and nCdhw8c[16c] -// input may be f32/bf16/int8, fused->output varies -void MKLDNNInterpolateNode::NNCGathered(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, int ID, int IH, int IW, int OD, int OH, int OW) { - int *index_d = static_cast(&indexTable[0]); - int *index_h = static_cast(&indexTable[OD]); - int *index_w = static_cast(&indexTable[OD + OH]); - - bool is_nhwc = (configured_for_layout == by_channel); - - for (int b = 0; b < B; b++) { - if (is_nhwc) { - const uint8_t *in_ptr = in_ptr_ + (IW * IH * ID * C * b) * srcDataSize; - uint8_t *out_ptr = out_ptr_ + (OW * OH * OD * C * b) * dstDataSize; - std::vector index_w_kernel(OW); - for (int ox = 0; ox < OW; ox++) { - index_w_kernel[ox] = index_w[ox] * C * srcDataSize; - } - parallel_for2d(OD, OH, [&](size_t d, size_t h) { - // kernel for C * OW - uint8_t *out_ptr_dh = out_ptr + (C * OW * OH * d + C * OW * h) * dstDataSize; - const uint8_t *in_ptr_dh = in_ptr + (C * IW * IH * index_d[d] + C * IW * index_h[h]) * srcDataSize; - auto arg = jit_interpolate_call_args(); - arg.dst = out_ptr_dh; - arg.src_ptr[0] = in_ptr_dh; - arg.index = static_cast(&(index_w_kernel[0])); - arg.work_amount = C; - arg.oc_off = 0; - (*interpolateKernel)(&arg); - }); - } else { // for blk - int blk_size = mayiuse(cpu::x64::avx512_common) ? 16 : 8; - int CB = div_up(C, blk_size); - const uint8_t *in_ptr = in_ptr_ + (IW * IH * ID * CB * blk_size * b) * srcDataSize; - uint8_t *out_ptr = out_ptr_ + (OW * OH * OD * CB * blk_size * b) * dstDataSize; - std::vector index_w_kernel(OW); - for (int ox = 0; ox < OW; ox++) { - index_w_kernel[ox] = index_w[ox] * blk_size * srcDataSize; - } - parallel_for2d(CB, OD, [&](size_t cb, size_t d) { - uint8_t *out_ptr_cbd = out_ptr + (blk_size * OW * OH * OD * cb + blk_size * OW * OH * d) * dstDataSize; - const uint8_t *in_ptr_cbd = in_ptr + (blk_size * IW * IH * ID * cb + blk_size * IW * IH * index_d[d]) * srcDataSize; - auto arg = jit_interpolate_call_args(); - for (int h = 0; h < OH; h++) { // kernel for blk_size * OW - arg.dst = out_ptr_cbd + blk_size * OW * h * dstDataSize; - arg.src_ptr[0] = in_ptr_cbd + blk_size * IW * index_h[h] * srcDataSize; - arg.index = static_cast(&(index_w_kernel[0])); - arg.work_amount = static_cast(OW); - arg.oc_off = cb * blk_size * sizeof(float); - (*interpolateKernel)(&arg); - } - }); - } - } // batch end -} - -void MKLDNNInterpolateNode::NNPlanar(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, int ID, int IH, int IW, int OD, int OH, int OW) { - int *index_d = static_cast(&indexTable[0]); - int *index_h = static_cast(&indexTable[OD]); - int *index_w = static_cast(&indexTable[OD + OH]); - - std::vector index_kernel(OH + OW); - // index_h * IW * srcDataSize to reduce and simplify redundant compute - for (int oh = 0; oh < OH; oh++) { - index_kernel[oh] = index_h[oh] * IW * srcDataSize; - } - // index_w * srcDataSize - for (int ow = 0; ow < OW; ow++) { - index_kernel[OH + ow] = index_w[ow] * srcDataSize; - } - - parallel_for3d(B, C, OD, [&](size_t b, size_t c, size_t od) { - const uint8_t *in_ptr = in_ptr_ + (IW * IH * ID * C * b + IW * IH * ID * c + IW * IH * index_d[od]) * srcDataSize; - uint8_t *out_ptr = out_ptr_ + (OW * OH * OD * C * b + OW * OH * OD * c + OW * OH * od) * dstDataSize; - - auto arg = jit_interpolate_call_args(); - arg.src_ptr[0] = in_ptr; - arg.dst = out_ptr; - arg.index = static_cast(&index_kernel[0]); // need index_h and index_w in kernel, it's in continous memory so one param - arg.oc_off = static_cast(c * sizeof(float)); - // work_amount is OH(out loop) and OW(inner loop), can get in kernel from jcp. - (*interpolateKernel)(&arg); - }); -} - -void MKLDNNInterpolateNode::NNRef(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, int ID, int IH, int IW, int OD, int OH, int OW) { +void MKLDNNInterpolateNode::InterpolateRefExecutor::NNRef(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, int ID, int IH, int IW, + int OD, int OH, int OW) { int *index_d = static_cast(&indexTable[0]); int *index_h = static_cast(&indexTable[OD]); int *index_w = static_cast(&indexTable[OD + OH]); @@ -2673,99 +2900,8 @@ void MKLDNNInterpolateNode::NNRef(const uint8_t *in_ptr_, uint8_t *out_ptr_, int }); } -void MKLDNNInterpolateNode::linearOnnxPlanar(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, int ID, int IH, int IW, int OD, int OH, int OW) { - // FrontTopLeft:0, FrontTopRight:1, FrontBottomLeft:2, FrontBottomRight:3, EndTopLeft:4, EndTopRight:5, EndBottomLeft:6, EndBottomRight:7 - // weight: Left:0, ritht:1, top:2, bottom:3, front:4, end:5 - int *index = static_cast(&indexTable[0]); - int eltInGrid = (spatialDimSize > 2) ? MAX_INPUT_INTERPOLATE : ((spatialDimSize > 1) ? 4 : 2); - int scratchLen = rnd_up(eltInGrid * OW * OH * OD, 16); - float *weight = reinterpret_cast(&indexTable[scratchLen]); - - parallel_for2d(B, C, [&](size_t b, size_t c) { - uint8_t *out_ptr_nc = out_ptr_ + (OH * OW * OD * C * b + OH * OW * OD * c) * dstDataSize; - const uint8_t *in_ptr_nc = in_ptr_ + (IH * IW * ID * C * b + IH * IW * ID * c) * srcDataSize; - auto arg = jit_interpolate_call_args(); - arg.src_ptr[0] = in_ptr_nc; - arg.index = static_cast(&index[0]); - arg.weight_ptr[0] = static_cast(&weight[0]); - arg.dst = out_ptr_nc; - arg.work_amount = OW * OH * OD; - arg.oc_off = static_cast(c * sizeof(float)); - (*interpolateKernel)(&arg); - }); -} - -void MKLDNNInterpolateNode::linearOnnxCGathered(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, int ID, int IH, int IW, int OD, int OH, int OW) { - // left:OW right:OW Top:OH Bottom:OH Front:OD End:OD - std::vector indexPtr(MAX_INPUT_INTERPOLATE, 0); - std::vector weightPtr(MAX_INPUT_INTERPOLATE, 0); - size_t scratchLen = rnd_up(OW + OW + OH + OH + OD + OD, 16); - indexPtr[0] = static_cast(&indexTable[0]); - indexPtr[1] = static_cast(&indexTable[OW]); - indexPtr[2] = static_cast(&indexTable[2 * OW]); - indexPtr[3] = static_cast(&indexTable[2 * OW + OH]); - indexPtr[4] = static_cast(&indexTable[2 * OW + 2 * OH]); - indexPtr[5] = static_cast(&indexTable[2 * OW + 2 * OH + OD]); - - weightPtr[0] = reinterpret_cast(&indexTable[scratchLen]); - weightPtr[1] = reinterpret_cast(&indexTable[scratchLen + OW]); - weightPtr[2] = reinterpret_cast(&indexTable[scratchLen + 2 * OW]); - weightPtr[3] = reinterpret_cast(&indexTable[scratchLen + 2 * OW + OH]); - weightPtr[4] = reinterpret_cast(&indexTable[scratchLen + 2 * OW + 2 * OH]); - weightPtr[5] = reinterpret_cast(&indexTable[scratchLen + 2 * OW + 2 * OH + OD]); - - bool isByChannel = (configured_for_layout == by_channel) ? true : false; - - int blkSize = mayiuse(cpu::x64::avx512_common) ? 16 : 8; - int CB = isByChannel ? 1 : div_up(C, blkSize); - int CGatherLen = isByChannel ? C : blkSize; - int workAmount = isByChannel ? C : CB; - // n_CB(1)_d_h_w_8[16](c), () for by-channel - int C0 = OW * CGatherLen; - int C1 = OH * C0; - int C2 = OD * C1; - int C3 = CB * C2; - int I0 = IW * CGatherLen; - int I1 = IH * I0; - int I2 = ID * I1; - int I3 = CB * I2; - parallel_for3d(B, OD, OH, [&](size_t b, size_t d, size_t h) { - uint8_t *out_ptr_ndh = out_ptr_ + (C3 * b + C1 * d + C0 * h) * dstDataSize; - - const uint8_t *in_ptr_n = in_ptr_ + (I3 * b) * srcDataSize; - const uint8_t *in_ptr_nf = in_ptr_n + (indexPtr[4][d] * I1) * srcDataSize; - const uint8_t *in_ptr_nft = in_ptr_nf + (indexPtr[2][h] * I0) * srcDataSize; - const uint8_t *in_ptr_nfb = in_ptr_nf + (indexPtr[3][h] * I0) * srcDataSize; - const uint8_t *in_ptr_ne = in_ptr_n + (indexPtr[5][d] * I1) * srcDataSize; - const uint8_t *in_ptr_net = in_ptr_ne + (indexPtr[2][h] * I0) * srcDataSize; - const uint8_t *in_ptr_neb = in_ptr_ne + (indexPtr[3][h] * I0) * srcDataSize; - auto arg = jit_interpolate_call_args(); - for (int w = 0; w < OW; ++w) { - uint8_t *out_ptr_ndhw = out_ptr_ndh + CGatherLen * w * dstDataSize; - - arg.src_ptr[0] = in_ptr_nft + (indexPtr[0][w] * CGatherLen) * srcDataSize; - arg.src_ptr[1] = in_ptr_nft + (indexPtr[1][w] * CGatherLen) * srcDataSize; - arg.src_ptr[2] = in_ptr_nfb + (indexPtr[0][w] * CGatherLen) * srcDataSize; - arg.src_ptr[3] = in_ptr_nfb + (indexPtr[1][w] * CGatherLen) * srcDataSize; - arg.src_ptr[4] = in_ptr_net + (indexPtr[0][w] * CGatherLen) * srcDataSize; - arg.src_ptr[5] = in_ptr_net + (indexPtr[1][w] * CGatherLen) * srcDataSize; - arg.src_ptr[6] = in_ptr_neb + (indexPtr[0][w] * CGatherLen) * srcDataSize; - arg.src_ptr[7] = in_ptr_neb + (indexPtr[1][w] * CGatherLen) * srcDataSize; - arg.weight_ptr[0] = static_cast(&weightPtr[0][w]); - arg.weight_ptr[1] = static_cast(&weightPtr[1][w]); - arg.weight_ptr[2] = static_cast(&weightPtr[2][h]); - arg.weight_ptr[3] = static_cast(&weightPtr[3][h]); - arg.weight_ptr[4] = static_cast(&weightPtr[4][d]); - arg.weight_ptr[5] = static_cast(&weightPtr[5][d]); - arg.dst = out_ptr_ndhw; - arg.work_amount = workAmount; - arg.oc_off = 0; - (*interpolateKernel)(&arg); - } - }); -} - -void MKLDNNInterpolateNode::linearOnnxRef(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, int ID, int IH, int IW, int OD, int OH, int OW) { +void MKLDNNInterpolateNode::InterpolateRefExecutor::linearOnnxRef(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, int ID, int IH, int IW, + int OD, int OH, int OW) { std::vector indexPtr(MAX_INPUT_INTERPOLATE, 0); std::vector weightPtr(MAX_INPUT_INTERPOLATE, 0); // FrontTopLeft:0, FrontTopRight:1, FrontBottomLeft:2, FrontBottomRight:3, @@ -2862,11 +2998,102 @@ void MKLDNNInterpolateNode::linearOnnxRef(const uint8_t *in_ptr_, uint8_t *out_p }); } -void MKLDNNInterpolateNode::linearInterpolation(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, int ID, int IH, int IW, +void MKLDNNInterpolateNode::InterpolateRefExecutor::cubicRef(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, int IH, int IW, int OH, int OW) { + const int idxNum = 1; + int *xOrigin = static_cast(&indexTable[0]); + float *xFactor = reinterpret_cast(&indexTable[OW]); + int *yOrigin = static_cast(&indexTable[(CUBIC_GRID_LEN + idxNum) * OW]); + float *yFactor = reinterpret_cast(&indexTable[(CUBIC_GRID_LEN + idxNum) * OW + OH]); + + const float *in_ptr_f32 = reinterpret_cast(in_ptr_); + float *out_ptr_f32 = reinterpret_cast(out_ptr_); + + parallel_for4d(B, C, OH, OW, [&](size_t n, size_t c, size_t oy, size_t ox) { + const float *in_ptr_nc = in_ptr_f32 + (IW * IH * C * n + IW * IH * c); + float *out_ptr_nc = out_ptr_f32 + (OW * OH * C * n + OW * OH * c); + + int iy = yOrigin[oy]; + int ix = xOrigin[ox]; + + float retY = 0.f; + for (int y = iy - 1, i = 0; y <= iy + 2; y++, i++) { + int yInRange = std::max(0, std::min(y, IH - 1)); + const float *in_ptr_nch = in_ptr_nc + IW * yInRange; + float retX = 0.f; + for (int x = ix - 1, j = 0; x <= ix + 2; x++, j++) { + int xInRange = std::max(0, std::min(x, IW - 1)); + retX += xFactor[ox * CUBIC_GRID_LEN + j] * in_ptr_nch[xInRange]; + } + retY += yFactor[oy * CUBIC_GRID_LEN + i] * retX; + } + out_ptr_nc[oy * OW + ox] = retY; + }); +} + +float MKLDNNInterpolateNode::InterpolateRefExecutor::getValue(const uint8_t *base, size_t offset, InferenceEngine::Precision prec) { + const uint8_t *baseOffset = base + offset; + switch (prec) { + case Precision::U8: { + return static_cast(*baseOffset); + break; + } + case Precision::I8: { + const int8_t *valuePtr = reinterpret_cast(baseOffset); + return static_cast(*valuePtr); + break; + } + case Precision::BF16: { + const uint16_t *valuePtr = reinterpret_cast(baseOffset); + return bfloat16_t::from_bits(*valuePtr); + break; + } + case Precision::FP32: { + const float *valuePtr = reinterpret_cast(baseOffset); + return *valuePtr; + break; + } + default: { + IE_THROW() << "Interpolate layer does not support precision: " << prec; + break; + } + } +} + +void MKLDNNInterpolateNode::InterpolateRefExecutor::setValue(uint8_t *base, size_t offset, float value, InferenceEngine::Precision prec) { + uint8_t *baseOffset = base + offset; + switch (prec) { + case Precision::U8: { + uint8_t data = static_cast(value < 0 ? 0 : value); + cpu_memcpy(baseOffset, &data, 1); + break; + } + case Precision::I8: { + int8_t data = static_cast(value); + cpu_memcpy(baseOffset, &data, 1); + break; + } + case Precision::BF16: { + uint16_t data = bfloat16_t(value).to_bits(); + cpu_memcpy(baseOffset, &data, 2); + break; + } + case Precision::FP32: { + cpu_memcpy(baseOffset, &value, sizeof(float)); + break; + } + default: { + IE_THROW() << "Interpolate layer does not support precision: " << prec; + break; + } + } +} + +void MKLDNNInterpolateNode::InterpolateRefExecutor::linearInterpolation(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, int ID, int IH, int IW, float fx, float fy, float fz, int OD, int OH, int OW, int kernel_width, bool antialias) { if (IW == OW && IH == OH && ID == OD) { size_t spatialDimSize = IW * IH * ID; - if (fusedWith.empty() && inputPrec == outputPrec) { + // TODO: enable when fusing into interp with linear mode will support + if (/*fusedWith.empty() &&*/ inputPrec == outputPrec) { size_t size = B * C * spatialDimSize * srcDataSize; cpu_memcpy(out_ptr_, in_ptr_, size); } else { @@ -2978,252 +3205,174 @@ void MKLDNNInterpolateNode::linearInterpolation(const uint8_t *in_ptr_, uint8_t }); } -void MKLDNNInterpolateNode::cubicCGathered(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, int IH, int IW, int OH, int OW) { - const int idxNum = 1; - int *xOrigin = static_cast(&indexTable[0]); - float *xFactor = reinterpret_cast(&indexTable[OW]); - int *yOrigin = static_cast(&indexTable[(CUBIC_GRID_LEN + idxNum) * OW]); - float *yFactor = reinterpret_cast(&indexTable[(CUBIC_GRID_LEN + idxNum) * OW + OH]); +MKLDNNInterpolateNode::InterpolateExecutor::InterpolateExecutor(const InterpolateAttrs& interpAttrs, + const VectorDims &srcDims, + const VectorDims &dstDims, + const std::vector &dataScales) : + mode(interpAttrs.mode), configured_for_layout(interpAttrs.layout), coordTransMode(interpAttrs.coordTransMode), + inputPrec(interpAttrs.inPrc), outputPrec(interpAttrs.outPrc) { + srcDimPad5d = to5Dim(getPaddedInputShape(srcDims, interpAttrs.padBegin, interpAttrs.padEnd)); + dstDim5d = to5Dim(dstDims); + srcDataSize = interpAttrs.inPrc.size(); + dstDataSize = interpAttrs.outPrc.size(); + dataRank = srcDims.size(); + spatialDimSize = getSpatialDimsNum(dataRank); - int blkSize = mayiuse(cpu::x64::avx512_common) ? 16 : 8; - int CB = div_up(C, blkSize); - int CSize = configured_for_layout == InterpolateLayoutType::by_channel ? C : blkSize * CB; - int CGatherLen = configured_for_layout == InterpolateLayoutType::by_channel ? C : blkSize; - int workAmount = configured_for_layout == InterpolateLayoutType::by_channel ? C : CB; + switch (mode) { + case InterpolateMode::nearest: { + buildTblNN(srcDimPad5d, dstDim5d, dataScales, interpAttrs.layout, interpAttrs.nearestMode); + break; + } + case InterpolateMode::linear_onnx: { + buildTblLinearOnnx(srcDimPad5d, dstDim5d, dataScales, interpAttrs.layout); + break; + } + case InterpolateMode::linear: { + static constexpr int LINEAR_KERNEL = 2; + buildTblLinear(srcDimPad5d, dstDim5d, dataScales, LINEAR_KERNEL, interpAttrs.antialias); + break; + } + case InterpolateMode::cubic: { + buildTblCubic(srcDimPad5d, dstDim5d, dataScales, interpAttrs.cubeCoeff, interpAttrs.layout); + break; + } + default: { + IE_THROW() << "Interpolate executor does not support interpolate mode: " << mode; + break; + } + } +} - parallel_for3d(B, OH, OW, [&](size_t b, size_t h, size_t w) { - uint8_t *out_ptr_nhw = out_ptr_ + (OH * OW * CSize * b + OW * CGatherLen * h + CGatherLen * w) * dstDataSize; - const uint8_t *in_ptr_n = in_ptr_ + (IH * IW * CSize * b) * srcDataSize; +MKLDNNInterpolateNode::InterpolateJitExecutor::InterpolateJitExecutor(const InterpolateAttrs& interpAttrs, + const VectorDims &srcDims, + const VectorDims &dstDims, + const std::vector &dataScales, + const mkldnn::primitive_attr &attr) : + InterpolateExecutor(interpAttrs, srcDims, dstDims, dataScales) { + auto jcp = jit_interpolate_config_params(); + jcp.mode = mode; + jcp.src_dt = MKLDNNExtensionUtils::IEPrecisionToDataType(interpAttrs.inPrc); + jcp.dst_dt = MKLDNNExtensionUtils::IEPrecisionToDataType(interpAttrs.outPrc); + jcp.src_data_size = MKLDNNExtensionUtils::sizeOfDataType(jcp.src_dt); + jcp.dst_data_size = MKLDNNExtensionUtils::sizeOfDataType(jcp.dst_dt); + jcp.indices_size = sizeof(int); + jcp.OW = dstDim5d[4]; + jcp.OH = dstDim5d[3]; + jcp.OD = dstDim5d[2]; + jcp.IW = srcDimPad5d[4]; + jcp.IH = srcDimPad5d[3]; + jcp.ID = srcDimPad5d[2]; + jcp.spatial_dim_size = getSpatialDimsNum(srcDims.size()); + jcp.layout = interpAttrs.layout; + if (jcp.layout != InterpolateLayoutType::planar) { + if (mayiuse(cpu::x64::avx512_common)) { + interpolateKernel.reset(new jit_uni_interpolate_kernel_f32(jcp, *attr.get())); + } else if (mayiuse(cpu::x64::avx2)) { + interpolateKernel.reset(new jit_uni_interpolate_kernel_f32(jcp, *attr.get())); + } else if (mayiuse(cpu::x64::sse41)) { + interpolateKernel.reset(new jit_uni_interpolate_kernel_f32(jcp, *attr.get())); + } + } else if (mayiuse(cpu::x64::avx2) && interpAttrs.inPrc == InferenceEngine::Precision::FP32) { + // gather ISA(for planar JIT kernel) for avx2 and fp32 + interpolateKernel.reset(new jit_uni_interpolate_kernel_f32(jcp, *attr.get())); + } else { + IE_THROW() << "Can't create InterpolateJitExecutor"; + } + if (interpolateKernel) { + interpolateKernel->create_ker(); + } else { + IE_THROW() << "Can't compile InterpolateJitExecutor"; + } +} - std::vector kernelIndex(CUBIC_GRID_LEN * CUBIC_GRID_LEN); // 16 address offset to src(batch) or src(CB) - int iy = yOrigin[h]; - int ix = xOrigin[w]; - for (int y = iy - 1, i = 0; y <= iy + 2; y++, i++) { - int yInRange = std::max(0, std::min(y, IH - 1)); - yInRange = yInRange * CGatherLen * IW * srcDataSize; - for (int x = ix - 1, j = 0; x <= ix + 2; x++, j++) { - int xInRange = std::max(0, std::min(x, IW - 1)); - xInRange = yInRange + xInRange * CGatherLen * srcDataSize; - kernelIndex[i * CUBIC_GRID_LEN + j] = xInRange; +void MKLDNNInterpolateNode::InterpolateJitExecutor::exec(const uint8_t *in_ptr_, uint8_t *out_ptr_) { + size_t N = srcDimPad5d[0], C = srcDimPad5d[1], ID = srcDimPad5d[2], IH = srcDimPad5d[3], IW = srcDimPad5d[4]; + size_t OD = dstDim5d[2], OH = dstDim5d[3], OW = dstDim5d[4]; + + if (!interpolateKernel) { + IE_THROW() << "Can't execute, kernel for Interpolate node is not compiled"; + } + switch (mode) { + case InterpolateMode::nearest: { + if (configured_for_layout == InterpolateLayoutType::planar) { + NNPlanar(in_ptr_, out_ptr_, N, C, ID, IH, IW, OD, OH, OW); + } else { + NNCGathered(in_ptr_, out_ptr_, N, C, ID, IH, IW, OD, OH, OW); } + break; } - auto arg = jit_interpolate_call_args(); - arg.dst = out_ptr_nhw; - arg.src_ptr[0] = in_ptr_n; - arg.index = static_cast(&kernelIndex[0]); - // 0 for weight_W, 1 for weight_H - arg.weight_ptr[0] = static_cast(&xFactor[w * CUBIC_GRID_LEN]); - arg.weight_ptr[1] = static_cast(&yFactor[h * CUBIC_GRID_LEN]); - - // for by channel, src + step, dst + step, process next step on continuous memory - // for blk, src + IW*IH*blkSize, dst + OW*OH*blkSize, process the blkSize on next CB - arg.work_amount = workAmount; - arg.oc_off = 0; - (*interpolateKernel)(&arg); - }); -} - -void MKLDNNInterpolateNode::cubicPlanar(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, int IH, int IW, int OH, int OW) { - int tblAdvance = 0; - int *xOrigin = static_cast(&indexTable[tblAdvance]); - tblAdvance += OW; - float *xFactor = reinterpret_cast(&indexTable[tblAdvance]); - tblAdvance += CUBIC_GRID_LEN * OW; - int *yOrigin = static_cast(&indexTable[tblAdvance]); - tblAdvance += OH; - float *yFactor = reinterpret_cast(&indexTable[tblAdvance]); - - tblAdvance += CUBIC_GRID_LEN * OH; - int *sequenceOH = static_cast(&indexTable[tblAdvance]); - tblAdvance += OW * OH; - int *sequenceOW = static_cast(&indexTable[tblAdvance]); - - parallel_for2d(B, C, [&](size_t n, size_t c) { - const uint8_t *in_ptr_nc = in_ptr_ + (IW * IH * C * n + IW * IH * c) * srcDataSize; - uint8_t *out_ptr_nc = out_ptr_ + (OW * OH * C * n + OW * OH * c) * dstDataSize; - - auto arg = jit_interpolate_call_args(); - arg.dst = out_ptr_nc; - arg.src_ptr[0] = in_ptr_nc; - arg.index = xOrigin; - arg.src_ptr[1] = yOrigin; - arg.src_ptr[2] = static_cast(&sequenceOH[0]); - arg.src_ptr[3] = static_cast(&sequenceOW[0]); - arg.weight_ptr[0] = xFactor; - arg.weight_ptr[1] = yFactor; - arg.work_amount = static_cast(OW * OH); - arg.oc_off = static_cast(c * sizeof(float)); - (*interpolateKernel)(&arg); - }); -} - -void MKLDNNInterpolateNode::cubicRef(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, int IH, int IW, int OH, int OW) { - const int idxNum = 1; - int *xOrigin = static_cast(&indexTable[0]); - float *xFactor = reinterpret_cast(&indexTable[OW]); - int *yOrigin = static_cast(&indexTable[(CUBIC_GRID_LEN + idxNum) * OW]); - float *yFactor = reinterpret_cast(&indexTable[(CUBIC_GRID_LEN + idxNum) * OW + OH]); - - const float *in_ptr_f32 = reinterpret_cast(in_ptr_); - float *out_ptr_f32 = reinterpret_cast(out_ptr_); - - parallel_for4d(B, C, OH, OW, [&](size_t n, size_t c, size_t oy, size_t ox) { - const float *in_ptr_nc = in_ptr_f32 + (IW * IH * C * n + IW * IH * c); - float *out_ptr_nc = out_ptr_f32 + (OW * OH * C * n + OW * OH * c); - - int iy = yOrigin[oy]; - int ix = xOrigin[ox]; - - float retY = 0.f; - for (int y = iy - 1, i = 0; y <= iy + 2; y++, i++) { - int yInRange = std::max(0, std::min(y, IH - 1)); - const float *in_ptr_nch = in_ptr_nc + IW * yInRange; - float retX = 0.f; - for (int x = ix - 1, j = 0; x <= ix + 2; x++, j++) { - int xInRange = std::max(0, std::min(x, IW - 1)); - retX += xFactor[ox * CUBIC_GRID_LEN + j] * in_ptr_nch[xInRange]; + case InterpolateMode::linear_onnx: { + if (configured_for_layout == InterpolateLayoutType::planar) { + linearOnnxPlanar(in_ptr_, out_ptr_, N, C, ID, IH, IW, OD, OH, OW); + } else { + linearOnnxCGathered(in_ptr_, out_ptr_, N, C, ID, IH, IW, OD, OH, OW); } - retY += yFactor[oy * CUBIC_GRID_LEN + i] * retX; - } - out_ptr_nc[oy * OW + ox] = retY; - }); -} - -float MKLDNNInterpolateNode::getValue(const uint8_t *base, size_t offset, InferenceEngine::Precision prec) { - const uint8_t *baseOffset = base + offset; - switch (prec) { - case Precision::U8: { - return static_cast(*baseOffset); break; } - case Precision::I8: { - const int8_t *valuePtr = reinterpret_cast(baseOffset); - return static_cast(*valuePtr); - break; - } - case Precision::BF16: { - const uint16_t *valuePtr = reinterpret_cast(baseOffset); - return bfloat16_t::from_bits(*valuePtr); - break; - } - case Precision::FP32: { - const float *valuePtr = reinterpret_cast(baseOffset); - return *valuePtr; + case InterpolateMode::cubic: { + if (configured_for_layout == InterpolateLayoutType::planar) { + cubicPlanar(in_ptr_, out_ptr_, N, C, IH, IW, OH, OW); + } else { + cubicCGathered(in_ptr_, out_ptr_, N, C, IH, IW, OH, OW); + } break; } default: { - IE_THROW() << "Interpolate layer does not support precision: " << prec; - break; + IE_THROW() << "InterpolateJitExecutor has unsupported interpolate mode: " << mode; } } } -void MKLDNNInterpolateNode::setValue(uint8_t *base, size_t offset, float value, InferenceEngine::Precision prec) { - uint8_t *baseOffset = base + offset; - switch (prec) { - case Precision::U8: { - uint8_t data = static_cast(value < 0 ? 0 : value); - cpu_memcpy(baseOffset, &data, 1); +void MKLDNNInterpolateNode::InterpolateRefExecutor::exec(const uint8_t *in_ptr_, uint8_t *out_ptr_) { + size_t N = srcDimPad5d[0], C = srcDimPad5d[1], ID = srcDimPad5d[2], IH = srcDimPad5d[3], IW = srcDimPad5d[4]; + size_t OD = dstDim5d[2], OH = dstDim5d[3], OW = dstDim5d[4]; + + switch (mode) { + case InterpolateMode::nearest: { + NNRef(in_ptr_, out_ptr_, N, C, ID, IH, IW, OD, OH, OW); break; } - case Precision::I8: { - int8_t data = static_cast(value); - cpu_memcpy(baseOffset, &data, 1); + case InterpolateMode::linear_onnx: { + linearOnnxRef(in_ptr_, out_ptr_, N, C, ID, IH, IW, OD, OH, OW); break; } - case Precision::BF16: { - uint16_t data = bfloat16_t(value).to_bits(); - cpu_memcpy(baseOffset, &data, 2); + case InterpolateMode::cubic: { + cubicRef(in_ptr_, out_ptr_, N, C, IH, IW, OH, OW); break; } - case Precision::FP32: { - cpu_memcpy(baseOffset, &value, sizeof(float)); + case InterpolateMode::linear: { + float fz = (dataRank == 5) ? dataScales[dataRank - 3] : 1.f; + float fy = dataScales[dataRank - 2]; + float fx = dataScales[dataRank - 1]; + + bool isDownsample = (fx < 1.f) || (fy < 1.f) || (fz < 1.f); + int kernel_width = 2; + linearInterpolation(in_ptr_, out_ptr_, N, C, ID, IH, IW, fx, fy, fz, OD, OH, OW, kernel_width, isDownsample && antialias); break; } default: { - IE_THROW() << "Interpolate layer does not support precision: " << prec; - break; + IE_THROW() << "Interpolate layer has unsupported interpolate mode: " << mode; } } } -// scale is float(outShape) / float(inShape) -// strictly consistent with onnx calc manner(div scale, not multiply inverse), given this is done offline -// the slight precison diff can produce obvious wrong value due to "nearest round" behavior for NN mode -inline float MKLDNNInterpolateNode::coordTransToInput(int outCoord, float scale, int inShape, int outShape) { - if (scale == 1.0f || (inShape == outShape)) { - return outCoord; - } - switch (coordTransMode) { - case InterpolateCoordTransMode::half_pixel: { - return (outCoord + 0.5f) / scale - 0.5f; - break; - } - case InterpolateCoordTransMode::pytorch_half_pixel: { - if (outShape > 1) - return (outCoord + 0.5f) / scale - 0.5f; - else - return 0; - break; - } - case InterpolateCoordTransMode::asymmetric: { - return static_cast(outCoord) / scale; - break; - } - case InterpolateCoordTransMode::tf_half_pixel_for_nn: { - return (outCoord + 0.5f) / scale; - break; - } - case InterpolateCoordTransMode::align_corners: { - if (outShape > 1) - return outCoord * (static_cast(inShape - 1) / static_cast(outShape - 1)); - else - return 0; - break; - } - default: { - IE_THROW() << errorPrefix << " does not support specified coordinate transformation mode"; - break; - } - } -} - -inline int MKLDNNInterpolateNode::nearestRound(float originCoord, bool isDownsample) { - switch (nearestMode) { - case InterpolateNearestMode::round_prefer_floor: { - if (originCoord == (static_cast(originCoord) + 0.5f)) - return static_cast(std::floor(originCoord)); - else - return static_cast(std::round(originCoord)); - break; - } - case InterpolateNearestMode::round_prefer_ceil: { - return static_cast(std::round(originCoord)); - break; - } - case InterpolateNearestMode::floor: { - return static_cast(std::floor(originCoord)); - break; - } - case InterpolateNearestMode::ceil: { - return static_cast(std::ceil(originCoord)); - break; - } - case InterpolateNearestMode::simple: { - if (isDownsample) - return static_cast(std::ceil(originCoord)); - else - return static_cast(originCoord); - } - default: { - IE_THROW() << errorPrefix << " does not support specified nearest round mode"; - break; - } +size_t MKLDNNInterpolateNode::getSpatialDimsNum(const Dim rank) { + switch (rank) { + case 1: + case 3: + return 1; + case 2: + case 4: + return 2; + case 5: + return 3; + default: + IE_THROW() << "Can't define number spatial"; } } bool MKLDNNInterpolateNode::canFuse(const MKLDNNNodePtr& node) const { - if (!mayiuse(cpu::x64::sse41) || mode == InterpolateMode::linear) { + if (!mayiuse(cpu::x64::sse41) || interpAttrs.mode == InterpolateMode::linear) { return false; } diff --git a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_interpolate_node.h b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_interpolate_node.h index b39960040a6..5c423711c7f 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_interpolate_node.h +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_interpolate_node.h @@ -97,6 +97,7 @@ public: void createPrimitive() override; bool created() const override; void execute(mkldnn::stream strm) override; + void executeDynamicImpl(mkldnn::stream strm) override; bool canBeInPlace() const override { return false; } @@ -104,83 +105,141 @@ public: static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; + bool needShapeInfer() const override; + std::vector shapeInfer() const override; + bool needPrepareParams() const override; + void prepareParams() override; + private: - // nearest neighbor - void NNPlanar(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, int ID, int IH, int IW, int OD, int OH, int OW); - void NNCGathered(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, int ID, int IH, int IW, int OD, int OH, int OW); - void NNRef(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, int ID, int IH, int IW, int OD, int OH, int OW); + struct InterpolateAttrs { + InterpolateMode mode; + InterpolateCoordTransMode coordTransMode; + InterpolateNearestMode nearestMode; + bool antialias; + float cubeCoeff; + std::vector padBegin; + std::vector padEnd; + InferenceEngine::Precision inPrc; + InferenceEngine::Precision outPrc; + InterpolateLayoutType layout; + } interpAttrs; - // onnx linear - void linearOnnxCF(int outCoord, float scale, int inShape, int outShape, int& index0, int& index1, float& weight0, float& weight1); - void linearOnnxPlanar(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, int ID, int IH, int IW, int OD, int OH, int OW); - void linearOnnxCGathered(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, int ID, int IH, int IW, int OD, int OH, int OW); - void linearOnnxRef(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, int ID, int IH, int IW, int OD, int OH, int OW); + class InterpolateExecutor { + public: + InterpolateExecutor(const InterpolateAttrs& interpAttrs, + const VectorDims &srcDims, + const VectorDims &dstDims, + const std::vector &dataScales); - // cubic - std::vector getCubicCoeffs(float mantissa, float a); - void cubicPlanar(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, int IH, int IW, int OH, int OW); - void cubicCGathered(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, int IH, int IW, int OH, int OW); - void cubicRef(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, int IH, int IW, int OH, int OW); + virtual void exec(const uint8_t *in_ptr_, uint8_t *out_ptr_) = 0; + virtual ~InterpolateExecutor() = default; + VectorDims getSrcDimPad5d() const { return srcDimPad5d; } - // linear - void linearInterpolation(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, int ID, int IH, int IW, - float fx, float fy, float fz, int OD, int OH, int OW, int kernel_width, bool antialias); + private: + void buildTblNN(const SizeVector& srcDimPad5d, const SizeVector& dstDim5d, const std::vector& dataScales, + InterpolateLayoutType layout, InterpolateNearestMode nearestMode); + void buildTblLinearOnnx(const SizeVector& srcDimPad5d, const SizeVector& dstDim5d, const std::vector& dataScales, + InterpolateLayoutType layout); + void buildTblLinear(const SizeVector& srcDimPad5d, const SizeVector& dstDim5d, const std::vector& dataScales, int kernel_width, + bool antialias); + void buildTblCubic(const SizeVector& srcDimPad5d, const SizeVector& dstDim5d, const std::vector& dataScales, float cubicCoeff, + InterpolateLayoutType layout); - void buildTblNN(SizeVector& srcDimPad5d, SizeVector& dstDim5d, std::vector& dataScales, InterpolateLayoutType layout); - void buildTblLinearOnnx(SizeVector& srcDimPad5d, SizeVector& dstDim5d, std::vector& dataScales, InterpolateLayoutType layout); - void buildTblLinear(SizeVector& srcDimPad5d, SizeVector& dstDim5d, std::vector& dataScales, int kernel_width, bool antialias); - void buildTblCubic(SizeVector& srcDimPad5d, SizeVector& dstDim5d, std::vector& dataScales, float cubicCoeff, InterpolateLayoutType layout); + float coordTransToInput(int outCoord, float scale, int inShape, int outShape) const; + int nearestRound(float origin, bool isDownsample, InterpolateNearestMode nearestMode) const; + void linearOnnxCF(int outCoord, float scale, int inShape, int outShape, int& index0, int& index1, float& weight0, float& weight1); + std::vector getCubicCoeffs(float mantissa, float a); - void setPostOps(mkldnn::primitive_attr &attr, bool initWeights = false); + protected: + InterpolateMode mode; + InterpolateCoordTransMode coordTransMode; + InterpolateLayoutType configured_for_layout; + VectorDims srcDimPad5d, dstDim5d; + InferenceEngine::Precision inputPrec, outputPrec; + size_t srcDataSize, dstDataSize; + int spatialDimSize; + size_t dataRank; + std::vector indexTable; + }; + std::shared_ptr execPtr = nullptr; - inline float coordTransToInput(int outCoord, float scale, int inShape, int outShape); - inline int nearestRound(float origin, bool isDownsample); - float getValue(const uint8_t *base, size_t offset, InferenceEngine::Precision prec); - void setValue(uint8_t *base, size_t offset, float value, InferenceEngine::Precision prec); + class InterpolateJitExecutor : public InterpolateExecutor { + public: + InterpolateJitExecutor(const InterpolateAttrs& interpAttrs, + const VectorDims &srcDims, + const VectorDims &dstDims, + const std::vector &dataScales, + const mkldnn::primitive_attr &attr); - SizeVector getPaddedInputShape(); - std::vector getScales(); + void exec(const uint8_t *in_ptr_, uint8_t *out_ptr_) override; - static const size_t DATA_ID = 0; - static const size_t TARGET_SHAPE_ID = 1; - static const size_t SCALES_ID = 2; - static const size_t AXES_ID = 3; - const int LINEAR_KERNEL = 2; - const int CUBIC_GRID_LEN = 4; + private: + // nearest neighbor + void NNPlanar(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, int ID, int IH, int IW, int OD, int OH, int OW); + void NNCGathered(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, int ID, int IH, int IW, int OD, int OH, int OW); + + // onnx linear + void linearOnnxPlanar(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, int ID, int IH, int IW, int OD, int OH, int OW); + void linearOnnxCGathered(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, int ID, int IH, int IW, int OD, int OH, int OW); + + // cubic + void cubicPlanar(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, int IH, int IW, int OH, int OW); + void cubicCGathered(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, int IH, int IW, int OH, int OW); + + private: + std::shared_ptr interpolateKernel = nullptr; + }; + + class InterpolateRefExecutor : public InterpolateExecutor { + public: + InterpolateRefExecutor(const InterpolateAttrs& interpAttrs, + const VectorDims &srcDims, + const VectorDims &dstDims, + const std::vector &_dataScales) : dataScales(_dataScales), antialias(interpAttrs.antialias), + InterpolateExecutor(interpAttrs, srcDims, dstDims, _dataScales) {} + + void exec(const uint8_t *in_ptr_, uint8_t *out_ptr_) override; + + private: + void NNRef(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, int ID, int IH, int IW, int OD, int OH, int OW); + void linearOnnxRef(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, int ID, int IH, int IW, int OD, int OH, int OW); + + void cubicRef(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, int IH, int IW, int OH, int OW); + void linearInterpolation(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, int ID, int IH, int IW, + float fx, float fy, float fz, int OD, int OH, int OW, int kernel_width, bool antialias); + + static float getValue(const uint8_t *base, size_t offset, InferenceEngine::Precision prec); + static void setValue(uint8_t *base, size_t offset, float value, InferenceEngine::Precision prec); + + private: + bool antialias; + std::vector dataScales; + }; + + void setPostOps(mkldnn::primitive_attr &attr, const VectorDims &dims, bool initWeights = false); + + static SizeVector getPaddedInputShape(const VectorDims &srcDims, const std::vector &padBegin, const std::vector &padEnd); + std::vector getScales(const VectorDims &srcDimPad, const VectorDims &dstDim); + static size_t getSpatialDimsNum(const Dim rank); + + static constexpr size_t DATA_ID = 0; + static constexpr size_t TARGET_SHAPE_ID = 1; + static constexpr size_t SCALES_ID = 2; + static constexpr size_t AXES_ID = 3; + static constexpr int CUBIC_GRID_LEN = 4; - InterpolateMode mode; - InterpolateCoordTransMode coordTransMode = InterpolateCoordTransMode::half_pixel; - bool antialias = false; - std::vector padBegin; - std::vector padEnd; bool hasPad = false; - InterpolateNearestMode nearestMode = InterpolateNearestMode::round_prefer_floor; InterpolateShapeCalcMode shapeCalcMode; - float cubeCoeff = -0.75; - bool isAxesSpecified = false; - // axes and scales from buffer, partical size. std::vector axes; - std::vector scales; - // target shape is dst dim, full size. - SizeVector dstDim; - SizeVector srcDim; - SizeVector srcDimPad; - int spatialDimSize = 1; mkldnn::primitive_attr attr; - std::vector PostOpsIntBlobMemory; - InferenceEngine::Precision inputPrec, outputPrec; - size_t srcDataSize = 0; - size_t dstDataSize = 0; + std::vector lastScales; + std::vector lastSizes; - InterpolateLayoutType configured_for_layout = InterpolateLayoutType::planar; - - std::vector indexTable; - - std::shared_ptr interpolateKernel = nullptr; + VectorDims lastOutputDims; std::string errorPrefix; }; diff --git a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_lrn_node.cpp b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_lrn_node.cpp index b4e1e28891b..e1430776725 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_lrn_node.cpp +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_lrn_node.cpp @@ -14,23 +14,18 @@ using namespace InferenceEngine; bool MKLDNNLrnNode::isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept { try { - if (isDynamicNgraphNode(op)) { - errorMessage = "Doesn't support op with dynamic shapes"; - return false; - } - - const auto lrn = std::dynamic_pointer_cast(op); + auto lrn = ngraph::as_type_ptr(op); if (!lrn) { errorMessage = "Only opset1 LRN operation is supported"; return false; } - const auto dataDims = lrn->get_input_shape(0); + const auto& dataDims = lrn->get_input_partial_shape(0); if (dataDims.size() < 2 || dataDims.size() > 5) { errorMessage = "Doesn't support 'data' input with rank: " + std::to_string(dataDims.size()); return false; } - const auto axesNode = std::dynamic_pointer_cast(lrn->get_input_node_shared_ptr(1)); + auto axesNode = ngraph::as_type_ptr(lrn->get_input_node_shared_ptr(1)); if (!axesNode) { errorMessage = "Only Constant operation on 'axis' input is supported"; return false; @@ -69,9 +64,10 @@ MKLDNNLrnNode::MKLDNNLrnNode(const std::shared_ptr& op, const mkld if (isSupportedOperation(op, errorMessage)) { errorPrefix = "LRN node with name '" + getName() + "'"; - const auto lrn = std::dynamic_pointer_cast(op); - const auto axes = std::dynamic_pointer_cast(lrn->get_input_node_shared_ptr(1))->cast_vector(); - isAcrossMaps = (axes.size() == 1 && axes[0] == 1); + auto lrn = ngraph::as_type_ptr(op); + auto axes = ngraph::as_type_ptr(lrn->get_input_node_shared_ptr(1))->cast_vector(); + bool isAcrossMaps = (axes.size() == 1 && axes[0] == 1); + alg = isAcrossMaps ? mkldnn::algorithm::lrn_across_channels : mkldnn::algorithm::lrn_within_channel; alpha = static_cast(lrn->get_alpha()); beta = static_cast(lrn->get_beta()); k = static_cast(lrn->get_bias()); @@ -107,21 +103,56 @@ std::shared_ptr MKLDNNLrnNode::getSrcMemDesc(mkldnn::primitive_desc_ if (idx > 0) { return std::make_shared(getOriginalInputPrecisionAtPort(idx), getInputShapeAtPort(idx)); } else { - return MKLDNNExtensionUtils::makeDescriptor(primitive_desc_it.dst_desc(idx)); + if (getInputShapeAtPort(idx).isDynamic()) { + return MKLDNNExtensionUtils::makeUndefinedDesc(primitive_desc_it.src_desc(idx), getInputShapeAtPort(idx)); + } + return MKLDNNExtensionUtils::makeDescriptor(primitive_desc_it.src_desc(idx)); } } void MKLDNNLrnNode::createPrimitive() { - if (prim) - return; + if (inputShapesDefined()) { + if (needPrepareParams()) + prepareParams(); + updateLastInputDims(); + } +} - auto prim_desc = createPrimitiveDescriptor(); +void MKLDNNLrnNode::prepareParams() { + auto& srcMemPtr = getParentEdgeAt(0)->getMemoryPtr(); + auto& dstMemPtr = getChildEdgeAt(0)->getMemoryPtr(); + if (!srcMemPtr || !srcMemPtr->GetPrimitivePtr()) + IE_THROW() << errorPrefix << " input memory did not allocate"; + if (!dstMemPtr || !dstMemPtr->GetPrimitivePtr()) + IE_THROW() << errorPrefix << "destination memory did not allocate"; + + const NodeDesc* selected_pd = getSelectedPrimitiveDescriptor(); + if (selected_pd == nullptr) + IE_THROW() << errorPrefix << "preferable primitive descriptor did not set"; + + auto inpDesc = getParentEdgeAt(0)->getMemory().GetDescWithType(); + const auto& in_candidate = inpDesc->getDnnlDesc(); + MKLDNNDescriptor desc(std::shared_ptr( + new mkldnn::lrn_forward::desc(mkldnn::prop_kind::forward_scoring, alg, in_candidate, size, alpha, beta, k))); + + mkldnn::lrn_forward::primitive_desc prim_desc; + dnnl::primitive_desc_iterator itpd = desc.createPrimitiveDescriptorIterator(getEngine()); + while (static_cast(itpd)) { + impl_desc_type impl_type = parse_impl_name(itpd.impl_info_str()); + + if (impl_type == selected_pd->getImplementationType()) { + prim_desc = itpd.get(); + break; + } + if (!itpd.next_impl()) + IE_THROW() << "Primitive descriptor was not found for node " << getName() << "."; + } prim.reset(new mkldnn::lrn_forward(prim_desc)); - auto src = getParentEdgesAtPort(0)[0]->getMemoryPtr()->GetPrimitive(); - auto dst = getChildEdgesAtPort(0)[0]->getMemoryPtr()->GetPrimitive(); - primArgs = {{DNNL_ARG_SRC, src}, {DNNL_ARG_DST, dst}}; + auto src = srcMemPtr->GetPrimitive(); + auto dst = dstMemPtr->GetPrimitive(); + primArgs = { {DNNL_ARG_SRC, src}, {DNNL_ARG_DST, dst} }; } bool MKLDNNLrnNode::created() const { @@ -130,11 +161,21 @@ bool MKLDNNLrnNode::created() const { void MKLDNNLrnNode::createDescriptor(const std::vector &inputDesc, const std::vector &outputDesc) { - mkldnn::algorithm alg = isAcrossMaps ? mkldnn::algorithm::lrn_across_channels : mkldnn::algorithm::lrn_within_channel; + auto inpDesc = inputDesc[0]->isDefined() ? inputDesc[0] : MemoryDescUtils::makeDummyDesc(*inputDesc[0]); + DnnlMemoryDescPtr definedInpMemDesc = MemoryDescUtils::convertToDnnlMemoryDesc(inpDesc); + const auto& in_candidate = definedInpMemDesc->getDnnlDesc(); + MKLDNNDescriptor desc(std::shared_ptr( - new mkldnn::lrn_forward::desc(mkldnn::prop_kind::forward_scoring, alg, MemoryDescUtils::convertToDnnlMemoryDesc(inputDesc[0])->getDnnlDesc(), - size, alpha, beta, k))); + new mkldnn::lrn_forward::desc(mkldnn::prop_kind::forward_scoring, alg, in_candidate, size, alpha, beta, k))); descs.push_back(desc); } +std::vector MKLDNNLrnNode::shapeInfer() const { + return { getParentEdgesAtPort(0).front()->getMemory().getStaticDims() }; +} + +void MKLDNNLrnNode::executeDynamicImpl(dnnl::stream strm) { + MKLDNNNode::execute(strm); +} + REG_MKLDNN_PRIM_FOR(MKLDNNLrnNode, Lrn); diff --git a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_lrn_node.h b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_lrn_node.h index 8ab180829ad..97ef5163f43 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_lrn_node.h +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_lrn_node.h @@ -29,10 +29,14 @@ public: return false; } + void prepareParams() override; + void executeDynamicImpl(mkldnn::stream strm) override; + std::vector shapeInfer() const override; + static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; private: - bool isAcrossMaps = false; + mkldnn::algorithm alg; size_t size = 1; int k = 1; float alpha = 1.0f; diff --git a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_matmul_node.cpp b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_matmul_node.cpp index fa277a11209..e9ebde02cff 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_matmul_node.cpp +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_matmul_node.cpp @@ -353,4 +353,41 @@ void MKLDNNMatMulNode::executeDynamicImpl(dnnl::stream strm) { MKLDNNNode::execute(strm); } +const std::vector& MKLDNNMatMulNode::getPrimitivesPriority() { + std::vector priorities = { + impl_desc_type::unknown, + impl_desc_type::brgemm_avx512_amx, + impl_desc_type::brgemm_avx512, + impl_desc_type::gemm_blas, + impl_desc_type::gemm_avx512, + impl_desc_type::gemm_avx2, + impl_desc_type::gemm_avx, + impl_desc_type::gemm_sse42, + impl_desc_type::gemm_any, + impl_desc_type::gemm, + impl_desc_type::jit_gemm, + impl_desc_type::jit_uni_dw, + impl_desc_type::jit_uni_1x1, + impl_desc_type::jit_uni, + impl_desc_type::jit_avx512_dw, + impl_desc_type::jit_avx512_1x1, + impl_desc_type::jit_avx512, + impl_desc_type::jit_avx2_dw, + impl_desc_type::jit_avx2_1x1, + impl_desc_type::jit_avx2, + impl_desc_type::jit_avx_dw, + impl_desc_type::jit_avx_1x1, + impl_desc_type::jit_avx, + impl_desc_type::jit_sse42_dw, + impl_desc_type::jit_sse42_1x1, + impl_desc_type::jit_sse42, + impl_desc_type::ref, + }; + for (const auto& impl : priorities) { + if (std::find(implPriorities.begin(), implPriorities.end(), impl) == implPriorities.end()) + implPriorities.push_back(impl); + } + return implPriorities; +} + REG_MKLDNN_PRIM_FOR(MKLDNNMatMulNode, MatMul); diff --git a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_matmul_node.h b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_matmul_node.h index e0046594f53..9c9489df237 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_matmul_node.h +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_matmul_node.h @@ -36,6 +36,7 @@ public: void executeDynamicImpl(mkldnn::stream strm) override; static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; + const std::vector& getPrimitivesPriority() override; protected: AttrPtr initPrimitiveAttr() const override; diff --git a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_matrix_nms_node.cpp b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_matrix_nms_node.cpp index 4317596fd32..b01aa731e68 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_matrix_nms_node.cpp +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_matrix_nms_node.cpp @@ -12,25 +12,19 @@ #include "ie_parallel.hpp" #include "ngraph/opsets/opset8.hpp" -#include "ngraph_ops/nms_static_shape_ie.hpp" #include "utils/general_utils.h" using namespace MKLDNNPlugin; using namespace InferenceEngine; -using MatrixNmsIEInternal = ngraph::op::internal::NmsStaticShapeIE; using ngNmsSortResultType = ngraph::op::util::NmsBase::SortResultType; using ngNmseDcayFunction = ngraph::op::v8::MatrixNms::DecayFunction; bool MKLDNNMatrixNmsNode::isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept { try { - if (isDynamicNgraphNode(op)) { - errorMessage = "Doesn't support op with dynamic shapes"; - return false; - } - const auto nms = std::dynamic_pointer_cast(op); + const auto nms = std::dynamic_pointer_cast(op); if (!nms) { - errorMessage = "Only internal MatrixNms operation is supported"; + errorMessage = "Only MatrixNms operation is supported"; return false; } const auto& attrs = nms->get_attrs(); @@ -57,36 +51,16 @@ MKLDNNMatrixNmsNode::MKLDNNMatrixNmsNode(const std::shared_ptr& op IE_THROW(NotImplemented) << errorMessage; } - errorPrefix = "MatrixNMS layer with name '" + getName() + "' "; - const auto matrix_nms = std::dynamic_pointer_cast(op); + m_errorPrefix = "MatrixNMS layer with name '" + getName() + "' "; if (getOriginalInputsNumber() != 2) - IE_THROW() << errorPrefix << "has incorrect number of input edges: " << getOriginalInputsNumber(); + IE_THROW() << m_errorPrefix << "has incorrect number of input edges: " << getOriginalInputsNumber(); if (getOriginalOutputsNumber() != 3) - IE_THROW() << errorPrefix << "has incorrect number of output edges: " << getOriginalOutputsNumber(); + IE_THROW() << m_errorPrefix << "has incorrect number of output edges: " << getOriginalOutputsNumber(); - const SizeVector& boxes_dims = inputShapes[NMS_BOXES].getStaticDims(); - const SizeVector& scores_dims = inputShapes[NMS_SCORES].getStaticDims(); - if (!(boxes_dims[0] == scores_dims[0] && boxes_dims[1] == scores_dims[2])) { - IE_THROW() << errorPrefix << "has incompatible 'boxes' and 'scores' input dmensions"; - } + const auto matrix_nms = std::dynamic_pointer_cast(op); - m_numBatches = boxes_dims[0]; - m_numBoxes = boxes_dims[1]; - if (boxes_dims.size() != 3) - IE_THROW() << errorPrefix << "has unsupported 'boxes' input rank: " << boxes_dims.size(); - if (boxes_dims[2] != 4) - IE_THROW() << errorPrefix << "has unsupported 'boxes' input 3rd dimension size: " << boxes_dims[2]; - - m_numClasses = scores_dims[1]; - if (scores_dims.size() != 3) - IE_THROW() << errorPrefix << "has unsupported 'scores' input rank: " << scores_dims.size(); - - if (m_numBatches != scores_dims[0]) - IE_THROW() << errorPrefix << " num_batches is different in 'boxes' and 'scores' inputs"; - if (m_numBoxes != scores_dims[2]) - IE_THROW() << errorPrefix << " num_boxes is different in 'boxes' and 'scores' inputs"; auto& attrs = matrix_nms->get_attrs(); if (attrs.sort_result_type == ngraph::op::util::NmsBase::SortResultType::CLASSID) m_sortResultType = MatrixNmsSortResultType::CLASSID; @@ -109,35 +83,6 @@ MKLDNNMatrixNmsNode::MKLDNNMatrixNmsNode(const std::shared_ptr& op m_gaussianSigma = attrs.gaussian_sigma; m_postThreshold = attrs.post_threshold; m_normalized = attrs.normalized; - int64_t max_output_boxes_per_class = 0; - size_t real_num_classes = m_backgroundClass == -1 ? m_numClasses : m_numClasses - 1; - if (m_nmsTopk >= 0) - max_output_boxes_per_class = std::min(m_numBoxes, static_cast(m_nmsTopk)); - else - max_output_boxes_per_class = m_numBoxes; - - m_maxBoxesPerBatch = max_output_boxes_per_class * real_num_classes; - if (m_keepTopk >= 0) - m_maxBoxesPerBatch = std::min(m_maxBoxesPerBatch, static_cast(m_keepTopk)); -} - -void MKLDNNMatrixNmsNode::initSupportedPrimitiveDescriptors() { - if (!supportedPrimitiveDescriptors.empty()) - return; - - m_realNumClasses = m_backgroundClass == -1 ? m_numClasses : m_numClasses - 1; - m_realNumBoxes = m_nmsTopk == -1 ? m_numBoxes : std::min(m_nmsTopk, static_cast(m_numBoxes)); - m_numPerBatch.resize(m_numBatches); - m_filteredBoxes.resize(m_numBatches * m_realNumClasses * m_realNumBoxes); - m_numPerBatchClass.resize(m_numBatches, std::vector(m_numClasses, 0)); - m_classOffset.resize(m_numClasses, 0); - - for (size_t i = 0, count = 0; i < m_numClasses; i++) { - if (i == m_backgroundClass) - continue; - m_classOffset[i] = (count++) * m_realNumBoxes; - } - if (m_decayFunction == MatrixNmsDecayFunction::LINEAR) { m_decay_fn = [](float iou, float max_iou, float sigma) -> float { return (1. - iou) / (1. - max_iou + 1e-10f); @@ -148,16 +93,29 @@ void MKLDNNMatrixNmsNode::initSupportedPrimitiveDescriptors() { }; } + const auto& boxes_dims = getInputShapeAtPort(NMS_BOXES).getDims(); + if (boxes_dims.size() != 3) + IE_THROW() << m_errorPrefix << "has unsupported 'boxes' input rank: " << boxes_dims.size(); + if (boxes_dims[2] != 4) + IE_THROW() << m_errorPrefix << "has unsupported 'boxes' input 3rd dimension size: " << boxes_dims[2]; + const auto& scores_dims = getInputShapeAtPort(NMS_SCORES).getDims(); + if (scores_dims.size() != 3) + IE_THROW() << m_errorPrefix << "has unsupported 'scores' input rank: " << scores_dims.size(); +} + +void MKLDNNMatrixNmsNode::initSupportedPrimitiveDescriptors() { + if (!supportedPrimitiveDescriptors.empty()) + return; + const std::vector supportedFloatPrecision = {Precision::FP32}; const std::vector supportedIntOutputPrecision = {Precision::I32, Precision::I64}; - checkPrecision(getOriginalInputPrecisionAtPort(NMS_BOXES), supportedFloatPrecision, "boxes", inType); + checkPrecision(getOriginalInputPrecisionAtPort(NMS_BOXES), supportedFloatPrecision, "boxes", m_inType); + checkPrecision(getOriginalInputPrecisionAtPort(NMS_SCORES), supportedFloatPrecision, "scores", m_inType); - checkPrecision(getOriginalInputPrecisionAtPort(NMS_SCORES), supportedFloatPrecision, "scores", inType); - - checkPrecision(getOriginalOutputPrecisionAtPort(NMS_SELECTED_INDICES), supportedIntOutputPrecision, "selected_indices", outType); - checkPrecision(getOriginalOutputPrecisionAtPort(NMS_SELECTED_OUTPUTS), supportedFloatPrecision, "selected_outputs", outType); - checkPrecision(getOriginalOutputPrecisionAtPort(NMS_VALID_OUTPUTS), supportedIntOutputPrecision, "valid_outputs", outType); + checkPrecision(getOriginalOutputPrecisionAtPort(NMS_SELECTED_INDICES), supportedIntOutputPrecision, "selected_indices", m_outType); + checkPrecision(getOriginalOutputPrecisionAtPort(NMS_SELECTED_OUTPUTS), supportedFloatPrecision, "selected_outputs", m_outType); + checkPrecision(getOriginalOutputPrecisionAtPort(NMS_VALID_OUTPUTS), supportedIntOutputPrecision, "valid_outputs", m_outType); addSupportedPrimDesc({{LayoutType::ncsp, Precision::FP32}, {LayoutType::ncsp, Precision::FP32}}, @@ -282,6 +240,54 @@ size_t MKLDNNMatrixNmsNode::nmsMatrix(const float* boxesData, const float* score return numDet; } +void MKLDNNMatrixNmsNode::createPrimitive() { + if (inputShapesDefined()) { + prepareParams(); + updateLastInputDims(); + } +} + +void MKLDNNMatrixNmsNode::prepareParams() { + const auto& boxes_dims = getParentEdgeAt(NMS_BOXES)->getMemory().getStaticDims(); + const auto& scores_dims = getParentEdgeAt(NMS_SCORES)->getMemory().getStaticDims(); + if (!(boxes_dims[0] == scores_dims[0] && boxes_dims[1] == scores_dims[2])) { + IE_THROW() << m_errorPrefix << "has incompatible 'boxes' and 'scores' input dmensions"; + } + + m_numBatches = boxes_dims[0]; + m_numBoxes = boxes_dims[1]; + + m_numClasses = scores_dims[1]; + + int64_t max_output_boxes_per_class = 0; + size_t real_num_classes = m_backgroundClass == -1 ? m_numClasses : + m_backgroundClass < m_numClasses ? m_numClasses - 1 : m_numClasses; + if (m_nmsTopk >= 0) + max_output_boxes_per_class = std::min(m_numBoxes, static_cast(m_nmsTopk)); + else + max_output_boxes_per_class = m_numBoxes; + + m_maxBoxesPerBatch = max_output_boxes_per_class * real_num_classes; + if (m_keepTopk >= 0) + m_maxBoxesPerBatch = std::min(m_maxBoxesPerBatch, static_cast(m_keepTopk)); + + m_realNumClasses = real_num_classes; + m_realNumBoxes = m_nmsTopk == -1 ? m_numBoxes : std::min(m_nmsTopk, static_cast(m_numBoxes)); + m_numPerBatch.resize(m_numBatches); + m_filteredBoxes.resize(m_numBatches * m_realNumClasses * m_realNumBoxes); + m_numPerBatchClass.resize(m_numBatches); + for (auto &numPerBatch : m_numPerBatchClass) { + numPerBatch.resize(m_numClasses, 0); + } + m_classOffset.resize(m_numClasses, 0); + + for (size_t i = 0, count = 0; i < m_numClasses; i++) { + if (i == m_backgroundClass) + continue; + m_classOffset[i] = (count++) * m_realNumBoxes; + } +} + void MKLDNNMatrixNmsNode::execute(mkldnn::stream strm) { const float* boxes = reinterpret_cast(getParentEdgeAt(NMS_BOXES)->getMemoryPtr()->GetPtr()); const float* scores = reinterpret_cast(getParentEdgeAt(NMS_SCORES)->getMemoryPtr()->GetPtr()); @@ -352,9 +358,20 @@ void MKLDNNMatrixNmsNode::execute(mkldnn::stream strm) { } } - float* selectedOutputs = reinterpret_cast(getChildEdgesAtPort(NMS_SELECTED_OUTPUTS)[0]->getMemoryPtr()->GetPtr()); - int* selectedIndices = reinterpret_cast(getChildEdgesAtPort(NMS_SELECTED_INDICES)[0]->getMemoryPtr()->GetPtr()); - int* validOutputs = reinterpret_cast(getChildEdgesAtPort(NMS_VALID_OUTPUTS)[0]->getMemoryPtr()->GetPtr()); + auto selectedOutputsMemPtr = getChildEdgesAtPort(NMS_SELECTED_OUTPUTS)[0]->getMemoryPtr(); + auto selectedIndicesMemPtr = getChildEdgesAtPort(NMS_SELECTED_INDICES)[0]->getMemoryPtr(); + auto validOutputsMemPtr = getChildEdgesAtPort(NMS_VALID_OUTPUTS)[0]->getMemoryPtr(); + + // TODO [DS NMS]: remove when nodes from models where nms is not last node in model supports DS + if (isDynamicNode()) { + size_t totalBox = std::accumulate(m_numPerBatch.begin(), m_numPerBatch.end(), 0); + selectedOutputsMemPtr->redefineDesc(getBaseMemDescAtOutputPort(NMS_SELECTED_OUTPUTS)->cloneWithNewDims({totalBox, 6})); + selectedIndicesMemPtr->redefineDesc(getBaseMemDescAtOutputPort(NMS_SELECTED_INDICES)->cloneWithNewDims({totalBox, 1})); + validOutputsMemPtr->redefineDesc(getBaseMemDescAtOutputPort(NMS_VALID_OUTPUTS)->cloneWithNewDims({m_numBatches})); + } + float* selectedOutputs = reinterpret_cast(selectedOutputsMemPtr->GetPtr()); + int* selectedIndices = reinterpret_cast(selectedIndicesMemPtr->GetPtr()); + int* validOutputs = reinterpret_cast(validOutputsMemPtr->GetPtr()); std::copy(m_numPerBatch.begin(), m_numPerBatch.end(), validOutputs); int64_t outputOffset = 0; @@ -372,16 +389,22 @@ void MKLDNNMatrixNmsNode::execute(mkldnn::stream strm) { selectedBase[4] = m_filteredBoxes[originalIndex].box.x2; selectedBase[5] = m_filteredBoxes[originalIndex].box.y2; } - std::fill_n(selectedOutputs + (outputOffset + real_boxes) * 6, (m_maxBoxesPerBatch - real_boxes) * 6, -1); - std::fill_n(selectedIndices + (outputOffset + real_boxes), m_maxBoxesPerBatch - real_boxes, -1); - outputOffset += m_maxBoxesPerBatch; - originalOffset += real_boxes; + // TODO [DS NMS]: remove when nodes from models where nms is not last node in model supports DS + if (!isDynamicNode()) { + std::fill_n(selectedOutputs + (outputOffset + real_boxes) * 6, (m_maxBoxesPerBatch - real_boxes) * 6, -1); + std::fill_n(selectedIndices + (outputOffset + real_boxes), m_maxBoxesPerBatch - real_boxes, -1); + outputOffset += m_maxBoxesPerBatch; + originalOffset += real_boxes; + } else { + outputOffset += real_boxes; + originalOffset += real_boxes; + } } } void MKLDNNMatrixNmsNode::checkPrecision(const Precision prec, const std::vector precList, const std::string name, const std::string type) { if (std::find(precList.begin(), precList.end(), prec) == precList.end()) - IE_THROW() << errorPrefix << "has unsupported '" << name << "' " << type << " precision: " << prec; + IE_THROW() << m_errorPrefix << "has unsupported '" << name << "' " << type << " precision: " << prec; } REG_MKLDNN_PRIM_FOR(MKLDNNMatrixNmsNode, MatrixNms); diff --git a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_matrix_nms_node.h b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_matrix_nms_node.h index 879caff6d70..c1f272bd2b2 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_matrix_nms_node.h +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_matrix_nms_node.h @@ -27,12 +27,17 @@ public: void getSupportedDescriptors() override {}; void initSupportedPrimitiveDescriptors() override; - void createPrimitive() override {}; + void createPrimitive() override; void execute(mkldnn::stream strm) override; bool created() const override; static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; + void executeDynamicImpl(mkldnn::stream strm) override { execute(strm); } + + bool needShapeInfer() const override { return false; } + void prepareParams() override; + private: // input static const size_t NMS_BOXES = 0; @@ -82,8 +87,8 @@ private: int64_t classIndex = -1; float score = 0.0f; }; - std::string errorPrefix; - const std::string inType = "input", outType = "output"; + std::string m_errorPrefix; + const std::string m_inType = "input", m_outType = "output"; std::vector m_numPerBatch; std::vector> m_numPerBatchClass; std::vector m_filteredBoxes; diff --git a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_multiclass_nms.cpp b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_multiclass_nms.cpp index d3ad18d0595..85d13de3829 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_multiclass_nms.cpp +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_multiclass_nms.cpp @@ -9,7 +9,6 @@ #include #include #include -#include #include #include #include @@ -22,17 +21,12 @@ using namespace MKLDNNPlugin; using namespace InferenceEngine; using ngNmsSortResultType = ngraph::op::util::NmsBase::SortResultType; -using MulticlassNmsIEInternal = ngraph::op::internal::NmsStaticShapeIE; bool MKLDNNMultiClassNmsNode::isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept { try { - if (isDynamicNgraphNode(op)) { - errorMessage = "Doesn't support op with dynamic shapes"; - return false; - } - const auto nms = std::dynamic_pointer_cast(op); + const auto nms = std::dynamic_pointer_cast(op); if (!nms) { - errorMessage = "Only internal MulitClassNonMaxSuppression operation is supported"; + errorMessage = "Only MulticlassNms operation is supported"; return false; } const auto& atrri = nms->get_attrs(); @@ -53,79 +47,55 @@ MKLDNNMultiClassNmsNode::MKLDNNMultiClassNmsNode(const std::shared_ptr(op); + m_errorPrefix = "MultiClassNms layer with name '" + getName() + "' "; if (getOriginalInputsNumber() != 2) - IE_THROW() << errorPrefix << "has incorrect number of input edges: " << getOriginalInputsNumber(); + IE_THROW() << m_errorPrefix << "has incorrect number of input edges: " << getOriginalInputsNumber(); if (getOriginalOutputsNumber() != 3) - IE_THROW() << errorPrefix << "has incorrect number of output edges: " << getOriginalOutputsNumber(); + IE_THROW() << m_errorPrefix << "has incorrect number of output edges: " << getOriginalOutputsNumber(); + + const auto nms = std::dynamic_pointer_cast(op); auto& atrri = nms->get_attrs(); - sort_result_across_batch = atrri.sort_result_across_batch; - max_output_boxes_per_class = atrri.nms_top_k; - iou_threshold = atrri.iou_threshold; - score_threshold = atrri.score_threshold; - background_class = atrri.background_class; - keep_top_k = atrri.keep_top_k; + m_sortResultAcrossBatch = atrri.sort_result_across_batch; + m_nmsTopK = atrri.nms_top_k; + m_iouThreshold = atrri.iou_threshold; + m_scoreThreshold = atrri.score_threshold; + m_backgroundClass = atrri.background_class; + m_keepTopK = atrri.keep_top_k; if (atrri.sort_result_type == ngNmsSortResultType::CLASSID) - sort_result_type = MulticlassNmsSortResultType::CLASSID; + m_sortResultType = MulticlassNmsSortResultType::CLASSID; else if (atrri.sort_result_type == ngNmsSortResultType::SCORE) - sort_result_type = MulticlassNmsSortResultType::SCORE; + m_sortResultType = MulticlassNmsSortResultType::SCORE; else if (atrri.sort_result_type == ngNmsSortResultType::NONE) - sort_result_type = MulticlassNmsSortResultType::NONE; - nms_eta = atrri.nms_eta; - normalized = atrri.normalized; + m_sortResultType = MulticlassNmsSortResultType::NONE; + m_nmsEta = atrri.nms_eta; + m_normalized = atrri.normalized; - const SizeVector& boxes_dims = inputShapes[NMS_BOXES].getStaticDims(); + const auto& boxes_dims = getInputShapeAtPort(NMS_BOXES).getDims(); if (boxes_dims.size() != 3) - IE_THROW() << errorPrefix << "has unsupported 'boxes' input rank: " << boxes_dims.size(); + IE_THROW() << m_errorPrefix << "has unsupported 'boxes' input rank: " << boxes_dims.size(); if (boxes_dims[2] != 4) - IE_THROW() << errorPrefix << "has unsupported 'boxes' input 3rd dimension size: " << boxes_dims[2]; - - const SizeVector& scores_dims = inputShapes[NMS_SCORES].getStaticDims(); + IE_THROW() << m_errorPrefix << "has unsupported 'boxes' input 3rd dimension size: " << boxes_dims[2]; + const auto& scores_dims = getInputShapeAtPort(NMS_SCORES).getDims(); if (scores_dims.size() != 3) - IE_THROW() << errorPrefix << "has unsupported 'scores' input rank: " << scores_dims.size(); - - if (boxes_dims[0] != scores_dims[0]) - IE_THROW() << errorPrefix << " num_batches is different in 'boxes' and 'scores' inputs"; - if (boxes_dims[1] != scores_dims[2]) - IE_THROW() << errorPrefix << " num_boxes is different in 'boxes' and 'scores' inputs"; - - const SizeVector& valid_outputs_dims = outputShapes[NMS_SELECTEDNUM].getStaticDims(); - if (valid_outputs_dims.size() != 1) - IE_THROW() << errorPrefix << "has unsupported 'valid_outputs' output rank: " << valid_outputs_dims.size(); - if (valid_outputs_dims[0] != boxes_dims[0]) // valid_outputs_dims[0] != num_batches - IE_THROW() << errorPrefix << "has unsupported 'valid_outputs' output 1st dimension size: " << valid_outputs_dims[0]; + IE_THROW() << m_errorPrefix << "has unsupported 'scores' input rank: " << scores_dims.size(); } void MKLDNNMultiClassNmsNode::initSupportedPrimitiveDescriptors() { if (!supportedPrimitiveDescriptors.empty()) return; - const SizeVector& boxes_dims = inputShapes[NMS_BOXES].getStaticDims(); - num_batches = boxes_dims[0]; - num_boxes = boxes_dims[1]; - const SizeVector& scores_dims = inputShapes[NMS_SCORES].getStaticDims(); - num_classes = scores_dims[1]; - numFiltBox.resize(num_batches, std::vector(num_classes)); // batches - numBoxOffset.resize(num_batches); - - if (max_output_boxes_per_class) { - max_output_boxes_per_class = (max_output_boxes_per_class == -1) ? num_boxes : max_output_boxes_per_class; - filtBoxes.resize(max_output_boxes_per_class * num_batches * num_classes); - } const std::vector supportedFloatPrecision = {Precision::FP32, Precision::BF16}; const std::vector supportedIntOutputPrecision = {Precision::I32, Precision::I64}; - checkPrecision(getOriginalInputPrecisionAtPort(NMS_BOXES), supportedFloatPrecision, "boxes", inType); + checkPrecision(getOriginalInputPrecisionAtPort(NMS_BOXES), supportedFloatPrecision, "boxes", m_inType); + checkPrecision(getOriginalInputPrecisionAtPort(NMS_SCORES), supportedFloatPrecision, "scores", m_inType); - checkPrecision(getOriginalInputPrecisionAtPort(NMS_SCORES), supportedFloatPrecision, "scores", inType); - - checkPrecision(getOriginalOutputPrecisionAtPort(NMS_SELECTEDINDICES), supportedIntOutputPrecision, "selected_indices", outType); - checkPrecision(getOriginalOutputPrecisionAtPort(NMS_SELECTEDOUTPUTS), supportedFloatPrecision, "selected_outputs", outType); - checkPrecision(getOriginalOutputPrecisionAtPort(NMS_SELECTEDNUM), supportedIntOutputPrecision, "selected_num", outType); + checkPrecision(getOriginalOutputPrecisionAtPort(NMS_SELECTEDINDICES), supportedIntOutputPrecision, "selected_indices", m_outType); + checkPrecision(getOriginalOutputPrecisionAtPort(NMS_SELECTEDOUTPUTS), supportedFloatPrecision, "selected_outputs", m_outType); + checkPrecision(getOriginalOutputPrecisionAtPort(NMS_SELECTEDNUM), supportedIntOutputPrecision, "selected_num", m_outType); addSupportedPrimDesc({{LayoutType::ncsp, Precision::FP32}, {LayoutType::ncsp, Precision::FP32}}, @@ -135,100 +105,138 @@ void MKLDNNMultiClassNmsNode::initSupportedPrimitiveDescriptors() { impl_desc_type::ref_any); } +void MKLDNNMultiClassNmsNode::createPrimitive() { + if (inputShapesDefined()) { + prepareParams(); + updateLastInputDims(); + } +} + +void MKLDNNMultiClassNmsNode::prepareParams() { + const auto& boxes_dims = getParentEdgeAt(NMS_BOXES)->getMemory().getStaticDims(); + const auto& scores_dims = getParentEdgeAt(NMS_SCORES)->getMemory().getStaticDims(); + if (!(boxes_dims[0] == scores_dims[0] && boxes_dims[1] == scores_dims[2])) { + IE_THROW() << m_errorPrefix << "has incompatible 'boxes' and 'scores' input dmensions"; + } + + m_numBatches = boxes_dims[0]; + m_numBoxes = boxes_dims[1]; + + m_numClasses = scores_dims[1]; + + int max_output_boxes_per_class = 0; + size_t real_num_classes = m_backgroundClass == -1 ? m_numClasses : + m_backgroundClass < m_numClasses ? m_numClasses - 1 : m_numClasses; + if (m_nmsTopK) { + max_output_boxes_per_class = (m_nmsTopK == -1) ? m_numBoxes : + std::min(m_nmsTopK, static_cast(m_numBoxes)); + m_filtBoxes.resize(max_output_boxes_per_class * m_numBatches * m_numClasses); + } + m_nmsRealTopk = max_output_boxes_per_class; + + m_maxBoxesPerBatch = max_output_boxes_per_class * real_num_classes; + if (m_keepTopK >= 0) + m_maxBoxesPerBatch = std::min(m_maxBoxesPerBatch, static_cast(m_keepTopK)); + + m_numFiltBox.resize(m_numBatches); + for (auto &numPerBatch : m_numFiltBox) { + numPerBatch.resize(m_numClasses, 0); + } + m_numBoxOffset.resize(m_numBatches); +} + void MKLDNNMultiClassNmsNode::execute(mkldnn::stream strm) { const float* boxes = reinterpret_cast(getParentEdgeAt(NMS_BOXES)->getMemoryPtr()->GetPtr()); const float* scores = reinterpret_cast(getParentEdgeAt(NMS_SCORES)->getMemoryPtr()->GetPtr()); auto dims_boxes = getParentEdgeAt(NMS_BOXES)->getMemory().getStaticDims(); - if (max_output_boxes_per_class == 0) + if (m_nmsRealTopk == 0) return; - int* selected_indices = reinterpret_cast(getChildEdgesAtPort(NMS_SELECTEDINDICES)[0]->getMemoryPtr()->GetPtr()); - - float* selected_outputs = reinterpret_cast(getChildEdgesAtPort(NMS_SELECTEDOUTPUTS)[0]->getMemoryPtr()->GetPtr()); - - int* selected_num = reinterpret_cast(getChildEdgesAtPort(NMS_SELECTEDNUM)[0]->getMemoryPtr()->GetPtr()); + auto selectedOutputsMemPtr = getChildEdgesAtPort(NMS_SELECTEDOUTPUTS)[0]->getMemoryPtr(); + auto selectedIndicesMemPtr = getChildEdgesAtPort(NMS_SELECTEDINDICES)[0]->getMemoryPtr(); + auto validOutputsMemPtr = getChildEdgesAtPort(NMS_SELECTEDNUM)[0]->getMemoryPtr(); auto boxesStrides = getParentEdgeAt(NMS_BOXES)->getMemory().GetDescWithType()->getStrides(); auto scoresStrides = getParentEdgeAt(NMS_SCORES)->getMemory().GetDescWithType()->getStrides(); - if ((nms_eta >= 0) && (nms_eta < 1)) { + if ((m_nmsEta >= 0) && (m_nmsEta < 1)) { nmsWithEta(boxes, scores, boxesStrides, scoresStrides); } else { nmsWithoutEta(boxes, scores, boxesStrides, scoresStrides); } - size_t startOffset = numFiltBox[0][0]; - numBoxOffset[0] = 0; - for (size_t b = 0; b < numFiltBox.size(); b++) { + size_t startOffset = m_numFiltBox[0][0]; + m_numBoxOffset[0] = 0; + for (size_t b = 0; b < m_numFiltBox.size(); b++) { size_t batchOffsetNew = 0; - size_t batchOffset = b * num_classes * max_output_boxes_per_class; - for (size_t c = (b == 0 ? 1 : 0); c < numFiltBox[b].size(); c++) { - size_t offset = batchOffset + c * max_output_boxes_per_class; - for (size_t i = 0; i < numFiltBox[b][c]; i++) { - filtBoxes[startOffset + i] = filtBoxes[offset + i]; + size_t batchOffset = b * m_numClasses * m_nmsRealTopk; + for (size_t c = (b == 0 ? 1 : 0); c < m_numFiltBox[b].size(); c++) { + size_t offset = batchOffset + c * m_nmsRealTopk; + for (size_t i = 0; i < m_numFiltBox[b][c]; i++) { + m_filtBoxes[startOffset + i] = m_filtBoxes[offset + i]; } - startOffset += numFiltBox[b][c]; - batchOffsetNew += numFiltBox[b][c]; + startOffset += m_numFiltBox[b][c]; + batchOffsetNew += m_numFiltBox[b][c]; } - numBoxOffset[b] = batchOffsetNew; + m_numBoxOffset[b] = batchOffsetNew; if (b == 0) - numBoxOffset[b] += numFiltBox[0][0]; + m_numBoxOffset[b] += m_numFiltBox[0][0]; } // sort element before go through keep_top_k - parallel_sort(filtBoxes.begin(), filtBoxes.begin() + startOffset, [](const filteredBoxes& l, const filteredBoxes& r) { + parallel_sort(m_filtBoxes.begin(), m_filtBoxes.begin() + startOffset, [](const filteredBoxes& l, const filteredBoxes& r) { return ((l.batch_index < r.batch_index) || ((l.batch_index == r.batch_index) && ((l.score > r.score) || ((std::fabs(l.score - r.score) < 1e-6) && l.class_index < r.class_index) || ((std::fabs(l.score - r.score) < 1e-6) && l.class_index == r.class_index && l.box_index < r.box_index)))); }); - if (keep_top_k > -1) { + if (m_keepTopK > -1) { startOffset = 0; size_t offset = 0; - for (size_t b = 0; b < numFiltBox.size(); b++) { - if (numBoxOffset[b] > keep_top_k) { + for (size_t b = 0; b < m_numFiltBox.size(); b++) { + if (m_numBoxOffset[b] > m_keepTopK) { if (startOffset == offset) { - startOffset += keep_top_k; - offset += numBoxOffset[b]; + startOffset += m_keepTopK; + offset += m_numBoxOffset[b]; } else { - for (size_t i = 0; i < keep_top_k; i++) { - filtBoxes[startOffset + i] = filtBoxes[offset + i]; + for (size_t i = 0; i < m_keepTopK; i++) { + m_filtBoxes[startOffset + i] = m_filtBoxes[offset + i]; } - startOffset += keep_top_k; - offset += numBoxOffset[b]; + startOffset += m_keepTopK; + offset += m_numBoxOffset[b]; } } else { if (startOffset == offset) { - startOffset += numBoxOffset[b]; - offset += numBoxOffset[b]; + startOffset += m_numBoxOffset[b]; + offset += m_numBoxOffset[b]; } else { - for (size_t i = 0; i < numBoxOffset[b]; i++) { - filtBoxes[startOffset + i] = filtBoxes[offset + i]; + for (size_t i = 0; i < m_numBoxOffset[b]; i++) { + m_filtBoxes[startOffset + i] = m_filtBoxes[offset + i]; } - startOffset += numBoxOffset[b]; - offset += numBoxOffset[b]; + startOffset += m_numBoxOffset[b]; + offset += m_numBoxOffset[b]; } } } } - if (sort_result_across_batch) { - if (sort_result_type == MulticlassNmsSortResultType::SCORE) { - parallel_sort(filtBoxes.begin(), filtBoxes.begin() + startOffset, [](const filteredBoxes& l, const filteredBoxes& r) { + if (m_sortResultAcrossBatch) { + if (m_sortResultType == MulticlassNmsSortResultType::SCORE) { + parallel_sort(m_filtBoxes.begin(), m_filtBoxes.begin() + startOffset, [](const filteredBoxes& l, const filteredBoxes& r) { return (l.score > r.score) || (l.score == r.score && l.batch_index < r.batch_index) || (l.score == r.score && l.batch_index == r.batch_index && l.class_index < r.class_index) || (l.score == r.score && l.batch_index == r.batch_index && l.class_index == r.class_index && l.box_index < r.box_index); }); - } else if (sort_result_type == MulticlassNmsSortResultType::CLASSID) { - parallel_sort(filtBoxes.begin(), filtBoxes.begin() + startOffset, [](const filteredBoxes& l, const filteredBoxes& r) { + } else if (m_sortResultType == MulticlassNmsSortResultType::CLASSID) { + parallel_sort(m_filtBoxes.begin(), m_filtBoxes.begin() + startOffset, [](const filteredBoxes& l, const filteredBoxes& r) { return (l.class_index < r.class_index) || (l.class_index == r.class_index && l.batch_index < r.batch_index) || (l.class_index == r.class_index && l.batch_index == r.batch_index && l.score > r.score) || (l.class_index == r.class_index && l.batch_index == r.batch_index && l.score == r.score && l.box_index < r.box_index); }); } - } else if (sort_result_type == MulticlassNmsSortResultType::CLASSID) { - parallel_sort(filtBoxes.begin(), filtBoxes.begin() + startOffset, [](const filteredBoxes& l, const filteredBoxes& r) { + } else if (m_sortResultType == MulticlassNmsSortResultType::CLASSID) { + parallel_sort(m_filtBoxes.begin(), m_filtBoxes.begin() + startOffset, [](const filteredBoxes& l, const filteredBoxes& r) { return ((l.batch_index < r.batch_index) || ((l.batch_index == r.batch_index) && ((l.class_index < r.class_index) || ((l.class_index == r.class_index) && l.score > r.score) || @@ -236,18 +244,28 @@ void MKLDNNMultiClassNmsNode::execute(mkldnn::stream strm) { }); } - const size_t selectedBoxesNum = getChildEdgeAt(NMS_SELECTEDINDICES)->getMemory().getStaticDims()[0]; - const size_t validOutputs = std::min(startOffset, selectedBoxesNum); + const size_t validOutputs = std::min(startOffset, m_maxBoxesPerBatch * dims_boxes[0]); std::vector m_selected_num; m_selected_num.resize(dims_boxes[0]); - const size_t selectedBoxesNum_perBatch = selectedBoxesNum / dims_boxes[0]; + const size_t selectedBoxesNum_perBatch = m_maxBoxesPerBatch; for (size_t idx = 0lu; idx < validOutputs; idx++) { - m_selected_num[filtBoxes[idx].batch_index]++; + m_selected_num[m_filtBoxes[idx].batch_index]++; } + // TODO [DS NMS]: remove when nodes from models where nms is not last node in model supports DS + if (isDynamicNode()) { + size_t totalBox = std::accumulate(m_selected_num.begin(), m_selected_num.end(), 0); + selectedOutputsMemPtr->redefineDesc(getBaseMemDescAtOutputPort(NMS_SELECTEDOUTPUTS)->cloneWithNewDims({totalBox, 6})); + selectedIndicesMemPtr->redefineDesc(getBaseMemDescAtOutputPort(NMS_SELECTEDINDICES)->cloneWithNewDims({totalBox, 1})); + validOutputsMemPtr->redefineDesc(getBaseMemDescAtOutputPort(NMS_SELECTEDNUM)->cloneWithNewDims({m_numBatches})); + } + int* selected_indices = reinterpret_cast(selectedIndicesMemPtr->GetPtr()); + float* selected_outputs = reinterpret_cast(selectedOutputsMemPtr->GetPtr()); + int* selected_num = reinterpret_cast(validOutputsMemPtr->GetPtr()); + int64_t output_offset = 0; int64_t original_offset = 0; for (size_t i = 0; i < dims_boxes[0]; i++) { @@ -256,19 +274,25 @@ void MKLDNNMultiClassNmsNode::execute(mkldnn::stream strm) { for (size_t j = 0; j < real_boxes; j++) { auto original_index = original_offset + j; - selected_indices[j + output_offset] = filtBoxes[original_index].batch_index * dims_boxes[1] + filtBoxes[original_index].box_index; + selected_indices[j + output_offset] = m_filtBoxes[original_index].batch_index * dims_boxes[1] + m_filtBoxes[original_index].box_index; auto selected_base = selected_outputs + (output_offset + j) * 6; - selected_base[0] = filtBoxes[original_index].class_index; - selected_base[1] = filtBoxes[original_index].score; + selected_base[0] = m_filtBoxes[original_index].class_index; + selected_base[1] = m_filtBoxes[original_index].score; selected_base[2] = boxes[selected_indices[j + output_offset] * 4]; selected_base[3] = boxes[selected_indices[j + output_offset] * 4 + 1]; selected_base[4] = boxes[selected_indices[j + output_offset] * 4 + 2]; selected_base[5] = boxes[selected_indices[j + output_offset] * 4 + 3]; } - std::fill_n(selected_outputs + (output_offset + real_boxes) * 6, (selectedBoxesNum_perBatch - real_boxes) * 6, -1); - std::fill_n(selected_indices + (output_offset + real_boxes), selectedBoxesNum_perBatch - real_boxes, -1); - output_offset += selectedBoxesNum_perBatch; - original_offset += real_boxes; + // TODO [DS NMS]: remove when nodes from models where nms is not last node in model supports DS + if (!isDynamicNode()) { + std::fill_n(selected_outputs + (output_offset + real_boxes) * 6, (selectedBoxesNum_perBatch - real_boxes) * 6, -1); + std::fill_n(selected_indices + (output_offset + real_boxes), selectedBoxesNum_perBatch - real_boxes, -1); + output_offset += selectedBoxesNum_perBatch; + original_offset += real_boxes; + } else { + output_offset += real_boxes; + original_offset += real_boxes; + } } } @@ -309,21 +333,21 @@ void MKLDNNMultiClassNmsNode::nmsWithEta(const float* boxes, const float* scores return iou <= adaptive_threshold ? 1.0f : 0.0f; }; - parallel_for2d(num_batches, num_classes, [&](int batch_idx, int class_idx) { - if (class_idx != background_class) { + parallel_for2d(m_numBatches, m_numClasses, [&](int batch_idx, int class_idx) { + if (class_idx != m_backgroundClass) { std::vector fb; const float* boxesPtr = boxes + batch_idx * boxesStrides[0]; const float* scoresPtr = scores + batch_idx * scoresStrides[0] + class_idx * scoresStrides[1]; std::priority_queue, decltype(less)> sorted_boxes(less); - for (int box_idx = 0; box_idx < num_boxes; box_idx++) { - if (scoresPtr[box_idx] >= score_threshold) // algin with ref + for (int box_idx = 0; box_idx < m_numBoxes; box_idx++) { + if (scoresPtr[box_idx] >= m_scoreThreshold) // algin with ref sorted_boxes.emplace(boxInfo({scoresPtr[box_idx], box_idx, 0})); } fb.reserve(sorted_boxes.size()); if (sorted_boxes.size() > 0) { - auto adaptive_threshold = iou_threshold; - int max_out_box = (max_output_boxes_per_class > sorted_boxes.size()) ? sorted_boxes.size() : max_output_boxes_per_class; + auto adaptive_threshold = m_iouThreshold; + int max_out_box = (m_nmsRealTopk > sorted_boxes.size()) ? sorted_boxes.size() : m_nmsRealTopk; while (max_out_box && !sorted_boxes.empty()) { boxInfo currBox = sorted_boxes.top(); float origScore = currBox.score; @@ -332,49 +356,49 @@ void MKLDNNMultiClassNmsNode::nmsWithEta(const float* boxes, const float* scores bool box_is_selected = true; for (int idx = static_cast(fb.size()) - 1; idx >= currBox.suppress_begin_index; idx--) { - float iou = intersectionOverUnion(&boxesPtr[currBox.idx * 4], &boxesPtr[fb[idx].box_index * 4], normalized); + float iou = intersectionOverUnion(&boxesPtr[currBox.idx * 4], &boxesPtr[fb[idx].box_index * 4], m_normalized); currBox.score *= func(iou, adaptive_threshold); if (iou >= adaptive_threshold) { box_is_selected = false; break; } - if (currBox.score <= score_threshold) + if (currBox.score <= m_scoreThreshold) break; } currBox.suppress_begin_index = fb.size(); if (box_is_selected) { - if (nms_eta < 1 && adaptive_threshold > 0.5) { - adaptive_threshold *= nms_eta; + if (m_nmsEta < 1 && adaptive_threshold > 0.5) { + adaptive_threshold *= m_nmsEta; } if (currBox.score == origScore) { fb.push_back({currBox.score, batch_idx, class_idx, currBox.idx}); continue; } - if (currBox.score > score_threshold) { + if (currBox.score > m_scoreThreshold) { sorted_boxes.push(currBox); } } } } - numFiltBox[batch_idx][class_idx] = fb.size(); - size_t offset = batch_idx * num_classes * max_output_boxes_per_class + class_idx * max_output_boxes_per_class; + m_numFiltBox[batch_idx][class_idx] = fb.size(); + size_t offset = batch_idx * m_numClasses * m_nmsRealTopk + class_idx * m_nmsRealTopk; for (size_t i = 0; i < fb.size(); i++) { - filtBoxes[offset + i] = fb[i]; + m_filtBoxes[offset + i] = fb[i]; } } }); } void MKLDNNMultiClassNmsNode::nmsWithoutEta(const float* boxes, const float* scores, const SizeVector& boxesStrides, const SizeVector& scoresStrides) { - parallel_for2d(num_batches, num_classes, [&](int batch_idx, int class_idx) { - if (class_idx != background_class) { + parallel_for2d(m_numBatches, m_numClasses, [&](int batch_idx, int class_idx) { + if (class_idx != m_backgroundClass) { const float* boxesPtr = boxes + batch_idx * boxesStrides[0]; const float* scoresPtr = scores + batch_idx * scoresStrides[0] + class_idx * scoresStrides[1]; std::vector> sorted_boxes; - for (int box_idx = 0; box_idx < num_boxes; box_idx++) { - if (scoresPtr[box_idx] >= score_threshold) // algin with ref + for (int box_idx = 0; box_idx < m_numBoxes; box_idx++) { + if (scoresPtr[box_idx] >= m_scoreThreshold) // algin with ref sorted_boxes.emplace_back(std::make_pair(scoresPtr[box_idx], box_idx)); } @@ -383,35 +407,36 @@ void MKLDNNMultiClassNmsNode::nmsWithoutEta(const float* boxes, const float* sco parallel_sort(sorted_boxes.begin(), sorted_boxes.end(), [](const std::pair& l, const std::pair& r) { return (l.first > r.first || ((l.first == r.first) && (l.second < r.second))); }); - int offset = batch_idx * num_classes * max_output_boxes_per_class + class_idx * max_output_boxes_per_class; - filtBoxes[offset + 0] = filteredBoxes(sorted_boxes[0].first, batch_idx, class_idx, sorted_boxes[0].second); + int offset = batch_idx * m_numClasses * m_nmsRealTopk + class_idx * m_nmsRealTopk; + m_filtBoxes[offset + 0] = filteredBoxes(sorted_boxes[0].first, batch_idx, class_idx, sorted_boxes[0].second); io_selection_size++; - int max_out_box = (max_output_boxes_per_class > sorted_boxes.size()) ? sorted_boxes.size() : max_output_boxes_per_class; + int max_out_box = (m_nmsRealTopk > sorted_boxes.size()) ? sorted_boxes.size() : m_nmsRealTopk; for (size_t box_idx = 1; box_idx < max_out_box; box_idx++) { bool box_is_selected = true; for (int idx = io_selection_size - 1; idx >= 0; idx--) { - float iou = - intersectionOverUnion(&boxesPtr[sorted_boxes[box_idx].second * 4], &boxesPtr[filtBoxes[offset + idx].box_index * 4], normalized); - if (iou >= iou_threshold) { + float iou = intersectionOverUnion(&boxesPtr[sorted_boxes[box_idx].second * 4], + &boxesPtr[m_filtBoxes[offset + idx].box_index * 4], m_normalized); + if (iou >= m_iouThreshold) { box_is_selected = false; break; } } if (box_is_selected) { - filtBoxes[offset + io_selection_size] = filteredBoxes(sorted_boxes[box_idx].first, batch_idx, class_idx, sorted_boxes[box_idx].second); + m_filtBoxes[offset + io_selection_size] = filteredBoxes(sorted_boxes[box_idx].first, batch_idx, class_idx, + sorted_boxes[box_idx].second); io_selection_size++; } } } - numFiltBox[batch_idx][class_idx] = io_selection_size; + m_numFiltBox[batch_idx][class_idx] = io_selection_size; } }); } void MKLDNNMultiClassNmsNode::checkPrecision(const Precision prec, const std::vector precList, const std::string name, const std::string type) { if (std::find(precList.begin(), precList.end(), prec) == precList.end()) - IE_THROW() << errorPrefix << "has unsupported '" << name << "' " << type << " precision: " << prec; + IE_THROW() << m_errorPrefix << "has unsupported '" << name << "' " << type << " precision: " << prec; } REG_MKLDNN_PRIM_FOR(MKLDNNMultiClassNmsNode, MulticlassNms) diff --git a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_multiclass_nms.hpp b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_multiclass_nms.hpp index fd6d040b3b0..6acf3755001 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_multiclass_nms.hpp +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_multiclass_nms.hpp @@ -23,12 +23,17 @@ public: void getSupportedDescriptors() override {}; void initSupportedPrimitiveDescriptors() override; - void createPrimitive() override {}; + void createPrimitive() override; void execute(mkldnn::stream strm) override; bool created() const override; static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; + void executeDynamicImpl(mkldnn::stream strm) override { execute(strm); } + + bool needShapeInfer() const override { return false; } + void prepareParams() override; + private: // input (port Num) const size_t NMS_BOXES = 0; @@ -39,27 +44,29 @@ private: const size_t NMS_SELECTEDINDICES = 1; const size_t NMS_SELECTEDNUM = 2; - bool sort_result_across_batch = false; - MulticlassNmsSortResultType sort_result_type = MulticlassNmsSortResultType::NONE; + bool m_sortResultAcrossBatch = false; + MulticlassNmsSortResultType m_sortResultType = MulticlassNmsSortResultType::NONE; - size_t num_batches = 0; - size_t num_boxes = 0; - size_t num_classes = 0; + size_t m_numBatches = 0; + size_t m_numBoxes = 0; + size_t m_numClasses = 0; + size_t m_maxBoxesPerBatch = 0; - int max_output_boxes_per_class = 0; - float iou_threshold = 0.0f; - float score_threshold = 0.0f; + int m_nmsRealTopk = 0; + int m_nmsTopK = 0; + float m_iouThreshold = 0.0f; + float m_scoreThreshold = 0.0f; - int32_t background_class = 0; - int32_t keep_top_k = 0; - float nms_eta = 0.0f; - bool normalized = true; + int32_t m_backgroundClass = 0; + int32_t m_keepTopK = 0; + float m_nmsEta = 0.0f; + bool m_normalized = true; - std::string errorPrefix; + std::string m_errorPrefix; - std::vector> numFiltBox; - std::vector numBoxOffset; - const std::string inType = "input", outType = "output"; + std::vector> m_numFiltBox; + std::vector m_numBoxOffset; + const std::string m_inType = "input", m_outType = "output"; struct filteredBoxes { float score; @@ -77,7 +84,7 @@ private: int suppress_begin_index; }; - std::vector filtBoxes; + std::vector m_filtBoxes; void checkPrecision(const InferenceEngine::Precision prec, const std::vector precList, const std::string name, const std::string type); diff --git a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_pooling_node.h b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_pooling_node.h index 104b6f65e0b..1d91199f95a 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_pooling_node.h +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_pooling_node.h @@ -28,7 +28,7 @@ public: return false; } - void prepareParams() override;; + void prepareParams() override; void executeDynamicImpl(mkldnn::stream strm) override { execute(strm); } static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; diff --git a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_reduce_node.cpp b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_reduce_node.cpp index b9439b4a2ed..3ecc41eee7e 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_reduce_node.cpp +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_reduce_node.cpp @@ -5,6 +5,7 @@ #include "mkldnn_reduce_node.h" #include "mkldnn_fake_quantize_node.h" +#include "mkldnn_eltwise_node.h" #include #include #include @@ -44,6 +45,7 @@ using namespace Xbyak; OW = width; #define GET_OFF(field) offsetof(jit_reduce_call_args, field) +#define GET_OFF_POST(field) offsetof(jit_reduce_post_call_args, field) #define GET_PTR_N_PLN const uint8_t *in_ptr_n = in_ptr + src_data_size * ib * IC * ID * IH * IW; \ uint8_t *out_ptr_n = out_ptr + dst_data_size * ob * OC * OD * OH * OW; @@ -86,17 +88,22 @@ struct jit_uni_reduce_kernel_f32 : public jit_uni_reduce_kernel, public jit_gene } void generate() override { - exp_injector.reset(new jit_uni_eltwise_injector_f32(this, alg_kind::eltwise_exp, 0.f, 0.f, 1)); + if (jcp_.reduce_mode == ReduceLogSumExp) { + exp_injector = std::make_shared>(this, alg_kind::eltwise_exp, 0.f, 0.f, 1); + } if (!mayiuse(avx512_core_bf16) && mayiuse(avx512_core)) - emu_vcvtneps2bf16.reset(new jit_emu_vcvtneps2bf16(this, isa, nullptr)); + emu_vcvtneps2bf16 = std::make_shared(this, isa, nullptr); this->preamble(); + planar_layout = jcp_.layout == ReduceLayoutType::reduce_ncsp || jcp_.layout == ReduceLayoutType::reduce_nspc; + mov(reg_src, ptr[reg_params + GET_OFF(src)]); mov(reg_dst, ptr[reg_params + GET_OFF(dst)]); mov(reg_work_amount, ptr[reg_params + GET_OFF(work_amount)]); - if (jcp_.planar_layout) + mov(reg_work_batch, ptr[reg_params + GET_OFF(work_batch)]); + if (planar_layout) mov(reg_reduce_w, ptr[reg_params + GET_OFF(reduce_w)]); if (jcp_.reduce_mode == ReduceAnd || jcp_.reduce_mode == ReduceL1 || jcp_.reduce_mode == ReduceMax || @@ -131,19 +138,26 @@ private: using Vmm = typename conditional3::type; size_t vlen = cpu_isa_traits::vlen; + bool planar_layout; Xbyak::Address table_val(int index) { return ptr[reg_table + index * vlen]; } Xbyak::Reg64 reg_src = r8; Xbyak::Reg64 reg_dst = r9; + Xbyak::Reg64 reg_idx = rdx; Xbyak::Reg64 reg_work_amount = r10; Xbyak::Reg64 reg_reduce_w = r11; - Xbyak::Reg64 reg_table = r12; + Xbyak::Reg64 reg_reduce_stride = r12; + Xbyak::Reg64 reg_work_batch = r13; + Xbyak::Reg64 reg_table = r14; Xbyak::Reg64 reg_params = abi_param1; - Xbyak::Reg8 reg_tmp_8 = r13b; - Xbyak::Reg32 reg_tmp_32 = r13d; - Xbyak::Reg64 reg_tmp_64 = r13; + Xbyak::Reg8 reg_tmp_8 = r15b; + Xbyak::Reg32 reg_tmp_32 = r15d; + Xbyak::Reg64 reg_tmp_64 = r15; + + Xbyak::Reg64 reg_src_aux = rax; + Xbyak::Reg64 reg_work_batch_aux = rbx; Vmm vmm_aux = Vmm(0); Xmm xmm_aux = Xmm(0); @@ -154,16 +168,17 @@ private: Vmm vmm_zero = Vmm(3); Xmm xmm_zero = Xmm(3); Vmm vmm_dst_aux = Vmm(4); - Xbyak::Xmm xmm_aux1 = Xbyak::Xmm(5); - Xbyak::Xmm xmm_aux2 = Xbyak::Xmm(6); - Xbyak::Xmm xmm_aux3 = Xbyak::Xmm(7); + Xmm xmm_aux1 = Xmm(5); + Xmm xmm_aux2 = Xmm(6); + Xmm xmm_aux3 = Xmm(7); + Vmm vmm_idx = Vmm(8); + Vmm vmm_mask = Vmm(9); const Xbyak::Opmask k_mask = Xbyak::Opmask(1); - std::unique_ptr emu_vcvtneps2bf16; - Xbyak::Label l_table; + std::shared_ptr emu_vcvtneps2bf16; std::shared_ptr> exp_injector; inline void reduce_main() { @@ -225,8 +240,12 @@ private: // ================================================================ Xbyak::Label reduce_to_vector_label; Xbyak::Label reduce_to_scalar_label; + Xbyak::Label reduce_to_gather_label; Xbyak::Label reduce_main_end_label; - if (jcp_.planar_layout) { + if (planar_layout) { + cmp(reg_work_batch, 0); + je(reduce_to_gather_label, T_NEAR); + cmp(reg_reduce_w, 1); // planar layout reducing W je(reduce_to_scalar_label, T_NEAR); } @@ -246,29 +265,8 @@ private: // load load_dst_vector(); - Xbyak::Label reduce_loop_label; - Xbyak::Label reduce_loop_end_label; - // reduce - L(reduce_loop_label); - { - cmp(reg_work_amount, step); - jl(reduce_loop_end_label, T_NEAR); - - load_vector(vmm_src, ptr[reg_src], jcp_.src_dt); - reduce_kernel(vmm_src, vmm_dst); - - if (isa == cpu::x64::sse41) { - load_vector(vmm_src, ptr[reg_src + 4 * jcp_.src_data_size], jcp_.src_dt); - reduce_kernel(vmm_src, vmm_dst_aux); - } - - add(reg_src, step * jcp_.src_data_size); - sub(reg_work_amount, step); - - jmp(reduce_loop_label, T_NEAR); - } - L(reduce_loop_end_label); + reduce_kernel(); // store store_dst_vector(); @@ -317,16 +315,57 @@ private: // reduce reduce_main_loop(); if (jcp_.reduce_mode == ReduceOr && isa != cpu::x64::avx512_common) { - if (isa == cpu::x64::avx2) { - vcmpneqps(vmm_dst, vmm_dst, vmm_zero); - } else if (isa == cpu::x64::sse41) { - cmpneqps(vmm_dst, vmm_zero); - } + uni_cmpneqps(vmm_dst, vmm_dst, vmm_zero); uni_vandps(vmm_dst, vmm_dst, vmm_aux); } // store // store after horizontal calculation and calculation with loaded original ptr[reg_dst] - load_embedded_horiz_reduce_store(vmm_dst, jcp_.dst_dt); + horiz_reduce_store(vmm_dst, jcp_.dst_dt, true); + + jmp(reduce_main_end_label, T_NEAR); + } + + // load vmm_src with gather, then store vmm_dst directly into memory after reducing + // cases: [planar layout reducing small W] + L(reduce_to_gather_label); + { + int step = 1; + cmp(reg_work_amount, step); + jl(reduce_main_end_label, T_NEAR); //avoid illegal loading and storing + + mov(reg_idx, ptr[reg_params + GET_OFF(idx)]); + uni_vmovdqu(vmm_idx, ptr[reg_idx]); + + if (jcp_.reduce_mode == ReduceL1) { + uni_vmovups(vmm_aux, table_val(1)); + } + + // load + load_dst_vector(); + + // reduce + Xbyak::Label reduce_loop_label; + Xbyak::Label reduce_loop_end_label; + L(reduce_loop_label); + { + cmp(reg_work_amount, step); + jl(reduce_loop_end_label, T_NEAR); + + reduce_gather(vmm_dst, 0); + if (isa == cpu::x64::sse41) { + reduce_gather(vmm_dst_aux, 4 * jcp_.src_data_size); + } + + add(reg_src, step * jcp_.src_data_size); + sub(reg_work_amount, step); + jmp(reduce_loop_label, T_NEAR); + } + L(reduce_loop_end_label); + + // store + store_dst_vector(); + + jmp(reduce_main_end_label, T_NEAR); } L(reduce_main_end_label); @@ -340,7 +379,7 @@ private: Xbyak::Label tail_dst_shifted_label; Xbyak::Label tail_dst_fixed_label; Xbyak::Label reduce_tail_end_label; - if (jcp_.planar_layout) { + if (planar_layout) { cmp(reg_reduce_w, 1); // planar layout reducing W je(tail_dst_fixed_label, T_NEAR); } @@ -349,40 +388,7 @@ private: // cases: [planar layout reducing other dimensions but W] [blocked layout concern padding] L(tail_dst_shifted_label); { - Xbyak::Label reduce_loop_label; - Xbyak::Label reduce_loop_end_label; - - int step = 1; - L(reduce_loop_label); - { - cmp(reg_work_amount, step); - jl(reduce_loop_end_label, T_NEAR); - - // load - load_scalar(xmm_dst, ptr[reg_dst], jcp_.dst_dt); - load_scalar(xmm_src, ptr[reg_src], jcp_.src_dt); - - // reduce - reduce_kernel_scalar(xmm_src, xmm_dst); - if (jcp_.reduce_mode == ReduceOr) { - if (isa == cpu::x64::sse41) { - cmpneqps(xmm_dst, xmm_zero); - } else { - vcmpneqps(xmm_dst, xmm_dst, xmm_zero); - } - uni_vandps(xmm_dst, xmm_dst, xmm_aux); - } - - // store - store_scalar(ptr[reg_dst], xmm_dst, jcp_.dst_dt); - - add(reg_dst, step * jcp_.dst_data_size); - add(reg_src, step * jcp_.src_data_size); - sub(reg_work_amount, step); - - jmp(reduce_loop_label, T_NEAR); - } - L(reduce_loop_end_label); + reduce_kernel_tail(); jmp(reduce_tail_end_label, T_NEAR); } @@ -408,11 +414,7 @@ private: reduce_kernel_scalar(xmm_src, xmm_dst); if (jcp_.reduce_mode == ReduceOr) { - if (isa == cpu::x64::sse41) { - cmpneqps(xmm_dst, xmm_zero); - } else { - vcmpneqps(xmm_dst, xmm_dst, xmm_zero); - } + uni_cmpneqps(xmm_dst, xmm_dst, xmm_zero); uni_vandps(xmm_dst, xmm_dst, xmm_aux); } @@ -425,12 +427,254 @@ private: // store store_scalar(ptr[reg_dst], xmm_dst, jcp_.dst_dt); - add(reg_dst, step * jcp_.dst_data_size); } L(reduce_tail_end_label); } + inline void init_reg_reduce_stride() { + mov(reg_reduce_stride, ptr[reg_params + GET_OFF(reduce_stride)]); + mul_by_const(reg_reduce_stride, reg_tmp_64, jcp_.src_data_size); + } + + inline void reduce_kernel() { + Xbyak::Label reduce_label; + Xbyak::Label reduce_end_label; + Xbyak::Label reduce_batch_label; + Xbyak::Label reduce_batch_end_label; + + int step = vlen / sizeof(float) < 8 ? 8 : vlen / sizeof(float); + cmp(reg_work_batch, 1); + je(reduce_label, T_NEAR); + + init_reg_reduce_stride(); + + L(reduce_batch_label); + { + cmp(reg_work_amount, step); + jl(reduce_end_label, T_NEAR); + + reduce_batch(); + + add(reg_src, step * jcp_.src_data_size); + sub(reg_work_amount, step); + jmp(reduce_batch_label, T_NEAR); + } + L(reduce_batch_end_label); + + L(reduce_label); + { + cmp(reg_work_amount, step); + jl(reduce_end_label, T_NEAR); + + reduce_once(); + + add(reg_src, step * jcp_.src_data_size); + sub(reg_work_amount, step); + jmp(reduce_label, T_NEAR); + } + L(reduce_end_label); + } + + inline void reduce_once() { + load_vector(vmm_src, ptr[reg_src], jcp_.src_dt); + reduce_kernel(vmm_src, vmm_dst); + + if (isa == cpu::x64::sse41) { + load_vector(vmm_src, ptr[reg_src + 4 * jcp_.src_data_size], jcp_.src_dt); + reduce_kernel(vmm_src, vmm_dst_aux); + } + } + + inline void reduce_batch() { + mov(reg_src_aux, reg_src); + mov(reg_work_batch_aux, reg_work_batch); + + Xbyak::Label reduce_batch_loop_label; + Xbyak::Label reduce_batch_loop_end_label; + L(reduce_batch_loop_label); + { + cmp(reg_work_batch_aux, 1); + jl(reduce_batch_loop_end_label, T_NEAR); + + load_vector(vmm_src, ptr[reg_src_aux], jcp_.src_dt); + reduce_kernel(vmm_src, vmm_dst); + if (isa == cpu::x64::sse41) { + load_vector(vmm_src, ptr[reg_src_aux + 4 * jcp_.src_data_size], jcp_.src_dt); + reduce_kernel(vmm_src, vmm_dst_aux); + } + + add(reg_src_aux, reg_reduce_stride); + sub(reg_work_batch_aux, 1); + jmp(reduce_batch_loop_label, T_NEAR); + } + L(reduce_batch_loop_end_label); + } + + inline void reduce_gather(Vmm vmm_dst, int offset) { + switch (jcp_.src_dt) { + case memory::data_type::f32: + case memory::data_type::s32: + if (isa == cpu::x64::avx512_common) { + kxnord(k_mask, k_mask, k_mask); + vgatherdps(vmm_src | k_mask, ptr[reg_src + offset + vmm_idx]); + } else if (isa == cpu::x64::avx2) { + uni_vpcmpeqd(vmm_mask, vmm_mask, vmm_mask); + vgatherdps(vmm_src, ptr[reg_src + offset + vmm_idx], vmm_mask); + } else { + pack_gathered_vector(vmm_src, vmm_idx, offset, jcp_.src_dt); + } + break; + case memory::data_type::bf16: + case memory::data_type::s8: + case memory::data_type::u8: + pack_gathered_vector(vmm_src, vmm_idx, offset, jcp_.src_dt); + break; + default: + assert(!"unknown src_dt"); + } + reduce_kernel(vmm_src, vmm_dst); + } + + inline void pack_gathered_vector(Vmm vmm_val, Vmm vmm_index, int offset, memory::data_type src_dt) { + sub(rsp, vlen); + uni_vmovdqu(ptr[rsp], vmm_index); + int repeats = vlen / sizeof(float); + for (size_t i = 0; i < repeats; i++) { + mov(reg_tmp_64.cvt32(), ptr[rsp + i * sizeof(int)]); + Xbyak::Address table_idx = ptr[reg_src + offset + reg_tmp_64]; + switch (src_dt) { + case memory::data_type::f32: + case memory::data_type::s32: + mov(reg_tmp_64.cvt32(), table_idx); + mov(ptr[rsp + i * sizeof(int)], reg_tmp_64.cvt32()); + break; + case memory::data_type::bf16: + mov(reg_tmp_64.cvt16(), table_idx); + mov(ptr[rsp + i * sizeof(MKLDNNPlugin::bfloat16_t)], reg_tmp_64.cvt16()); + break; + case memory::data_type::s8: + case memory::data_type::u8: + mov(reg_tmp_64.cvt8(), table_idx); + mov(ptr[rsp + i * sizeof(char)], reg_tmp_64.cvt8()); + break; + default: + assert(!"unknown src_dt"); + } + } + + switch (src_dt) { + case memory::data_type::f32: + case memory::data_type::s32: + uni_vmovups(vmm_val, ptr[rsp]); + break; + case memory::data_type::bf16: + uni_vpmovzxwd(vmm_val, ptr[rsp]); + uni_vpslld(vmm_val, vmm_val, 16); + break; + case memory::data_type::s8: + uni_vpmovsxbd(vmm_val, ptr[rsp]); + break; + case memory::data_type::u8: + uni_vpmovzxbd(vmm_val, ptr[rsp]); + break; + default: + assert(!"unknown src_dt"); + } + add(rsp, vlen); + } + + inline void reduce_kernel_tail() { + Xbyak::Label reduce_label; + Xbyak::Label reduce_end_label; + Xbyak::Label reduce_batch_label; + Xbyak::Label reduce_batch_end_label; + + int step = 1; + cmp(reg_work_batch, 1); + je(reduce_label, T_NEAR); + + init_reg_reduce_stride(); + + L(reduce_batch_label); + { + cmp(reg_work_amount, step); + jl(reduce_end_label, T_NEAR); + + // load + load_scalar(xmm_dst, ptr[reg_dst], jcp_.dst_dt); + + // reduce + reduce_batch_tail(); + + // store + store_scalar(ptr[reg_dst], xmm_dst, jcp_.dst_dt); + + add(reg_dst, step * jcp_.dst_data_size); + add(reg_src, step * jcp_.src_data_size); + sub(reg_work_amount, step); + + jmp(reduce_batch_label, T_NEAR); + } + L(reduce_batch_end_label); + + L(reduce_label); + { + cmp(reg_work_amount, step); + jl(reduce_end_label, T_NEAR); + + // load + load_scalar(xmm_dst, ptr[reg_dst], jcp_.dst_dt); + + // reduce + reduce_batch_tail(); + + // store + store_scalar(ptr[reg_dst], xmm_dst, jcp_.dst_dt); + + add(reg_dst, step * jcp_.dst_data_size); + add(reg_src, step * jcp_.src_data_size); + sub(reg_work_amount, step); + + jmp(reduce_label, T_NEAR); + } + L(reduce_end_label); + } + + inline void reduce_once_tail() { + load_scalar(xmm_src, ptr[reg_src], jcp_.src_dt); + reduce_kernel_scalar(xmm_src, xmm_dst); + if (jcp_.reduce_mode == ReduceOr) { + uni_cmpneqps(xmm_dst, xmm_dst, xmm_zero); + uni_vandps(xmm_dst, xmm_dst, xmm_aux); + } + } + + inline void reduce_batch_tail() { + mov(reg_src_aux, reg_src); + mov(reg_work_batch_aux, reg_work_batch); + + Xbyak::Label reduce_batch_loop_label; + Xbyak::Label reduce_batch_loop_end_label; + L(reduce_batch_loop_label); + { + cmp(reg_work_batch_aux, 1); + jl(reduce_batch_loop_end_label, T_NEAR); + + load_scalar(xmm_src, ptr[reg_src_aux], jcp_.src_dt); + reduce_kernel_scalar(xmm_src, xmm_dst); + if (jcp_.reduce_mode == ReduceOr) { + uni_cmpneqps(xmm_dst, xmm_dst, xmm_zero); + uni_vandps(xmm_dst, xmm_dst, xmm_aux); + } + + add(reg_src_aux, reg_reduce_stride); + sub(reg_work_batch_aux, 1); + jmp(reduce_batch_loop_label, T_NEAR); + } + L(reduce_batch_loop_end_label); + } + inline void reduce_main_loop() { Xbyak::Label reduce_loop_label; Xbyak::Label reduce_loop_end_label; @@ -463,10 +707,8 @@ private: if (isa == cpu::x64::avx512_common) { vcmpps(k_mask, vmm_src, vmm_zero, _cmp_neq_uq); vblendmps(vmm_src | k_mask, vmm_zero, vmm_aux); - } else if (isa == cpu::x64::avx2) { - vcmpneqps(vmm_src, vmm_src, vmm_zero); } else { - cmpneqps(vmm_src, vmm_zero); + uni_cmpneqps(vmm_src, vmm_src, vmm_zero); } uni_vandps(vmm_dst, vmm_dst, vmm_src); break; @@ -512,11 +754,7 @@ private: inline void reduce_kernel_scalar(Xmm xmm_src, Xmm xmm_dst) { switch (jcp_.reduce_mode) { case ReduceAnd: - if (isa == cpu::x64::sse41) { - cmpneqps(xmm_src, xmm_zero); - } else { - vcmpneqps(xmm_src, xmm_src, xmm_zero); - } + uni_cmpneqps(xmm_src, xmm_src, xmm_zero); uni_vandps(xmm_dst, xmm_dst, xmm_src); break; case ReduceL1: @@ -562,15 +800,11 @@ private: inline void store_dst_vector() { if (jcp_.reduce_mode == ReduceOr && isa != cpu::x64::avx512_common) { - if (isa == cpu::x64::avx2) { - vcmpneqps(vmm_dst, vmm_dst, vmm_zero); - } else if (isa == cpu::x64::sse41) { - cmpneqps(vmm_dst, vmm_zero); - } + uni_cmpneqps(vmm_dst, vmm_dst, vmm_zero); uni_vandps(vmm_dst, vmm_dst, vmm_aux); if (isa == cpu::x64::sse41) { - cmpneqps(vmm_dst_aux, vmm_zero); + uni_cmpneqps(vmm_dst_aux, vmm_dst_aux, vmm_zero); uni_vandps(vmm_dst_aux, vmm_dst_aux, vmm_aux); } } @@ -607,19 +841,19 @@ private: switch (src_dt) { case memory::data_type::f32: case memory::data_type::s32: - movss(xmm_src, op); + uni_vmovss(xmm_src, op); break; case memory::data_type::bf16: - pinsrw(xmm_src, op, 0x0); + uni_vpinsrw(xmm_src, xmm_src, op, 0x0); uni_vpslld(xmm_src, xmm_src, 16); break; case memory::data_type::s8: movsx(reg_tmp_32, op); - movq(xmm_src, reg_tmp_64); + uni_vmovq(xmm_src, reg_tmp_64); break; case memory::data_type::u8: movzx(reg_tmp_32, op); - movq(xmm_src, reg_tmp_64); + uni_vmovq(xmm_src, reg_tmp_64); break; default: assert(!"unknown src_dt"); @@ -662,7 +896,7 @@ private: if (isa != cpu::x64::sse41) vmovq(op, xmm_dst); else - movd(op, xmm_dst); + uni_vmovd(op, xmm_dst); } break; case memory::data_type::u8: @@ -676,7 +910,7 @@ private: if (isa != cpu::x64::sse41) vmovq(op, xmm_dst); else - movd(op, xmm_dst); + uni_vmovd(op, xmm_dst); } break; default: @@ -692,22 +926,22 @@ private: switch (dst_dt) { case memory::data_type::f32: case memory::data_type::s32: - movss(op, xmm_dst); + uni_vmovss(op, xmm_dst); break; case memory::data_type::bf16: uni_vpsrld(xmm_dst, xmm_dst, 16); - pextrw(op, xmm_dst, 0x0); + uni_vpextrw(op, xmm_dst, 0x0); break; case memory::data_type::s8: uni_vpackssdw(xmm_dst, xmm_dst, xmm_dst); uni_vpacksswb(xmm_dst, xmm_dst, xmm_dst); - movq(reg_tmp_64, xmm_dst); + uni_vmovq(reg_tmp_64, xmm_dst); mov(op, reg_tmp_8); break; case memory::data_type::u8: uni_vpackusdw(xmm_dst, xmm_dst, xmm_dst); uni_vpackuswb(xmm_dst, xmm_dst, xmm_dst); - movq(reg_tmp_64, xmm_dst); + uni_vmovq(reg_tmp_64, xmm_dst); mov(op, reg_tmp_8); break; default: @@ -715,15 +949,15 @@ private: } } - inline void load_embedded_horiz_reduce_store(Vmm vmm_dst, memory::data_type dst_dt) { + inline void horiz_reduce_store(Vmm vmm_dst, memory::data_type dst_dt, bool load_embedded = false) { if (isa == cpu::x64::sse41) { - load_embedded_horiz_store(vmm_dst, dst_dt); + horiz_store(vmm_dst, dst_dt, load_embedded); } else if (isa == cpu::x64::avx2) { Xbyak::Ymm ymm_dst = Xbyak::Ymm(vmm_dst.getIdx()); vextractf128(xmm_aux1, ymm_dst, 0); vextractf128(xmm_aux2, ymm_dst, 1); horiz_ps(xmm_aux1, xmm_aux2); - load_embedded_horiz_store(xmm_aux1, dst_dt); + horiz_store(xmm_aux1, dst_dt, load_embedded); } else { Xbyak::Zmm zmm_dst = Xbyak::Zmm(vmm_dst.getIdx()); vextractf32x4(xmm_aux1, zmm_dst, 0); @@ -733,51 +967,26 @@ private: vextractf32x4(xmm_aux3, zmm_dst, 3); horiz_ps(xmm_aux2, xmm_aux3); horiz_ps(xmm_aux1, xmm_aux2); - load_embedded_horiz_store(xmm_aux1, dst_dt); + horiz_store(xmm_aux1, dst_dt, load_embedded); } } - inline void load_embedded_horiz_store(Xbyak::Xmm xmm_dst, memory::data_type dst_dt) { - movshdup(xmm_aux3, xmm_dst); // dst:1,2,3,4; aux3:2,2,4,4 - horiz_ps(xmm_dst, xmm_aux3); // dst:f(1,2),f(2,2),f(3,4),f(4,4) - movhlps(xmm_aux3, xmm_dst); // aux3:f(3,4),f(4,4),4,4 - horiz_ps(xmm_dst, xmm_aux3); // dst:f(1,2,3,4),... - load_scalar(xmm_aux3, ptr[reg_dst], dst_dt); - - switch (dst_dt) { - case memory::data_type::f32: - case memory::data_type::bf16: - horiz_ps(xmm_dst, xmm_aux3); - store_scalar(ptr[reg_dst], xmm_dst, dst_dt); - break; - case memory::data_type::s32: - horiz_ps(xmm_dst, xmm_aux3); - uni_vcvtps2dq(xmm_dst, xmm_dst); - movss(ptr[reg_dst], xmm_dst); - break; - case memory::data_type::u8: - horiz_ps(xmm_dst, xmm_aux3); - uni_vcvtps2dq(xmm_dst, xmm_dst); - uni_vpackusdw(xmm_dst, xmm_dst, xmm_dst); - uni_vpackuswb(xmm_dst, xmm_dst, xmm_dst); - pextrb(ptr[reg_dst], xmm_dst, 0); - break; - case memory::data_type::s8: - horiz_ps(xmm_dst, xmm_aux3); - uni_vcvtps2dq(xmm_dst, xmm_dst); - uni_vpackssdw(xmm_dst, xmm_dst, xmm_dst); - uni_vpacksswb(xmm_dst, xmm_dst, xmm_dst); - pextrb(ptr[reg_dst], xmm_dst, 0); - break; - default: - assert(!"unknown dst_dt"); + inline void horiz_store(Xbyak::Xmm xmm_dst, memory::data_type dst_dt, bool load_embedded) { + uni_movshdup(xmm_aux3, xmm_dst); // dst:1,2,3,4; aux3:2,2,4,4 + horiz_ps(xmm_dst, xmm_aux3); // dst:f(1,2),f(2,2),f(3,4),f(4,4) + uni_movhlps(xmm_aux3, xmm_dst); // aux3:f(3,4),f(4,4),4,4 + horiz_ps(xmm_dst, xmm_aux3); // dst:f(1,2,3,4),... + if (load_embedded) { + load_scalar(xmm_aux3, ptr[reg_dst], dst_dt); + horiz_ps(xmm_dst, xmm_aux3); } + store_scalar(ptr[reg_dst], xmm_dst, dst_dt); } inline void horiz_ps(const Xmm& xmm, const Operand& op) { switch (jcp_.reduce_mode) { case ReduceAnd: - andps(xmm, op); + uni_vandps(xmm, xmm, op); break; case ReduceL1: case ReduceL2: @@ -786,19 +995,19 @@ private: case ReduceSum: case ReduceSumSquare: case ReduceLogSumExp: - addps(xmm, op); + uni_vaddps(xmm, xmm, op); break; case ReduceMax: - maxps(xmm, op); + uni_vmaxps(xmm, xmm, op); break; case ReduceMin: - minps(xmm, op); + uni_vminps(xmm, xmm, op); break; case ReduceOr: - orps(xmm, op); + uni_vorps(xmm, xmm, op); break; case ReduceProd: - mulps(xmm, op); + uni_vmulps(xmm, xmm, op); break; default: assert(!"unsupported reduce mode"); @@ -837,8 +1046,8 @@ template struct jit_uni_reduce_post_kernel_f32 : public jit_uni_reduce_post_kernel, public jit_generator { DECLARE_CPU_JIT_AUX_FUNCTIONS(jit_uni_reduce_post_kernel_f32) - explicit jit_uni_reduce_post_kernel_f32(jit_reduce_config_params jcp) - : jit_uni_reduce_post_kernel(jcp), jit_generator() {} + explicit jit_uni_reduce_post_kernel_f32(jit_reduce_config_params jcp, const mkldnn_primitive_attr &attr) + : jit_uni_reduce_post_kernel(jcp, attr), jit_generator() {} void create_ker() override { jit_generator::create_kernel(); @@ -846,25 +1055,69 @@ struct jit_uni_reduce_post_kernel_f32 : public jit_uni_reduce_post_kernel, publi } void generate() override { - log_injector.reset(new jit_uni_eltwise_injector_f32(this, alg_kind::eltwise_log, 0.f, 0.f, 1.f)); + const auto &p = attr_.post_ops_; + for (int i = 0; i < p.len(); i++) { + auto &post_op = p.entry_[i]; + if (post_op.is_eltwise()) { + eltwise_injectors.push_back(std::make_shared>( + this, post_op.eltwise.alg, post_op.eltwise.alpha, post_op.eltwise.beta, post_op.eltwise.scale)); + } else if (post_op.is_depthwise()) { + depthwise_injectors.push_back(std::make_shared>( + this, post_op.depthwise.alg)); + } else if (post_op.is_quantization()) { + quantization_injectors.push_back(std::make_shared>( + this, post_op, vmm_d_weights, vmm_d_bias, reg_d_weights, reg_d_bias)); + } + } + + if (jcp_.reduce_mode == ReduceLogSum || jcp_.reduce_mode == ReduceLogSumExp) { + log_injector = std::make_shared>(this, alg_kind::eltwise_log, 0.f, 0.f, 1.f); + } if (!mayiuse(avx512_core_bf16) && mayiuse(avx512_core)) - emu_vcvtneps2bf16.reset(new jit_emu_vcvtneps2bf16(this, isa, nullptr)); + emu_vcvtneps2bf16 = std::make_shared(this, isa, nullptr); this->preamble(); - mov(reg_dst, ptr[reg_params + GET_OFF(dst)]); - mov(reg_work_amount, ptr[reg_params + GET_OFF(work_amount)]); - mov(reg_divisor, ptr[reg_params + GET_OFF(divisor)]); - if (!jcp_.planar_layout) - mov(reg_reduce_c, ptr[reg_params + GET_OFF(reduce_c)]); + planar_layout = jcp_.layout == ReduceLayoutType::reduce_ncsp || jcp_.layout == ReduceLayoutType::reduce_nspc; + + mov(reg_dst, ptr[reg_params + GET_OFF_POST(dst)]); + mov(reg_work_amount, ptr[reg_params + GET_OFF_POST(work_amount)]); + mov(reg_channel_size, ptr[reg_params + GET_OFF_POST(channel_size)]); + mov(reg_divisor, ptr[reg_params + GET_OFF_POST(divisor)]); + if (!planar_layout) + mov(reg_reduce_c, ptr[reg_params + GET_OFF_POST(reduce_c)]); + if (attr_.post_ops_.len() != 0) + mov(reg_oc_off, ptr[reg_params + GET_OFF_POST(oc_off)]); if (isa == cpu::x64::avx512_common) uni_vpxor(vmm_zero, vmm_zero, vmm_zero); - reduce_post_main(); - if (jcp_.planar_layout) + if (jcp_.layout == ReduceLayoutType::reduce_blocked) { + reduce_post_main(); + } else if (jcp_.layout == ReduceLayoutType::reduce_nspc && attr_.post_ops_.len() != 0) { + // the tail of channel dimension should always be concerned during post ops fusing for nspc layout + Xbyak::Label reduce_nspc_loop_label; + Xbyak::Label reduce_nspc_loop_end_label; + mov(reg_total_work_amount, reg_work_amount); + L(reduce_nspc_loop_label); + { + cmp(reg_total_work_amount, 0); + jle(reduce_nspc_loop_end_label, T_NEAR); + + mov(reg_oc_off, 0); + mov(reg_work_amount, reg_channel_size); + reduce_post_main(); + reduce_post_tail(); + + sub(reg_total_work_amount, reg_channel_size); + jmp(reduce_nspc_loop_label, T_NEAR); + } + L(reduce_nspc_loop_end_label); + } else { + reduce_post_main(); reduce_post_tail(); + } this->postamble(); @@ -874,22 +1127,32 @@ struct jit_uni_reduce_post_kernel_f32 : public jit_uni_reduce_post_kernel, publi if (jcp_.reduce_mode == ReduceLogSum || jcp_.reduce_mode == ReduceLogSumExp) { log_injector->prepare_table(); } + + for (auto& inj : eltwise_injectors) + inj->prepare_table(); } private: using Vmm = typename conditional3::type; size_t vlen = cpu_isa_traits::vlen; + bool planar_layout; Xbyak::Reg64 reg_dst = r8; Xbyak::Reg64 reg_work_amount = r9; - Xbyak::Reg64 reg_divisor = r10; - Xbyak::Reg64 reg_reduce_c = r11; + Xbyak::Reg64 reg_total_work_amount = r10; + Xbyak::Reg64 reg_channel_size = r11; + Xbyak::Reg64 reg_divisor = r12; + Xbyak::Reg64 reg_reduce_c = r13; Xbyak::Reg64 reg_params = abi_param1; - Xbyak::Reg8 reg_tmp_8 = r12b; - Xbyak::Reg32 reg_tmp_32 = r12d; - Xbyak::Reg64 reg_tmp_64 = r12; + Xbyak::Reg8 reg_tmp_8 = r14b; + Xbyak::Reg32 reg_tmp_32 = r14d; + Xbyak::Reg64 reg_tmp_64 = r14; + + Xbyak::Reg64 reg_oc_off = rax; + Xbyak::Reg64 reg_d_weights = rbx; + Xbyak::Reg64 reg_d_bias = rdx; Vmm vmm_aux = Vmm(0); Xmm xmm_aux = Xmm(0); @@ -901,14 +1164,20 @@ private: Xbyak::Xmm xmm_aux2 = Xbyak::Xmm(5); Xbyak::Xmm xmm_aux3 = Xbyak::Xmm(6); - std::unique_ptr emu_vcvtneps2bf16; + Vmm vmm_d_weights = Vmm(7); + Vmm vmm_d_bias = Vmm(8); + std::shared_ptr emu_vcvtneps2bf16; std::shared_ptr> log_injector; + std::vector>> eltwise_injectors; + std::vector>> depthwise_injectors; + std::vector>> quantization_injectors; + inline void reduce_post_main() { Xbyak::Label reduce_channel_label; Xbyak::Label reduce_map_label; - if (jcp_.planar_layout) { + if (planar_layout) { jmp(reduce_map_label, T_NEAR); } else { cmp(reg_reduce_c, 1); @@ -937,7 +1206,7 @@ private: // reduce and store horiz_reduce_store(vmm_dst, jcp_.dst_dt); if (isa == cpu::x64::sse41) - load_embedded_horiz_reduce_store(vmm_dst_aux, jcp_.dst_dt); + horiz_reduce_store(vmm_dst_aux, jcp_.dst_dt, true); add(reg_dst, step * jcp_.dst_data_size); sub(reg_work_amount, step); @@ -946,8 +1215,8 @@ private: } L(reduce_loop_end_label); - mov(reg_dst, ptr[reg_params + GET_OFF(dst)]); - mov(reg_work_amount, ptr[reg_params + GET_OFF(work_amount)]); + mov(reg_dst, ptr[reg_params + GET_OFF_POST(dst)]); + mov(reg_work_amount, ptr[reg_params + GET_OFF_POST(work_amount)]); } // reduce map for value in dst memory @@ -968,27 +1237,67 @@ private: cmp(reg_work_amount, step); jl(reduce_loop_end_label, T_NEAR); - // load load_vector(vmm_dst, ptr[reg_dst], jcp_.dst_dt); - if (isa == cpu::x64::sse41) - load_vector(vmm_dst_aux, ptr[reg_dst + 4 * jcp_.dst_data_size], jcp_.dst_dt); - - // reduce reduce_map_kernel(vmm_dst); - if (isa == cpu::x64::sse41) - reduce_map_kernel(vmm_dst_aux); - - // store + if (attr_.post_ops_.len() != 0) + apply_post_ops(jcp_.dst_dt, jcp_.layout == ReduceLayoutType::reduce_ncsp); store_vector(ptr[reg_dst], vmm_dst, jcp_.dst_dt); - if (isa == cpu::x64::sse41) - store_vector(ptr[reg_dst + 4 * jcp_.dst_data_size], vmm_dst_aux, jcp_.dst_dt); + + if (isa == cpu::x64::sse41) { + load_vector(vmm_dst, ptr[reg_dst + 4 * jcp_.dst_data_size], jcp_.dst_dt); + reduce_map_kernel(vmm_dst); + if (attr_.post_ops_.len() != 0) { + if (jcp_.layout != ReduceLayoutType::reduce_ncsp) + add(reg_oc_off, 4 * sizeof(float)); + apply_post_ops(jcp_.dst_dt, jcp_.layout == ReduceLayoutType::reduce_ncsp); + if (jcp_.layout != ReduceLayoutType::reduce_ncsp) + sub(reg_oc_off, 4 * sizeof(float)); + } + store_vector(ptr[reg_dst + 4 * jcp_.dst_data_size], vmm_dst, jcp_.dst_dt); + } add(reg_dst, step * jcp_.dst_data_size); + if (jcp_.layout == ReduceLayoutType::reduce_nspc && attr_.post_ops_.len() != 0) + add(reg_oc_off, step * sizeof(float)); sub(reg_work_amount, step); jmp(reduce_loop_label, T_NEAR); } L(reduce_loop_end_label); + } else { + if (attr_.post_ops_.len() != 0) { + Xbyak::Label reduce_loop_label; + Xbyak::Label reduce_loop_end_label; + + int step = vlen / sizeof(float) < 8 ? 8 : vlen / sizeof(float); + L(reduce_loop_label); + { + cmp(reg_work_amount, step); + jl(reduce_loop_end_label, T_NEAR); + + load_vector(vmm_dst, ptr[reg_dst], jcp_.dst_dt); + apply_post_ops(jcp_.dst_dt, jcp_.layout == ReduceLayoutType::reduce_ncsp); + store_vector(ptr[reg_dst], vmm_dst, jcp_.dst_dt); + + if (isa == cpu::x64::sse41) { + load_vector(vmm_dst, ptr[reg_dst + 4 * jcp_.dst_data_size], jcp_.dst_dt); + if (jcp_.layout != ReduceLayoutType::reduce_ncsp) + add(reg_oc_off, 4 * sizeof(float)); + apply_post_ops(jcp_.dst_dt, jcp_.layout == ReduceLayoutType::reduce_ncsp); + if (jcp_.layout != ReduceLayoutType::reduce_ncsp) + sub(reg_oc_off, 4 * sizeof(float)); + store_vector(ptr[reg_dst + 4 * jcp_.dst_data_size], vmm_dst, jcp_.dst_dt); + } + + add(reg_dst, step * jcp_.dst_data_size); + if (jcp_.layout == ReduceLayoutType::reduce_nspc && attr_.post_ops_.len() != 0) + add(reg_oc_off, step * sizeof(float)); + sub(reg_work_amount, step); + + jmp(reduce_loop_label, T_NEAR); + } + L(reduce_loop_end_label); + } } } } @@ -1017,14 +1326,84 @@ private: reduce_map_kernel_scalar(xmm_dst); // store + if (attr_.post_ops_.len() != 0) + apply_post_ops(jcp_.dst_dt, jcp_.layout == ReduceLayoutType::reduce_ncsp); store_scalar(ptr[reg_dst], xmm_dst, jcp_.dst_dt); add(reg_dst, step * jcp_.dst_data_size); + if (jcp_.layout == ReduceLayoutType::reduce_nspc && attr_.post_ops_.len() != 0) + add(reg_oc_off, step * sizeof(float)); sub(reg_work_amount, step); jmp(reduce_loop_label, T_NEAR); } L(reduce_loop_end_label); + } else { + if (attr_.post_ops_.len() != 0) { + Xbyak::Label reduce_loop_label; + Xbyak::Label reduce_loop_end_label; + + int step = 1; + L(reduce_loop_label); + { + cmp(reg_work_amount, step); + jl(reduce_loop_end_label, T_NEAR); + + // load + load_scalar(xmm_dst, ptr[reg_dst], jcp_.dst_dt); + + // store + apply_post_ops(jcp_.dst_dt, jcp_.layout == ReduceLayoutType::reduce_ncsp); + store_scalar(ptr[reg_dst], xmm_dst, jcp_.dst_dt); + + add(reg_dst, step * jcp_.dst_data_size); + if (jcp_.layout == ReduceLayoutType::reduce_nspc && attr_.post_ops_.len() != 0) + add(reg_oc_off, step * sizeof(float)); + sub(reg_work_amount, step); + + jmp(reduce_loop_label, T_NEAR); + } + L(reduce_loop_end_label); + } + } + } + + void apply_post_ops(memory::data_type dst_dt, bool is_broadcast) { + const auto &p = attr_.post_ops_; + int eltwise_inj_idx = 0; + int depthwise_inj_idx = 0; + int quantization_inj_idx = 0; + for (int i = 0; i < p.len(); i++) { + auto& post_op = p.entry_[i]; + if (post_op.is_eltwise()) { + eltwise_injectors[eltwise_inj_idx]->compute_vector_range(vmm_dst.getIdx(), vmm_dst.getIdx() + 1); + eltwise_inj_idx++; + } else if (post_op.is_depthwise()) { + mov(reg_d_weights, reinterpret_cast(post_op.depthwise.weights_data)); + mov(reg_d_bias, reinterpret_cast(post_op.depthwise.biases_data)); + add(reg_d_weights, reg_oc_off); + add(reg_d_bias, reg_oc_off); + depthwise_injectors[depthwise_inj_idx]->compute_vector_range(vmm_dst.getIdx(), vmm_dst.getIdx() + 1, reg_d_weights, reg_d_bias, is_broadcast); + depthwise_inj_idx++; + } else if (post_op.is_quantization()) { + bool do_dequantization = post_op.quantization.alg == alg_kind::quantization_quantize_dequantize; + bool do_rounding = do_dequantization || isFloatCompatible(dst_dt) || i != p.len() - 1; + + int s_idx = vmm_dst.getIdx(); + + quantization_injectors[quantization_inj_idx]->init_crop_ptrs(reg_oc_off); + quantization_injectors[quantization_inj_idx]->compute_crop(s_idx, s_idx + 1, 0, 0, is_broadcast); + + quantization_injectors[quantization_inj_idx]->init_input_scale_shift_ptrs(reg_oc_off); + quantization_injectors[quantization_inj_idx]->compute_input_scale_shift(s_idx, s_idx + 1, 0, do_rounding, 0, is_broadcast); + + if (do_dequantization) { + quantization_injectors[quantization_inj_idx]->init_output_scale_shift_ptrs(reg_oc_off); + quantization_injectors[quantization_inj_idx]->compute_output_scale_shift(s_idx, s_idx + 1, 0, 0, is_broadcast); + } + + quantization_inj_idx++; + } } } @@ -1074,19 +1453,19 @@ private: switch (src_dt) { case memory::data_type::f32: case memory::data_type::s32: - movss(xmm_src, op); + uni_vmovss(xmm_src, op); break; case memory::data_type::bf16: - pinsrw(xmm_src, op, 0x0); + uni_vpinsrw(xmm_src, xmm_src, op, 0x0); uni_vpslld(xmm_src, xmm_src, 16); break; case memory::data_type::s8: movsx(reg_tmp_32, op); - movq(xmm_src, reg_tmp_64); + uni_vmovq(xmm_src, reg_tmp_64); break; case memory::data_type::u8: movzx(reg_tmp_32, op); - movq(xmm_src, reg_tmp_64); + uni_vmovq(xmm_src, reg_tmp_64); break; default: assert(!"unknown src_dt"); @@ -1129,7 +1508,7 @@ private: if (isa != cpu::x64::sse41) vmovq(op, xmm_dst); else - movd(op, xmm_dst); + uni_vmovd(op, xmm_dst); } break; case memory::data_type::u8: @@ -1143,7 +1522,7 @@ private: if (isa != cpu::x64::sse41) vmovq(op, xmm_dst); else - movd(op, xmm_dst); + uni_vmovd(op, xmm_dst); } break; default: @@ -1159,22 +1538,22 @@ private: switch (dst_dt) { case memory::data_type::f32: case memory::data_type::s32: - movss(op, xmm_dst); + uni_vmovss(op, xmm_dst); break; case memory::data_type::bf16: uni_vpsrld(xmm_dst, xmm_dst, 16); - pextrw(op, xmm_dst, 0x0); + uni_vpextrw(op, xmm_dst, 0x0); break; case memory::data_type::s8: uni_vpackssdw(xmm_dst, xmm_dst, xmm_dst); uni_vpacksswb(xmm_dst, xmm_dst, xmm_dst); - movq(reg_tmp_64, xmm_dst); + uni_vmovq(reg_tmp_64, xmm_dst); mov(op, reg_tmp_8); break; case memory::data_type::u8: uni_vpackusdw(xmm_dst, xmm_dst, xmm_dst); uni_vpackuswb(xmm_dst, xmm_dst, xmm_dst); - movq(reg_tmp_64, xmm_dst); + uni_vmovq(reg_tmp_64, xmm_dst); mov(op, reg_tmp_8); break; default: @@ -1182,15 +1561,15 @@ private: } } - inline void horiz_reduce_store(Vmm vmm_dst, memory::data_type dst_dt) { + inline void horiz_reduce_store(Vmm vmm_dst, memory::data_type dst_dt, bool load_embedded = false) { if (isa == cpu::x64::sse41) { - horize_store(vmm_dst, dst_dt); + horiz_store(vmm_dst, dst_dt, load_embedded); } else if (isa == cpu::x64::avx2) { Xbyak::Ymm ymm_dst = Xbyak::Ymm(vmm_dst.getIdx()); vextractf128(xmm_aux1, ymm_dst, 0); vextractf128(xmm_aux2, ymm_dst, 1); horiz_ps(xmm_aux1, xmm_aux2); - horize_store(xmm_aux1, dst_dt); + horiz_store(xmm_aux1, dst_dt, load_embedded); } else { Xbyak::Zmm zmm_dst = Xbyak::Zmm(vmm_dst.getIdx()); vextractf32x4(xmm_aux1, zmm_dst, 0); @@ -1200,107 +1579,26 @@ private: vextractf32x4(xmm_aux3, zmm_dst, 3); horiz_ps(xmm_aux2, xmm_aux3); horiz_ps(xmm_aux1, xmm_aux2); - horize_store(xmm_aux1, dst_dt); + horiz_store(xmm_aux1, dst_dt, load_embedded); } } - inline void horize_store(Xbyak::Xmm xmm_dst, memory::data_type dst_dt) { - movshdup(xmm_aux3, xmm_dst); // dst:1,2,3,4; aux3:2,2,4,4 - horiz_ps(xmm_dst, xmm_aux3); // dst:f(1,2),f(2,2),f(3,4),f(4,4) - movhlps(xmm_aux3, xmm_dst); // aux3:f(3,4),f(4,4),4,4 - horiz_ps(xmm_dst, xmm_aux3); // dst:f(1,2,3,4),... - switch (dst_dt) { - case memory::data_type::f32: - movss(ptr[reg_dst], xmm_dst); - break; - case memory::data_type::bf16: - uni_vpsrld(xmm_dst, xmm_dst, 16); - pextrw(ptr[reg_dst], xmm_dst, 0x0); - break; - case memory::data_type::s32: - uni_vcvtps2dq(xmm_dst, xmm_dst); - movss(ptr[reg_dst], xmm_dst); - break; - case memory::data_type::u8: - uni_vcvtps2dq(xmm_dst, xmm_dst); - uni_vpackusdw(xmm_dst, xmm_dst, xmm_dst); - uni_vpackuswb(xmm_dst, xmm_dst, xmm_dst); - pextrb(ptr[reg_dst], xmm_dst, 0); - break; - case memory::data_type::s8: - uni_vcvtps2dq(xmm_dst, xmm_dst); - uni_vpackssdw(xmm_dst, xmm_dst, xmm_dst); - uni_vpacksswb(xmm_dst, xmm_dst, xmm_dst); - pextrb(ptr[reg_dst], xmm_dst, 0); - break; - default: - assert(!"unknown dst_dt"); - } - } - - inline void load_embedded_horiz_reduce_store(Vmm vmm_dst, memory::data_type dst_dt) { - if (isa == cpu::x64::sse41) { - load_embedded_horiz_store(vmm_dst, dst_dt); - } else if (isa == cpu::x64::avx2) { - Xbyak::Ymm ymm_dst = Xbyak::Ymm(vmm_dst.getIdx()); - vextractf128(xmm_aux1, ymm_dst, 0); - vextractf128(xmm_aux2, ymm_dst, 1); - horiz_ps(xmm_aux1, xmm_aux2); - load_embedded_horiz_store(xmm_aux1, dst_dt); - } else { - Xbyak::Zmm zmm_dst = Xbyak::Zmm(vmm_dst.getIdx()); - vextractf32x4(xmm_aux1, zmm_dst, 0); - vextractf32x4(xmm_aux2, zmm_dst, 1); - horiz_ps(xmm_aux1, xmm_aux2); - vextractf32x4(xmm_aux2, zmm_dst, 2); - vextractf32x4(xmm_aux3, zmm_dst, 3); - horiz_ps(xmm_aux2, xmm_aux3); - horiz_ps(xmm_aux1, xmm_aux2); - load_embedded_horiz_store(xmm_aux1, dst_dt); - } - } - - inline void load_embedded_horiz_store(Xbyak::Xmm xmm_dst, memory::data_type dst_dt) { - movshdup(xmm_aux3, xmm_dst); // dst:1,2,3,4; aux3:2,2,4,4 - horiz_ps(xmm_dst, xmm_aux3); // dst:f(1,2),f(2,2),f(3,4),f(4,4) - movhlps(xmm_aux3, xmm_dst); // aux3:f(3,4),f(4,4),4,4 - horiz_ps(xmm_dst, xmm_aux3); // dst:f(1,2,3,4),... - load_scalar(xmm_aux3, ptr[reg_dst], dst_dt); - - switch (dst_dt) { - case memory::data_type::f32: - case memory::data_type::bf16: - horiz_ps(xmm_dst, xmm_aux3); - store_scalar(ptr[reg_dst], xmm_dst, dst_dt); - break; - case memory::data_type::s32: - horiz_ps(xmm_dst, xmm_aux3); - uni_vcvtps2dq(xmm_dst, xmm_dst); - movss(ptr[reg_dst], xmm_dst); - break; - case memory::data_type::u8: - horiz_ps(xmm_dst, xmm_aux3); - uni_vcvtps2dq(xmm_dst, xmm_dst); - uni_vpackusdw(xmm_dst, xmm_dst, xmm_dst); - uni_vpackuswb(xmm_dst, xmm_dst, xmm_dst); - pextrb(ptr[reg_dst], xmm_dst, 0); - break; - case memory::data_type::s8: - horiz_ps(xmm_dst, xmm_aux3); - uni_vcvtps2dq(xmm_dst, xmm_dst); - uni_vpackssdw(xmm_dst, xmm_dst, xmm_dst); - uni_vpacksswb(xmm_dst, xmm_dst, xmm_dst); - pextrb(ptr[reg_dst], xmm_dst, 0); - break; - default: - assert(!"unknown dst_dt"); + inline void horiz_store(Xbyak::Xmm xmm_dst, memory::data_type dst_dt, bool load_embedded) { + uni_movshdup(xmm_aux3, xmm_dst); // dst:1,2,3,4; aux3:2,2,4,4 + horiz_ps(xmm_dst, xmm_aux3); // dst:f(1,2),f(2,2),f(3,4),f(4,4) + uni_movhlps(xmm_aux3, xmm_dst); // aux3:f(3,4),f(4,4),4,4 + horiz_ps(xmm_dst, xmm_aux3); // dst:f(1,2,3,4),... + if (load_embedded) { + load_scalar(xmm_aux3, ptr[reg_dst], dst_dt); + horiz_ps(xmm_dst, xmm_aux3); } + store_scalar(ptr[reg_dst], xmm_dst, dst_dt); } inline void horiz_ps(const Xmm& xmm, const Operand& op) { switch (jcp_.reduce_mode) { case ReduceAnd: - andps(xmm, op); + uni_vandps(xmm, xmm, op); break; case ReduceL1: case ReduceL2: @@ -1309,19 +1607,19 @@ private: case ReduceSum: case ReduceSumSquare: case ReduceLogSumExp: - addps(xmm, op); + uni_vaddps(xmm, xmm, op); break; case ReduceMax: - maxps(xmm, op); + uni_vmaxps(xmm, xmm, op); break; case ReduceMin: - minps(xmm, op); + uni_vminps(xmm, xmm, op); break; case ReduceOr: - orps(xmm, op); + uni_vorps(xmm, xmm, op); break; case ReduceProd: - mulps(xmm, op); + uni_vmulps(xmm, xmm, op); break; default: assert(!"unsupported reduce mode"); @@ -1361,15 +1659,25 @@ const std::map& op, std::string& errorMessage) noexcept { try { - if (isDynamicNgraphNode(op)) { - errorMessage = "Doesn't support op with dynamic shapes"; - return false; - } if (std::dynamic_pointer_cast(op) == nullptr && std::dynamic_pointer_cast(op) == nullptr) { errorMessage = "Reduce node with name " + op->get_friendly_name() + " is not derived from ArithmeticReductionKeepDims or LogicalReductionKeepDims"; return false; } + if (const auto reduce = std::dynamic_pointer_cast(op)) { + auto reduceConst = std::dynamic_pointer_cast(reduce->get_input_node_shared_ptr(REDUCE_INDEXES)); + if (!reduceConst) { + errorMessage = "Second tensor is not constant"; + return false; + } + } + if (const auto reduce = std::dynamic_pointer_cast(op)) { + auto reduceConst = std::dynamic_pointer_cast(reduce->get_input_node_shared_ptr(REDUCE_INDEXES)); + if (!reduceConst) { + errorMessage = "Second tensor is not constant"; + return false; + } + } if (initializers.find(op->get_type_info()) == initializers.end()) { errorMessage = "Doesn't support Reduce algorithm: " + std::string(op->get_type_info().name); return false; @@ -1392,9 +1700,18 @@ MKLDNNReduceNode::MKLDNNReduceNode(const std::shared_ptr& op, cons initializers.at(op->get_type_info())(op, *this); if (const auto reduce = std::dynamic_pointer_cast(op)) { keep_dims = reduce->get_keep_dims(); + auto reduceConst = std::dynamic_pointer_cast(reduce->get_input_node_shared_ptr(REDUCE_INDEXES)); + if (!reduceConst) + IE_THROW() << errorPrefix << " second tensor is not constant!"; + raw_axes = reduceConst->cast_vector(); } else if (const auto reduce = std::dynamic_pointer_cast(op)) { keep_dims = reduce->get_keep_dims(); + auto reduceConst = std::dynamic_pointer_cast(reduce->get_input_node_shared_ptr(REDUCE_INDEXES)); + if (!reduceConst) + IE_THROW() << errorPrefix << " second tensor is not constant!"; + raw_axes = reduceConst->cast_vector(); } + setJITBeyond5D(); } else { IE_THROW(NotImplemented) << errorMessage; } @@ -1429,38 +1746,30 @@ void MKLDNNReduceNode::initSupportedPrimitiveDescriptors() { if (!supportedPrimitiveDescriptors.empty()) return; - static const Precision supportedPrecisions[] = { - Precision::FP32, - Precision::BF16, - Precision::I32, - Precision::I8, - Precision::U8 - }; + input_prec = getOriginalInputPrecisionAtPort(REDUCE_DATA); + output_prec = getOriginalOutputPrecisionAtPort(0); - Precision inputPrecision = getOriginalInputPrecisionAtPort(REDUCE_DATA); - Precision outputPrecision = getOriginalOutputPrecisionAtPort(0); + if (!fusedWith.empty()) { + output_prec = fusedWith[fusedWith.size() - 1]->getOriginalOutputPrecisionAtPort(0); + } - jit_mode = (mayiuse(cpu::x64::sse41)) && getInputShapeAtPort(REDUCE_DATA).getRank() <= 5 && - std::find(std::begin(supportedPrecisions), std::end(supportedPrecisions), inputPrecision) != std::end(supportedPrecisions) && - std::find(std::begin(supportedPrecisions), std::end(supportedPrecisions), outputPrecision) != std::end(supportedPrecisions); + jit_mode = canApplyJIT(input_prec, output_prec); if (jit_mode) { // Since in jit mode we use the output memory as an intermediate accumulator for certain reduce modes, we can't use BF16 output precision due to // the possible accuracy loss. Therefore, for such mods, we will change the output precision to FP32. - if (Precision::BF16 == outputPrecision) { + if (Precision::BF16 == output_prec) { if (!mayiuse(avx512_core)) { - outputPrecision = Precision::FP32; + output_prec = Precision::FP32; } else if (algorithm != ReduceAnd && algorithm != ReduceOr && algorithm != ReduceMin && algorithm != ReduceMax) { - outputPrecision = Precision::FP32; + output_prec = Precision::FP32; } } } - input_prec = inputPrecision; - output_prec = outputPrecision; - src_data_size = inputPrecision.size(); - dst_data_size = outputPrecision.size(); + src_data_size = input_prec.size(); + dst_data_size = output_prec.size(); NodeConfig config; config.dynBatchSupport = false; @@ -1475,12 +1784,12 @@ void MKLDNNReduceNode::initSupportedPrimitiveDescriptors() { auto& creatorsMap = BlockedDescCreator::getCommonCreators(); - auto pushDesc = [&](LayoutType inFormat, LayoutType outFormat, InferenceEngine::Precision inDataType, - InferenceEngine::Precision outDataType, impl_desc_type impl_type) { - config.inConfs[REDUCE_DATA].desc = creatorsMap.at(inFormat)->createSharedDesc(inDataType, getInputShapeAtPort(REDUCE_DATA)); + auto pushDesc = [&](LayoutType inFormat, LayoutType outFormat, InferenceEngine::Precision inPrecision, + InferenceEngine::Precision outPrecision, impl_desc_type impl_type) { + config.inConfs[REDUCE_DATA].desc = creatorsMap.at(inFormat)->createSharedDesc(inPrecision, getInputShapeAtPort(REDUCE_DATA)); config.inConfs[REDUCE_INDEXES].desc = creatorsMap.at(LayoutType::ncsp)->createSharedDesc(InferenceEngine::Precision::I32, getInputShapeAtPort(REDUCE_INDEXES)); - config.outConfs[0].desc = creatorsMap.at(outFormat)->createSharedDesc(outDataType, getOutputShapeAtPort(0)); + config.outConfs[0].desc = creatorsMap.at(outFormat)->createSharedDesc(outPrecision, getOutputShapeAtPort(0)); supportedPrimitiveDescriptors.push_back({config, impl_type}); }; @@ -1492,14 +1801,24 @@ void MKLDNNReduceNode::initSupportedPrimitiveDescriptors() { impl_type = impl_desc_type::jit_avx2; } - pushDesc(LayoutType::ncsp, LayoutType::ncsp, inputPrecision, outputPrecision, impl_type); - if (keep_dims) { - if ((getInputShapeAtPort(REDUCE_DATA).getRank() == 4 || getInputShapeAtPort(REDUCE_DATA).getRank() == 5) && - getInputShapeAtPort(REDUCE_DATA).getStaticDims()[1] > 1) { + pushDesc(LayoutType::ncsp, LayoutType::ncsp, input_prec, output_prec, impl_type); + if ((getInputShapeAtPort(REDUCE_DATA).getRank() == 4 || getInputShapeAtPort(REDUCE_DATA).getRank() == 5) && + getInputShapeAtPort(REDUCE_DATA).getMinDims()[1] > 1) { + if (keep_dims) { if (mayiuse(cpu::x64::avx512_common)) { - pushDesc(LayoutType::nCsp16c, LayoutType::nCsp16c, inputPrecision, outputPrecision, impl_type); + pushDesc(LayoutType::nspc, LayoutType::nspc, input_prec, output_prec, impl_type); + pushDesc(LayoutType::nCsp16c, LayoutType::nCsp16c, input_prec, output_prec, impl_type); } else if (mayiuse(cpu::x64::avx2) || mayiuse(cpu::x64::sse41)) { - pushDesc(LayoutType::nCsp8c, LayoutType::nCsp8c, inputPrecision, outputPrecision, impl_type); + pushDesc(LayoutType::nspc, LayoutType::nspc, input_prec, output_prec, impl_type); + pushDesc(LayoutType::nCsp8c, LayoutType::nCsp8c, input_prec, output_prec, impl_type); + } + } else { + if (mayiuse(cpu::x64::avx512_common)) { + pushDesc(LayoutType::nspc, LayoutType::ncsp, input_prec, output_prec, impl_type); + pushDesc(LayoutType::nCsp16c, LayoutType::ncsp, input_prec, output_prec, impl_type); + } else if (mayiuse(cpu::x64::avx2) || mayiuse(cpu::x64::sse41)) { + pushDesc(LayoutType::nspc, LayoutType::ncsp, input_prec, output_prec, impl_type); + pushDesc(LayoutType::nCsp8c, LayoutType::ncsp, input_prec, output_prec, impl_type); } } } @@ -1508,94 +1827,112 @@ void MKLDNNReduceNode::initSupportedPrimitiveDescriptors() { } } +void MKLDNNReduceNode::prepareParams() { + src_dims = getParentEdgesAtPort(REDUCE_DATA)[0]->getMemory().getDesc().getShape().getDims(); + std::vector reduce_axes; + if (jit_mode && jit_beyond_5D) { + reduce_axes = update_src_dims(); + } else { + reduce_axes = raw_axes; + } + + auto &dstMemPtr = getChildEdgeAt(0)->getMemoryPtr(); + const SizeVector &dst_dims = dstMemPtr->getDesc().getShape().getDims(); + dst_size = dstMemPtr->GetSize(); + calc_process_dst_dims(reduce_axes, dst_dims); + if (jit_mode) { + set_reduce_dim_flags(); + } + + if (compile_post_kernel) { + setPostOps(attr, dst_dims, true); + if (mayiuse(cpu::x64::avx512_common)) { + reduce_post_kernel.reset(new jit_uni_reduce_post_kernel_f32(jcp, *attr.get())); + } else if (mayiuse(cpu::x64::avx2)) { + reduce_post_kernel.reset(new jit_uni_reduce_post_kernel_f32(jcp, *attr.get())); + } else if (mayiuse(cpu::x64::sse41)) { + reduce_post_kernel.reset(new jit_uni_reduce_post_kernel_f32(jcp, *attr.get())); + } + if (reduce_post_kernel) + reduce_post_kernel->create_ker(); + jit_mode = jit_mode && reduce_post_kernel; + + if (!isDynamicNode() || (isDynamicNode() && attr.get()->post_ops_.len() == 0)) { + compile_post_kernel = false; + } + } +} + void MKLDNNReduceNode::createPrimitive() { auto &dstMemPtr = getChildEdgeAt(0)->getMemoryPtr(); - auto &srcDataMemPtr = getParentEdgeAt(REDUCE_DATA)->getMemoryPtr(); - auto &srcIndexesMemPtr = getParentEdgeAt(REDUCE_INDEXES)->getMemoryPtr(); + auto &srcMemPtr = getParentEdgeAt(REDUCE_DATA)->getMemoryPtr(); if (!dstMemPtr || !dstMemPtr->GetPrimitivePtr()) IE_THROW() << errorPrefix << " has not allocated destination memory."; - if (!srcDataMemPtr || !srcDataMemPtr->GetPrimitivePtr() || !srcIndexesMemPtr || !srcIndexesMemPtr->GetPrimitivePtr()) + if (!srcMemPtr || !srcMemPtr->GetPrimitivePtr()) IE_THROW() << errorPrefix << " has not allocate input memory."; if (getSelectedPrimitiveDescriptor() == nullptr) IE_THROW() << errorPrefix << " has nullable preferable primitive descriptor"; - auto selectedPD = getSelectedPrimitiveDescriptor(); - planar_layout = getParentEdgeAt(REDUCE_DATA)->getMemory().getDesc().hasLayoutType(LayoutType::ncsp); + if (srcMemPtr->getDesc().hasLayoutType(LayoutType::ncsp)) { + layout = ReduceLayoutType::reduce_ncsp; + } else if (srcMemPtr->getDesc().hasLayoutType(LayoutType::nspc)) { + layout = ReduceLayoutType::reduce_nspc; + } else { + layout = ReduceLayoutType::reduce_blocked; + } - auto jcp = jit_reduce_config_params(); + // hybrid layout: nspc/blocked layout for input and ncsp for output + // !keep_dims is needed to avoid hybrid layout for cases eg. (A, B, C, D) reduce to (A, 1, 1, 1) + if (!keep_dims && (layout == ReduceLayoutType::reduce_nspc || layout == ReduceLayoutType::reduce_blocked)) { + is_hybrid_layout = dstMemPtr->getDesc().hasLayoutType(LayoutType::ncsp); + } + + auto selectedPD = getSelectedPrimitiveDescriptor(); + jcp = jit_reduce_config_params(); jcp.src_dt = MKLDNNExtensionUtils::IEPrecisionToDataType(selectedPD->getConfig().inConfs[REDUCE_DATA].desc->getPrecision()); jcp.dst_dt = MKLDNNExtensionUtils::IEPrecisionToDataType(selectedPD->getConfig().outConfs[0].desc->getPrecision()); jcp.src_data_size = MKLDNNExtensionUtils::sizeOfDataType(jcp.src_dt); jcp.dst_data_size = MKLDNNExtensionUtils::sizeOfDataType(jcp.dst_dt); - jcp.planar_layout = planar_layout; + jcp.layout = layout; jcp.reduce_mode = getAlgorithm(); + compile_post_kernel = true; + + if (inputShapesDefined()) { + if (needPrepareParams()) + prepareParams(); + updateLastInputDims(); + } + if (mayiuse(cpu::x64::avx512_common)) { reduce_kernel.reset(new jit_uni_reduce_kernel_f32(jcp)); - reduce_post_kernel.reset(new jit_uni_reduce_post_kernel_f32(jcp)); blk_size = 16; } else if (mayiuse(cpu::x64::avx2)) { reduce_kernel.reset(new jit_uni_reduce_kernel_f32(jcp)); - reduce_post_kernel.reset(new jit_uni_reduce_post_kernel_f32(jcp)); blk_size = 8; } else if (mayiuse(cpu::x64::sse41)) { reduce_kernel.reset(new jit_uni_reduce_kernel_f32(jcp)); - reduce_post_kernel.reset(new jit_uni_reduce_post_kernel_f32(jcp)); blk_size = 8; } - if (reduce_kernel) reduce_kernel->create_ker(); - - if (reduce_post_kernel) - reduce_post_kernel->create_ker(); - jit_mode = jit_mode && reduce_kernel; } void MKLDNNReduceNode::execute(mkldnn::stream strm) { auto &dstMemPtr = getChildEdgeAt(0)->getMemoryPtr(); auto &srcMemPtr = getParentEdgeAt(REDUCE_DATA)->getMemoryPtr(); - auto &srcIndexesMemPtr = getParentEdgeAt(REDUCE_INDEXES)->getMemoryPtr(); - - const auto idx_data = reinterpret_cast(srcIndexesMemPtr->GetData()); - size_t dst_size = dstMemPtr->GetSize(); - src_dims = getParentEdgeAt(REDUCE_DATA)->getMemory().getStaticDims(); - src_strides = getParentEdgeAt(REDUCE_DATA)->getMemory().GetDescWithType()->getStrides(); - dims_size = src_dims.size(); - calc_process_dst_dims(idx_data); - - if (dims_size <= 5) { - if (dims_size == 5) { - SET_SRC_DIM_VALUE(src_dims[0], src_dims[1], src_dims[2], src_dims[3], src_dims[4]); - SET_DST_DIM_VALUE(process_dst_dims[0], process_dst_dims[1], process_dst_dims[2], process_dst_dims[3], process_dst_dims[4]); - } else if (dims_size == 4) { - SET_SRC_DIM_VALUE(src_dims[0], src_dims[1], 1, src_dims[2], src_dims[3]); - SET_DST_DIM_VALUE(process_dst_dims[0], process_dst_dims[1], 1, process_dst_dims[2], process_dst_dims[3]); - } else if (dims_size == 3) { - SET_SRC_DIM_VALUE(1, src_dims[0], 1, src_dims[1], src_dims[2]); - SET_DST_DIM_VALUE(1, process_dst_dims[0], 1, process_dst_dims[1], process_dst_dims[2]); - } else if (dims_size == 2) { - SET_SRC_DIM_VALUE(1, 1, 1, src_dims[0], src_dims[1]); - SET_DST_DIM_VALUE(1, 1, 1, process_dst_dims[0], process_dst_dims[1]); - } else { - SET_SRC_DIM_VALUE(1, src_dims[0], 1, 1, 1); - SET_DST_DIM_VALUE(1, process_dst_dims[0], 1, 1, 1); - } - - ReduceN = IB != OB && OB == 1; - ReduceC = IC != OC && OC == 1; - ReduceD = ID != OD && OD == 1; - ReduceH = IH != OH && OH == 1; - ReduceW = IW != OW && OW == 1; - } const uint8_t *src_data = reinterpret_cast(srcMemPtr->GetPtr()); uint8_t *dst_data = reinterpret_cast(dstMemPtr->GetPtr()); + if (jit_mode) { + if (is_hybrid_layout) { + dst_data = reinterpret_cast(prc_mem->get_data_handle()); + } reduce_type(src_data, dst_data, dst_size); } else { - if (planar_layout) { + if (layout == ReduceLayoutType::reduce_ncsp) { auto in_ptr = reinterpret_cast(src_data); auto out_ptr = reinterpret_cast(dst_data); reduce_ref(in_ptr, out_ptr); @@ -1607,71 +1944,175 @@ void MKLDNNReduceNode::execute(mkldnn::stream strm) { void MKLDNNReduceNode::reduce_type(const uint8_t *in_ptr, uint8_t *out_ptr, size_t dst_size) { init_dst_data(out_ptr, dst_size); + reduce_stride = IW; - if (planar_layout) { + if (layout == ReduceLayoutType::reduce_ncsp || layout == ReduceLayoutType::reduce_nspc) { reduce_PLN(in_ptr, out_ptr); } else { - if ((algorithm == ReduceAnd || algorithm == ReduceLogSumExp || algorithm == ReduceMax || - algorithm == ReduceMin || algorithm == ReduceProd) && ReduceC) { + if (ReduceC && (IC % blk_size)) { reduce_BLK_concern_padding(in_ptr, out_ptr); } else { reduce_BLK(in_ptr, out_ptr); } } + + if (is_hybrid_layout) { + uint8_t *proc_ptr = out_ptr; + auto &dstMemPtr = getChildEdgeAt(0)->getMemoryPtr(); + out_ptr = reinterpret_cast(dstMemPtr->GetPtr()); + if (layout == ReduceLayoutType::reduce_nspc) { + nspc2ncsp(proc_ptr, out_ptr); + } else { + blocked2ncsp(proc_ptr, out_ptr); + } + } } void MKLDNNReduceNode::reduce_PLN(const uint8_t *in_ptr, uint8_t *out_ptr) { - for (size_t ib = 0; ib < IB; ib++) { - size_t ob = ReduceN ? 0 : ib; GET_PTR_N_PLN; - if (!ReduceC && !ReduceD && ReduceH && ReduceW) { - parallel_for2d(IC, ID, [&](size_t ic, size_t id) { - size_t oc = ic, od = id; GET_PTR_NCD_BASE_PTR_N_PLN; - reduce_kernel_process(in_ptr_ncd, out_ptr_ncd, IH * IW, 1); - }); - } else if (ReduceH && ReduceW) { - for (size_t ic = 0; ic < IC; ic++) { - size_t oc = ReduceC ? 0 : ic; GET_PTR_NC_PLN; - for (size_t id = 0; id < ID; id++) { - size_t od = ReduceD ? 0 : id; GET_PTR_NCD_PLN; - reduce_kernel_process(in_ptr_ncd, out_ptr_ncd, IH * IW, 1); - } - } - } else if (!ReduceH && ReduceW) { - for (size_t ic = 0; ic < IC; ic++) { - size_t oc = ReduceC ? 0 : ic; GET_PTR_NC_PLN; - for (size_t id = 0; id < ID; id++) { - size_t od = ReduceD ? 0 : id; GET_PTR_NCD_PLN; - parallel_for(IH, [&](size_t ih){ - size_t oh = ih; GET_PTR_NCDH_PLN; - reduce_kernel_process(in_ptr_ncdh, out_ptr_ncdh, IW, 1); + if (ReduceN && !ReduceC && !ReduceD && !ReduceH && !ReduceW) { + size_t IA = IC * ID * IH * IW; + reduce_stride = IA; + parallel_for(IA / blk_size, [&](size_t iba){ + size_t oba = iba; + reduce_kernel_process(in_ptr + iba * blk_size * src_data_size, out_ptr + oba * blk_size * dst_data_size, + blk_size, 0, IB); + }); + + size_t tail_start = IA / blk_size * blk_size; + reduce_kernel_process(in_ptr + tail_start * src_data_size, out_ptr + tail_start * dst_data_size, + IA - tail_start, 0, IB); + } else { + for (size_t ib = 0; ib < IB; ib++) { + size_t ob = ReduceN ? 0 : ib; GET_PTR_N_PLN; + if (!ReduceC && !ReduceD && ReduceW) { + size_t work_amount = ReduceH ? IH * IW : IW; + if (work_amount < blk_size && mayiuse(cpu::x64::avx2)) { + size_t outer_size = ReduceH ? IC * ID : IC * ID * IH; + size_t inner_size = ReduceH ? IH * IW : IW; + size_t output_inner_size = ReduceH ? OH * OW : OW; + size_t IK = outer_size / blk_size; + std::vector index_buf(blk_size); + for (size_t i = 0; i < blk_size; i++) { + index_buf[i] = i * work_amount * src_data_size; + } + parallel_for(IK, [&](size_t ik) { + size_t ok = ik; + reduce_kernel_process(in_ptr_n + ik * blk_size * inner_size * src_data_size, + out_ptr_n + ok * blk_size * output_inner_size * dst_data_size, + work_amount, 1, 0, static_cast(&index_buf[0])); }); - } - } - } else if (ReduceW) { - for (size_t ic = 0; ic < IC; ic++) { - size_t oc = ReduceC ? 0 : ic; GET_PTR_NC_PLN; - for (size_t id = 0; id < ID; id++) { - size_t od = ReduceD ? 0 : id; GET_PTR_NCD_PLN; - for (size_t ih = 0; ih < IH; ih++) { - size_t oh = ReduceH ? 0 : ih; GET_PTR_NCDH_PLN; - reduce_kernel_process(in_ptr_ncdh, out_ptr_ncdh, IW, 1); + size_t tail_start = IK * blk_size; + size_t IT = outer_size - tail_start; + parallel_for(IT, [&](size_t it) { + size_t ot = it; + reduce_kernel_process(in_ptr_n + (tail_start + it) * inner_size * src_data_size, + out_ptr_n + (tail_start + ot) * output_inner_size * dst_data_size, work_amount, 1); + }); + } else { + if (ReduceH) { + parallel_for2d(IC, ID, [&](size_t ic, size_t id) { + size_t oc = ic, od = id; GET_PTR_NCD_BASE_PTR_N_PLN; + reduce_kernel_process(in_ptr_ncd, out_ptr_ncd, work_amount, 1); + }); + } else { + parallel_for3d(IC, ID, IH, [&](size_t ic, size_t id, size_t ih) { + size_t oc = ic, od = id; GET_PTR_NCD_BASE_PTR_N_PLN; + size_t oh = ih; GET_PTR_NCDH_PLN; + reduce_kernel_process(in_ptr_ncdh, out_ptr_ncdh, work_amount, 1); + }); } } - } - } else { - for (size_t ic = 0; ic < IC; ic++) { - size_t oc = ReduceC ? 0 : ic; GET_PTR_NC_PLN; - for (size_t id = 0; id < ID; id++) { - size_t od = ReduceD ? 0 : id; GET_PTR_NCD_PLN; - for (size_t ih = 0; ih < IH; ih++) { - size_t oh = ReduceH ? 0 : ih; GET_PTR_NCDH_PLN; - for (size_t ibw = 0; ibw < IW / blk_size; ibw++) { - size_t obw = ibw; - reduce_kernel_process(in_ptr_ncdh + ibw * blk_size * src_data_size, - out_ptr_ncdh + obw * blk_size * dst_data_size, blk_size, 0); + } else if (ReduceH && ReduceW) { + for (size_t ic = 0; ic < IC; ic++) { + size_t oc = ReduceC ? 0 : ic; GET_PTR_NC_PLN; + for (size_t id = 0; id < ID; id++) { + size_t od = ReduceD ? 0 : id; GET_PTR_NCD_PLN; + reduce_kernel_process(in_ptr_ncd, out_ptr_ncd, IH * IW, 1); + } + } + } else if (!ReduceH && ReduceW) { + for (size_t ic = 0; ic < IC; ic++) { + size_t oc = ReduceC ? 0 : ic; GET_PTR_NC_PLN; + for (size_t id = 0; id < ID; id++) { + size_t od = ReduceD ? 0 : id; GET_PTR_NCD_PLN; + parallel_for(IH, [&](size_t ih){ + size_t oh = ih; GET_PTR_NCDH_PLN; + reduce_kernel_process(in_ptr_ncdh, out_ptr_ncdh, IW, 1); + }); + } + } + } else if (ReduceW) { + for (size_t ic = 0; ic < IC; ic++) { + size_t oc = ReduceC ? 0 : ic; GET_PTR_NC_PLN; + for (size_t id = 0; id < ID; id++) { + size_t od = ReduceD ? 0 : id; GET_PTR_NCD_PLN; + for (size_t ih = 0; ih < IH; ih++) { + size_t oh = ReduceH ? 0 : ih; GET_PTR_NCDH_PLN; + reduce_kernel_process(in_ptr_ncdh, out_ptr_ncdh, IW, 1); + } + } + } + } else if (!ReduceC && !ReduceD && ReduceH && !ReduceW) { + parallel_for2d(IC, ID, [&](size_t ic, size_t id) { + size_t oc = ic, od = id; GET_PTR_NCD_BASE_PTR_N_PLN; + parallel_for(IW / blk_size, [&](size_t ibw){ + size_t obw = ibw; + reduce_kernel_process(in_ptr_ncd + ibw * blk_size * src_data_size, out_ptr_ncd + obw * blk_size * dst_data_size, + blk_size, 0, IH); + }); + size_t tail_start = IW / blk_size * blk_size; + reduce_kernel_process(in_ptr_ncd + tail_start * src_data_size, out_ptr_ncd + tail_start * dst_data_size, + IW - tail_start, 0, IH); + }); + } else if (!ReduceC && ReduceD && ReduceH && !ReduceW) { + parallel_for(IC, [&](size_t ic) { + size_t oc = ic; GET_PTR_NC_PLN; + parallel_for(IW / blk_size, [&](size_t ibw){ + size_t obw = ibw; + reduce_kernel_process(in_ptr_nc + ibw * blk_size * src_data_size, out_ptr_nc + obw * blk_size * dst_data_size, + blk_size, 0, ID * IH); + }); + size_t tail_start = IW / blk_size * blk_size; + reduce_kernel_process(in_ptr_nc + tail_start * src_data_size, out_ptr_nc + tail_start * dst_data_size, + IW - tail_start, 0, ID * IH); + }); + } else if (ReduceC && ReduceD && ReduceH && !ReduceW) { + parallel_for(IW / blk_size, [&](size_t ibw){ + size_t obw = ibw; + reduce_kernel_process(in_ptr_n + ibw * blk_size * src_data_size, out_ptr_n + obw * blk_size * dst_data_size, + blk_size, 0, IC * ID * IH); + }); + + size_t tail_start = IW / blk_size * blk_size; + reduce_kernel_process(in_ptr_n + tail_start * src_data_size, out_ptr_n + tail_start * dst_data_size, + IW - tail_start, 0, IC * ID * IH); + } else if (ReduceC && !ReduceD && !ReduceH && !ReduceW) { + size_t IS = ID * IH * IW; + reduce_stride = IS; + parallel_for(IS / blk_size, [&](size_t ibs){ + size_t obs = ibs; + reduce_kernel_process(in_ptr_n + ibs * blk_size * src_data_size, out_ptr_n + obs * blk_size * dst_data_size, + blk_size, 0, IC); + }); + + size_t tail_start = IS / blk_size * blk_size; + reduce_kernel_process(in_ptr_n + tail_start * src_data_size, out_ptr_n + tail_start * dst_data_size, + IS - tail_start, 0, IC); + } else { + for (size_t ic = 0; ic < IC; ic++) { + size_t oc = ReduceC ? 0 : ic; GET_PTR_NC_PLN; + for (size_t id = 0; id < ID; id++) { + size_t od = ReduceD ? 0 : id; GET_PTR_NCD_PLN; + for (size_t ih = 0; ih < IH; ih++) { + size_t oh = ReduceH ? 0 : ih; GET_PTR_NCDH_PLN; + for (size_t ibw = 0; ibw < IW / blk_size; ibw++) { + size_t obw = ibw; + reduce_kernel_process(in_ptr_ncdh + ibw * blk_size * src_data_size, + out_ptr_ncdh + obw * blk_size * dst_data_size, blk_size, 0); + } + size_t tail_start = IW / blk_size * blk_size; + reduce_kernel_process(in_ptr_ncdh + tail_start * src_data_size, out_ptr_ncdh + tail_start * dst_data_size, IW - tail_start, 0); } - size_t tail_start = IW / blk_size * blk_size; - reduce_kernel_process(in_ptr_ncdh + tail_start * src_data_size, out_ptr_ncdh + tail_start * dst_data_size, IW - tail_start, 0); } } } @@ -1692,13 +2133,24 @@ void MKLDNNReduceNode::reduce_BLK(const uint8_t *in_ptr, uint8_t *out_ptr) { size_t ocb = icb, od = id; GET_PTR_NCD_BASE_PTR_N_BLK; reduce_kernel_process(in_ptr_ncd, out_ptr_ncd, IH * IW * blk_size); }); - } else if (ReduceH && ReduceW) { - for (size_t icb = 0; icb < ICB; icb++) { - size_t ocb = ReduceC ? 0 : icb; GET_PTR_NC_BLK; - for (size_t id = 0; id < ID; id++) { - size_t od = ReduceD ? 0 : id; GET_PTR_NCD_BLK; - reduce_kernel_process(in_ptr_ncd, out_ptr_ncd, IH * IW * blk_size); - } + } else if (ReduceC && ReduceD && ReduceH && ReduceW) { + if (input_prec != output_prec || getAlgorithm() == ReduceL2 || + algorithm == ReduceLogSumExp || algorithm == ReduceSumSquare) { + reduce_kernel_process(in_ptr_n, out_ptr_n, ICB * ID * IH * IW * blk_size); + } else { + // reduce parallelly + // step1: !ReduceC && ReduceD && ReduceH && ReduceW + size_t prc_size = ICB * blk_size * dst_data_size; + std::vector vec_prc(prc_size); + init_dst_data(vec_prc.data(), prc_size); + uint8_t *out_ptr_n_cp = out_ptr_n; + out_ptr_n = vec_prc.data(); + parallel_for(ICB, [&](size_t icb) { + size_t ocb = icb; GET_PTR_NC_BLK; + reduce_kernel_process(in_ptr_nc, out_ptr_nc, ID * IH * IW * blk_size); + }); + // step2: ReduceC + reduce_kernel_process(out_ptr_n, out_ptr_n_cp, ICB * blk_size); } } else if (ReduceW) { for (size_t icb = 0; icb < ICB; icb++) { @@ -1711,6 +2163,15 @@ void MKLDNNReduceNode::reduce_BLK(const uint8_t *in_ptr, uint8_t *out_ptr) { } } } + } else if (ReduceC && !ReduceD && !ReduceH && !ReduceW) { + reduce_stride = ID * IH * IW * blk_size; + parallel_for3d(ID, IH, IW, [&](size_t id, size_t ih, size_t iw) { + size_t icb = 0, ocb = 0; GET_PTR_NC_BLK; + size_t od = id; GET_PTR_NCD_BLK; + size_t oh = ih; GET_PTR_NCDH_BLK; + size_t ow = iw; GET_PTR_NCDHW_BLK; + reduce_kernel_process(in_ptr_ncdhw, out_ptr_ncdhw, blk_size, 0, ICB); + }); } else { for (size_t icb = 0; icb < ICB; icb++) { size_t ocb = ReduceC ? 0 : icb; GET_PTR_NC_BLK; @@ -1815,44 +2276,180 @@ void MKLDNNReduceNode::reduce_BLK_concern_padding(const uint8_t *in_ptr, uint8_t reduce_kernel_post_process(out_ptr); } -inline void MKLDNNReduceNode::reduce_kernel_process(const uint8_t *in_p, uint8_t *out_p, size_t work_amount, size_t reduce_w) { +inline void MKLDNNReduceNode::reduce_kernel_process(const uint8_t *in_p, uint8_t *out_p, size_t work_amount, + size_t reduce_w, size_t work_batch, const int *tab_idx) { auto arg = jit_reduce_call_args(); arg.src = static_cast(in_p); + arg.idx = tab_idx; arg.dst = static_cast(out_p); arg.work_amount = work_amount; + arg.work_batch = work_batch; arg.reduce_w = reduce_w; + arg.reduce_stride = reduce_stride; + (*reduce_kernel)(&arg); } inline void MKLDNNReduceNode::reduce_kernel_post_process(uint8_t *out_ptr) { const size_t integerDivisor = IB * IC * ID * IH * IW / (OB * OC * OD * OH * OW); const float divisor = static_cast(integerDivisor); - if (planar_layout) { - size_t parallel_amount = OB * OC * OD; - parallel_for(parallel_amount, [&](size_t i) { - uint8_t *out_p = out_ptr + i * OH * OW * dst_data_size; - auto arg = jit_reduce_call_args(); + if (layout == ReduceLayoutType::reduce_ncsp || layout == ReduceLayoutType::reduce_nspc) { + parallel_for2d(OB, OC, [&](size_t ob, size_t oc) { + uint8_t *out_p = out_ptr + (ob * OC + oc) * OD * OH * OW * dst_data_size; + auto arg = jit_reduce_post_call_args(); arg.dst = static_cast(out_p); - arg.reduce_c = 2; - arg.work_amount = OH * OW; + arg.oc_off = layout == ReduceLayoutType::reduce_nspc ? 0 : oc * sizeof(float); + arg.channel_size = layout == ReduceLayoutType::reduce_nspc ? OW : OC; // OW is related to nspc-ncsp dimension reinterpret + arg.work_amount = OD * OH * OW; arg.divisor = &divisor; (*reduce_post_kernel)(&arg); }); } else { size_t OCB = div_up(OC, blk_size); - size_t parallel_amount = OB * OCB * OD; - parallel_for(parallel_amount, [&](size_t i) { - uint8_t *out_p = out_ptr + i * OH * OW * blk_size * dst_data_size; - auto arg = jit_reduce_call_args(); + parallel_for2d(OB, OCB, [&](size_t ob, size_t ocb) { + uint8_t *out_p = out_ptr + (ob * OCB + ocb) * OD * OH * OW * blk_size * dst_data_size; + auto arg = jit_reduce_post_call_args(); arg.dst = static_cast(out_p); arg.reduce_c = ReduceC ? 1 : 0; - arg.work_amount = OH * OW * blk_size; + arg.oc_off = ocb * blk_size * sizeof(float); + arg.work_amount = OD * OH * OW * blk_size; arg.divisor = &divisor; (*reduce_post_kernel)(&arg); }); } } +void MKLDNNReduceNode::nspc2ncsp(uint8_t *proc_ptr, uint8_t *out_ptr) { + // dimension reinterpret after nspc reusing routine reduce_PLN + // demote -- nspc -- ncsp + // DIM0 -- B -- B + // DIM1 -- C -- W + // DIM2 -- D -- C + // DIM3 -- H -- D + // DIM4 -- W -- H + const size_t DIM0 = OB; + const size_t DIM1 = OW; + const size_t DIM2 = OC; + const size_t DIM3 = OD; + const size_t DIM4 = OH; + const size_t stride1 = DIM2 * DIM3 * DIM4; + const size_t stride0 = stride1 * DIM1; + + if (dst_data_size == 4) { + auto src_data = reinterpret_cast(proc_ptr); + auto dst_data = reinterpret_cast(out_ptr); + parallel_for2d(DIM0, stride1, [&](size_t b, size_t j) { + auto src_off = b * stride0 + j * DIM1; + auto dst_off = b * stride0 + j; + for (size_t dim1 = 0; dim1 < DIM1; dim1++) { + dst_data[dst_off] = src_data[src_off]; + src_off++; + dst_off += stride1; + } + }); + } else if (dst_data_size == 2) { + auto src_data = reinterpret_cast(proc_ptr); + auto dst_data = reinterpret_cast(out_ptr); + parallel_for2d(DIM0, stride1, [&](size_t b, size_t j) { + auto src_off = b * stride0 + j * DIM1; + auto dst_off = b * stride0 + j; + for (size_t dim1 = 0; dim1 < DIM1; dim1++) { + dst_data[dst_off] = src_data[src_off]; + src_off++; + dst_off += stride1; + } + }); + } else { + auto src_data = reinterpret_cast(proc_ptr); + auto dst_data = reinterpret_cast(out_ptr); + parallel_for2d(DIM0, stride1, [&](size_t b, size_t j) { + auto src_off = b * stride0 + j * DIM1; + auto dst_off = b * stride0 + j; + for (size_t dim1 = 0; dim1 < DIM1; dim1++) { + dst_data[dst_off] = src_data[src_off]; + src_off++; + dst_off += stride1; + } + }); + } +} + +void MKLDNNReduceNode::blocked2ncsp(uint8_t *proc_ptr, uint8_t *out_ptr) { + const size_t DIM0 = OB; + const size_t DIM1 = OC; + const size_t DIM2 = OD; + const size_t DIM3 = OH; + const size_t DIM4 = OW; + const size_t stride1 = DIM2 * DIM3 * DIM4; + const size_t src_stride0 = stride1 * div_up(OC, blk_size) * blk_size; + const size_t dst_stride0 = stride1 * DIM1; + + if (dst_data_size == 4) { + auto src_data = reinterpret_cast(proc_ptr); + auto dst_data = reinterpret_cast(out_ptr); + parallel_for2d(DIM0, stride1, [&](size_t b, size_t j) { + auto src_off = b * src_stride0 + j * blk_size; + auto dst_off = b * dst_stride0 + j; + for (size_t dim1 = 0; dim1 + blk_size <= DIM1; dim1 += blk_size) { + for (size_t k = 0; k < blk_size; k++) { + dst_data[dst_off] = src_data[src_off]; + src_off++; + dst_off += stride1; + } + src_off += (stride1 - 1) * blk_size; + } + size_t tail = DIM1 % blk_size; + for (size_t k = 0; k < tail; k++) { + dst_data[dst_off] = src_data[src_off]; + src_off++; + dst_off += stride1; + } + }); + } else if (dst_data_size == 2) { + auto src_data = reinterpret_cast(proc_ptr); + auto dst_data = reinterpret_cast(out_ptr); + parallel_for2d(DIM0, stride1, [&](size_t b, size_t j) { + auto src_off = b * src_stride0 + j * blk_size; + auto dst_off = b * dst_stride0 + j; + for (size_t dim1 = 0; dim1 + blk_size <= DIM1; dim1 += blk_size) { + for (size_t k = 0; k < blk_size; k++) { + dst_data[dst_off] = src_data[src_off]; + src_off++; + dst_off += stride1; + } + src_off += (stride1 - 1) * blk_size; + } + size_t tail = DIM1 % blk_size; + for (size_t k = 0; k < tail; k++) { + dst_data[dst_off] = src_data[src_off]; + src_off++; + dst_off += stride1; + } + }); + } else { + auto src_data = reinterpret_cast(proc_ptr); + auto dst_data = reinterpret_cast(out_ptr); + parallel_for2d(DIM0, stride1, [&](size_t b, size_t j) { + auto src_off = b * src_stride0 + j * blk_size; + auto dst_off = b * dst_stride0 + j; + for (size_t dim1 = 0; dim1 + blk_size <= DIM1; dim1 += blk_size) { + for (size_t k = 0; k < blk_size; k++) { + dst_data[dst_off] = src_data[src_off]; + src_off++; + dst_off += stride1; + } + src_off += (stride1 - 1) * blk_size; + } + size_t tail = DIM1 % blk_size; + for (size_t k = 0; k < tail; k++) { + dst_data[dst_off] = src_data[src_off]; + src_off++; + dst_off += stride1; + } + }); + } +} + inline void MKLDNNReduceNode::init_dst_data(uint8_t *out_ptr, size_t dst_size) { switch (algorithm) { case ReduceL1: @@ -1925,12 +2522,23 @@ inline void MKLDNNReduceNode::init_dst_data(uint8_t *out_ptr, size_t dst_size) { } } -inline void MKLDNNReduceNode::calc_process_dst_dims(const int32_t *idx_data) { - SizeVector out_dims; - SizeVector dst_dims = getOutputShapeAtPort(0).getStaticDims(); +inline void MKLDNNReduceNode::create_working_memory() { + auto rank = getInputShapeAtPort(REDUCE_DATA).getRank(); + memory::format_tag format = (layout == ReduceLayoutType::reduce_nspc) ? (rank == 4 ? memory::format_tag::nhwc : memory::format_tag::ndhwc) + : (rank == 4 ? (mayiuse(cpu::x64::avx512_common) ? memory::format_tag::nChw16c : memory::format_tag::nChw8c) + : (mayiuse(cpu::x64::avx512_common) ? memory::format_tag::nCdhw16c : memory::format_tag::nCdhw8c)); + auto prc_dims = rank == 4 ? std::vector{OB, OC, OH, OW} : std::vector{OB, OC, OD, OH, OW}; + auto desc = mkldnn::memory::desc(MKLDNNExtensionUtils::convertToDnnlDims(prc_dims), MKLDNNExtensionUtils::IEPrecisionToDataType(output_prec), format); + prc_mem = std::make_shared(desc, getEngine()); + dst_size = desc.get_size(); +} + +inline void MKLDNNReduceNode::calc_process_dst_dims(std::vector &reduce_axes, const SizeVector &dst_dims) { std::set axes; - for (size_t i = 0; i < getParentEdgeAt(REDUCE_INDEXES)->getMemory().getStaticDims()[0]; i++) { - int32_t axis = idx_data[i]; + SizeVector out_dims; + process_dst_dims.clear(); + axes_for_reduction.clear(); + for (auto &axis : reduce_axes) { if (axis < 0) axis += src_dims.size(); if (static_cast(axis) > src_dims.size()) @@ -1954,9 +2562,66 @@ inline void MKLDNNReduceNode::calc_process_dst_dims(const int32_t *idx_data) { process_dst_dims.push_back(src_dims[i]); } } - for (size_t i = 0; i < std::min(out_dims.size(), dst_dims.size()); i++) { - if (out_dims[i] != dst_dims[i]) + if (jit_mode && jit_beyond_5D) { + if (std::accumulate(out_dims.begin(), out_dims.end(), 1, std::multiplies()) != + std::accumulate(dst_dims.begin(), dst_dims.end(), 1, std::multiplies())) IE_THROW() << errorPrefix << "gets incorrect number of output dimensions!"; + } else { + for (size_t i = 0; i < std::min(out_dims.size(), dst_dims.size()); i++) { + if (out_dims[i] != dst_dims[i]) + IE_THROW() << errorPrefix << "gets incorrect number of output dimensions!"; + } + } +} + +inline void MKLDNNReduceNode::set_reduce_dim_flags() { + size_t dims_size = src_dims.size(); + if (dims_size == 5) { + SET_SRC_DIM_VALUE(src_dims[0], src_dims[1], src_dims[2], src_dims[3], src_dims[4]); + SET_DST_DIM_VALUE(process_dst_dims[0], process_dst_dims[1], process_dst_dims[2], process_dst_dims[3], process_dst_dims[4]); + } else if (dims_size == 4) { + SET_SRC_DIM_VALUE(src_dims[0], src_dims[1], 1, src_dims[2], src_dims[3]); + SET_DST_DIM_VALUE(process_dst_dims[0], process_dst_dims[1], 1, process_dst_dims[2], process_dst_dims[3]); + } else if (dims_size == 3) { + SET_SRC_DIM_VALUE(1, src_dims[0], 1, src_dims[1], src_dims[2]); + SET_DST_DIM_VALUE(1, process_dst_dims[0], 1, process_dst_dims[1], process_dst_dims[2]); + } else if (dims_size == 2) { + SET_SRC_DIM_VALUE(1, 1, 1, src_dims[0], src_dims[1]); + SET_DST_DIM_VALUE(1, 1, 1, process_dst_dims[0], process_dst_dims[1]); + } else { + SET_SRC_DIM_VALUE(1, src_dims[0], 1, 1, 1); + SET_DST_DIM_VALUE(1, process_dst_dims[0], 1, 1, 1); + } + + // must be done before the following dimension change + if (is_hybrid_layout) { + create_working_memory(); + } + + // Reducing a dimesion in nspc layout can be treated as reducing another dimension in ncsp layout, + // eg. reducing C in nspc can be treated as reducing W in ncsp layout, so that the routine reduce_PLN can be reused. + // nspc -- ncsp + // D -- C + // H -- D + // W -- H + // C -- W + if (layout == ReduceLayoutType::reduce_nspc) { + size_t ITmp = IC; IC = ID; ID = IH; IH = IW; IW = ITmp; + size_t OTmp = OC; OC = OD; OD = OH; OH = OW; OW = OTmp; + } + + ReduceN = IB != OB && OB == 1; + ReduceC = IC != OC && OC == 1; + ReduceD = ID != OD && OD == 1; + ReduceH = IH != OH && OH == 1; + ReduceW = IW != OW && OW == 1; + + // suit for parallel + if (ReduceH && IW == 1) { + ReduceW = true; + } + if (ReduceC && ReduceH && ID == 1) { + ReduceD = true; } } @@ -2013,6 +2678,7 @@ void MKLDNNReduceNode::reduce_ref_process(const float *in_ptr, float *out_ptr, f reduced_dims_work_amount *= src_dims[i]; reduced_dims_work_amount /= work_amount_dst; + SizeVector src_strides = getParentEdgeAt(REDUCE_DATA)->getMemory().GetDescWithType()->getStrides(); parallel_nt(0, [&](const int ithr, const int nthr) { int j; size_t i, start = 0, end = 0; @@ -2091,6 +2757,114 @@ inline void MKLDNNReduceNode::reduce_ref_map(float *out_ptr, size_t work_amount_ } } +void MKLDNNReduceNode::setPostOps(mkldnn::primitive_attr &attr, const VectorDims &postOpDims, bool initWeights) { + mkldnn::post_ops ops; + for (auto &node : fusedWith) { + auto* fakeQuantizeNode = dynamic_cast(node.get()); + if (fakeQuantizeNode) { + fakeQuantizeNode->appendPostOps(ops); + continue; + } + + auto* eltwiseNode = dynamic_cast(node.get()); + if (eltwiseNode) { + constexpr int align = 16; + eltwiseNode->appendPostOps(ops, postOpDims, align); + continue; + } + IE_THROW() << "Fusing of " << NameFromType(node->getType()) << " operation to " << NameFromType(this->getType()) << " node is not implemented"; + } + attr.set_post_ops(ops); +} + +void MKLDNNReduceNode::setJITBeyond5D() { + jit_beyond_5D = false; + if (getInputShapeAtPort(REDUCE_DATA).getRank() > 5) { + for (auto &axis : raw_axes) { + if (axis < 0) + axis += static_cast(getInputShapeAtPort(REDUCE_DATA).getRank()); + } + + if (raw_axes.size() <= 1) { + jit_beyond_5D = true; + } else { + for (size_t i = 1; i < raw_axes.size(); i++) { + if (raw_axes[i] != raw_axes[i - 1] + 1) { + jit_beyond_5D = false; + break; + } + jit_beyond_5D = true; + } + } + } +} + +std::vector MKLDNNReduceNode::update_src_dims() { + std::vector reduce_axes = raw_axes; + + if (reduce_axes.size() < 1) + return reduce_axes; + + size_t axis_dim = 1; + size_t outer_dim = 1; + size_t inner_dim = 1; + int outer_end = reduce_axes[0]; + int inner_start = reduce_axes[reduce_axes.size() - 1]; + for (size_t i = 0; i < src_dims.size(); i++) { + if (i < outer_end) { + outer_dim *= src_dims[i]; + } else if (i > inner_start) { + inner_dim *= src_dims[i]; + } else { + axis_dim *= src_dims[i]; + } + } + + reduce_axes.clear(); + reduce_axes.push_back(1); + + src_dims.clear(); + src_dims.push_back(outer_dim); + src_dims.push_back(axis_dim); + src_dims.push_back(inner_dim); + + return reduce_axes; +} + +bool MKLDNNReduceNode::canApplyJIT(const Precision &input_prec, const Precision &output_prec) const { + static const Precision supportedPrecisions[] = { + Precision::FP32, + Precision::BF16, + Precision::I32, + Precision::I8, + Precision::U8 + }; + + return (mayiuse(cpu::x64::sse41)) && (getInputShapeAtPort(REDUCE_DATA).getRank() <= 5 || jit_beyond_5D) && + std::find(std::begin(supportedPrecisions), std::end(supportedPrecisions), input_prec) != std::end(supportedPrecisions) && + std::find(std::begin(supportedPrecisions), std::end(supportedPrecisions), output_prec) != std::end(supportedPrecisions); +} + +bool MKLDNNReduceNode::canFuse(const MKLDNNNodePtr& node) const { + Precision input_prec = getOriginalInputPrecisionAtPort(REDUCE_DATA); + Precision output_prec = getOriginalOutputPrecisionAtPort(0); + if (!canApplyJIT(input_prec, output_prec) || jit_beyond_5D || algorithm == ReduceAnd || algorithm == ReduceOr) { + return false; + } + + // In jit mode we use the output memory as an intermediate accumulator for certain reduce modes. + // If the post ops node has a lower precision for such modes, post ops fusing won't be supposted, in order to avoid accuracy loss. + if (output_prec == Precision::FP32 && + !node->getOriginalOutputPrecisions().empty() && node->getOriginalOutputPrecisionAtPort(0) != Precision::FP32) { + if (algorithm != ReduceAnd && algorithm != ReduceOr && + algorithm != ReduceMin && algorithm != ReduceMax) { + return false; + } + } + + return canFuseSimpleOperation(node); +} + bool MKLDNNReduceNode::created() const { return getType() == Reduce; } diff --git a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_reduce_node.h b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_reduce_node.h index 202961e3e03..07effa0891f 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_reduce_node.h +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_reduce_node.h @@ -12,8 +12,14 @@ namespace MKLDNNPlugin { +enum ReduceLayoutType { + reduce_ncsp, + reduce_nspc, + reduce_blocked +}; + struct jit_reduce_config_params { - bool planar_layout; + ReduceLayoutType layout; Algorithm reduce_mode; mkldnn::memory::data_type src_dt; mkldnn::memory::data_type dst_dt; @@ -23,11 +29,22 @@ struct jit_reduce_config_params { struct jit_reduce_call_args { const void *src; + const int *idx; void *dst; size_t work_amount; - size_t reduce_w = 2; // only used in planar layout [1: reduce width dimension] [0: reduce other dimension] [other value: N/A] - size_t reduce_c = 2; // only used in blocked layout [1: reduce channel dimension] [0: reduce other dimension] [other value: N/A] - const float *divisor; // mean = sum / divisor + size_t work_batch; + size_t reduce_w = 2; // only used in planar layout [1: reduce width dimension] [0: reduce other dimension] [other value: N/A] + size_t reduce_stride; // only used in planar layout while reducing dimensions except for width +}; + +struct jit_reduce_post_call_args { + const void *src; + void *dst; + size_t work_amount; + size_t reduce_c = 2; // only used in blocked layout [1: reduce channel dimension] [0: reduce other dimension] [other value: N/A] + size_t oc_off; // offset in byte along channel on output tensor + size_t channel_size; // only for post ops fusion of nspc layout + const float *divisor; // mean = sum / divisor }; struct jit_uni_reduce_kernel { @@ -47,19 +64,20 @@ struct jit_uni_reduce_kernel { }; struct jit_uni_reduce_post_kernel { - void (*ker_)(const jit_reduce_call_args *); + void (*ker_)(const jit_reduce_post_call_args *); - void operator()(const jit_reduce_call_args *args) { + void operator()(const jit_reduce_post_call_args *args) { assert(ker_); ker_(args); } - virtual void create_ker() = 0; - - explicit jit_uni_reduce_post_kernel(jit_reduce_config_params jcp) : ker_(nullptr), jcp_(jcp) {} + explicit jit_uni_reduce_post_kernel(jit_reduce_config_params jcp, const mkldnn_primitive_attr &attr) : ker_(nullptr), jcp_(jcp), attr_(attr) {} virtual ~jit_uni_reduce_post_kernel() {} + virtual void create_ker() = 0; + jit_reduce_config_params jcp_; + const mkldnn_primitive_attr &attr_; }; class MKLDNNReduceNode : public MKLDNNNode { @@ -68,9 +86,12 @@ public: void getSupportedDescriptors() override; void initSupportedPrimitiveDescriptors() override; + void prepareParams() override; void createPrimitive() override; bool created() const override; void execute(mkldnn::stream strm) override; + void executeDynamicImpl(mkldnn::stream strm) override { execute(strm); } + bool canFuse(const MKLDNNNodePtr& node) const override; bool canBeInPlace() const override { return false; } @@ -82,30 +103,49 @@ private: void reduce_PLN(const uint8_t *in_ptr, uint8_t *out_ptr); void reduce_BLK(const uint8_t *in_ptr, uint8_t *out_ptr); void reduce_BLK_concern_padding(const uint8_t *in_ptr, uint8_t *out_ptr); - inline void reduce_kernel_process(const uint8_t *in_p, uint8_t *out_p, size_t work_amount, size_t reduce_w = 2); + inline void reduce_kernel_process(const uint8_t *in_p, uint8_t *out_p, size_t work_amount, + size_t reduce_w = 2, size_t work_batch = 1, const int *tab_idx = NULL); inline void reduce_kernel_post_process(uint8_t *out_ptr); inline void init_dst_data(uint8_t *out_ptr, size_t dst_size); - inline void calc_process_dst_dims(const int32_t *idx_data); + inline void create_working_memory(); + inline void calc_process_dst_dims(std::vector &reduce_axes, const InferenceEngine::SizeVector &dst_dim); + inline void set_reduce_dim_flags(); inline void reduce_ref(const float *in_ptr, float *out_ptr); void reduce_ref_process(const float *in_ptr, float *out_ptr, float init_value, std::function func); inline void reduce_ref_map(float *out_ptr, size_t work_amount_dst, size_t reduced_dims_work_amount); + void nspc2ncsp(uint8_t *proc_ptr, uint8_t *out_ptr); + void blocked2ncsp(uint8_t *proc_ptr, uint8_t *out_ptr); + void setPostOps(mkldnn::primitive_attr &attr, const VectorDims &postOpDims, bool initWeights = false); + void setJITBeyond5D(); + std::vector update_src_dims(); + bool canApplyJIT(const InferenceEngine::Precision &input_prec, const InferenceEngine::Precision &output_prec) const; size_t blk_size; - size_t dims_size; + size_t dst_size; static const size_t REDUCE_DATA = 0; static const size_t REDUCE_INDEXES = 1; - bool planar_layout = true; + bool jit_beyond_5D = false; bool jit_mode = true; bool keep_dims = true; + bool is_hybrid_layout = false; + bool compile_post_kernel = true; bool ReduceN, ReduceC, ReduceD, ReduceH, ReduceW; size_t IB, IC, ID, IH, IW; size_t OB, OC, OD, OH, OW; size_t src_data_size, dst_data_size; + size_t reduce_stride; + ReduceLayoutType layout; InferenceEngine::Precision input_prec, output_prec; InferenceEngine::SizeVector src_dims; - InferenceEngine::SizeVector src_strides; InferenceEngine::SizeVector process_dst_dims; InferenceEngine::SizeVector axes_for_reduction; + std::vector raw_axes; + + jit_reduce_config_params jcp; + + mkldnn::primitive_attr attr; + + std::shared_ptr prc_mem; std::shared_ptr reduce_kernel; std::shared_ptr reduce_post_kernel; diff --git a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_reorg_yolo_node.cpp b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_reorg_yolo_node.cpp index 194ddca390c..3ebc977bc41 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_reorg_yolo_node.cpp +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_reorg_yolo_node.cpp @@ -13,10 +13,6 @@ using namespace InferenceEngine; bool MKLDNNReorgYoloNode::isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept { try { - if (isDynamicNgraphNode(op)) { - errorMessage = "Doesn't support op with dynamic shapes"; - return false; - } const auto reorgYolo = std::dynamic_pointer_cast(op); if (!reorgYolo) { errorMessage = "Only opset2 ReorgYolo operation is supported"; diff --git a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_reorg_yolo_node.h b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_reorg_yolo_node.h index d22147c48e0..c3be7362484 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_reorg_yolo_node.h +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_reorg_yolo_node.h @@ -18,6 +18,10 @@ public: void createPrimitive() override {}; void execute(mkldnn::stream strm) override; bool created() const override; + bool needPrepareParams() const override { return false; } + void executeDynamicImpl(mkldnn::stream strm) override { + execute(strm); + } static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; diff --git a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_roi_align_node.cpp b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_roi_align_node.cpp index 045930139ad..bbd4d12ac5e 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_roi_align_node.cpp +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_roi_align_node.cpp @@ -25,11 +25,7 @@ using ngPoolingMode = ngraph::op::v3::ROIAlign::PoolingMode; bool MKLDNNROIAlignNode::isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept { try { - if (isDynamicNgraphNode(op)) { - errorMessage = "Doesn't support op with dynamic shapes"; - return false; - } - const auto roiAlign = std::dynamic_pointer_cast(op); + auto roiAlign = ngraph::as_type_ptr(op); if (!roiAlign) { errorMessage = "Only opset3 ROIAlign operation is supported"; return false; @@ -52,7 +48,7 @@ MKLDNNROIAlignNode::MKLDNNROIAlignNode(const std::shared_ptr& op, if (isSupportedOperation(op, errorMessage)) { errorPrefix = "ROIPooling layer with name '" + getName() + "' "; - const auto roiAlign = std::dynamic_pointer_cast(op); + auto roiAlign = ngraph::as_type_ptr(op); pooledH = roiAlign->get_pooled_h(); pooledW = roiAlign->get_pooled_w(); spatialScale = roiAlign->get_spatial_scale(); @@ -93,15 +89,15 @@ void MKLDNNROIAlignNode::getSupportedDescriptors() { IE_THROW() << errorPrefix << "doesn't support output with rank: " << getOutputShapeAtPort(0).getRank(); } - if (getInputShapeAtPort(1).getStaticDims()[1] != 4) { - IE_THROW() << errorPrefix << "has invalid shape on 1st input: [" - << getInputShapeAtPort(1).getStaticDims()[0] << "," << getInputShapeAtPort(1).getStaticDims()[1] << "]"; + const auto& proposalsDims = getInputShapeAtPort(1).getDims(); + if (proposalsDims[1] != 4) { + IE_THROW() << errorPrefix << "has invalid shape on 1st input: [" << proposalsDims[0] << "," << proposalsDims[1] << "]"; } - if (getInputShapeAtPort(1).getStaticDims()[0] != getInputShapeAtPort(2).getStaticDims()[0]) { + const auto& indexesDims = getInputShapeAtPort(2).getDims(); + if (!dimsEqualWeak(proposalsDims[0], indexesDims[0])) { IE_THROW() << errorPrefix << "has different sizes of inputs for proposals (" - << getInputShapeAtPort(1).getStaticDims()[0] << ") and indexes (" - << getInputShapeAtPort(2).getStaticDims()[0] << ")"; + << proposalsDims[0] << ") and indexes (" << indexesDims[0] << ")"; } } @@ -368,6 +364,18 @@ bool MKLDNNROIAlignNode::created() const { return getType() == ROIAlign; } -void MKLDNNROIAlignNode::createPrimitive() {} +bool MKLDNNROIAlignNode::needPrepareParams() const { + return false; +} + +void MKLDNNROIAlignNode::executeDynamicImpl(mkldnn::stream strm) { + return execute(strm); +} + +void MKLDNNROIAlignNode::createPrimitive() { + if (inputShapesDefined()) { + updateLastInputDims(); + } +} REG_MKLDNN_PRIM_FOR(MKLDNNROIAlignNode, ROIAlign) diff --git a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_roi_align_node.h b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_roi_align_node.h index 4e6b835c95f..31d470d4bca 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_roi_align_node.h +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_roi_align_node.h @@ -23,6 +23,9 @@ public: void execute(mkldnn::stream strm) override; bool created() const override; + bool needPrepareParams() const override; + void executeDynamicImpl(mkldnn::stream strm) override; + static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; private: diff --git a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_scatter_update_node.cpp b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_scatter_update_node.cpp index bb68ecfdfc0..566fe7fb00b 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_scatter_update_node.cpp +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_scatter_update_node.cpp @@ -21,14 +21,10 @@ using namespace InferenceEngine; bool MKLDNNScatterUpdateNode::isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept { try { - if (isDynamicNgraphNode(op)) { - errorMessage = "Doesn't support op with dynamic shapes"; - return false; - } - const auto scatterElemUpd = std::dynamic_pointer_cast(op); - const auto scatterUpd = std::dynamic_pointer_cast(op); - const auto scatterNdUpd = std::dynamic_pointer_cast(op); - if (scatterElemUpd == nullptr && scatterUpd == nullptr && scatterNdUpd == nullptr) { + auto scatterElemUpd = ngraph::as_type_ptr(op); + auto scatterUpd = ngraph::as_type_ptr(op); + auto scatterNdUpd = ngraph::as_type_ptr(op); + if (!scatterElemUpd && !scatterUpd && !scatterNdUpd) { const std::string opType = op->get_type_name(); errorMessage = "Only opset" + opType == "ScatterNDUpdate" ? "4 " : "3 " + opType + " operation is supported"; return false; @@ -81,10 +77,10 @@ void MKLDNNScatterUpdateNode::initSupportedPrimitiveDescriptors() { if (!supportedPrimitiveDescriptors.empty()) return; - auto srcDataDim = getInputShapeAtPort(DATA_ID).getStaticDims(); - auto indicesDim = getInputShapeAtPort(INDICES_ID).getStaticDims(); - auto updateDim = getInputShapeAtPort(UPDATE_ID).getStaticDims(); - auto dstDataDim = getOutputShapeAtPort(0).getStaticDims(); + const auto& srcDataDim = getInputShapeAtPort(DATA_ID).getDims(); + const auto& indicesDim = getInputShapeAtPort(INDICES_ID).getDims(); + const auto& updateDim = getInputShapeAtPort(UPDATE_ID).getDims(); + const auto& dstDataDim = getOutputShapeAtPort(0).getDims(); size_t srcRank = srcDataDim.size(); size_t indicesRank = indicesDim.size(); @@ -96,9 +92,9 @@ void MKLDNNScatterUpdateNode::initSupportedPrimitiveDescriptors() { IE_THROW() << errorPrefix << " should have same rank for input and output tensor"; } else { for (size_t r = 0; r < srcRank; r++) { - if (srcDataDim[r] != dstDataDim[r]) { + if (!dimsEqualWeak(srcDataDim[r], dstDataDim[r])) { IE_THROW() << errorPrefix << " should have same shape for input and output tensor. The input shape is " - << srcDataDim[r] << ", while output shape is " << dstDataDim[r] << " for " << r << "th dimension"; + << srcDataDim[r] << ", while output shape is " << dstDataDim[r] << " for " << r << "th dimension"; } } } @@ -111,26 +107,28 @@ void MKLDNNScatterUpdateNode::initSupportedPrimitiveDescriptors() { break; } case ScatterUpdateMode::ScatterNDUpdate: { - size_t k = indicesDim[indicesRank - 1]; - if (k > srcRank) { - IE_THROW() << errorPrefix << "' do not have an correct indices' last dimension value, " - << "which should be smaller than or equal to input tensor rank"; - } + if (indicesDim[indicesRank - 1] != Shape::UNDEFINED_DIM) { + size_t k = indicesDim[indicesRank - 1]; + if (k > srcRank) { + IE_THROW() << errorPrefix << "' do not have an correct indices' last dimension value, " + << "which should be smaller than or equal to input tensor rank"; + } - SizeVector expectUpdateShape = {}; - size_t tupleRank = indicesRank - 1; - for (size_t ri = 0; ri < tupleRank; ri++) { - expectUpdateShape.push_back(indicesDim[ri]); - } - for (size_t rd = k; rd < srcRank; rd++) { - expectUpdateShape.push_back(srcDataDim[rd]); - } - if (expectUpdateShape.size() != updateRank) { - IE_THROW() << errorPrefix << " do not have matched tensor rank relationship for input, indices and update"; - } - for (size_t ru = 0; ru < updateRank; ru++) { - if (updateDim[ru] != expectUpdateShape[ru]) { - IE_THROW() << errorPrefix << " do not have matched tensor shape relationship for input, indices and update"; + SizeVector expectUpdateShape = {}; + size_t tupleRank = indicesRank - 1; + for (size_t ri = 0; ri < tupleRank; ri++) { + expectUpdateShape.push_back(indicesDim[ri]); + } + for (size_t rd = k; rd < srcRank; rd++) { + expectUpdateShape.push_back(srcDataDim[rd]); + } + if (expectUpdateShape.size() != updateRank) { + IE_THROW() << errorPrefix << " do not have matched tensor rank relationship for input, indices and update"; + } + for (size_t ru = 0; ru < updateRank; ru++) { + if (!dimsEqualWeak(updateDim[ru], expectUpdateShape[ru])) { + IE_THROW() << errorPrefix << " do not have matched tensor shape relationship for input, indices and update"; + } } } break; @@ -140,7 +138,7 @@ void MKLDNNScatterUpdateNode::initSupportedPrimitiveDescriptors() { IE_THROW() << errorPrefix << " do not have the same tensor rank for input, indices and update"; } for (size_t ri = 0; ri < indicesRank; ri++) { - if (indicesDim[ri] != updateDim[ri]) { + if (!dimsEqualWeak(indicesDim[ri], updateDim[ri])) { IE_THROW() << errorPrefix << " do not have the same tensor shape for indices and update"; } } @@ -178,8 +176,8 @@ void MKLDNNScatterUpdateNode::initSupportedPrimitiveDescriptors() { dataPrec = getOriginalInputPrecisionAtPort(DATA_ID); dataSize = dataPrec.size(); - bool canBeInplace = getParentEdgeAt(DATA_ID)->getParent()->getChildEdges().size() == 1 && - !getParentEdgeAt(DATA_ID)->getParent()->isConstant(); + bool canBeInplace = !isDynamicNode() && getParentEdgeAt(DATA_ID)->getParent()->getChildEdges().size() == 1 && + !getParentEdgeAt(DATA_ID)->getParent()->isConstant(); NodeConfig config; config.dynBatchSupport = false; @@ -226,6 +224,18 @@ void MKLDNNScatterUpdateNode::createPrimitive() { IE_THROW() << errorPrefix << " did not allocate update memory"; if (getSelectedPrimitiveDescriptor() == nullptr) IE_THROW() << errorPrefix << " did not set preferable primitive descriptor"; + + if (inputShapesDefined()) { + updateLastInputDims(); + } +} + +bool MKLDNNScatterUpdateNode::needPrepareParams() const { + return false; +} + +void MKLDNNScatterUpdateNode::executeDynamicImpl(mkldnn::stream strm) { + return execute(strm); } int64_t MKLDNNScatterUpdateNode::getIndicesValue(uint8_t *indices, size_t offset) { @@ -245,7 +255,7 @@ int64_t MKLDNNScatterUpdateNode::getIndicesValue(uint8_t *indices, size_t offset // shapeND: n c d h w // blockND: ncdhw cdhw dhw hw w 1 // index : 0 1 2 3 4 5 -static std::vector getBlockND(const SizeVector& shape) { +static std::vector getBlockND(const VectorDims& shape) { size_t shapeRank = shape.size(); std::vector blockND(shapeRank + 1, 1); for (int i = shapeRank - 1; i >= 0; i--) { @@ -265,8 +275,8 @@ void MKLDNNScatterUpdateNode::execute(mkldnn::stream strm) { uint8_t *indicesPtr = reinterpret_cast(indicesMemPtr->GetPtr()); uint8_t *updatePtr = reinterpret_cast(updateMemPtr->GetPtr()); - SizeVector srcDataDim = getParentEdgeAt(DATA_ID)->getMemory().getStaticDims(); - SizeVector indicesDim = getParentEdgeAt(INDICES_ID)->getMemory().getStaticDims(); + const auto& srcDataDim = getParentEdgeAt(DATA_ID)->getMemory().getStaticDims(); + const auto& indicesDim = getParentEdgeAt(INDICES_ID)->getMemory().getStaticDims(); size_t srcRank = srcDataDim.size(); int axis = 0; if (axisRelaxed) { @@ -362,9 +372,9 @@ void MKLDNNScatterUpdateNode::execute(mkldnn::stream strm) { // and indices tensor of shape [i_0, i_1, ..., i_k]. // Updates tensor shape should be [d_0, d_1, ... d_(axis - 1), i_0, i_1, ..., i_k, d_(axis + 1), ..., d_n]. void MKLDNNScatterUpdateNode::scatterUpdate(uint8_t *indices, uint8_t *update, int axis, uint8_t *dstData) { - SizeVector srcDataDim = getParentEdgeAt(DATA_ID)->getMemory().getStaticDims(); - SizeVector indicesDim = getParentEdgeAt(INDICES_ID)->getMemory().getStaticDims(); - SizeVector updateDim = getParentEdgeAt(UPDATE_ID)->getMemory().getStaticDims(); + const auto& srcDataDim = getParentEdgeAt(DATA_ID)->getMemory().getStaticDims(); + const auto& indicesDim = getParentEdgeAt(INDICES_ID)->getMemory().getStaticDims(); + const auto& updateDim = getParentEdgeAt(UPDATE_ID)->getMemory().getStaticDims(); size_t indicesRank = indicesDim.size(); std::vector srcBlockND = getBlockND(srcDataDim); @@ -395,8 +405,8 @@ void MKLDNNScatterUpdateNode::scatterUpdate(uint8_t *indices, uint8_t *update, i // k is indices.shape[-1] and should not be greater than rank of input, q is rank of indicies. // updates is a (q-1)-dimension tensor of replacement-slice-values void MKLDNNScatterUpdateNode::scatterNDUpdate(uint8_t *indices, uint8_t *update, uint8_t *dstData) { - SizeVector srcDataDim = getParentEdgeAt(DATA_ID)->getMemory().getStaticDims(); - SizeVector indicesDim = getParentEdgeAt(INDICES_ID)->getMemory().getStaticDims(); + const auto& srcDataDim = getParentEdgeAt(DATA_ID)->getMemory().getStaticDims(); + const auto& indicesDim = getParentEdgeAt(INDICES_ID)->getMemory().getStaticDims(); size_t indicesRank = indicesDim.size(); std::vector srcBlockND = getBlockND(srcDataDim); @@ -425,9 +435,8 @@ void MKLDNNScatterUpdateNode::scatterNDUpdate(uint8_t *indices, uint8_t *update, // output[i][indices[i][j][k]][k] = updates[i][j][k] if axis = 1, // output[i][j][indices[i][j][k]] = updates[i][j][k] if axis = 2. void MKLDNNScatterUpdateNode::scatterElementsUpdate(uint8_t *indices, uint8_t *update, int axis, uint8_t *dstData) { - SizeVector srcDataDim = getParentEdgeAt(DATA_ID)->getMemory().getStaticDims(); - SizeVector updateDim = getParentEdgeAt(UPDATE_ID)->getMemory().getStaticDims(); - SizeVector indicesDim = getParentEdgeAt(INDICES_ID)->getMemory().getStaticDims(); + const auto& srcDataDim = getParentEdgeAt(DATA_ID)->getMemory().getStaticDims(); + const auto& updateDim = getParentEdgeAt(UPDATE_ID)->getMemory().getStaticDims(); size_t updateRank = updateDim.size(); std::vector srcBlockND = getBlockND(srcDataDim); diff --git a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_scatter_update_node.h b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_scatter_update_node.h index 7fc9d96818f..30b0ca5735d 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_scatter_update_node.h +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_scatter_update_node.h @@ -31,6 +31,9 @@ public: return false; } + bool needPrepareParams() const override; + void executeDynamicImpl(mkldnn::stream strm) override; + static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; private: @@ -40,10 +43,7 @@ private: inline int64_t getIndicesValue(uint8_t *indices, size_t offset); ScatterUpdateMode scatterUpdateMode = ScatterUpdateMode::ScatterUpdate; - const size_t DATA_ID = 0; - const size_t INDICES_ID = 1; - const size_t UPDATE_ID = 2; - const size_t AXIS_ID = 3; + enum { DATA_ID, INDICES_ID, UPDATE_ID, AXIS_ID }; // if axis can be set other than default 0. bool axisRelaxed = false; @@ -53,4 +53,4 @@ private: std::string errorPrefix; }; -} // namespace MKLDNNPlugin \ No newline at end of file +} // namespace MKLDNNPlugin diff --git a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_tile_node.cpp b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_tile_node.cpp index 00fc9ba7873..74a1d2911c2 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_tile_node.cpp +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_tile_node.cpp @@ -3,39 +3,24 @@ // #include "mkldnn_tile_node.h" -#include -#include -#include #include "common/cpu_memcpy.h" -#include -using namespace mkldnn; -using namespace MKLDNNPlugin; using namespace InferenceEngine; +using namespace MKLDNNPlugin; -bool MKLDNNTileNode::isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept { +bool MKLDNNTileNode::isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept { try { - if (isDynamicNgraphNode(op)) { - errorMessage = "Doesn't support op with dynamic shapes"; + if (!ov::is_type(op)) { + errorMessage = "Only opset1 Tile operation is supported."; return false; } - const auto tile = std::dynamic_pointer_cast(op); - if (!tile) { - errorMessage = "Only opset1 Tile operation is supported"; + if (op->get_input_partial_shape(TILE_REPEATS).is_dynamic()) { + errorMessage = "Only static shape is supported for tile repeats input."; return false; } - if (tile->get_input_shape(TILE_INPUT).size() != tile->get_input_shape(TILE_REPEATS)[0]) { - errorMessage = "Doesn't support inputs with different ranks"; - return false; - } - const auto repeatsNode = std::dynamic_pointer_cast(tile->get_input_node_shared_ptr(TILE_REPEATS)); - if (repeatsNode == nullptr) { - errorMessage = "Only const 'repeats' input is supported"; - return false; - } - const auto repeats = repeatsNode->cast_vector(); - if (std::count_if(repeats.begin(), repeats.end(), [](int64_t x) { return x > 1; }) > 1) { - errorMessage = "Doesn't support 'repeats' with more than one specified axis"; + if (!isDynamicNgraphNode(op) && + !ov::is_type(op->get_input_node_ptr(TILE_REPEATS))) { + errorMessage = "Only constant 'Repeats' input is supported with static shapes."; return false; } } catch (...) { @@ -44,77 +29,141 @@ bool MKLDNNTileNode::isSupportedOperation(const std::shared_ptr& op, const mkldnn::engine& eng, MKLDNNWeightsSharing::Ptr &cache) : +MKLDNNTileNode::MKLDNNTileNode(const std::shared_ptr& op, const mkldnn::engine& eng, MKLDNNWeightsSharing::Ptr &cache) : MKLDNNNode(op, eng, cache) { std::string errorMessage; - if (isSupportedOperation(op, errorMessage)) { - errorPrefix = "Tile node with name '" + getName() + "'"; - - const auto tile = std::dynamic_pointer_cast(op); - const auto repeatsNode = std::dynamic_pointer_cast(tile->get_input_node_shared_ptr(TILE_REPEATS)); - const auto repeats = repeatsNode->cast_vector(); - // At this moment CPU plug-in supports tiling only per single axis - // This behavoiur is guaranteed by ConvertTileToSeqTiles - for (size_t i = 0; i < repeats.size(); i++) { - if (repeats[i] > 1) { - axis = i; - tiles = repeats[i]; - break; - } - } - noTiling = axis == -1; - if (axis >= static_cast(tile->get_input_shape(TILE_INPUT).size())) - IE_THROW() << errorPrefix << " has incorrect tiling axis: " << axis; - if (tiles < 1 && !noTiling) - IE_THROW() << errorPrefix << " has incorrect 'repeats' value: " << tiles; - } else { + if (!isSupportedOperation(op, errorMessage)) { IE_THROW(NotImplemented) << errorMessage; } + + errorPrefix = "Tile node with name '" + getName() + "'"; + + if (ov::is_type(op->get_input_node_ptr(TILE_REPEATS))) { + constMap[TILE_REPEATS] = true; + repeats = originRepeats = ov::as_type(op->get_input_node_ptr(TILE_REPEATS))->cast_vector(); + while (repeats.size() < getInputShapeAtPort(TILE_INPUT).getRank()) { + repeats.insert(repeats.begin(), 1lu); + } + } } void MKLDNNTileNode::getSupportedDescriptors() { if (getParentEdges().size() != 2) - IE_THROW() << errorPrefix << " has incorrect number of input edges"; - if (!getChildEdges().size()) - IE_THROW() << errorPrefix << " has incorrect number of output edges"; + IE_THROW() << errorPrefix << " has incorrect number of input edges. " + "Expected: 2, Actual: " << getParentEdges().size(); + if (getChildEdges().empty()) + IE_THROW() << errorPrefix << " has no output edges."; + const auto& dstDims0 = getOutputShapeAtPort(0).getDims(); + for (size_t i = 1lu; i < outputShapes.size(); i++) { + const auto& dstDims = getOutputShapeAtPort(i).getDims(); + if (dstDims.size() != dstDims0.size()) + IE_THROW() << errorPrefix << " has output edges 0 and " << i << " with different ranks: " << dstDims0.size() << " and " << dstDims.size(); + for (size_t j = 0; j < dstDims0.size(); j++) { + if (dstDims0[j] != dstDims[j]) { + IE_THROW() << errorPrefix << " has output edges 0 and " << i << " with different dims: " + << std::string(dstDims0.begin(), dstDims0.end()) << " and " << std::string(dstDims.begin(), dstDims.end()); + } + } + } + if (constMap[TILE_REPEATS] && getInputShapeAtPort(TILE_INPUT).getRank() > getOutputShapeAtPort(0).getRank()) + IE_THROW() << errorPrefix << " has incorrect input/output data shape rank. Input shape rank cannot be more than output shape rank. " + "Actual input shape size: " << getInputShapeAtPort(TILE_INPUT).getRank() << ", output shape size: " << getOutputShapeAtPort(0).getRank(); + + if (!isDynamicNode()) + needPrepareParamsVar = true; } void MKLDNNTileNode::initSupportedPrimitiveDescriptors() { if (!supportedPrimitiveDescriptors.empty()) return; - InferenceEngine::Precision precision = getOriginalInputPrecisionAtPort(TILE_INPUT); - if (precision.size() != sizeof(PrecisionTrait::value_type) && - precision.size() != sizeof(PrecisionTrait::value_type) && - precision.size() != sizeof(PrecisionTrait::value_type)) { - IE_THROW() << errorPrefix << " has unsupported input precision: " << precision; - } - - int inPlace = noTiling ? 0 : -1; - addSupportedPrimDesc({{LayoutType::ncsp, precision}, - {LayoutType::ncsp, Precision::I32}}, - {{LayoutType::ncsp, precision, false, inPlace}}, - impl_desc_type::unknown, - true); + supportedPrimitiveDescriptors = getSupportedConfigs(this); } void MKLDNNTileNode::createPrimitive() { - auto& dstMemPtr = getChildEdgeAt(0)->getMemoryPtr(); - auto& srcMemPtr = getParentEdgeAt(0)->getMemoryPtr(); - if (!dstMemPtr || !dstMemPtr->GetPrimitivePtr()) - IE_THROW() << errorPrefix << " can't get destination memory"; - if (!srcMemPtr || !srcMemPtr->GetPrimitivePtr()) - IE_THROW() << errorPrefix << " can't get input memory"; - if (getSelectedPrimitiveDescriptor() == nullptr) - IE_THROW() << errorPrefix << " has nullable preferable primitive descriptor"; + if (inputShapesDefined()) { + if (needPrepareParams()) + prepareParams(); + updateLastInputDims(); + } +} + +bool MKLDNNTileNode::needPrepareParams() const { + return needPrepareParamsVar; +} + +void MKLDNNTileNode::prepareParams() { + if (!constMap[TILE_REPEATS]) { + const auto& repeatsMem = getParentEdgesAtPort(TILE_REPEATS)[0]->getMemory(); + + const int32_t* repeatsData = reinterpret_cast(repeatsMem.GetPtr()); + originRepeats.assign(repeatsData, repeatsData + repeatsMem.getStaticDims()[0]); + + repeats.assign(std::max(originRepeats.size(), getInputShapeAtPort(TILE_INPUT).getRank()), 1lu); + const size_t offset = repeats.size() - originRepeats.size(); + for (size_t i = 0lu; i < originRepeats.size(); i++) { + repeats[i + offset] = originRepeats[i]; + } + } + + auto srcBlockedDims = getParentEdgeAt(TILE_INPUT)->getMemory().GetDescWithType()->getBlockDims(); + auto dstBlockedDims = getChildEdgeAt(0)->getMemory().GetDescWithType()->getBlockDims(); + + optimizedCase = prepareOptimizedParams(this, srcBlockedDims, dstBlockedDims); +} + +bool MKLDNNTileNode::needShapeInfer() const { + needPrepareParamsVar = true; + if (inputShapesModified()) { + return true; + } + if (!constMap[TILE_REPEATS]) { + if (originRepeats.empty()) + return true; + const int32_t* repeatsData = reinterpret_cast(getParentEdgesAtPort(TILE_REPEATS)[0]->getMemory().GetPtr()); + for (size_t i = 0lu; i < originRepeats.size(); i++) { + if (originRepeats[i] != repeatsData[i]) + return true; + } + } + needPrepareParamsVar = false; + return false; +} + +std::vector MKLDNNTileNode::shapeInfer() const { + ngraph::OutputVector inputsForShapeInfer { + std::make_shared(opToShapeInfer->get_input_element_type(TILE_INPUT), + getParentEdgesAtPort(TILE_INPUT)[0]->getMemory().GetShape().toPartialShape()), + std::make_shared(ov::element::Type_t::i32, + getParentEdgesAtPort(TILE_REPEATS)[0]->getMemory().GetShape().getStaticDims(), + getParentEdgesAtPort(TILE_REPEATS)[0]->getMemory().GetPtr()) + }; + const auto localShapeInferOp = opToShapeInfer->clone_with_new_inputs(inputsForShapeInfer); + + localShapeInferOp->validate_and_infer_types(); + + std::vector newOutputShapes(outputShapes.size()); + for (size_t i = 0lu; i < newOutputShapes.size(); i++) { + const auto &partShape = localShapeInferOp->get_output_partial_shape(i); + newOutputShapes[i] = partShape.get_shape(); + } + return newOutputShapes; } void MKLDNNTileNode::execute(mkldnn::stream strm) { + if (optimizedCase) { + optimizedExecute(getParentEdgeAt(TILE_INPUT)->getMemoryPtr(), getChildEdgeAt(0)->getMemoryPtr()); + } else { + plainExecute(strm); + } +} + +void MKLDNNTileNode::plainExecute(mkldnn::stream strm) { if (noTiling) { return; } - auto& srcMemory = getParentEdgeAt(0)->getMemory(); + auto& srcMemory = getParentEdgeAt(TILE_INPUT)->getMemory(); const uint8_t* src_ptr = reinterpret_cast(srcMemory.GetPtr()); uint8_t* dst_ptr = reinterpret_cast(getChildEdgeAt(0)->getMemory().GetPtr()); @@ -122,14 +171,23 @@ void MKLDNNTileNode::execute(mkldnn::stream strm) { int m_inner_dim = 1; int m_outer_dim = 1; auto inDims = srcMemory.getStaticDims(); - for (int i=0; i < axis; i++ ) m_outer_dim *= inDims[i]; - for (int i=axis; i < inDims.size(); i++ ) m_inner_dim *= inDims[i]; + for (int i = 0; i < axis; i++ ) + m_outer_dim *= inDims[i]; + for (int i = axis; i < inDims.size(); i++ ) + m_inner_dim *= inDims[i]; + + int MB = 0; + if (isDynamicNode()) { + MB = srcMemory.getStaticDims()[0]; + } else { + MB = batchToProcess(); + } if (axis > 0) { m_outer_dim /= inDims[0]; - m_outer_dim *= batchToProcess(); + m_outer_dim *= MB; } else { m_inner_dim /= inDims[0]; - m_inner_dim *= batchToProcess(); + m_inner_dim *= MB; } if (m_inner_dim == 1 && m_outer_dim % 8 == 0 && srcMemory.getDesc().hasLayoutType(LayoutType::nCsp8c)) { diff --git a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_tile_node.h b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_tile_node.h index 2eeb96ae3d8..b973a3a27c9 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_tile_node.h +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_tile_node.h @@ -4,31 +4,43 @@ #pragma once -#include -#include +#include "common/tile_broadcast_utils.h" + #include namespace MKLDNNPlugin { -class MKLDNNTileNode : public MKLDNNNode { +class MKLDNNTileNode : public MKLDNNNode, public TileBroadcastCommon { public: - MKLDNNTileNode(const std::shared_ptr& op, const mkldnn::engine& eng, MKLDNNWeightsSharing::Ptr &cache); + MKLDNNTileNode(const std::shared_ptr& op, const mkldnn::engine& eng, MKLDNNWeightsSharing::Ptr &cache); void getSupportedDescriptors() override; void initSupportedPrimitiveDescriptors() override; void createPrimitive() override; void execute(mkldnn::stream strm) override; + void executeDynamicImpl(mkldnn::stream strm) override { + execute(strm); + } bool created() const override; - static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; + static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; + +protected: + bool needPrepareParams() const override; + void prepareParams() override; + bool needShapeInfer() const override; + std::vector shapeInfer() const override; private: - static const size_t TILE_INPUT = 0; - static const size_t TILE_REPEATS = 1; + void plainExecute(mkldnn::stream strm); + + static constexpr size_t TILE_INPUT = 0lu; + static constexpr size_t TILE_REPEATS = 1lu; int axis = -1; int tiles = 0; bool noTiling = false; + VectorDims originRepeats; std::string errorPrefix; }; diff --git a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_topk_node.cpp b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_topk_node.cpp index ffef15396cd..c1d200f79c3 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_topk_node.cpp +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_topk_node.cpp @@ -4,6 +4,8 @@ #include +#include +#include #include #include "ie_parallel.hpp" #include "mkldnn_topk_node.h" @@ -18,10 +20,6 @@ using namespace InferenceEngine; bool MKLDNNTopKNode::isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept { try { - if (isDynamicNgraphNode(op)) { - errorMessage = "Doesn't support op with dynamic shapes"; - return false; - } const auto topKOp = ngraph::as_type_ptr(op); if (!topKOp) { errorMessage = "Node is not an instance of the TopK from the operations set v1 or v3"; @@ -52,36 +50,9 @@ MKLDNNTopKNode::MKLDNNTopKNode(const std::shared_ptr& op, const mk } auto topK1Op = ngraph::as_type_ptr(op); - VectorDims dstDims = topK1Op->get_output_shape(TOPK_VALUE); - src_dims = topK1Op->get_input_shape(TOPK_DATA); - axis = topK1Op->get_axis(); - - if (topK1Op->get_mode() == ngraph::op::TopKMode::MAX) - mode_max = true; - else - mode_max = false; - - if (topK1Op->get_sort_type() == ngraph::op::TopKSortType::SORT_VALUES) - sort_value = true; - else - sort_value = false; - - int j; - for (j = src_dims.size() - 1; j >= 0; j--) { - if (src_dims[j] != 1) break; - } - if (static_cast(j) == axis) is_last_dim = true; - - for (size_t i = 0; i < axis; i++) { - axis_step *= src_dims[i]; - } - axis_dim = src_dims[axis]; - for (size_t i = (axis + 1); i < src_dims.size(); i++) { - axis_stride *= src_dims[i]; - } - dim = static_cast(src_dims[axis]); - before_num = count(src_dims, 0, axis); + mode_max = topK1Op->get_mode() == ngraph::op::TopKMode::MAX; + sort_value = topK1Op->get_sort_type() == ngraph::op::TopKSortType::SORT_VALUES; } void MKLDNNTopKNode::initSupportedPrimitiveDescriptors() { @@ -134,11 +105,23 @@ void MKLDNNTopKNode::execute(mkldnn::stream strm) { IE_THROW() << errorMsg; } - if (src_dims[axis] < static_cast(src_k)) - src_k = src_dims[axis]; - const VectorDims& in_dims = getParentEdgeAt(TOPK_DATA)->getMemory().getStaticDims(); + if (in_dims[axis] < static_cast(src_k)) + src_k = in_dims[axis]; + + bool is_last_dim = false; + for (int j = in_dims.size() - 1; j >= 0; j--) { + if (in_dims[j] != 1) { + if (static_cast(j) == axis) + is_last_dim = true; + break; + } + } + + dim = static_cast(in_dims[axis]); + before_num = count(in_dims, 0, axis); + if (src_k == 1) { if (is_last_dim) { if (mode_max) @@ -170,6 +153,49 @@ bool MKLDNNTopKNode::created() const { return getType() == TopK; } +bool MKLDNNTopKNode::needPrepareParams() const { + return false; +} + +void MKLDNNTopKNode::executeDynamicImpl(mkldnn::stream strm) { + return execute(strm); +} + +void MKLDNNTopKNode::createPrimitive() { + if (inputShapesDefined()) { + updateLastInputDims(); + } +} + +bool MKLDNNTopKNode::needShapeInfer() const { + const int kValue = reinterpret_cast(getParentEdgeAt(TOPK_K)->getMemoryPtr()->GetPtr())[0]; + return inputShapesModified() || kValue != src_k; +} + +std::vector MKLDNNTopKNode::shapeInfer() const { + if (dynamic_cast(opToShapeInfer->get_input_node_ptr(1))) { + return MKLDNNNode::shapeInfer(); + } + + opToShapeInfer->get_input_tensor(0).set_partial_shape(getParentEdgesAtPort(0)[0]->getMemory().getDesc().getShape().toPartialShape()); + + const auto& kMemory = getParentEdgesAtPort(1)[0]->getMemory(); + const auto ngPrecision = InferenceEngine::details::convertPrecision(kMemory.getDesc().getPrecision()); + const auto kConst = ngraph::opset1::Constant::create(ngPrecision, VectorDims{}, kMemory.GetPtr()); + + const auto localShapeInferOp = opToShapeInfer->clone_with_new_inputs({ opToShapeInfer->input_value(0), kConst }); + localShapeInferOp->validate_and_infer_types(); + + std::vector newOutputShapes(outputShapes.size()); + for (size_t i = 0; i < newOutputShapes.size(); ++i) { + const auto& pShape = localShapeInferOp->get_output_partial_shape(i); + if (pShape.is_dynamic()) + IE_THROW(NotImplemented) << "CPU plug-in doesn't support default shape infer for nodes with internal dynamism"; + newOutputShapes[i] = pShape.get_shape(); + } + return newOutputShapes; +} + template class Compare2> void MKLDNNTopKNode::top1_axis(const float* src_data, float* dst_data, int* dst_idx, VectorDims in_dims) { int after_num = count(in_dims, axis + 1, in_dims.size()); diff --git a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_topk_node.h b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_topk_node.h index 3cf879f4338..83773eb7eec 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_topk_node.h +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_topk_node.h @@ -16,15 +16,16 @@ public: MKLDNNWeightsSharing::Ptr &cache); void getSupportedDescriptors() override {}; - void initSupportedPrimitiveDescriptors() override; - - void createPrimitive() override {}; - + void createPrimitive() override; void execute(mkldnn::stream strm) override; - bool created() const override; + bool needPrepareParams() const override; + void executeDynamicImpl(mkldnn::stream strm) override; + bool needShapeInfer() const override; + std::vector shapeInfer() const override; + static bool isSupportedOperation(const std::shared_ptr &op, std::string &errorMessage) noexcept; #if defined(HAVE_AVX512F) @@ -85,12 +86,7 @@ private: const size_t TOPK_VALUE = 0; const size_t TOPK_INDEX = 1; - InferenceEngine::SizeVector src_dims; size_t axis; - size_t axis_dim; - size_t axis_stride = 1; - size_t axis_step = 1; - bool is_last_dim = false; int src_k = 1; bool sort_value = false; diff --git a/inference-engine/src/mkldnn_plugin/utils/ngraph_utils.hpp b/inference-engine/src/mkldnn_plugin/utils/ngraph_utils.hpp index 964b2e17015..08ae121a7db 100644 --- a/inference-engine/src/mkldnn_plugin/utils/ngraph_utils.hpp +++ b/inference-engine/src/mkldnn_plugin/utils/ngraph_utils.hpp @@ -10,7 +10,7 @@ namespace MKLDNNPlugin { -inline std::string getRTInfoValue(const std::map>& rtInfo, std::string paramName) { +inline std::string getRTInfoValue(const std::map& rtInfo, std::string paramName) { auto it = rtInfo.find(paramName); if (it != rtInfo.end()) { auto value = std::dynamic_pointer_cast>(it->second); diff --git a/inference-engine/src/mkldnn_plugin/utils/rt_info/memory_formats_attribute.cpp b/inference-engine/src/mkldnn_plugin/utils/rt_info/memory_formats_attribute.cpp index 91ae496d918..5dca9699645 100644 --- a/inference-engine/src/mkldnn_plugin/utils/rt_info/memory_formats_attribute.cpp +++ b/inference-engine/src/mkldnn_plugin/utils/rt_info/memory_formats_attribute.cpp @@ -11,15 +11,28 @@ using namespace ngraph; using namespace ov; -template class ov::MLKDNNMemoryFormatsHelper; +MLKDNNInputMemoryFormats::~MLKDNNInputMemoryFormats() = default; std::string ngraph::getMLKDNNInputMemoryFormats(const std::shared_ptr& node) { - return MLKDNNMemoryFormatsHelper::getMemoryFormats(node); + auto it_info = node->get_rt_info().find(MLKDNNInputMemoryFormatsAttr); + if (it_info != node->get_rt_info().end()) { + if (auto ptr = it_info->second.as>()) { + return ptr->getMemoryFormats(); + } + } + return {}; } -template class ov::MLKDNNMemoryFormatsHelper; +MLKDNNOutputMemoryFormats::~MLKDNNOutputMemoryFormats() = default; std::string ngraph::getMLKDNNOutputMemoryFormats(const std::shared_ptr& node) { - return MLKDNNMemoryFormatsHelper::getMemoryFormats(node); + auto it_info = node->get_rt_info().find(MLKDNNOutputMemoryFormatsAttr); + if (it_info != node->get_rt_info().end()) { + if (auto ptr = it_info->second.as>()) { + return ptr->getMemoryFormats(); + } + } + return {}; } + diff --git a/inference-engine/src/mkldnn_plugin/utils/rt_info/memory_formats_attribute.hpp b/inference-engine/src/mkldnn_plugin/utils/rt_info/memory_formats_attribute.hpp index cdd47e604e1..c2e7498bb58 100644 --- a/inference-engine/src/mkldnn_plugin/utils/rt_info/memory_formats_attribute.hpp +++ b/inference-engine/src/mkldnn_plugin/utils/rt_info/memory_formats_attribute.hpp @@ -15,7 +15,8 @@ namespace ngraph { constexpr const char *MLKDNNInputMemoryFormatsAttr = "MLKDNNInputMemoryFormats"; constexpr const char *MLKDNNOutputMemoryFormatsAttr = "MLKDNNOutputMemoryFormats"; -class MLKDNNMemoryFormats { +template +class MLKDNNMemoryFormats : public Variant { protected: std::string memory_format; @@ -23,82 +24,54 @@ public: MLKDNNMemoryFormats() = default; explicit MLKDNNMemoryFormats(const std::string &_memory_format) : memory_format(_memory_format) {} std::string getMemoryFormats() const { return memory_format; } -}; - -class MLKDNNInputMemoryFormats : public MLKDNNMemoryFormats { -public: - MLKDNNInputMemoryFormats() = default; - explicit MLKDNNInputMemoryFormats(const std::string &_memory_format) : MLKDNNMemoryFormats(_memory_format) {} -}; - -std::string getMLKDNNInputMemoryFormats(const std::shared_ptr& node); - -class MLKDNNOutputMemoryFormats : public MLKDNNMemoryFormats { -public: - MLKDNNOutputMemoryFormats() = default; - explicit MLKDNNOutputMemoryFormats(const std::string &_memory_format) : MLKDNNMemoryFormats(_memory_format) {} -}; -std::string getMLKDNNOutputMemoryFormats(const std::shared_ptr& node); - -} // namespace ngraph - -namespace ov { -template -class MLKDNNMemoryFormatsHelper : public VariantImpl { -public: - MLKDNNMemoryFormatsHelper(const MemoryFormatsType& value) : VariantImpl(value) {} - - static std::string getMemoryFormats(const std::shared_ptr& node) { - const auto &rtInfo = node->get_rt_info(); - using MemoryFormatsWrapper = VariantWrapper; - if (!rtInfo.count(MemoryFormatsWrapper::get_type_info_static().name)) return ""; - const auto &attr = rtInfo.at(MemoryFormatsWrapper::get_type_info_static().name); - MemoryFormatsType mem_format = ngraph::as_type_ptr(attr)->get(); - return mem_format.getMemoryFormats(); - } - - std::shared_ptr merge(const ngraph::NodeVector & nodes) override { + ov::Any merge(const ngraph::NodeVector & nodes) override { std::set unique_mem_format; for (auto &node : nodes) { - std::string mem_format = getMemoryFormats(node); - if (!mem_format.empty()) unique_mem_format.insert(mem_format); + auto it_info = node->get_rt_info().find(MemoryFormat::get_type_info_static().name); + if (it_info != node->get_rt_info().end()) { + if (auto ptr = it_info->second.template as>()) { + std::string mem_format = ptr->getMemoryFormats(); + if (!mem_format.empty()) { + unique_mem_format.insert(mem_format); + } + } + } } if (unique_mem_format.size() > 1) { - throw ngraph::ngraph_error(std::string(VariantWrapper::get_type_info_static().name) + " no rule defined for multiple values."); + throw ngraph::ngraph_error( + std::string(MemoryFormat::get_type_info_static().name) + + " no rule defined for multiple values."); } std::string final_mem_format; if (unique_mem_format.size() == 1) { final_mem_format = *unique_mem_format.begin(); } - return std::make_shared>(MemoryFormatsType(final_mem_format)); - } - - std::shared_ptr init(const std::shared_ptr & node) override { - throw ngraph::ngraph_error(std::string(VariantWrapper::get_type_info_static().name) + " has no default initialization."); + return std::make_shared(final_mem_format); } }; -extern template class MLKDNNMemoryFormatsHelper; -template<> -class VariantWrapper : public MLKDNNMemoryFormatsHelper { + +class MLKDNNInputMemoryFormats : public MLKDNNMemoryFormats { public: - OPENVINO_RTTI(ngraph::MLKDNNInputMemoryFormatsAttr); - - VariantWrapper(const ngraph::MLKDNNInputMemoryFormats &value) : MLKDNNMemoryFormatsHelper(value) {} + OPENVINO_RTTI(MLKDNNInputMemoryFormatsAttr); + MLKDNNInputMemoryFormats() = default; + explicit MLKDNNInputMemoryFormats(const std::string &_memory_format) : MLKDNNMemoryFormats(_memory_format) {} + ~MLKDNNInputMemoryFormats() override; }; -extern template class MLKDNNMemoryFormatsHelper; +std::string getMLKDNNInputMemoryFormats(const std::shared_ptr& node); -template<> -class VariantWrapper : public MLKDNNMemoryFormatsHelper { +class MLKDNNOutputMemoryFormats : public MLKDNNMemoryFormats { public: - OPENVINO_RTTI(ngraph::MLKDNNOutputMemoryFormatsAttr); - - VariantWrapper(const ngraph::MLKDNNOutputMemoryFormats &value) : MLKDNNMemoryFormatsHelper(value) {} + OPENVINO_RTTI(MLKDNNOutputMemoryFormatsAttr); + MLKDNNOutputMemoryFormats() = default; + explicit MLKDNNOutputMemoryFormats(const std::string &_memory_format) : MLKDNNMemoryFormats(_memory_format) {} + ~MLKDNNOutputMemoryFormats() override; }; +std::string getMLKDNNOutputMemoryFormats(const std::shared_ptr& node); -} // namespace ov +} // namespace ngraph diff --git a/inference-engine/src/multi_device/CMakeLists.txt b/inference-engine/src/multi_device/CMakeLists.txt index 5018ebcad2c..a23919651e2 100644 --- a/inference-engine/src/multi_device/CMakeLists.txt +++ b/inference-engine/src/multi_device/CMakeLists.txt @@ -4,12 +4,11 @@ set (TARGET_NAME "MultiDevicePlugin") -file(GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) -file(GLOB HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp) +file(GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp ${CMAKE_CURRENT_SOURCE_DIR}/utils/*.cpp) ie_add_plugin(NAME ${TARGET_NAME} DEVICE_NAME "MULTI" - SOURCES ${SOURCES} ${HEADERS} + SOURCES ${SOURCES} VERSION_DEFINES_FOR multi_device_plugin.cpp) ie_add_plugin(NAME ${TARGET_NAME} diff --git a/inference-engine/src/multi_device/multi_device_exec_network.cpp b/inference-engine/src/multi_device/multi_device_exec_network.cpp index d35e4fffc0e..ef08869b7f4 100644 --- a/inference-engine/src/multi_device/multi_device_exec_network.cpp +++ b/inference-engine/src/multi_device/multi_device_exec_network.cpp @@ -20,6 +20,7 @@ #include "ngraph/opsets/opset1.hpp" #include "transformations/utils/utils.hpp" +#include "utils/log_util.hpp" #include "multi_itt.hpp" // ------------------------------MultiDeviceExecutableNetwork---------------------------- @@ -167,6 +168,7 @@ MultiDeviceExecutableNetwork::MultiDeviceExecutableNetwork(const std::string& _loadContext[ACTUALDEVICE].networkPrecision = GetNetworkPrecision(network); _loadContext[ACTUALDEVICE].metaDevices = metaDevices; _loadContext[ACTUALDEVICE].deviceInfo = _multiPlugin->SelectDevice(metaDevices, _loadContext[ACTUALDEVICE].networkPrecision); + LOG_INFO("[AUTOPLUGIN]:select device:%s", _loadContext[ACTUALDEVICE].deviceInfo.deviceName.c_str()); bool isActualDevCPU = _loadContext[ACTUALDEVICE].deviceInfo.deviceName.find("CPU") != std::string::npos; // if Actual device is CPU, disabled _loadContext[CPU], only use _loadContext[ACTUALDEVICE] @@ -179,6 +181,7 @@ MultiDeviceExecutableNetwork::MultiDeviceExecutableNetwork(const std::string& if (CPUIter != metaDevices.end()) { _loadContext[CPU].isEnabled = true; _loadContext[CPU].deviceInfo = *CPUIter; + LOG_INFO("[AUTOPLUGIN]:will load CPU for accelerator"); } else { _loadContext[CPU].isEnabled = false; } @@ -201,6 +204,21 @@ MultiDeviceExecutableNetwork::MultiDeviceExecutableNetwork(const std::string& contextPtr->deviceInfo.config.end()); } contextPtr->isAlready = true; + auto& deviceName = contextPtr->deviceInfo.deviceName; + LOG_INFO("[AUTOPLUGIN]:device:%s loading Network finished", + deviceName.c_str()); + std::vector supported_config_keys = + _core->GetMetric(deviceName, METRIC_KEY(SUPPORTED_CONFIG_KEYS)); + // there is log mutex in LOG_DEBUG, add _configMutex just want to print them all together + // toDo maybe neet to implement LOG_RUN(task, LOG_LEVEL) to run some debug code. + std::lock_guard lock(_confMutex); + for (const auto& cfg : supported_config_keys) { + try { + LOG_DEBUG("[AUTOPLUGIN]:device:%s, GetConfig:%s=%s", deviceName.c_str(), + cfg.c_str(), contextPtr->executableNetwork->GetConfig(cfg).as().c_str()); + } catch (...) { + } + } } contextPtr->promise.set_value(); // the first load network process finished @@ -290,6 +308,7 @@ void MultiDeviceExecutableNetwork::TryToLoadNetWork(AutoLoadContext& context, return; } + LOG_DEBUG("[AUTOPLUGIN] try to load %s", context.deviceInfo.deviceName.c_str()); // try to load this candidate device TryToLoadNetWork(context, modelPath, network); } @@ -318,8 +337,14 @@ void MultiDeviceExecutableNetwork::WaitFirstNetworkReady() { } } - // ToDo need to print failed error mesage - IE_THROW() << "[AUTO] load all devices failed"; + //print errMessage + for (int i = CONTEXTNUM - 1; i >= 0; i--) { + if (_loadContext[i].isEnabled) { + LOG_ERROR("[AUTOPLUGIN] load failed, %s", _loadContext[i].errMessage.c_str()); + } + } + + IE_THROW() << "[AUTOPLUGIN] load all devices failed"; } void MultiDeviceExecutableNetwork::WaitActualNetworkReady() const { @@ -336,7 +361,7 @@ void MultiDeviceExecutableNetwork::WaitActualNetworkReady() const { _loadContext[ACTUALDEVICE].deviceInfo = _loadContext[CPU].deviceInfo; _loadContext[ACTUALDEVICE].isAlready = true; } - }); + }); } void MultiDeviceExecutableNetwork::ScheduleToWorkerInferRequest(Task inferPipelineTask, DeviceName preferred_device) { @@ -352,6 +377,7 @@ void MultiDeviceExecutableNetwork::ScheduleToWorkerInferRequest(Task inferPipeli } devices.push_back(_loadContext[ACTUALDEVICE].deviceInfo); } else { + // _acceleratorDevice could be the same as _cpuDevice, such as AUTO:CPU if (_loadContext[ACTUALDEVICE].isAlready) { devices.push_back(_loadContext[ACTUALDEVICE].deviceInfo); } else { diff --git a/inference-engine/src/multi_device/multi_device_plugin.cpp b/inference-engine/src/multi_device/multi_device_plugin.cpp index 8fc3fc7a621..95a421b2764 100644 --- a/inference-engine/src/multi_device/multi_device_plugin.cpp +++ b/inference-engine/src/multi_device/multi_device_plugin.cpp @@ -165,6 +165,7 @@ void MultiDeviceInferencePlugin::SetConfig(const std::map filterConfig; CheckConfig(config, needPerfCounters, filterConfig); + for (auto && kvp : config) { const auto& name = kvp.first; _config[name] = kvp.second; @@ -259,6 +260,8 @@ IExecutableNetworkInternal::Ptr MultiDeviceInferencePlugin::LoadNetworkImpl(cons for (auto& config : configs) { if (std::find(validConfigKey.begin(), validConfigKey.end(), config.first) != validConfigKey.end()) { deviceConfig.insert({config.first, config.second}); + LOG_INFO("[AUTOPLUGIN]:device:%s, config:%s=%s", iter->deviceName.c_str(), + config.first.c_str(), config.second.c_str()); } } iter->config = deviceConfig; @@ -519,6 +522,7 @@ std::string MultiDeviceInferencePlugin::GetDeviceList(const std::map& config, bool& needPerfCounters, std::map& filterConfig) { // TODO need to optimize this code, too much duplicated code + const auto perf_hints_configs = PerfHintsConfig::SupportedKeys(); for (auto&& kvp : config) { if (kvp.first.find("AUTO_") == 0) { @@ -541,6 +545,12 @@ void MultiDeviceInferencePlugin::CheckConfig(const std::map #include #include "multi_device_exec_network.hpp" +#include "utils/log_util.hpp" #ifdef MULTIUNITTEST #define MOCKTESTMACRO virtual diff --git a/inference-engine/src/multi_device/utils/log.cpp b/inference-engine/src/multi_device/utils/log.cpp new file mode 100644 index 00000000000..8b2a094878b --- /dev/null +++ b/inference-engine/src/multi_device/utils/log.cpp @@ -0,0 +1,11 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#include "log.hpp" + +namespace MultiDevicePlugin { +uint32_t Log::defaultLogLevel = static_cast(LogLevel::LOG_NONE); +} // namespace MultiDevicePlugin diff --git a/inference-engine/src/multi_device/utils/log.hpp b/inference-engine/src/multi_device/utils/log.hpp new file mode 100644 index 00000000000..02c0f1e2bc2 --- /dev/null +++ b/inference-engine/src/multi_device/utils/log.hpp @@ -0,0 +1,228 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +/////////////////////////////////////////////////////////////////////////////////////////////////// +#ifndef MULTIDEVICEPLUGIN_LOG_H +#define MULTIDEVICEPLUGIN_LOG_H + +#include +#include +#include +#include +#include + +#include "singleton.hpp" +#include "time_utils.hpp" +#include "thread_utils.hpp" + +#ifdef MULTIUNITTEST +#define MOCKTESTMACRO virtual +#define MultiDevicePlugin MockMultiDevicePlugin +#else +#define MOCKTESTMACRO +#endif + +#ifdef COLOR_LOG +#define COL(x) "\033[1;" #x ";40m" +#define COL_END "\033[0m" +#else +#define COL(x) "" +#define COL_END "" +#endif + +#define RED COL(31) +#define GREEN COL(32) +#define YELLOW COL(33) +#define BLUE COL(34) +#define MAGENTA COL(35) +#define CYAN COL(36) +#define WHITE COL(0) +#define DEFAULT_COLOR "" + +#ifdef ERROR +#undef ERROR +#endif + +namespace MultiDevicePlugin { +inline int parseInteger(const char* str) { + std::string var(str ? str : ""); + try { + return std::stoi(var); + } catch (...) { + return INT32_MAX; + } +} + +inline std::string getFileName(const std::string& filePath) { + auto index = filePath.find_last_of("/\\"); + if (std::string::npos == index) { + return filePath; + } + return filePath.substr(index + 1); +} + +inline int getDebugLevel() { + return parseInteger(std::getenv("OPENVINO_LOG_LEVEL")); +} +const int debug_level = getDebugLevel(); + +enum class LogLevel : uint32_t { + FREQUENT = 0x01, + PROCESS = 0x02, + DEBUG = 0x04, + INFO = 0x08, + WARN = 0x10, + ERROR = 0x40, + FATAL = 0x80, + LOG_NONE = 0, + LOG_FATAL = static_cast(LogLevel::FATAL), + LOG_ERROR = static_cast(LogLevel::ERROR) | static_cast(LogLevel::LOG_FATAL), + LOG_WARNING = static_cast(LogLevel::WARN) | static_cast(LogLevel::LOG_ERROR), + LOG_INFO = static_cast(LogLevel::INFO) | static_cast(LogLevel::LOG_WARNING), + LOG_DEBUG = static_cast(LogLevel::DEBUG) | static_cast(LogLevel::LOG_INFO), + LOG_TRACE = static_cast(LogLevel::PROCESS) | static_cast(LogLevel::LOG_DEBUG), + LOG_FREQUENT = static_cast(LogLevel::FREQUENT) | static_cast(LogLevel::LOG_TRACE) +}; + +class Log : public Singleton { +public: + void setPrefix(std::string prefix); + void setSuffix(std::string suffix); + void setLogLevel(LogLevel logLevel); + + template + void doLog(bool on, bool isTraceCallStack, LogLevel level, const char* levelStr, const char* file, + const char* func, long line, const char* tag, const char* fmt, Args... args); +#ifdef MULTIUNITTEST + Log(std::string unittest):Log() { + } +#endif + +private: + Log(); + friend Singleton; + static std::string colorBegin(LogLevel logLevel); + static std::string colorEnd(LogLevel logLevel); + MOCKTESTMACRO void print(std::stringstream& stream); + +private: + std::mutex mutex; + std::string logName; + std::string logPath; + std::string prefix; + std::string suffix; + uint32_t logLevel; + static uint32_t defaultLogLevel; +}; + +inline Log::Log() + : logLevel(defaultLogLevel) { + switch (debug_level) { + case 0: { + logLevel = static_cast(LogLevel::LOG_NONE); + break; + } + case 1: { + logLevel = static_cast(LogLevel::LOG_FATAL); + break; + } + case 2: { + logLevel = static_cast(LogLevel::LOG_ERROR); + break; + } + case 3: { + logLevel = static_cast(LogLevel::LOG_WARNING); + break; + } + case 4: { + logLevel = static_cast(LogLevel::LOG_INFO); + break; + } + case 5: { + logLevel = static_cast(LogLevel::LOG_DEBUG); + break; + } + case 6: { + logLevel = static_cast(LogLevel::LOG_TRACE); + break; + } + case 7: { + logLevel = static_cast(LogLevel::LOG_FREQUENT); + break; + } + default: + break; + } +} + +inline void Log::setPrefix(std::string prefix_) { + std::lock_guard autoLock(mutex); + prefix = std::move(prefix_); +} + +inline void Log::setSuffix(std::string suffix_) { + std::lock_guard autoLock(mutex); + suffix = std::move(suffix_); +} + +inline void Log::setLogLevel(LogLevel logLevel_) { + std::lock_guard autoLock(mutex); + logLevel = static_cast(logLevel_); +} + +inline void Log::print(std::stringstream& stream) { + std::cout << stream.str() << std::endl; +} +template +inline void Log::doLog(bool on, bool isTraceCallStack, LogLevel level, const char* levelStr, const char* file, + const char* func, const long line, const char* tag, const char* fmt, Args... args) { + + if (!(static_cast(level) & static_cast(logLevel)) || !on) { + return; + } + + std::stringstream stream; + stream << colorBegin(level) << prefix << '[' << TimeUtils::getCurrentTime() << ']'; + + stream << '[' << ThreadUtils::getThreadId() << ']'; + if (level < LogLevel::ERROR) { + stream << levelStr[0]; + } else { + stream << levelStr; + } + stream << '[' << getFileName(file) << ':' << line << ']'; + + if (isTraceCallStack) { + stream << '[' << func << '(' << ')' << ']'; + } + if (tag) { + stream << '[' << tag << ']'; + } + char buffer[255]; + std::string compatibleString = "%s" + std::string(fmt); + std::snprintf (&buffer[0], sizeof(buffer), compatibleString.c_str(), "", args...); + stream << ' ' << buffer << suffix << colorEnd(level); + std::lock_guard autoLock(mutex); + print(stream); +} + +inline std::string Log::colorBegin(MultiDevicePlugin::LogLevel logLevel) { + if (logLevel == LogLevel::WARN) { + return std::string(CYAN); + } + if (logLevel == LogLevel::ERROR || logLevel == LogLevel::FATAL) { + return std::string(RED); + } + return std::string(DEFAULT_COLOR); +} + +inline std::string Log::colorEnd(MultiDevicePlugin::LogLevel logLevel) { + if (logLevel == LogLevel::WARN || logLevel == LogLevel::ERROR || logLevel == LogLevel::FATAL) { + return std::string(COL_END); + } + return {}; +} +} // namespace MultiDevicePlugin + +#endif //MULTIDEVICEPLUGIN_LOG_H diff --git a/inference-engine/src/multi_device/utils/log_util.hpp b/inference-engine/src/multi_device/utils/log_util.hpp new file mode 100644 index 00000000000..42a8b717213 --- /dev/null +++ b/inference-engine/src/multi_device/utils/log_util.hpp @@ -0,0 +1,58 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +/////////////////////////////////////////////////////////////////////////////////////////////////// +#ifndef MULTIDEVICEPLUGIN_HLOG_H +#define MULTIDEVICEPLUGIN_HLOG_H + +#include + +#include "log.hpp" +#include + +#ifdef MULTIUNITTEST +#include "plugin/mock_log_utils.hpp" +#define MOCKTESTMACRO virtual +#define MultiDevicePlugin MockMultiDevicePlugin +#define HLogger MockMultiDevice::MockLog::GetInstance() +#else +#define MOCKTESTMACRO +#define HLogger MultiDevicePlugin::Log::instance() +#endif + + +#define HLogPrint(isOn, isTraceCallStack, logLevel, level, tag, ...) \ + HLogger->doLog(isOn, isTraceCallStack, logLevel, level, __FILE__, __func__, __LINE__, tag, __VA_ARGS__) + +// #define HFrequent(isOn, tag, ...) HLogPrint(isOn, MultiDevicePlugin::LogLevel::FREQUENT, "FREQ", tag, __VA_ARGS__) +// #define HFatal(...) HLogPrint(true, false, MultiDevicePlugin::LogLevel::FATAL, "FATAL", nullptr, __VA_ARGS__) +#define LOG_TRACE(isOn, tag, ...) HLogPrint(isOn, false, MultiDevicePlugin::LogLevel::PROCESS, "PROC", tag, __VA_ARGS__) +#define LOG_DEBUG(...) HLogPrint(true, false, MultiDevicePlugin::LogLevel::DEBUG, "DEBUG", nullptr, __VA_ARGS__) +#define LOG_INFO(...) HLogPrint(true, false, MultiDevicePlugin::LogLevel::INFO, "INFO", nullptr, __VA_ARGS__) +#define LOG_WARNING(...) HLogPrint(true, false, MultiDevicePlugin::LogLevel::WARN, "WARN", nullptr, __VA_ARGS__) +#define LOG_ERROR(...) HLogPrint(true, false, MultiDevicePlugin::LogLevel::ERROR, "ERROR", nullptr, __VA_ARGS__) + +#define TraceCallStacks(...) HLogPrint(true, true, MultiDevicePlugin::LogLevel::DEBUG, "DEBUG", nullptr, __VA_ARGS__) +#define TraceCallStack() TraceCallStacks(" ") + +namespace MultiDevicePlugin { +inline bool setLogLevel(std::string logLevel) { + static std::map logValueMap = {{CONFIG_VALUE(LOG_NONE), LogLevel::LOG_NONE}, + {CONFIG_VALUE(LOG_ERROR), LogLevel::LOG_ERROR}, + {CONFIG_VALUE(LOG_WARNING), LogLevel::LOG_WARNING}, + {CONFIG_VALUE(LOG_INFO), LogLevel::LOG_INFO}, + {CONFIG_VALUE(LOG_DEBUG), LogLevel::LOG_DEBUG}, + {CONFIG_VALUE(LOG_TRACE), LogLevel::LOG_TRACE}}; + auto it = logValueMap.find(logLevel); + if (it != logValueMap.end()) { + HLogger->setLogLevel(it->second); + return true; + } else { + return false; + } +} + +} // namespace MultiDevicePlugin + +#endif //MULTIDEVICEPLUGIN_HLOG_H diff --git a/inference-engine/src/multi_device/utils/non_copyable.hpp b/inference-engine/src/multi_device/utils/non_copyable.hpp new file mode 100644 index 00000000000..dfe4dbbe629 --- /dev/null +++ b/inference-engine/src/multi_device/utils/non_copyable.hpp @@ -0,0 +1,32 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef MULTIDEVICEPLUGIN_NONCOPYABLE_H +#define MULTIDEVICEPLUGIN_NONCOPYABLE_H + +#ifdef MULTIUNITTEST +#define MOCKTESTMACRO virtual +#define MultiDevicePlugin MockMultiDevicePlugin +#else +#define MOCKTESTMACRO +#endif + +namespace MultiDevicePlugin { +class NonCopyable { +public: + NonCopyable(const NonCopyable&) = delete; + NonCopyable(NonCopyable&&) = delete; + + NonCopyable& operator=(const NonCopyable&) = delete; + NonCopyable& operator=(NonCopyable&&) = delete; + +protected: + NonCopyable() = default; + virtual ~NonCopyable() = default; +}; +} // namespace MultiDevicePlugin + +#endif //MULTIDEVICEPLUGIN_NONCOPYABLE_H diff --git a/inference-engine/src/multi_device/utils/singleton.hpp b/inference-engine/src/multi_device/utils/singleton.hpp new file mode 100644 index 00000000000..e4f0b046cd5 --- /dev/null +++ b/inference-engine/src/multi_device/utils/singleton.hpp @@ -0,0 +1,47 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef MULTIDEVICEPLUGIN_SINGLETON_H +#define MULTIDEVICEPLUGIN_SINGLETON_H +#include +#include +#include +#include + +#include "non_copyable.hpp" + +#ifdef MULTIUNITTEST +#define MOCKTESTMACRO virtual +#define MultiDevicePlugin MockMultiDevicePlugin +#else +#define MOCKTESTMACRO +#endif + +namespace MultiDevicePlugin { +template +class Singleton : public NonCopyable { +public: + static std::shared_ptr& instance() { + static std::shared_ptr obj; + std::call_once(m_onceFlag, [&]() { + auto* objPtr = new Type(); + assert(objPtr!= nullptr); + obj.reset(objPtr); + }); + return obj; + } + +protected: + static std::once_flag m_onceFlag; + Singleton() = default; + virtual ~Singleton() = default; +}; + +template +std::once_flag Singleton::m_onceFlag; +} // namespace MultiDevicePlugin + +#endif //MULTIDEVICEPLUGIN_SINGLETON_H diff --git a/inference-engine/src/multi_device/utils/thread_utils.cpp b/inference-engine/src/multi_device/utils/thread_utils.cpp new file mode 100644 index 00000000000..970decb28b8 --- /dev/null +++ b/inference-engine/src/multi_device/utils/thread_utils.cpp @@ -0,0 +1,107 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#include +#include + +#include "thread_utils.hpp" +#include + +namespace MultiDevicePlugin { +namespace ThreadUtils { +void setName(const std::string& name) { + setName(name.c_str()); +} + +std::string getName() { + char threadName[32] = { '\0' }; + getName(threadName, 32); + return threadName; +} + +void saveThreadInfo(const std::string& threadName, const std::string& saveFile) { + static std::mutex mutex; + static uint32_t threadCount = 0; + + std::lock_guard autoLock(mutex); + + std::ofstream stream; + if (!threadCount) { + stream.open(saveFile, std::ios::out | std::ios::trunc); + } else { + stream.open(saveFile, std::ios::out | std::ios::app); + } + + stream << "[" << std::setw(2) << std::setfill('0') << threadCount++ << "]" + << " threadId=" << getThreadId() << " threadName=" << threadName << std::endl; +} + +#if (defined(_WIN32) || defined(_WIN64)) +DWORD getThreadId() { + return GetCurrentThreadId(); +} + +static void setThreadName(DWORD dwThreadID, const char* threadName) { + HANDLE handle = OpenThread(THREAD_SET_LIMITED_INFORMATION, true, dwThreadID); + auto len = MultiByteToWideChar(CP_ACP, 0, threadName, static_cast(strlen(threadName)), NULL, 0); + PWSTR threadDesc = new WCHAR[len + 1]; + MultiByteToWideChar(CP_ACP, 0, threadName, static_cast(strlen(threadName)), threadDesc, len); + threadDesc[len] = '\0'; + SetThreadDescription(handle, threadDesc); + delete[] threadDesc; + CloseHandle(handle); +} + +void setName(const char* pname) { + setThreadName(GetCurrentThreadId(), pname); +} + +void getName(char* name, size_t size) { + HANDLE handle = OpenThread(THREAD_QUERY_LIMITED_INFORMATION, true, GetCurrentThreadId()); + PWSTR threadDesc; + if (SUCCEEDED(GetThreadDescription(handle, &threadDesc))) { + auto len = WideCharToMultiByte(CP_ACP, 0, threadDesc, static_cast(wcslen(threadDesc)), NULL, 0, NULL, NULL); + if (len < size) { + WideCharToMultiByte(CP_ACP, 0, threadDesc, static_cast(wcslen(threadDesc)), name, len, NULL, NULL); + name[len] = '\0'; + } + LocalFree(threadDesc); + } + CloseHandle(handle); +} +#elif defined(__linux__) +long getThreadId() { + return syscall(SYS_gettid); +} + +void setName(const char* pname) { + prctl(PR_SET_NAME, pname); +} + +void getName(char* name, size_t size) { + if (name && size >= 16) { + prctl(PR_GET_NAME, name); + } +} + +#elif defined(__APPLE__) +long getThreadId() { + return (long)pthread_self(); +} + +void setName(const char* pname) { + pthread_setname_np(pname); +} + +void getName(char* name, size_t size) { + pthread_getname_np(pthread_self(), name, size); +} + +#else +#endif +} // namespace ThreadUtils +} // namespace MultiDevicePlugin + diff --git a/inference-engine/src/multi_device/utils/thread_utils.hpp b/inference-engine/src/multi_device/utils/thread_utils.hpp new file mode 100644 index 00000000000..e22fa974015 --- /dev/null +++ b/inference-engine/src/multi_device/utils/thread_utils.hpp @@ -0,0 +1,63 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +/////////////////////////////////////////////////////////////////////////////////////////////////// +#ifndef MULTIDEVICEPLUGIN_THREADUTILS_H +#define MULTIDEVICEPLUGIN_THREADUTILS_H + +#include +#include + +#ifdef MULTIUNITTEST +#define MOCKTESTMACRO virtual +#define MultiDevicePlugin MockMultiDevicePlugin +#else +#define MOCKTESTMACRO +#endif + +#if (defined(_WIN32) || defined(_WIN64)) +#include +#include +#include +namespace MultiDevicePlugin { +namespace ThreadUtils { +DWORD getThreadId(); +} // namespace ThreadUtils +#elif defined(__linux__) +#include +#include +#include +#include +namespace MultiDevicePlugin { +namespace ThreadUtils { +long getThreadId(); +} // namespace ThreadUtils +#elif defined(__APPLE__) +#include +#include +namespace MultiDevicePlugin { +namespace ThreadUtils { +long getThreadId(); +} // namespace ThreadUtils +#else +namespace MultiDevicePlugin { +namespace ThreadUtils { +long getThreadId(); +} // namespace ThreadUtils +#endif + + + +namespace ThreadUtils { +uint64_t getRdtsc(); +std::string getName(); + +void setName(const char* name); +void setName(const std::string& name); +void getName(char* name, size_t size); +void saveThreadInfo(const std::string& threadName, const std::string& saveFile = "threads.info"); +} // namespace ThreadUtils +} // namespace MultiDevicePlugin + +#endif //MULTIDEVICEPLUGIN_THREADUTILS_H diff --git a/inference-engine/src/multi_device/utils/time_utils.cpp b/inference-engine/src/multi_device/utils/time_utils.cpp new file mode 100644 index 00000000000..1ac43c57215 --- /dev/null +++ b/inference-engine/src/multi_device/utils/time_utils.cpp @@ -0,0 +1,74 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +/////////////////////////////////////////////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include "time_utils.hpp" + +namespace MultiDevicePlugin { +namespace TimeUtils { + +bool localtimeSafe(const time_t* time, struct tm* result) { + if (time && result) { +#if (defined(_WIN32) || defined(_WIN64)) + localtime_s(result, time); +#else + localtime_r(time, result); +#endif + return true; + } + return false; +} + +std::string putTime(std::chrono::system_clock::time_point tp, const char* format) { + struct tm t = {}; + time_t timeObj = std::chrono::system_clock::to_time_t(tp); + + localtimeSafe(&timeObj, &t); + + std::stringstream ss; + +#if (defined(__GNUC__) && (__GNUC__ < 5)) + char time_str[24]; + strftime(time_str, sizeof(time_str), format, &t); + ss << time_str; +#else + ss << std::put_time(&t, format); +#endif + + return ss.str(); +} + +std::string formatTimeMilli(std::chrono::system_clock::time_point tp) { + std::stringstream ss; + + auto milliseconds = (std::chrono::duration_cast(tp.time_since_epoch()).count() % 1000); + + ss << putTime(tp, "%T") << '.' << std::setfill('0') << std::setw(3) << milliseconds; + + return ss.str(); +} + +std::string getCurrentTime() { + std::stringstream ss; + +#ifdef VERBOSE_LOG + const char* timeFormat = "%F %T"; +#else + const char* timeFormat = "%T"; +#endif + + auto now = std::chrono::system_clock::now(); + + auto microseconds = (std::chrono::duration_cast(now.time_since_epoch()).count() % 1000000) / 100; + + ss << putTime(now, timeFormat) << '.' << std::setfill('0') << std::setw(4) << microseconds; + + return ss.str(); +} +} // namespace TimeUtils +} // namespace MultiDevicePlugin diff --git a/inference-engine/src/multi_device/utils/time_utils.hpp b/inference-engine/src/multi_device/utils/time_utils.hpp new file mode 100644 index 00000000000..6c2675d4de3 --- /dev/null +++ b/inference-engine/src/multi_device/utils/time_utils.hpp @@ -0,0 +1,58 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +/////////////////////////////////////////////////////////////////////////////////////////////////// +#ifndef MULTIDEVICEPLUGIN_TIMEUTILS_H +#define MULTIDEVICEPLUGIN_TIMEUTILS_H + +#include +#include +#include + +#ifdef MULTIUNITTEST +#define MOCKTESTMACRO virtual +#define MultiDevicePlugin MockMultiDevicePlugin +#else +#define MOCKTESTMACRO +#endif + +namespace MultiDevicePlugin { +namespace TimeUtils { +class StopWatch { +public: + explicit StopWatch(int seconds) { + m_start = std::chrono::steady_clock::now(); + m_deadline = m_start + std::chrono::seconds(seconds); + } + + void reset(int seconds) { + m_start = std::chrono::steady_clock::now(); + m_deadline = m_start + std::chrono::seconds(seconds); + } + + bool isExpired() const { + auto now = std::chrono::steady_clock::now(); + return now > m_deadline; + } + +private: + std::chrono::steady_clock::time_point m_start; + std::chrono::steady_clock::time_point m_deadline; +}; + +template +float getTimeDiffInMs(TimePoint tp1, TimePoint tp2) { + std::chrono::duration duration = (tp1 > tp2) ? tp1 - tp2 : tp2 - tp1; + return duration.count(); +} + +bool localtimeSafe(const time_t* time, struct tm* result); + +std::string getCurrentTime(); +std::string putTime(std::chrono::system_clock::time_point tp, const char* format); +std::string formatTimeMilli(std::chrono::system_clock::time_point tp); // format tp to HH:MM:SS.mmm +} // namespace TimeUtils +} // namespace MultiDevicePlugin + +#endif //MULTIDEVICEPLUGIN_TIMEUTILS_H diff --git a/inference-engine/src/readers/CMakeLists.txt b/inference-engine/src/readers/CMakeLists.txt deleted file mode 100644 index 29cd6e6c327..00000000000 --- a/inference-engine/src/readers/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright (C) 2018-2021 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 -# - -set(TARGET_NAME inference_engine_reader_api) - -# Reader API interface library -add_library(${TARGET_NAME} INTERFACE) - -target_include_directories(${TARGET_NAME} INTERFACE - $ - $) - -ov_install_static_lib(${TARGET_NAME} core) - -file(GLOB_RECURSE reader_api_hpp "${CMAKE_CURRENT_SOURCE_DIR}/reader_api/*.hpp") - -add_cpplint_target(${TARGET_NAME}_cpplint FOR_SOURCES ${reader_api_hpp}) - -if(ENABLE_IR_V7_READER) - add_subdirectory(ir_reader_v7) -endif() diff --git a/inference-engine/src/vpu/graph_transformer/include/vpu/model/data_contents/conv_weights_contents.hpp b/inference-engine/src/vpu/graph_transformer/include/vpu/model/data_contents/conv_weights_contents.hpp index b6360c45541..06da36d3bdc 100644 --- a/inference-engine/src/vpu/graph_transformer/include/vpu/model/data_contents/conv_weights_contents.hpp +++ b/inference-engine/src/vpu/graph_transformer/include/vpu/model/data_contents/conv_weights_contents.hpp @@ -14,7 +14,7 @@ namespace vpu { class ConvIm2ColWeightsContent final : public CalculatedDataContent { public: - explicit ConvIm2ColWeightsContent(const DataContent::Ptr& origContent, DataDesc desc); + explicit ConvIm2ColWeightsContent(const DataContent::Ptr& origContent, const DataDesc& desc); size_t byteSize() const override; @@ -32,7 +32,7 @@ private: class Conv3x3WeightsContent final : public CalculatedDataContent { public: - explicit Conv3x3WeightsContent(const DataContent::Ptr& origContent, DataDesc desc); + explicit Conv3x3WeightsContent(const DataContent::Ptr& origContent, const DataDesc& desc); size_t byteSize() const override; @@ -50,7 +50,7 @@ private: class ConvCHWWeightsContent final : public CalculatedDataContent { public: - explicit ConvCHWWeightsContent(const DataContent::Ptr& origContent, DataDesc desc); + explicit ConvCHWWeightsContent(const DataContent::Ptr& origContent, const DataDesc& desc); size_t byteSize() const override; diff --git a/inference-engine/src/vpu/graph_transformer/include/vpu/model/data_contents/deconvolution_contents.hpp b/inference-engine/src/vpu/graph_transformer/include/vpu/model/data_contents/deconvolution_contents.hpp index e0f6e81f912..7797ef2c43d 100644 --- a/inference-engine/src/vpu/graph_transformer/include/vpu/model/data_contents/deconvolution_contents.hpp +++ b/inference-engine/src/vpu/graph_transformer/include/vpu/model/data_contents/deconvolution_contents.hpp @@ -78,7 +78,7 @@ class DeconvolutionWeightsContent final : public CalculatedDataContent { public: DeconvolutionWeightsContent( const DataContent::Ptr& origContent, - DataDesc desc, + const DataDesc& desc, int KX, int KY, int IC, int OC); diff --git a/inference-engine/src/vpu/graph_transformer/src/model/data_contents/conv_weights_contents.cpp b/inference-engine/src/vpu/graph_transformer/src/model/data_contents/conv_weights_contents.cpp index 0f0bd88f57b..2291419fe06 100644 --- a/inference-engine/src/vpu/graph_transformer/src/model/data_contents/conv_weights_contents.cpp +++ b/inference-engine/src/vpu/graph_transformer/src/model/data_contents/conv_weights_contents.cpp @@ -13,7 +13,7 @@ namespace vpu { // ConvIm2ColWeightsContent // -ConvIm2ColWeightsContent::ConvIm2ColWeightsContent(const DataContent::Ptr& origContent, DataDesc desc) : +ConvIm2ColWeightsContent::ConvIm2ColWeightsContent(const DataContent::Ptr& origContent, const DataDesc& desc) : _origContent(origContent), _desc(desc) {} size_t ConvIm2ColWeightsContent::byteSize() const { @@ -30,7 +30,7 @@ void ConvIm2ColWeightsContent::fillTempBuf(void* tempBuf) const { // Conv3x3WeightsContent // -Conv3x3WeightsContent::Conv3x3WeightsContent(const DataContent::Ptr& origContent, DataDesc desc) : +Conv3x3WeightsContent::Conv3x3WeightsContent(const DataContent::Ptr& origContent, const DataDesc& desc) : _origContent(origContent), _desc(desc) { } @@ -48,7 +48,7 @@ void Conv3x3WeightsContent::fillTempBuf(void* tempBuf) const { // ConvCHWWeightsContent // -ConvCHWWeightsContent::ConvCHWWeightsContent(const DataContent::Ptr& origContent, DataDesc desc) : +ConvCHWWeightsContent::ConvCHWWeightsContent(const DataContent::Ptr& origContent, const DataDesc& desc) : _origContent(origContent), _desc(desc) { } diff --git a/inference-engine/src/vpu/graph_transformer/src/model/data_contents/deconvolution_contents.cpp b/inference-engine/src/vpu/graph_transformer/src/model/data_contents/deconvolution_contents.cpp index 437b868d5f3..5b30185f87f 100644 --- a/inference-engine/src/vpu/graph_transformer/src/model/data_contents/deconvolution_contents.cpp +++ b/inference-engine/src/vpu/graph_transformer/src/model/data_contents/deconvolution_contents.cpp @@ -156,7 +156,7 @@ void deconvolutionRelayout( DeconvolutionWeightsContent::DeconvolutionWeightsContent( const DataContent::Ptr& origContent, - DataDesc desc, + const DataDesc& desc, int KX, int KY, int IC, int OC) : _origContent(origContent), _desc(desc), diff --git a/inference-engine/src/vpu/graph_transformer/src/stages/rnn.cpp b/inference-engine/src/vpu/graph_transformer/src/stages/rnn.cpp index 8cae451119c..0c0d676b18c 100644 --- a/inference-engine/src/vpu/graph_transformer/src/stages/rnn.cpp +++ b/inference-engine/src/vpu/graph_transformer/src/stages/rnn.cpp @@ -198,8 +198,9 @@ void FrontEnd::parseRNN(const Model& model, const ie::CNNLayerPtr& _layer, const }; auto newWeights = model->addConstData(_layer->name + "@weights", weights->desc(), generator); - auto outputData = outputs; - if (outputs.size() == 1) { + DataVector outputData; + std::copy_if(outputs.cbegin(), outputs.cend(), std::back_inserter(outputData), [](const Data& handle) { return !!handle;}); + if (outputData.size() == 1) { outputData.push_back(model->addFakeData()); } diff --git a/inference-engine/src/vpu/myriad_plugin/myriad_executable_network.cpp b/inference-engine/src/vpu/myriad_plugin/myriad_executable_network.cpp index c33762dc1d5..90c12142c23 100644 --- a/inference-engine/src/vpu/myriad_plugin/myriad_executable_network.cpp +++ b/inference-engine/src/vpu/myriad_plugin/myriad_executable_network.cpp @@ -21,7 +21,8 @@ #include #include #include -#include "../../../ngraph/core/include/openvino/core/interval.hpp" +// FIXME: Please remove relative path +#include "../../../src/core/include/openvino/core/interval.hpp" using namespace InferenceEngine; @@ -99,10 +100,9 @@ ExecutableNetwork::ExecutableNetwork( } copyNetwork = ie::CNNNetwork(function); for (const auto& inputInf : network.getInputsInfo()) { - auto& copyInput = copyNetwork.getInputsInfo()[inputInf.first]; - copyInput->setPrecision(inputInf.second->getPrecision()); - copyInput->setLayout(inputInf.second->getLayout()); - copyInput->getPreProcess() = inputInf.second->getPreProcess(); + copyNetwork.getInputsInfo()[inputInf.first]->setPrecision(inputInf.second->getPrecision()); + copyNetwork.getInputsInfo()[inputInf.first]->setLayout(inputInf.second->getLayout()); + copyNetwork.getInputsInfo()[inputInf.first]->getPreProcess() = inputInf.second->getPreProcess(); } for (const auto& outputInf : network.getOutputsInfo()) { *copyNetwork.getOutputsInfo()[outputInf.first].get() = *outputInf.second.get(); diff --git a/inference-engine/tests/functional/inference_engine/CMakeLists.txt b/inference-engine/tests/functional/inference_engine/CMakeLists.txt index 5cdf0a7a968..51f7ca94185 100644 --- a/inference-engine/tests/functional/inference_engine/CMakeLists.txt +++ b/inference-engine/tests/functional/inference_engine/CMakeLists.txt @@ -41,7 +41,7 @@ if(ENABLE_IR_V7_READER) endif() if(ENABLE_HETERO) - list(APPEND DEPENDENCIES HeteroPlugin) + list(APPEND DEPENDENCIES ov_hetero_plugin) endif() if(ENABLE_MULTI) @@ -128,12 +128,12 @@ function(ie_headers_compilation_with_custom_flags) if(IE_TEST_PLUGIN_API) set(include_dirs - "${OpenVINO_SOURCE_DIR}/inference-engine/src/plugin_api/") + "${OpenVINO_SOURCE_DIR}/src/inference/dev_api/") else() set(include_dirs - "${OpenVINO_SOURCE_DIR}/ngraph/core/include" - "${OpenVINO_SOURCE_DIR}/inference-engine/src/inference_engine/include/ie" - "${OpenVINO_SOURCE_DIR}/inference-engine/src/inference_engine/include/") + "${OpenVINO_SOURCE_DIR}/src/core/include" + "${OpenVINO_SOURCE_DIR}/src/inference/include/ie" + "${OpenVINO_SOURCE_DIR}/src/inference/include/") endif() foreach(include_dir IN LISTS include_dirs) diff --git a/inference-engine/tests/functional/inference_engine/caching_test.cpp b/inference-engine/tests/functional/inference_engine/caching_test.cpp index b6065d928c0..a7214cd6481 100644 --- a/inference-engine/tests/functional/inference_engine/caching_test.cpp +++ b/inference-engine/tests/functional/inference_engine/caching_test.cpp @@ -360,7 +360,9 @@ private: })); ON_CALL(plugin, GetMetric(METRIC_KEY(DEVICE_ARCHITECTURE), _)). - WillByDefault(Return("mock")); + WillByDefault(Invoke([&](const std::string &, const std::map &) { + return "mock"; + })); ON_CALL(plugin, ImportNetwork(_, _, _)). WillByDefault(Invoke([&](std::istream &istr, const RemoteContext::Ptr&, diff --git a/inference-engine/tests/functional/inference_engine/ir_serialization/custom_ops.cpp b/inference-engine/tests/functional/inference_engine/ir_serialization/custom_ops.cpp index e5e130dbb03..25a3a6e28e5 100644 --- a/inference-engine/tests/functional/inference_engine/ir_serialization/custom_ops.cpp +++ b/inference-engine/tests/functional/inference_engine/ir_serialization/custom_ops.cpp @@ -20,7 +20,7 @@ #endif #ifndef IE_BUILD_POSTFIX // should be already defined by cmake -#define IE_BUILD_POSTFIX "" +# error "IE_BUILD_POSTFIX is not defined" #endif static std::string get_extension_path() { @@ -69,6 +69,12 @@ TEST_F(CustomOpsSerializationTest, CustomOpUser_MO) { #ifdef NGRAPH_ONNX_FRONTEND_ENABLE +// This test will not work because template_extension for ONNX registers +// extension via `register_operator` function which registers operator +// is template_extension's copy of onnx_importer. So, extensions as +// a shared library for ONNX don't make sence in static OpenVINO build +#ifndef OPENVINO_STATIC_LIBRARY + TEST_F(CustomOpsSerializationTest, CustomOpUser_ONNXImporter) { const std::string model = CommonTestUtils::getModelFromTestModelZoo( IR_SERIALIZATION_MODELS_PATH "custom_op.onnx"); @@ -90,7 +96,9 @@ TEST_F(CustomOpsSerializationTest, CustomOpUser_ONNXImporter) { ASSERT_TRUE(success) << message; } -#endif +#endif // OPENVINO_STATIC_LIBRARY + +#endif // NGRAPH_ONNX_FRONTEND_ENABLE TEST_F(CustomOpsSerializationTest, CustomOpTransformation) { const std::string model = CommonTestUtils::getModelFromTestModelZoo( diff --git a/inference-engine/tests/functional/inference_engine/lp_transformations/is_asymmetric_on_weights_dequantization.cpp b/inference-engine/tests/functional/inference_engine/lp_transformations/is_asymmetric_on_weights_dequantization.cpp index e5caba16f00..8dc8a6c9ec3 100644 --- a/inference-engine/tests/functional/inference_engine/lp_transformations/is_asymmetric_on_weights_dequantization.cpp +++ b/inference-engine/tests/functional/inference_engine/lp_transformations/is_asymmetric_on_weights_dequantization.cpp @@ -21,6 +21,7 @@ using namespace ngraph::pass; class IsAsymmetricOnWeightsDequantizationTestValues { public: + TestTransformationParams params; ngraph::element::Type precisionBeforeDequantization; ngraph::builder::subgraph::DequantizationOperations dequantizationOnActivations; std::shared_ptr weights; @@ -58,7 +59,7 @@ public: IsAsymmetricOnWeightsDequantizationTestValues testValues = std::get<2>(obj.param); std::ostringstream result; - result << + result << toString(testValues.params) << "_" << netPrecision << "_" << inputShape << "_" << testValues.precisionBeforeDequantization << "_" << @@ -95,6 +96,7 @@ const std::vector suitablePartialShapes = { const std::vector testValues = { { + LayerTransformation::createParamsU8I8().setSupportAsymmetricQuantization(true), ngraph::element::u8, {{ngraph::element::f32}, { 128.f }, { 0.02f }}, op::Constant::create(ngraph::element::i8, ngraph::Shape{}, std::vector{ 2.f }), @@ -106,6 +108,7 @@ const std::vector testValues = { true }, { + LayerTransformation::createParamsU8I8().setSupportAsymmetricQuantization(true), ngraph::element::u8, {{ngraph::element::f32}, { 128.f }, { 0.02f }}, op::Constant::create(ngraph::element::i8, ngraph::Shape{}, std::vector{ 2.f }), diff --git a/inference-engine/tests/functional/inference_engine/lp_transformations/is_asymmetric_on_weights_fq.cpp b/inference-engine/tests/functional/inference_engine/lp_transformations/is_asymmetric_on_weights_fq.cpp index 78bd7aa5483..79ac9d62b6d 100644 --- a/inference-engine/tests/functional/inference_engine/lp_transformations/is_asymmetric_on_weights_fq.cpp +++ b/inference-engine/tests/functional/inference_engine/lp_transformations/is_asymmetric_on_weights_fq.cpp @@ -21,6 +21,7 @@ using namespace ngraph::pass; class IsAsymmetricOnWeightsFakeQuantizeTestValues { public: + TestTransformationParams params; ngraph::element::Type precisionBeforeDequantization; ngraph::builder::subgraph::DequantizationOperations dequantizationOnActivations; std::shared_ptr weights; @@ -106,6 +107,7 @@ const std::vector suitablePartialShapes = { const std::vector testValues = { { + LayerTransformation::createParamsU8I8().setSupportAsymmetricQuantization(true), ngraph::element::u8, {{ngraph::element::f32}, { 128.f }, { 0.02f }}, op::Constant::create(ngraph::element::f32, ngraph::Shape{}, std::vector{ 2.f }), diff --git a/inference-engine/tests/functional/inference_engine/lp_transformations/layer_transformation.hpp b/inference-engine/tests/functional/inference_engine/lp_transformations/layer_transformation.hpp index d704936eecf..b90717de7ac 100644 --- a/inference-engine/tests/functional/inference_engine/lp_transformations/layer_transformation.hpp +++ b/inference-engine/tests/functional/inference_engine/lp_transformations/layer_transformation.hpp @@ -139,7 +139,7 @@ public: template static bool checkIfOutputAttributesAreTheSame(const NodeVector& nodes) { - Variant* first = nullptr; + void* first = nullptr; for (auto node : nodes) { for (auto output : node->outputs()) { auto& rt = output.get_rt_info(); @@ -150,11 +150,13 @@ public: } auto value = it->second; + OPENVINO_SUPPRESS_DEPRECATED_START if (first == nullptr) { first = value.get(); } else if (value.get() != first) { return false; } + OPENVINO_SUPPRESS_DEPRECATED_END } } return true; diff --git a/inference-engine/tests/functional/inference_engine/ngraph_reader/topK_tests.cpp b/inference-engine/tests/functional/inference_engine/ngraph_reader/topK_tests.cpp index 388a59d9c11..29b3d4ad358 100644 --- a/inference-engine/tests/functional/inference_engine/ngraph_reader/topK_tests.cpp +++ b/inference-engine/tests/functional/inference_engine/ngraph_reader/topK_tests.cpp @@ -4,6 +4,8 @@ #include #include "ngraph_reader_tests.hpp" +#include "openvino/runtime/core.hpp" + TEST_F(NGraphReaderTests, DISABLED_ReadTopKNetwork) { std::string model = R"V0G0N( @@ -248,3 +250,75 @@ TEST_F(NGraphReaderTests, DISABLED_ReadTopKNetwork) { data[0] = 5; }); } + +TEST_F(NGraphReaderTests, ReadTopKV10Network) { + std::string model = R"V0G0N( + + + + + + + 1 + 3 + 22 + 22 + + + + + + + + + + + + + + 1 + 3 + 22 + 22 + + + + + + 1 + 3 + 5 + 22 + + + 1 + 3 + 5 + 22 + + + + + + + 1 + 3 + 5 + 22 + + + + + + + + + + +)V0G0N"; + + ov::runtime::Core core; + ov::runtime::Tensor t(ov::element::i64, {1}); + t.data()[0] = 5; + core.read_model(model, t); +} diff --git a/inference-engine/tests/functional/inference_engine/parameter_tests.cpp b/inference-engine/tests/functional/inference_engine/parameter_tests.cpp deleted file mode 100644 index 16ed9c339ff..00000000000 --- a/inference-engine/tests/functional/inference_engine/parameter_tests.cpp +++ /dev/null @@ -1,418 +0,0 @@ -// Copyright (C) 2018-2021 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#include - -#include -#include - -using namespace InferenceEngine; - -class DestructorTest { -public: - DestructorTest() { - constructorCount++; - } - - DestructorTest(const DestructorTest& c) { - constructorCount++; - } - - DestructorTest(const DestructorTest&& c) { - constructorCount++; - } - - ~DestructorTest() { - destructorCount++; - } - - static size_t destructorCount; - static size_t constructorCount; -}; -size_t DestructorTest::destructorCount = 0; -size_t DestructorTest::constructorCount = 0; - -class ParameterTests : public ::testing::Test { -public: - void SetUp() override { - DestructorTest::destructorCount = 0; - DestructorTest::constructorCount = 0; - } -}; - -TEST_F(ParameterTests, ParameterAsInt) { - Parameter p = 4; - ASSERT_TRUE(p.is()); - int test = p; - ASSERT_EQ(4, test); -} - -TEST_F(ParameterTests, ParameterAsUInt) { - Parameter p = 4u; - ASSERT_TRUE(p.is()); -#ifdef __i386__ - ASSERT_TRUE(p.is()); -#else - ASSERT_FALSE(p.is()); -#endif - unsigned int test = p; - ASSERT_EQ(4, test); -} - -TEST_F(ParameterTests, ParameterAsSize_t) { - size_t ref = 4; - Parameter p = ref; - ASSERT_TRUE(p.is()); - size_t test = p; - ASSERT_EQ(ref, test); -} - -TEST_F(ParameterTests, ParameterAsFloat) { - Parameter p = 4.f; - ASSERT_TRUE(p.is()); - float test = p; - ASSERT_EQ(4.f, test); -} - -TEST_F(ParameterTests, ParameterAsString) { - std::string ref = "test"; - Parameter p = ref; - std::string test = p; - ASSERT_TRUE(p.is()); - ASSERT_EQ(ref, test); -} - -TEST_F(ParameterTests, ParameterAsStringInLine) { - Parameter p = "test"; - std::string test = p; - ASSERT_TRUE(p.is()); - ASSERT_EQ("test", test); -} - -TEST_F(ParameterTests, IntParameterAsString) { - Parameter p = 4; - ASSERT_TRUE(p.is()); - ASSERT_FALSE(p.is()); - ASSERT_THROW(std::string test = p, std::bad_cast); - ASSERT_THROW(std::string test = p.as(), std::bad_cast); -} - -TEST_F(ParameterTests, StringParameterAsInt) { - Parameter p = "4"; - ASSERT_FALSE(p.is()); - ASSERT_TRUE(p.is()); - ASSERT_THROW((void)static_cast(p), std::bad_cast); - ASSERT_THROW((void)p.as(), std::bad_cast); -} - -TEST_F(ParameterTests, ParameterAsTensorDesc) { - TensorDesc ref(Precision::FP32, {1, 3, 2, 2}, Layout::NCHW); - Parameter p = ref; - ASSERT_TRUE(p.is()); - TensorDesc test = p; - ASSERT_EQ(ref, test); -} - -TEST_F(ParameterTests, ParameterAsInts) { - std::vector ref = {1, 2, 3, 4, 5}; - Parameter p = ref; - ASSERT_TRUE(p.is>()); - std::vector test = p; - ASSERT_EQ(ref.size(), test.size()); - for (size_t i = 0; i < ref.size(); i++) { - ASSERT_EQ(ref[i], test[i]); - } -} - -TEST_F(ParameterTests, ParameterAsUInts) { - std::vector ref = {1, 2, 3, 4, 5}; - Parameter p = ref; - ASSERT_TRUE(p.is>()); - std::vector test = p; - ASSERT_EQ(ref.size(), test.size()); - for (size_t i = 0; i < ref.size(); i++) { - ASSERT_EQ(ref[i], test[i]); - } -} - -TEST_F(ParameterTests, ParameterAsSize_ts) { - std::vector ref = {1, 2, 3, 4, 5}; - Parameter p = ref; - ASSERT_TRUE(p.is>()); - std::vector test = p; - ASSERT_EQ(ref.size(), test.size()); - for (size_t i = 0; i < ref.size(); i++) { - ASSERT_EQ(ref[i], test[i]); - } -} - -TEST_F(ParameterTests, ParameterAsFloats) { - std::vector ref = {1, 2, 3, 4, 5}; - Parameter p = ref; - ASSERT_TRUE(p.is>()); - std::vector test = p; - ASSERT_EQ(ref.size(), test.size()); - for (size_t i = 0; i < ref.size(); i++) { - ASSERT_EQ(ref[i], test[i]); - } -} - -TEST_F(ParameterTests, ParameterAsStrings) { - std::vector ref = {"test1", "test2", "test3", "test4", "test1"}; - Parameter p = ref; - ASSERT_TRUE(p.is>()); - std::vector test = p; - ASSERT_EQ(ref.size(), test.size()); - for (size_t i = 0; i < ref.size(); i++) { - ASSERT_EQ(ref[i], test[i]); - } -} - -TEST_F(ParameterTests, ParameterAsMapOfParameters) { - std::map refMap; - refMap["testParamInt"] = 4; - refMap["testParamString"] = "test"; - Parameter p = refMap; - bool isMap = p.is>(); - ASSERT_TRUE(isMap); - std::map testMap = p; - - ASSERT_NE(testMap.find("testParamInt"), testMap.end()); - ASSERT_NE(testMap.find("testParamString"), testMap.end()); - - int testInt = testMap["testParamInt"]; - std::string testString = testMap["testParamString"]; - - ASSERT_EQ(refMap["testParamInt"].as(), testInt); - ASSERT_EQ(refMap["testParamString"].as(), testString); -} - -TEST_F(ParameterTests, ParameterNotEmpty) { - Parameter p = 4; - ASSERT_FALSE(p.empty()); -} - -TEST_F(ParameterTests, ParameterEmpty) { - Parameter p; - ASSERT_TRUE(p.empty()); -} - -TEST_F(ParameterTests, ParameterClear) { - Parameter p = 4; - ASSERT_FALSE(p.empty()); - p.clear(); - ASSERT_TRUE(p.empty()); -} - -TEST_F(ParameterTests, ParametersNotEqualByType) { - Parameter p1 = 4; - Parameter p2 = "string"; - ASSERT_TRUE(p1 != p2); - ASSERT_FALSE(p1 == p2); -} - -TEST_F(ParameterTests, ParametersNotEqualByValue) { - Parameter p1 = 4; - Parameter p2 = 5; - ASSERT_TRUE(p1 != p2); - ASSERT_FALSE(p1 == p2); -} - -TEST_F(ParameterTests, ParametersEqual) { - Parameter p1 = 4; - Parameter p2 = 4; - ASSERT_TRUE(p1 == p2); - ASSERT_FALSE(p1 != p2); -} - -TEST_F(ParameterTests, ParametersStringEqual) { - std::string s1 = "abc"; - std::string s2 = std::string("a") + "bc"; - Parameter p1 = s1; - Parameter p2 = s2; - ASSERT_TRUE(s1 == s2); - ASSERT_TRUE(p1 == p2); - ASSERT_FALSE(p1 != p2); -} - -TEST_F(ParameterTests, ParametersCStringEqual) { - const char s1[] = "abc"; - const char s2[] = "abc"; - Parameter p1 = s1; - Parameter p2 = s2; - ASSERT_TRUE(s1 != s2); - ASSERT_TRUE(p1 == p2); - ASSERT_FALSE(p1 != p2); -} - -TEST_F(ParameterTests, MapOfParametersEqual) { - std::map map0; - map0["testParamInt"] = 4; - map0["testParamString"] = "test"; - const auto map1 = map0; - - Parameter p0 = map0; - Parameter p1 = map1; - ASSERT_TRUE(p0 == p1); - ASSERT_FALSE(p0 != p1); -} - -TEST_F(ParameterTests, CompareParametersWithoutEqualOperator) { - class TestClass { - public: - TestClass(int test, int* testPtr): test(test), testPtr(testPtr) {} - - private: - int test; - int* testPtr; - }; - - TestClass a(2, reinterpret_cast(0x234)); - TestClass b(2, reinterpret_cast(0x234)); - TestClass c(3, reinterpret_cast(0x234)); - Parameter parA = a; - Parameter parB = b; - Parameter parC = c; - - ASSERT_THROW((void)(parA == parB), ov::Exception); - ASSERT_THROW((void)(parA != parB), ov::Exception); - ASSERT_THROW((void)(parA == parC), ov::Exception); - ASSERT_THROW((void)(parA != parC), ov::Exception); -} - -TEST_F(ParameterTests, ParameterRemovedRealObject) { - ASSERT_EQ(0, DestructorTest::constructorCount); - ASSERT_EQ(0, DestructorTest::destructorCount); - { - DestructorTest t; - Parameter p1 = t; - } - ASSERT_EQ(2, DestructorTest::constructorCount); - ASSERT_EQ(2, DestructorTest::destructorCount); -} - -TEST_F(ParameterTests, ParameterRemovedRealObjectWithDuplication) { - ASSERT_EQ(0, DestructorTest::constructorCount); - ASSERT_EQ(0, DestructorTest::destructorCount); - { - DestructorTest t; - Parameter p = t; - ASSERT_EQ(0, DestructorTest::destructorCount); - p = t; - ASSERT_EQ(2, DestructorTest::destructorCount); - } - ASSERT_EQ(4, DestructorTest::constructorCount); - ASSERT_EQ(4, DestructorTest::destructorCount); -} - -TEST_F(ParameterTests, ParameterRemovedRealObjectPointerWithDuplication) { - ASSERT_EQ(0, DestructorTest::constructorCount); - ASSERT_EQ(0, DestructorTest::destructorCount); - { - auto * t = new DestructorTest(); - Parameter p = t; - ASSERT_EQ(1, DestructorTest::constructorCount); - ASSERT_EQ(0, DestructorTest::destructorCount); - p = t; - ASSERT_TRUE(p.is()); - DestructorTest* t2 = p; - ASSERT_EQ(0, DestructorTest::destructorCount); - delete t; - auto * t3 = p.as(); - ASSERT_EQ(t2, t3); - } - ASSERT_EQ(1, DestructorTest::constructorCount); - ASSERT_EQ(1, DestructorTest::destructorCount); -} - -TEST_F(ParameterTests, PrintToEmptyParameterDoesNothing) { - Parameter p; - std::stringstream stream; - ASSERT_NO_THROW(PrintTo(p, &stream)); - ASSERT_EQ(stream.str(), std::string{}); -} - -TEST_F(ParameterTests, PrintToIntParameter) { - int value = -5; - Parameter p = value; - std::stringstream stream; - ASSERT_NO_THROW(PrintTo(p, &stream)); - ASSERT_EQ(stream.str(), std::to_string(value)); -} - -TEST_F(ParameterTests, PrintToUIntParameter) { - unsigned int value = 5; - Parameter p = value; - std::stringstream stream; - ASSERT_NO_THROW(PrintTo(p, &stream)); - ASSERT_EQ(stream.str(), std::to_string(value)); -} - -TEST_F(ParameterTests, PrintToSize_tParameter) { - std::size_t value = 5; - Parameter p = value; - std::stringstream stream; - ASSERT_NO_THROW(PrintTo(p, &stream)); - ASSERT_EQ(stream.str(), std::to_string(value)); -} - -TEST_F(ParameterTests, PrintToFloatParameter) { - Parameter p = 5.5f; - std::stringstream stream; - ASSERT_NO_THROW(PrintTo(p, &stream)); - ASSERT_EQ(stream.str(), std::string{"5.5"}); -} - -TEST_F(ParameterTests, PrintToStringParameter) { - std::string value = "some text"; - Parameter p = value; - std::stringstream stream; - ASSERT_NO_THROW(PrintTo(p, &stream)); - ASSERT_EQ(stream.str(), value); -} - -TEST_F(ParameterTests, PrintToVectorOfIntsParameterDoesNothing) { - Parameter p = std::vector{-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5}; - std::stringstream stream; - ASSERT_NO_THROW(PrintTo(p, &stream)); - ASSERT_EQ(stream.str(), std::string{}); -} - -TEST_F(ParameterTests, PrintToVectorOfUIntsParameterDoesNothing) { - Parameter p = std::vector{0, 1, 2, 3, 4, 5}; - std::stringstream stream; - ASSERT_NO_THROW(PrintTo(p, &stream)); - ASSERT_EQ(stream.str(), std::string{}); -} - -TEST_F(ParameterTests, PrintToVectorOfSize_tParameterDoesNothing) { - Parameter p = std::vector{0, 1, 2, 3, 4, 5}; - std::stringstream stream; - ASSERT_NO_THROW(PrintTo(p, &stream)); - ASSERT_EQ(stream.str(), std::string{}); -} - -TEST_F(ParameterTests, PrintToVectorOfFloatsParameterDoesNothing) { - Parameter p = std::vector{0.0f, 1.1f, 2.2f, 3.3f, 4.4f, 5.5f}; - std::stringstream stream; - ASSERT_NO_THROW(PrintTo(p, &stream)); - ASSERT_EQ(stream.str(), std::string{}); -} - -TEST_F(ParameterTests, PrintToVectorOfStringsParameterDoesNothing) { - Parameter p = std::vector{"zero", "one", "two", "three", "four", "five"}; - std::stringstream stream; - ASSERT_NO_THROW(PrintTo(p, &stream)); - ASSERT_EQ(stream.str(), std::string{}); -} - -TEST_F(ParameterTests, PrintToMapOfParametersDoesNothing) { - std::map refMap; - refMap["testParamInt"] = 4; - refMap["testParamString"] = "test"; - Parameter p = refMap; - std::stringstream stream; - ASSERT_NO_THROW(PrintTo(p, &stream)); - ASSERT_EQ(stream.str(), std::string{}); -} diff --git a/inference-engine/tests/functional/inference_engine/serialization/single_layer/matrix_nms.cpp b/inference-engine/tests/functional/inference_engine/serialization/single_layer/matrix_nms.cpp index 9e5910160b1..6cc30ad8860 100644 --- a/inference-engine/tests/functional/inference_engine/serialization/single_layer/matrix_nms.cpp +++ b/inference-engine/tests/functional/inference_engine/serialization/single_layer/matrix_nms.cpp @@ -7,22 +7,31 @@ #include "shared_test_classes/single_layer/matrix_nms.hpp" using namespace ngraph; -using namespace LayerTestsDefinitions; +using namespace ov::test::subgraph; namespace { TEST_P(MatrixNmsLayerTest, Serialize) { - Serialize(); + serialize(); } - const std::vector netPrecisions = { - InferenceEngine::Precision::FP32, - InferenceEngine::Precision::FP16 + const std::vector netPrecisions = { + ov::element::f32, + ov::element::f16 }; - const std::vector inShapeParams = { - InputShapeParams{3, 100, 5}, - InputShapeParams{1, 10, 50}, - InputShapeParams{2, 50, 50} + const std::vector> shapeParams = { + // num_batches, num_boxes, 4 + {{{ngraph::Dimension::dynamic(), ngraph::Dimension::dynamic(), 4}, + {{1, 10, 4}, {2, 100, 4}}}, + // num_batches, num_classes, num_boxes + {{ngraph::Dimension::dynamic(), ngraph::Dimension::dynamic(), ngraph::Dimension::dynamic()}, + {{1, 3, 10}, {2, 5, 100}}}}, + // num_batches, num_boxes, 4 + {{{ngraph::Dimension(1, 10), ngraph::Dimension(1, 100), 4}, + {{1, 10, 4}, {2, 100, 4}}}, + // num_batches, num_classes, num_boxes + {{{ngraph::Dimension(1, 10), ngraph::Dimension(1, 100), ngraph::Dimension(1, 100)}}, + {{1, 3, 10}, {2, 5, 100}}}} }; const std::vector sortResultType = {op::v8::MatrixNms::SortResultType::CLASSID, @@ -43,10 +52,10 @@ namespace { const std::vector normalized = {true, false}; const std::vector decayFunction = {op::v8::MatrixNms::DecayFunction::GAUSSIAN, op::v8::MatrixNms::DecayFunction::LINEAR}; - const auto nmsParams = ::testing::Combine(::testing::ValuesIn(inShapeParams), - ::testing::Combine(::testing::Values(InferenceEngine::Precision::FP32), - ::testing::Values(InferenceEngine::Precision::I32), - ::testing::Values(InferenceEngine::Precision::FP32)), + const auto nmsParams = ::testing::Combine(::testing::ValuesIn(shapeParams), + ::testing::Combine(::testing::Values(ov::element::f32), + ::testing::Values(ov::element::i32), + ::testing::Values(ov::element::f32)), ::testing::ValuesIn(sortResultType), ::testing::ValuesIn(outType), ::testing::ValuesIn(topKParams), diff --git a/inference-engine/tests/functional/inference_engine/serialization/single_layer/multiclass_nms.cpp b/inference-engine/tests/functional/inference_engine/serialization/single_layer/multiclass_nms.cpp index f53954dda8c..179fcd8a42a 100644 --- a/inference-engine/tests/functional/inference_engine/serialization/single_layer/multiclass_nms.cpp +++ b/inference-engine/tests/functional/inference_engine/serialization/single_layer/multiclass_nms.cpp @@ -7,19 +7,25 @@ #include "shared_test_classes/single_layer/multiclass_nms.hpp" using namespace ngraph; -using namespace LayerTestsDefinitions; +using namespace ov::test::subgraph; namespace { TEST_P(MulticlassNmsLayerTest, Serialize) { - Serialize(); + serialize(); } -const std::vector netPrecisions = { - InferenceEngine::Precision::FP32, InferenceEngine::Precision::FP16}; - -const std::vector inShapeParams = { - InputShapeParams{3, 100, 5}, InputShapeParams{1, 10, 50}, - InputShapeParams{2, 50, 50}}; +const std::vector> shapeParams = { + // num_batches, num_boxes, 4 + {{{ngraph::Dimension::dynamic(), ngraph::Dimension::dynamic(), 4}, + {{1, 10, 4}, {2, 100, 4}}}, + // num_batches, num_classes, num_boxes + {{ngraph::Dimension::dynamic(), ngraph::Dimension::dynamic(), ngraph::Dimension::dynamic()}, + {{1, 3, 10}, {2, 5, 100}}}}, + {{{ngraph::Dimension(1, 10), ngraph::Dimension(1, 100), 4}, + {{1, 10, 4}, {2, 100, 4}}}, + {{{ngraph::Dimension(1, 10), ngraph::Dimension(1, 100), ngraph::Dimension(1, 100)}}, + {{1, 3, 10}, {2, 5, 100}}}} +}; const std::vector nmsTopK = {-1, 20}; const std::vector iouThreshold = {0.7f}; @@ -37,10 +43,10 @@ const std::vector nmsEta = {0.6f, 1.0f}; const std::vector normalized = {true, false}; const auto nmsParams = ::testing::Combine( - ::testing::ValuesIn(inShapeParams), - ::testing::Combine(::testing::Values(InferenceEngine::Precision::FP32), - ::testing::Values(InferenceEngine::Precision::I32), - ::testing::Values(InferenceEngine::Precision::FP32)), + ::testing::ValuesIn(shapeParams), + ::testing::Combine(::testing::Values(ov::element::f32), + ::testing::Values(ov::element::i32), + ::testing::Values(ov::element::f32)), ::testing::ValuesIn(nmsTopK), ::testing::Combine(::testing::ValuesIn(iouThreshold), ::testing::ValuesIn(scoreThreshold), diff --git a/inference-engine/tests/functional/inference_engine/serialization/single_layer/prior_box.cpp b/inference-engine/tests/functional/inference_engine/serialization/single_layer/prior_box.cpp index 91def7d74c8..38404e9868b 100644 --- a/inference-engine/tests/functional/inference_engine/serialization/single_layer/prior_box.cpp +++ b/inference-engine/tests/functional/inference_engine/serialization/single_layer/prior_box.cpp @@ -66,6 +66,10 @@ namespace { true, false }; + const std::vector min_max_aspect_ratios_order = { + true, false + }; + const std::vector inputShape = {128, 128}; const std::vector imageShape = {50, 50}; @@ -81,7 +85,8 @@ namespace { ::testing::ValuesIn(steps), ::testing::ValuesIn(offsets), ::testing::ValuesIn(variances), - ::testing::ValuesIn(scale_all_sizes)); + ::testing::ValuesIn(scale_all_sizes), + ::testing::ValuesIn(min_max_aspect_ratios_order)); INSTANTIATE_TEST_SUITE_P(smoke_PriorBox_Basic, PriorBoxLayerTest, ::testing::Combine( diff --git a/inference-engine/tests/functional/inference_engine/snippets/registers.cpp b/inference-engine/tests/functional/inference_engine/snippets/registers.cpp index e76d8318f59..54ce843308a 100644 --- a/inference-engine/tests/functional/inference_engine/snippets/registers.cpp +++ b/inference-engine/tests/functional/inference_engine/snippets/registers.cpp @@ -51,8 +51,9 @@ TEST(TransformationTests, AssignRegisters) { for (auto& op : f->get_ordered_ops()) { auto& rt = op->get_rt_info(); - if (auto rinfo = rt["reginfo"]) { - auto reginfo = ov::as_type_ptr>>(rinfo)->get(); + auto it_rinfo = rt.find("reginfo"); + if (it_rinfo != rt.end()) { + auto reginfo = ov::as_type_ptr>>(it_rinfo->second)->get(); auto reg = reginfo[0]; ASSERT_TRUE(ref_registers[op->get_friendly_name()] == reg); total_ops++; @@ -124,9 +125,9 @@ TEST(TransformationTests, AssignRegisters2) { auto total_ops = 0; for (auto& op : f->get_ordered_ops()) { auto& rt = op->get_rt_info(); - - if (auto rinfo = rt["reginfo"]) { - auto reginfo = ov::as_type_ptr>>(rinfo)->get(); + auto it_rinfo = rt.find("reginfo"); + if (it_rinfo != rt.end()) { + auto reginfo = ov::as_type_ptr>>(it_rinfo->second)->get(); auto reg = reginfo[0]; ASSERT_TRUE(ref_registers[op->get_friendly_name()] == reg); total_ops++; diff --git a/inference-engine/tests/functional/inference_engine/transformations/const_folding_prior_box.cpp b/inference-engine/tests/functional/inference_engine/transformations/const_folding_prior_box.cpp index a56ea2b612e..b62629d0728 100644 --- a/inference-engine/tests/functional/inference_engine/transformations/const_folding_prior_box.cpp +++ b/inference-engine/tests/functional/inference_engine/transformations/const_folding_prior_box.cpp @@ -10,6 +10,7 @@ #include #include +#include #include #include #include @@ -24,7 +25,7 @@ TEST(TransformationTests, ConstFoldingPriorBox) { { auto in = std::make_shared(ngraph::element::i64, ngraph::Shape{2}); - ngraph::op::PriorBoxAttrs attrs; + ngraph::op::v0::PriorBox::Attributes attrs; attrs.min_size = {256.0f}; attrs.max_size = {315.0f}; attrs.aspect_ratio = {2.0f}; @@ -119,7 +120,7 @@ TEST(TransformationTests, ConstFoldingPriorBoxSubgraph) { { auto in = std::make_shared(ngraph::element::i64, ngraph::Shape{2, 3, 1, 1}); auto in_2 = std::make_shared(ngraph::element::i64, ngraph::Shape{2, 3, 300, 300}); - ngraph::op::PriorBoxAttrs attrs; + ngraph::op::v0::PriorBox::Attributes attrs; attrs.min_size = {256.0f}; attrs.max_size = {315.0f}; attrs.aspect_ratio = {2.0f}; @@ -225,3 +226,111 @@ TEST(TransformationTests, ConstFoldingPriorBoxClusteredSubgraph) { EXPECT_TRUE(ref != nullptr); EXPECT_TRUE(fused->get_vector() == ref->get_vector()); } + +TEST(TransformationTests, ConstFoldingPriorBox8) { + std::shared_ptr f(nullptr), f_ref(nullptr); + + { + auto in = std::make_shared(ngraph::element::i64, ngraph::Shape {2}); + ngraph::op::v8::PriorBox::Attributes attrs; + attrs.min_size = {2.0f}; + attrs.max_size = {5.0f}; + attrs.aspect_ratio = {1.5f}; + attrs.scale_all_sizes = true; + attrs.min_max_aspect_ratios_order = false; + + auto layer_shape = ngraph::opset8::Constant::create(ngraph::element::i64, ngraph::Shape {2}, {2, 2}); + auto image_shape = ngraph::opset8::Constant::create(ngraph::element::i64, ngraph::Shape {2}, {10, 10}); + auto pb = std::make_shared(layer_shape, image_shape, attrs); + auto res = std::make_shared(pb); + f = std::make_shared(ngraph::NodeVector {res}, ngraph::ParameterVector {in}); + ngraph::pass::Manager manager; + manager.register_pass(); + manager.register_pass(); + manager.run_passes(f); + ASSERT_NO_THROW(check_rt_info(f)); + } + + { + auto layer_shape = std::make_shared(ngraph::element::i64, ngraph::Shape {2}); + auto const_prior_box = ngraph::opset8::Constant::create( + ngraph::element::f32, ngraph::Shape {2, 48}, + {0.15, 0.15, 0.35, 0.35, 0.127526, 0.16835, 0.372474, 0.33165, 0.0918861, 0.0918861, 0.408114, 0.408114, 0.65, 0.15, + 0.85, 0.35, 0.627526, 0.16835, 0.872474, 0.33165, 0.591886, 0.0918861, 0.908114, 0.408114, 0.15, 0.65, 0.35, 0.85, + 0.127526, 0.66835, 0.372474, 0.83165, 0.0918861, 0.591886, 0.408114, 0.908114, 0.65, 0.65, 0.85, 0.85, 0.627526, 0.66835, + 0.872474, 0.83165, 0.591886, 0.591886, 0.908114, 0.908114, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, + 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, + 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, + 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1}); + auto res = std::make_shared(const_prior_box); + f_ref = std::make_shared(ngraph::NodeVector {res}, ngraph::ParameterVector {layer_shape}); + } + + auto res = compare_functions(f, f_ref); + ASSERT_TRUE(res.first) << res.second; + + auto fused = std::dynamic_pointer_cast(f->get_result()->input_value(0).get_node_shared_ptr()); + auto ref = std::dynamic_pointer_cast(f->get_result()->input_value(0).get_node_shared_ptr()); + + EXPECT_TRUE(fused != nullptr); + EXPECT_TRUE(ref != nullptr); + EXPECT_TRUE(fused->get_vector() == ref->get_vector()); +} + +TEST(TransformationTests, ConstFoldingPriorBox8Subgraph) { + std::shared_ptr f(nullptr), f_ref(nullptr); + + { + auto in = std::make_shared(ngraph::element::i64, ngraph::Shape {2, 3, 2, 2}); + auto in_2 = std::make_shared(ngraph::element::i64, ngraph::Shape {2, 3, 10, 10}); + ngraph::op::v8::PriorBox::Attributes attrs; + attrs.min_size = {2.0f}; + attrs.max_size = {5.0f}; + attrs.aspect_ratio = {1.5f}; + attrs.scale_all_sizes = true; + attrs.min_max_aspect_ratios_order = false; + + auto layer_shape = std::make_shared(in); + auto image_shape = std::make_shared(in_2); + + auto begin = ngraph::opset8::Constant::create(ngraph::element::i64, ngraph::Shape {1}, {2}); + auto end = ngraph::opset8::Constant::create(ngraph::element::i64, ngraph::Shape {1}, {4}); + auto stride = ngraph::opset8::Constant::create(ngraph::element::i64, ngraph::Shape {1}, {1}); + auto ss_data = std::make_shared(layer_shape, begin, end, stride, std::vector {0}, std::vector {0}); + + auto ss_image = std::make_shared(image_shape, begin, end, stride, std::vector {0}, std::vector {0}); + auto pb = std::make_shared(ss_data, ss_image, attrs); + auto res = std::make_shared(pb); + f = std::make_shared(ngraph::NodeVector {res}, ngraph::ParameterVector {in, in_2}); + ngraph::pass::Manager manager; + manager.register_pass(); + manager.register_pass(); + manager.run_passes(f); + ASSERT_NO_THROW(check_rt_info(f)); + } + + { + auto layer_shape = std::make_shared(ngraph::element::i64, ngraph::Shape {2}); + auto const_prior_box = ngraph::opset8::Constant::create( + ngraph::element::f32, ngraph::Shape {2, 48}, + {0.15, 0.15, 0.35, 0.35, 0.127526, 0.16835, 0.372474, 0.33165, 0.0918861, 0.0918861, 0.408114, 0.408114, 0.65, 0.15, + 0.85, 0.35, 0.627526, 0.16835, 0.872474, 0.33165, 0.591886, 0.0918861, 0.908114, 0.408114, 0.15, 0.65, 0.35, 0.85, + 0.127526, 0.66835, 0.372474, 0.83165, 0.0918861, 0.591886, 0.408114, 0.908114, 0.65, 0.65, 0.85, 0.85, 0.627526, 0.66835, + 0.872474, 0.83165, 0.591886, 0.591886, 0.908114, 0.908114, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, + 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, + 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, + 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1}); + auto res = std::make_shared(const_prior_box); + f_ref = std::make_shared(ngraph::NodeVector {res}, ngraph::ParameterVector {layer_shape}); + } + + auto res = compare_functions(f, f_ref); + ASSERT_TRUE(res.first) << res.second; + + auto fused = std::dynamic_pointer_cast(f->get_result()->input_value(0).get_node_shared_ptr()); + auto ref = std::dynamic_pointer_cast(f->get_result()->input_value(0).get_node_shared_ptr()); + + EXPECT_TRUE(fused != nullptr); + EXPECT_TRUE(ref != nullptr); + EXPECT_TRUE(fused->get_vector() == ref->get_vector()); +} diff --git a/inference-engine/tests/functional/inference_engine/transformations/convert_ngraph_to_cnn_network_tests.cpp b/inference-engine/tests/functional/inference_engine/transformations/convert_ngraph_to_cnn_network_tests.cpp index c62de865091..d961c561701 100644 --- a/inference-engine/tests/functional/inference_engine/transformations/convert_ngraph_to_cnn_network_tests.cpp +++ b/inference-engine/tests/functional/inference_engine/transformations/convert_ngraph_to_cnn_network_tests.cpp @@ -85,7 +85,6 @@ TEST(ConvertFunctionToCNNNetworkTests, ConvertConvolutionNetwork) { TEST(ConvertFunctionToCNNNetworkTests, OpsShouldBeConvertedToIERepresentation) { ngraph::NodeVector should_converted_to_ie = { - std::make_shared(), std::make_shared(), std::make_shared(), std::make_shared(), @@ -107,7 +106,6 @@ TEST(ConvertFunctionToCNNNetworkTests, OpsShouldBeConvertedToIERepresentation) { std::make_shared(), std::make_shared(), std::make_shared(), - std::make_shared(), }; // create simple ngraph function Parameter -> Result diff --git a/inference-engine/tests/functional/inference_engine/transformations/convert_precision.cpp b/inference-engine/tests/functional/inference_engine/transformations/convert_precision.cpp index 032cd71e5d9..0d384efdef6 100644 --- a/inference-engine/tests/functional/inference_engine/transformations/convert_precision.cpp +++ b/inference-engine/tests/functional/inference_engine/transformations/convert_precision.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -125,6 +126,58 @@ TEST(TransformationTests, ConvertPrecision_NMS5) { ASSERT_FALSE(has_type(f)); } +TEST(TransformationTests, ConvertPrecision_MatrixNms) { + std::shared_ptr f; + { + auto boxes = std::make_shared(ngraph::element::f16, ngraph::Shape{1, 1000, 4}); + auto scores = std::make_shared(ngraph::element::f16, ngraph::Shape{1, 1, 1000}); + op::v8::MatrixNms::Attributes attrs; + attrs.output_type = ngraph::element::i64; + auto nms = std::make_shared(boxes, scores, attrs); + + auto result1 = std::make_shared(nms->output(0)); + auto result2 = std::make_shared(nms->output(1)); + auto result3 = std::make_shared(nms->output(2)); + f = std::make_shared(ngraph::ResultVector{result1, result2, result3}, ngraph::ParameterVector{boxes, scores}); + } + + pass::Manager manager; + static const precisions_array precisions = { + { ngraph::element::i64, ngraph::element::i32 }, + { ngraph::element::f16, ngraph::element::f32 } + }; + manager.register_pass(precisions); + manager.run_passes(f); + ASSERT_FALSE(has_type(f)); + ASSERT_FALSE(has_type(f)); +} + +TEST(TransformationTests, ConvertPrecision_MulticlassNms) { + std::shared_ptr f; + { + auto boxes = std::make_shared(ngraph::element::f16, ngraph::Shape{1, 1000, 4}); + auto scores = std::make_shared(ngraph::element::f16, ngraph::Shape{1, 1, 1000}); + op::v8::MulticlassNms::Attributes attrs; + attrs.output_type = ngraph::element::i64; + auto nms = std::make_shared(boxes, scores, attrs); + + auto result1 = std::make_shared(nms->output(0)); + auto result2 = std::make_shared(nms->output(1)); + auto result3 = std::make_shared(nms->output(2)); + f = std::make_shared(ngraph::ResultVector{result1, result2, result3}, ngraph::ParameterVector{boxes, scores}); + } + + pass::Manager manager; + static const precisions_array precisions = { + { ngraph::element::i64, ngraph::element::i32 }, + { ngraph::element::f16, ngraph::element::f32 } + }; + manager.register_pass(precisions); + manager.run_passes(f); + ASSERT_FALSE(has_type(f)); + ASSERT_FALSE(has_type(f)); +} + TEST(TransformationTests, ConvertPrecision_ShapeOf) { std::shared_ptr f(nullptr); { diff --git a/inference-engine/tests/functional/inference_engine/transformations/convert_prior_box_v8_to_v0_test.cpp b/inference-engine/tests/functional/inference_engine/transformations/convert_prior_box_v8_to_v0_test.cpp new file mode 100644 index 00000000000..56bcab84104 --- /dev/null +++ b/inference-engine/tests/functional/inference_engine/transformations/convert_prior_box_v8_to_v0_test.cpp @@ -0,0 +1,77 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "common_test_utils/ngraph_test_utils.hpp" + +using namespace testing; +using namespace ngraph; + +TEST_F(TransformationTestsF, ConvertPriorBox8To0) { + { + const Shape input_shape {2, 2}; + const Shape image_Shape {10, 10}; + op::v8::PriorBox::Attributes attrs; + attrs.min_size = {2.0f}; + attrs.max_size = {5.0f}; + attrs.aspect_ratio = {1.5f}; + attrs.scale_all_sizes = true; + + auto input = std::make_shared(element::i64, input_shape); + auto image = std::make_shared(element::i64, image_Shape); + + auto prior_box = std::make_shared(input, image, attrs); + + function = std::make_shared(NodeVector {prior_box}, ParameterVector {input, image}); + manager.register_pass(); + } + + { + const Shape input_shape {2, 2}; + const Shape image_Shape {10, 10}; + op::v0::PriorBox::Attributes attrs; + attrs.min_size = {2.0f}; + attrs.max_size = {5.0f}; + attrs.aspect_ratio = {1.5f}; + attrs.scale_all_sizes = true; + + auto input = std::make_shared(element::i64, input_shape); + auto image = std::make_shared(element::i64, image_Shape); + + auto prior_box = std::make_shared(input, image, attrs); + + function_ref = std::make_shared(NodeVector {prior_box}, ParameterVector {input, image}); + } +} + +TEST_F(TransformationTestsF, ConvertPriorBox8To0_min_max_aspect_ratios_order) { + { + const Shape input_shape {2, 2}; + const Shape image_Shape {10, 10}; + op::v8::PriorBox::Attributes attrs; + attrs.min_size = {2.0f}; + attrs.max_size = {5.0f}; + attrs.aspect_ratio = {1.5f}; + attrs.scale_all_sizes = true; + attrs.min_max_aspect_ratios_order = false; + + auto input = std::make_shared(element::i64, input_shape); + auto image = std::make_shared(element::i64, image_Shape); + + auto prior_box = std::make_shared(input, image, attrs); + + function = std::make_shared(NodeVector {prior_box}, ParameterVector {input, image}); + manager.register_pass(); + } +} \ No newline at end of file diff --git a/inference-engine/tests/functional/plugin/conformance/subgraphs_dumper/CMakeLists.txt b/inference-engine/tests/functional/plugin/conformance/subgraphs_dumper/CMakeLists.txt index 8a97d7698d2..6d1c07b38fb 100644 --- a/inference-engine/tests/functional/plugin/conformance/subgraphs_dumper/CMakeLists.txt +++ b/inference-engine/tests/functional/plugin/conformance/subgraphs_dumper/CMakeLists.txt @@ -9,9 +9,6 @@ addIeTargetTest( ROOT ${CMAKE_CURRENT_SOURCE_DIR} INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/include - $ - DEPENDENCIES - ir_ov_frontend LINK_LIBRARIES PRIVATE gflags @@ -21,4 +18,8 @@ addIeTargetTest( ADD_CPPLINT ) +if(TARGET ir_ov_frontend) + add_dependencies(${TARGET_NAME} ir_ov_frontend) +endif() + ie_faster_build(${TARGET_NAME} UNITY) diff --git a/inference-engine/tests/functional/plugin/conformance/test_runner/api_conformance_runner/include/api_conformance_helpers.hpp b/inference-engine/tests/functional/plugin/conformance/test_runner/api_conformance_runner/include/api_conformance_helpers.hpp index 36dc38cf3e9..9c83e12fd62 100644 --- a/inference-engine/tests/functional/plugin/conformance/test_runner/api_conformance_runner/include/api_conformance_helpers.hpp +++ b/inference-engine/tests/functional/plugin/conformance/test_runner/api_conformance_runner/include/api_conformance_helpers.hpp @@ -23,7 +23,7 @@ inline const std::string getPluginLibNameByDevice(const std::string& deviceName) { "CPU", "MKLDNNPlugin" }, { "GNA", "GNAPlugin" }, { "GPU", "clDNNPlugin" }, - { "HETERO", "HeteroPlugin" }, + { "HETERO", "ov_hetero_plugin" }, { "MULTI", "MultiDevicePlugin" }, { "MYRIAD", "myriadPlugin" }, { "TEMPLATE", "templatePlugin" }, @@ -83,4 +83,4 @@ const std::vector> emptyConfig = { } // namespace conformance } // namespace test -} // namespace ov \ No newline at end of file +} // namespace ov diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/behavior/plugin/configuration_tests.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/behavior/plugin/configuration_tests.cpp index a772c660d5b..ff240aa56ed 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/behavior/plugin/configuration_tests.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/behavior/plugin/configuration_tests.cpp @@ -76,6 +76,29 @@ namespace { {InferenceEngine::PluginConfigParams::KEY_PERFORMANCE_HINT_NUM_REQUESTS, "1"}} }; + const std::vector> AutoConfigs = { + {{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_CPU}, + {InferenceEngine::PluginConfigParams::KEY_PERFORMANCE_HINT, InferenceEngine::PluginConfigParams::THROUGHPUT}}, + {{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_CPU}, + {InferenceEngine::PluginConfigParams::KEY_PERFORMANCE_HINT, InferenceEngine::PluginConfigParams::LATENCY}}, + {{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_CPU}, + {InferenceEngine::PluginConfigParams::KEY_PERFORMANCE_HINT, InferenceEngine::PluginConfigParams::LATENCY}, + {InferenceEngine::PluginConfigParams::KEY_PERFORMANCE_HINT_NUM_REQUESTS, "1"}}, + {{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_CPU}}, + {{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_CPU}, + {InferenceEngine::PluginConfigParams::KEY_LOG_LEVEL, InferenceEngine::PluginConfigParams::LOG_NONE}}, + {{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_CPU}, + {InferenceEngine::PluginConfigParams::KEY_LOG_LEVEL, InferenceEngine::PluginConfigParams::LOG_ERROR}}, + {{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_CPU}, + {InferenceEngine::PluginConfigParams::KEY_LOG_LEVEL, InferenceEngine::PluginConfigParams::LOG_WARNING}}, + {{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_CPU}, + {InferenceEngine::PluginConfigParams::KEY_LOG_LEVEL, InferenceEngine::PluginConfigParams::LOG_INFO}}, + {{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_CPU}, + {InferenceEngine::PluginConfigParams::KEY_LOG_LEVEL, InferenceEngine::PluginConfigParams::LOG_DEBUG}}, + {{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_CPU}, + {InferenceEngine::PluginConfigParams::KEY_LOG_LEVEL, InferenceEngine::PluginConfigParams::LOG_TRACE}} + }; + INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, CorrectConfigTests, ::testing::Combine( ::testing::Values(CommonTestUtils::DEVICE_CPU), @@ -91,7 +114,7 @@ namespace { INSTANTIATE_TEST_SUITE_P(smoke_Auto_BehaviorTests, CorrectConfigTests, ::testing::Combine( ::testing::Values(CommonTestUtils::DEVICE_AUTO), - ::testing::ValuesIn(MultiConfigs)), + ::testing::ValuesIn(AutoConfigs)), CorrectConfigTests::getTestCaseName); const std::vector> inconfigs = { @@ -137,6 +160,25 @@ namespace { {{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_CPU}} }; + const std::vector> autoinconfigs = { + {{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_CPU}, + {InferenceEngine::PluginConfigParams::KEY_PERFORMANCE_HINT, "DOESN'T EXIST"}}, + {{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_CPU}, + {InferenceEngine::PluginConfigParams::KEY_PERFORMANCE_HINT, InferenceEngine::PluginConfigParams::LATENCY}, + {InferenceEngine::PluginConfigParams::KEY_PERFORMANCE_HINT_NUM_REQUESTS, "-1"}}, + {{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_CPU}, + {InferenceEngine::PluginConfigParams::KEY_PERFORMANCE_HINT, InferenceEngine::PluginConfigParams::THROUGHPUT}, + {InferenceEngine::PluginConfigParams::KEY_PERFORMANCE_HINT_NUM_REQUESTS, "should be int"}}, + {{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_CPU}, + {InferenceEngine::PluginConfigParams::KEY_CPU_THROUGHPUT_STREAMS, "OFF"}}, + {{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_CPU}, + {InferenceEngine::PluginConfigParams::KEY_CPU_BIND_THREAD, "OFF"}}, + {{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_CPU}, + {InferenceEngine::PluginConfigParams::KEY_DYN_BATCH_LIMIT, "NAN"}}, + {{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_CPU}, + {InferenceEngine::PluginConfigParams::KEY_LOG_LEVEL, "NAN"}} + }; + INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, IncorrectConfigTests, ::testing::Combine( ::testing::Values(CommonTestUtils::DEVICE_CPU), @@ -152,7 +194,7 @@ namespace { INSTANTIATE_TEST_SUITE_P(smoke_Auto_BehaviorTests, IncorrectConfigTests, ::testing::Combine( ::testing::Values(CommonTestUtils::DEVICE_AUTO), - ::testing::ValuesIn(multiinconfigs)), + ::testing::ValuesIn(autoinconfigs)), IncorrectConfigTests::getTestCaseName); INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, IncorrectConfigAPITests, @@ -170,7 +212,7 @@ namespace { INSTANTIATE_TEST_SUITE_P(smoke_Auto_BehaviorTests, IncorrectConfigAPITests, ::testing::Combine( ::testing::Values(CommonTestUtils::DEVICE_AUTO), - ::testing::ValuesIn(multiinconfigs)), + ::testing::ValuesIn(autoinconfigs)), IncorrectConfigAPITests::getTestCaseName); const std::vector> ConfigsCheck = { diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/convolution_transformation.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/convolution_transformation.cpp index b2d223c8f31..ffbdd0dbe85 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/convolution_transformation.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/convolution_transformation.cpp @@ -155,4 +155,31 @@ INSTANTIATE_TEST_SUITE_P(smoke_LPT, ConvolutionWIthIncorrectWeightsTransformatio ::testing::ValuesIn(trasformationParamValues), ::testing::ValuesIn(incorrectWeightsParams)), ConvolutionWIthIncorrectWeightsTransformation::getTestCaseName); + +namespace convolution3D { +const std::vector params = { + { + { 256ul, ngraph::Shape { 1, 1, 1}, { 0.f }, { 255.f }, { 0.f }, { 25.5f } }, + false, + { 255ul, ngraph::Shape { 1, 1, 1}, { 0.f }, { 254.f }, { -12.7f }, { 12.7f } }, + false, + "Convolution", + "U8" + }, +}; + +const std::vector shapes = { + { 1, 3, 16 }, + { 4, 3, 16 } +}; + +INSTANTIATE_TEST_SUITE_P(smoke_LPT, ConvolutionTransformation, + ::testing::Combine( + ::testing::ValuesIn(netPrecisions), + ::testing::ValuesIn(shapes), + ::testing::Values(CommonTestUtils::DEVICE_CPU), + ::testing::ValuesIn(trasformationParamValues), + ::testing::ValuesIn(params)), + ConvolutionTransformation::getTestCaseName); +} // namespace convolution3D } // namespace diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/group_convolution_transformation.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/group_convolution_transformation.cpp index 040396db8bc..a6183d5c013 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/group_convolution_transformation.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/group_convolution_transformation.cpp @@ -11,22 +11,23 @@ using namespace LayerTestsDefinitions; namespace { const std::vector netPrecisions = { - ngraph::element::f32, - // ngraph::element::f16 + ngraph::element::f32 }; const std::vector trasformationParamValues = { - LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParams(), - // LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParams().setUpdatePrecisions(false), + LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParams() }; const std::vector addPrecisionPreserved = { true, false }; +const std::vector> inputShapes = { + {{ 1, 6, 24, 24 }, { 1, 24, 18, 18 }}, + {{ 1, 6, 24 }, { 1, 24, 18 }} +}; + const std::vector params = { // group convolution, tensor quantization { - { 1, 6, 24, 24 }, - { 1, 24, 18, 18 }, 3ul, -1, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 25.5f }, { 0.f }, { 25.5f } }, @@ -36,8 +37,6 @@ const std::vector pa }, // group convolution, tensor quantization { - { 1, 6, 24, 24 }, - { 1, 24, 18, 18 }, 3ul, 0, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 25.5f }, { 0.f }, { 25.5f } }, @@ -47,8 +46,6 @@ const std::vector pa }, // group convolution, tensor quantization { - { 1, 6, 24, 24 }, - { 1, 24, 18, 18 }, 3ul, 1, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 25.5f }, { 0.f }, { 25.5f } }, @@ -58,8 +55,6 @@ const std::vector pa }, // group convolution, per-channel quantization { - { 1, 6, 24, 24 }, - { 1, 24, 18, 18 }, 3ul, -1, { @@ -73,11 +68,28 @@ const std::vector pa { 255ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 254.f }, { -127.f }, { 127.f } }, "", "" - }, + } +}; + +INSTANTIATE_TEST_SUITE_P(smoke_LPT, GroupConvolutionTransformation, + ::testing::Combine( + ::testing::ValuesIn(netPrecisions), + ::testing::Values(CommonTestUtils::DEVICE_CPU), + ::testing::ValuesIn(trasformationParamValues), + ::testing::ValuesIn(inputShapes), + ::testing::ValuesIn(params), + ::testing::ValuesIn(addPrecisionPreserved)), + GroupConvolutionTransformation::getTestCaseName); + +namespace depthwise { +const std::vector> inputShapes = { + {{ 1, 6, 24, 24 }, { 1, 6, 18, 18 }}, + {{ 1, 6, 24 }, { 1, 6, 18 }}, +}; + +const std::vector params = { // depth-wise convolution, tensor quantization { - { 1, 6, 24, 24 }, - { 1, 6, 18, 18 }, 6ul, -1, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 25.5f }, { 0.f }, { 25.5f } }, @@ -87,8 +99,6 @@ const std::vector pa }, // depth-wise convolution, per-channel quantization { - { 1, 6, 24, 24 }, - { 1, 6, 18, 18 }, 6ul, -1, { @@ -105,8 +115,6 @@ const std::vector pa }, // depth-wise convolution, per-channel quantization { - ngraph::Shape{ 1, 6, 24, 24 }, - ngraph::Shape{ 1, 6, 18, 18 }, 6ul, -1, { @@ -128,7 +136,10 @@ INSTANTIATE_TEST_SUITE_P(smoke_LPT, GroupConvolutionTransformation, ::testing::ValuesIn(netPrecisions), ::testing::Values(CommonTestUtils::DEVICE_CPU), ::testing::ValuesIn(trasformationParamValues), + ::testing::ValuesIn(inputShapes), ::testing::ValuesIn(params), ::testing::ValuesIn(addPrecisionPreserved)), GroupConvolutionTransformation::getTestCaseName); +} // namespace depthwise + } // namespace diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/reduce_max_transformation.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/reduce_max_transformation.cpp index ec5a659c72b..67e960de0ad 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/reduce_max_transformation.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/reduce_max_transformation.cpp @@ -33,21 +33,21 @@ const std::vector params = { 256ul, ngraph::Shape{ 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 127.f } }, { 2, 3 }, false, - "Output/pool", + "Output_original", "U8" }, { { 256ul, ngraph::Shape{ 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 127.f } }, { 1 }, true, - "Output/pool", + "Output_original", "U8" }, { { 256ul, ngraph::Shape{ 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 127.f } }, { 1 }, false, - "Output/pool", + "Output_original", "U8" }, { @@ -73,7 +73,7 @@ const std::vector params = }, { 2, 3 }, false, - "Output/pool", + "Output_original", "U8" }, { @@ -86,7 +86,7 @@ const std::vector params = }, { 0, 1 }, true, - "Output/pool", + "Output", "FP32" }, { @@ -99,7 +99,7 @@ const std::vector params = }, { 0, 1 }, false, - "Output/pool", + "Output", "FP32" }, }; diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/reduce_mean_transformation.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/reduce_mean_transformation.cpp index d77121a8e5c..284373d7748 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/reduce_mean_transformation.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/reduce_mean_transformation.cpp @@ -33,21 +33,21 @@ const std::vector params = { 256ul, ngraph::Shape{ 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 127.f } }, { 2, 3 }, false, - "Output/pool", + "Output_original", "U8" }, { { 256ul, ngraph::Shape{ 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 127.f } }, { 1 }, true, - "Output/pool", + "Output_original", "U8" }, { { 256ul, ngraph::Shape{ 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 127.f } }, { 1 }, false, - "Output/pool", + "Output_original", "U8" }, { @@ -73,7 +73,7 @@ const std::vector params = }, { 2, 3 }, false, - "Output/pool", + "Output_original", "U8" }, { @@ -86,7 +86,7 @@ const std::vector params = }, { 0, 1 }, true, - "Output/pool", + "Output", "FP32" }, { @@ -99,7 +99,7 @@ const std::vector params = }, { 0, 1 }, false, - "Output/pool", + "Output", "FP32" }, }; diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/reduce_sum_transformation.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/reduce_sum_transformation.cpp index a7ca938ddbe..bf9dac7876b 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/reduce_sum_transformation.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/reduce_sum_transformation.cpp @@ -26,14 +26,14 @@ const std::vector params = { 256ul, ngraph::Shape{ 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 127.f } }, { 2, 3 }, true, - "Output/pool", + "Output_original", "U8" }, { { 256ul, ngraph::Shape{ 1, 1, 1, 1 }, { 2.f }, { 10.f }, { 2.f }, { 10.f } }, { 2, 3 }, false, - "Output/pool", + "Output_original", "U8" }, { @@ -46,7 +46,7 @@ const std::vector params = }, { 2, 3 }, true, - "Output/pool", + "Output_original", "U8" }, { @@ -59,7 +59,7 @@ const std::vector params = }, { 2, 3 }, false, - "Output/pool", + "Output_original", "U8" }, { @@ -72,7 +72,7 @@ const std::vector params = }, { 0, 1 }, true, - "Output/pool", + "Output", "FP32" }, { @@ -85,7 +85,7 @@ const std::vector params = }, { 0, 1 }, false, - "Output/pool", + "Output", "FP32" }, }; diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/single_layer_tests/broadcast.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/single_layer_tests/broadcast.cpp index d30ba6cd215..c9a5ff31bd7 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/single_layer_tests/broadcast.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/single_layer_tests/broadcast.cpp @@ -13,56 +13,103 @@ namespace { const std::vector inputPrecisions = { InferenceEngine::Precision::FP32, + InferenceEngine::Precision::BF16, InferenceEngine::Precision::I32, + InferenceEngine::Precision::I8, + InferenceEngine::Precision::U8 +}; + +const std::vector inputTPrecisions = { + InferenceEngine::Precision::FP16, + InferenceEngine::Precision::I16, InferenceEngine::Precision::BOOL }; -// NUMPY MODE - -std::vector> inShapesNumpy = { - {3, 1}, - {1, 4, 1} -}; - -std::vector> targetShapesNumpy = { +// NUMPY MODE ////////////////////////////////////////// +// 1D +std::vector> targetShapesNumpy1D = { + {1}, + {16}, + {1, 16}, + {1, 1, 16}, + {2, 16}, {2, 3, 6}, - {1, 4, 4} + {1, 4, 4}, }; -const auto numpyBroadcastParams1 = ::testing::Combine( - ::testing::Values(targetShapesNumpy[0]), +const auto numpyBroadcast1DInputParams = ::testing::Combine( + ::testing::ValuesIn(targetShapesNumpy1D), ::testing::Values(ngraph::AxisSet{}), //not used in numpy mode ::testing::Values(ngraph::op::BroadcastType::NUMPY), - ::testing::Values(inShapesNumpy[0]), + ::testing::Values(std::vector{1}), ::testing::ValuesIn(inputPrecisions), ::testing::Values(CommonTestUtils::DEVICE_CPU) ); -INSTANTIATE_TEST_SUITE_P( - smoke_TestNumpyBroadcast1, - BroadcastLayerTest, - numpyBroadcastParams1, - BroadcastLayerTest::getTestCaseName -); +INSTANTIATE_TEST_CASE_P(smoke_TestNumpyBroadcast1D, BroadcastLayerTest, numpyBroadcast1DInputParams, BroadcastLayerTest::getTestCaseName); -const auto numpyBroadcastParams2 = ::testing::Combine( - ::testing::Values(targetShapesNumpy[1]), +INSTANTIATE_TEST_CASE_P(smoke_PrecTransformation, BroadcastLayerTest, + ::testing::Combine( + ::testing::Values(targetShapesNumpy1D[0]), + ::testing::Values(ngraph::AxisSet{}), //not used in numpy mode + ::testing::Values(ngraph::op::BroadcastType::NUMPY), + ::testing::Values(std::vector{1}), + ::testing::ValuesIn(inputTPrecisions), + ::testing::Values(CommonTestUtils::DEVICE_CPU)), + BroadcastLayerTest::getTestCaseName); + +// 2D +std::vector> targetShapesNumpy2D = { + {3, 1}, + {3, 6}, + {2, 3, 6}, + {2, 2, 3, 6}, +}; + +const auto numpyBroadcast2DInputParams = ::testing::Combine( + ::testing::ValuesIn(targetShapesNumpy2D), ::testing::Values(ngraph::AxisSet{}), //not used in numpy mode ::testing::Values(ngraph::op::BroadcastType::NUMPY), - ::testing::Values(inShapesNumpy[1]), + ::testing::Values(std::vector{3, 1}), ::testing::ValuesIn(inputPrecisions), ::testing::Values(CommonTestUtils::DEVICE_CPU) ); -INSTANTIATE_TEST_SUITE_P( - smoke_TestNumpyBroadcast2, - BroadcastLayerTest, - numpyBroadcastParams2, - BroadcastLayerTest::getTestCaseName +INSTANTIATE_TEST_CASE_P(smoke_TestNumpyBroadcast2D, BroadcastLayerTest, numpyBroadcast2DInputParams, BroadcastLayerTest::getTestCaseName); + +// 3D +std::vector> targetShapesNumpy3D = { + {1, 4, 1}, + {1, 4, 4}, + {1, 1, 4, 4}, + {2, 1, 1, 4, 4}, +}; + +const auto numpyBroadcast3DInputParams = ::testing::Combine( + ::testing::ValuesIn(targetShapesNumpy3D), + ::testing::Values(ngraph::AxisSet{}), //not used in numpy mode + ::testing::Values(ngraph::op::BroadcastType::NUMPY), + ::testing::Values(std::vector{1, 4, 1}), + ::testing::ValuesIn(inputPrecisions), + ::testing::Values(CommonTestUtils::DEVICE_CPU) ); -// BIDIRECTIONAL MODE +INSTANTIATE_TEST_CASE_P(smoke_TestNumpyBroadcast3D, BroadcastLayerTest, numpyBroadcast3DInputParams, BroadcastLayerTest::getTestCaseName); +// NGRAPH EVALUATE +const auto numpyBroadcastNgraphEvaluateParams = ::testing::Combine( + ::testing::Values(std::vector{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}), + ::testing::Values(ngraph::AxisSet{}), //not used in numpy mode + ::testing::Values(ngraph::op::BroadcastType::NUMPY), + ::testing::Values(std::vector{1, 2, 1, 4, 1, 6, 1, 8, 1, 10}), + ::testing::ValuesIn(inputPrecisions), + ::testing::Values(CommonTestUtils::DEVICE_CPU) +); + +INSTANTIATE_TEST_CASE_P(smoke_TestNumpyBroadcastNgraphEvaluate, BroadcastLayerTest, numpyBroadcastNgraphEvaluateParams, BroadcastLayerTest::getTestCaseName); +// END NUMPY MODE ////////////////////////////////////// + +// BIDIRECTIONAL MODE ////////////////////////////////// std::vector> inShapesBidi = { {4, 1}, {1, 4, 1}, @@ -70,42 +117,38 @@ std::vector> inShapesBidi = { }; std::vector> targetShapesBidi = { - {2, 1, 4}, + {4, 1, 4}, {1, 4, 4}, - {1, 1, 2, 2} + {1, 1, 4, 4} }; -const auto bidirectionalBroadcastParams1 = ::testing::Combine( - ::testing::Values(targetShapesBidi[0]), +const auto bidirectionalBroadcastParams = ::testing::Combine( + ::testing::ValuesIn(targetShapesBidi), ::testing::Values(ngraph::AxisSet{}), //not used in bidirectional mode ::testing::Values(ngraph::op::BroadcastType::BIDIRECTIONAL), - ::testing::Values(inShapesBidi[0]), + ::testing::ValuesIn(inShapesBidi), ::testing::ValuesIn(inputPrecisions), ::testing::Values(CommonTestUtils::DEVICE_CPU) ); -INSTANTIATE_TEST_SUITE_P( - smoke_TestBidirectionalBroadcast1, - BroadcastLayerTest, - bidirectionalBroadcastParams1, - BroadcastLayerTest::getTestCaseName -); +INSTANTIATE_TEST_CASE_P(smoke_TestBidirectionalBroadcast, BroadcastLayerTest, bidirectionalBroadcastParams, BroadcastLayerTest::getTestCaseName); -const auto bidirectionalBroadcastParams2 = ::testing::Combine( - ::testing::Values(targetShapesBidi[1]), - ::testing::Values(ngraph::AxisSet{}), //not used in bidirectional mode - ::testing::Values(ngraph::op::BroadcastType::BIDIRECTIONAL), - ::testing::Values(inShapesBidi[1]), +// EXPLICIT MODE /////////////////////////////////////// +// 1D +std::vector> inShapesExplicit1D = { {4} }; +std::vector> targetShapesExplicit1D = { {4, 2, 4}, {4, 2, 4, 1} }; +std::vector axes1D = { {0}, {2} }; + +const auto explicitBroadcast1DInputParams = ::testing::Combine( + ::testing::ValuesIn(targetShapesExplicit1D), + ::testing::ValuesIn(axes1D), + ::testing::Values(ngraph::op::BroadcastType::EXPLICIT), + ::testing::ValuesIn(inShapesExplicit1D), ::testing::ValuesIn(inputPrecisions), ::testing::Values(CommonTestUtils::DEVICE_CPU) ); -INSTANTIATE_TEST_SUITE_P( - smoke_TestBidirectionalBroadcast2, - BroadcastLayerTest, - bidirectionalBroadcastParams2, - BroadcastLayerTest::getTestCaseName -); +INSTANTIATE_TEST_CASE_P(smoke_TestExplicitBroadcast1D, BroadcastLayerTest, explicitBroadcast1DInputParams, BroadcastLayerTest::getTestCaseName); const auto bidirectionalBroadcastParams3 = ::testing::Combine( ::testing::Values(targetShapesBidi[2]), @@ -135,40 +178,38 @@ std::vector> targetShapesExplicit = { {2, 3, 4} }; -std::vector axes = { - {1, 2}, - {0, 2} -}; +// 2D +std::vector> inShapesExplicit2D = { {2, 4} }; +std::vector> targetShapesExplicit2D = { {2, 2, 4}, {2, 2, 4, 1}}; +std::vector axes2D = { {1, 2}, {0, 2} }; -const auto explicitBroadcastParams1 = ::testing::Combine( - ::testing::Values(targetShapesExplicit[0]), - ::testing::Values(axes[0]), +const auto explicitBroadcast2DInputParams = ::testing::Combine( + ::testing::ValuesIn(targetShapesExplicit2D), + ::testing::ValuesIn(axes2D), ::testing::Values(ngraph::op::BroadcastType::EXPLICIT), - ::testing::Values(inShapesExplicit[0]), + ::testing::ValuesIn(inShapesExplicit2D), ::testing::ValuesIn(inputPrecisions), ::testing::Values(CommonTestUtils::DEVICE_CPU) ); -INSTANTIATE_TEST_SUITE_P( - smoke_TestExplicitBroadcast1, - BroadcastLayerTest, - explicitBroadcastParams1, - BroadcastLayerTest::getTestCaseName -); +INSTANTIATE_TEST_CASE_P(smoke_TestExplicitBroadcast2D, BroadcastLayerTest, explicitBroadcast2DInputParams, BroadcastLayerTest::getTestCaseName); -const auto explicitBroadcastParams2 = ::testing::Combine( - ::testing::Values(targetShapesExplicit[1]), - ::testing::Values(axes[1]), +// 3D +std::vector> inShapesExplicit3D = { {2, 2, 2} }; +std::vector> targetShapesExplicit3D = { {2, 2, 2, 2} }; +std::vector axes3D = { {0, 1, 2}, {0, 1, 3}, {0, 2, 3}, {1, 2, 3} }; + +const auto explicitBroadcast3DInputParams = ::testing::Combine( + ::testing::ValuesIn(targetShapesExplicit3D), + ::testing::ValuesIn(axes3D), ::testing::Values(ngraph::op::BroadcastType::EXPLICIT), - ::testing::Values(inShapesExplicit[1]), + ::testing::ValuesIn(inShapesExplicit3D), ::testing::ValuesIn(inputPrecisions), ::testing::Values(CommonTestUtils::DEVICE_CPU) ); -INSTANTIATE_TEST_SUITE_P( - smoke_TestExplicitBroadcast2, - BroadcastLayerTest, - explicitBroadcastParams2, - BroadcastLayerTest::getTestCaseName -); -} // namespace \ No newline at end of file +INSTANTIATE_TEST_CASE_P(smoke_TestExplicitBroadcast3D, BroadcastLayerTest, explicitBroadcast3DInputParams, BroadcastLayerTest::getTestCaseName); +// END EXPLICIT MODE /////////////////////////////////// + +} // namespace + diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/single_layer_tests/matrix_nms.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/single_layer_tests/matrix_nms.cpp index 816a5b9c1c1..477e4e1fc74 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/single_layer_tests/matrix_nms.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/single_layer_tests/matrix_nms.cpp @@ -8,14 +8,25 @@ #include "single_layer_tests/matrix_nms.hpp" #include "common_test_utils/test_constants.hpp" -using namespace LayerTestsDefinitions; +using namespace ov::test::subgraph; using namespace InferenceEngine; using namespace ngraph; +const std::vector> inStaticShapeParams = { + {{3, 100, 4}, {3, 1, 100}}, + {{1, 10, 4}, {1, 100, 10 }} +}; -const std::vector inShapeParams = { - InputShapeParams{3, 100, 5}, - InputShapeParams{1, 10, 50}, - InputShapeParams{2, 50, 50} +const std::vector> inDynamicShapeParams = { + // num_batches, num_boxes, 4 + {{{ngraph::Dimension::dynamic(), ngraph::Dimension::dynamic(), 4}, + {{1, 10, 4}, {2, 100, 4}}}, + // num_batches, num_classes, num_boxes + {{ngraph::Dimension::dynamic(), ngraph::Dimension::dynamic(), ngraph::Dimension::dynamic()}, + {{1, 3, 10}, {2, 5, 100}}}}, + {{{ngraph::Dimension(1, 10), ngraph::Dimension(1, 100), 4}, + {{1, 10, 4}, {2, 100, 4}}}, + {{{ngraph::Dimension(1, 10), ngraph::Dimension(1, 100), ngraph::Dimension(1, 100)}}, + {{1, 3, 10}, {2, 5, 100}}}} }; const std::vector sortResultType = {op::v8::MatrixNms::SortResultType::CLASSID, @@ -32,23 +43,38 @@ const std::vector thresholdParams = { }; const std::vector nmsTopK = {-1, 100}; const std::vector keepTopK = {-1, 5}; -const std::vector backgroudClass = {-1, 0}; +const std::vector backgroudClass = {-1, 1}; const std::vector normalized = {true, false}; const std::vector decayFunction = {op::v8::MatrixNms::DecayFunction::GAUSSIAN, op::v8::MatrixNms::DecayFunction::LINEAR}; -const auto nmsParams = ::testing::Combine(::testing::ValuesIn(inShapeParams), - ::testing::Combine(::testing::Values(Precision::FP32), - ::testing::Values(Precision::I32), - ::testing::Values(Precision::FP32)), - ::testing::ValuesIn(sortResultType), - ::testing::ValuesIn(outType), - ::testing::ValuesIn(topKParams), - ::testing::ValuesIn(thresholdParams), - ::testing::ValuesIn(backgroudClass), - ::testing::ValuesIn(normalized), - ::testing::ValuesIn(decayFunction), - ::testing::Values(CommonTestUtils::DEVICE_CPU) +const auto nmsParamsStatic = ::testing::Combine(::testing::ValuesIn(ov::test::static_shapes_to_test_representation(inStaticShapeParams)), + ::testing::Combine(::testing::Values(ov::element::f32), + ::testing::Values(ov::element::i32), + ::testing::Values(ov::element::f32)), + ::testing::ValuesIn(sortResultType), + ::testing::ValuesIn(outType), + ::testing::ValuesIn(topKParams), + ::testing::ValuesIn(thresholdParams), + ::testing::ValuesIn(backgroudClass), + ::testing::ValuesIn(normalized), + ::testing::ValuesIn(decayFunction), + ::testing::Values(CommonTestUtils::DEVICE_CPU) ); -INSTANTIATE_TEST_SUITE_P(smoke_MatrixNmsLayerTest, MatrixNmsLayerTest, nmsParams, MatrixNmsLayerTest::getTestCaseName); +const auto nmsParamsDynamic = ::testing::Combine(::testing::ValuesIn(inDynamicShapeParams), + ::testing::Combine(::testing::Values(ov::element::f32), + ::testing::Values(ov::element::i32), + ::testing::Values(ov::element::f32)), + ::testing::ValuesIn(sortResultType), + ::testing::ValuesIn(outType), + ::testing::ValuesIn(topKParams), + ::testing::ValuesIn(thresholdParams), + ::testing::ValuesIn(backgroudClass), + ::testing::ValuesIn(normalized), + ::testing::ValuesIn(decayFunction), + ::testing::Values(CommonTestUtils::DEVICE_CPU) +); + +INSTANTIATE_TEST_SUITE_P(smoke_MatrixNmsLayerTest_static, MatrixNmsLayerTest, nmsParamsStatic, MatrixNmsLayerTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_MatrixNmsLayerTest_dynamic, MatrixNmsLayerTest, nmsParamsDynamic, MatrixNmsLayerTest::getTestCaseName); diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/single_layer_tests/multiclass_nms.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/single_layer_tests/multiclass_nms.cpp index 33844763173..1988ef53e2a 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/single_layer_tests/multiclass_nms.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/single_layer_tests/multiclass_nms.cpp @@ -8,16 +8,32 @@ #include "common_test_utils/test_constants.hpp" -using namespace LayerTestsDefinitions; +using namespace ov::test::subgraph; using namespace InferenceEngine; using namespace ngraph; -const std::vector inShapeParams = {InputShapeParams {3, 100, 5}, InputShapeParams {1, 10, 50}, InputShapeParams {2, 50, 50}}; +const std::vector> inStaticShapeParams = { + {{3, 100, 4}, {3, 1, 100}}, + {{1, 10, 4}, {1, 100, 10 }} +}; + +const std::vector> inDynamicShapeParams = { + // num_batches, num_boxes, 4 + {{{ngraph::Dimension::dynamic(), ngraph::Dimension::dynamic(), 4}, + {{1, 10, 4}, {2, 100, 4}}}, + // num_batches, num_classes, num_boxes + {{ngraph::Dimension::dynamic(), ngraph::Dimension::dynamic(), ngraph::Dimension::dynamic()}, + {{1, 3, 10}, {2, 5, 100}}}}, + {{{ngraph::Dimension(1, 10), ngraph::Dimension(1, 100), 4}, + {{1, 10, 4}, {2, 100, 4}}}, + {{{ngraph::Dimension(1, 10), ngraph::Dimension(1, 100), ngraph::Dimension(1, 100)}}, + {{1, 3, 10}, {2, 5, 100}}}} +}; const std::vector nmsTopK = {-1, 20}; const std::vector iouThreshold = {0.7f}; const std::vector scoreThreshold = {0.7f}; -const std::vector backgroundClass = {-1, 0}; +const std::vector backgroundClass = {-1, 1}; const std::vector keepTopK = {-1, 30}; const std::vector outType = {element::i32, element::i64}; @@ -27,11 +43,29 @@ const std::vector sortResDesc = {true, false}; const std::vector nmsEta = {0.6f, 1.0f}; const std::vector normalized = {true, false}; -const auto nmsParams = ::testing::Combine( - ::testing::ValuesIn(inShapeParams), - ::testing::Combine(::testing::Values(Precision::FP32), ::testing::Values(Precision::I32), ::testing::Values(Precision::FP32)), ::testing::ValuesIn(nmsTopK), +const auto nmsParamsStatic = ::testing::Combine( + ::testing::ValuesIn(ov::test::static_shapes_to_test_representation(inStaticShapeParams)), + ::testing::Combine(::testing::Values(ov::element::f32), ::testing::Values(ov::element::i32), ::testing::Values(ov::element::f32)), + ::testing::ValuesIn(nmsTopK), ::testing::Combine(::testing::ValuesIn(iouThreshold), ::testing::ValuesIn(scoreThreshold), ::testing::ValuesIn(nmsEta)), - ::testing::ValuesIn(backgroundClass), ::testing::ValuesIn(keepTopK), ::testing::ValuesIn(outType), ::testing::ValuesIn(sortResultType), - ::testing::Combine(::testing::ValuesIn(sortResDesc), ::testing::ValuesIn(normalized)), ::testing::Values(CommonTestUtils::DEVICE_CPU)); + ::testing::ValuesIn(backgroundClass), + ::testing::ValuesIn(keepTopK), + ::testing::ValuesIn(outType), + ::testing::ValuesIn(sortResultType), + ::testing::Combine(::testing::ValuesIn(sortResDesc), ::testing::ValuesIn(normalized)), + ::testing::Values(CommonTestUtils::DEVICE_CPU)); -INSTANTIATE_TEST_SUITE_P(smoke_MulticlassNmsLayerTest, MulticlassNmsLayerTest, nmsParams, MulticlassNmsLayerTest::getTestCaseName); +const auto nmsParamsDynamic = ::testing::Combine( + ::testing::ValuesIn(inDynamicShapeParams), + ::testing::Combine(::testing::Values(ov::element::f32), ::testing::Values(ov::element::i32), ::testing::Values(ov::element::f32)), + ::testing::ValuesIn(nmsTopK), + ::testing::Combine(::testing::ValuesIn(iouThreshold), ::testing::ValuesIn(scoreThreshold), ::testing::ValuesIn(nmsEta)), + ::testing::ValuesIn(backgroundClass), + ::testing::ValuesIn(keepTopK), + ::testing::ValuesIn(outType), + ::testing::ValuesIn(sortResultType), + ::testing::Combine(::testing::ValuesIn(sortResDesc), ::testing::ValuesIn(normalized)), + ::testing::Values(CommonTestUtils::DEVICE_CPU)); + +INSTANTIATE_TEST_SUITE_P(smoke_MulticlassNmsLayerTest_static, MulticlassNmsLayerTest, nmsParamsStatic, MulticlassNmsLayerTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_MulticlassNmsLayerTest_dynamic, MulticlassNmsLayerTest, nmsParamsDynamic, MulticlassNmsLayerTest::getTestCaseName); \ No newline at end of file diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/single_layer_tests/prior_box.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/single_layer_tests/prior_box.cpp index d4c56aa0078..4be78d242b8 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/single_layer_tests/prior_box.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/single_layer_tests/prior_box.cpp @@ -50,6 +50,9 @@ const std::vector> variances = { const std::vector scale_all_sizes = { false, true}; +const std::vector min_max_aspect_ratios_order = { + false, true}; + const std::vector inputShape = {300, 300}; const std::vector imageShape = {32, 32}; @@ -65,7 +68,8 @@ const auto layerSpecificParams = ::testing::Combine( ::testing::ValuesIn(steps), ::testing::ValuesIn(offsets), ::testing::ValuesIn(variances), - ::testing::ValuesIn(scale_all_sizes)); + ::testing::ValuesIn(scale_all_sizes), + ::testing::ValuesIn(min_max_aspect_ratios_order)); INSTANTIATE_TEST_SUITE_P(smoke_PriorBox_Basic, PriorBoxLayerTest, ::testing::Combine( diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/single_layer_tests/tile.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/single_layer_tests/tile.cpp index bff906dd101..8fb376fe0b9 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/single_layer_tests/tile.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/single_layer_tests/tile.cpp @@ -11,11 +11,28 @@ using namespace LayerTestsDefinitions; namespace { const std::vector netPrecisions = { + InferenceEngine::Precision::I8, + InferenceEngine::Precision::U8, + InferenceEngine::Precision::I32, + InferenceEngine::Precision::BF16, InferenceEngine::Precision::FP32 }; +const std::vector netTPrecisions = { + InferenceEngine::Precision::I64, + InferenceEngine::Precision::I16, + InferenceEngine::Precision::FP16, +}; + +const std::vector> inputShapes = { + {2, 3, 4}, + {1, 1, 1}, +}; + const std::vector> repeats3D = { {1, 2, 3}, + {1, 1, 2, 3}, + {1, 2, 1, 3}, {2, 1, 1}, {2, 3, 1}, {2, 2, 2}, @@ -30,7 +47,19 @@ INSTANTIATE_TEST_SUITE_P(smoke_Tile, TileLayerTest, ::testing::Values(InferenceEngine::Precision::UNSPECIFIED), ::testing::Values(InferenceEngine::Layout::ANY), ::testing::Values(InferenceEngine::Layout::ANY), - ::testing::Values(std::vector({2, 3, 4})), + ::testing::ValuesIn(inputShapes), + ::testing::Values(CommonTestUtils::DEVICE_CPU)), + TileLayerTest::getTestCaseName); + +INSTANTIATE_TEST_SUITE_P(smoke_PrecTransformation, TileLayerTest, + ::testing::Combine( + ::testing::Values(repeats3D[0]), + ::testing::ValuesIn(netTPrecisions), + ::testing::Values(InferenceEngine::Precision::UNSPECIFIED), + ::testing::Values(InferenceEngine::Precision::UNSPECIFIED), + ::testing::Values(InferenceEngine::Layout::ANY), + ::testing::Values(InferenceEngine::Layout::ANY), + ::testing::Values(inputShapes[0]), ::testing::Values(CommonTestUtils::DEVICE_CPU)), TileLayerTest::getTestCaseName); diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/skip_tests_config.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/skip_tests_config.cpp index 3e681558a71..d4b26dababb 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/skip_tests_config.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/skip_tests_config.cpp @@ -84,6 +84,10 @@ std::vector disabledTestPatterns() { R"(.*(Auto|Multi).*Behavior.*IncorrectConfigTests.*CanNotLoadNetworkWithIncorrectConfig.*)", R"(.*OVExecutableNetworkBaseTest.*(CanGetInputsInfoAndCheck|CanSetConfigToExecNet).*)", R"(.*Behavior.*CorrectConfigCheck.*(canSetConfigAndCheckGetConfig|canSetConfigTwiceAndCheckGetConfig).*CPU_BIND_THREAD=YES.*)", + // Issue: 62846 Here shape[1] is not the channel dimension size + R"(.*smoke_Reduce.*KeepNoDims.*(_axes=\((0.*|.*1.*)).*Fused=.*PerChannel.*)", + // Issue: 72021 Unreasonable abs_threshold for comparing bf16 results + R"(.*smoke_Reduce.*type=(Prod|Min).*netPRC=(BF|bf)16.*)", // TODO: 56520 Accuracy mismatch R"(.*ReduceOpsLayerTest.*type=Mean_.*netPRC=(I64|I32).*)", R"(.*ReduceOpsLayerTest.*type=Mean_.*netPRC=U64.*)", @@ -153,6 +157,16 @@ std::vector disabledTestPatterns() { // TODO : CVS-69533 R"(.*ConvolutionLayerCPUTest.*IS=\{.+\}.*_Fused=.*Add\(Parameters\).*)", R"(.*GroupConvolutionLayerCPUTest.*IS=\{.+\}.*_Fused=.*Add\(Parameters\).*)", + // Issue: 71968 + R"(.*LSTMSequenceCommonZeroClip.*PURE.*CONST.*hidden_size=10.*sigmoid.sigmoid.sigmoid.*reverse.*FP32_targetDevice=CPU.*)", + // Issue: 72005 + // there are some inconsistency between cpu plugin and ng ref + // for ctcMergeRepeated is true when legal randomized inputs value. + // Failure happened on win and macos for current seeds. + R"(.*CTCLossLayerTest.*CMR=1.*)", + R"(.*CTCLossLayerCPUTest.*ctcMergeRepeated=1.*)", + // Issue: 72151 + R"(.*smoke_ROIAlignLayoutTest.*)", }; #define FIX_62820 0 diff --git a/inference-engine/tests/functional/plugin/cpu/single_layer_tests/adaptive_pooling.cpp b/inference-engine/tests/functional/plugin/cpu/single_layer_tests/adaptive_pooling.cpp index e8232476ec4..f9b1f59108a 100644 --- a/inference-engine/tests/functional/plugin/cpu/single_layer_tests/adaptive_pooling.cpp +++ b/inference-engine/tests/functional/plugin/cpu/single_layer_tests/adaptive_pooling.cpp @@ -2,53 +2,65 @@ // SPDX-License-Identifier: Apache-2.0 // +#include +#include "shared_test_classes/base/ov_subgraph.hpp" #include "test_utils/cpu_test_utils.hpp" #include "ngraph_functions/builders.hpp" #include "ngraph_functions/utils/ngraph_helpers.hpp" using namespace InferenceEngine; using namespace CPUTestUtils; +using namespace ov::test; namespace CPULayerTestsDefinitions { namespace { std::vector pooledSpatialShape; std::string mode; - std::vector inputShape; + std::vector inputShape; } // namespace -typedef std::tuple< +using AdaPoolSpecificParams = std::tuple< std::vector, // pooled vector - std::vector // feature map shape -> AdaPoolSpecificParams; + std::vector>; // feature map shape -typedef std::tuple< +using AdaPoolLayerTestParams = std::tuple< AdaPoolSpecificParams, - std::string, // mode - InferenceEngine::Precision, // Net precision - LayerTestsUtils::TargetDevice // Device name -> AdaPoolLayerTestParams; + std::string, // mode + bool, // second Input is Constant + ElementType, // Net precision + TargetDevice>; // Device name -typedef std::tuple< +using AdaPoolLayerCPUTestParamsSet = std::tuple< CPULayerTestsDefinitions::AdaPoolLayerTestParams, - CPUSpecificParams> AdaPoolLayerCPUTestParamsSet; + CPUSpecificParams>; class AdaPoolLayerCPUTest : public testing::WithParamInterface, - virtual public LayerTestsUtils::LayerTestsCommon, public CPUTestsBase { + virtual public SubgraphBaseTest, public CPUTestsBase { public: static std::string getTestCaseName(testing::TestParamInfo obj) { CPULayerTestsDefinitions::AdaPoolLayerTestParams basicParamsSet; CPUSpecificParams cpuParams; std::tie(basicParamsSet, cpuParams) = obj.param; std::string td; - Precision netPr; + ElementType netPr; + bool isStatic; AdaPoolSpecificParams adaPar; - std::tie(adaPar, mode, netPr, td) = basicParamsSet; + std::tie(adaPar, mode, isStatic, netPr, td) = basicParamsSet; std::tie(pooledSpatialShape, inputShape) = adaPar; std::ostringstream result; result << "AdaPoolTest_"; - result << "IS=" << CommonTestUtils::vec2str(inputShape) << "_"; + result << "IS=("; + for (const auto& shape : inputShape) { + result << CommonTestUtils::partialShape2str({shape.first}) << "_"; + } + result << ")_TS=("; + for (const auto& shape : inputShape) { + for (const auto& item : shape.second) { + result << CommonTestUtils::vec2str(item) << "_"; + } + } result << "OS=" << CommonTestUtils::vec2str(pooledSpatialShape) << "(spat.)_"; - result << netPr.name() << "_"; + result << netPr << "_"; result << mode << "_"; result << CPUTestsBase::getTestCaseName(cpuParams) << "_"; result << std::to_string(obj.index); @@ -62,31 +74,103 @@ protected: std::tie(inFmts, outFmts, priority, selectedType) = cpuParams; CPULayerTestsDefinitions::AdaPoolSpecificParams adaPoolParams; - auto netPrecision = InferenceEngine::Precision::UNSPECIFIED; - std::tie(adaPoolParams, mode, netPrecision, targetDevice) = basicParamsSet; - inPrc = outPrc = netPrecision; - std::tie(pooledSpatialShape, inputShape) = adaPoolParams; + ElementType netPrecision; + bool isStatic; + std::tie(adaPoolParams, mode, isStatic, netPrecision, targetDevice) = basicParamsSet; + std::tie(pooledVector, inputShape) = adaPoolParams; - ngraph::Shape coordsShape = {pooledSpatialShape.size() }; - auto pooledParam = ngraph::builder::makeConstant(ngraph::element::i32, coordsShape, pooledSpatialShape); - auto params = ngraph::builder::makeParams(ngraph::element::f32, {inputShape}); - - // we cannot create abstract Op to use polymorphism - auto adapoolMax = std::make_shared(params[0], pooledParam, ngraph::element::i32); - adapoolMax->get_rt_info() = getCPUInfo(); - auto adapoolAvg = std::make_shared(params[0], pooledParam); - adapoolAvg->get_rt_info() = getCPUInfo(); + init_input_shapes(inputShape); + if (!isStatic) { + for (auto &target : targetStaticShapes) { + target.push_back({pooledVector.size()}); + } + } selectedType = std::string("unknown_FP32"); - threshold = 1e-2; - function = (mode == "max" ? std::make_shared(adapoolMax->outputs(), params, "AdaPoolMax") : - std::make_shared(adapoolAvg->outputs(), params, "AdaPoolAvg")); + if (netPrecision == ElementType::bf16) { + rel_threshold = 1e-2; + } + function = createFunction(isStatic); } + + void generatePooledVector() { + std::random_device rd; + std::uniform_int_distribution distribution(1, 5); + for (int i = 0; i < pooledVector.size(); i++) { + pooledVector[i] = distribution(rd); + } + } + + std::shared_ptr createFunction(bool secondInputConst) { + auto params = ngraph::builder::makeDynamicParams(ngraph::element::f32, { inputDynamicShapes[0] }); + params.front()->set_friendly_name("ParamsInput"); + std::shared_ptr secondInput; + if (secondInputConst) { + secondInput = ngraph::op::Constant::create(ngraph::element::i32, ngraph::Shape{pooledVector.size()}, pooledVector); + } else { + auto pooledParam = std::make_shared(ngraph::element::i32, ngraph::Shape{pooledVector.size()}); + pooledParam->set_friendly_name("ParamSecondInput"); + params.push_back(pooledParam); + secondInput = pooledParam; + } + + auto adapoolMax = std::make_shared(params[0], secondInput, ngraph::element::i32); + adapoolMax->get_rt_info() = getCPUInfo(); + auto adapoolAvg = std::make_shared(params[0], secondInput); + adapoolAvg->get_rt_info() = getCPUInfo(); + + auto function = (mode == "max" ? std::make_shared(adapoolMax->outputs(), params, "AdaPoolMax") : + std::make_shared(adapoolAvg->outputs(), params, "AdaPoolAvg")); + return function; + } + + void init_ref_function(std::shared_ptr &funcRef, const std::vector& targetInputStaticShapes) override { + if (function->get_parameters().size() == 2) { + generatePooledVector(); + funcRef = createFunction(true); + } + ngraph::helpers::resize_function(funcRef, targetInputStaticShapes); + } + + void validate() override { + if (function->get_parameters().size() == 2) { + auto pos = std::find_if(inputs.begin(), inputs.end(), + [](const std::pair, ov::runtime::Tensor> ¶ms) { + return params.first->get_friendly_name() == "ParamSecondInput"; + }); + IE_ASSERT(pos != inputs.end()); + inputs.erase(pos); + } + SubgraphBaseTest::validate(); + } + + void generate_inputs(const std::vector& targetInputStaticShapes) override { + inputs.clear(); + const auto& funcInputs = function->inputs(); + for (int i = 0; i < funcInputs.size(); ++i) { + const auto& funcInput = funcInputs[i]; + ov::runtime::Tensor tensor; + + if (i == 1) { + tensor = ov::runtime::Tensor(funcInput.get_element_type(), targetInputStaticShapes[i]); + auto *dataPtr = tensor.data(); + for (size_t i = 0; i < pooledVector.size(); i++) { + dataPtr[i] = pooledVector[i]; + } + } else { + tensor = ov::test::utils::create_and_fill_tensor(funcInput.get_element_type(), targetInputStaticShapes[i], 2560, 0, 256); + } + inputs.insert({funcInput.get_node_shared_ptr(), tensor}); + } + } + +private: + std::vector pooledVector; }; TEST_P(AdaPoolLayerCPUTest, CompareWithRefs) { SKIP_IF_CURRENT_TEST_IS_DISABLED() - Run(); + run(); CheckPluginRelatedResults(executableNetwork, "AdaptivePooling"); } @@ -151,9 +235,9 @@ std::vector filterCPUInfoForDevice(std::string dims = "3D", s return resCPUParams; } -const std::vector netPrecisions = { - InferenceEngine::Precision::FP32, - InferenceEngine::Precision::BF16 +const std::vector netPrecisions = { + ElementType::f32, + ElementType::bf16 }; const std::vector> pooled3DVector = { @@ -173,24 +257,36 @@ const std::vector> pooled5DVector = { { 3, 5, 3 }, }; -const std::vector> input3DShapeVector = { - SizeVector({ 1, 17, 3 }), - SizeVector({ 3, 17, 5 }), +std::vector> staticInput3DShapeVector = {{{1, 17, 3}, {3, 7, 5}}}; + +const std::vector> input3DShapeVector = { + { + {{{-1, 17, -1}, {{1, 17, 3}, {3, 17, 5}, {3, 17, 5}}}}, + {{{{1, 10}, 20, {1, 10}}, {{1, 20, 5}, {2, 20, 4}, {3, 20, 6}}}} + } }; -const std::vector> input4DShapeVector = { - SizeVector({ 1, 3, 1, 1 }), - SizeVector({ 3, 17, 5, 2 }), +std::vector> staticInput4DShapeVector = {{{1, 3, 1, 1}, {3, 17, 5, 2}}}; + +const std::vector> input4DShapeVector = { + { + {{{-1, 3, -1, -1}, {{1, 3, 1, 1}, {3, 3, 5, 2}, {3, 3, 5, 2}}}}, + {{{{1, 10}, 3, {1, 10}, {1, 10}}, {{2, 3, 10, 6}, {3, 3, 6, 5}, {3, 3, 6, 5}}}} + } }; -const std::vector> input5DShapeVector = { - SizeVector({ 1, 17, 2, 5, 2 }), - SizeVector({ 3, 17, 4, 5, 4 }), +std::vector> staticInput5DShapeVector = {{{ 1, 17, 2, 5, 2}, {3, 17, 4, 5, 4}}}; + +const std::vector> input5DShapeVector = { + { + {{{-1, 17, -1, -1, -1}, {{1, 17, 2, 5, 2}, {3, 17, 4, 5, 4}, {3, 17, 4, 5, 4}}}}, + {{{{1, 10}, 3, {1, 10}, {1, 10}, {1, 10}}, {{3, 3, 2, 5, 2}, {1, 3, 4, 5, 4}, {1, 3, 4, 5, 4}}}} + } }; const auto adaPool3DParams = ::testing::Combine( ::testing::ValuesIn(pooled3DVector), // output spatial shape - ::testing::ValuesIn(input3DShapeVector) // feature map shape + ::testing::ValuesIn(input3DShapeVector) // feature map shape ); const auto adaPool4DParams = ::testing::Combine( @@ -203,11 +299,27 @@ const auto adaPool5DParams = ::testing::Combine( ::testing::ValuesIn(input5DShapeVector) // feature map shape ); +const auto staticAdaPool3DParams = ::testing::Combine( + ::testing::ValuesIn(pooled3DVector), // output spatial shape + ::testing::ValuesIn(static_shapes_to_test_representation(staticInput3DShapeVector)) // feature map shape +); + +const auto staticAdaPool4DParams = ::testing::Combine( + ::testing::ValuesIn(pooled4DVector), // output spatial shape + ::testing::ValuesIn(static_shapes_to_test_representation(staticInput4DShapeVector)) // feature map shape +); + +const auto staticAdaPool5DParams = ::testing::Combine( + ::testing::ValuesIn(pooled5DVector), // output spatial shape + ::testing::ValuesIn(static_shapes_to_test_representation(staticInput5DShapeVector)) // feature map shape +); + INSTANTIATE_TEST_SUITE_P(smoke_AdaPoolAvg3DLayoutTest, AdaPoolLayerCPUTest, ::testing::Combine( ::testing::Combine( adaPool3DParams, ::testing::Values("avg"), + ::testing::Values(false), ::testing::ValuesIn(netPrecisions), ::testing::Values(CommonTestUtils::DEVICE_CPU)), ::testing::ValuesIn(filterCPUInfoForDevice("3D", "avg"))), @@ -218,6 +330,7 @@ INSTANTIATE_TEST_SUITE_P(smoke_AdaPoolAvg4DLayoutTest, AdaPoolLayerCPUTest, ::testing::Combine( adaPool4DParams, ::testing::Values("avg"), + ::testing::Values(false), ::testing::ValuesIn(netPrecisions), ::testing::Values(CommonTestUtils::DEVICE_CPU)), ::testing::ValuesIn(filterCPUInfoForDevice("4D", "avg"))), @@ -228,6 +341,7 @@ INSTANTIATE_TEST_SUITE_P(smoke_AdaPoolAvg5DLayoutTest, AdaPoolLayerCPUTest, ::testing::Combine( adaPool5DParams, ::testing::Values("avg"), + ::testing::Values(false), ::testing::ValuesIn(netPrecisions), ::testing::Values(CommonTestUtils::DEVICE_CPU)), ::testing::ValuesIn(filterCPUInfoForDevice("5D", "avg"))), @@ -238,6 +352,7 @@ INSTANTIATE_TEST_SUITE_P(smoke_AdaPoolMax3DLayoutTest, AdaPoolLayerCPUTest, ::testing::Combine( adaPool3DParams, ::testing::Values("max"), + ::testing::Values(false), ::testing::ValuesIn(netPrecisions), ::testing::Values(CommonTestUtils::DEVICE_CPU)), ::testing::ValuesIn(filterCPUInfoForDevice("3D", "max"))), @@ -248,6 +363,7 @@ INSTANTIATE_TEST_SUITE_P(smoke_AdaPoolMax4DLayoutTest, AdaPoolLayerCPUTest, ::testing::Combine( adaPool4DParams, ::testing::Values("max"), + ::testing::Values(false), ::testing::ValuesIn(netPrecisions), ::testing::Values(CommonTestUtils::DEVICE_CPU)), ::testing::ValuesIn(filterCPUInfoForDevice("4D", "max"))), @@ -258,22 +374,111 @@ INSTANTIATE_TEST_SUITE_P(smoke_AdaPoolMax5DLayoutTest, AdaPoolLayerCPUTest, ::testing::Combine( adaPool5DParams, ::testing::Values("max"), + ::testing::Values(false), ::testing::ValuesIn(netPrecisions), ::testing::Values(CommonTestUtils::DEVICE_CPU)), ::testing::ValuesIn(filterCPUInfoForDevice("5D", "max"))), AdaPoolLayerCPUTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_StaticAdaPoolAvg3DLayoutTest, AdaPoolLayerCPUTest, + ::testing::Combine( + ::testing::Combine( + staticAdaPool3DParams, + ::testing::Values("avg"), + ::testing::Values(true), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(CommonTestUtils::DEVICE_CPU)), + ::testing::ValuesIn(filterCPUInfoForDevice("3D", "avg"))), + AdaPoolLayerCPUTest::getTestCaseName); + +INSTANTIATE_TEST_SUITE_P(smoke_StaticAdaPoolAvg4DLayoutTest, AdaPoolLayerCPUTest, + ::testing::Combine( + ::testing::Combine( + staticAdaPool4DParams, + ::testing::Values("avg"), + ::testing::Values(true), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(CommonTestUtils::DEVICE_CPU)), + ::testing::ValuesIn(filterCPUInfoForDevice("4D", "avg"))), + AdaPoolLayerCPUTest::getTestCaseName); + +INSTANTIATE_TEST_SUITE_P(smoke_StaticAdaPoolAvg5DLayoutTest, AdaPoolLayerCPUTest, + ::testing::Combine( + ::testing::Combine( + staticAdaPool5DParams, + ::testing::Values("avg"), + ::testing::Values(true), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(CommonTestUtils::DEVICE_CPU)), + ::testing::ValuesIn(filterCPUInfoForDevice("5D", "avg"))), + AdaPoolLayerCPUTest::getTestCaseName); + +INSTANTIATE_TEST_SUITE_P(smoke_StaticAdaPoolMax3DLayoutTest, AdaPoolLayerCPUTest, + ::testing::Combine( + ::testing::Combine( + staticAdaPool3DParams, + ::testing::Values("max"), + ::testing::Values(true), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(CommonTestUtils::DEVICE_CPU)), + ::testing::ValuesIn(filterCPUInfoForDevice("3D", "max"))), + AdaPoolLayerCPUTest::getTestCaseName); + +INSTANTIATE_TEST_SUITE_P(smoke_StaticAdaPoolMax4DLayoutTest, AdaPoolLayerCPUTest, + ::testing::Combine( + ::testing::Combine( + staticAdaPool4DParams, + ::testing::Values("max"), + ::testing::Values(true), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(CommonTestUtils::DEVICE_CPU)), + ::testing::ValuesIn(filterCPUInfoForDevice("4D", "max"))), + AdaPoolLayerCPUTest::getTestCaseName); + +INSTANTIATE_TEST_SUITE_P(smoke_StaticAdaPoolMax5DLayoutTest, AdaPoolLayerCPUTest, + ::testing::Combine( + ::testing::Combine( + staticAdaPool5DParams, + ::testing::Values("max"), + ::testing::Values(true), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(CommonTestUtils::DEVICE_CPU)), + ::testing::ValuesIn(filterCPUInfoForDevice("5D", "max"))), + AdaPoolLayerCPUTest::getTestCaseName); + + // in 1-channel cases {..., 1, 1, 1} shape cannot be correctly resolved on oneDnn level, so it was removed from instances +const std::vector> input3DShape1Channel = { + { + {{{-1, -1, -1}, {{1, 1, 2}, {1, 1, 2}, {1, 1, 2}}}}, + {{{{1, 10}, {1, 10}, {1, 10}}, {{1, 1, 2}, {2, 1, 2}, {2, 1, 2}}}} + } +}; + +const std::vector> input4DShape1Channel = { + { + {{{-1, -1, -1, -1}, {{1, 1, 1, 2}, {2, 1, 2, 1}, {2, 1, 2, 1}}}}, + {{{{1, 10}, {1, 10}, {1, 10}, {1, 10}}, {{1, 1, 1, 2}, {1, 1, 1, 2}, {2, 1, 2, 1}}}} + } +}; + +const std::vector> input5DShape1Channel = { + { + {{{-1, -1, -1, -1, -1}, {{1, 1, 1, 1, 2}, {1, 1, 1, 1, 2}, {2, 1, 1, 2, 1}}}}, + {{{{1, 10}, {1, 10}, {1, 10}, {1, 10}, {1, 10}}, {{1, 1, 1, 1, 2}, {1, 1, 1, 1, 2}, {2, 1, 1, 2, 1}}}} + } +}; + INSTANTIATE_TEST_SUITE_P(smoke_AdaPool_1ch_Avg3DLayoutTest, AdaPoolLayerCPUTest, ::testing::Combine( ::testing::Combine( ::testing::Combine( ::testing::ValuesIn(std::vector> { {1}, {2}}), - ::testing::ValuesIn(std::vector> { - SizeVector{1, 1, 2}, SizeVector{2, 1, 2}})), + ::testing::ValuesIn(input3DShape1Channel)), ::testing::Values("avg"), + ::testing::Values(true), ::testing::ValuesIn(netPrecisions), ::testing::Values(CommonTestUtils::DEVICE_CPU)), ::testing::Values(CPUSpecificParams{{ncw, x}, {ncw}, {}, {}})), @@ -287,11 +492,9 @@ INSTANTIATE_TEST_SUITE_P(smoke_AdaPool_1ch_Avg4DLayoutTest, AdaPoolLayerCPUTest, {1, 1}, {2, 2} }), - ::testing::ValuesIn(std::vector> { - SizeVector{1, 1, 1, 2}, - SizeVector{2, 1, 2, 1} - })), + ::testing::ValuesIn(input4DShape1Channel)), ::testing::Values("avg"), + ::testing::Values(true), ::testing::ValuesIn(netPrecisions), ::testing::Values(CommonTestUtils::DEVICE_CPU)), ::testing::Values(CPUSpecificParams{{nchw, x}, {nchw}, {}, {}})), @@ -303,9 +506,9 @@ INSTANTIATE_TEST_SUITE_P(smoke_AdaPool_1ch_Avg5DLayoutTest, AdaPoolLayerCPUTest, ::testing::Combine( ::testing::ValuesIn(std::vector> { {1, 1, 1}, {2, 2, 2}}), - ::testing::ValuesIn(std::vector> { - SizeVector{1, 1, 1, 1, 2}, SizeVector{2, 1, 1, 2, 1}})), + ::testing::ValuesIn(input5DShape1Channel)), ::testing::Values("avg"), + ::testing::Values(true), ::testing::ValuesIn(netPrecisions), ::testing::Values(CommonTestUtils::DEVICE_CPU)), ::testing::Values(CPUSpecificParams{{ncdhw, x}, {ncdhw}, {}, {}})), @@ -318,9 +521,9 @@ INSTANTIATE_TEST_SUITE_P(smoke_AdaPool_1ch_Max3DLayoutTest, AdaPoolLayerCPUTest, ::testing::Combine( ::testing::ValuesIn(std::vector> { {1}, {2}}), - ::testing::ValuesIn(std::vector> { - SizeVector{1, 1, 2}, SizeVector{2, 1, 2}})), + ::testing::ValuesIn(input3DShape1Channel)), ::testing::Values("max"), + ::testing::Values(true), ::testing::ValuesIn(netPrecisions), ::testing::Values(CommonTestUtils::DEVICE_CPU)), ::testing::Values(CPUSpecificParams{{ncw, x}, {ncw}, {}, {}})), @@ -332,9 +535,9 @@ INSTANTIATE_TEST_SUITE_P(smoke_AdaPool_1ch_Max4DLayoutTest, AdaPoolLayerCPUTest, ::testing::Combine( ::testing::ValuesIn(std::vector> { {1, 1}, {2, 2}}), - ::testing::ValuesIn(std::vector> { - SizeVector{1, 1, 1, 2}, SizeVector{2, 1, 2, 1}})), + ::testing::ValuesIn(input4DShape1Channel)), ::testing::Values("max"), + ::testing::Values(true), ::testing::ValuesIn(netPrecisions), ::testing::Values(CommonTestUtils::DEVICE_CPU)), ::testing::Values(CPUSpecificParams{{nchw, x}, {nchw}, {}, {}})), @@ -348,11 +551,9 @@ INSTANTIATE_TEST_SUITE_P(smoke_AdaPool_1ch_Max5DLayoutTest, AdaPoolLayerCPUTest, {1, 1, 1}, {2, 2, 2} }), - ::testing::ValuesIn(std::vector> { - SizeVector{1, 1, 1, 1, 2}, - SizeVector{2, 1, 1, 2, 1} - })), + ::testing::ValuesIn(input5DShape1Channel)), ::testing::Values("max"), + ::testing::Values(true), ::testing::ValuesIn(netPrecisions), ::testing::Values(CommonTestUtils::DEVICE_CPU)), ::testing::Values(CPUSpecificParams{{ncdhw, x}, {ncdhw}, {}, {}})), diff --git a/inference-engine/tests/functional/plugin/cpu/single_layer_tests/broadcast.cpp b/inference-engine/tests/functional/plugin/cpu/single_layer_tests/broadcast.cpp new file mode 100644 index 00000000000..5833d20f95f --- /dev/null +++ b/inference-engine/tests/functional/plugin/cpu/single_layer_tests/broadcast.cpp @@ -0,0 +1,374 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "test_utils/cpu_test_utils.hpp" +#include "ngraph_functions/builders.hpp" +#include "shared_test_classes/base/ov_subgraph.hpp" +#include "functional_test_utils/ov_tensor_utils.hpp" + +using namespace CPUTestUtils; + +namespace CPULayerTestsDefinitions { + +using BroadcastLayerTestParamsSet = typename std::tuple< + std::vector, // Shapes + std::vector, // Target shapes + std::vector, // Axes mapping + ov::op::BroadcastType, // Broadcast mode + ov::element::Type_t, // Network precision + std::vector, // Const inputs + std::string>; // Device name + +using BroadcastLayerCPUTestParamsSet = typename std::tuple< + BroadcastLayerTestParamsSet, + CPUSpecificParams>; + +class BroadcastLayerCPUTest : public testing::WithParamInterface, + virtual public ov::test::SubgraphBaseTest, public CPUTestsBase { +public: + static std::string getTestCaseName(testing::TestParamInfo obj) { + BroadcastLayerTestParamsSet basicParamsSet; + CPUSpecificParams cpuParams; + std::tie(basicParamsSet, cpuParams) = obj.param; + + std::vector inputShapes; + std::vector targetShapes, axesMapping; + ov::op::BroadcastType mode; + ov::element::Type_t netPrecision; + std::vector isConstInputs; + std::string deviceName; + std::tie(inputShapes, targetShapes, axesMapping, mode, netPrecision, isConstInputs, deviceName) = basicParamsSet; + + std::ostringstream result; + result << "IS=("; + for (const auto& shape : inputShapes) { + result << CommonTestUtils::partialShape2str({shape.first}) << "_"; + } + result << ")_TS=("; + for (const auto& shape : inputShapes) { + for (const auto& item : shape.second) { + result << CommonTestUtils::vec2str(item) << "_"; + } + } + result << "targetShape=" << CommonTestUtils::vec2str(targetShapes) << "_"; + result << "axesMapping=" << CommonTestUtils::vec2str(axesMapping) << "_"; + result << "mode=" << mode << "_"; + result << "netPrec=" << netPrecision << "_"; + result << "constIn=(" << (isConstInputs[0] ? "True" : "False") << "." << (isConstInputs[1] ? "True" : "False") << ")_"; + result << "trgDev=" << deviceName; + + result << CPUTestsBase::getTestCaseName(cpuParams); + + return result.str(); + } + +protected: + void SetUp() override { + BroadcastLayerTestParamsSet basicParamsSet; + CPUSpecificParams cpuParams; + std::tie(basicParamsSet, cpuParams) = this->GetParam(); + + std::vector inputShapes; + ov::op::BroadcastType mode; + ov::element::Type_t netPrecision; + std::vector isConstInput; + std::tie(inputShapes, targetShape, axesMapping, mode, netPrecision, isConstInput, targetDevice) = basicParamsSet; + bool isTargetShapeConst = isConstInput[0], isAxesMapConst = isConstInput[1]; + const auto targetShapeRank = targetShape.size(); + const auto axesMappingRank = axesMapping.size(); + + std::tie(inFmts, outFmts, priority, selectedType) = cpuParams; + + selectedType += std::string("_") + InferenceEngine::details::convertPrecision(netPrecision).name(); + + if (inputShapes.front().first.rank() != 0) { + inputDynamicShapes.push_back(inputShapes.front().first); + if (!isTargetShapeConst) { + inputDynamicShapes.push_back({ static_cast(targetShape.size()) }); + } + if (!isAxesMapConst) { + inputDynamicShapes.push_back({ static_cast(axesMapping.size()) }); + } + } + const size_t targetStaticShapeSize = inputShapes.front().second.size(); + targetStaticShapes.resize(targetStaticShapeSize); + for (size_t i = 0lu; i < targetStaticShapeSize; ++i) { + targetStaticShapes[i].push_back(inputShapes.front().second[i]); + if (!isTargetShapeConst) + targetStaticShapes[i].push_back({ targetShape.size() }); + if (!isAxesMapConst) + targetStaticShapes[i].push_back({ axesMapping.size() }); + } + + ov::ParameterVector functionParams; + if (inputDynamicShapes.empty()) { + functionParams.push_back(std::make_shared(netPrecision, targetStaticShapes.front().front())); + } else { + functionParams.push_back(std::make_shared(netPrecision, inputDynamicShapes.front())); + if (!isTargetShapeConst) { + functionParams.push_back(std::make_shared(ov::element::i64, inputDynamicShapes[1])); + functionParams.back()->set_friendly_name("targetShape"); + } + if (!isAxesMapConst) { + functionParams.push_back(std::make_shared(ov::element::i64, inputDynamicShapes.back())); + functionParams.back()->set_friendly_name("axesMapping"); + } + } + functionParams.front()->set_friendly_name("data"); + + auto paramOuts = ngraph::helpers::convert2OutputVector(ngraph::helpers::castOps2Nodes(functionParams)); + + std::shared_ptr broadcastOp; + if (mode == ov::op::BroadcastType::EXPLICIT) { + std::shared_ptr targetShapeOp; + std::shared_ptr axesMappingOp; + if (isTargetShapeConst) { + targetShapeOp = ov::op::v0::Constant::create(ov::element::i64, {targetShapeRank}, targetShape); + } else { + targetShapeOp = functionParams[0]; + } + if (isAxesMapConst) { + axesMappingOp = ov::op::v0::Constant::create(ov::element::i64, {axesMappingRank}, axesMapping); + } else { + axesMappingOp = functionParams.size() > 2 ? functionParams[2] : functionParams[1]; + } + broadcastOp = std::make_shared(paramOuts[0], + targetShapeOp, + axesMappingOp, + mode); + } else if (mode == ov::op::BroadcastType::NUMPY) { + if (isTargetShapeConst) { + auto targetShapeConst = ov::op::v0::Constant::create(ov::element::i64, {targetShapeRank}, targetShape); + broadcastOp = std::make_shared(paramOuts[0], + targetShapeConst, + mode); + } else { + broadcastOp = std::make_shared(paramOuts[0], + paramOuts[1], + mode); + } + } + + function = makeNgraphFunction(netPrecision, functionParams, broadcastOp, "Broadcast"); + } + + void generate_inputs(const std::vector& targetInputStaticShapes) override { + inputs.clear(); + const auto& funcInputs = function->inputs(); + for (size_t i = 0lu; i < funcInputs.size(); i++) { + const auto& funcInput = funcInputs[i]; + ov::runtime::Tensor tensor; + if (funcInput.get_node()->get_friendly_name() == "targetShape") { + tensor = ov::runtime::Tensor{ov::element::i64, targetInputStaticShapes[i]}; + auto data = tensor.data::value_type>(); + for (size_t i = 0lu; i < targetShape.size(); i++) { + data[i] = targetShape[i]; + } + } else if (funcInput.get_node()->get_friendly_name() == "axesMapping") { + tensor = ov::runtime::Tensor{ov::element::i64, targetInputStaticShapes[i]}; + auto data = tensor.data::value_type>(); + for (size_t i = 0lu; i < axesMapping.size(); i++) { + data[i] = axesMapping[i]; + } + } else { + if (funcInput.get_element_type().is_real()) { + tensor = ov::test::utils::create_and_fill_tensor( + funcInput.get_element_type(), targetInputStaticShapes[i], 10, 0, 1000); + } else { + tensor = ov::test::utils::create_and_fill_tensor(funcInput.get_element_type(), targetInputStaticShapes[i]); + } + } + inputs.insert({funcInput.get_node_shared_ptr(), tensor}); + } + } + + std::vector targetShape, axesMapping; +}; + +TEST_P(BroadcastLayerCPUTest, CompareWithRefs) { + SKIP_IF_CURRENT_TEST_IS_DISABLED() + + run(); + CheckPluginRelatedResults(executableNetwork, "Broadcast"); +} + +namespace { + +/* CPU PARAMS */ +const auto cpuParams_nChw16c = CPUSpecificParams {{nChw16c}, {nChw16c}, {}, "ref"}; +const auto cpuParams_nCdhw16c = CPUSpecificParams {{nCdhw16c}, {nCdhw16c}, {}, "ref"}; + +const auto cpuParams_nChw8c = CPUSpecificParams {{nChw8c}, {nChw8c}, {}, "ref"}; +const auto cpuParams_nCdhw8c = CPUSpecificParams {{nCdhw8c}, {nCdhw8c}, {}, "ref"}; + +const auto cpuParams_nhwc = CPUSpecificParams {{nhwc}, {nhwc}, {}, "ref"}; +const auto cpuParams_ndhwc = CPUSpecificParams {{ndhwc}, {ndhwc}, {}, "ref"}; +/* ========== */ + +/* COMMON PARAMS */ +const std::vector inputPrecisions = { + ov::element::f32, + ov::element::bf16, + ov::element::i32, + ov::element::i8 +}; +/* ============= */ + +/* INSTANCES */ +// 4D +const std::vector CPUParams4D = { + cpuParams_nChw16c, + cpuParams_nChw8c, + cpuParams_nhwc +}; + +const std::vector> staticInputShapes4D = { + { + {{}, + { // Static shapes + {1, 16, 1, 1} + } + } + }, + { + {{}, + { // Static shapes + {50, 50} + } + } + } +}; + +INSTANTIATE_TEST_CASE_P(smoke_StaticShape4D, BroadcastLayerCPUTest, + ::testing::Combine( + ::testing::Combine( + ::testing::Values(staticInputShapes4D[0]), + ::testing::ValuesIn(std::vector>{{1, 16, 3, 3}, {1, 16, 1, 3}}), + ::testing::Values(std::vector{}), + ::testing::Values(ov::op::BroadcastType::NUMPY), + ::testing::ValuesIn(inputPrecisions), + ::testing::Values(std::vector{true, true}), + ::testing::Values(CommonTestUtils::DEVICE_CPU)), + ::testing::ValuesIn(CPUParams4D)), + BroadcastLayerCPUTest::getTestCaseName); + +INSTANTIATE_TEST_CASE_P(smoke_StaticShape4DE, BroadcastLayerCPUTest, + ::testing::Combine( + ::testing::Combine( + ::testing::Values(staticInputShapes4D[1]), + ::testing::Values(std::vector{1, 50, 50, 16}), + ::testing::Values(std::vector{1, 2}), + ::testing::Values(ov::op::BroadcastType::EXPLICIT), + ::testing::ValuesIn(inputPrecisions), + ::testing::Values(std::vector{true, true}), + ::testing::Values(CommonTestUtils::DEVICE_CPU)), + ::testing::Values(CPUSpecificParams{{}, {}, {}, "ref"})), + BroadcastLayerCPUTest::getTestCaseName); + +const std::vector> dynamicInputShapes4D = { + { + { // Origin dynamic shapes + {ov::Dimension(1, 20), ov::Dimension(1, 20), ov::Dimension(1, 20), ov::Dimension(1, 20)}, + { // Dynamic shapes instances + {1, 16, 1, 1}, + {8, 1, 1, 7}, + {1, 1, 1, 7} + } + }, + }, + { + { // Origin dynamic shapes + {-1, -1, -1, -1}, + { // Dynamic shapes instances + {{1, 16, 1, 1}}, + {{8, 1, 1, 1}} + } + } + } +}; + +INSTANTIATE_TEST_CASE_P(smoke_DynamicShape4D, BroadcastLayerCPUTest, + ::testing::Combine(::testing::Combine( + ::testing::ValuesIn(dynamicInputShapes4D), + ::testing::ValuesIn(std::vector>{{8, 16, 1, 7}, {8, 16, 10, 7}}), + ::testing::Values(std::vector{}), + ::testing::Values(ov::op::BroadcastType::NUMPY), + ::testing::ValuesIn(inputPrecisions), + ::testing::ValuesIn(std::vector>{{true, true}, {false, true}}), + ::testing::Values(CommonTestUtils::DEVICE_CPU)), + ::testing::Values(CPUSpecificParams{{}, {}, {}, "ref"})), + BroadcastLayerCPUTest::getTestCaseName); + +// 5D +const std::vector> staticInputShapes5D = { + { + {{}, + { // Static shapes + {1, 16, 1, 1, 1} + } + } + } +}; +const std::vector> dynamicInputShapes5D = { + { + { // Origin dynamic shapes + {ov::Dimension(1, 20), ov::Dimension(1, 20), ov::Dimension(1, 20), ov::Dimension(1, 20), ov::Dimension(1, 20)}, + { // Dynamic shapes instances + {1, 16, 1, 1, 1}, + {8, 1, 1, 7, 1}, + {8, 1, 1, 1, 1} + } + } + }, + { + { // Origin dynamic shapes + {-1, -1, -1, -1, -1}, + { // Dynamic shapes instances + {1, 16, 1, 1, 1}, + {8, 16, 1, 7, 1} + } + } + } +}; +std::vector> targetShapes5D { + {8, 16, 1, 7, 1}, + {8, 16, 10, 7, 4} +}; + +const std::vector CPUParams5D = { + cpuParams_nCdhw16c, + cpuParams_nCdhw8c, + cpuParams_ndhwc, +}; + +INSTANTIATE_TEST_CASE_P(smoke_StaticShape5D, BroadcastLayerCPUTest, + ::testing::Combine( + ::testing::Combine( + ::testing::ValuesIn(staticInputShapes5D), + ::testing::ValuesIn(std::vector>{{1, 16, 1, 1, 3}, {1, 16, 3, 1, 3}}), + ::testing::Values(std::vector{}), + ::testing::Values(ov::op::BroadcastType::NUMPY), + ::testing::ValuesIn(inputPrecisions), + ::testing::Values(std::vector{true, true}), + ::testing::Values(CommonTestUtils::DEVICE_CPU)), + ::testing::ValuesIn(CPUParams5D)), + BroadcastLayerCPUTest::getTestCaseName); + +INSTANTIATE_TEST_CASE_P(smoke_DynamicShape5D, BroadcastLayerCPUTest, + ::testing::Combine( + ::testing::Combine( + ::testing::ValuesIn(dynamicInputShapes5D), + ::testing::ValuesIn(targetShapes5D), + ::testing::Values(std::vector{}), + ::testing::Values(ov::op::BroadcastType::NUMPY), + ::testing::ValuesIn(inputPrecisions), + ::testing::ValuesIn(std::vector>{{true, true}, {false, true}}), + ::testing::Values(CommonTestUtils::DEVICE_CPU)), + ::testing::Values(CPUSpecificParams{{}, {}, {}, "ref"})), + BroadcastLayerCPUTest::getTestCaseName); +/* ========= */ + +} // namespace + +} // namespace CPULayerTestsDefinitions diff --git a/inference-engine/tests/functional/plugin/cpu/single_layer_tests/ctc_Loss.cpp b/inference-engine/tests/functional/plugin/cpu/single_layer_tests/ctc_Loss.cpp new file mode 100644 index 00000000000..48927a83b67 --- /dev/null +++ b/inference-engine/tests/functional/plugin/cpu/single_layer_tests/ctc_Loss.cpp @@ -0,0 +1,251 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include + +#include +#include +#include +#include +#include + +#include "shared_test_classes/base/ov_subgraph.hpp" +#include "test_utils/cpu_test_utils.hpp" + +using namespace InferenceEngine; +using namespace CPUTestUtils; +using namespace ov::test; + +namespace CPULayerTestsDefinitions { + +// N,T,C +using CTCLossShapeParams = std::pair, std::vector>>; + +using CTCLossLayerCPUTestParams = std::tuple; + +class CTCLossLayerCPUTest : public testing::WithParamInterface, virtual public SubgraphBaseTest, public CPUTestsBase { +public: + static std::string getTestCaseName(const testing::TestParamInfo& obj) { + CTCLossShapeParams shapes; + int blank; + bool preprocessCollapseRepeated; + bool ctcMergeRepeated; + bool unique; + ngraph::element::Type fPrecision; + ngraph::element::Type iPrecision; + std::tie(shapes, blank, preprocessCollapseRepeated, ctcMergeRepeated, unique, fPrecision, iPrecision) = obj.param; + std::ostringstream results; + results << "IS=" << CommonTestUtils::partialShape2str({shapes.first}) << "_"; + results << "TS="; + for (std::vector& staticShapes : shapes.second) { + for (ngraph::Shape& shape : staticShapes) { + size_t N = shape[0]; + size_t T = shape[1]; + size_t C = shape[2]; + results << "{" << N << "," << T << "," << C << "}" + << "_"; + } + } + results << "blank=" << blank << "_"; + results << "preprocessCollapseRepeated=" << preprocessCollapseRepeated << "_"; + results << "ctcMergeRepeated=" << ctcMergeRepeated << "_"; + results << "unique=" << unique << "_"; + + results << "fPrecision=" << fPrecision << "_"; + results << "iPrecision=" << iPrecision << "_"; + + return results.str(); + } + +protected: + void SetUp() override { + CTCLossShapeParams shapes; + bool preprocessCollapseRepeated; + bool ctcMergeRepeated; + bool unique; + ngraph::element::Type fPrecision; + ngraph::element::Type iPrecision; + std::tie(shapes, blank, preprocessCollapseRepeated, ctcMergeRepeated, unique, fPrecision, iPrecision) = GetParam(); + + targetDevice = CommonTestUtils::DEVICE_CPU; + selectedType = std::string("ref_any_FP32"); + + for (std::vector& staticShapes : shapes.second) { + for (ngraph::Shape& shape : staticShapes) { + size_t N = shape[0]; + size_t T = shape[1]; + size_t C = shape[2]; + targetStaticShapes.push_back({{N, T, C}, {N}, {N, T}, {N}}); + } + } + + auto inputDynamicShapesValues = shapes.first.front(); + ov::PartialShape shapeN{inputDynamicShapesValues[0]}; + ov::PartialShape shapeNT{inputDynamicShapesValues[0], inputDynamicShapesValues[1]}; + ov::PartialShape shapeNTC{inputDynamicShapesValues[0], inputDynamicShapesValues[1], inputDynamicShapesValues[2]}; + inputDynamicShapes = {shapeNTC, shapeN, shapeNT, shapeN}; + + std::vector types{fPrecision, iPrecision, iPrecision, iPrecision}; + std::vector partialShapes{inputDynamicShapesValues, shapeN, shapeNT, shapeN}; + + auto params = ngraph::builder::makeDynamicParams(types, partialShapes); + auto bankNode = ngraph::op::Constant::create(ngraph::element::i64, ngraph::Shape{ }, {blank}); + + auto ctcLoss = std::make_shared(params[0], params[1], params[2], + params[3], bankNode, preprocessCollapseRepeated, ctcMergeRepeated, unique); + ngraph::ResultVector results{std::make_shared(ctcLoss)}; + function = std::make_shared(results, params, "CTCLossLayerCPUTest"); + }; + + void generate_inputs(const std::vector& targetInputStaticShapes) override { + inputs.clear(); + const auto& funcInputs = function->inputs(); + const auto& dataShape = targetInputStaticShapes[0]; + const auto N = dataShape[0]; + const auto T = dataShape[1]; + const auto C = dataShape[2]; + ngraph::Shape shapeN{N}; + ngraph::Shape shapeNT{N, T}; + + std::mt19937 gen(42); + std::uniform_int_distribution dist(1, T); + std::vector logitLength(N, 0); + for (int n = 0; n < N; n++) { + logitLength[n] = dist(gen); + } + for (int i = 0; i < funcInputs.size(); ++i) { + const auto& funcInput = funcInputs[i]; + ov::runtime::Tensor tensor; + if (i == 0) { + tensor = ov::test::utils::create_and_fill_tensor(funcInput.get_element_type(), + dataShape, + 10, + 0, + 10); + } else if (i == 1) { + tensor = ov::runtime::Tensor{funcInput.get_element_type(), {shapeN}}; + if (funcInput.get_element_type() == ElementType::i32) { + auto begin = tensor.data(); + std::copy(logitLength.begin(), logitLength.end(), begin); + } else if (funcInput.get_element_type() == ElementType::i64) { + auto begin = tensor.data(); + std::copy(logitLength.begin(), logitLength.end(), begin); + } + } else if (i == 2) { + std::mt19937 genLable(42); + std::uniform_int_distribution distLabel(0, C - 1); + std::vector labels(N * T, 0); + for (int n = 0; n < N * T; n++) { + int value; + // make sure blank not be inclded in labels + while ((value = distLabel(genLable)) == blank) {} + labels[n] = value; + } + tensor = ov::runtime::Tensor{funcInput.get_element_type(), {shapeNT}}; + if (funcInput.get_element_type() == ElementType::i32) { + auto begin = tensor.data(); + std::copy(labels.begin(), labels.end(), begin); + } else if (funcInput.get_element_type() == ElementType::i64) { + auto begin = tensor.data(); + std::copy(labels.begin(), labels.end(), begin); + } + } else if (i == 3) { + std::mt19937 gen(24); + std::uniform_int_distribution dist(1, T); + + std::vector labelLength(N, 0); + for (int n = 0; n < N; n++) { + const int len = dist(gen); + // make sure lableLen <= logitLen + labelLength[n] = std::min(len, logitLength[n]); + } + + tensor = ov::runtime::Tensor{funcInput.get_element_type(), {shapeN}}; + if (funcInput.get_element_type() == ElementType::i32) { + auto begin = tensor.data(); + std::copy(labelLength.begin(), labelLength.end(), begin); + } else if (funcInput.get_element_type() == ElementType::i64) { + auto begin = tensor.data(); + std::copy(labelLength.begin(), labelLength.end(), begin); + } + } + inputs.insert({funcInput.get_node_shared_ptr(), tensor}); + } + } + +private: + int blank; +}; + +TEST_P(CTCLossLayerCPUTest, CompareWithRefs) { + SKIP_IF_CURRENT_TEST_IS_DISABLED(); + + run(); + CheckPluginRelatedResults(executableNetwork, "CTCLoss"); +} + +namespace { + const ngraph::element::TypeVector fPrecisions = { + ngraph::element::f32 + // ngraph::element::f16 + }; + + const ngraph::element::TypeVector iPrecisions = { + ngraph::element::i32, + ngraph::element::i64 + }; + + const std::vector preprocessCollapseRepeated = {true, false}; + const std::vector ctcMergeRepeated = {true, false}; + const std::vector unique = {true, false}; + + const std::vector shapes = { + { + // dynamic undifined + { + {-1, -1, -1}, + }, + // target + { + {{3, 6, 8}, {2, 5, 6}, {5, 6, 10}} + } + }, + { + // dynamic lower/upper bound + { + {{1, 10}, {5, 10}, {6, 12}}, + }, + // target + { + {{1, 5, 6}, {10, 10, 12}, {5, 7, 8}} + } + }, + }; + + const std::vector blanks = { + 0, 2, 5 + }; + +const auto basicCases = ::testing::Combine(::testing::ValuesIn(shapes), + ::testing::ValuesIn(blanks), + ::testing::ValuesIn(preprocessCollapseRepeated), + ::testing::ValuesIn(ctcMergeRepeated), + ::testing::ValuesIn(unique), + ::testing::ValuesIn(fPrecisions), + ::testing::ValuesIn(iPrecisions)); + +INSTANTIATE_TEST_SUITE_P(smoke_CTCLossCPU, + CTCLossLayerCPUTest, + basicCases, + CTCLossLayerCPUTest::getTestCaseName); +} // namespace + +} // namespace CPULayerTestsDefinitions diff --git a/inference-engine/tests/functional/plugin/cpu/single_layer_tests/ctc_greedy_decoder.cpp b/inference-engine/tests/functional/plugin/cpu/single_layer_tests/ctc_greedy_decoder.cpp new file mode 100644 index 00000000000..9d9689350d4 --- /dev/null +++ b/inference-engine/tests/functional/plugin/cpu/single_layer_tests/ctc_greedy_decoder.cpp @@ -0,0 +1,174 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include + +#include +#include +#include +#include +#include +#include + +#include "shared_test_classes/base/ov_subgraph.hpp" +#include "test_utils/cpu_test_utils.hpp" + +using namespace InferenceEngine; +using namespace CPUTestUtils; +using namespace ov::test; + +namespace CPULayerTestsDefinitions { + +using CtcGreedyDecoderParams = std::tuple; // Number of classes + +using InputShapeParams = std::pair, // bounds for T, N, C + std::vector>; // target input dimensions + +using CTCGreedyDecoderLayerCPUTestParams = std::tuple; + +class CTCGreedyDecoderLayerCPUTest : public testing::WithParamInterface, + virtual public SubgraphBaseTest, + public CPUTestsBase { +public: + static std::string getTestCaseName(const testing::TestParamInfo& obj) { + ElementType inType; + bool mergeRepeated; + InputShapeParams shapes; + std::tie(shapes, inType, mergeRepeated) = obj.param; + std::ostringstream results; + results << "IS=" << CommonTestUtils::partialShape2str({shapes.first}) << "_"; + results << "TS="; + for (const auto& shape : shapes.second) { + size_t T; + size_t N; + size_t C; + std::tie(T, N, C) = shape; + results << "{" << T << "," << N << "," << C << "}" + << "_"; + } + + results << "Prc=" << inType << "_"; + results << "MergeRepeated=" << mergeRepeated; + + return results.str(); + } + +protected: + void SetUp() override { + ElementType inType; + bool mergeRepeated; + InputShapeParams shapes; + std::tie(shapes, inType, mergeRepeated) = GetParam(); + selectedType = "ref_any_FP32"; + targetDevice = CommonTestUtils::DEVICE_CPU; + // construct input shapes + ASSERT_EQ(shapes.first.size(), 3); + const auto& in_dyn_T = shapes.first[0]; + const auto& in_dyn_N = shapes.first[1]; + const auto& in_dyc_C = shapes.first[2]; + inputDynamicShapes = {ov::PartialShape{in_dyn_T, in_dyn_N, in_dyc_C}, ov::PartialShape{in_dyn_T, in_dyn_N}}; + + for (const auto& shape : shapes.second) { + size_t T; + size_t N; + size_t C; + std::tie(T, N, C) = shape; + targetStaticShapes.push_back({{T, N, C}, {T, N}}); + } + + auto params = ngraph::builder::makeDynamicParams(inType, inputDynamicShapes); + auto ctcGreedyDecoder = std::make_shared(params[0], params[1], mergeRepeated); + + ngraph::ResultVector results{std::make_shared(ctcGreedyDecoder)}; + function = std::make_shared(results, params, "CTCGreedyDecoderCPU"); + }; + + void generate_inputs(const std::vector& targetInputStaticShapes) override { + inputs.clear(); + const auto& funcInputs = function->inputs(); + for (int i = 0; i < funcInputs.size(); ++i) { + const auto& funcInput = funcInputs[i]; + ov::runtime::Tensor tensor; + if (i == 0) { + if (funcInput.get_element_type().is_real()) { + tensor = ov::test::utils::create_and_fill_tensor(funcInput.get_element_type(), + targetInputStaticShapes[i], + 10, + 0, + 1000); + } else { + tensor = ov::test::utils::create_and_fill_tensor(funcInput.get_element_type(), + targetInputStaticShapes[i]); + } + } else { + auto T = targetInputStaticShapes[i][0]; + auto B = targetInputStaticShapes[i][1]; + std::mt19937 gen(1); + std::uniform_int_distribution dist(1, T); + + std::vector sequenceMaskData(B * T, 0); + for (int b = 0; b < B; b++) { + int len = dist(gen); + for (int t = 0; t < len; t++) { + sequenceMaskData[t * B + b] = 1; + } + } + tensor = ov::runtime::Tensor{funcInput.get_element_type(), targetInputStaticShapes[i]}; + float* begin = tensor.data(); + std::copy(sequenceMaskData.begin(), sequenceMaskData.end(), begin); + } + + inputs.insert({funcInput.get_node_shared_ptr(), tensor}); + } + } +}; + +TEST_P(CTCGreedyDecoderLayerCPUTest, CompareWithRefs) { + SKIP_IF_CURRENT_TEST_IS_DISABLED(); + run(); + CheckPluginRelatedResults(executableNetwork, "CTCGreedyDecoder"); +} + +namespace { +// Common params +// ElementType::f16 is not support by CPU Plugin yet +const std::vector netPrecisions = {ElementType::f32}; +const std::vector mergeRepeated{true, false}; +const std::vector inputShapesCTCDecoder = { + {{ov::Dimension{1, 50}, ov::Dimension{1, 3}, ov::Dimension{2, 150}}, + {CtcGreedyDecoderParams{1, 1, 16}, + CtcGreedyDecoderParams{50, 3, 3}, + CtcGreedyDecoderParams{50, 3, 7}, + CtcGreedyDecoderParams{50, 3, 8}, + CtcGreedyDecoderParams{50, 3, 16}, + CtcGreedyDecoderParams{50, 3, 128}, + CtcGreedyDecoderParams{50, 3, 49}, + CtcGreedyDecoderParams{50, 3, 55}}}, + {{ov::Dimension{-1}, ov::Dimension{-1}, ov::Dimension{-1}}, + {CtcGreedyDecoderParams{50, 3, 3}, + CtcGreedyDecoderParams{50, 3, 7}, + CtcGreedyDecoderParams{50, 3, 8}, + CtcGreedyDecoderParams{50, 3, 16}, + CtcGreedyDecoderParams{50, 3, 128}, + CtcGreedyDecoderParams{50, 3, 49}, + CtcGreedyDecoderParams{50, 3, 55}, + CtcGreedyDecoderParams{1, 1, 16}}}, +}; + +const auto basicCases = ::testing::Combine(::testing::ValuesIn(inputShapesCTCDecoder), + ::testing::ValuesIn(netPrecisions), + ::testing::ValuesIn(mergeRepeated)); + +INSTANTIATE_TEST_SUITE_P(smoke_CtcGreedyDecoderCPU, + CTCGreedyDecoderLayerCPUTest, + basicCases, + CTCGreedyDecoderLayerCPUTest::getTestCaseName); +} // namespace + +} // namespace CPULayerTestsDefinitions diff --git a/inference-engine/tests/functional/plugin/cpu/single_layer_tests/ctc_greedy_decoder_seq_len.cpp b/inference-engine/tests/functional/plugin/cpu/single_layer_tests/ctc_greedy_decoder_seq_len.cpp new file mode 100644 index 00000000000..7094be74e89 --- /dev/null +++ b/inference-engine/tests/functional/plugin/cpu/single_layer_tests/ctc_greedy_decoder_seq_len.cpp @@ -0,0 +1,216 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include + +#include +#include +#include +#include +#include + +#include "shared_test_classes/base/ov_subgraph.hpp" +#include "test_utils/cpu_test_utils.hpp" + +using namespace InferenceEngine; +using namespace CPUTestUtils; +using namespace ov::test; + +namespace CPULayerTestsDefinitions { + +using CtcGreedyDecoderSeqLenParams = std::tuple; // Number of classes + +using InputShapeParams = std::pair, // bounds N, T, C, blank + std::vector>; // target input dimensions + +using InputElementParams = std::vector; + +using CTCGreedyDecoderSeqLenLayerCPUTestParams = std::tuple; +ngraph::ParameterVector makeDynamicParams(const std::vector& types, + const std::vector& shapes) { + ngraph::ParameterVector outs; + NGRAPH_CHECK(types.size() == shapes.size()); + for (size_t i = 0; i < types.size(); i++) { + auto paramNode = std::make_shared(types[i], shapes[i]); + outs.push_back(paramNode); + } + return outs; +} + +class CTCGreedyDecoderSeqLenLayerCPUTest : public testing::WithParamInterface, + virtual public SubgraphBaseTest, + public CPUTestsBase { +public: + static std::string getTestCaseName(const testing::TestParamInfo& obj) { + InputElementParams inType; + bool mergeRepeated; + InputShapeParams shapes; + ElementType indexType; + std::tie(shapes, inType, indexType, mergeRepeated) = obj.param; + std::ostringstream results; + results << "IS=" << CommonTestUtils::partialShape2str({shapes.first}) << "_"; + results << "TS="; + for (const auto& shape : shapes.second) { + size_t N; + size_t T; + size_t C; + std::tie(N, T, C) = shape; + results << "{" << N << "," << T << "," << C << "}" + << "_"; + } + for (const auto& type : inType) { + results << "Prc=" << type << "_"; + } + + results << "IndexType=" << indexType << "_"; + + results << "MergeRepeated=" << mergeRepeated; + + return results.str(); + } + +protected: + void SetUp() override { + InputElementParams inType; + bool mergeRepeated; + InputShapeParams shapes; + ElementType indexType; + std::tie(shapes, inType, indexType, mergeRepeated) = GetParam(); + selectedType = "ref_any_FP32"; + targetDevice = CommonTestUtils::DEVICE_CPU; + ASSERT_EQ(shapes.first.size(), 4); + const auto& in_dyn_N = shapes.first[0]; + const auto& in_dyn_T = shapes.first[1]; + const auto& in_dyc_C = shapes.first[2]; + const auto& in_dyc_blank = shapes.first[3]; + const size_t blank_rank = in_dyc_blank.get_length(); + ASSERT_TRUE(blank_rank == 0 || blank_rank == 1); + inputDynamicShapes = {ov::PartialShape{in_dyn_N, in_dyn_T, in_dyc_C}, + ov::PartialShape{in_dyn_N}, + blank_rank == 0 ? ov::PartialShape{} : ov::PartialShape{1}}; + + for (auto& shape : shapes.second) { + size_t N; + size_t T; + size_t C; + std::tie(N, T, C) = shape; + if (blank_rank == 0) + targetStaticShapes.push_back({{N, T, C}, {N}, {}}); + else + targetStaticShapes.push_back({{N, T, C}, {N}, {1}}); + } + + auto params = makeDynamicParams(inType, inputDynamicShapes); + auto ctcGreedyDecoderSeqLen = std::make_shared(params[0], + params[1], + params[2], + mergeRepeated, + indexType, + indexType); + + ngraph::ResultVector results{std::make_shared(ctcGreedyDecoderSeqLen)}; + function = std::make_shared(results, params, "CTCGreedyDecoderSeqLenCPU"); + }; + + void generate_inputs(const std::vector& targetInputStaticShapes) override { + inputs.clear(); + const auto& funcInputs = function->inputs(); + const auto& dataShape = targetInputStaticShapes[0]; + for (int i = 0; i < funcInputs.size(); ++i) { + const auto& funcInput = funcInputs[i]; + ov::runtime::Tensor tensor; + if (i == 0) { + if (funcInput.get_element_type().is_real()) { + tensor = ov::test::utils::create_and_fill_tensor(funcInput.get_element_type(), + targetInputStaticShapes[i], + 10, + 0, + 1000); + } else { + tensor = ov::test::utils::create_and_fill_tensor(funcInput.get_element_type(), + targetInputStaticShapes[i]); + } + } else if (i == 1) { + const auto seqLen = dataShape[1]; + const auto B = dataShape[0]; + std::mt19937 gen(42); + std::uniform_int_distribution dist(1, seqLen); + + std::vector sequenceLenData(B, 0); + for (int b = 0; b < B; b++) { + const int len = dist(gen); + sequenceLenData[b] = len; + } + tensor = ov::runtime::Tensor{funcInput.get_element_type(), targetInputStaticShapes[i]}; + if (funcInput.get_element_type() == ElementType::i32) { + auto begin = tensor.data(); + std::copy(sequenceLenData.begin(), sequenceLenData.end(), begin); + } else if (funcInput.get_element_type() == ElementType::i64) { + auto begin = tensor.data(); + std::copy(sequenceLenData.begin(), sequenceLenData.end(), begin); + } + + } else if (i == 2) { + // blank should be valid class type + tensor = ov::test::utils::create_and_fill_tensor(funcInput.get_element_type(), + targetInputStaticShapes[i], + dataShape[2], + 0); + } + inputs.insert({funcInput.get_node_shared_ptr(), tensor}); + } + } +}; + +TEST_P(CTCGreedyDecoderSeqLenLayerCPUTest, CompareWithRefs) { + SKIP_IF_CURRENT_TEST_IS_DISABLED(); + run(); + CheckPluginRelatedResults(executableNetwork, "CTCGreedyDecoderSeqLen"); +} + +namespace { +// Common params +// ElementType::f16 is not support by CPU Plugin yet +const std::vector inputType = {ElementType::f32, ElementType::i32, ElementType::i32}; +const std::vector mergeRepeated{true, false}; +const std::vector indexType = {ElementType::i64, ElementType::i32}; +const std::vector inputShapesCTCDecoder = { + {{ov::Dimension{-1}, ov::Dimension{-1}, ov::Dimension{-1}, ov::Dimension{0}}, + {CtcGreedyDecoderSeqLenParams{1, 1, 1}, + CtcGreedyDecoderSeqLenParams{1, 6, 10}, + CtcGreedyDecoderSeqLenParams{3, 3, 16}, + CtcGreedyDecoderSeqLenParams{5, 3, 55}}}, + {{ov::Dimension{-1}, ov::Dimension{-1}, ov::Dimension{-1}, ov::Dimension{1}}, + {CtcGreedyDecoderSeqLenParams{1, 1, 1}, + CtcGreedyDecoderSeqLenParams{1, 6, 10}, + CtcGreedyDecoderSeqLenParams{3, 3, 16}, + CtcGreedyDecoderSeqLenParams{5, 3, 55}}}, + {{ov::Dimension{1, 5}, ov::Dimension{1, 6}, ov::Dimension{1, 60}, ov::Dimension{0}}, + {CtcGreedyDecoderSeqLenParams{1, 6, 10}, + CtcGreedyDecoderSeqLenParams{3, 3, 16}, + CtcGreedyDecoderSeqLenParams{5, 3, 55}}}, + {{ov::Dimension{1, 5}, ov::Dimension{1, 6}, ov::Dimension{1, 60}, ov::Dimension{1}}, + {CtcGreedyDecoderSeqLenParams{1, 6, 10}, + CtcGreedyDecoderSeqLenParams{3, 3, 16}, + CtcGreedyDecoderSeqLenParams{5, 3, 55}}}, +}; + +const auto basicCases = ::testing::Combine(::testing::ValuesIn(inputShapesCTCDecoder), + ::testing::Values(inputType), + ::testing::ValuesIn(indexType), + ::testing::ValuesIn(mergeRepeated)); + +INSTANTIATE_TEST_SUITE_P(smoke_CtcGreedyDecoderSeqLenCPU, + CTCGreedyDecoderSeqLenLayerCPUTest, + basicCases, + CTCGreedyDecoderSeqLenLayerCPUTest::getTestCaseName); +} // namespace + +} // namespace CPULayerTestsDefinitions diff --git a/inference-engine/tests/functional/plugin/cpu/single_layer_tests/embedding_bag_offsets_sum.cpp b/inference-engine/tests/functional/plugin/cpu/single_layer_tests/embedding_bag_offsets_sum.cpp new file mode 100644 index 00000000000..9ae91d53dc1 --- /dev/null +++ b/inference-engine/tests/functional/plugin/cpu/single_layer_tests/embedding_bag_offsets_sum.cpp @@ -0,0 +1,168 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include +#include +#include + +#include +#include "ngraph_functions/builders.hpp" +#include "shared_test_classes/base/layer_test_utils.hpp" +#include "shared_test_classes/base/ov_subgraph.hpp" +#include "test_utils/cpu_test_utils.hpp" + +using namespace InferenceEngine; +using namespace CPUTestUtils; +using namespace ov::test; + +namespace CPULayerTestsDefinitions { + +typedef std::tuple< + InputShape, // input_shapes + std::vector, // indices + std::vector, // offsets + size_t, // default_index + bool, // with_weights + bool // with_def_index + > embeddingBagOffsetsSumParams; + +typedef std::tuple< + embeddingBagOffsetsSumParams, + ElementType, // embedding table + ElementType, // indices + LayerTestsUtils::TargetDevice> embeddingBagOffsetsSumLayerTestParamsSet; + +class EmbeddingBagOffsetsSumLayerCPUTest : + public testing::WithParamInterface, + virtual public SubgraphBaseTest, + public CPUTestsBase { +public: + static std::string getTestCaseName(const testing::TestParamInfo& obj) { + embeddingBagOffsetsSumParams params; + ElementType netPrecision, indPrecision; + std::string targetDevice; + std::tie(params, netPrecision, indPrecision, targetDevice) = obj.param; + + InputShape inputShapes; + std::vector indices, offsets; + size_t defaultIndex; + bool withWeights, withDefIndex; + std::tie(inputShapes, indices, offsets, defaultIndex, withWeights, withDefIndex) = params; + + std::ostringstream result; + result << "IS=" << inputShapes << "_"; + result << "I" << CommonTestUtils::vec2str(indices) << "_"; + result << "O" << CommonTestUtils::vec2str(offsets) << "_"; + result << "DI" << defaultIndex << "_"; + result << "WW" << withWeights << "_"; + result << "WDI" << withDefIndex << "_"; + result << "netPRC=" << netPrecision << "_"; + result << "indPRC=" << indPrecision << "_"; + result << "targetDevice=" << targetDevice; + return result.str(); + } + + void SetUp() override { + embeddingBagOffsetsSumParams embParams; + ElementType indPrecision; + std::tie(embParams, inType, indPrecision, targetDevice) = this->GetParam(); + + InputShape inputShapes; + std::vector indices, offsets; + bool withWeights, withDefIndex; + size_t defaultIndex; + std::tie(inputShapes, indices, offsets, defaultIndex, withWeights, withDefIndex) = embParams; + + selectedType = makeSelectedTypeStr("ref", inType); + targetDevice = CommonTestUtils::DEVICE_CPU; + + init_input_shapes({ inputShapes }); + + auto emb_table_node = std::make_shared(inType, inputShapes.first); + ngraph::ParameterVector params = {emb_table_node}; + + auto embBag = std::dynamic_pointer_cast(ngraph::builder::makeEmbeddingBagOffsetsSum( + inType, + indPrecision, + emb_table_node, + indices, + offsets, + defaultIndex, + withWeights, + withDefIndex)); + ngraph::ResultVector results{std::make_shared(embBag)}; + function = std::make_shared(results, params, "embeddingBagOffsetsSum"); + } +}; + +TEST_P(EmbeddingBagOffsetsSumLayerCPUTest, CompareWithRefs) { + SKIP_IF_CURRENT_TEST_IS_DISABLED() + run(); + CheckPluginRelatedResults(executableNetwork, "embeddingBagOffsetsSum"); +} + +namespace { + +const std::vector netPrecisions = { + ElementType::f32, + ElementType::i32, + ElementType::u8 +}; + +const std::vector indPrecisions = { + ElementType::i64, + ElementType::i32 +}; + +const std::vector input_shapes = { + // dynamic input shapes + { + // input model dynamic shapes + {ov::Dimension::dynamic(), ov::Dimension::dynamic()}, + // input tensor shapes + {{5, 6}, {10, 35}} + }, + { + // input model dynamic shapes + {ov::Dimension::dynamic(), ov::Dimension::dynamic(), ov::Dimension::dynamic()}, + // input tensor shapes + {{5, 4, 16}, {10, 12, 8}} + }, + { + // input model dynamic shapes with limits + {{5, 10}, {6, 35}, {4, 8}}, + // input tensor shapes + {{5, 6, 4}, {10, 35, 8}, {5, 6, 4}} + }, + // static shapes + {{5, 6}, {{5, 6}}}, + {{10, 35}, {{10, 35}}}, + {{5, 4, 16}, {{5, 4, 16}}}, +}; + +const std::vector> indices = + {{0, 1, 2, 2, 3}, {4, 4, 3, 1, 0}, {1, 2, 1, 2, 1, 2, 1, 2, 1, 2}}; +const std::vector> offsets = {{0, 2}, {0, 0, 2, 2}, {2, 4}}; +const std::vector default_index = {0, 4}; +const std::vector with_weights = {false, true}; +const std::vector with_default_index = {false, true}; + +const auto embBagOffsetSumArgSet = ::testing::Combine( + ::testing::ValuesIn(input_shapes), + ::testing::ValuesIn(indices), + ::testing::ValuesIn(offsets), + ::testing::ValuesIn(default_index), + ::testing::ValuesIn(with_weights), + ::testing::ValuesIn(with_default_index) +); + +INSTANTIATE_TEST_SUITE_P(smoke, EmbeddingBagOffsetsSumLayerCPUTest, + ::testing::Combine( + embBagOffsetSumArgSet, + ::testing::ValuesIn(netPrecisions), + ::testing::ValuesIn(indPrecisions), + ::testing::Values(CommonTestUtils::DEVICE_CPU)), + EmbeddingBagOffsetsSumLayerCPUTest::getTestCaseName); +} // namespace +} // namespace CPULayerTestsDefinitions \ No newline at end of file diff --git a/inference-engine/tests/functional/plugin/cpu/single_layer_tests/embedding_bag_packed_sum.cpp b/inference-engine/tests/functional/plugin/cpu/single_layer_tests/embedding_bag_packed_sum.cpp new file mode 100644 index 00000000000..90b08799f73 --- /dev/null +++ b/inference-engine/tests/functional/plugin/cpu/single_layer_tests/embedding_bag_packed_sum.cpp @@ -0,0 +1,152 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include +#include +#include + +#include +#include "ngraph_functions/builders.hpp" +#include "shared_test_classes/base/layer_test_utils.hpp" +#include "shared_test_classes/base/ov_subgraph.hpp" +#include "test_utils/cpu_test_utils.hpp" + +using namespace InferenceEngine; +using namespace CPUTestUtils; +using namespace ov::test; + +namespace CPULayerTestsDefinitions { + +typedef std::tuple< + InputShape, // input_shapes + std::vector>, // indices + bool // with_weights + > embeddingBagPackedSumParams; + +typedef std::tuple< + embeddingBagPackedSumParams, + ElementType, // embedding table + ElementType, // indices + LayerTestsUtils::TargetDevice> embeddingBagPackedSumLayerTestParamsSet; + +class EmbeddingBagPackedSumLayerCPUTest : + public testing::WithParamInterface, + virtual public SubgraphBaseTest, + public CPUTestsBase { +public: + static std::string getTestCaseName(const testing::TestParamInfo& obj) { + embeddingBagPackedSumParams params; + ElementType netPrecision, indPrecision; + std::string targetDevice; + std::tie(params, netPrecision, indPrecision, targetDevice) = obj.param; + + InputShape inputShapes; + std::vector> indices; + bool withWeights; + std::tie(inputShapes, indices, withWeights) = params; + + std::ostringstream result; + result << "IS=" << inputShapes << "_"; + result << "I" << CommonTestUtils::vec2str(indices) << "_"; + result << "WW" << withWeights << "_"; + result << "netPRC=" << netPrecision << "_"; + result << "indPRC=" << indPrecision << "_"; + result << "targetDevice=" << targetDevice; + return result.str(); + } + +protected: + void SetUp() override { + embeddingBagPackedSumParams embParams; + ElementType indPrecision; + std::tie(embParams, inType, indPrecision, targetDevice) = this->GetParam(); + + InputShape inputShapes; + std::vector> indices; + bool withWeights; + std::tie(inputShapes, indices, withWeights) = embParams; + + selectedType = makeSelectedTypeStr("ref", inType); + targetDevice = CommonTestUtils::DEVICE_CPU; + + init_input_shapes({ inputShapes }); + + auto emb_table_node = std::make_shared(inType, inputShapes.first); + ngraph::ParameterVector params = {emb_table_node}; + + auto embBag = std::dynamic_pointer_cast(ngraph::builder::makeEmbeddingBagPackedSum( + inType, + indPrecision, + emb_table_node, + indices, + withWeights)); + ngraph::ResultVector results{std::make_shared(embBag)}; + function = std::make_shared(results, params, "embeddingBagPackedSum"); + } +}; + +TEST_P(EmbeddingBagPackedSumLayerCPUTest, CompareWithRefs) { + SKIP_IF_CURRENT_TEST_IS_DISABLED() + run(); + CheckPluginRelatedResults(executableNetwork, "embeddingBagPackedSum"); +} + +namespace { + +const std::vector netPrecisions = { + ElementType::f32, + ElementType::i32, + ElementType::u8 +}; + +const std::vector indPrecisions = { + ElementType::i64, + ElementType::i32 +}; + +const std::vector input_shapes = { + // dynamic input shapes + { + // input model dynamic shapes + {ov::Dimension::dynamic(), ov::Dimension::dynamic()}, + // input tensor shapes + {{{5, 6}}, {10, 35}} + }, + { + // input model dynamic shapes + {ov::Dimension::dynamic(), ov::Dimension::dynamic(), ov::Dimension::dynamic()}, + // input tensor shapes + {{5, 4, 16}, {10, 12, 8}} + }, + { + // input model dynamic shapes with limits + {{5, 10}, {6, 35}, {4, 8}}, + // input tensor shapes + {{5, 6, 4}, {10, 35, 8}, {5, 6, 4}} + }, + // static shapes + {{5, 6}, {{5, 6}}}, + {{10, 35}, {{10, 35}}}, + {{5, 4, 16}, {{5, 4, 16}}}, +}; + +const std::vector>> indices = + {{{0, 1}, {2, 2}, {3, 4}}, {{4, 4, 3}, {1, 0, 2}}, {{1, 2, 1, 2}, {1, 2, 1, 2}}}; +const std::vector with_weights = {false, true}; + +const auto embBagPackedSumArgSet = ::testing::Combine( + ::testing::ValuesIn(input_shapes), + ::testing::ValuesIn(indices), + ::testing::ValuesIn(with_weights) +); + +INSTANTIATE_TEST_SUITE_P(smoke, EmbeddingBagPackedSumLayerCPUTest, + ::testing::Combine( + embBagPackedSumArgSet, + ::testing::ValuesIn(netPrecisions), + ::testing::ValuesIn(indPrecisions), + ::testing::Values(CommonTestUtils::DEVICE_CPU)), + EmbeddingBagPackedSumLayerCPUTest::getTestCaseName); +} // namespace +} // namespace CPULayerTestsDefinitions diff --git a/inference-engine/tests/functional/plugin/cpu/single_layer_tests/embedding_segments_sum.cpp b/inference-engine/tests/functional/plugin/cpu/single_layer_tests/embedding_segments_sum.cpp new file mode 100644 index 00000000000..49df7ba6b14 --- /dev/null +++ b/inference-engine/tests/functional/plugin/cpu/single_layer_tests/embedding_segments_sum.cpp @@ -0,0 +1,173 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include +#include +#include + +#include +#include "ngraph_functions/builders.hpp" +#include "shared_test_classes/base/layer_test_utils.hpp" +#include "shared_test_classes/base/ov_subgraph.hpp" +#include "test_utils/cpu_test_utils.hpp" + +using namespace InferenceEngine; +using namespace CPUTestUtils; +using namespace ov::test; + +namespace CPULayerTestsDefinitions { + +typedef std::tuple< + InputShape, // input_shapes + std::vector, // indices + std::vector, // segment_ids + size_t, // num_segments + size_t, // default_index + bool, // with_weights + bool // with_def_index + > embeddingSegmentsSumParams; + +typedef std::tuple< + embeddingSegmentsSumParams, + ElementType, // embedding table + ElementType, // indices + LayerTestsUtils::TargetDevice> embeddingSegmentsSumLayerTestParamsSet; + +class EmbeddingSegmentsSumLayerCPUTest : + public testing::WithParamInterface, + virtual public SubgraphBaseTest, + public CPUTestsBase { +public: + static std::string getTestCaseName(const testing::TestParamInfo& obj) { + embeddingSegmentsSumParams params; + ElementType netPrecision, indPrecision; + std::string targetDevice; + std::tie(params, netPrecision, indPrecision, targetDevice) = obj.param; + + InputShape inputShapes; + std::vector indices, segmentIds; + size_t numSegments, defaultIndex; + bool withWeights, withDefIndex; + std::tie(inputShapes, indices, segmentIds, numSegments, defaultIndex, withWeights, withDefIndex) = params; + + std::ostringstream result; + result << "IS=" << inputShapes << "_"; + result << "I" << CommonTestUtils::vec2str(indices) << "_"; + result << "SI" << CommonTestUtils::vec2str(segmentIds) << "_"; + result << "NS" << numSegments << "_"; + result << "DI" << defaultIndex << "_"; + result << "WW" << withWeights << "_"; + result << "WDI" << withDefIndex << "_"; + result << "netPRC=" << netPrecision << "_"; + result << "indPRC=" << indPrecision << "_"; + result << "targetDevice=" << targetDevice; + return result.str(); + } + +protected: + void SetUp() override { + embeddingSegmentsSumParams embParams; + ElementType indPrecision; + std::tie(embParams, inType, indPrecision, targetDevice) = this->GetParam(); + + InputShape inputShapes; + std::vector indices, segmentIds; + bool withWeights, withDefIndex; + size_t numSegments, defaultIndex; + std::tie(inputShapes, indices, segmentIds, numSegments, defaultIndex, withWeights, withDefIndex) = embParams; + + selectedType = makeSelectedTypeStr("ref", inType); + targetDevice = CommonTestUtils::DEVICE_CPU; + + init_input_shapes({ inputShapes }); + + auto emb_table_node = std::make_shared(inType, inputShapes.first); + ngraph::ParameterVector params = {emb_table_node}; + + auto embBag = std::dynamic_pointer_cast(ngraph::builder::makeEmbeddingSegmentsSum( + inType, + indPrecision, + emb_table_node, + indices, + segmentIds, + numSegments, + defaultIndex, + withWeights, + withDefIndex)); + ngraph::ResultVector results{std::make_shared(embBag)}; + function = std::make_shared(results, params, "embeddingSegmentsSum"); + } +}; + +TEST_P(EmbeddingSegmentsSumLayerCPUTest, CompareWithRefs) { + SKIP_IF_CURRENT_TEST_IS_DISABLED() + run(); + CheckPluginRelatedResults(executableNetwork, "embeddingSegmentsSum"); +} + +namespace { +const std::vector netPrecisions = { + ElementType::f32, + ElementType::i32, + ElementType::u8 +}; + +const std::vector indPrecisions = { + ElementType::i64, + ElementType::i32 +}; + +const std::vector input_shapes = { + // dynamic input shapes + { + // input model dynamic shapes + {ov::Dimension::dynamic(), ov::Dimension::dynamic()}, + // input tensor shapes + {{5, 6}, {10, 35}} + }, + { + // input model dynamic shapes + {ov::Dimension::dynamic(), ov::Dimension::dynamic(), ov::Dimension::dynamic()}, + // input tensor shapes + {{5, 4, 16}, {10, 12, 8}} + }, + { + // input model dynamic shapes with limits + {{5, 10}, {6, 35}, {4, 8}}, + // input tensor shapes + {{5, 6, 4}, {10, 35, 8}, {5, 6, 4}} + }, + // static shapes + {{5, 6}, {{5, 6}}}, + {{10, 35}, {{10, 35}}}, + {{5, 4, 16}, {{5, 4, 16}}}, +}; + +const std::vector> indices = + {{0, 1, 2, 2, 3}, {4, 4, 3, 1, 2}}; +const std::vector> segment_ids = {{0, 1, 2, 3, 4}, {0, 0, 2, 2, 4}}; +const std::vector num_segments = {5, 7}; +const std::vector default_index = {0, 4}; +const std::vector with_weights = {false, true}; +const std::vector with_default_index = {false, true}; + +const auto embSegmentsSumArgSet = ::testing::Combine( + ::testing::ValuesIn(input_shapes), + ::testing::ValuesIn(indices), + ::testing::ValuesIn(segment_ids), + ::testing::ValuesIn(num_segments), + ::testing::ValuesIn(default_index), + ::testing::ValuesIn(with_weights), + ::testing::ValuesIn(with_default_index) +); + +INSTANTIATE_TEST_SUITE_P(smoke, EmbeddingSegmentsSumLayerCPUTest, + ::testing::Combine( + embSegmentsSumArgSet, + ::testing::ValuesIn(netPrecisions), + ::testing::ValuesIn(indPrecisions), + ::testing::Values(CommonTestUtils::DEVICE_CPU)), + EmbeddingSegmentsSumLayerCPUTest::getTestCaseName); +} // namespace +} // namespace CPULayerTestsDefinitions diff --git a/inference-engine/tests/functional/plugin/cpu/single_layer_tests/extract_image_patches.cpp b/inference-engine/tests/functional/plugin/cpu/single_layer_tests/extract_image_patches.cpp index 58e532a7f1c..2c58b36392f 100755 --- a/inference-engine/tests/functional/plugin/cpu/single_layer_tests/extract_image_patches.cpp +++ b/inference-engine/tests/functional/plugin/cpu/single_layer_tests/extract_image_patches.cpp @@ -2,91 +2,132 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "shared_test_classes/base/ov_subgraph.hpp" #include "test_utils/cpu_test_utils.hpp" #include "shared_test_classes/base/layer_test_utils.hpp" -#include "ngraph_functions/utils/ngraph_helpers.hpp" -#include +#include "ngraph_functions/builders.hpp" -using namespace InferenceEngine; using namespace CPUTestUtils; +using namespace ov::test; namespace CPULayerTestsDefinitions { -using LayerTestsDefinitions::extractImagePatchesTuple; +using extractImagePatchesParams = typename std::tuple< + InputShape, // input shape + ElementType, // Network precision + ov::Shape, // kernel size + ov::Strides, // strides + ov::Shape, // rates + ov::op::PadType>; // pad type -typedef std::tuple< - extractImagePatchesTuple, - CPUSpecificParams> extractImagePatchesCPUTestParamsSet; - -class ExtractImagePatchesLayerCPUTest : public testing::WithParamInterface, - virtual public LayerTestsUtils::LayerTestsCommon, public CPUTestsBase { +class ExtractImagePatchesLayerCPUTest : public testing::WithParamInterface, + virtual public SubgraphBaseTest, public CPUTestsBase { public: - static std::string getTestCaseName(testing::TestParamInfo obj) { - extractImagePatchesTuple basicParamsSet; - CPUSpecificParams cpuParams; - std::tie(basicParamsSet, cpuParams) = obj.param; + static std::string getTestCaseName(testing::TestParamInfo obj) { + InputShape inputShapes; + ElementType inputPrecision; + ov::Shape kernelSize; + ov::Strides strides; + ov::Shape rates; + ov::op::PadType padType; + std::tie(inputShapes, inputPrecision, kernelSize, strides, rates, padType) = obj.param; std::ostringstream result; - result << LayerTestsDefinitions::ExtractImagePatchesTest::getTestCaseName(testing::TestParamInfo( - basicParamsSet, 0)); + result << "netPRC=" << inputPrecision << "_" << "IS=" << CommonTestUtils::partialShape2str({ inputShapes.first }) << "_"; + result << "TS="; + result << "("; + for (const auto& targetShape : inputShapes.second) { + result << CommonTestUtils::vec2str(targetShape) << "_"; + } - result << CPUTestsBase::getTestCaseName(cpuParams); + result << ")_" << "kernelSize=" << kernelSize << "_strides=" << strides << "_rates=" << rates << "_padType=" << padType; return result.str(); } protected: void SetUp() override { - extractImagePatchesTuple basicParamsSet; - CPUSpecificParams cpuParams; - std::tie(basicParamsSet, cpuParams) = this->GetParam(); - std::tie(inFmts, outFmts, priority, selectedType) = cpuParams; + targetDevice = CommonTestUtils::DEVICE_CPU; + InputShape inputShapes; + ElementType inputPrecision; + ov::Shape kernelSize; + ov::Strides strides; + ov::Shape rates; + ov::op::PadType padType; + std::tie(inputShapes, inputPrecision, kernelSize, strides, rates, padType) = this->GetParam(); - std::vector inputShape, kernel, strides, rates; - ngraph::op::PadType pad_type; - InferenceEngine::Precision netPrecision; - std::tie(inputShape, kernel, strides, rates, pad_type, netPrecision, inPrc, outPrc, inLayout, targetDevice) = basicParamsSet; - selectedType = std::string("ref_any_") + netPrecision.name(); + selectedType = makeSelectedTypeStr("ref_any", inputPrecision); + if (inputPrecision == ElementType::bf16) { + rel_threshold = 1e-2; + } - auto ngPrc = FuncTestUtils::PrecisionUtils::convertIE2nGraphPrc(netPrecision); - auto inputNode = std::make_shared(ngPrc, ngraph::Shape(inputShape)); - ngraph::ParameterVector params = {inputNode}; + init_input_shapes({ inputShapes }); - auto extImgPatches = std::make_shared( - inputNode, ngraph::Shape(kernel), ngraph::Strides(strides), ngraph::Shape(rates), pad_type); - ngraph::ResultVector results{std::make_shared(extImgPatches)}; - function = std::make_shared(results, params, "ExtractImagePatches"); + auto params = ngraph::builder::makeDynamicParams(inputPrecision, inputDynamicShapes); + auto extImgPatches = std::make_shared(params[0], kernelSize, strides, rates, padType); + function = makeNgraphFunction(inputPrecision, params, extImgPatches, "ExtractImagePatches"); } }; TEST_P(ExtractImagePatchesLayerCPUTest, CompareWithRefs) { SKIP_IF_CURRENT_TEST_IS_DISABLED() - Run(); + run(); CheckPluginRelatedResults(executableNetwork, "ExtractImagePatches"); } namespace { - const std::vector> inShapes = {{2, 3, 13, 37}}; - const std::vector> kSizes = {{1, 5}, {3, 4}, {3, 1}}; - const std::vector> strides = {{1, 2}, {2, 2}, {2, 1}}; - const std::vector> rates = {{1, 3}, {3, 3}, {3, 1}}; +const std::vector inputShapes = { + InputShape{{}, {{2, 3, 13, 37}}}, + InputShape{ + // dynamic + {-1, -1, -1, -1}, + // static + {{2, 3, 13, 37}, {6, 4, 14, 14}, {8, 12, 15, 16}} + }, + InputShape{ + // dynamic + {{5, 15}, {6, 17}, {10, 15}, {13, 16}}, + // static + {{5, 17, 10, 15}, {15, 10, 12, 13}, {10, 10, 15, 16}} + }, +}; - const std::vector autoPads = {ngraph::op::PadType::VALID, ngraph::op::PadType::SAME_UPPER, ngraph::op::PadType::SAME_LOWER}; - const std::vector netPrecision = {Precision::I8, Precision::BF16, Precision::FP32}; - const CPUSpecificParams CPUParams = emptyCPUSpec; +const std::vector inputPrecisions = { + ElementType::i8, + ElementType::bf16, + ElementType::f32 +}; -const auto Layer_params = ::testing::Combine( - ::testing::ValuesIn(inShapes), - ::testing::ValuesIn(kSizes), - ::testing::ValuesIn(strides), - ::testing::ValuesIn(rates), - ::testing::ValuesIn(autoPads), - ::testing::ValuesIn(netPrecision), - ::testing::Values(InferenceEngine::Precision::UNSPECIFIED), - ::testing::Values(InferenceEngine::Precision::UNSPECIFIED), - ::testing::Values(InferenceEngine::Layout::ANY), - ::testing::Values(CommonTestUtils::DEVICE_CPU)); +const std::vector kSizes = { + {1, 5}, + {3, 4}, + {3, 1} +}; -INSTANTIATE_TEST_SUITE_P(smoke_ExtractImagePatches_CPU, ExtractImagePatchesLayerCPUTest, - ::testing::Combine(Layer_params, ::testing::Values(CPUParams)), - ExtractImagePatchesLayerCPUTest::getTestCaseName); +const std::vector strides = { + {1, 2}, + {2, 2}, + {2, 1} +}; + +const std::vector rates = { + {1, 3}, + {3, 3}, + {3, 1} +}; + +const std::vector autoPads = { + ov::op::PadType::VALID, + ov::op::PadType::SAME_UPPER, + ov::op::PadType::SAME_LOWER +}; + +const auto params = ::testing::Combine( + ::testing::ValuesIn(inputShapes), + ::testing::ValuesIn(inputPrecisions), + ::testing::ValuesIn(kSizes), + ::testing::ValuesIn(strides), + ::testing::ValuesIn(rates), + ::testing::ValuesIn(autoPads)); + +INSTANTIATE_TEST_SUITE_P(smoke_ExtractImagePatches_CPU, ExtractImagePatchesLayerCPUTest, params, ExtractImagePatchesLayerCPUTest::getTestCaseName); } // namespace } // namespace CPULayerTestsDefinitions diff --git a/inference-engine/tests/functional/plugin/cpu/single_layer_tests/interpolate.cpp b/inference-engine/tests/functional/plugin/cpu/single_layer_tests/interpolate.cpp index 7392cbdb530..f3bbbe6d1b4 100644 --- a/inference-engine/tests/functional/plugin/cpu/single_layer_tests/interpolate.cpp +++ b/inference-engine/tests/functional/plugin/cpu/single_layer_tests/interpolate.cpp @@ -2,35 +2,95 @@ // SPDX-License-Identifier: Apache-2.0 // -#include +#include "shared_test_classes/base/ov_subgraph.hpp" +#include "ngraph_functions/builders.hpp" #include "test_utils/cpu_test_utils.hpp" #include "test_utils/fusing_test_utils.hpp" +#include "functional_test_utils/ov_tensor_utils.hpp" +#include "openvino/core/preprocess/pre_post_process.hpp" -using namespace InferenceEngine; +using namespace ov::test; using namespace CPUTestUtils; +using ngraph::helpers::operator<<; namespace CPULayerTestsDefinitions { -typedef std::tuple< - LayerTestsDefinitions::InterpolateLayerTestParams, - CPUSpecificParams, - fusingSpecificParams, - std::map - > InterpolateLayerCPUTestParamsSet; +using InterpolateSpecificParams = std::tuple, // PadBegin + std::vector, // PadEnd + double>; // Cube coef + +using ShapeParams = std::tuple>, // scales or sizes values + std::vector>; // axes + +using InterpolateLayerCPUTestParamsSet = std::tuple>; class InterpolateLayerCPUTest : public testing::WithParamInterface, - virtual public LayerTestsUtils::LayerTestsCommon, public CpuTestWithFusing { + virtual public SubgraphBaseTest, public CpuTestWithFusing { public: static std::string getTestCaseName(testing::TestParamInfo obj) { - LayerTestsDefinitions::InterpolateLayerTestParams basicParamsSet; + InterpolateSpecificParams specificParams; + ShapeParams shapeParams; + ElementType prec; CPUSpecificParams cpuParams; fusingSpecificParams fusingParams; std::map additionalConfig; - std::tie(basicParamsSet, cpuParams, fusingParams, additionalConfig) = obj.param; + std::tie(specificParams, shapeParams, prec, cpuParams, fusingParams, additionalConfig) = obj.param; + + ngraph::op::v4::Interpolate::InterpolateMode mode; + ngraph::op::v4::Interpolate::CoordinateTransformMode transfMode; + ngraph::op::v4::Interpolate::NearestMode nearMode; + bool antiAlias; + std::vector padBegin; + std::vector padEnd; + double cubeCoef; + std::tie(mode, transfMode, nearMode, antiAlias, padBegin, padEnd, cubeCoef) = specificParams; + + ngraph::op::v4::Interpolate::ShapeCalcMode shapeCalcMode; + InputShape inputShapes; + ngraph::helpers::InputLayerType shapeInputType; + std::vector> shapeDataForInput; + std::vector axes; + std::tie(shapeCalcMode, inputShapes, shapeInputType, shapeDataForInput, axes) = shapeParams; std::ostringstream result; - result << LayerTestsDefinitions::InterpolateLayerTest::getTestCaseName(testing::TestParamInfo( - basicParamsSet, 0)); + result << "ShapeCalcMode=" << shapeCalcMode << "_"; + result << "IS="; + result << CommonTestUtils::partialShape2str({inputShapes.first}) << "_"; + result << "TS="; + for (const auto& shape : inputShapes.second) { + result << CommonTestUtils::vec2str(shape) << "_"; + } + if (shapeCalcMode == ngraph::op::v4::Interpolate::ShapeCalcMode::SCALES) { + result << "Scales="; + } else { + result << "Sizes="; + } + for (const auto &data : shapeDataForInput) { + result << CommonTestUtils::vec2str(data) << "_"; + } + result << shapeInputType << "_"; + result << "InterpolateMode=" << mode << "_"; + result << "CoordinateTransformMode=" << transfMode << "_"; + result << "NearestMode=" << nearMode << "_"; + result << "CubeCoef=" << cubeCoef << "_"; + result << "Antialias=" << antiAlias << "_"; + result << "PB=" << CommonTestUtils::vec2str(padBegin) << "_"; + result << "PE=" << CommonTestUtils::vec2str(padEnd) << "_"; + result << "Axes=" << CommonTestUtils::vec2str(axes) << "_"; + result << "PRC=" << prec << "_"; result << CPUTestsBase::getTestCaseName(cpuParams); result << CpuTestWithFusing::getTestCaseName(fusingParams); @@ -45,75 +105,168 @@ public: return result.str(); } + void generate_inputs(const std::vector& targetInputStaticShapes) override { + inputs.clear(); + const auto& funcInputs = function->inputs(); + for (int i = 0; i < funcInputs.size(); ++i) { + const auto& funcInput = funcInputs[i]; + ov::runtime::Tensor tensor; + + if (i == 1) { + if (shapeCalcMode == ngraph::op::v4::Interpolate::ShapeCalcMode::SIZES) { + tensor = ov::runtime::Tensor(funcInput.get_element_type(), targetInputStaticShapes[i], sizes[inferRequestNum].data()); + } else { + tensor = ov::runtime::Tensor(funcInput.get_element_type(), targetInputStaticShapes[i], scales[inferRequestNum].data()); + } + } else { + tensor = ov::test::utils::create_and_fill_tensor(funcInput.get_element_type(), targetInputStaticShapes[i], 2560, 0, 256); + } + + inputs.insert({funcInput.get_node_shared_ptr(), tensor}); + } + inferRequestNum++; + } + + void configure_model() override { + ov::preprocess::PrePostProcessor p(function); + { + auto& params = function->get_parameters(); + for (size_t i = 0; i < params.size(); i++) { + if (i > 0) { + continue; + } + if (inType != ov::element::Type_t::undefined) { + p.input(ov::preprocess::InputInfo(i) + .tensor(ov::preprocess::InputTensorInfo().set_element_type(inType))); + } + } + } + { + auto results = function->get_results(); + for (size_t i = 0; i < results.size(); i++) { + if (outType != ov::element::Type_t::undefined) { + p.output(ov::preprocess::OutputInfo(i) + .tensor(ov::preprocess::OutputTensorInfo().set_element_type(outType))); + } + } + } + function = p.build(); + } + protected: + std::vector> scales; + std::vector> sizes; + ngraph::op::v4::Interpolate::ShapeCalcMode shapeCalcMode; + size_t inferRequestNum = 0; + void SetUp() override { - LayerTestsDefinitions::InterpolateLayerTestParams basicParamsSet; + targetDevice = CommonTestUtils::DEVICE_CPU; + + InterpolateSpecificParams specificParams; + ShapeParams shapeParams; + ElementType ngPrc; CPUSpecificParams cpuParams; fusingSpecificParams fusingParams; std::map additionalConfig; - std::tie(basicParamsSet, cpuParams, fusingParams, additionalConfig) = this->GetParam(); + std::tie(specificParams, shapeParams, ngPrc, cpuParams, fusingParams, additionalConfig) = this->GetParam(); std::tie(inFmts, outFmts, priority, selectedType) = cpuParams; std::tie(postOpMgrPtr, fusedOps) = fusingParams; - - LayerTestsDefinitions::InterpolateSpecificParams interpolateParams; - std::vector inputShape; - std::vector targetShape; - Precision netPrecision; - std::map additional_config; - std::tie(interpolateParams, netPrecision, inPrc, outPrc, inLayout, outLayout, inputShape, - targetShape, targetDevice, additional_config) = basicParamsSet; + configuration.insert(additionalConfig.begin(), additionalConfig.end()); ngraph::op::v4::Interpolate::InterpolateMode mode; - ngraph::op::v4::Interpolate::ShapeCalcMode shapeCalcMode; - ngraph::op::v4::Interpolate::CoordinateTransformMode coordinateTransformMode; - ngraph::op::v4::Interpolate::NearestMode nearestMode; - bool antialias; - std::vector padBegin, padEnd; + ngraph::op::v4::Interpolate::CoordinateTransformMode transfMode; + ngraph::op::v4::Interpolate::NearestMode nearMode; + bool antiAlias; + std::vector padBegin; + std::vector padEnd; double cubeCoef; + std::tie(mode, transfMode, nearMode, antiAlias, padBegin, padEnd, cubeCoef) = specificParams; + + InputShape dataShape; + ngraph::helpers::InputLayerType shapeInputType; + std::vector> shapeDataForInput; std::vector axes; - std::vector scales; - std::tie(mode, shapeCalcMode, coordinateTransformMode, nearestMode, antialias, padBegin, padEnd, cubeCoef, axes, scales) = interpolateParams; - inPrc = outPrc = netPrecision; - configuration.insert(additionalConfig.begin(), additionalConfig.end()); - using ShapeCalcMode = ngraph::op::v4::Interpolate::ShapeCalcMode; + std::tie(shapeCalcMode, dataShape, shapeInputType, shapeDataForInput, axes) = shapeParams; - auto ngPrc = FuncTestUtils::PrecisionUtils::convertIE2nGraphPrc(netPrecision); - auto params = ngraph::builder::makeParams(ngPrc, {inputShape}); + if (shapeCalcMode == ngraph::op::v4::Interpolate::ShapeCalcMode::SCALES) { + scales = shapeDataForInput; + sizes.resize(scales.size(), std::vector(scales.front().size(), 0)); + } else { + sizes.resize(shapeDataForInput.size()); + for (size_t i = 0; i < shapeDataForInput.size(); i++) { + for (size_t j = 0; j < shapeDataForInput[i].size(); j++) { + sizes[i].push_back(shapeDataForInput[i][j]); + } + } + scales.resize(sizes.size(), std::vector(sizes.front().size(), 0)); + } - auto constant = ngraph::opset3::Constant(ngraph::element::Type_t::i64, {targetShape.size()}, targetShape); + std::vector inputShapes; + inputShapes.push_back(dataShape); + if (shapeInputType == ngraph::helpers::InputLayerType::PARAMETER) { + inputShapes.push_back(InputShape({static_cast(axes.size())}, std::vector(dataShape.second.size(), {axes.size()}))); + } - auto scales_const = ngraph::opset3::Constant(ngraph::element::Type_t::f32, {scales.size()}, scales); + if (additionalConfig[InferenceEngine::PluginConfigParams::KEY_ENFORCE_BF16] == InferenceEngine::PluginConfigParams::YES) { + inType = outType = ngPrc = ElementType::bf16; + rel_threshold = 1e-2f; + } else { + inType = outType = ngPrc; + } - auto scalesInput = std::make_shared(scales_const); + init_input_shapes(inputShapes); - auto secondaryInput = std::make_shared(constant); + auto params = ngraph::builder::makeDynamicParams(ngPrc, {inputDynamicShapes.front()}); + + std::shared_ptr sizesInput, scalesInput; + if (shapeCalcMode == ngraph::op::v4::Interpolate::ShapeCalcMode::SCALES) { + if (shapeInputType == ngraph::helpers::InputLayerType::PARAMETER) { + auto paramNode = std::make_shared(ngraph::element::Type_t::f32, ov::Shape{scales.front().size()}); + params.push_back(paramNode); + scalesInput = paramNode; + } else { + scalesInput = std::make_shared(ngraph::element::Type_t::f32, ov::Shape{scales.front().size()}, scales.front()); + } + sizesInput = std::make_shared(ngraph::element::Type_t::i32, ov::Shape{sizes.front().size()}, sizes.front()); + } else { + if (shapeInputType == ngraph::helpers::InputLayerType::PARAMETER) { + auto paramNode = std::make_shared(ngraph::element::Type_t::i32, ov::Shape{sizes.front().size()}); + params.push_back(paramNode); + sizesInput = paramNode; + } else { + sizesInput = std::make_shared(ngraph::element::Type_t::i32, ov::Shape{sizes.front().size()}, sizes.front()); + } + scalesInput = std::make_shared(ngraph::element::Type_t::f32, ov::Shape{scales.front().size()}, scales.front()); + } + auto axesInput = std::make_shared(ngraph::element::Type_t::i64, ov::Shape{axes.size()}, axes); + + for (size_t i = 0; i < params.size(); i++) { + params[i]->set_friendly_name(std::string("param_") + std::to_string(i)); + } + + ngraph::op::v4::Interpolate::InterpolateAttrs interpAttr{mode, shapeCalcMode, padBegin, padEnd, transfMode, nearMode, + antiAlias, cubeCoef}; - auto axesConst = ngraph::opset3::Constant(ngraph::element::Type_t::i64, {axes.size()}, axes); - auto axesInput = std::make_shared(axesConst); - ngraph::op::v4::Interpolate::InterpolateAttrs interpolateAttributes{mode, shapeCalcMode, padBegin, - padEnd, coordinateTransformMode, nearestMode, antialias, cubeCoef}; auto interpolate = std::make_shared(params[0], - secondaryInput, + sizesInput, scalesInput, axesInput, - interpolateAttributes); - function = makeNgraphFunction(ngPrc, params, interpolate, "interpolate"); + interpAttr); + + function = makeNgraphFunction(ngPrc, params, interpolate, "InterpolateCPU"); + if (selectedType.empty()) { selectedType = getPrimitiveType(); } - selectedType.push_back('_'); - if (additionalConfig.count(PluginConfigParams::KEY_ENFORCE_BF16) && additionalConfig[PluginConfigParams::KEY_ENFORCE_BF16] == PluginConfigParams::YES) - selectedType += "BF16"; - else - selectedType += netPrecision.name(); + selectedType = makeSelectedTypeStr(selectedType, ngPrc); } }; TEST_P(InterpolateLayerCPUTest, CompareWithRefs) { SKIP_IF_CURRENT_TEST_IS_DISABLED() - Run(); + run(); CheckPluginRelatedResults(executableNetwork, "Interpolate"); } @@ -122,14 +275,14 @@ namespace { /* CPU PARAMS */ std::vector filterCPUInfoForDevice() { std::vector resCPUParams; - if (with_cpu_x86_avx512f()) { + if (InferenceEngine::with_cpu_x86_avx512f()) { resCPUParams.push_back(CPUSpecificParams{{nChw16c, x, x, x}, {nChw16c}, {"jit_avx512"}, "jit_avx512"}); resCPUParams.push_back(CPUSpecificParams{{nhwc, x, x, x}, {nhwc}, {"jit_avx512"}, "jit_avx512"}); - } else if (with_cpu_x86_avx2()) { + } else if (InferenceEngine::with_cpu_x86_avx2()) { resCPUParams.push_back(CPUSpecificParams{{nChw8c, x, x, x}, {nChw8c}, {"jit_avx2"}, "jit_avx2"}); resCPUParams.push_back(CPUSpecificParams{{nhwc, x, x, x}, {nhwc}, {"jit_avx2"}, "jit_avx2"}); resCPUParams.push_back(CPUSpecificParams{{nchw, x, x, x}, {nchw}, {"jit_avx2"}, "jit_avx2"}); - } else if (with_cpu_x86_sse42()) { + } else if (InferenceEngine::with_cpu_x86_sse42()) { resCPUParams.push_back(CPUSpecificParams{{nChw8c, x, x, x}, {nChw8c}, {"jit_sse42"}, "jit_sse42"}); resCPUParams.push_back(CPUSpecificParams{{nhwc, x, x, x}, {nhwc}, {"jit_sse42"}, "jit_sse42"}); } else { @@ -138,11 +291,6 @@ std::vector filterCPUInfoForDevice() { return resCPUParams; } /* ========== */ - -const std::vector netPrecisions = { - InferenceEngine::Precision::FP32 -}; - const std::vector coordinateTransformModes = { ngraph::op::v4::Interpolate::CoordinateTransformMode::TF_HALF_PIXEL_FOR_NN, ngraph::op::v4::Interpolate::CoordinateTransformMode::PYTORCH_HALF_PIXEL, @@ -168,11 +316,6 @@ const std::vector defNearestModes = { ngraph::op::v4::Interpolate::NearestMode::ROUND_PREFER_FLOOR, }; -const std::vector> pads = { - {0, 0, 0, 0}, - {0, 0, 1, 1}, -}; - const std::vector antialias = { false, }; @@ -181,152 +324,178 @@ const std::vector cubeCoefs = { -0.75f, }; -const std::vector> defaultAxes = { - {0, 1, 2, 3} -}; - -const std::vector> defaultScales = { - {1.f, 1.f, 1.25f, 1.5f} -}; - -const auto interpolateCasesNN = ::testing::Combine( - ::testing::Values(ngraph::op::v4::Interpolate::InterpolateMode::nearest), - ::testing::ValuesIn(shapeCalculationMode), - ::testing::ValuesIn(coordinateTransformModes), - ::testing::ValuesIn(nearestModes), - ::testing::ValuesIn(antialias), - ::testing::ValuesIn(pads), - ::testing::ValuesIn(pads), - ::testing::ValuesIn(cubeCoefs), - ::testing::ValuesIn(defaultAxes), - ::testing::ValuesIn(defaultScales)); - -const auto interpolateCasesLinearOnnx = ::testing::Combine( - ::testing::Values(ngraph::op::v4::Interpolate::InterpolateMode::linear_onnx), - ::testing::ValuesIn(shapeCalculationMode), - ::testing::ValuesIn(coordinateTransformModes), - ::testing::ValuesIn(defNearestModes), - ::testing::ValuesIn(antialias), - ::testing::ValuesIn(pads), - ::testing::ValuesIn(pads), - ::testing::ValuesIn(cubeCoefs), - ::testing::ValuesIn(defaultAxes), - ::testing::ValuesIn(defaultScales)); - -const auto interpolateCasesLinear = ::testing::Combine( - ::testing::Values(ngraph::op::v4::Interpolate::InterpolateMode::linear), - ::testing::ValuesIn(shapeCalculationMode), - ::testing::ValuesIn(coordinateTransformModes), - ::testing::ValuesIn(defNearestModes), - ::testing::ValuesIn(antialias), - ::testing::ValuesIn(pads), - ::testing::ValuesIn(pads), - ::testing::ValuesIn(cubeCoefs), - ::testing::ValuesIn(defaultAxes), - ::testing::ValuesIn(defaultScales)); - -const auto interpolateCasesCubic = ::testing::Combine( - ::testing::Values(ngraph::op::v4::Interpolate::InterpolateMode::cubic), - ::testing::ValuesIn(shapeCalculationMode), - ::testing::ValuesIn(coordinateTransformModes), - ::testing::ValuesIn(defNearestModes), - ::testing::ValuesIn(antialias), - ::testing::ValuesIn(pads), - ::testing::ValuesIn(pads), - ::testing::ValuesIn(cubeCoefs), - ::testing::ValuesIn(defaultAxes), - ::testing::ValuesIn(defaultScales)); - const std::vector interpolateFusingParamsSet{ emptyFusingSpec, - fusingRelu, fusingSwish, - fusingFakeQuantizePerChannelRelu, + fusingFakeQuantizePerTensorRelu, }; -std::map additional_config = {}; - std::vector> filterAdditionalConfig() { - if (with_cpu_x86_avx512f()) { + if (InferenceEngine::with_cpu_x86_avx512f()) { return { - {{PluginConfigParams::KEY_ENFORCE_BF16, PluginConfigParams::NO}}, - {{PluginConfigParams::KEY_ENFORCE_BF16, PluginConfigParams::YES}} + {{InferenceEngine::PluginConfigParams::KEY_ENFORCE_BF16, InferenceEngine::PluginConfigParams::NO}}, + {{InferenceEngine::PluginConfigParams::KEY_ENFORCE_BF16, InferenceEngine::PluginConfigParams::YES}} }; } else { return { // default config as an stub for target without avx512, otherwise all tests with BF16 in its name are skipped - {{PluginConfigParams::KEY_PERF_COUNT, PluginConfigParams::NO}} + {{InferenceEngine::PluginConfigParams::KEY_PERF_COUNT, InferenceEngine::PluginConfigParams::NO}} }; } } +const std::vector> pads4D = { + {0, 0, 0, 0}, + {0, 0, 1, 1}, +}; + +const std::vector> defaultAxes4D = { + {0, 1, 2, 3} +}; + +const std::vector shapeParams4D = { + ShapeParams{ + ngraph::op::v4::Interpolate::ShapeCalcMode::SCALES, + InputShape{{}, {{1, 11, 4, 4}}}, + ngraph::helpers::InputLayerType::CONSTANT, + {{1.f, 1.f, 1.25f, 1.5f}}, + defaultAxes4D.front() + }, + ShapeParams{ + ngraph::op::v4::Interpolate::ShapeCalcMode::SIZES, + InputShape{{}, {{1, 11, 4, 4}}}, + ngraph::helpers::InputLayerType::CONSTANT, + {{1, 11, 5, 6}}, + defaultAxes4D.front() + }, + ShapeParams{ + ngraph::op::v4::Interpolate::ShapeCalcMode::SCALES, + InputShape{{-1, {2, 20}, -1, -1}, {{1, 11, 4, 4}, {2, 7, 6, 5}}}, + ngraph::helpers::InputLayerType::CONSTANT, + {{1.f, 1.f, 1.25f, 1.5f}}, + defaultAxes4D.front() + }, + ShapeParams{ + ngraph::op::v4::Interpolate::ShapeCalcMode::SIZES, + InputShape{{-1, {2, 20}, -1, -1}, {{1, 11, 4, 4}, {1, 11, 5, 5}}}, + ngraph::helpers::InputLayerType::CONSTANT, + {{1, 11, 5, 6}}, + defaultAxes4D.front() + }, + ShapeParams{ + ngraph::op::v4::Interpolate::ShapeCalcMode::SCALES, + InputShape{{-1, {2, 20}, -1, -1}, {{1, 11, 4, 4}, {2, 7, 6, 5}}}, + ngraph::helpers::InputLayerType::PARAMETER, + {{1.f, 1.f, 1.25f, 1.5f}, {1.f, 1.f, 1.25f, 1.25f}}, + defaultAxes4D.front() + }, + ShapeParams{ + ngraph::op::v4::Interpolate::ShapeCalcMode::SIZES, + InputShape{{-1, {2, 20}, -1, -1}, {{1, 11, 4, 4}, {2, 7, 6, 5}}}, + ngraph::helpers::InputLayerType::PARAMETER, + {{1, 11, 6, 7}, {2, 7, 8, 7}}, + defaultAxes4D.front() + } +}; + +const auto interpolateCasesNN = ::testing::Combine( + ::testing::Values(ngraph::op::v4::Interpolate::InterpolateMode::nearest), + ::testing::ValuesIn(coordinateTransformModes), + ::testing::ValuesIn(nearestModes), + ::testing::ValuesIn(antialias), + ::testing::ValuesIn(pads4D), + ::testing::ValuesIn(pads4D), + ::testing::ValuesIn(cubeCoefs)); + INSTANTIATE_TEST_SUITE_P(smoke_InterpolateNN_Layout_Test, InterpolateLayerCPUTest, ::testing::Combine( - ::testing::Combine( - interpolateCasesNN, - ::testing::ValuesIn(netPrecisions), - ::testing::Values(InferenceEngine::Precision::UNSPECIFIED), - ::testing::Values(InferenceEngine::Precision::UNSPECIFIED), - ::testing::Values(InferenceEngine::Layout::ANY), - ::testing::Values(InferenceEngine::Layout::ANY), - ::testing::Values(std::vector({1, 21, 4, 4})), - ::testing::Values(std::vector({1, 21, 5, 6})), - ::testing::Values(CommonTestUtils::DEVICE_CPU), - ::testing::Values(additional_config)), + interpolateCasesNN, + ::testing::ValuesIn(shapeParams4D), + ::testing::Values(ElementType::f32), ::testing::ValuesIn(filterCPUInfoForDevice()), ::testing::ValuesIn(interpolateFusingParamsSet), ::testing::ValuesIn(filterAdditionalConfig())), InterpolateLayerCPUTest::getTestCaseName); +const std::vector shapeParams4D_fixed_C = { + ShapeParams{ + ngraph::op::v4::Interpolate::ShapeCalcMode::SCALES, + InputShape{{}, {{1, 11, 4, 4}}}, + ngraph::helpers::InputLayerType::CONSTANT, + {{1.f, 1.f, 1.25f, 1.5f}}, + defaultAxes4D.front() + }, + ShapeParams{ + ngraph::op::v4::Interpolate::ShapeCalcMode::SIZES, + InputShape{{-1, 16, -1, -1}, {{1, 16, 4, 4}, {1, 16, 6, 5}}}, + ngraph::helpers::InputLayerType::CONSTANT, + {{1, 16, 6, 7}}, + defaultAxes4D.front() + } +}; + +INSTANTIATE_TEST_SUITE_P(smoke_InterpolateNN_Layout_PerChannelFuse_Test, InterpolateLayerCPUTest, + ::testing::Combine( + interpolateCasesNN, + ::testing::ValuesIn(shapeParams4D_fixed_C), + ::testing::Values(ElementType::f32), + ::testing::ValuesIn(filterCPUInfoForDevice()), + ::testing::Values(fusingFakeQuantizePerChannelRelu), + ::testing::ValuesIn(filterAdditionalConfig())), + InterpolateLayerCPUTest::getTestCaseName); + +const auto interpolateCasesLinearOnnx = ::testing::Combine( + ::testing::Values(ngraph::op::v4::Interpolate::InterpolateMode::linear_onnx), + ::testing::ValuesIn(coordinateTransformModes), + ::testing::ValuesIn(defNearestModes), + ::testing::ValuesIn(antialias), + ::testing::ValuesIn(pads4D), + ::testing::ValuesIn(pads4D), + ::testing::ValuesIn(cubeCoefs)); + INSTANTIATE_TEST_SUITE_P(smoke_InterpolateLinearOnnx_Layout_Test, InterpolateLayerCPUTest, ::testing::Combine( - ::testing::Combine( - interpolateCasesLinearOnnx, - ::testing::ValuesIn(netPrecisions), - ::testing::Values(InferenceEngine::Precision::UNSPECIFIED), - ::testing::Values(InferenceEngine::Precision::UNSPECIFIED), - ::testing::Values(InferenceEngine::Layout::ANY), - ::testing::Values(InferenceEngine::Layout::ANY), - ::testing::Values(std::vector({1, 21, 4, 4})), - ::testing::Values(std::vector({1, 21, 5, 6})), - ::testing::Values(CommonTestUtils::DEVICE_CPU), - ::testing::Values(additional_config)), + interpolateCasesLinearOnnx, + ::testing::ValuesIn(shapeParams4D), + ::testing::Values(ElementType::f32), ::testing::ValuesIn(filterCPUInfoForDevice()), ::testing::ValuesIn(interpolateFusingParamsSet), ::testing::ValuesIn(filterAdditionalConfig())), InterpolateLayerCPUTest::getTestCaseName); +const auto interpolateCasesLinear = ::testing::Combine( + ::testing::Values(ngraph::op::v4::Interpolate::InterpolateMode::linear), + ::testing::ValuesIn(coordinateTransformModes), + ::testing::ValuesIn(defNearestModes), + ::testing::ValuesIn(antialias), + ::testing::ValuesIn(pads4D), + ::testing::ValuesIn(pads4D), + ::testing::ValuesIn(cubeCoefs)); + INSTANTIATE_TEST_SUITE_P(smoke_InterpolateLinear_Layout_Test, InterpolateLayerCPUTest, ::testing::Combine( - ::testing::Combine( - interpolateCasesLinear, - ::testing::ValuesIn(netPrecisions), - ::testing::Values(InferenceEngine::Precision::UNSPECIFIED), - ::testing::Values(InferenceEngine::Precision::UNSPECIFIED), - ::testing::Values(InferenceEngine::Layout::ANY), - ::testing::Values(InferenceEngine::Layout::ANY), - ::testing::Values(std::vector({1, 21, 4, 4})), - ::testing::Values(std::vector({1, 21, 5, 6})), - ::testing::Values(CommonTestUtils::DEVICE_CPU), - ::testing::Values(additional_config)), + interpolateCasesLinear, + ::testing::ValuesIn(shapeParams4D), + ::testing::Values(ElementType::f32), ::testing::ValuesIn(filterCPUInfoForDevice()), ::testing::ValuesIn(interpolateFusingParamsSet), ::testing::ValuesIn(filterAdditionalConfig())), InterpolateLayerCPUTest::getTestCaseName); +const auto interpolateCasesCubic = ::testing::Combine( + ::testing::Values(ngraph::op::v4::Interpolate::InterpolateMode::cubic), + ::testing::ValuesIn(coordinateTransformModes), + ::testing::ValuesIn(defNearestModes), + ::testing::ValuesIn(antialias), + ::testing::ValuesIn(pads4D), + ::testing::ValuesIn(pads4D), + ::testing::ValuesIn(cubeCoefs)); + INSTANTIATE_TEST_SUITE_P(smoke_InterpolateCubic_Layout_Test, InterpolateLayerCPUTest, ::testing::Combine( - ::testing::Combine( - interpolateCasesCubic, - ::testing::ValuesIn(netPrecisions), - ::testing::Values(InferenceEngine::Precision::UNSPECIFIED), - ::testing::Values(InferenceEngine::Precision::UNSPECIFIED), - ::testing::Values(InferenceEngine::Layout::ANY), - ::testing::Values(InferenceEngine::Layout::ANY), - ::testing::Values(std::vector({1, 21, 4, 4})), - ::testing::Values(std::vector({1, 21, 5, 6})), - ::testing::Values(CommonTestUtils::DEVICE_CPU), - ::testing::Values(additional_config)), + interpolateCasesCubic, + ::testing::ValuesIn(shapeParams4D), + ::testing::Values(ElementType::f32), ::testing::ValuesIn(filterCPUInfoForDevice()), ::testing::ValuesIn(interpolateFusingParamsSet), ::testing::ValuesIn(filterAdditionalConfig())), @@ -335,14 +504,14 @@ INSTANTIATE_TEST_SUITE_P(smoke_InterpolateCubic_Layout_Test, InterpolateLayerCPU ////////////////////////5D///////////////////////////// std::vector filterCPUInfoForDevice5D() { std::vector resCPUParams; - if (with_cpu_x86_avx512f()) { + if (InferenceEngine::with_cpu_x86_avx512f()) { resCPUParams.push_back(CPUSpecificParams{{nCdhw16c, x, x, x}, {nCdhw16c}, {"jit_avx512"}, "jit_avx512"}); resCPUParams.push_back(CPUSpecificParams{{ndhwc, x, x, x}, {ndhwc}, {"jit_avx512"}, "jit_avx512"}); - } else if (with_cpu_x86_avx2()) { + } else if (InferenceEngine::with_cpu_x86_avx2()) { resCPUParams.push_back(CPUSpecificParams{{nCdhw8c, x, x, x}, {nCdhw8c}, {"jit_avx2"}, "jit_avx2"}); resCPUParams.push_back(CPUSpecificParams{{ndhwc, x, x, x}, {ndhwc}, {"jit_avx2"}, "jit_avx2"}); resCPUParams.push_back(CPUSpecificParams{{ncdhw, x, x, x}, {ncdhw}, {"jit_avx2"}, "jit_avx2"}); - } else if (with_cpu_x86_sse42()) { + } else if (InferenceEngine::with_cpu_x86_sse42()) { resCPUParams.push_back(CPUSpecificParams{{nCdhw8c, x, x, x}, {nCdhw8c}, {"jit_sse42"}, "jit_sse42"}); resCPUParams.push_back(CPUSpecificParams{{ndhwc, x, x, x}, {ndhwc}, {"jit_sse42"}, "jit_sse42"}); } else { @@ -359,70 +528,126 @@ const std::vector> defaultAxes5D = { {0, 1, 2, 3, 4} }; -const std::vector> defaultScales5D = { - {1.f, 1.f, 1.25f, 1.5f, 0.5f} +const std::vector shapeParams5D = { + ShapeParams{ + ngraph::op::v4::Interpolate::ShapeCalcMode::SCALES, + InputShape{{}, {{1, 11, 4, 4, 4}}}, + ngraph::helpers::InputLayerType::CONSTANT, + {{1.f, 1.f, 1.25f, 1.5f, 0.5f}}, + defaultAxes5D.front() + }, + ShapeParams{ + ngraph::op::v4::Interpolate::ShapeCalcMode::SIZES, + InputShape{{}, {{1, 11, 4, 4, 4}}}, + ngraph::helpers::InputLayerType::CONSTANT, + {{1, 11, 5, 6, 2}}, + defaultAxes5D.front() + }, + ShapeParams{ + ngraph::op::v4::Interpolate::ShapeCalcMode::SCALES, + InputShape{{-1, {2, 20}, -1, -1, -1}, {{1, 11, 4, 4, 4}, {2, 7, 6, 5, 8}}}, + ngraph::helpers::InputLayerType::CONSTANT, + {{1.f, 1.f, 1.25f, 1.5f, 0.5f}}, + defaultAxes5D.front() + }, + ShapeParams{ + ngraph::op::v4::Interpolate::ShapeCalcMode::SIZES, + InputShape{{-1, {2, 20}, -1, -1, -1}, {{1, 11, 4, 4, 4}, {1, 11, 5, 5, 8}}}, + ngraph::helpers::InputLayerType::CONSTANT, + {{1, 11, 5, 6, 4}}, + defaultAxes5D.front() + }, + ShapeParams{ + ngraph::op::v4::Interpolate::ShapeCalcMode::SCALES, + InputShape{{-1, {2, 20}, -1, -1, -1}, {{1, 11, 4, 4, 4}, {2, 7, 6, 5, 8}}}, + ngraph::helpers::InputLayerType::PARAMETER, + {{1.f, 1.f, 1.25f, 1.5f, 0.5f}, {1.f, 1.f, 1.25f, 1.25f, 1.25f}}, + defaultAxes5D.front() + }, + ShapeParams{ + ngraph::op::v4::Interpolate::ShapeCalcMode::SIZES, + InputShape{{-1, {2, 20}, -1, -1, -1}, {{1, 11, 4, 4, 4}, {2, 7, 6, 5, 8}}}, + ngraph::helpers::InputLayerType::PARAMETER, + {{1, 11, 6, 7, 2}, {2, 7, 8, 7, 4}}, + defaultAxes5D.front() + }, }; const auto interpolateCasesLinearOnnx5D = ::testing::Combine( ::testing::Values(ngraph::op::v4::Interpolate::InterpolateMode::linear_onnx), - ::testing::ValuesIn(shapeCalculationMode), ::testing::ValuesIn(coordinateTransformModes), ::testing::ValuesIn(nearestModes), ::testing::ValuesIn(antialias), ::testing::ValuesIn(pads5D), ::testing::ValuesIn(pads5D), - ::testing::ValuesIn(cubeCoefs), - ::testing::ValuesIn(defaultAxes5D), - ::testing::ValuesIn(defaultScales5D)); - -const auto interpolateCasesNN5D = ::testing::Combine( - ::testing::Values(ngraph::op::v4::Interpolate::InterpolateMode::nearest), - ::testing::ValuesIn(shapeCalculationMode), - ::testing::ValuesIn(coordinateTransformModes), - ::testing::ValuesIn(defNearestModes), - ::testing::ValuesIn(antialias), - ::testing::ValuesIn(pads5D), - ::testing::ValuesIn(pads5D), - ::testing::ValuesIn(cubeCoefs), - ::testing::ValuesIn(defaultAxes5D), - ::testing::ValuesIn(defaultScales5D)); + ::testing::ValuesIn(cubeCoefs)); INSTANTIATE_TEST_SUITE_P(smoke_InterpolateLinearOnnx5D_Layout_Test, InterpolateLayerCPUTest, ::testing::Combine( - ::testing::Combine( - interpolateCasesLinearOnnx5D, - ::testing::ValuesIn(netPrecisions), - ::testing::Values(InferenceEngine::Precision::UNSPECIFIED), - ::testing::Values(InferenceEngine::Precision::UNSPECIFIED), - ::testing::Values(InferenceEngine::Layout::ANY), - ::testing::Values(InferenceEngine::Layout::ANY), - ::testing::Values(std::vector({1, 21, 4, 4, 4})), - ::testing::Values(std::vector({1, 21, 5, 6, 2})), - ::testing::Values(CommonTestUtils::DEVICE_CPU), - ::testing::Values(additional_config)), + interpolateCasesLinearOnnx5D, + ::testing::ValuesIn(shapeParams5D), + ::testing::Values(ElementType::f32), ::testing::ValuesIn(filterCPUInfoForDevice5D()), ::testing::ValuesIn(interpolateFusingParamsSet), ::testing::ValuesIn(filterAdditionalConfig())), InterpolateLayerCPUTest::getTestCaseName); +const auto interpolateCasesNN5D = ::testing::Combine( + ::testing::Values(ngraph::op::v4::Interpolate::InterpolateMode::nearest), + ::testing::ValuesIn(coordinateTransformModes), + ::testing::ValuesIn(defNearestModes), + ::testing::ValuesIn(antialias), + ::testing::ValuesIn(pads5D), + ::testing::ValuesIn(pads5D), + ::testing::ValuesIn(cubeCoefs)); + INSTANTIATE_TEST_SUITE_P(smoke_InterpolateNN5D_Layout_Test, InterpolateLayerCPUTest, ::testing::Combine( - ::testing::Combine( - interpolateCasesNN5D, - ::testing::ValuesIn(netPrecisions), - ::testing::Values(InferenceEngine::Precision::UNSPECIFIED), - ::testing::Values(InferenceEngine::Precision::UNSPECIFIED), - ::testing::Values(InferenceEngine::Layout::ANY), - ::testing::Values(InferenceEngine::Layout::ANY), - ::testing::Values(std::vector({1, 21, 4, 4, 4})), - ::testing::Values(std::vector({1, 21, 5, 6, 2})), - ::testing::Values(CommonTestUtils::DEVICE_CPU), - ::testing::Values(additional_config)), + interpolateCasesNN5D, + ::testing::ValuesIn(shapeParams5D), + ::testing::Values(ElementType::f32), ::testing::ValuesIn(filterCPUInfoForDevice5D()), ::testing::ValuesIn(interpolateFusingParamsSet), ::testing::ValuesIn(filterAdditionalConfig())), InterpolateLayerCPUTest::getTestCaseName); +// corner cases +const std::vector shapeParams4D_corner = { + ShapeParams{ + ngraph::op::v4::Interpolate::ShapeCalcMode::SCALES, + InputShape{{1, 11, 4, 4}, {{1, 11, 4, 4}, {1, 11, 4, 4}}}, + ngraph::helpers::InputLayerType::PARAMETER, + {{1.f, 1.f, 1.25f, 1.5f}, {1.f, 1.f, 1.25f, 1.25f}}, + defaultAxes4D.front() + }, + ShapeParams{ + ngraph::op::v4::Interpolate::ShapeCalcMode::SIZES, + InputShape{{1, 11, 4, 4}, {{1, 11, 4, 4}, {1, 11, 4, 4}}}, + ngraph::helpers::InputLayerType::PARAMETER, + {{1, 11, 6, 7}, {1, 11, 8, 7}}, + defaultAxes4D.front() + } +}; + +const auto interpolateCornerCases = ::testing::Combine( + ::testing::Values(ngraph::op::v4::Interpolate::InterpolateMode::nearest), + ::testing::Values(ngraph::op::v4::Interpolate::CoordinateTransformMode::ASYMMETRIC), + ::testing::Values(ngraph::op::v4::Interpolate::NearestMode::SIMPLE), + ::testing::ValuesIn(antialias), + ::testing::Values(std::vector{0, 0, 0, 0}), + ::testing::Values(std::vector{0, 0, 0, 0}), + ::testing::ValuesIn(cubeCoefs)); + +INSTANTIATE_TEST_SUITE_P(smoke_Interpolate_corner_Layout_Test, InterpolateLayerCPUTest, + ::testing::Combine( + interpolateCornerCases, + ::testing::ValuesIn(shapeParams4D_corner), + ::testing::Values(ElementType::f32), + ::testing::ValuesIn(filterCPUInfoForDevice()), + ::testing::ValuesIn(interpolateFusingParamsSet), + ::testing::ValuesIn(filterAdditionalConfig())), + InterpolateLayerCPUTest::getTestCaseName); + } // namespace } // namespace CPULayerTestsDefinitions diff --git a/inference-engine/tests/functional/plugin/cpu/single_layer_tests/lrn.cpp b/inference-engine/tests/functional/plugin/cpu/single_layer_tests/lrn.cpp new file mode 100644 index 00000000000..061d451c6e6 --- /dev/null +++ b/inference-engine/tests/functional/plugin/cpu/single_layer_tests/lrn.cpp @@ -0,0 +1,116 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "functional_test_utils/ov_tensor_utils.hpp" +#include "test_utils/cpu_test_utils.hpp" + +#include "shared_test_classes/base/ov_subgraph.hpp" +#include "ngraph_functions/builders.hpp" + +using namespace ngraph; +using namespace CPUTestUtils; +using namespace ov::test; + +namespace CPULayerTestsDefinitions { +using LRNParams = std::tuple< + ElementType, // data precision + InputShape, // data shape + double, // alpha + double, // beta + double, // bias + size_t, // size + std::vector>; // axes to reduction + +class LRNLayerCPUTest : public testing::WithParamInterface, public ov::test::SubgraphBaseTest, public CPUTestsBase { +public: + static std::string getTestCaseName(testing::TestParamInfo obj) { + ElementType inputPrecision; + InputShape inputShapes; + double alpha, beta, bias; + size_t size; + std::vector axes; + std::tie(inputPrecision, inputShapes, alpha, beta, bias, size, axes) = obj.param; + + std::ostringstream result; + result << inputPrecision << "_" << "IS=" << CommonTestUtils::partialShape2str({ inputShapes.first }) << "_" << "TS=("; + for (const auto& shape : inputShapes.second) { + result << CommonTestUtils::vec2str(shape) << "_"; + } + + result << ")_alpha=" << alpha << "_beta=" << beta << "_bias=" << bias << "_size=" << size << "_axes=" << CommonTestUtils::vec2str(axes); + return result.str(); + } + +protected: + void SetUp() override { + targetDevice = CommonTestUtils::DEVICE_CPU; + ElementType inputPrecision; + InputShape inputShapes; + double alpha, beta, bias; + size_t size; + std::vector axes; + std::tie(inputPrecision, inputShapes, alpha, beta, bias, size, axes) = this->GetParam(); + + init_input_shapes({ inputShapes }); + selectedType = makeSelectedTypeStr("ref_any", inputPrecision); + + auto params = ngraph::builder::makeDynamicParams(inputPrecision, { inputDynamicShapes }); + auto axesNode = ngraph::opset1::Constant::create(ngraph::element::i32, { axes.size() }, axes); + auto lrn = std::make_shared(params[0], axesNode, alpha, beta, bias, size); + function = makeNgraphFunction(inputPrecision, params, lrn, "LRN"); + } +}; + +TEST_P(LRNLayerCPUTest, CompareWithRefs) { + SKIP_IF_CURRENT_TEST_IS_DISABLED() + + run(); + CheckPluginRelatedResults(executableNetwork, "LRN"); +} + +const std::vector inputPrecisions = { + ngraph::element::f32, +}; + +const std::vector> axes = { + { 1 }, + { 2, 3 }, + { 3, 2 }, + { 1, 2, 3 } +}; + +const std::vector alpha = { 9.9e-05 }; +const std::vector beta = { 2. }; +const std::vector bias = { 1. }; +const std::vector size = { 5ul }; + +const std::vector inputShapes = { + InputShape{{}, {{10, 10, 3, 8}}}, + InputShape{ + // dynamic + {-1, -1, -1, -1}, + // static + {{15, 5, 7, 8}, {10, 10, 3, 8}, {1, 3, 5, 5}} + }, + InputShape{ + // dynamic + {{1, 15}, {3, 10}, {3, 7}, {5, 8}}, + // static + {{15, 5, 7, 8}, {10, 10, 3, 8}, {1, 3, 5, 5}} + }, +}; + +const auto testCases = ::testing::Combine( + ::testing::ValuesIn(inputPrecisions), + ::testing::ValuesIn(inputShapes), + ::testing::ValuesIn(alpha), + ::testing::ValuesIn(beta), + ::testing::ValuesIn(bias), + ::testing::ValuesIn(size), + ::testing::ValuesIn(axes) +); + +INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs, LRNLayerCPUTest, testCases, LRNLayerCPUTest::getTestCaseName); + +} // namespace CPULayerTestsDefinitions diff --git a/inference-engine/tests/functional/plugin/cpu/single_layer_tests/mat_mul.cpp b/inference-engine/tests/functional/plugin/cpu/single_layer_tests/mat_mul.cpp index 417da7b48b2..367886f31e2 100644 --- a/inference-engine/tests/functional/plugin/cpu/single_layer_tests/mat_mul.cpp +++ b/inference-engine/tests/functional/plugin/cpu/single_layer_tests/mat_mul.cpp @@ -35,7 +35,8 @@ typedef std::tuple< using MatMulLayerCPUTestParamSet = std::tuple; + fusingSpecificParams, + CPUSpecificParams>; class MatMulLayerCPUTest : public testing::WithParamInterface, virtual public SubgraphBaseTest, public CpuTestWithFusing { @@ -44,8 +45,9 @@ public: MatMulLayerTestParamsSet basicParamsSet; MatMulNodeType nodeType; fusingSpecificParams fusingParams; + CPUSpecificParams cpuParams; - std::tie(basicParamsSet, nodeType, fusingParams) = obj.param; + std::tie(basicParamsSet, nodeType, fusingParams, cpuParams) = obj.param; ElementType netType; ElementType inType, outType; @@ -86,6 +88,7 @@ public: } result << ")"; result << CpuTestWithFusing::getTestCaseName(fusingParams); + result << CPUTestsBase::getTestCaseName(cpuParams); return result.str(); } @@ -103,8 +106,10 @@ protected: MatMulLayerTestParamsSet basicParamsSet; MatMulNodeType nodeType; fusingSpecificParams fusingParams; + CPUSpecificParams cpuParams; - std::tie(basicParamsSet, nodeType, fusingParams) = this->GetParam(); + std::tie(basicParamsSet, nodeType, fusingParams, cpuParams) = this->GetParam(); + std::tie(inFmts, outFmts, priority, selectedType) = cpuParams; ShapeRelatedParams shapeRelatedParams; ElementType netType; @@ -149,7 +154,7 @@ protected: inType = outType = netType; cpuNodeType = nodeType == MatMulNodeType::MatMul ? "MatMul" : "FullyConnected"; - selectedType = makeSelectedTypeStr("jit_gemm", outType); + selectedType = makeSelectedTypeStr(selectedType, outType); auto params = builder::makeDynamicParams(netType, {inShapeA}); @@ -184,6 +189,13 @@ const std::vector netPRCs { ElementType::bf16 }; +std::vector filterSpecificParams() { + std::vector specificParams; + specificParams.push_back(CPUSpecificParams{{}, {}, {"jit_gemm"}, "jit_gemm"}); + + return specificParams; +} + /* ============= FullyConnected ============= */ namespace fullyConnected { @@ -233,7 +245,8 @@ const auto fullyConnectedParams2D = ::testing::Combine(::testing::ValuesIn(IS2D) const auto testParams2D = ::testing::Combine(fullyConnectedParams2D, ::testing::Values(MatMulNodeType::FullyConnected), - ::testing::ValuesIn(fusingParamsSet2D)); + ::testing::ValuesIn(fusingParamsSet2D), + ::testing::ValuesIn(filterSpecificParams())); INSTANTIATE_TEST_SUITE_P(smoke_FC_2D, MatMulLayerCPUTest, testParams2D, MatMulLayerCPUTest::getTestCaseName); @@ -266,10 +279,58 @@ const auto fullyConnectedParams3D = ::testing::Combine(::testing::ValuesIn(IS3D) const auto testParams3D = ::testing::Combine(fullyConnectedParams3D, ::testing::Values(MatMulNodeType::FullyConnected), - ::testing::ValuesIn(fusingParamsSet3D)); + ::testing::ValuesIn(fusingParamsSet3D), + ::testing::ValuesIn(filterSpecificParams())); INSTANTIATE_TEST_SUITE_P(smoke_FC_3D, MatMulLayerCPUTest, testParams3D, MatMulLayerCPUTest::getTestCaseName); +std::vector> filterAdditionalConfig_Brgemm() { + std::vector> additionalConfig = { + std::map{/* empty config */} + }; + if (with_cpu_x86_bfloat16()) { + additionalConfig.push_back({{PluginConfigParams::KEY_ENFORCE_BF16, PluginConfigParams::YES}}); + } + + return additionalConfig; +} + +const std::vector IS2D_Brgemm = { + {static_shapes_to_test_representation({{59, 16}, {16, 120}}), {false, false}}, + {static_shapes_to_test_representation({{59, 16}, {16, 120}}), {true, false}}, + {static_shapes_to_test_representation({{59, 16}, {16, 120}}), {false, true}}, + {static_shapes_to_test_representation({{59, 16}, {16, 120}}), {true, true}}, + + {static_shapes_to_test_representation({{71, 128}, {128, 20}}), {false, false}}, + {static_shapes_to_test_representation({{71, 128}, {128, 20}}), {true, false}}, + {static_shapes_to_test_representation({{71, 128}, {128, 20}}), {false, true}}, + {static_shapes_to_test_representation({{71, 128}, {128, 20}}), {true, true}}, +}; + +std::vector filterSpecificParams_Brgemm() { + std::vector specificParams; + if (with_cpu_x86_avx512_core()) { + specificParams.push_back(CPUSpecificParams{{}, {}, {"brgemm_avx512"}, "brgemm_avx512"}); + } + + return specificParams; +} + +const auto fullyConnectedParams2D_Brgemm = ::testing::Combine(::testing::ValuesIn(IS2D_Brgemm), + ::testing::Values(ElementType::f32), + ::testing::Values(ElementType::undefined), + ::testing::Values(ElementType::undefined), + ::testing::Values(helpers::InputLayerType::CONSTANT), + ::testing::Values(CommonTestUtils::DEVICE_CPU), + ::testing::ValuesIn(filterAdditionalConfig_Brgemm())); + +const auto testParams2D_Brgemm = ::testing::Combine(fullyConnectedParams2D_Brgemm, + ::testing::Values(MatMulNodeType::FullyConnected), + ::testing::ValuesIn(fusingParamsSet2D), + ::testing::ValuesIn(filterSpecificParams_Brgemm())); + +INSTANTIATE_TEST_SUITE_P(smoke_FC_2D_Brgemm, MatMulLayerCPUTest, testParams2D_Brgemm, MatMulLayerCPUTest::getTestCaseName); + } // namespace fullyConnected @@ -459,7 +520,8 @@ const auto matMulParams = ::testing::Combine(::testing::ValuesIn(IS), const auto testParams = ::testing::Combine(matMulParams, ::testing::Values(MatMulNodeType::MatMul), - ::testing::ValuesIn(matmulFusingParams)); + ::testing::ValuesIn(matmulFusingParams), + ::testing::ValuesIn(filterSpecificParams())); INSTANTIATE_TEST_SUITE_P(smoke_MM, MatMulLayerCPUTest, testParams, MatMulLayerCPUTest::getTestCaseName); diff --git a/inference-engine/tests/functional/plugin/cpu/single_layer_tests/reduce_ops.cpp b/inference-engine/tests/functional/plugin/cpu/single_layer_tests/reduce_ops.cpp index 222651e51ff..dbc3e8435c7 100644 --- a/inference-engine/tests/functional/plugin/cpu/single_layer_tests/reduce_ops.cpp +++ b/inference-engine/tests/functional/plugin/cpu/single_layer_tests/reduce_ops.cpp @@ -2,64 +2,114 @@ // SPDX-License-Identifier: Apache-2.0 // -#include +#include "shared_test_classes/base/ov_subgraph.hpp" #include "ngraph_functions/builders.hpp" #include "test_utils/cpu_test_utils.hpp" +#include "functional_test_utils/ov_tensor_utils.hpp" +#include "test_utils/fusing_test_utils.hpp" -using namespace InferenceEngine; using namespace CPUTestUtils; -using namespace LayerTestsDefinitions; +using namespace ov::test; namespace CPULayerTestsDefinitions { -typedef std::tuple ReduceLayerCPUTestParamSet; +typedef std::tuple< + std::vector, // Axis to reduce order + CommonTestUtils::OpType, // Scalar or vector type axis + bool, // Keep dims + ngraph::helpers::ReductionType, // Reduce operation type + ElementType, // Net precision + ElementType, // Input precision + ElementType, // Output precision + std::vector // Input shapes +> basicReduceParams; + +typedef std::tuple< + basicReduceParams, + CPUSpecificParams, + fusingSpecificParams> ReduceLayerCPUTestParamSet; class ReduceCPULayerTest : public testing::WithParamInterface, - virtual public LayerTestsUtils::LayerTestsCommon, public CPUTestsBase { + virtual public SubgraphBaseTest, public CpuTestWithFusing { public: static std::string getTestCaseName(testing::TestParamInfo obj) { - reduceMeanParams basicParamsSet; + basicReduceParams basicParams; CPUSpecificParams cpuParams; - std::tie(basicParamsSet, cpuParams) = obj.param; + fusingSpecificParams fusingParams; + std::tie(basicParams, cpuParams, fusingParams) = obj.param; + + std::vector axes; + CommonTestUtils::OpType opType; + bool keepDims; + ngraph::helpers::ReductionType reductionType; + ElementType netPrecision, inPrc, outPrc; + std::vector inputShapes; + + std::tie(axes, opType, keepDims, reductionType, netPrecision, inPrc, outPrc, inputShapes) = basicParams; std::ostringstream result; - result << LayerTestsDefinitions::ReduceOpsLayerTest::getTestCaseName(testing::TestParamInfo( - basicParamsSet, 0)); + result << "IS=("; + for (const auto& shape : inputShapes) { + result << CommonTestUtils::partialShape2str({shape.first}) << "_"; + } + result << ")_TS=("; + for (const auto& shape : inputShapes) { + for (const auto& item : shape.second) { + result << CommonTestUtils::vec2str(item) << "_"; + } + } + result << ")_axes=" << CommonTestUtils::vec2str(axes) << "_"; + result << "opType=" << opType << "_"; + result << "type=" << reductionType << "_"; + if (keepDims) + result << "KeepDims=true_"; + else + result << "KeepDims=false_"; + result << "netPRC=" << netPrecision << "_"; + result << "inPRC=" << inPrc << "_"; + result << "outPRC=" << outPrc << "_"; + result << CPUTestsBase::getTestCaseName(cpuParams); + result << CpuTestWithFusing::getTestCaseName(fusingParams); return result.str(); } protected: void SetUp() override { - reduceMeanParams basicParamsSet; + targetDevice = CommonTestUtils::DEVICE_CPU; + + basicReduceParams basicParams; CPUSpecificParams cpuParams; - std::tie(basicParamsSet, cpuParams) = this->GetParam(); + fusingSpecificParams fusingParams; + std::tie(basicParams, cpuParams, fusingParams) = this->GetParam(); std::tie(inFmts, outFmts, priority, selectedType) = cpuParams; + std::tie(postOpMgrPtr, fusedOps) = fusingParams; - InferenceEngine::Precision netPrecision; - bool keepDims; - std::vector inputShape; std::vector axes; CommonTestUtils::OpType opType; - std::tie(axes, opType, keepDims, reductionType, netPrecision, inPrc, outPrc, inLayout, inputShape, targetDevice) = basicParamsSet; + bool keepDims; + ElementType inPrc, outPrc; + std::vector inputShapes; + + std::tie(axes, opType, keepDims, reductionType, netPrecision, inPrc, outPrc, inputShapes) = basicParams; inPrc = outPrc = netPrecision; - auto ngPrc = FuncTestUtils::PrecisionUtils::convertIE2nGraphPrc(netPrecision); - auto params = ngraph::builder::makeParams(ngPrc, {inputShape}); + + init_input_shapes(inputShapes); + + auto params = ngraph::builder::makeDynamicParams(netPrecision, inputDynamicShapes); auto paramOuts = ngraph::helpers::convert2OutputVector( ngraph::helpers::castOps2Nodes(params)); std::vector shapeAxes; switch (opType) { - case CommonTestUtils::OpType::SCALAR: { + case CommonTestUtils::OpType::SCALAR: if (axes.size() > 1) FAIL() << "In reduce op if op type is scalar, 'axis' input's must contain 1 element"; break; - } - case CommonTestUtils::OpType::VECTOR: { + case CommonTestUtils::OpType::VECTOR: shapeAxes.push_back(axes.size()); break; - } default: FAIL() << "Reduce op doesn't support operation type: " << opType; } @@ -68,46 +118,75 @@ protected: const auto reduce = ngraph::builder::makeReduce(paramOuts[0], reductionAxesNode, keepDims, reductionType); - selectedType = getPrimitiveType() + "_" + (inPrc == Precision::BOOL ? "I8" : inPrc.name()); + selectedType = getPrimitiveType() + "_" + + (inPrc == ElementType::boolean ? "I8" : InferenceEngine::details::convertPrecision(inPrc).name()); - reduce->get_rt_info() = getCPUInfo(); - - const ngraph::ResultVector results{std::make_shared(reduce)}; - function = std::make_shared(results, params, "Reduce"); - } - InferenceEngine::Blob::Ptr GenerateInput(const InferenceEngine::InputInfo &info) const override { - if (ngraph::helpers::ReductionType::Prod == reductionType) { - // We change the range of random values to avoid possible floating point overflow - auto blob = FuncTestUtils::createAndFillBlob(info.getTensorDesc(), 10, 5); - if (Precision::FP32 == info.getTensorDesc().getPrecision()) { - auto *rawBlobDataPtr = blob->buffer().as(); - for (size_t i = 0; i < blob->size(); ++i) { - rawBlobDataPtr[i] /= 10.f; - } - } else if (Precision::BF16 == info.getTensorDesc().getPrecision()) { - auto *rawBlobDataPtr = blob->buffer().as(); - for (size_t i = 0; i < blob->size(); ++i) { - rawBlobDataPtr[i] /= 10.f; - } + // hybrid layouts + if (inFmts.size() != 0 && outFmts.size() == 0) { + size_t outShapeSize = inputDynamicShapes[0].size() - axes.size(); + switch (outShapeSize) { + case 0: + case 1: + outFmts.push_back(x); + break; + case 2: + outFmts.push_back(nc); + break; + case 3: + outFmts.push_back(tnc); + break; + case 4: + outFmts.push_back(nchw); + break; + default: + FAIL() << "Invaid outShapeSize: " << outShapeSize; } - return blob; - } else { - return LayerTestsCommon::GenerateInput(info); + } + + function = makeNgraphFunction(netPrecision, params, reduce, "Reduce"); + } + + void generate_inputs(const std::vector& targetInputStaticShapes) override { + inputs.clear(); + const auto& funcInputs = function->inputs(); + for (int i = 0; i < funcInputs.size(); ++i) { + const auto& funcInput = funcInputs[i]; + ov::runtime::Tensor tensor; + if (reductionType == ngraph::helpers::ReductionType::Prod) { + tensor = ov::test::utils::create_and_fill_tensor(funcInput.get_element_type(), targetInputStaticShapes[i], 10, 5); + if (netPrecision == ElementType::f32) { + auto *rawBlobDataPtr = static_cast(tensor.data()); + for (size_t i = 0; i < tensor.get_size(); ++i) { + rawBlobDataPtr[i] /= 10.f; + } + } else if (netPrecision == ElementType::bf16) { + auto *rawBlobDataPtr = static_cast(tensor.data()); + for (size_t i = 0; i < tensor.get_size(); ++i) { + rawBlobDataPtr[i] /= 10.f; + } + } + } else { + tensor = ov::test::utils::create_and_fill_tensor(funcInput.get_element_type(), targetInputStaticShapes[i]); + } + + inputs.insert({funcInput.get_node_shared_ptr(), tensor}); } } private: ngraph::helpers::ReductionType reductionType; + ElementType netPrecision; }; TEST_P(ReduceCPULayerTest, CompareWithRefs) { SKIP_IF_CURRENT_TEST_IS_DISABLED() - Run(); + run(); + CheckPluginRelatedResults(executableNetwork, "Reduce"); } namespace { -std::vector inpOutPrc = {Precision::BF16, Precision::FP32}; +const std::vector inpOutPrc = {ElementType::bf16, ElementType::f32}; const std::vector keepDims = { true, @@ -135,15 +214,44 @@ const std::vector> axesND = { {0, 1, 2, 3} }; +const std::vector> axes5D = { + {2, 4}, + {0, 2, 4}, + {0, 1, 2, 3, 4}, +}; + +const std::vector> axes6D = { + {5}, + {4, 5}, + {3, 4, 5}, + {2, 3, 4, 5}, + {1, 2, 3, 4, 5}, + {0, 1, 2, 3, 4, 5} +}; + +const std::vector> axesNDFusing = { + {0, 1}, + {0, 2}, + {0, 3}, + {1, 2}, + {1, 3}, + {2, 3}, +}; + +const std::vector> axes5DFusing = { + {2, 4}, + {0, 2, 4}, +}; + std::vector opTypes = { CommonTestUtils::OpType::SCALAR, CommonTestUtils::OpType::VECTOR, }; const std::vector reductionTypes = { -// ngraph::helpers::ReductionType::Mean, //optimized out during the graph transformations -// ngraph::helpers::ReductionType::Max, //optimized out during the graph transformations -// ngraph::helpers::ReductionType::Sum, //optimized out during the graph transformations + ngraph::helpers::ReductionType::Mean, + ngraph::helpers::ReductionType::Max, + ngraph::helpers::ReductionType::Sum, ngraph::helpers::ReductionType::Min, ngraph::helpers::ReductionType::Prod, ngraph::helpers::ReductionType::L1, @@ -155,186 +263,432 @@ const std::vector reductionLogicalTypes = { ngraph::helpers::ReductionType::LogicalAnd }; -const std::vector> inputShapes = { - std::vector{10, 5, 15, 12}, - std::vector{3, 5, 7, 9}, +std::vector> inputShapes = { + {{{}, {{2, 19, 2, 9}}}}, + {{{{1, 5}, 19, {1, 5}, {1, 10}}, {{2, 19, 2, 2}, {2, 19, 2, 9}}}}, +}; + +std::vector> inputShapes_5D = { + {{{}, {{2, 19, 2, 2, 9}}}}, + {{{{1, 5}, 19, {1, 5}, {1, 5}, {1, 5}}, {{2, 19, 2, 2, 2}, {2, 19, 3, 2, 2}}}}, +}; + +// TODO: should remove inputShapesFusingKeepNoDims and inputShapesFusingKeepNoDims_5D, +// and use inputShapes and inputShapes_5D directly, +// after Shape mismatching in fusing per channel[Issue: 62846] being fixed +std::vector> inputShapesFusingKeepNoDims = { + {{{}, {{2, 19, 2, 9}}}}, + {{{{1, 5}, 19, 2, 9}, {{2, 19, 2, 9}, {3, 19, 2, 9}}}}, +}; + +std::vector> inputShapesFusingKeepNoDims_5D = { + {{{}, {{2, 19, 2, 2, 9}}}}, + {{{{1, 5}, 19, 2, 2, 2}, {{2, 19, 2, 2, 2}, {3, 19, 2, 2, 2}}}}, +}; + +std::vector> inputShapes_6D = { + {{{}, {{2, 19, 2, 2, 2, 2}}}}, + {{{{1, 5}, 19, {1, 5}, {1, 5}, {1, 5}, {1, 5}}, {{2, 19, 2, 2, 2, 2}, {2, 19, 2, 2, 3, 2}}}}, }; std::vector cpuParams_4D = { CPUSpecificParams({nChw16c}, {nChw16c}, {}, {}), - CPUSpecificParams({nchw}, {nchw}, {}, {}) + CPUSpecificParams({nchw}, {nchw}, {}, {}), + CPUSpecificParams({nhwc}, {nhwc}, {}, {}) }; std::vector cpuParams_5D = { CPUSpecificParams({nCdhw16c}, {nCdhw16c}, {}, {}), - CPUSpecificParams({ncdhw}, {ncdhw}, {}, {}) + CPUSpecificParams({ncdhw}, {ncdhw}, {}, {}), + CPUSpecificParams({ndhwc}, {ndhwc}, {}, {}) }; -const auto paramsOneAxis = ::testing::Combine( +std::vector cpuParams_HybridLayout_4D = { + CPUSpecificParams({nChw16c}, {}, {}, {}), + CPUSpecificParams({nhwc}, {}, {}, {}) +}; + +std::vector cpuParams_HybridLayout_5D = { + CPUSpecificParams({nCdhw16c}, {}, {}, {}), + CPUSpecificParams({ndhwc}, {}, {}, {}) +}; + +const std::vector fusingParamsSet { + /* activations */ + fusingRelu, + fusingElu, + fusingTanh, + fusingSwish, + + /* FQ */ + fusingFakeQuantizePerChannel, + fusingFakeQuantizePerChannelRelu, + fusingFakeQuantizePerTensorRelu, + /* another patterns */ + fusingScaleShift +}; + +/* ================================ 1.1 No fusion - Arithmetic ================================ */ +const auto params_OneAxis = testing::Combine( testing::Combine( testing::ValuesIn(axes), testing::ValuesIn(opTypes), testing::ValuesIn(keepDims), testing::ValuesIn(reductionTypes), testing::ValuesIn(inpOutPrc), - testing::Values(InferenceEngine::Precision::UNSPECIFIED), - testing::Values(InferenceEngine::Precision::UNSPECIFIED), - testing::Values(InferenceEngine::Layout::ANY), - testing::ValuesIn(inputShapes), - testing::Values(CommonTestUtils::DEVICE_CPU)), - testing::Values(emptyCPUSpec)); - -const auto paramsOneAxisLogical = testing::Combine( - testing::Combine( - testing::ValuesIn(axes), - testing::ValuesIn(opTypes), - testing::ValuesIn(keepDims), - testing::ValuesIn(reductionLogicalTypes), - testing::Values(InferenceEngine::Precision::BOOL), - testing::Values(InferenceEngine::Precision::UNSPECIFIED), - testing::Values(InferenceEngine::Precision::UNSPECIFIED), - testing::Values(InferenceEngine::Layout::ANY), - testing::ValuesIn(inputShapes), - testing::Values(CommonTestUtils::DEVICE_CPU)), - testing::Values(emptyCPUSpec)); - -const auto params_MultiAxis = testing::Combine( - testing::Combine( - testing::ValuesIn(axesND), - testing::Values(opTypes[1]), - testing::Values(false), - testing::ValuesIn(reductionTypes), - testing::ValuesIn(inpOutPrc), - testing::Values(InferenceEngine::Precision::UNSPECIFIED), - testing::Values(InferenceEngine::Precision::UNSPECIFIED), - testing::Values(InferenceEngine::Layout::ANY), - testing::Values(std::vector{2, 9, 2, 9}), - testing::Values(CommonTestUtils::DEVICE_CPU)), - testing::Values(emptyCPUSpec)); + testing::Values(ElementType::undefined), + testing::Values(ElementType::undefined), + testing::ValuesIn(inputShapes)), + testing::Values(emptyCPUSpec), + testing::Values(emptyFusingSpec)); const auto params_MultiAxis_4D = testing::Combine( testing::Combine( testing::ValuesIn(axesND), - testing::Values(opTypes[1]), + testing::Values(CommonTestUtils::OpType::VECTOR), testing::Values(true), testing::ValuesIn(reductionTypes), testing::ValuesIn(inpOutPrc), - testing::Values(InferenceEngine::Precision::UNSPECIFIED), - testing::Values(InferenceEngine::Precision::UNSPECIFIED), - testing::Values(InferenceEngine::Layout::ANY), - testing::Values(std::vector{2, 19, 2, 9}), - testing::Values(CommonTestUtils::DEVICE_CPU)), - testing::ValuesIn(filterCPUSpecificParams(cpuParams_4D))); + testing::Values(ElementType::undefined), + testing::Values(ElementType::undefined), + testing::ValuesIn(inputShapes)), + testing::ValuesIn(filterCPUSpecificParams(cpuParams_4D)), + testing::Values(emptyFusingSpec)); const auto params_MultiAxis_5D = testing::Combine( testing::Combine( - testing::ValuesIn(axesND), - testing::Values(opTypes[1]), + testing::ValuesIn(axes5D), + testing::Values(CommonTestUtils::OpType::VECTOR), testing::Values(true), testing::ValuesIn(reductionTypes), testing::ValuesIn(inpOutPrc), - testing::Values(InferenceEngine::Precision::UNSPECIFIED), - testing::Values(InferenceEngine::Precision::UNSPECIFIED), - testing::Values(InferenceEngine::Layout::ANY), - testing::Values(std::vector{2, 19, 7, 2, 9}), - testing::Values(CommonTestUtils::DEVICE_CPU)), - testing::ValuesIn(filterCPUSpecificParams(cpuParams_5D))); + testing::Values(ElementType::undefined), + testing::Values(ElementType::undefined), + testing::ValuesIn(inputShapes_5D)), + testing::ValuesIn(filterCPUSpecificParams(cpuParams_5D)), + testing::Values(emptyFusingSpec)); -const auto params_MultiAxisLogical = testing::Combine( +const auto params_MultiAxis_4D_Hybrid = testing::Combine( testing::Combine( testing::ValuesIn(axesND), - testing::Values(opTypes[1]), + testing::Values(CommonTestUtils::OpType::VECTOR), testing::Values(false), - testing::ValuesIn(reductionLogicalTypes), - testing::Values(InferenceEngine::Precision::BOOL), - testing::Values(InferenceEngine::Precision::UNSPECIFIED), - testing::Values(InferenceEngine::Precision::UNSPECIFIED), - testing::Values(InferenceEngine::Layout::ANY), - testing::Values(std::vector{2, 9, 2, 9}), - testing::Values(CommonTestUtils::DEVICE_CPU)), - testing::Values(emptyCPUSpec)); + testing::ValuesIn(reductionTypes), + testing::ValuesIn(inpOutPrc), + testing::Values(ElementType::undefined), + testing::Values(ElementType::undefined), + testing::ValuesIn(inputShapes)), + testing::ValuesIn(filterCPUSpecificParams(cpuParams_HybridLayout_4D)), + testing::Values(emptyFusingSpec)); -const auto params_MultiAxisLogical4D = testing::Combine( +const auto params_MultiAxis_5D_Hybrid = testing::Combine( testing::Combine( - testing::ValuesIn(axesND), - testing::Values(opTypes[1]), - testing::Values(true), - testing::ValuesIn(reductionLogicalTypes), - testing::Values(InferenceEngine::Precision::BOOL), - testing::Values(InferenceEngine::Precision::UNSPECIFIED), - testing::Values(InferenceEngine::Precision::UNSPECIFIED), - testing::Values(InferenceEngine::Layout::ANY), - testing::Values(std::vector{2, 19, 2, 9}), - testing::Values(CommonTestUtils::DEVICE_CPU)), - testing::ValuesIn(filterCPUSpecificParams(cpuParams_4D))); + testing::ValuesIn(axes5D), + testing::Values(CommonTestUtils::OpType::VECTOR), + testing::Values(false), + testing::ValuesIn(reductionTypes), + testing::ValuesIn(inpOutPrc), + testing::Values(ElementType::undefined), + testing::Values(ElementType::undefined), + testing::ValuesIn(inputShapes_5D)), + testing::ValuesIn(filterCPUSpecificParams(cpuParams_HybridLayout_5D)), + testing::Values(emptyFusingSpec)); -const auto params_MultiAxisLogical5D = testing::Combine( +const auto params_MultiAxis_6D = testing::Combine( testing::Combine( - testing::ValuesIn(axesND), - testing::Values(opTypes[1]), - testing::Values(true), - testing::ValuesIn(reductionLogicalTypes), - testing::Values(InferenceEngine::Precision::BOOL), - testing::Values(InferenceEngine::Precision::UNSPECIFIED), - testing::Values(InferenceEngine::Precision::UNSPECIFIED), - testing::Values(InferenceEngine::Layout::ANY), - testing::Values(std::vector{2, 19, 7, 2, 9}), - testing::Values(CommonTestUtils::DEVICE_CPU)), - testing::ValuesIn(filterCPUSpecificParams(cpuParams_5D))); + testing::ValuesIn(axes6D), + testing::Values(CommonTestUtils::OpType::VECTOR), + testing::ValuesIn(keepDims), + testing::ValuesIn(reductionTypes), + testing::ValuesIn(inpOutPrc), + testing::Values(ElementType::undefined), + testing::Values(ElementType::undefined), + testing::ValuesIn(inputShapes_6D)), + testing::Values(emptyCPUSpec), + testing::Values(emptyFusingSpec)); INSTANTIATE_TEST_SUITE_P( - smoke_ReduceOneAxis_CPU, + smoke_Reduce_OneAxis_CPU, ReduceCPULayerTest, - paramsOneAxis, + params_OneAxis, ReduceCPULayerTest::getTestCaseName ); INSTANTIATE_TEST_SUITE_P( - smoke_ReduceLogicalOneAxis_CPU, - ReduceCPULayerTest, - paramsOneAxisLogical, - ReduceCPULayerTest::getTestCaseName -); - -INSTANTIATE_TEST_SUITE_P( - smoke_Reduce_ReductionTypes_CPU, - ReduceCPULayerTest, - params_MultiAxis, - ReduceCPULayerTest::getTestCaseName -); - -INSTANTIATE_TEST_SUITE_P( - smoke_Reduce_ReductionTypes4D_CPU, + smoke_Reduce_MultiAxis_4D_CPU, ReduceCPULayerTest, params_MultiAxis_4D, ReduceCPULayerTest::getTestCaseName ); INSTANTIATE_TEST_SUITE_P( - smoke_Reduce_ReductionTypes5D_CPU, + smoke_Reduce_MultiAxis_5D_CPU, ReduceCPULayerTest, params_MultiAxis_5D, ReduceCPULayerTest::getTestCaseName ); INSTANTIATE_TEST_SUITE_P( - smoke_ReduceLogical_ReductionTypes_CPU, + smoke_Reduce_MultiAxis_4D_Hybrid_CPU, ReduceCPULayerTest, - params_MultiAxisLogical, + params_MultiAxis_4D_Hybrid, ReduceCPULayerTest::getTestCaseName ); INSTANTIATE_TEST_SUITE_P( - smoke_ReduceLogical4D_ReductionTypes_CPU, + smoke_Reduce_MultiAxis_5D_Hybrid_CPU, ReduceCPULayerTest, - params_MultiAxisLogical4D, + params_MultiAxis_5D_Hybrid, ReduceCPULayerTest::getTestCaseName ); INSTANTIATE_TEST_SUITE_P( - smoke_ReduceLogical5D_ReductionTypes_CPU, + smoke_Reduce_MultiAxis_6D_CPU, ReduceCPULayerTest, - params_MultiAxisLogical5D, + params_MultiAxis_6D, + ReduceCPULayerTest::getTestCaseName +); + +/* ================================ 1.2 No fusion - Logical ================================ */ +const auto params_OneAxis_Logical = testing::Combine( + testing::Combine( + testing::ValuesIn(axes), + testing::ValuesIn(opTypes), + testing::ValuesIn(keepDims), + testing::ValuesIn(reductionLogicalTypes), + testing::Values(ElementType::boolean), + testing::Values(ElementType::undefined), + testing::Values(ElementType::undefined), + testing::ValuesIn(inputShapes)), + testing::Values(emptyCPUSpec), + testing::Values(emptyFusingSpec)); + +const auto params_MultiAxis_4D_Logical = testing::Combine( + testing::Combine( + testing::ValuesIn(axesND), + testing::Values(CommonTestUtils::OpType::VECTOR), + testing::Values(true), + testing::ValuesIn(reductionLogicalTypes), + testing::Values(ElementType::boolean), + testing::Values(ElementType::undefined), + testing::Values(ElementType::undefined), + testing::ValuesIn(inputShapes)), + testing::ValuesIn(filterCPUSpecificParams(cpuParams_4D)), + testing::Values(emptyFusingSpec)); + +const auto params_MultiAxis_5D_Logical = testing::Combine( + testing::Combine( + testing::ValuesIn(axes5D), + testing::Values(CommonTestUtils::OpType::VECTOR), + testing::Values(true), + testing::ValuesIn(reductionLogicalTypes), + testing::Values(ElementType::boolean), + testing::Values(ElementType::undefined), + testing::Values(ElementType::undefined), + testing::ValuesIn(inputShapes_5D)), + testing::ValuesIn(filterCPUSpecificParams(cpuParams_5D)), + testing::Values(emptyFusingSpec)); + +const auto params_MultiAxis_4D_Hybrid_Logical = testing::Combine( + testing::Combine( + testing::ValuesIn(axesND), + testing::Values(CommonTestUtils::OpType::VECTOR), + testing::Values(false), + testing::ValuesIn(reductionLogicalTypes), + testing::Values(ElementType::boolean), + testing::Values(ElementType::undefined), + testing::Values(ElementType::undefined), + testing::ValuesIn(inputShapes)), + testing::ValuesIn(filterCPUSpecificParams(cpuParams_HybridLayout_4D)), + testing::Values(emptyFusingSpec)); + +const auto params_MultiAxis_5D_Hybrid_Logical = testing::Combine( + testing::Combine( + testing::ValuesIn(axes5D), + testing::Values(CommonTestUtils::OpType::VECTOR), + testing::Values(false), + testing::ValuesIn(reductionLogicalTypes), + testing::Values(ElementType::boolean), + testing::Values(ElementType::undefined), + testing::Values(ElementType::undefined), + testing::ValuesIn(inputShapes_5D)), + testing::ValuesIn(filterCPUSpecificParams(cpuParams_HybridLayout_5D)), + testing::Values(emptyFusingSpec)); + +const auto params_MultiAxis_6D_Logical = testing::Combine( + testing::Combine( + testing::ValuesIn(axes6D), + testing::Values(CommonTestUtils::OpType::VECTOR), + testing::ValuesIn(keepDims), + testing::ValuesIn(reductionLogicalTypes), + testing::Values(ElementType::boolean), + testing::Values(ElementType::undefined), + testing::Values(ElementType::undefined), + testing::ValuesIn(inputShapes_6D)), + testing::Values(emptyCPUSpec), + testing::Values(emptyFusingSpec)); + +INSTANTIATE_TEST_SUITE_P( + smoke_Reduce_OneAxis_Logical_CPU, + ReduceCPULayerTest, + params_OneAxis_Logical, + ReduceCPULayerTest::getTestCaseName +); + +INSTANTIATE_TEST_SUITE_P( + smoke_Reduce_MultiAxis_4D_Logical_CPU, + ReduceCPULayerTest, + params_MultiAxis_4D_Logical, + ReduceCPULayerTest::getTestCaseName +); + +INSTANTIATE_TEST_SUITE_P( + smoke_Reduce_MultiAxis_5D_Logical_CPU, + ReduceCPULayerTest, + params_MultiAxis_5D_Logical, + ReduceCPULayerTest::getTestCaseName +); + +INSTANTIATE_TEST_SUITE_P( + smoke_Reduce_MultiAxis_4D_Hybrid_Logical_CPU, + ReduceCPULayerTest, + params_MultiAxis_4D_Hybrid_Logical, + ReduceCPULayerTest::getTestCaseName +); + +INSTANTIATE_TEST_SUITE_P( + smoke_Reduce_MultiAxis_5D_Hybrid_Logical_CPU, + ReduceCPULayerTest, + params_MultiAxis_5D_Hybrid_Logical, + ReduceCPULayerTest::getTestCaseName +); + +INSTANTIATE_TEST_SUITE_P( + smoke_Reduce_MultiAxis_6D_Logical_CPU, + ReduceCPULayerTest, + params_MultiAxis_6D_Logical, + ReduceCPULayerTest::getTestCaseName +); + +/* ================================ 2.1 Fusion - KeepDims ================================ */ +const auto params_OneAxis_fusing = testing::Combine( + testing::Combine( + testing::ValuesIn(axes), + testing::ValuesIn(opTypes), + testing::Values(true), + testing::ValuesIn(reductionTypes), + testing::ValuesIn(inpOutPrc), + testing::Values(ElementType::undefined), + testing::Values(ElementType::undefined), + testing::ValuesIn(inputShapes)), + testing::Values(emptyCPUSpec), + testing::ValuesIn(fusingParamsSet)); + +const auto params_MultiAxis_4D_fusing = testing::Combine( + testing::Combine( + testing::ValuesIn(axesND), + testing::Values(CommonTestUtils::OpType::VECTOR), + testing::Values(true), + testing::ValuesIn(reductionTypes), + testing::ValuesIn(inpOutPrc), + testing::Values(ElementType::undefined), + testing::Values(ElementType::undefined), + testing::ValuesIn(inputShapes)), + testing::ValuesIn(filterCPUSpecificParams(cpuParams_4D)), + testing::ValuesIn(fusingParamsSet)); + +const auto params_MultiAxis_5D_fusing = testing::Combine( + testing::Combine( + testing::ValuesIn(axes5D), + testing::Values(CommonTestUtils::OpType::VECTOR), + testing::Values(true), + testing::ValuesIn(reductionTypes), + testing::ValuesIn(inpOutPrc), + testing::Values(ElementType::undefined), + testing::Values(ElementType::undefined), + testing::ValuesIn(inputShapes_5D)), + testing::ValuesIn(filterCPUSpecificParams(cpuParams_5D)), + testing::ValuesIn(fusingParamsSet)); + +INSTANTIATE_TEST_SUITE_P( + smoke_Reduce_OneAxis_fusing_CPU, + ReduceCPULayerTest, + params_OneAxis_fusing, + ReduceCPULayerTest::getTestCaseName +); + +INSTANTIATE_TEST_SUITE_P( + smoke_Reduce_MultiAxis_4D_fusing_CPU, + ReduceCPULayerTest, + params_MultiAxis_4D_fusing, + ReduceCPULayerTest::getTestCaseName +); + +INSTANTIATE_TEST_SUITE_P( + smoke_Reduce_MultiAxis_5D_fusing_CPU, + ReduceCPULayerTest, + params_MultiAxis_5D_fusing, + ReduceCPULayerTest::getTestCaseName +); + +/* ================================ 2.2 Fusion - KeepNoDims ================================ */ +const auto params_OneAxis_fusing_KeepNoDims = testing::Combine( + testing::Combine( + testing::ValuesIn(axes), + testing::ValuesIn(opTypes), + testing::Values(false), + testing::ValuesIn(reductionTypes), + testing::ValuesIn(inpOutPrc), + testing::Values(ElementType::undefined), + testing::Values(ElementType::undefined), + testing::ValuesIn(inputShapesFusingKeepNoDims)), + testing::Values(emptyCPUSpec), + testing::ValuesIn(fusingParamsSet)); + +const auto params_MultiAxis_4D_Hybrid_fusing_KeepNoDims = testing::Combine( + testing::Combine( + testing::ValuesIn(axesNDFusing), + testing::Values(CommonTestUtils::OpType::VECTOR), + testing::Values(false), + testing::ValuesIn(reductionTypes), + testing::ValuesIn(inpOutPrc), + testing::Values(ElementType::undefined), + testing::Values(ElementType::undefined), + testing::ValuesIn(inputShapesFusingKeepNoDims)), + testing::ValuesIn(filterCPUSpecificParams(cpuParams_HybridLayout_4D)), + testing::ValuesIn(fusingParamsSet)); + +const auto params_MultiAxis_5D_Hybrid_fusing_KeepNoDims = testing::Combine( + testing::Combine( + testing::ValuesIn(axes5DFusing), + testing::Values(CommonTestUtils::OpType::VECTOR), + testing::Values(false), + testing::ValuesIn(reductionTypes), + testing::ValuesIn(inpOutPrc), + testing::Values(ElementType::undefined), + testing::Values(ElementType::undefined), + testing::ValuesIn(inputShapesFusingKeepNoDims_5D)), + testing::ValuesIn(filterCPUSpecificParams(cpuParams_HybridLayout_5D)), + testing::ValuesIn(fusingParamsSet)); + +INSTANTIATE_TEST_SUITE_P( + smoke_Reduce_OneAxis_fusing_KeepNoDims_CPU, + ReduceCPULayerTest, + params_OneAxis_fusing_KeepNoDims, + ReduceCPULayerTest::getTestCaseName +); + +INSTANTIATE_TEST_SUITE_P( + smoke_Reduce_MultiAxis_4D_Hybrid_fusing_KeepNoDims_CPU, + ReduceCPULayerTest, + params_MultiAxis_4D_Hybrid_fusing_KeepNoDims, + ReduceCPULayerTest::getTestCaseName +); + +INSTANTIATE_TEST_SUITE_P( + smoke_Reduce_MultiAxis_5D_Hybrid_fusing_KeepNoDims_CPU, + ReduceCPULayerTest, + params_MultiAxis_5D_Hybrid_fusing_KeepNoDims, ReduceCPULayerTest::getTestCaseName ); } // namespace diff --git a/inference-engine/tests/functional/plugin/cpu/single_layer_tests/reorg_yolo.cpp b/inference-engine/tests/functional/plugin/cpu/single_layer_tests/reorg_yolo.cpp new file mode 100644 index 00000000000..f728d590038 --- /dev/null +++ b/inference-engine/tests/functional/plugin/cpu/single_layer_tests/reorg_yolo.cpp @@ -0,0 +1,90 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "functional_test_utils/ov_tensor_utils.hpp" +#include "ngraph_functions/builders.hpp" +#include "shared_test_classes/base/ov_subgraph.hpp" +#include "test_utils/cpu_test_utils.hpp" + +using namespace InferenceEngine; +using namespace CPUTestUtils; +using namespace ngraph::opset3; +using namespace ov::test; + +namespace CPULayerTestsDefinitions { + +using ReorgYoloCPUParamsTuple = typename std::tuple; // Device + +class ReorgYoloLayerCPUTest : public testing::WithParamInterface, + virtual public ov::test::SubgraphBaseTest { +public: + static std::string getTestCaseName(const testing::TestParamInfo& obj) { + InputShape inputShape; + size_t stride; + ElementType netPrecision; + TargetDevice targetDev; + std::tie(inputShape, stride, netPrecision, targetDev) = obj.param; + std::ostringstream result; + result << "IS=" << CommonTestUtils::partialShape2str({inputShape.first}) << "_"; + for (const auto& item : inputShape.second) { + result << CommonTestUtils::vec2str(item) << "_"; + } + result << "stride=" << stride << "_"; + result << "netPRC=" << netPrecision << "_"; + result << "targetDevice=" << targetDev << "_"; + return result.str(); + } + +protected: + void SetUp() override { + InputShape inputShape; + size_t stride; + ElementType netPrecision; + std::tie(inputShape, stride, netPrecision, targetDevice) = this->GetParam(); + + init_input_shapes({inputShape}); + + auto param = std::make_shared(ngraph::element::f32, inputDynamicShapes[0]); + auto reorg_yolo = std::make_shared(param, stride); + function = std::make_shared(std::make_shared(reorg_yolo), + ngraph::ParameterVector{param}, + "ReorgYolo"); + } +}; + +TEST_P(ReorgYoloLayerCPUTest, CompareWithRefs) { + run(); +}; + +const std::vector inShapesDynamic = { + {{{1, 2}, -1, -1, -1}, {{1, 4, 4, 4}, {1, 8, 4, 4}, {2, 8, 4, 4}}}}; + +const std::vector strides = {2, 3}; + +const std::vector inShapesDynamic2 = {{{{1, 2}, -1, -1, -1}, {{1, 9, 3, 3}}}}; + +const auto testCase_stride2_Dynamic = ::testing::Combine(::testing::ValuesIn(inShapesDynamic), + ::testing::Values(strides[0]), + ::testing::Values(ov::element::f32), + ::testing::Values(CommonTestUtils::DEVICE_CPU)); + +const auto testCase_stride3_Dynamic = ::testing::Combine(::testing::ValuesIn(inShapesDynamic2), + ::testing::Values(strides[1]), + ::testing::Values(ov::element::f32), + ::testing::Values(CommonTestUtils::DEVICE_CPU)); + +INSTANTIATE_TEST_SUITE_P(smoke_TestsReorgYolo_stride2_DynamicShape, + ReorgYoloLayerCPUTest, + testCase_stride2_Dynamic, + ReorgYoloLayerCPUTest::getTestCaseName); + +INSTANTIATE_TEST_SUITE_P(smoke_TestsReorgYolo_stride3_DynamicShape, + ReorgYoloLayerCPUTest, + testCase_stride3_Dynamic, + ReorgYoloLayerCPUTest::getTestCaseName); + +}; // namespace CPULayerTestsDefinitions diff --git a/inference-engine/tests/functional/plugin/cpu/single_layer_tests/roialign.cpp b/inference-engine/tests/functional/plugin/cpu/single_layer_tests/roialign.cpp index 78a6fdcd0cb..cd7864c7fe8 100644 --- a/inference-engine/tests/functional/plugin/cpu/single_layer_tests/roialign.cpp +++ b/inference-engine/tests/functional/plugin/cpu/single_layer_tests/roialign.cpp @@ -3,70 +3,129 @@ // #include "test_utils/cpu_test_utils.hpp" +#include "functional_test_utils/ov_tensor_utils.hpp" +#include "shared_test_classes/base/ov_subgraph.hpp" #include "ngraph_functions/builders.hpp" #include "ngraph_functions/utils/ngraph_helpers.hpp" using namespace InferenceEngine; using namespace CPUTestUtils; +using namespace ov::test; namespace CPULayerTestsDefinitions { -namespace { - int pooledH; - int pooledW; - float spatialScale; - int samplingRatio; - std::pair, std::vector> proposal; - std::string mode; - std::vector inputShape; -} // namespace +using ROIAlignShapes = std::vector; -typedef std::tuple< +using ROIAlignSpecificParams = std::tuple< int, // bin's column count int, // bin's row count float, // scale for given region considering actual input size int, // pooling ratio - std::pair, std::vector>, // united proposal vector of coordinates and indexes std::string, // pooling mode - std::vector // feature map shape -> ROIAlignSpecificParams; + ROIAlignShapes +>; -typedef std::tuple< +using ROIAlignLayerTestParams = std::tuple< ROIAlignSpecificParams, - InferenceEngine::Precision, // Net precision + ElementType, // Net precision LayerTestsUtils::TargetDevice // Device name -> ROIAlignLayerTestParams; +>; -typedef std::tuple< +using ROIAlignLayerCPUTestParamsSet = std::tuple< CPULayerTestsDefinitions::ROIAlignLayerTestParams, - CPUSpecificParams> ROIAlignLayerCPUTestParamsSet; + CPUSpecificParams>; class ROIAlignLayerCPUTest : public testing::WithParamInterface, - virtual public LayerTestsUtils::LayerTestsCommon, public CPUTestsBase { + public SubgraphBaseTest, public CPUTestsBase { public: static std::string getTestCaseName(testing::TestParamInfo obj) { CPULayerTestsDefinitions::ROIAlignLayerTestParams basicParamsSet; CPUSpecificParams cpuParams; std::tie(basicParamsSet, cpuParams) = obj.param; std::string td; - Precision netPr; + ElementType netPrecision; ROIAlignSpecificParams roiPar; - std::tie(roiPar, netPr, td) = basicParamsSet; - std::tie(pooledH, pooledW, spatialScale, samplingRatio, - proposal, mode, inputShape) = roiPar; + std::tie(roiPar, netPrecision, td) = basicParamsSet; + + int pooledH; + int pooledW; + float spatialScale; + int samplingRatio; + std::string mode; + ROIAlignShapes inputShapes; + std::tie(pooledH, pooledW, spatialScale, samplingRatio, mode, inputShapes) = roiPar; std::ostringstream result; - result << "ROIAlignTest_"; - result << std::to_string(obj.index); + + result << netPrecision << "_IS="; + for (const auto& shape : inputShapes) { + result << CommonTestUtils::partialShape2str({ shape.first }) << "_"; + } + result << "TS="; + for (const auto& shape : inputShapes) { + result << "("; + for (const auto& targetShape : shape.second) { + result << CommonTestUtils::vec2str(targetShape) << "_"; + } + result << ")_"; + } + result << "pooledH=" << pooledH << "_"; result << "pooledW=" << pooledW << "_"; result << "spatialScale=" << spatialScale << "_"; result << "samplingRatio=" << samplingRatio << "_"; - result << (netPr == Precision::FP32 ? "FP32" : "BF16") << "_"; result << mode << "_"; result << CPUTestsBase::getTestCaseName(cpuParams); + return result.str(); } protected: + void generate_inputs(const std::vector& targetInputStaticShapes) override { + inputs.clear(); + const auto& funcInputs = function->inputs(); + + ov::runtime::Tensor data_tensor; + const auto& dataPrecision = funcInputs[0].get_element_type(); + const auto& dataShape = targetInputStaticShapes.front(); + data_tensor = ov::test::utils::create_and_fill_tensor(dataPrecision, dataShape, 10, 0, 1000); + + const auto& coordsET = funcInputs[1].get_element_type(); + auto coordsTensor = ov::runtime::Tensor{ coordsET, targetInputStaticShapes[1] }; + if (coordsET == ElementType::f32) { + auto coordsTensorData = static_cast(coordsTensor.data()); + for (size_t i = 0; i < coordsTensor.get_size(); i += 4) { + coordsTensorData[i] = 1.f; + coordsTensorData[i] = 1.f; + coordsTensorData[i] = 19.f; + coordsTensorData[i] = 19.f; + } + } else if (coordsET == ElementType::bf16) { + auto coordsTensorData = static_cast(coordsTensor.data()); + for (size_t i = 0; i < coordsTensor.get_size(); i += 4) { + coordsTensorData[i] = static_cast(ngraph::bfloat16(1.f).to_bits()); + coordsTensorData[i] = static_cast(ngraph::bfloat16(1.f).to_bits()); + coordsTensorData[i] = static_cast(ngraph::bfloat16(19.f).to_bits()); + coordsTensorData[i] = static_cast(ngraph::bfloat16(19.f).to_bits()); + } + } else { + IE_THROW() << "roi align. Unsupported precision: " << coordsET; + } + + auto roisIdxTensor = ov::runtime::Tensor{ funcInputs[2].get_element_type(), targetInputStaticShapes[2] }; + auto roisIdxTensorData = static_cast(roisIdxTensor.data()); + if (roisIdxTensor.get_size() == 1) { + roisIdxTensorData[0] = 1; + } else if (roisIdxTensor.get_size() == 2) { + roisIdxTensorData[0] = 0; + roisIdxTensorData[1] = 1; + } else { + IE_THROW() << "Unexpected roiIdx size: " << roisIdxTensor.get_size(); + } + + inputs.insert({ funcInputs[0].get_node_shared_ptr(), data_tensor }); + inputs.insert({ funcInputs[1].get_node_shared_ptr(), coordsTensor }); + inputs.insert({ funcInputs[2].get_node_shared_ptr(), roisIdxTensor }); + } + void SetUp() override { CPULayerTestsDefinitions::ROIAlignLayerTestParams basicParamsSet; CPUSpecificParams cpuParams; @@ -74,36 +133,38 @@ protected: std::tie(inFmts, outFmts, priority, selectedType) = cpuParams; CPULayerTestsDefinitions::ROIAlignSpecificParams roiAlignParams; - auto netPrecision = InferenceEngine::Precision::UNSPECIFIED; - std::tie(roiAlignParams, netPrecision, targetDevice) = basicParamsSet; - inPrc = outPrc = netPrecision; - std::tie(pooledH, pooledW, spatialScale, samplingRatio, - proposal, mode, inputShape) = roiAlignParams; + ElementType inputPrecision; + std::tie(roiAlignParams, inputPrecision, targetDevice) = basicParamsSet; - std::vector proposalVector = proposal.first; - std::vector roiIdxVector = proposal.second; + int pooledH; + int pooledW; + float spatialScale; + int samplingRatio; + std::string mode; + ROIAlignShapes inputShapes; + std::tie(pooledH, pooledW, spatialScale, samplingRatio, mode, inputShapes) = roiAlignParams; - ngraph::Shape coordsShape = { proposalVector.size() / 4, 4 }; - ngraph::Shape idxVectorShape = { roiIdxVector.size() }; + init_input_shapes(inputShapes); - auto roisIdx = ngraph::builder::makeConstant(ngraph::element::i32, idxVectorShape, roiIdxVector); - auto coords = ngraph::builder::makeConstant(ngraph::element::f32, coordsShape, proposalVector); - auto params = ngraph::builder::makeParams(ngraph::element::f32, {inputShape}); + auto float_params = ngraph::builder::makeDynamicParams(inputPrecision, { inputDynamicShapes[0], inputDynamicShapes[1] }); + auto int_params = ngraph::builder::makeDynamicParams(ngraph::element::i32, { inputDynamicShapes[2] }); - auto roialign = std::make_shared(params[0], coords, roisIdx, pooledH, pooledW, + auto roialign = std::make_shared(float_params[0], float_params[1], int_params[0], pooledH, pooledW, samplingRatio, spatialScale, mode); - roialign->get_rt_info() = getCPUInfo(); - selectedType = std::string("unknown_") + inPrc.name(); - threshold = 1e-2; - const ngraph::ResultVector results{std::make_shared(roialign)}; - function = std::make_shared(results, params, "ROIAlign"); + selectedType = makeSelectedTypeStr("unknown", inputPrecision); + if (inputPrecision == ElementType::bf16) { + rel_threshold = 1e-2; + } + + ngraph::ParameterVector params{ float_params[0], float_params[1], int_params[0] }; + function = makeNgraphFunction(inputPrecision, params, roialign, "ROIAlign"); } }; TEST_P(ROIAlignLayerCPUTest, CompareWithRefs) { SKIP_IF_CURRENT_TEST_IS_DISABLED() - Run(); + run(); CheckPluginRelatedResults(executableNetwork, "ROIAlign"); } @@ -122,9 +183,9 @@ std::vector filterCPUInfoForDevice() { return resCPUParams; } -const std::vector netPrecisions = { - InferenceEngine::Precision::FP32, - InferenceEngine::Precision::BF16 +const std::vector netPrecisions = { + ElementType::f32, + ElementType::bf16, }; const std::vector spatialBinXVector = { 2 }; @@ -140,17 +201,30 @@ const std::vector modeVector = { "max" }; -const std::vector> inputShapeVector = { - SizeVector({ 2, 18, 20, 20 }), - SizeVector({ 2, 4, 20, 20 }), - SizeVector({ 2, 4, 20, 40 }), - SizeVector({ 10, 1, 20, 20 }) -}; - - -const std::vector, std::vector>> propVector = { - {{ 1, 1, 19, 19, 1, 1, 19, 19, }, { 0, 1 }}, - {{ 1, 1, 19, 19 }, { 1 }} +const std::vector inputShapeVector = { + ROIAlignShapes{{{}, {{ 2, 18, 20, 20 }}}, {{}, {{2, 4}}}, {{}, {{2}}}}, + ROIAlignShapes{{{}, {{ 2, 4, 20, 20 }}}, {{}, {{2, 4}}}, {{}, {{2}}}}, + ROIAlignShapes{{{}, {{ 2, 4, 20, 40 }}}, {{}, {{2, 4}}}, {{}, {{2}}}}, + ROIAlignShapes{{{}, {{ 10, 1, 20, 20 }}}, {{}, {{2, 4}}}, {{}, {{2}}}}, + ROIAlignShapes{{{}, {{ 2, 18, 20, 20 }}}, {{}, {{1, 4}}}, {{}, {{1}}}}, + ROIAlignShapes{{{}, {{ 2, 4, 20, 20 }}}, {{}, {{1, 4}}}, {{}, {{1}}}}, + ROIAlignShapes{{{}, {{ 2, 4, 20, 40 }}}, {{}, {{1, 4}}}, {{}, {{1}}}}, + ROIAlignShapes{{{}, {{ 10, 1, 20, 20 }}}, {{}, {{1, 4}}}, {{}, {{1}}}}, + ROIAlignShapes{ + {{-1, -1, -1, -1}, {{ 10, 1, 20, 20 }, { 2, 4, 20, 20 }, { 2, 18, 20, 20 }}}, + {{-1, 4}, {{1, 4}, {2, 4}, {1, 4}}}, + {{-1}, {{1}, {2}, {1}}} + }, + ROIAlignShapes{ + {{{2, 10}, { 1, 5 }, -1, -1}, {{ 2, 1, 20, 20 }, { 10, 5, 30, 20 }, { 4, 4, 40, 40 }}}, + {{-1, 4}, {{2, 4}, {2, 4}, {1, 4}}}, + {{-1}, {{2}, {2}, {1}}} + }, + ROIAlignShapes{ + {{{2, 10}, {1, 18}, {10, 30}, {15, 25}}, {{ 10, 1, 10, 15 }, { 2, 4, 20, 20 }, { 7, 18, 30, 25 }}}, + {{{1, 2}, 4}, {{1, 4}, {2, 4}, {1, 4}}}, + {{{1, 2}}, {{1}, {2}, {1}}} + }, }; const auto roiAlignParams = ::testing::Combine( @@ -158,7 +232,6 @@ const auto roiAlignParams = ::testing::Combine( ::testing::ValuesIn(spatialBinYVector), // bin's row count ::testing::ValuesIn(spatialScaleVector), // scale for given region considering actual input size ::testing::ValuesIn(poolingRatioVector), // pooling ratio for bin - ::testing::ValuesIn(propVector), // united vector of coordinates and batch id's ::testing::ValuesIn(modeVector), // pooling mode ::testing::ValuesIn(inputShapeVector) // feature map shape ); diff --git a/inference-engine/tests/functional/plugin/cpu/single_layer_tests/scatter_ND_update.cpp b/inference-engine/tests/functional/plugin/cpu/single_layer_tests/scatter_ND_update.cpp new file mode 100644 index 00000000000..e92e40dc299 --- /dev/null +++ b/inference-engine/tests/functional/plugin/cpu/single_layer_tests/scatter_ND_update.cpp @@ -0,0 +1,174 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "functional_test_utils/ov_tensor_utils.hpp" +#include "test_utils/cpu_test_utils.hpp" +#include "shared_test_classes/base/ov_subgraph.hpp" +#include "ngraph_functions/builders.hpp" + +using namespace ngraph; +using namespace InferenceEngine; +using namespace CPUTestUtils; +using namespace ov::test; + +namespace CPULayerTestsDefinitions { +using ScatterNDUpdateShapes = std::vector; +using IndicesValues = std::vector; + +struct ScatterNDUpdateLayerParams { + ScatterNDUpdateShapes inputShapes; + IndicesValues indicesValues; +}; + +using scatterUpdateParams = std::tuple< + ScatterNDUpdateLayerParams, + ElementType, // input precision + ElementType>; // indices precision + +class ScatterNDUpdateLayerCPUTest : public testing::WithParamInterface, public SubgraphBaseTest, public CPUTestsBase { +public: + static std::string getTestCaseName(testing::TestParamInfo obj) { + ScatterNDUpdateLayerParams scatterParams; + ElementType inputPrecision; + ElementType idxPrecision; + std::tie(scatterParams, inputPrecision, idxPrecision) = obj.param; + const auto inputShapes = scatterParams.inputShapes; + const auto indicesValues = scatterParams.indicesValues; + + std::ostringstream result; + result << inputPrecision << "_IS="; + for (const auto& shape : inputShapes) { + result << CommonTestUtils::partialShape2str({ shape.first }) << "_"; + } + result << "TS="; + for (const auto& shape : inputShapes) { + result << "("; + for (const auto& targetShape : shape.second) { + result << CommonTestUtils::vec2str(targetShape) << "_"; + } + result << ")_"; + } + result << "indices_values=" << CommonTestUtils::vec2str(indicesValues) << "_idx_precision=" << idxPrecision; + return result.str(); + } + +protected: + void generate_inputs(const std::vector& targetInputStaticShapes) override { + inputs.clear(); + const auto& funcInputs = function->inputs(); + for (int i = 0; i < funcInputs.size(); ++i) { + const auto& funcInput = funcInputs[i]; + const auto& inputPrecision = funcInput.get_element_type(); + const auto& targetShape = targetInputStaticShapes[i]; + ov::runtime::Tensor tensor; + if (i == 1) { + tensor = ov::runtime::Tensor{ inputPrecision, targetShape }; + const auto indicesVals = std::get<0>(this->GetParam()).indicesValues; + if (inputPrecision == ElementType::i32) { + auto data = tensor.data(); + for (size_t i = 0; i < tensor.get_size(); ++i) { + data[i] = static_cast(indicesVals[i]); + } + } else if (inputPrecision == ElementType::i64) { + auto data = tensor.data(); + for (size_t i = 0; i < tensor.get_size(); ++i) { + data[i] = indicesVals[i]; + } + } else { + IE_THROW() << "GatherNDUpdate. Unsupported indices precision: " << inputPrecision; + } + } else { + if (inputPrecision.is_real()) { + tensor = ov::test::utils::create_and_fill_tensor(inputPrecision, targetShape, 10, 0, 1000); + } else { + tensor = ov::test::utils::create_and_fill_tensor(inputPrecision, targetShape); + } + } + inputs.insert({ funcInput.get_node_shared_ptr(), tensor }); + } + } + + void SetUp() override { + targetDevice = CommonTestUtils::DEVICE_CPU; + ScatterNDUpdateLayerParams scatterParams; + ElementType inputPrecision; + ElementType idxPrecision; + std::tie(scatterParams, inputPrecision, idxPrecision) = this->GetParam(); + const auto inputShapes = scatterParams.inputShapes; + const auto indicesValues = scatterParams.indicesValues; + + init_input_shapes(inputShapes); + selectedType = makeSelectedTypeStr("unknown", inputPrecision); + + auto dataParams = ngraph::builder::makeDynamicParams(inputPrecision, { inputDynamicShapes[0], inputDynamicShapes[2] }); + auto indicesParam = ngraph::builder::makeDynamicParams(idxPrecision, { inputDynamicShapes[1] }); + dataParams[0]->set_friendly_name("Param_1"); + indicesParam[0]->set_friendly_name("Param_2"); + dataParams[1]->set_friendly_name("Param_3"); + + auto scatter = std::make_shared(dataParams[0], indicesParam[0], dataParams[1]); + + ngraph::ParameterVector allParams{ dataParams[0], indicesParam[0], dataParams[1] }; + function = makeNgraphFunction(inputPrecision, allParams, scatter, "ScatterNDUpdateLayerCPUTest"); + } +}; + +TEST_P(ScatterNDUpdateLayerCPUTest, CompareWithRefs) { + SKIP_IF_CURRENT_TEST_IS_DISABLED() + run(); + CheckPluginRelatedResults(executableNetwork, "ScatterUpdate"); +} + +const std::vector scatterParams = { + ScatterNDUpdateLayerParams{ + ScatterNDUpdateShapes{ + {{-1, -1, -1, -1, -1}, {{10, 9, 10, 9, 10}, {10, 1, 11, 2, 5}, {10, 15, 8, 1, 7}}}, + {{2, 2, 1}, {{2, 2, 1}, {2, 2, 1}, {2, 2, 1}}}, + {{-1, -1, -1, -1, -1, -1}, {{2, 2, 9, 10, 9, 10}, {2, 2, 1, 11, 2, 5}, {2, 2, 15, 8, 1, 7}}}, + }, + IndicesValues{ 5, 6, 2, 8 } + }, + ScatterNDUpdateLayerParams{ + ScatterNDUpdateShapes{ + {{-1, -1, -1, -1}, {{ 10, 9, 9, 11 }, { 7, 5, 3, 12 }, { 3, 4, 9, 8 }}}, + {{2, 3}, {{2, 3}, {2, 3}, {2, 3}}}, + {{-1, -1}, {{2, 11}, {2, 12}, {2, 8}}} + }, + IndicesValues{ 0, 1, 1, 2, 2, 2 } + }, + ScatterNDUpdateLayerParams{ + ScatterNDUpdateShapes{ + {{{3, 10}, -1, {3, 9}, -1}, {{ 10, 9, 9, 11 }, { 7, 5, 3, 12 }, { 3, 4, 9, 8 }}}, + {{2, 3}, {{2, 3}, {2, 3}, {2, 3}}}, + {{{2, 4}, -1}, {{2, 11}, {2, 12}, {2, 8}}} + }, + IndicesValues{ 0, 1, 1, 2, 2, 2 } + }, + ScatterNDUpdateLayerParams{ + ScatterNDUpdateShapes{ + {{{3, 10}, {4, 11}, {3, 9}, {8, 15}}, {{ 10, 9, 9, 11 }, { 7, 5, 3, 12 }, { 3, 4, 9, 8 }}}, + {{2, 3}, {{2, 3}, {2, 3}, {2, 3}}}, + {{{2, 4}, -1}, {{2, 11}, {2, 12}, {2, 8}}} + }, + IndicesValues{ 0, 1, 1, 2, 2, 2 } + }, +}; + +const std::vector inputPrecisions = { + ElementType::f32, + ElementType::i32, +}; + +const std::vector constantPrecisions = { + ElementType::i32, + ElementType::i64, +}; + +INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs, ScatterNDUpdateLayerCPUTest, + ::testing::Combine( + ::testing::ValuesIn(scatterParams), + ::testing::ValuesIn(inputPrecisions), + ::testing::ValuesIn(constantPrecisions)), + ScatterNDUpdateLayerCPUTest::getTestCaseName); +} // namespace CPULayerTestsDefinitions diff --git a/inference-engine/tests/functional/plugin/cpu/single_layer_tests/scatter_elements_update.cpp b/inference-engine/tests/functional/plugin/cpu/single_layer_tests/scatter_elements_update.cpp new file mode 100644 index 00000000000..27ef185b74e --- /dev/null +++ b/inference-engine/tests/functional/plugin/cpu/single_layer_tests/scatter_elements_update.cpp @@ -0,0 +1,174 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "test_utils/cpu_test_utils.hpp" +#include "functional_test_utils/ov_tensor_utils.hpp" +#include "shared_test_classes/base/ov_subgraph.hpp" +#include "ngraph_functions/builders.hpp" + +using namespace ngraph; +using namespace InferenceEngine; +using namespace CPUTestUtils; +using namespace ov::test; + +namespace CPULayerTestsDefinitions { +using ScatterElementsUpdateShapes = std::vector; +using IndicesValues = std::vector; + +struct ScatterElementsUpdateLayerParams { + ScatterElementsUpdateShapes inputShapes; + IndicesValues indicesValues; +}; + +using scatterUpdateParams = std::tuple< + ScatterElementsUpdateLayerParams, + std::int64_t, // axis + ElementType, // input precision + ElementType>; // indices precision + +class ScatterElementsUpdateLayerCPUTest : public testing::WithParamInterface, public SubgraphBaseTest, public CPUTestsBase { +public: + static std::string getTestCaseName(testing::TestParamInfo obj) { + ScatterElementsUpdateLayerParams scatterParams; + std::int64_t axis; + ElementType inputPrecision; + ElementType idxPrecision; + std::tie(scatterParams, axis, inputPrecision, idxPrecision) = obj.param; + const auto inputShapes = scatterParams.inputShapes; + const auto indicesVals = scatterParams.indicesValues; + + std::ostringstream result; + result << inputPrecision << "_IS="; + for (const auto& shape : inputShapes) { + result << CommonTestUtils::partialShape2str({ shape.first }) << "_"; + } + result << "TS="; + for (const auto& shape : inputShapes) { + result << "("; + for (const auto& targetShape : shape.second) { + result << CommonTestUtils::vec2str(targetShape) << "_"; + } + result << ")_"; + } + result << "_indices_values=" << CommonTestUtils::vec2str(indicesVals) + << "axis=" << axis << "_idx_precision=" << idxPrecision; + return result.str(); + } + +protected: + void generate_inputs(const std::vector& targetInputStaticShapes) override { + inputs.clear(); + const auto& funcInputs = function->inputs(); + for (int i = 0; i < funcInputs.size(); ++i) { + const auto& funcInput = funcInputs[i]; + const auto& inputPrecision = funcInput.get_element_type(); + const auto& targetShape = targetInputStaticShapes[i]; + ov::runtime::Tensor tensor; + if (i == 1) { + tensor = ov::runtime::Tensor{ inputPrecision, targetShape }; + const auto indicesVals = std::get<0>(this->GetParam()).indicesValues; + if (inputPrecision == ElementType::i32) { + auto data = tensor.data(); + for (size_t i = 0; i < tensor.get_size(); ++i) { + data[i] = static_cast(indicesVals[i]); + } + } else if (inputPrecision == ElementType::i64) { + auto data = tensor.data(); + for (size_t i = 0; i < tensor.get_size(); ++i) { + data[i] = indicesVals[i]; + } + } else { + IE_THROW() << "GatherElementsUpdate. Unsupported indices precision: " << inputPrecision; + } + } else { + if (inputPrecision.is_real()) { + tensor = ov::test::utils::create_and_fill_tensor(inputPrecision, targetShape, 10, 0, 1000); + } else { + tensor = ov::test::utils::create_and_fill_tensor(inputPrecision, targetShape); + } + } + inputs.insert({ funcInput.get_node_shared_ptr(), tensor }); + } + } + + void SetUp() override { + targetDevice = CommonTestUtils::DEVICE_CPU; + ScatterElementsUpdateLayerParams scatterParams; + std::int64_t axis; + ElementType inputPrecision; + ElementType idxPrecision; + std::tie(scatterParams, axis, inputPrecision, idxPrecision) = this->GetParam(); + const auto inputShapes = scatterParams.inputShapes; + const auto indicesDescr = scatterParams.indicesValues; + + init_input_shapes(inputShapes); + selectedType = makeSelectedTypeStr("unknown", inputPrecision); + + auto dataParams = ngraph::builder::makeDynamicParams(inputPrecision, { inputDynamicShapes[0], inputDynamicShapes[2] }); + auto indicesParam = ngraph::builder::makeDynamicParams(idxPrecision, { inputDynamicShapes[1] }); + dataParams[0]->set_friendly_name("Param_1"); + indicesParam[0]->set_friendly_name("Param_2"); + dataParams[1]->set_friendly_name("Param_3"); + + auto axisNode = ngraph::opset3::Constant::create(idxPrecision, {}, { axis }); + auto scatter = std::make_shared(dataParams[0], indicesParam[0], dataParams[1], axisNode); + + ngraph::ParameterVector allParams{ dataParams[0], indicesParam[0], dataParams[1] }; + function = makeNgraphFunction(inputPrecision, allParams, scatter, "ScatterElementsUpdateLayerCPUTest"); + } +}; + +TEST_P(ScatterElementsUpdateLayerCPUTest, CompareWithRefs) { + SKIP_IF_CURRENT_TEST_IS_DISABLED() + run(); + CheckPluginRelatedResults(executableNetwork, "ScatterUpdate"); +} + +const std::vector axes = { -3, -2, -1, 0, 1, 2 }; + +const std::vector scatterParams = { + ScatterElementsUpdateLayerParams{ + ScatterElementsUpdateShapes{ + {{-1, -1, -1}, {{10, 12, 15}, {8, 9, 10}, {11, 8, 12}}}, + {{-1, -1, -1}, {{1, 2, 4}, {2, 1, 4}, {4, 1, 2}}}, + {{-1, -1, -1}, {{1, 2, 4}, {2, 1, 4}, {4, 1, 2}}} + }, + IndicesValues{1, 0, 4, 6, 2, 3, 7, 5}, + }, + ScatterElementsUpdateLayerParams{ + ScatterElementsUpdateShapes{ + {{-1, -1, -1, -1}, {{10, 9, 8, 12}, {8, 12, 10, 9}, {11, 10, 12, 9}}}, + {{-1, -1, -1, -1}, {{1, 2, 2, 2}, {1, 2, 1, 4}, {1, 2, 2, 2}}}, + {{-1, -1, -1, -1}, {{1, 2, 2, 2}, {1, 2, 1, 4}, {1, 2, 2, 2}}} + }, + IndicesValues{1, 0, 4, 6, 2, 3, 7, 5}, + }, + ScatterElementsUpdateLayerParams{ + ScatterElementsUpdateShapes{ + {{{7, 15}, {9, 12}, {1, 12}, {8, 12}}, {{10, 9, 8, 12}, {8, 12, 10, 9}, {11, 10, 12, 9}}}, + {{-1, -1, -1, -1}, {{1, 2, 2, 2}, {1, 2, 1, 4}, {1, 2, 2, 2}}}, + {{-1, -1, -1, -1}, {{1, 2, 2, 2}, {1, 2, 1, 4}, {1, 2, 2, 2}}} + }, + IndicesValues{1, 0, 4, 6, 2, 3, 7, 5}, + }, +}; + +const std::vector inputPrecisions = { + ElementType::f32, + ElementType::i32, +}; + +const std::vector constantPrecisions = { + ElementType::i32, + ElementType::i64, +}; + +INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs, ScatterElementsUpdateLayerCPUTest, + ::testing::Combine( + ::testing::ValuesIn(scatterParams), + ::testing::ValuesIn(axes), + ::testing::ValuesIn(inputPrecisions), + ::testing::ValuesIn(constantPrecisions)), + ScatterElementsUpdateLayerCPUTest::getTestCaseName); +} // namespace CPULayerTestsDefinitions diff --git a/inference-engine/tests/functional/plugin/cpu/single_layer_tests/scatter_update.cpp b/inference-engine/tests/functional/plugin/cpu/single_layer_tests/scatter_update.cpp new file mode 100644 index 00000000000..ded9a8883ed --- /dev/null +++ b/inference-engine/tests/functional/plugin/cpu/single_layer_tests/scatter_update.cpp @@ -0,0 +1,147 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "test_utils/cpu_test_utils.hpp" +#include "shared_test_classes/base/ov_subgraph.hpp" +#include "ngraph_functions/builders.hpp" + +using namespace ngraph; +using namespace InferenceEngine; +using namespace CPUTestUtils; +using namespace ov::test; + +namespace CPULayerTestsDefinitions { +using ScatterUpdateShapes = std::vector; +using IndicesDescription = std::pair>; +using Axis = std::int64_t; + +struct ScatterUpdateLayerParams { + ScatterUpdateShapes inputShapes; // shapes for "data" and "updates" inputs + IndicesDescription indicesDescriprion; // indices shapes and values + Axis axis; +}; + +using scatterUpdateParams = std::tuple< + ScatterUpdateLayerParams, + ElementType, // input precision + ElementType>; // indices precision + +class ScatterUpdateLayerCPUTest : public testing::WithParamInterface, public SubgraphBaseTest, public CPUTestsBase { +public: + static std::string getTestCaseName(testing::TestParamInfo obj) { + ScatterUpdateLayerParams scatterParams; + ElementType inputPrecision; + ElementType idxPrecision; + std::tie(scatterParams, inputPrecision, idxPrecision) = obj.param; + const auto inputShapes = scatterParams.inputShapes; + const auto indicesDescr = scatterParams.indicesDescriprion; + const auto axis = scatterParams.axis; + + std::ostringstream result; + result << inputPrecision << "_IS="; + for (const auto& shape : inputShapes) { + result << CommonTestUtils::partialShape2str({ shape.first }) << "_"; + } + result << "TS="; + for (const auto& shape : inputShapes) { + result << "("; + for (const auto& targetShape : shape.second) { + result << CommonTestUtils::vec2str(targetShape) << "_"; + } + result << ")_"; + } + result << "indices_shape=" << indicesDescr.first << "_indices_values=" << CommonTestUtils::vec2str(indicesDescr.second) + << "axis=" << axis << "_idx_precision=" << idxPrecision; + return result.str(); + } + +protected: + void SetUp() override { + targetDevice = CommonTestUtils::DEVICE_CPU; + ScatterUpdateLayerParams scatterParams; + ElementType inputPrecision; + ElementType idxPrecision; + std::tie(scatterParams, inputPrecision, idxPrecision) = this->GetParam(); + const auto inputShapes = scatterParams.inputShapes; + const auto indicesDescr = scatterParams.indicesDescriprion; + const auto axis = scatterParams.axis; + + init_input_shapes(inputShapes); + selectedType = makeSelectedTypeStr("unknown", inputPrecision); + + auto params = ngraph::builder::makeDynamicParams(inputPrecision, inputDynamicShapes); + auto indicesNode = ngraph::opset1::Constant::create(idxPrecision, indicesDescr.first, indicesDescr.second); + auto axis_node = ngraph::opset1::Constant::create(idxPrecision, {}, { axis }); + auto scatter = std::make_shared(params[0], indicesNode, params[1], axis_node); + + function = makeNgraphFunction(inputPrecision, params, scatter, "ScatterUpdateLayerCPUTest"); + } +}; + +TEST_P(ScatterUpdateLayerCPUTest, CompareWithRefs) { + SKIP_IF_CURRENT_TEST_IS_DISABLED() + run(); + CheckPluginRelatedResults(executableNetwork, "ScatterUpdate"); +} + +const std::vector scatterParams = { + ScatterUpdateLayerParams{ + ScatterUpdateShapes{ + {{-1, -1, -1, -1}, {{4, 12, 3, 11}, {7, 11, 2, 3}, {3, 9, 4, 10}}}, + {{-1, -1, -1, -1}, {{4, 8, 3, 11}, {7, 8, 2, 3}, {3, 8, 4, 10}}} + }, + IndicesDescription{{8}, {0, 2, 4, 6, 1, 3, 5, 7}}, + Axis{1} + }, + ScatterUpdateLayerParams{ + ScatterUpdateShapes{ + {{-1, -1, -1, -1}, {{4, 12, 3, 11}, {7, 9, 1, 12}, {3, 2, 1, 9}}}, + {{-1, -1, -1, -1}, {{4, 12, 3, 8}, {7, 9, 1, 8}, {3, 2, 1, 8}}} + }, + IndicesDescription{{8}, {0, 2, 4, 6, 1, 3, 5, 7}}, + Axis{3} + }, + ScatterUpdateLayerParams{ + ScatterUpdateShapes{ + {{-1, -1, -1, -1, -1}, {{5, 9, 10, 3, 4}, {7, 8, 11, 2, 2}, {11, 3, 12, 2, 2}}}, + {{-1, -1, -1, -1, -1, -1}, {{5, 9, 4, 2, 3, 4}, {7, 8, 4, 2, 2, 2}, {11, 3, 4, 2, 2, 2}}} + }, + IndicesDescription{{ 4, 2 }, { 0, 2, 4, 6, 1, 3, 5, 7 }}, + Axis{2} + }, + ScatterUpdateLayerParams{ + ScatterUpdateShapes{ + {{-1, -1, -1, -1, -1}, {{8, 9, 10, 3, 4}, {11, 3, 4, 3, 4}, {12, 9, 11, 2, 2}}}, + {{-1, -1, -1, -1, -1, -1}, {{4, 2, 9, 10, 3, 4}, {4, 2, 3, 4, 3, 4}, {4, 2, 9, 11, 2, 2}}} + }, + IndicesDescription{{ 4, 2 }, { 0, 2, 4, 6, 1, 3, 5, 7 }}, + Axis{0} + }, + ScatterUpdateLayerParams{ + ScatterUpdateShapes{ + {{{8, 12}, {3, 9}, {4, 11}, {2, 3}, {2, 4}}, {{8, 9, 10, 3, 4}, {11, 3, 4, 3, 4}, {12, 9, 11, 2, 2}}}, + {{4, 2, {3, 9}, {4, 11}, {2, 3}, {2, 4}}, {{4, 2, 9, 10, 3, 4}, {4, 2, 3, 4, 3, 4}, {4, 2, 9, 11, 2, 2}}} + }, + IndicesDescription{{ 4, 2 }, { 0, 2, 4, 6, 1, 3, 5, 7 }}, + Axis{0} + }, +}; + +const std::vector inputPrecisions = { + ElementType::f32, + ElementType::i32, +}; + +const std::vector constantPrecisions = { + ElementType::i32, + ElementType::i64, +}; + +INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs, ScatterUpdateLayerCPUTest, + ::testing::Combine( + ::testing::ValuesIn(scatterParams), + ::testing::ValuesIn(inputPrecisions), + ::testing::ValuesIn(constantPrecisions)), + ScatterUpdateLayerCPUTest::getTestCaseName); +} // namespace CPULayerTestsDefinitions diff --git a/inference-engine/tests/functional/plugin/cpu/single_layer_tests/tile.cpp b/inference-engine/tests/functional/plugin/cpu/single_layer_tests/tile.cpp new file mode 100644 index 00000000000..aef8df59eee --- /dev/null +++ b/inference-engine/tests/functional/plugin/cpu/single_layer_tests/tile.cpp @@ -0,0 +1,322 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "test_utils/cpu_test_utils.hpp" +#include "ngraph_functions/builders.hpp" +#include "shared_test_classes/base/ov_subgraph.hpp" +#include "functional_test_utils/ov_tensor_utils.hpp" + +using namespace CPUTestUtils; + +namespace CPULayerTestsDefinitions { + +using TileLayerTestParamsSet = typename std::tuple< + std::vector, // Input shapes + std::vector, // Repeats + ov::element::Type_t, // Network precision + bool, // Is Repeats input constant + std::string>; // Device name + +typedef std::tuple< + TileLayerTestParamsSet, + CPUSpecificParams> TileLayerCPUTestParamsSet; + +class TileLayerCPUTest : public testing::WithParamInterface, + virtual public ov::test::SubgraphBaseTest, public CPUTestsBase { +public: + static std::string getTestCaseName(testing::TestParamInfo obj) { + TileLayerTestParamsSet basicParamsSet; + CPUSpecificParams cpuParams; + std::tie(basicParamsSet, cpuParams) = obj.param; + + std::vector inputShapes; + std::vector repeats; + ov::element::Type_t netPrecision; + bool isRepeatsConst; + std::string deviceName; + std::tie(inputShapes, repeats, netPrecision, isRepeatsConst, deviceName) = basicParamsSet; + + std::ostringstream result; + result << "IS=("; + for (const auto& shape : inputShapes) { + result << CommonTestUtils::partialShape2str({shape.first}) << "_"; + } + result << ")_TS=("; + for (const auto& shape : inputShapes) { + for (const auto& item : shape.second) { + result << CommonTestUtils::vec2str(item) << "_"; + } + } + result << "Repeats=" << CommonTestUtils::vec2str(repeats) << "_"; + result << "netPrec=" << netPrecision << "_"; + result << "constRepeats=" << (isRepeatsConst ? "True" : "False") << "_"; + result << "trgDev=" << deviceName; + + result << CPUTestsBase::getTestCaseName(cpuParams); + + return result.str(); + } + +protected: + void SetUp() override { + TileLayerTestParamsSet basicParamsSet; + CPUSpecificParams cpuParams; + std::tie(basicParamsSet, cpuParams) = this->GetParam(); + + std::tie(inFmts, outFmts, priority, selectedType) = cpuParams; + + std::vector inputShapes; + ov::element::Type_t netPrecision; + bool isRepeatsConst; + std::tie(inputShapes, repeatsData, netPrecision, isRepeatsConst, targetDevice) = basicParamsSet; + + selectedType += std::string("_") + InferenceEngine::details::convertPrecision(netPrecision).name(); + + if (inputShapes.front().first.rank() != 0) { + inputDynamicShapes.push_back(inputShapes.front().first); + if (!isRepeatsConst) { + inputDynamicShapes.push_back({ static_cast(repeatsData.size()) }); + } + } + const size_t targetStaticShapeSize = inputShapes.front().second.size(); + targetStaticShapes.resize(targetStaticShapeSize); + for (size_t i = 0lu; i < targetStaticShapeSize; ++i) { + targetStaticShapes[i].push_back(inputShapes.front().second[i]); + if (!isRepeatsConst) + targetStaticShapes[i].push_back({ repeatsData.size() }); + } + + ov::ParameterVector functionParams; + if (inputDynamicShapes.empty()) { + functionParams.push_back(std::make_shared(netPrecision, targetStaticShapes.front().front())); + } else { + functionParams.push_back(std::make_shared(netPrecision, inputDynamicShapes.front())); + if (!isRepeatsConst) { + functionParams.push_back(std::make_shared(ov::element::i64, inputDynamicShapes[1])); + functionParams.back()->set_friendly_name("repeats"); + } + } + functionParams.front()->set_friendly_name("data"); + + auto paramOuts = ngraph::helpers::convert2OutputVector(ngraph::helpers::castOps2Nodes(functionParams)); + std::shared_ptr tileNode; + if (isRepeatsConst) { + tileNode = std::make_shared(paramOuts[0], + ov::op::v0::Constant::create(ov::element::i64, { repeatsData.size() }, repeatsData)); + } else { + tileNode = std::make_shared(paramOuts[0], paramOuts[1]); + } + function = makeNgraphFunction(netPrecision, functionParams, tileNode, "CPUTile"); + } + + void generate_inputs(const std::vector& targetInputStaticShapes) override { + inputs.clear(); + const auto& funcInputs = function->inputs(); + for (size_t i = 0lu; i < funcInputs.size(); i++) { + const auto& funcInput = funcInputs[i]; + ov::runtime::Tensor tensor; + if (funcInput.get_node()->get_friendly_name() == "repeats") { + tensor = ov::runtime::Tensor{ov::element::i64, targetInputStaticShapes[i]}; + auto data = tensor.data::value_type>(); + for (size_t i = 0lu; i < repeatsData.size(); i++) { + data[i] = repeatsData[i]; + } + } else { + if (funcInput.get_element_type().is_real()) { + tensor = ov::test::utils::create_and_fill_tensor( + funcInput.get_element_type(), targetInputStaticShapes[i], 10, 0, 1000); + } else { + tensor = ov::test::utils::create_and_fill_tensor(funcInput.get_element_type(), targetInputStaticShapes[i]); + } + } + inputs.insert({funcInput.get_node_shared_ptr(), tensor}); + } + } + + std::vector repeatsData; +}; + +TEST_P(TileLayerCPUTest, CompareWithRefs) { + SKIP_IF_CURRENT_TEST_IS_DISABLED() + + run(); + CheckPluginRelatedResults(executableNetwork, "Tile"); +} + +namespace { + +/* CPU PARAMS */ +const auto cpuParams_nchw = CPUSpecificParams{{nchw}, {nchw}, {}, "ref"}; +const auto cpuParams_ncdhw = CPUSpecificParams{{ncdhw}, {ncdhw}, {}, "ref"}; + +const auto cpuParams_nChw16c = CPUSpecificParams{{nChw16c}, {nChw16c}, {}, "ref"}; +const auto cpuParams_nCdhw16c = CPUSpecificParams{{nCdhw16c}, {nCdhw16c}, {}, "ref"}; + +const auto cpuParams_nChw8c = CPUSpecificParams{{nChw8c}, {nChw8c}, {}, "ref"}; +const auto cpuParams_nCdhw8c = CPUSpecificParams{{nCdhw8c}, {nCdhw8c}, {}, "ref"}; + +const auto cpuParams_nhwc = CPUSpecificParams{{nhwc}, {nhwc}, {}, "ref"}; +const auto cpuParams_ndhwc = CPUSpecificParams{{ndhwc}, {ndhwc}, {}, "ref"}; +/* ========== */ + +/* PARAMS */ +const std::vector netPrecisions = { + ov::element::f32, + ov::element::bf16, + ov::element::i32, + ov::element::i8 +}; + +const std::vector> staticInputShapes4D = { + { + {{}, + { // Static shapes + {2, 16, 3, 4} + } + } + }, + { + {{}, + { // Static shapes + {1, 16, 1, 1} + } + } + } +}; +const std::vector> dynamicInputShapes4D = { + { + { // Origin dynamic shapes + {ov::Dimension(1, 20), ov::Dimension(10, 20), ov::Dimension(1, 20), ov::Dimension(1, 20)}, + { // Dynamic shapes instances + {2, 16, 3, 4}, + {1, 16, 1, 1}, + {1, 16, 2, 3} + } + } + }, + { + { // Origin dynamic shapes + {-1, -1, -1, -1}, + { // Dynamic shapes instances + {3, 15, 5, 7}, + {4, 55, 8, 24} + } + } + } +}; + +const std::vector> staticInputShapes5D = { + { + {{}, + { // Static shapes + {2, 16, 2, 3, 4} + } + } + } +}; +const std::vector> dynamicInputShapes5D = { + { + { // Origin dynamic shapes + {ov::Dimension(1, 20), ov::Dimension(1, 20), ov::Dimension(1, 20), ov::Dimension(1, 20), ov::Dimension(1, 70)}, + { // Dynamic shapes instances + {2, 16, 2, 3, 4}, + {1, 16, 8, 5, 4}, + {8, 1, 2, 3, 64} + } + } + }, + { + { // Origin dynamic shapes + {-1, -1, -1, -1, -1}, + { // Dynamic shapes instances + {2, 16, 2, 3, 4}, + {1, 16, 8, 5, 4}, + {8, 1, 2, 3, 64} + } + } + } +}; + +const std::vector> repeats4D = { + {2, 3}, + {1, 2, 3}, + {1, 1, 1, 1}, + {1, 1, 2, 3}, + {1, 2, 1, 3}, + {2, 1, 1, 1}, + {2, 3, 1, 1} +}; +const std::vector> repeats5D = { + {1, 2, 3}, + {1, 1, 2, 3}, + {1, 1, 1, 2, 3}, + {1, 2, 1, 1, 3}, + {2, 1, 1, 1, 1}, + {2, 3, 1, 1, 1} +}; + +const std::vector CPUParams4D = { + cpuParams_nchw, + cpuParams_nChw16c, + cpuParams_nChw8c, + cpuParams_nhwc, +}; + +const std::vector CPUParams5D = { + cpuParams_ncdhw, + cpuParams_nCdhw16c, + cpuParams_nCdhw8c, + cpuParams_ndhwc, +}; +/* ============= */ + +/* INSTANCES */ +INSTANTIATE_TEST_CASE_P(smoke_StaticShape4D, TileLayerCPUTest, + ::testing::Combine( + ::testing::Combine( + ::testing::ValuesIn(staticInputShapes4D), + ::testing::ValuesIn(repeats4D), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(true), + ::testing::Values(CommonTestUtils::DEVICE_CPU)), + ::testing::ValuesIn(CPUParams4D)), + TileLayerCPUTest::getTestCaseName); + +INSTANTIATE_TEST_CASE_P(smoke_DynamicShape4D, TileLayerCPUTest, + ::testing::Combine( + ::testing::Combine( + ::testing::ValuesIn(dynamicInputShapes4D), + ::testing::ValuesIn(repeats4D), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(true, false), + ::testing::Values(CommonTestUtils::DEVICE_CPU)), + ::testing::Values(CPUSpecificParams{{}, {}, {}, "ref"})), + TileLayerCPUTest::getTestCaseName); + +INSTANTIATE_TEST_CASE_P(smoke_StaticShape5D, TileLayerCPUTest, + ::testing::Combine( + ::testing::Combine( + ::testing::ValuesIn(staticInputShapes5D), + ::testing::ValuesIn(repeats5D), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(true), + ::testing::Values(CommonTestUtils::DEVICE_CPU)), + ::testing::ValuesIn(CPUParams5D)), + TileLayerCPUTest::getTestCaseName); + +INSTANTIATE_TEST_CASE_P(smoke_DynamicShape5D, TileLayerCPUTest, + ::testing::Combine( + ::testing::Combine( + ::testing::ValuesIn(dynamicInputShapes5D), + ::testing::ValuesIn(repeats5D), + ::testing::ValuesIn(netPrecisions), + ::testing::Values(true, false), + ::testing::Values(CommonTestUtils::DEVICE_CPU)), + ::testing::Values(CPUSpecificParams{{}, {}, {}, "ref"})), + TileLayerCPUTest::getTestCaseName); +/* ========= */ + +} // namespace + +} // namespace CPULayerTestsDefinitions diff --git a/inference-engine/tests/functional/plugin/cpu/single_layer_tests/topk.cpp b/inference-engine/tests/functional/plugin/cpu/single_layer_tests/topk.cpp new file mode 100644 index 00000000000..df461039f90 --- /dev/null +++ b/inference-engine/tests/functional/plugin/cpu/single_layer_tests/topk.cpp @@ -0,0 +1,172 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "functional_test_utils/ov_tensor_utils.hpp" +#include "common_test_utils/data_utils.hpp" +#include "test_utils/cpu_test_utils.hpp" + +#include "shared_test_classes/base/ov_subgraph.hpp" +#include "ngraph_functions/builders.hpp" + +using namespace ngraph; +using namespace InferenceEngine; +using namespace CPUTestUtils; +using namespace ov::test; + +namespace CPULayerTestsDefinitions { +using topKParams = std::tuple< + ngraph::element::Type, // data precision + InputShape, // data shape + std::int64_t, // axis + ngraph::opset4::TopK::Mode, + ngraph::opset4::TopK::SortType>; + +class TopKLayerCPUTest : public testing::WithParamInterface, public ov::test::SubgraphBaseTest, public CPUTestsBase { +public: + static std::string getTestCaseName(testing::TestParamInfo obj) { + ngraph::element::Type inputPrecision; + InputShape inputShape; + std::int64_t axis; + ngraph::opset4::TopK::Mode mode; + ngraph::opset4::TopK::SortType sortType; + std::tie(inputPrecision, inputShape, axis, mode, sortType) = obj.param; + + std::ostringstream result; + result << inputPrecision << "_" << "IS=" << CommonTestUtils::partialShape2str({ inputShape.first }) << "_" << "TS=("; + for (const auto& shape : inputShape.second) { + result << CommonTestUtils::vec2str(shape) << "_"; + } + + result << ")_axis=" << axis << "_mode=" << mode << "_sortType=" << sortType; + return result.str(); + } + +protected: + void generate_inputs(const std::vector& targetInputStaticShapes) override { + inputs.clear(); + const auto& funcInputs = function->inputs(); + + ov::runtime::Tensor data_tensor; + const auto& dataPrecision = funcInputs[0].get_element_type(); + const auto& dataShape = targetInputStaticShapes.front(); + if (funcInputs[0].get_element_type().is_real()) { + data_tensor = ov::test::utils::create_and_fill_tensor(dataPrecision, dataShape, 10, 0, 1000); + } else { + data_tensor = ov::test::utils::create_and_fill_tensor(dataPrecision, dataShape); + } + + const auto axis = std::get<2>(this->GetParam()); + const auto& kPrecision = funcInputs[1].get_element_type(); + const auto& kShape = targetInputStaticShapes[1]; + + const size_t startFrom = 1; + const size_t range = targetInputStaticShapes[0][axis] - 1; + const size_t seed = inferRequestNum++; + const auto kTensor = ov::test::utils::create_and_fill_tensor(kPrecision, kShape, range, startFrom, 1, seed); + + inputs.insert({ funcInputs[0].get_node_shared_ptr(), data_tensor }); + inputs.insert({ funcInputs[1].get_node_shared_ptr(), kTensor }); + } + + void SetUp() override { + targetDevice = CommonTestUtils::DEVICE_CPU; + ngraph::element::Type inputPrecision; + InputShape inputShape; + std::int64_t axis; + ngraph::opset4::TopK::Mode mode; + ngraph::opset4::TopK::SortType sortType; + std::tie(inputPrecision, inputShape, axis, mode, sortType) = this->GetParam(); + + inputDynamicShapes = { inputShape.first, {} }; + for (size_t i = 0; i < inputShape.second.size(); ++i) { + targetStaticShapes.push_back({ inputShape.second[i], {} }); + } + + selectedType = makeSelectedTypeStr("ref_any", inputPrecision); + + auto params = ngraph::builder::makeDynamicParams(inputPrecision, { inputDynamicShapes[0] }); + auto k_param = std::make_shared(ngraph::element::i32, inputDynamicShapes[1]); + params.push_back(k_param); + auto topk = std::make_shared(params[0], k_param, axis, mode, sortType); + + ngraph::ResultVector results; + for (size_t i = 0; i < topk->get_output_size(); ++i) { + results.push_back(std::make_shared(topk->output(i))); + } + + function = std::make_shared(results, params, "TopKLayerCPUTest"); + functionRefs = ngraph::clone_function(*function); + } + +private: + size_t inferRequestNum = 0; +}; + +TEST_P(TopKLayerCPUTest, CompareWithRefs) { + SKIP_IF_CURRENT_TEST_IS_DISABLED() + + run(); + CheckPluginRelatedResults(executableNetwork, "TopK"); +} + +const ngraph::element::TypeVector inputPrecisions = { + ngraph::element::f32, +}; + +const std::vector axes = { 0, 1, 2 }; + +const std::vector modes = { + ngraph::opset4::TopK::Mode::MIN, + ngraph::opset4::TopK::Mode::MAX +}; + +const std::vector sortTypes = { + ngraph::opset4::TopK::SortType::SORT_INDICES, + ngraph::opset4::TopK::SortType::SORT_VALUES, +}; + +const std::vector inShapes = { + InputShape{ + // dynamic + {-1, -1, -1}, + // target + { + {10, 13, 11}, + {15, 10, 5}, + {5, 5, 8} + } + }, + InputShape{ + // dynamic + {-1, { 7, 25 }, -1}, + // target + { + {10, 7, 10}, + {15, 20, 5}, + {5, 25, 7} + } + }, + InputShape{ + // dynamic + {{8, 10}, {7, 17}, {12, 27}}, + // target + { + {8, 7, 12}, + {9, 12, 25}, + {10, 17, 27} + } + }, +}; + +const auto testCases = ::testing::Combine( + ::testing::ValuesIn(inputPrecisions), + ::testing::ValuesIn(inShapes), + ::testing::ValuesIn(axes), + ::testing::ValuesIn(modes), + ::testing::ValuesIn(sortTypes) +); + +INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs, TopKLayerCPUTest, testCases, TopKLayerCPUTest::getTestCaseName); + +} // namespace CPULayerTestsDefinitions diff --git a/inference-engine/tests/functional/plugin/cpu/test_utils/cpu_test_utils.cpp b/inference-engine/tests/functional/plugin/cpu/test_utils/cpu_test_utils.cpp index 3af2767bbbc..d92bcdfb1e1 100644 --- a/inference-engine/tests/functional/plugin/cpu/test_utils/cpu_test_utils.cpp +++ b/inference-engine/tests/functional/plugin/cpu/test_utils/cpu_test_utils.cpp @@ -266,11 +266,11 @@ CPUTestsBase::makeCPUInfo(std::vector inFmts, std::vector>(ngraph::MLKDNNInputMemoryFormats(fmts2str(inFmts, "cpu:")))}); + std::make_shared(fmts2str(inFmts, "cpu:"))}); } if (!outFmts.empty()) { cpuInfo.insert({std::string(ngraph::MLKDNNOutputMemoryFormatsAttr), - std::make_shared>(ngraph::MLKDNNOutputMemoryFormats(fmts2str(outFmts, "cpu:")))}); + std::make_shared(fmts2str(outFmts, "cpu:"))}); } if (!priority.empty()) { cpuInfo.insert({"PrimitivesPriority", std::make_shared>(impls2str(priority))}); diff --git a/inference-engine/tests/functional/plugin/cpu/test_utils/cpu_test_utils.hpp b/inference-engine/tests/functional/plugin/cpu/test_utils/cpu_test_utils.hpp index 08c50459baa..b62e5c6c206 100644 --- a/inference-engine/tests/functional/plugin/cpu/test_utils/cpu_test_utils.hpp +++ b/inference-engine/tests/functional/plugin/cpu/test_utils/cpu_test_utils.hpp @@ -116,7 +116,7 @@ namespace CPUTestUtils { class CPUTestsBase { public: - typedef std::map> CPUInfo; + typedef std::map CPUInfo; public: static std::string getTestCaseName(CPUSpecificParams params); diff --git a/inference-engine/tests/functional/plugin/gna/pass_tests/remove_permutations_NHWC_to_NCHW_pass.cpp b/inference-engine/tests/functional/plugin/gna/pass_tests/remove_permutations_NHWC_to_NCHW_pass.cpp index 5366f4c8ee6..379cbffdf01 100644 --- a/inference-engine/tests/functional/plugin/gna/pass_tests/remove_permutations_NHWC_to_NCHW_pass.cpp +++ b/inference-engine/tests/functional/plugin/gna/pass_tests/remove_permutations_NHWC_to_NCHW_pass.cpp @@ -36,9 +36,65 @@ typedef std::tuple< namespace LayerTestsDefinitions { -std::vector GetKernelShape(size_t height, size_t width, size_t kernel_size) { - return (height == 1 ? std::vector{1, kernel_size} : - (width == 1 ? std::vector{kernel_size, 1} : std::vector{kernel_size, kernel_size})); +std::vector GetKernelShape(std::vector input_shape, size_t kernel_size, bool output_1d = false) { + if (input_shape.size() == 3) { + return output_1d ? std::vector{input_shape.back()} : std::vector{kernel_size}; + } + + if (output_1d) { + return std::vector{input_shape[1], input_shape[2]}; + } + + return (input_shape[1] == 1 ? std::vector{1, kernel_size} : + (input_shape[2] == 1 ? std::vector{kernel_size, 1} : std::vector{kernel_size, kernel_size})); +} + +std::shared_ptr CreateTranspose(std::shared_ptr input, size_t shape_size, + bool before_conv) { + std::vector permute_order; + if (before_conv) { + permute_order = shape_size == 4 ? std::vector{ 0, 3, 1, 2 } : std::vector{ 0, 2, 1 }; + } else { + permute_order = shape_size == 4 ? std::vector{ 0, 2, 3, 1 } : std::vector{ 0, 2, 1 }; + } + return std::make_shared(input, + ngraph::opset1::Constant::create(ngraph::element::i64, ngraph::Shape{ shape_size }, permute_order)); +} + +ngraph::Shape GetLayerTransposedOutputShape(std::shared_ptr layer) { + auto out_shape = layer->get_output_shape(0); + auto perm = out_shape.size() == 4 ? std::vector{0, 2, 3, 1} : std::vector{0, 2, 1}; + std::vector nhwc_out_shape; + std::transform(std::begin(perm), std::end(perm), std::back_inserter(nhwc_out_shape), + [out_shape](int i) { return out_shape[i]; }); + return nhwc_out_shape; +} + +std::shared_ptr CreateConvolution(std::shared_ptr input, + const ov::element::Type& ngPrc, + const std::vector &input_shape, + bool output1D = false, + bool withPool = false, + bool withActivation = false) { + const size_t num_out_channels = 12; + auto kernel_shape = GetKernelShape(input_shape, 8, output1D); + size_t filter_total_size = num_out_channels * input_shape.back() * + std::accumulate(std::begin(kernel_shape), std::end(kernel_shape), 1, std::multiplies()); + const std::vector filter_weights = CommonTestUtils::generate_float_numbers(filter_total_size, -0.01f, 0.01f); + const auto shape_size = input_shape.size(); + auto conv = ngraph::builder::makeConvolution(input, ngPrc, kernel_shape, std::vector(shape_size - 2, 1), + std::vector(shape_size - 2, 0l), std::vector(shape_size - 2, 0l), + std::vector(shape_size - 2, 1), ngraph::op::PadType::VALID, num_out_channels, false, filter_weights); + + if (!withPool) { + return conv; + } + + auto pool_kernal_shape = GetKernelShape(GetLayerTransposedOutputShape(conv), 2, false); + auto pool = ngraph::builder::makePooling(conv, pool_kernal_shape, std::vector(shape_size - 2, 0), + std::vector(shape_size - 2, 0), pool_kernal_shape, ngraph::op::RoundingType::FLOOR, + ngraph::op::PadType::VALID, false, ngraph::helpers::PoolingTypes::MAX); + return withActivation ? std::make_shared(pool) : pool; } class RemovePermutationsNHWCToNCHWPassTest : public testing::WithParamInterface, @@ -80,25 +136,19 @@ class RemovePermutationsNHWCToNCHWPassTest : public testing::WithParamInterface< std::tie(netPrecision, targetDevice, configuration, inputShape, output1D) = this->GetParam(); auto ngPrc = FuncTestUtils::PrecisionUtils::convertIE2nGraphPrc(netPrecision); + size_t shape_size = inputShape.size(); + ASSERT_GT(shape_size, 2); + ASSERT_LT(shape_size, 5); size_t in_total_dims_size = std::accumulate(std::begin(inputShape), std::end(inputShape), 1, std::multiplies()); auto params = ngraph::builder::makeParams(ngPrc, { {1, in_total_dims_size} }); - auto pattern1 = std::make_shared(ngraph::element::Type_t::i64, ngraph::Shape{ 4 }, inputShape); + auto pattern1 = std::make_shared(ngraph::element::Type_t::i64, + ngraph::Shape{ shape_size }, inputShape); auto reshape1 = std::make_shared(params[0], pattern1, false); - auto permute1 = std::make_shared(reshape1, - ngraph::opset1::Constant::create(ngraph::element::i64, ngraph::Shape{ 4 }, { 0, 3, 1, 2 })); - size_t num_out_channels = 12; - auto kernel_shape = output1D ? ngraph::Shape{inputShape[1], inputShape[2]} : - GetKernelShape(inputShape[1], inputShape[2], 8); - std::vector filter_weights = CommonTestUtils::generate_float_numbers(num_out_channels * inputShape[3] * - kernel_shape[0] * kernel_shape[1], - -0.2f, 0.2f); - auto conv = ngraph::builder::makeConvolution(permute1, ngPrc, kernel_shape, { 1, 1 }, { 0, 0 }, { 0, 0 }, { 1, 1 }, - ngraph::op::PadType::VALID, num_out_channels, false, filter_weights); - - auto permute2 = std::make_shared(conv, - ngraph::opset1::Constant::create(ngraph::element::i64, ngraph::Shape{ 4 }, { 0, 2, 3, 1 })); + auto permute1 = CreateTranspose(reshape1, shape_size, true); + auto conv = CreateConvolution(permute1, ngPrc, inputShape, output1D); + auto permute2 = CreateTranspose(conv, shape_size, false); auto conv_out_size = std::accumulate(std::begin(conv->get_output_shape(0)), std::end(conv->get_output_shape(0)), size_t(1), std::multiplies()); @@ -111,7 +161,7 @@ class RemovePermutationsNHWCToNCHWPassTest : public testing::WithParamInterface< } }; -class RemovePermutationsNHWCToNCHWPass4DOutputTest : public testing::WithParamInterface, +class RemovePermutationsNHWCToNCHWPassNoReshapesTest : public testing::WithParamInterface, public LayerTestsUtils::LayerTestsCommon { public: static std::string getTestCaseName(testing::TestParamInfo obj) { @@ -138,19 +188,18 @@ protected: std::tie(netPrecision, targetDevice, configuration, inputShape) = this->GetParam(); auto ngPrc = FuncTestUtils::PrecisionUtils::convertIE2nGraphPrc(netPrecision); + size_t shape_size = inputShape.size(); + ASSERT_GT(shape_size, 2); + ASSERT_LT(shape_size, 5); + auto params = ngraph::builder::makeParams(ngPrc, { inputShape }); - auto permute1 = std::make_shared(params[0], - ngraph::opset1::Constant::create(ngraph::element::i64, ngraph::Shape{ 4 }, { 0, 3, 1, 2 })); - - auto kernel_shape = GetKernelShape(inputShape[1], inputShape[2], 8); - auto conv1 = ngraph::builder::makeConvolution(permute1, ngPrc, kernel_shape, { 1, 1 }, { 0, 0 }, { 0, 0 }, { 1, 1 }, ngraph::op::PadType::VALID, 12); - - auto permute2 = std::make_shared(conv1, - ngraph::opset1::Constant::create(ngraph::element::i64, ngraph::Shape{ 4 }, { 0, 2, 3, 1 })); + auto permute1 = CreateTranspose(params[0], shape_size, true); + auto conv = CreateConvolution(permute1, ngPrc, inputShape); + auto permute2 = CreateTranspose(conv, shape_size, false); ngraph::ResultVector results{ std::make_shared(permute2) }; - function = std::make_shared(results, params, "RemovePermutationPass4DOutput"); + function = std::make_shared(results, params, "RemovePermutationPassNoReshapes"); } }; @@ -209,39 +258,24 @@ class RemovePermutationsWithPoolAndActTest : public testing::WithParamInterface< std::tie(netPrecision, targetDevice, configuration, inputShape, withActivation) = this->GetParam(); auto ngPrc = FuncTestUtils::PrecisionUtils::convertIE2nGraphPrc(netPrecision); + size_t shape_size = inputShape.size(); + ASSERT_GT(shape_size, 2); + ASSERT_LT(shape_size, 5); + size_t in_total_dims_size = std::accumulate(std::begin(inputShape), std::end(inputShape), 1, std::multiplies()); auto params = ngraph::builder::makeParams(ngPrc, { {1, in_total_dims_size} }); - auto pattern1 = std::make_shared(ngraph::element::Type_t::i64, ngraph::Shape{ 4 }, inputShape); + auto pattern1 = std::make_shared(ngraph::element::Type_t::i64, ngraph::Shape{ shape_size }, inputShape); auto reshape1 = std::make_shared(params[0], pattern1, false); - auto permute1 = std::make_shared(reshape1, - ngraph::opset1::Constant::create(ngraph::element::i64, ngraph::Shape{ 4 }, { 0, 3, 1, 2 })); - size_t num_out_channels = 12; - auto kernel_shape = GetKernelShape(inputShape[1], inputShape[2], 8); - std::vector filter_weights = CommonTestUtils::generate_float_numbers(num_out_channels * inputShape[3] * - kernel_shape[0] * kernel_shape[1], - -0.2f, 0.2f); - auto conv1 = ngraph::builder::makeConvolution(permute1, ngPrc, kernel_shape, { 1, 1 }, { 0, 0 }, { 0, 0 }, { 1, 1 }, - ngraph::op::PadType::VALID, num_out_channels, false, filter_weights); - auto pool_kernal_shape = (inputShape[1] == 1 ? std::vector{1, 2} : std::vector{2, 1}); - auto pool = ngraph::builder::makePooling(conv1, pool_kernal_shape, {0, 0}, {0, 0}, pool_kernal_shape, ngraph::op::RoundingType::FLOOR, - ngraph::op::PadType::VALID, false, ngraph::helpers::PoolingTypes::MAX); + auto permute1 = CreateTranspose(reshape1, shape_size, true); + auto conv = CreateConvolution(permute1, ngPrc, inputShape, false, true, true); + auto permute2 = CreateTranspose(conv, shape_size, false); - size_t out_width = ((inputShape[2] - kernel_shape[1]) + 1) / pool_kernal_shape[1]; - size_t out_height = ((inputShape[1] - kernel_shape[0]) + 1) / pool_kernal_shape[0]; - - auto pool_output = pool; - if (withActivation) { - auto relu2 = std::make_shared(pool); - pool_output = relu2; - } - - auto permute2 = std::make_shared(pool_output, - ngraph::opset1::Constant::create(ngraph::element::i64, ngraph::Shape{ 4 }, { 0, 2, 3, 1 })); - - std::vector outFormShapes = { 1, out_width * out_height * num_out_channels }; - auto pattern2 = std::make_shared(ngraph::element::Type_t::i64, ngraph::Shape{ 2 }, outFormShapes); + auto conv_out_size = std::accumulate(std::begin(conv->get_output_shape(0)), std::end(conv->get_output_shape(0)), + size_t(1), std::multiplies()); + auto pattern2 = std::make_shared(ngraph::element::Type_t::i64, + ngraph::Shape{ 2 }, ngraph::Shape{ 1, conv_out_size }); auto reshape2 = std::make_shared(permute2, pattern2, false); ngraph::ResultVector results{ std::make_shared(reshape2) }; @@ -299,39 +333,25 @@ class RemovePermutationsWithTwoConvTest : public testing::WithParamInterfaceGetParam(); auto ngPrc = FuncTestUtils::PrecisionUtils::convertIE2nGraphPrc(netPrecision); + size_t shape_size = inputShape.size(); + ASSERT_GT(shape_size, 2); + ASSERT_LT(shape_size, 5); + size_t in_total_dims_size = std::accumulate(std::begin(inputShape), std::end(inputShape), 1, std::multiplies()); auto params = ngraph::builder::makeParams(ngPrc, { {1, in_total_dims_size} }); - auto pattern1 = std::make_shared(ngraph::element::Type_t::i64, ngraph::Shape{ 4 }, inputShape); + auto pattern1 = std::make_shared(ngraph::element::Type_t::i64, ngraph::Shape{ shape_size }, inputShape); auto reshape1 = std::make_shared(params[0], pattern1, false); - auto permute1 = std::make_shared(reshape1, - ngraph::opset1::Constant::create(ngraph::element::i64, ngraph::Shape{ 4 }, { 0, 3, 1, 2 })); - size_t num_out_channels = 12; - size_t kernel_size = 8; - auto kernel_shape1 = GetKernelShape(inputShape[1], inputShape[2], kernel_size); - std::vector filter_weights_1 = CommonTestUtils::generate_float_numbers(num_out_channels * inputShape[3] * - kernel_shape1[0] * kernel_shape1[1], - 0.0f, 0.5f); - auto conv1 = ngraph::builder::makeConvolution(permute1, ngPrc, kernel_shape1, { 1, 1 }, { 0, 0 }, { 0, 0 }, { 1, 1 }, - ngraph::op::PadType::VALID, num_out_channels, false, filter_weights_1); - size_t out_width = conv1->get_output_shape(0).at(3); - size_t out_height = conv1->get_output_shape(0).at(2); + auto permute1 = CreateTranspose(reshape1, shape_size, true); + auto conv1 = CreateConvolution(permute1, ngPrc, inputShape); + auto conv2 = CreateConvolution(conv1, ngPrc, GetLayerTransposedOutputShape(conv1)); + auto permute2 = CreateTranspose(conv2, shape_size, false); - std::vector kernel_shape2 = (out_height == 1 ? std::vector{1, kernel_size} : std::vector{kernel_size, 1}); - std::vector filter_weights_2 = CommonTestUtils::generate_float_numbers(num_out_channels * num_out_channels * - kernel_size, - -0.2f, 0.2f); - auto conv2 = ngraph::builder::makeConvolution(conv1, ngPrc, kernel_shape2, { 1, 1 }, { 0, 0 }, { 0, 0 }, { 1, 1 }, - ngraph::op::PadType::VALID, num_out_channels, false, filter_weights_2); - out_width = conv2->get_output_shape(0).at(3); - out_height = conv2->get_output_shape(0).at(2); - - auto permute2 = std::make_shared(conv2, - ngraph::opset1::Constant::create(ngraph::element::i64, ngraph::Shape{ 4 }, { 0, 2, 3, 1 })); - - std::vector outFormShapes = { 1, out_width * out_height * num_out_channels }; - auto pattern2 = std::make_shared(ngraph::element::Type_t::i64, ngraph::Shape{ 2 }, outFormShapes); + auto conv_out_size = std::accumulate(std::begin(conv2->get_output_shape(0)), std::end(conv2->get_output_shape(0)), + size_t(1), std::multiplies()); + auto pattern2 = std::make_shared(ngraph::element::Type_t::i64, + ngraph::Shape{ 2 }, ngraph::Shape{ 1, conv_out_size }); auto reshape2 = std::make_shared(permute2, pattern2, false); ngraph::ResultVector results{ std::make_shared(reshape2) }; @@ -390,46 +410,35 @@ class RemovePermutationsWithEltwiseTest : public testing::WithParamInterfaceGetParam(); auto ngPrc = FuncTestUtils::PrecisionUtils::convertIE2nGraphPrc(netPrecision); + size_t shape_size = inputShape.size(); + ASSERT_GT(shape_size, 2); + ASSERT_LT(shape_size, 5); + size_t in_total_dims_size = std::accumulate(std::begin(inputShape), std::end(inputShape), 1, std::multiplies()); auto params = ngraph::builder::makeParams(ngPrc, { {1, 2 * in_total_dims_size} }); auto split = ngraph::builder::makeSplit(params[0], ngPrc, 2, 1); - auto in_width = inputShape[2]; - auto in_height = inputShape[1]; - auto in_channels = inputShape[3]; - auto pattern1 = std::make_shared(ngraph::element::Type_t::i64, ngraph::Shape{ 4 }, inputShape); + auto pattern1 = std::make_shared(ngraph::element::Type_t::i64, + ngraph::Shape{ shape_size }, inputShape); auto reshape1 = std::make_shared(split->output(0), pattern1, false); - auto permute1 = std::make_shared(reshape1, - ngraph::opset1::Constant::create(ngraph::element::i64, ngraph::Shape{ 4 }, { 0, 3, 1, 2 })); - size_t num_out_channels = 12; - auto kernel_shape = GetKernelShape(inputShape[1], inputShape[2], 8); - std::vector filter_weights_1 = CommonTestUtils::generate_float_numbers(num_out_channels * in_channels * - kernel_shape[0] * kernel_shape[1], - -0.2f, 0.2f); - auto conv1 = ngraph::builder::makeConvolution(permute1, ngPrc, kernel_shape, { 1, 1 }, { 0, 0 }, { 0, 0 }, { 1, 1 }, - ngraph::op::PadType::VALID, num_out_channels, false, filter_weights_1); + auto permute1 = CreateTranspose(reshape1, shape_size, true); + auto conv1 = CreateConvolution(permute1, ngPrc, inputShape); - auto pattern2 = std::make_shared(ngraph::element::Type_t::i64, ngraph::Shape{ 4 }, inputShape); + auto pattern2 = std::make_shared(ngraph::element::Type_t::i64, + ngraph::Shape{ shape_size }, inputShape); auto reshape2 = std::make_shared(split->output(1), pattern2, false); - auto permute2 = std::make_shared(reshape2, - ngraph::opset1::Constant::create(ngraph::element::i64, ngraph::Shape{ 4 }, { 0, 3, 1, 2 })); - std::vector filter_weights_2 = CommonTestUtils::generate_float_numbers(num_out_channels * in_channels * - kernel_shape[0] * kernel_shape[1], - -0.2f, 0.2f); - auto conv2 = ngraph::builder::makeConvolution(permute2, ngPrc, kernel_shape, { 1, 1 }, { 0, 0 }, { 0, 0 }, { 1, 1 }, - ngraph::op::PadType::VALID, num_out_channels, false, filter_weights_2); + auto permute2 = CreateTranspose(reshape2, shape_size, true); + auto conv2 = CreateConvolution(permute2, ngPrc, inputShape); auto add = std::make_shared(conv1, conv2); + auto permute3 = CreateTranspose(add, add->get_output_shape(0).size(), false); - auto permute3 = std::make_shared(add, - ngraph::opset1::Constant::create(ngraph::element::i64, ngraph::Shape{ 4 }, { 0, 2, 3, 1 })); - - size_t out_width = ((in_width - kernel_shape[1]) + 1); - size_t out_height = ((in_height - kernel_shape[0]) + 1); - std::vector outFormShapes = { 1, out_width * out_height * num_out_channels }; - auto pattern3 = std::make_shared(ngraph::element::Type_t::i64, ngraph::Shape{ 2 }, outFormShapes); + auto conv_out_size = std::accumulate(std::begin(add->get_output_shape(0)), std::end(add->get_output_shape(0)), + size_t(1), std::multiplies()); + auto pattern3 = std::make_shared(ngraph::element::Type_t::i64, + ngraph::Shape{ 2 }, ngraph::Shape{ 1, conv_out_size }); auto reshape3 = std::make_shared(permute3, pattern3, false); ngraph::ResultVector results{ std::make_shared(reshape3) }; @@ -441,7 +450,7 @@ class RemovePermutationsWithEltwiseTest : public testing::WithParamInterface{false, true})), // with 1d output of convolution RemovePermutationsNHWCToNCHWPassTest::getTestCaseName); - INSTANTIATE_TEST_SUITE_P(smoke_PermutationPass, RemovePermutationsNHWCToNCHWPass4DOutputTest, + INSTANTIATE_TEST_SUITE_P(smoke_PermutationPass, RemovePermutationsNHWCToNCHWPassNoReshapesTest, ::testing::Combine( ::testing::ValuesIn(netPrecisions), ::testing::Values(CommonTestUtils::DEVICE_GNA), ::testing::ValuesIn(configs), ::testing::ValuesIn(inputShapes)), - RemovePermutationsNHWCToNCHWPass4DOutputTest::getTestCaseName); + RemovePermutationsNHWCToNCHWPassNoReshapesTest::getTestCaseName); INSTANTIATE_TEST_SUITE_P(smoke_PermutationPass, RemovePermutationsWithPoolAndActTest, ::testing::Combine( diff --git a/inference-engine/tests/functional/plugin/gna/shared_tests_instances/subgraph_tests/split_concat_multi_inputs.cpp b/inference-engine/tests/functional/plugin/gna/shared_tests_instances/subgraph_tests/split_concat_multi_inputs.cpp new file mode 100644 index 00000000000..f1b9e3f6272 --- /dev/null +++ b/inference-engine/tests/functional/plugin/gna/shared_tests_instances/subgraph_tests/split_concat_multi_inputs.cpp @@ -0,0 +1,46 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include + +#include "subgraph_tests/split_concat_multi_inputs.hpp" +#include "common_test_utils/test_constants.hpp" +#include "gna/gna_config.hpp" + +using namespace SubgraphTestsDefinitions; + +namespace { +std::vector precisions = {InferenceEngine::Precision::FP32, + InferenceEngine::Precision::FP16}; + +std::vector> additionalConfig = { + { + {"GNA_DEVICE_MODE", "GNA_SW_FP32"} + }, + { + {"GNA_DEVICE_MODE", "GNA_SW_EXACT"} + } +}; + +std::vector> inputShapes = { + {1, 10}, + {1, 50}, + {1, 32}, + {1, 512} +}; + +std::vector splitsNum = {2, 3, 4, 10}; + +std::vector isFc = {false, true}; + +INSTANTIATE_TEST_SUITE_P(smoke_splitConcatMultiInputs, SplitConcatMultiInputsTest, + ::testing::Combine( + ::testing::ValuesIn(precisions), + ::testing::Values(CommonTestUtils::DEVICE_GNA), + ::testing::ValuesIn(additionalConfig), + ::testing::ValuesIn(inputShapes), + ::testing::ValuesIn(splitsNum), + ::testing::ValuesIn(isFc)), + SplitConcatMultiInputsTest::getTestCaseName); +} // namespace \ No newline at end of file diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/behavior/ov_plugin/core_integration.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/behavior/ov_plugin/core_integration.cpp index 12cc9381901..2ed71181c73 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/behavior/ov_plugin/core_integration.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/behavior/ov_plugin/core_integration.cpp @@ -76,7 +76,7 @@ INSTANTIATE_TEST_SUITE_P(nightly_OVClassGetAvailableDevices, OVClassGetAvailable using OVClassGetMetricTest_GPU_DEVICE_TOTAL_MEM_SIZE = OVClassBaseTestP; TEST_P(OVClassGetMetricTest_GPU_DEVICE_TOTAL_MEM_SIZE, GetMetricAndPrintNoThrow) { ov::runtime::Core ie; - ov::runtime::Parameter p; + ov::Any p; ASSERT_NO_THROW(p = ie.get_metric(deviceName, GPU_METRIC_KEY(DEVICE_TOTAL_MEM_SIZE))); uint64_t t = p; @@ -93,7 +93,7 @@ INSTANTIATE_TEST_SUITE_P(nightly_OVClassGetMetricTest, using OVClassGetMetricTest_GPU_UARCH_VERSION = OVClassBaseTestP; TEST_P(OVClassGetMetricTest_GPU_UARCH_VERSION, GetMetricAndPrintNoThrow) { ov::runtime::Core ie; - ov::runtime::Parameter p; + ov::Any p; ASSERT_NO_THROW(p = ie.get_metric(deviceName, GPU_METRIC_KEY(UARCH_VERSION))); std::string t = p; @@ -109,7 +109,7 @@ INSTANTIATE_TEST_SUITE_P(nightly_OVClassGetMetricTest, using OVClassGetMetricTest_GPU_EXECUTION_UNITS_COUNT = OVClassBaseTestP; TEST_P(OVClassGetMetricTest_GPU_EXECUTION_UNITS_COUNT, GetMetricAndPrintNoThrow) { ov::runtime::Core ie; - ov::runtime::Parameter p; + ov::Any p; ASSERT_NO_THROW(p = ie.get_metric(deviceName, GPU_METRIC_KEY(EXECUTION_UNITS_COUNT))); int t = p; diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/behavior/plugin/config.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/behavior/plugin/config.cpp index 006d1aaeb7f..d46d0e3cc6f 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/behavior/plugin/config.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/behavior/plugin/config.cpp @@ -63,6 +63,8 @@ namespace { {InferenceEngine::PluginConfigParams::KEY_TUNING_MODE, "TUNING_UNKNOWN_MODE"}}, {{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_GPU}, {InferenceEngine::PluginConfigParams::KEY_DEVICE_ID, "DEVICE_UNKNOWN"}}, + {{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_CPU}, + {InferenceEngine::PluginConfigParams::KEY_LOG_LEVEL, "NAN"}}, {{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_GPU + std::string(",") + CommonTestUtils::DEVICE_CPU}, {InferenceEngine::PluginConfigParams::KEY_PERFORMANCE_HINT, "DOESN'T EXIST"}}, @@ -84,7 +86,10 @@ namespace { {InferenceEngine::PluginConfigParams::KEY_TUNING_MODE, "TUNING_UNKNOWN_MODE"}}, {{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_GPU + std::string(",") + CommonTestUtils::DEVICE_CPU}, - {InferenceEngine::PluginConfigParams::KEY_DEVICE_ID, "DEVICE_UNKNOWN"}} + {InferenceEngine::PluginConfigParams::KEY_DEVICE_ID, "DEVICE_UNKNOWN"}}, + {{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , + CommonTestUtils::DEVICE_GPU + std::string(",") + CommonTestUtils::DEVICE_CPU}, + {InferenceEngine::PluginConfigParams::KEY_LOG_LEVEL, "NAN"}} }; IE_SUPPRESS_DEPRECATED_END @@ -178,7 +183,25 @@ namespace { {{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_GPU + std::string(",") + CommonTestUtils::DEVICE_CPU}, {InferenceEngine::PluginConfigParams::KEY_PERFORMANCE_HINT, InferenceEngine::PluginConfigParams::LATENCY}, - {InferenceEngine::PluginConfigParams::KEY_PERFORMANCE_HINT_NUM_REQUESTS, "1"}} + {InferenceEngine::PluginConfigParams::KEY_PERFORMANCE_HINT_NUM_REQUESTS, "1"}}, + {{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , + CommonTestUtils::DEVICE_GPU + std::string(",") + CommonTestUtils::DEVICE_CPU}, + {InferenceEngine::PluginConfigParams::KEY_LOG_LEVEL, InferenceEngine::PluginConfigParams::LOG_NONE}}, + {{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , + CommonTestUtils::DEVICE_GPU + std::string(",") + CommonTestUtils::DEVICE_CPU}, + {InferenceEngine::PluginConfigParams::KEY_LOG_LEVEL, InferenceEngine::PluginConfigParams::LOG_ERROR}}, + {{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , + CommonTestUtils::DEVICE_GPU + std::string(",") + CommonTestUtils::DEVICE_CPU}, + {InferenceEngine::PluginConfigParams::KEY_LOG_LEVEL, InferenceEngine::PluginConfigParams::LOG_WARNING}}, + {{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , + CommonTestUtils::DEVICE_GPU + std::string(",") + CommonTestUtils::DEVICE_CPU}, + {InferenceEngine::PluginConfigParams::KEY_LOG_LEVEL, InferenceEngine::PluginConfigParams::LOG_INFO}}, + {{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , + CommonTestUtils::DEVICE_GPU + std::string(",") + CommonTestUtils::DEVICE_CPU}, + {InferenceEngine::PluginConfigParams::KEY_LOG_LEVEL, InferenceEngine::PluginConfigParams::LOG_DEBUG}}, + {{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , + CommonTestUtils::DEVICE_GPU + std::string(",") + CommonTestUtils::DEVICE_CPU}, + {InferenceEngine::PluginConfigParams::KEY_LOG_LEVEL, InferenceEngine::PluginConfigParams::LOG_TRACE}} }; INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, DefaultValuesConfigTests, diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/group_convolution_transformation.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/group_convolution_transformation.cpp index 3543e311e89..dae65e7730d 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/group_convolution_transformation.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/group_convolution_transformation.cpp @@ -17,16 +17,17 @@ const std::vector netPrecisions = { const std::vector trasformationParamValues = { LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParams(), - // LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParams().setUpdatePrecisions(false), }; const std::vector addPrecisionPreserved = { true, false }; +const std::vector> inputShapes = { + {{ 1, 6, 24, 24 }, { 1, 24, 18, 18 }} +}; + const std::vector params = { // group convolution, tensor quantization { - { 1, 6, 24, 24 }, - ngraph::Shape{ 1, 24, 18, 18 }, 3ul, -1, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 25.5f }, { 0.f }, { 25.5f } }, @@ -36,8 +37,6 @@ const std::vector pa }, // group convolution, tensor quantization { - { 1, 6, 24, 24 }, - ngraph::Shape{ 1, 24, 18, 18 }, 3ul, 0, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 25.5f }, { 0.f }, { 25.5f } }, @@ -47,8 +46,6 @@ const std::vector pa }, // group convolution, tensor quantization { - { 1, 6, 24, 24 }, - ngraph::Shape{ 1, 24, 18, 18 }, 3ul, 1, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 25.5f }, { 0.f }, { 25.5f } }, @@ -58,8 +55,6 @@ const std::vector pa }, // group convolution, per-channel quantization { - { 1, 6, 24, 24 }, - ngraph::Shape{ 1, 24, 18, 18 }, 3ul, -1, { @@ -71,11 +66,27 @@ const std::vector pa { 25.5f, 25.5f, 25.5f / 2.f, 25.5f / 2.f, 25.5f / 4.f, 25.5f / 4.f } }, { 255ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 254.f }, { -127.f }, { 127.f } }, - }, + } +}; + +INSTANTIATE_TEST_SUITE_P(smoke_LPT, GroupConvolutionTransformation, + ::testing::Combine( + ::testing::ValuesIn(netPrecisions), + ::testing::Values(CommonTestUtils::DEVICE_GPU), + ::testing::ValuesIn(trasformationParamValues), + ::testing::ValuesIn(inputShapes), + ::testing::ValuesIn(params), + ::testing::ValuesIn(addPrecisionPreserved)), + GroupConvolutionTransformation::getTestCaseName); + +namespace depthwise { +const std::vector> inputShapes = { + {{ 1, 6, 24, 24 }, { 1, 6, 18, 18 }} +}; + +const std::vector params = { // depthwise convolution, tensor quantization { - { 1, 6, 24, 24 }, - ngraph::Shape{ 1, 6, 18, 18 }, 6ul, -1, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 25.5f }, { 0.f }, { 25.5f } }, @@ -83,8 +94,6 @@ const std::vector pa }, // depthwise convolution, per-channel quantization { - { 1, 6, 24, 24 }, - ngraph::Shape{ 1, 6, 18, 18 }, 6ul, -1, { @@ -104,7 +113,9 @@ INSTANTIATE_TEST_SUITE_P(smoke_LPT, GroupConvolutionTransformation, ::testing::ValuesIn(netPrecisions), ::testing::Values(CommonTestUtils::DEVICE_GPU), ::testing::ValuesIn(trasformationParamValues), + ::testing::ValuesIn(inputShapes), ::testing::ValuesIn(params), ::testing::ValuesIn(addPrecisionPreserved)), GroupConvolutionTransformation::getTestCaseName); +} // namespace depthwise } // namespace diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/single_layer_tests/strided_slice.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/single_layer_tests/strided_slice.cpp index 1b4447a75da..a784cc44ced 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/single_layer_tests/strided_slice.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/single_layer_tests/strided_slice.cpp @@ -44,6 +44,8 @@ std::vector ss_only_test_cases_fp32 = { {1, 1, 1, 1}, {1, 1, 1, 1}, {}, {}, {} }, StridedSliceSpecificParams{ { 2, 2, 2, 2 }, { 1, 1, 1, 1 }, { 2, 2, 2, 2 }, { 1, 1, 1, 1 }, {0, 0, 0, 0}, {1, 1, 1, 1}, {}, {}, {} }, + StridedSliceSpecificParams{ { 1, 2, 128, 2 }, { 0, 0, 0, 1 }, { 0, 1, 0, 2 }, { 1, 1, 1, 1 }, + {1, 0, 1, 0}, {1, 0, 1, 0}, {0, 0, 0, 0}, {0, 1, 0, 1}, {0, 0, 0, 0} }, StridedSliceSpecificParams{ { 2, 2, 2, 2 }, { 1, 1, 1, 1 }, { 2, 2, 2, 2 }, { 1, 1, 1, 1 }, {0, 0, 0, 0}, {0, 0, 0, 0}, {}, {}, {} }, StridedSliceSpecificParams{ { 2, 2, 4, 3 }, { 0, 0, 0, 0 }, { 2, 2, 4, 3 }, { 1, 1, 2, 1 }, diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/skip_tests_config.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/skip_tests_config.cpp index e72e81b460d..5e678cb5de4 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/skip_tests_config.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/skip_tests_config.cpp @@ -46,8 +46,6 @@ std::vector disabledTestPatterns() { R"(.*(smoke_DetectionOutput5In).*)", // TODO: Issue: 47773 R"(.*(ProposalLayerTest).*)", - // INT8 StridedSlice not supported - R"(.*(LPT/StridedSliceTransformation).*)", // TODO: Issue: 48106 R"(.*ConstantResultSubgraphTest.*inPrc=I16.*)", // TODO: Issue: 54194 @@ -90,11 +88,11 @@ std::vector disabledTestPatterns() { R"(.*(SoftMaxLayerTest).*)", // TODO: Issue: 68712 R"(.*.MatMul.*CompareWithRefs.*IS0=\(1.5\)_IS1=\(1.5\).*transpose_a=0.*transpose_b=1.*CONSTANT.*FP16.*UNSPECIFIED.*UNSPECIFIED.*ANY.*)", - // TODO: Issue 66685 - R"(smoke_PrePostProcess.*resize_linear_nhwc.*)", // TODO: Issue 69187 R"(smoke_PrePostProcess.*cvt_color_nv12.*)", // TODO: Issue 71215 R"(smoke_PrePostProcess.*cvt_color_i420.*)", + // Unsupported + R"(smoke_Behavior/InferRequestSetBlobByType.setInputBlobsByType/BlobType=Batched_Device=GPU_Config=().*)", }; } diff --git a/inference-engine/tests/functional/plugin/gpu/subgraph_tests/shared_constant.cpp b/inference-engine/tests/functional/plugin/gpu/subgraph_tests/shared_constant.cpp new file mode 100644 index 00000000000..f106acae24f --- /dev/null +++ b/inference-engine/tests/functional/plugin/gpu/subgraph_tests/shared_constant.cpp @@ -0,0 +1,45 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include +#include + +namespace { + +using namespace ngraph; + +// Validate scenario where a single Constant has multiple users (like one constant is used for Convolution, ConvolutionBackpropData, Multiply, etc.) +class SharedConstant : virtual public LayerTestsUtils::LayerTestsCommon { +protected: + void SetUp() override { + targetDevice = CommonTestUtils::DEVICE_GPU; + auto type = element::f32; + Shape constShape{4, 1, 3, 3}; + Shape convInputShape{1, 1, 5, 5}; + Shape convBackpropInputShape{1, 4, 5, 5}; + Shape constGroupConvBackpropShape{2, 2, 3, 3, 3}; + auto constant = opset8::Constant::create(type, constShape, {1}); + auto input1 = std::make_shared(type, convInputShape); + auto conv = std::make_shared(input1, constant, Strides{1, 1}, CoordinateDiff{0, 0}, CoordinateDiff{0, 0}, Strides{1, 1}); + auto input2 = std::make_shared(type, convBackpropInputShape); + auto convBprop = std::make_shared(input2, constant, Strides{1, 1}, + CoordinateDiff{0, 0}, CoordinateDiff{0, 0}, Strides{1, 1}); + auto input3 = std::make_shared(type, convBackpropInputShape); + auto constantGroupConv = opset8::Constant::create(type, constGroupConvBackpropShape, {1}); + auto groupConvBprop = std::make_shared(input3, constantGroupConv, Strides{1, 1}, + CoordinateDiff{0, 0}, CoordinateDiff{0, 0}, Strides{1, 1}); + auto input4 = std::make_shared(type, constShape); + auto mul = std::make_shared(input4, constant); + auto input5 = std::make_shared(type, constGroupConvBackpropShape); + auto mul2 = std::make_shared(input5, constantGroupConv); + function = std::make_shared(NodeVector{convBprop, conv, groupConvBprop, mul2, mul}, + ParameterVector{input1, input2, input3, input4, input5}); + } +}; + +TEST_F(SharedConstant, smoke_SharedConstant) { + Run(); +} + +} // namespace diff --git a/inference-engine/tests/functional/plugin/myriad/shared_tests_instances/behavior/ov_plugin/core_integration.cpp b/inference-engine/tests/functional/plugin/myriad/shared_tests_instances/behavior/ov_plugin/core_integration.cpp index ebb6f9819d7..8f6d3bab139 100644 --- a/inference-engine/tests/functional/plugin/myriad/shared_tests_instances/behavior/ov_plugin/core_integration.cpp +++ b/inference-engine/tests/functional/plugin/myriad/shared_tests_instances/behavior/ov_plugin/core_integration.cpp @@ -37,7 +37,7 @@ TEST_P(OVClassNetworkTestP_VPU_GetMetric, smoke_OptimizationCapabilitiesReturnsF ov::runtime::Core ie; ASSERT_METRIC_SUPPORTED(METRIC_KEY(OPTIMIZATION_CAPABILITIES)) - ov::runtime::Parameter optimizationCapabilitiesParameter; + ov::Any optimizationCapabilitiesParameter; ASSERT_NO_THROW(optimizationCapabilitiesParameter = ie.get_metric(deviceName, METRIC_KEY(OPTIMIZATION_CAPABILITIES))); diff --git a/inference-engine/tests/functional/plugin/myriad/subgraph_tests/lstm_transpose.cpp b/inference-engine/tests/functional/plugin/myriad/subgraph_tests/lstm_transpose.cpp new file mode 100644 index 00000000000..6a7314efb73 --- /dev/null +++ b/inference-engine/tests/functional/plugin/myriad/subgraph_tests/lstm_transpose.cpp @@ -0,0 +1,34 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include +#include + +namespace { + +using namespace ngraph; + +class LSTMTranspose : virtual public LayerTestsUtils::LayerTestsCommon { +protected: + void SetUp() override { + targetDevice = CommonTestUtils::DEVICE_MYRIAD; + + auto X = std::make_shared(element::f32, Shape{1, 26, 64}); + auto hidden_state = std::make_shared(element::f32, Shape{1, 1, 32}); + auto cell_state = std::make_shared(element::f32, Shape{1, 1, 32}); + auto seq_len = opset8::Constant::create(element::i32, Shape{1}, {26}); + auto W = opset8::Constant::create(element::f32, Shape{1, 128, 64}, {1}); + auto R = opset8::Constant::create(element::f32, Shape{1, 128, 32}, {1}); + auto B = opset8::Constant::create(element::f32, Shape{1, 128}, {1}); + auto lstm = std::make_shared(X, hidden_state, cell_state, seq_len, W, R, B, 32, op::RecurrentSequenceDirection::FORWARD); + auto transpose = std::make_shared(lstm->output(0), opset8::Constant::create(element::i32, Shape{4}, {2, 0, 1, 3})); + function = std::make_shared(transpose, ParameterVector{X, hidden_state, cell_state}); + } +}; + +TEST_F(LSTMTranspose, CompareWithRefs) { + Run(); +} + +} // namespace diff --git a/inference-engine/tests/functional/plugin/shared/CMakeLists.txt b/inference-engine/tests/functional/plugin/shared/CMakeLists.txt index 0b44bfe870c..0fc2aab0cb2 100644 --- a/inference-engine/tests/functional/plugin/shared/CMakeLists.txt +++ b/inference-engine/tests/functional/plugin/shared/CMakeLists.txt @@ -9,7 +9,7 @@ set(PUBLIC_HEADERS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include") set(DEPENDENCIES mock_engine) if(ENABLE_HETERO) - list(APPEND DEPENDENCIES HeteroPlugin) + list(APPEND DEPENDENCIES ov_hetero_plugin) endif() if(ENABLE_MULTI) diff --git a/inference-engine/tests/functional/plugin/shared/include/behavior/infer_request/set_blob_by_type.hpp b/inference-engine/tests/functional/plugin/shared/include/behavior/infer_request/set_blob_by_type.hpp index e6162428730..0c6cb85352b 100644 --- a/inference-engine/tests/functional/plugin/shared/include/behavior/infer_request/set_blob_by_type.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/behavior/infer_request/set_blob_by_type.hpp @@ -56,13 +56,13 @@ protected: case FuncTestUtils::BlobType::NV12: return false; case FuncTestUtils::BlobType::Batched: { - const std::vector& supported_metrics = ie->GetMetric(targetDevice, METRIC_KEY(SUPPORTED_METRICS)); + std::vector supported_metrics = ie->GetMetric(targetDevice, METRIC_KEY(SUPPORTED_METRICS)); if (std::find(supported_metrics.begin(), supported_metrics.end(), METRIC_KEY(OPTIMIZATION_CAPABILITIES)) == supported_metrics.end()) { return false; } - const std::vector& optimization_caps = + std::vector optimization_caps = ie->GetMetric(targetDevice, METRIC_KEY(OPTIMIZATION_CAPABILITIES)); return std::find(optimization_caps.begin(), optimization_caps.end(), METRIC_VALUE(BATCHED_BLOB)) != optimization_caps.end(); diff --git a/inference-engine/tests/functional/plugin/shared/include/behavior/ov_executable_network/get_metric.hpp b/inference-engine/tests/functional/plugin/shared/include/behavior/ov_executable_network/get_metric.hpp index 16cbd649aaf..3cd1e7d58f5 100644 --- a/inference-engine/tests/functional/plugin/shared/include/behavior/ov_executable_network/get_metric.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/behavior/ov_executable_network/get_metric.hpp @@ -101,7 +101,7 @@ TEST_P(OVClassImportExportTestP, smoke_ImportNetworkNoThrowWithDeviceName) { // TEST_P(OVClassExecutableNetworkGetMetricTest_SUPPORTED_CONFIG_KEYS, GetMetricNoThrow) { ov::runtime::Core ie = createCoreWithTemplate(); - runtime::Parameter p; + ov::Any p; auto exeNetwork = ie.compile_model(simpleNetwork, deviceName); @@ -119,7 +119,7 @@ TEST_P(OVClassExecutableNetworkGetMetricTest_SUPPORTED_CONFIG_KEYS, GetMetricNoT TEST_P(OVClassExecutableNetworkGetMetricTest_SUPPORTED_METRICS, GetMetricNoThrow) { ov::runtime::Core ie = createCoreWithTemplate(); - runtime::Parameter p; + ov::Any p; auto exeNetwork = ie.compile_model(simpleNetwork, deviceName); @@ -137,7 +137,7 @@ TEST_P(OVClassExecutableNetworkGetMetricTest_SUPPORTED_METRICS, GetMetricNoThrow TEST_P(OVClassExecutableNetworkGetMetricTest_NETWORK_NAME, GetMetricNoThrow) { ov::runtime::Core ie = createCoreWithTemplate(); - runtime::Parameter p; + ov::Any p; auto exeNetwork = ie.compile_model(simpleNetwork, deviceName); @@ -151,7 +151,7 @@ TEST_P(OVClassExecutableNetworkGetMetricTest_NETWORK_NAME, GetMetricNoThrow) { TEST_P(OVClassExecutableNetworkGetMetricTest_OPTIMAL_NUMBER_OF_INFER_REQUESTS, GetMetricNoThrow) { ov::runtime::Core ie = createCoreWithTemplate(); - runtime::Parameter p; + ov::Any p; auto exeNetwork = ie.compile_model(simpleNetwork, deviceName); @@ -165,7 +165,7 @@ TEST_P(OVClassExecutableNetworkGetMetricTest_OPTIMAL_NUMBER_OF_INFER_REQUESTS, G TEST_P(OVClassExecutableNetworkGetMetricTest_ThrowsUnsupported, GetMetricThrow) { ov::runtime::Core ie = createCoreWithTemplate(); - runtime::Parameter p; + ov::Any p; auto exeNetwork = ie.compile_model(simpleNetwork, deviceName); @@ -174,7 +174,7 @@ TEST_P(OVClassExecutableNetworkGetMetricTest_ThrowsUnsupported, GetMetricThrow) TEST_P(OVClassExecutableNetworkGetConfigTest, GetConfigNoThrow) { ov::runtime::Core ie = createCoreWithTemplate(); - runtime::Parameter p; + ov::Any p; auto exeNetwork = ie.compile_model(simpleNetwork, deviceName); @@ -182,7 +182,7 @@ TEST_P(OVClassExecutableNetworkGetConfigTest, GetConfigNoThrow) { std::vector configValues = p; for (auto&& confKey : configValues) { - runtime::Parameter defaultValue; + ov::Any defaultValue; ASSERT_NO_THROW(defaultValue = ie.get_config(deviceName, confKey)); ASSERT_FALSE(defaultValue.empty()); } @@ -190,7 +190,7 @@ TEST_P(OVClassExecutableNetworkGetConfigTest, GetConfigNoThrow) { TEST_P(OVClassExecutableNetworkGetConfigTest, GetConfigThrows) { ov::runtime::Core ie = createCoreWithTemplate(); - runtime::Parameter p; + ov::Any p; auto exeNetwork = ie.compile_model(simpleNetwork, deviceName); @@ -199,7 +199,7 @@ TEST_P(OVClassExecutableNetworkGetConfigTest, GetConfigThrows) { TEST_P(OVClassExecutableNetworkSetConfigTest, SetConfigThrows) { ov::runtime::Core ie = createCoreWithTemplate(); - runtime::Parameter p; + ov::Any p; auto exeNetwork = ie.compile_model(simpleNetwork, deviceName); @@ -208,7 +208,7 @@ TEST_P(OVClassExecutableNetworkSetConfigTest, SetConfigThrows) { TEST_P(OVClassExecutableNetworkSupportedConfigTest, SupportedConfigWorks) { ov::runtime::Core ie = createCoreWithTemplate(); - runtime::Parameter p; + ov::Any p; auto exeNetwork = ie.compile_model(simpleNetwork, deviceName); @@ -227,7 +227,7 @@ TEST_P(OVClassExecutableNetworkUnsupportedConfigTest, UnsupportedConfigThrows) { TEST_P(OVClassExecutableNetworkGetConfigTest, GetConfigNoEmptyNoThrow) { ov::runtime::Core ie = createCoreWithTemplate(); - runtime::Parameter p; + ov::Any p; ASSERT_NO_THROW(p = ie.get_metric(deviceName, METRIC_KEY(SUPPORTED_CONFIG_KEYS))); std::vector devConfigValues = p; @@ -241,15 +241,15 @@ TEST_P(OVClassExecutableNetworkGetConfigTest, GetConfigNoEmptyNoThrow) { for (auto && configKey : devConfigValues) { ASSERT_NE(execConfigValues.end(), std::find(execConfigValues.begin(), execConfigValues.end(), configKey)); - runtime::Parameter configValue; - ASSERT_NO_THROW(Parameter configValue = exeNetwork.get_config(configKey)); + ov::Any configValue; + ASSERT_NO_THROW(ov::Any configValue = exeNetwork.get_config(configKey)); } */ } TEST_P(OVClassHeteroExecutableNetworkGetMetricTest_SUPPORTED_CONFIG_KEYS, GetMetricNoThrow) { ov::runtime::Core ie = createCoreWithTemplate(); - runtime::Parameter pHetero, pDevice; + ov::Any pHetero, pDevice; auto heteroExeNetwork = ie.compile_model(actualNetwork, heteroDeviceName); auto deviceExeNetwork = ie.compile_model(actualNetwork, deviceName); @@ -270,8 +270,8 @@ TEST_P(OVClassHeteroExecutableNetworkGetMetricTest_SUPPORTED_CONFIG_KEYS, GetMet auto it = std::find(heteroConfigValues.begin(), heteroConfigValues.end(), deviceConf); ASSERT_TRUE(it != heteroConfigValues.end()); - runtime::Parameter heteroConfigValue = heteroExeNetwork.get_config(deviceConf); - runtime::Parameter deviceConfigValue = deviceExeNetwork.get_config(deviceConf); + ov::Any heteroConfigValue = heteroExeNetwork.get_config(deviceConf); + ov::Any deviceConfigValue = deviceExeNetwork.get_config(deviceConf); // HETERO returns EXCLUSIVE_ASYNC_REQUESTS as a boolean value if (CONFIG_KEY(EXCLUSIVE_ASYNC_REQUESTS) != deviceConf) { @@ -282,7 +282,7 @@ TEST_P(OVClassHeteroExecutableNetworkGetMetricTest_SUPPORTED_CONFIG_KEYS, GetMet TEST_P(OVClassHeteroExecutableNetworkGetMetricTest_SUPPORTED_METRICS, GetMetricNoThrow) { ov::runtime::Core ie = createCoreWithTemplate(); - runtime::Parameter pHetero, pDevice; + ov::Any pHetero, pDevice; auto heteroExeNetwork = ie.compile_model(actualNetwork, heteroDeviceName); auto deviceExeNetwork = ie.compile_model(actualNetwork, deviceName); @@ -306,8 +306,8 @@ TEST_P(OVClassHeteroExecutableNetworkGetMetricTest_SUPPORTED_METRICS, GetMetricN auto it = std::find(heteroMetricValues.begin(), heteroMetricValues.end(), deviceMetricName); ASSERT_TRUE(it != heteroMetricValues.end()); - runtime::Parameter heteroMetricValue = heteroExeNetwork.get_metric(deviceMetricName); - runtime::Parameter deviceMetricValue = deviceExeNetwork.get_metric(deviceMetricName); + ov::Any heteroMetricValue = heteroExeNetwork.get_metric(deviceMetricName); + ov::Any deviceMetricValue = deviceExeNetwork.get_metric(deviceMetricName); if (std::find(heteroSpecificMetrics.begin(), heteroSpecificMetrics.end(), deviceMetricName) == heteroSpecificMetrics.end()) { @@ -318,7 +318,7 @@ TEST_P(OVClassHeteroExecutableNetworkGetMetricTest_SUPPORTED_METRICS, GetMetricN TEST_P(OVClassHeteroExecutableNetworkGetMetricTest_NETWORK_NAME, GetMetricNoThrow) { ov::runtime::Core ie = createCoreWithTemplate(); - runtime::Parameter p; + ov::Any p; auto exeNetwork = ie.compile_model(actualNetwork, heteroDeviceName); @@ -330,7 +330,7 @@ TEST_P(OVClassHeteroExecutableNetworkGetMetricTest_NETWORK_NAME, GetMetricNoThro TEST_P(OVClassHeteroExecutableNetworkGetMetricTest_TARGET_FALLBACK, GetMetricNoThrow) { ov::runtime::Core ie = createCoreWithTemplate(); - runtime::Parameter p; + ov::Any p; setHeteroNetworkAffinity(deviceName); diff --git a/inference-engine/tests/functional/plugin/shared/include/behavior/ov_plugin/core_integration.hpp b/inference-engine/tests/functional/plugin/shared/include/behavior/ov_plugin/core_integration.hpp index 1b1704b472c..6b301c27a68 100644 --- a/inference-engine/tests/functional/plugin/shared/include/behavior/ov_plugin/core_integration.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/behavior/ov_plugin/core_integration.hpp @@ -470,7 +470,7 @@ TEST_P(OVClassNetworkTestP, QueryNetworkMultiThrows) { TEST(OVClassBasicTest, smoke_GetMetricSupportedMetricsHeteroNoThrow) { ov::runtime::Core ie = createCoreWithTemplate(); - runtime::Parameter p; + ov::Any p; std::string deviceName = CommonTestUtils::DEVICE_HETERO; ASSERT_NO_THROW(p = ie.get_metric(deviceName, METRIC_KEY(SUPPORTED_METRICS))); @@ -486,7 +486,7 @@ TEST(OVClassBasicTest, smoke_GetMetricSupportedMetricsHeteroNoThrow) { TEST(OVClassBasicTest, smoke_GetMetricSupportedConfigKeysHeteroNoThrow) { ov::runtime::Core ie = createCoreWithTemplate(); - runtime::Parameter p; + ov::Any p; std::string deviceName = CommonTestUtils::DEVICE_HETERO; ASSERT_NO_THROW(p = ie.get_metric(deviceName, METRIC_KEY(SUPPORTED_CONFIG_KEYS))); @@ -509,7 +509,7 @@ TEST(OVClassBasicTest, smoke_GetMetricSupportedConfigKeysHeteroThrows) { TEST_P(OVClassGetMetricTest_SUPPORTED_METRICS, GetMetricAndPrintNoThrow) { ov::runtime::Core ie = createCoreWithTemplate(); - runtime::Parameter p; + ov::Any p; ASSERT_NO_THROW(p = ie.get_metric(deviceName, METRIC_KEY(SUPPORTED_METRICS))); std::vector t = p; @@ -524,7 +524,7 @@ TEST_P(OVClassGetMetricTest_SUPPORTED_METRICS, GetMetricAndPrintNoThrow) { TEST_P(OVClassGetMetricTest_SUPPORTED_CONFIG_KEYS, GetMetricAndPrintNoThrow) { ov::runtime::Core ie = createCoreWithTemplate(); - runtime::Parameter p; + ov::Any p; ASSERT_NO_THROW(p = ie.get_metric(deviceName, METRIC_KEY(SUPPORTED_CONFIG_KEYS))); std::vector t = p; @@ -539,7 +539,7 @@ TEST_P(OVClassGetMetricTest_SUPPORTED_CONFIG_KEYS, GetMetricAndPrintNoThrow) { TEST_P(OVClassGetMetricTest_AVAILABLE_DEVICES, GetMetricAndPrintNoThrow) { ov::runtime::Core ie = createCoreWithTemplate(); - runtime::Parameter p; + ov::Any p; ASSERT_NO_THROW(p = ie.get_metric(deviceName, METRIC_KEY(AVAILABLE_DEVICES))); std::vector t = p; @@ -554,7 +554,7 @@ TEST_P(OVClassGetMetricTest_AVAILABLE_DEVICES, GetMetricAndPrintNoThrow) { TEST_P(OVClassGetMetricTest_FULL_DEVICE_NAME, GetMetricAndPrintNoThrow) { ov::runtime::Core ie = createCoreWithTemplate(); - runtime::Parameter p; + ov::Any p; ASSERT_NO_THROW(p = ie.get_metric(deviceName, METRIC_KEY(FULL_DEVICE_NAME))); std::string t = p; @@ -565,7 +565,7 @@ TEST_P(OVClassGetMetricTest_FULL_DEVICE_NAME, GetMetricAndPrintNoThrow) { TEST_P(OVClassGetMetricTest_OPTIMIZATION_CAPABILITIES, GetMetricAndPrintNoThrow) { ov::runtime::Core ie = createCoreWithTemplate(); - runtime::Parameter p; + ov::Any p; ASSERT_NO_THROW(p = ie.get_metric(deviceName, METRIC_KEY(OPTIMIZATION_CAPABILITIES))); std::vector t = p; @@ -580,7 +580,7 @@ TEST_P(OVClassGetMetricTest_OPTIMIZATION_CAPABILITIES, GetMetricAndPrintNoThrow) TEST_P(OVClassGetMetricTest_DEVICE_GOPS, GetMetricAndPrintNoThrow) { ov::runtime::Core ie = createCoreWithTemplate(); - runtime::Parameter p; + ov::Any p; ASSERT_NO_THROW(p = ie.get_metric(deviceName, METRIC_KEY(DEVICE_GOPS))); std::map t = p; @@ -595,7 +595,7 @@ TEST_P(OVClassGetMetricTest_DEVICE_GOPS, GetMetricAndPrintNoThrow) { TEST_P(OVClassGetMetricTest_DEVICE_TYPE, GetMetricAndPrintNoThrow) { ov::runtime::Core ie = createCoreWithTemplate(); - runtime::Parameter p; + ov::Any p; ASSERT_NO_THROW(p = ie.get_metric(deviceName, METRIC_KEY(DEVICE_TYPE))); InferenceEngine::Metrics::DeviceType t = p; @@ -607,7 +607,7 @@ TEST_P(OVClassGetMetricTest_DEVICE_TYPE, GetMetricAndPrintNoThrow) { TEST_P(OVClassGetMetricTest_NUMBER_OF_WAITING_INFER_REQUESTS, GetMetricAndPrintNoThrow) { ov::runtime::Core ie = createCoreWithTemplate(); - runtime::Parameter p; + ov::Any p; ASSERT_NO_THROW(p = ie.get_metric(deviceName, METRIC_KEY(NUMBER_OF_WAITING_INFER_REQUESTS))); unsigned int t = p; @@ -619,7 +619,7 @@ TEST_P(OVClassGetMetricTest_NUMBER_OF_WAITING_INFER_REQUESTS, GetMetricAndPrintN TEST_P(OVClassGetMetricTest_NUMBER_OF_EXEC_INFER_REQUESTS, GetMetricAndPrintNoThrow) { ov::runtime::Core ie = createCoreWithTemplate(); - runtime::Parameter p; + ov::Any p; ASSERT_NO_THROW(p = ie.get_metric(deviceName, METRIC_KEY(NUMBER_OF_EXEC_INFER_REQUESTS))); unsigned int t = p; @@ -631,7 +631,7 @@ TEST_P(OVClassGetMetricTest_NUMBER_OF_EXEC_INFER_REQUESTS, GetMetricAndPrintNoTh TEST_P(OVClassGetMetricTest_RANGE_FOR_ASYNC_INFER_REQUESTS, GetMetricAndPrintNoThrow) { ov::runtime::Core ie = createCoreWithTemplate(); - runtime::Parameter p; + ov::Any p; ASSERT_NO_THROW(p = ie.get_metric(deviceName, METRIC_KEY(RANGE_FOR_ASYNC_INFER_REQUESTS))); std::tuple t = p; @@ -653,7 +653,7 @@ TEST_P(OVClassGetMetricTest_RANGE_FOR_ASYNC_INFER_REQUESTS, GetMetricAndPrintNoT TEST_P(OVClassGetMetricTest_RANGE_FOR_STREAMS, GetMetricAndPrintNoThrow) { ov::runtime::Core ie = createCoreWithTemplate(); - runtime::Parameter p; + ov::Any p; ASSERT_NO_THROW(p = ie.get_metric(deviceName, METRIC_KEY(RANGE_FOR_STREAMS))); std::tuple t = p; @@ -672,20 +672,20 @@ TEST_P(OVClassGetMetricTest_RANGE_FOR_STREAMS, GetMetricAndPrintNoThrow) { TEST_P(OVClassGetMetricTest_ThrowUnsupported, GetMetricThrow) { ov::runtime::Core ie = createCoreWithTemplate(); - runtime::Parameter p; + ov::Any p; ASSERT_THROW(p = ie.get_metric(deviceName, "unsupported_metric"), ov::Exception); } TEST_P(OVClassGetConfigTest, GetConfigNoThrow) { ov::runtime::Core ie = createCoreWithTemplate(); - runtime::Parameter p; + ov::Any p; ASSERT_NO_THROW(p = ie.get_metric(deviceName, METRIC_KEY(SUPPORTED_CONFIG_KEYS))); std::vector configValues = p; for (auto&& confKey : configValues) { - runtime::Parameter defaultValue; + ov::Any defaultValue; ASSERT_NO_THROW(defaultValue = ie.get_config(deviceName, confKey)); ASSERT_FALSE(defaultValue.empty()); } @@ -693,7 +693,7 @@ TEST_P(OVClassGetConfigTest, GetConfigNoThrow) { TEST_P(OVClassGetConfigTest, GetConfigHeteroNoThrow) { ov::runtime::Core ie = createCoreWithTemplate(); - runtime::Parameter p; + ov::Any p; ASSERT_NO_THROW(p = ie.get_metric(deviceName, METRIC_KEY(SUPPORTED_CONFIG_KEYS))); std::vector configValues = p; @@ -705,14 +705,14 @@ TEST_P(OVClassGetConfigTest, GetConfigHeteroNoThrow) { TEST_P(OVClassGetConfigTest_ThrowUnsupported, GetConfigHeteroThrow) { ov::runtime::Core ie = createCoreWithTemplate(); - runtime::Parameter p; + ov::Any p; ASSERT_THROW(p = ie.get_config(CommonTestUtils::DEVICE_HETERO, "unsupported_config"), ov::Exception); } TEST_P(OVClassGetConfigTest_ThrowUnsupported, GetConfigHeteroWithDeviceThrow) { ov::runtime::Core ie = createCoreWithTemplate(); - runtime::Parameter p; + ov::Any p; ASSERT_THROW(p = ie.get_config(CommonTestUtils::DEVICE_HETERO + std::string(":") + deviceName, HETERO_CONFIG_KEY(DUMP_GRAPH_DOT)), @@ -721,14 +721,14 @@ TEST_P(OVClassGetConfigTest_ThrowUnsupported, GetConfigHeteroWithDeviceThrow) { TEST_P(OVClassGetConfigTest_ThrowUnsupported, GetConfigThrow) { ov::runtime::Core ie = createCoreWithTemplate(); - runtime::Parameter p; + ov::Any p; ASSERT_THROW(p = ie.get_config(deviceName, "unsupported_config"), ov::Exception); } TEST_P(OVClassSpecificDeviceTestGetConfig, GetConfigSpecificDeviceNoThrow) { ov::runtime::Core ie = createCoreWithTemplate(); - runtime::Parameter p; + ov::Any p; std::string deviceID, clearDeviceName; auto pos = deviceName.find('.'); @@ -748,7 +748,7 @@ TEST_P(OVClassSpecificDeviceTestGetConfig, GetConfigSpecificDeviceNoThrow) { std::vector configValues = p; for (auto &&confKey : configValues) { - runtime::Parameter defaultValue; + ov::Any defaultValue; ASSERT_NO_THROW(defaultValue = ie.get_config(deviceName, confKey)); ASSERT_FALSE(defaultValue.empty()); } @@ -1152,7 +1152,7 @@ TEST_P(OVClassSetGlobalConfigTest, SetGlobalConfigNoThrow) { ov::runtime::Core ie = createCoreWithTemplate(); std::vector deviceIDs = ie.get_metric(deviceName, METRIC_KEY(AVAILABLE_DEVICES)); - runtime::Parameter ref, src; + ov::Any ref, src; for (auto& dev_id : deviceIDs) { ASSERT_NO_THROW(ie.set_config({{ InferenceEngine::PluginConfigParams::KEY_PERF_COUNT, InferenceEngine::PluginConfigParams::NO }}, deviceName + "." + dev_id)); diff --git a/inference-engine/tests/functional/plugin/shared/include/behavior/ov_remote.hpp b/inference-engine/tests/functional/plugin/shared/include/behavior/ov_remote.hpp index b6339de49a7..9988cc7c2b4 100644 --- a/inference-engine/tests/functional/plugin/shared/include/behavior/ov_remote.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/behavior/ov_remote.hpp @@ -11,6 +11,7 @@ #include "openvino/runtime/executable_network.hpp" #include "openvino/op/parameter.hpp" #include "functional_test_utils/ov_plugin_cache.hpp" +#include "common_test_utils/ov_common_utils.hpp" namespace ov { namespace test { diff --git a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/group_convolution_transformation.hpp b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/group_convolution_transformation.hpp index 237a6b12448..6b0401f3458 100644 --- a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/group_convolution_transformation.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/group_convolution_transformation.hpp @@ -15,8 +15,6 @@ namespace LayerTestsDefinitions { class GroupConvolutionTransformationParam { public: - ngraph::PartialShape inputShape; - ngraph::Shape outputShape; size_t group; int groupCalculationDimention; ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantizeOnData; @@ -29,6 +27,7 @@ typedef std::tuple< ngraph::element::Type, std::string, ngraph::pass::low_precision::LayerTransformation::Params, + std::pair, GroupConvolutionTransformationParam, bool // add precision preserved operation > GroupConvolutionTransformationParams; diff --git a/inference-engine/tests/functional/plugin/shared/include/single_layer_tests/matrix_nms.hpp b/inference-engine/tests/functional/plugin/shared/include/single_layer_tests/matrix_nms.hpp index 21e89bf0474..18f75890588 100644 --- a/inference-engine/tests/functional/plugin/shared/include/single_layer_tests/matrix_nms.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/single_layer_tests/matrix_nms.hpp @@ -6,10 +6,14 @@ #include "shared_test_classes/single_layer/matrix_nms.hpp" -namespace LayerTestsDefinitions { +namespace ov { +namespace test { +namespace subgraph { TEST_P(MatrixNmsLayerTest, CompareWithRefs) { - Run(); + run(); }; -} // namespace LayerTestsDefinitions +} // namespace subgraph +} // namespace test +} // namespace ov diff --git a/inference-engine/tests/functional/plugin/shared/include/single_layer_tests/multiclass_nms.hpp b/inference-engine/tests/functional/plugin/shared/include/single_layer_tests/multiclass_nms.hpp index e89ba2d126c..28ae8cea0c4 100644 --- a/inference-engine/tests/functional/plugin/shared/include/single_layer_tests/multiclass_nms.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/single_layer_tests/multiclass_nms.hpp @@ -6,10 +6,14 @@ #include "shared_test_classes/single_layer/multiclass_nms.hpp" -namespace LayerTestsDefinitions { +namespace ov { +namespace test { +namespace subgraph { TEST_P(MulticlassNmsLayerTest, CompareWithRefs) { - Run(); + run(); }; -} // namespace LayerTestsDefinitions +} // namespace subgraph +} // namespace test +} // namespace ov diff --git a/inference-engine/tests/functional/plugin/shared/include/subgraph_tests/split_concat_multi_inputs.hpp b/inference-engine/tests/functional/plugin/shared/include/subgraph_tests/split_concat_multi_inputs.hpp new file mode 100644 index 00000000000..ec91fe02d6c --- /dev/null +++ b/inference-engine/tests/functional/plugin/shared/include/subgraph_tests/split_concat_multi_inputs.hpp @@ -0,0 +1,14 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include "shared_test_classes/subgraph/split_concat_multi_inputs.hpp" + +namespace SubgraphTestsDefinitions { + +TEST_P(SplitConcatMultiInputsTest, CompareWithRefs) { + Run(); +}; +} // namespace SubgraphTestsDefinitions \ No newline at end of file diff --git a/inference-engine/tests/functional/plugin/shared/src/behavior/caching/caching_tests.cpp b/inference-engine/tests/functional/plugin/shared/src/behavior/caching/caching_tests.cpp index 8a6918a51d1..734630d61e5 100644 --- a/inference-engine/tests/functional/plugin/shared/src/behavior/caching/caching_tests.cpp +++ b/inference-engine/tests/functional/plugin/shared/src/behavior/caching/caching_tests.cpp @@ -121,7 +121,7 @@ bool LoadNetworkCacheTestBase::importExportSupported(InferenceEngine::Core& ie) auto it = std::find(supportedMetricKeys.begin(), supportedMetricKeys.end(), METRIC_KEY(IMPORT_EXPORT_SUPPORT)); bool supported = (it != supportedMetricKeys.end()) && - ie.GetMetric(targetDevice, METRIC_KEY(IMPORT_EXPORT_SUPPORT)); + ie.GetMetric(targetDevice, METRIC_KEY(IMPORT_EXPORT_SUPPORT)).as(); return supported; } diff --git a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/convolution_transformation.cpp b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/convolution_transformation.cpp index 89b900011a5..7519814f23a 100755 --- a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/convolution_transformation.cpp +++ b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/convolution_transformation.cpp @@ -30,6 +30,7 @@ std::string ConvolutionTransformation::getTestCaseName(const testing::TestParamI std::ostringstream result; result << getTestCaseNameByParams(netPrecision, inputShape, targetDevice, params) << "_" << + inputShape.rank().get_length() << "D_" << param.fakeQuantizeOnData << "_" << param.fakeQuantizeOnWeights; return result.str(); diff --git a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/group_convolution_transformation.cpp b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/group_convolution_transformation.cpp index 28aee25c464..0f48e736a12 100644 --- a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/group_convolution_transformation.cpp +++ b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/group_convolution_transformation.cpp @@ -24,15 +24,17 @@ std::string GroupConvolutionTransformation::getTestCaseName(const testing::TestP ngraph::element::Type netPrecision; std::string targetDevice; ngraph::pass::low_precision::LayerTransformation::Params params; + std::pair inputShapes; GroupConvolutionTransformationParam param; bool addPrecisionPreserved; - std::tie(netPrecision, targetDevice, params, param, addPrecisionPreserved) = obj.param; + std::tie(netPrecision, targetDevice, params, inputShapes, param, addPrecisionPreserved) = obj.param; std::ostringstream result; result << - getTestCaseNameByParams(netPrecision, param.inputShape, targetDevice, params) << "_" << - param.inputShape << "_" << - param.outputShape << "_" << + getTestCaseNameByParams(netPrecision, inputShapes.first, targetDevice, params) << "_" << + inputShapes.first.rank().get_length() << "D_" << + inputShapes.first << "_" << + inputShapes.second << "_" << param.group << "_" << param.groupCalculationDimention << "_" << param.fakeQuantizeOnData << "_" << @@ -46,14 +48,18 @@ void GroupConvolutionTransformation::SetUp() { ngraph::element::Type netPrecision; ngraph::pass::low_precision::LayerTransformation::Params params; + std::pair inputShapes; GroupConvolutionTransformationParam param; bool addPrecisionPreserved; - std::tie(netPrecision, targetDevice, params, param, addPrecisionPreserved) = this->GetParam(); + std::tie(netPrecision, targetDevice, params, inputShapes, param, addPrecisionPreserved) = this->GetParam(); + while (param.fakeQuantizeOnData.constantShape.size() > inputShapes.first.size()) { + param.fakeQuantizeOnData.constantShape.pop_back(); + } function = ngraph::builder::subgraph::GroupConvolutionFunction::getOriginal( netPrecision, - param.inputShape, - param.outputShape, + inputShapes.first, + inputShapes.second, param.group, param.groupCalculationDimention, param.fakeQuantizeOnData, @@ -64,7 +70,7 @@ void GroupConvolutionTransformation::SetUp() { void GroupConvolutionTransformation::Run() { LayerTestsCommon::Run(); - const auto param = std::get<3>(GetParam()); + const auto param = std::get<4>(GetParam()); if (!param.layerName.empty()) { const auto actualPrecision = getRuntimePrecisionByType(param.layerName); auto expectedPrecision = param.expectedKernelType; diff --git a/inference-engine/tests/functional/shared_test_classes/include/shared_test_classes/single_layer/matrix_nms.hpp b/inference-engine/tests/functional/shared_test_classes/include/shared_test_classes/single_layer/matrix_nms.hpp index f318c6930af..2ee3eff36b2 100644 --- a/inference-engine/tests/functional/shared_test_classes/include/shared_test_classes/single_layer/matrix_nms.hpp +++ b/inference-engine/tests/functional/shared_test_classes/include/shared_test_classes/single_layer/matrix_nms.hpp @@ -7,18 +7,18 @@ #include #include -#include "shared_test_classes/base/layer_test_utils.hpp" -#include "ngraph_functions/builders.hpp" +#include "ngraph_functions/utils/ngraph_helpers.hpp" +#include "common_test_utils/common_utils.hpp" +#include "shared_test_classes/base/ov_subgraph.hpp" -namespace LayerTestsDefinitions { +namespace ov { +namespace test { +namespace subgraph { -using InputShapeParams = std::tuple; // Number of classes - -using InputPrecisions = std::tuple; // iou_threshold, score_threshold, soft_nms_sigma precisions +using InputPrecisions = std::tuple; // iou_threshold, score_threshold, using TopKParams = std::tuple; // Maximum number of boxes to be selected per batch element @@ -27,7 +27,7 @@ using ThresholdParams = std::tuple; // filter out boxes with low confidence score after decaying -using NmsParams = std::tuple, // Params using to create 1st and 2nd inputs InputPrecisions, // Input precisions ngraph::op::v8::MatrixNms::SortResultType, // Order of output elements ngraph::element::Type, // Output type @@ -38,21 +38,22 @@ using NmsParams = std::tuple; // Device name -class MatrixNmsLayerTest : public testing::WithParamInterface, virtual public LayerTestsUtils::LayerTestsCommon { +class MatrixNmsLayerTest : public testing::WithParamInterface, + virtual public SubgraphBaseTest { public: static std::string getTestCaseName(const testing::TestParamInfo& obj); - void GenerateInputs() override; - void Compare(const std::vector>> &expectedOutputs, - const std::vector &actualOutputs) - override; + void generate_inputs(const std::vector& targetInputStaticShapes) override; + void compare(const std::vector &expected, const std::vector &actual) override; protected: void SetUp() override; private: - size_t numBatches, numBoxes, numClasses; - size_t maxOutputBoxesPerClass; - size_t maxOutputBoxesPerBatch; + void GetOutputParams(size_t& numBatches, size_t& maxOutputBoxesPerBatch); + ngraph::op::v8::MatrixNms::Attributes m_attrs; + bool m_outStaticShape; }; -} // namespace LayerTestsDefinitions +} // namespace subgraph +} // namespace test +} // namespace ov diff --git a/inference-engine/tests/functional/shared_test_classes/include/shared_test_classes/single_layer/multiclass_nms.hpp b/inference-engine/tests/functional/shared_test_classes/include/shared_test_classes/single_layer/multiclass_nms.hpp index 4dd7777b4b9..bf6c141d1af 100644 --- a/inference-engine/tests/functional/shared_test_classes/include/shared_test_classes/single_layer/multiclass_nms.hpp +++ b/inference-engine/tests/functional/shared_test_classes/include/shared_test_classes/single_layer/multiclass_nms.hpp @@ -7,20 +7,19 @@ #include #include -#include "ngraph_functions/builders.hpp" -#include "shared_test_classes/base/layer_test_utils.hpp" +#include "ngraph_functions/utils/ngraph_helpers.hpp" +#include "common_test_utils/common_utils.hpp" +#include "shared_test_classes/base/ov_subgraph.hpp" -namespace LayerTestsDefinitions { +namespace ov { +namespace test { +namespace subgraph { -using InputShapeParams = std::tuple; // Number of classes - -using InputPrecisions = std::tuple; // iou_threshold, score_threshold, - // soft_nms_sigma precisions +using InputPrecisions = std::tuple; // iou_threshold, score_threshold, + // soft_nms_sigma precisions using InputfloatVar = std::tuple; // normalized -using MulticlassNmsParams = std::tuple, // Params using to create 1st and 2nd inputs InputPrecisions, // Input precisions int32_t, // Max output boxes per class InputfloatVar, // iouThreshold, scoreThreshold, nmsEta @@ -40,20 +39,21 @@ using MulticlassNmsParams = std::tuple; -class MulticlassNmsLayerTest : public testing::WithParamInterface, virtual public LayerTestsUtils::LayerTestsCommon { +class MulticlassNmsLayerTest : public testing::WithParamInterface, + virtual public SubgraphBaseTest { public: static std::string getTestCaseName(const testing::TestParamInfo& obj); - void GenerateInputs() override; - void Compare(const std::vector>>& expectedOutputs, - const std::vector& actualOutputs) override; + void generate_inputs(const std::vector& targetInputStaticShapes) override; + void compare(const std::vector &expected, const std::vector &actual) override; protected: void SetUp() override; private: - size_t numBatches, numBoxes, numClasses; - size_t maxOutputBoxesPerClass; - size_t maxOutputBoxesPerBatch; + void GetOutputParams(size_t& numBatches, size_t& maxOutputBoxesPerBatch); + ngraph::op::v8::MulticlassNms::Attributes m_attrs; + bool m_outStaticShape; }; - -} // namespace LayerTestsDefinitions +} // namespace subgraph +} // namespace test +} // namespace ov diff --git a/inference-engine/tests/functional/shared_test_classes/include/shared_test_classes/single_layer/prior_box.hpp b/inference-engine/tests/functional/shared_test_classes/include/shared_test_classes/single_layer/prior_box.hpp index 15fcb6d1127..466112a1d96 100644 --- a/inference-engine/tests/functional/shared_test_classes/include/shared_test_classes/single_layer/prior_box.hpp +++ b/inference-engine/tests/functional/shared_test_classes/include/shared_test_classes/single_layer/prior_box.hpp @@ -39,7 +39,8 @@ using priorBoxSpecificParams = std::tuple< float, // step float, // offset std::vector, // variance - bool>; // scale_all_sizes + bool, // scale_all_sizes + bool>; // min_max_aspect_ratios_order typedef std::tuple< priorBoxSpecificParams, @@ -73,6 +74,7 @@ protected: bool clip; bool flip; bool scale_all_sizes; + bool min_max_aspect_ratios_order; void SetUp() override; }; diff --git a/inference-engine/tests/functional/shared_test_classes/include/shared_test_classes/subgraph/split_concat_multi_inputs.hpp b/inference-engine/tests/functional/shared_test_classes/include/shared_test_classes/subgraph/split_concat_multi_inputs.hpp new file mode 100644 index 00000000000..59f61bbd366 --- /dev/null +++ b/inference-engine/tests/functional/shared_test_classes/include/shared_test_classes/subgraph/split_concat_multi_inputs.hpp @@ -0,0 +1,42 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include +#include +#include +#include + +#include "shared_test_classes/base/layer_test_utils.hpp" +#include "ngraph_functions/utils/ngraph_helpers.hpp" +#include "ngraph_functions/builders.hpp" + +namespace SubgraphTestsDefinitions { + +typedef std::tuple< + InferenceEngine::Precision, // Network Precision + std::string, // Target Device + std::map, // Configuration + std::vector, // Input Shapes + size_t, // Num of Split outputs (concat inputs) + bool // with FC or not +> SplitConcatMultiInputsParams; + + +class SplitConcatMultiInputsTest : public testing::WithParamInterface, + public LayerTestsUtils::LayerTestsCommon { +public: + static std::string getTestCaseName(testing::TestParamInfo obj); + +protected: + void SetUp() override; + InferenceEngine::Blob::Ptr GenerateInput(const InferenceEngine::InputInfo &info) const override; + + float inputDataMin = 0.0; + float inputDataMax = 0.2; + float inputDataResolution = 1; + int32_t seed = 1; +}; +} // namespace SubgraphTestsDefinitions diff --git a/inference-engine/tests/functional/shared_test_classes/src/single_layer/broadcast.cpp b/inference-engine/tests/functional/shared_test_classes/src/single_layer/broadcast.cpp index 2961551648a..1cb86e1bf88 100644 --- a/inference-engine/tests/functional/shared_test_classes/src/single_layer/broadcast.cpp +++ b/inference-engine/tests/functional/shared_test_classes/src/single_layer/broadcast.cpp @@ -7,8 +7,8 @@ namespace LayerTestsDefinitions { std::string BroadcastLayerTest::getTestCaseName(const testing::TestParamInfo& obj) { InferenceEngine::SizeVector targetShape; - ngraph::AxisSet axesMapping; - ngraph::op::BroadcastType mode; + ov::AxisSet axesMapping; + ov::op::BroadcastType mode; InferenceEngine::SizeVector inputShape; InferenceEngine::Precision networkPrecision; std::string deviceName; @@ -26,19 +26,19 @@ std::string BroadcastLayerTest::getTestCaseName(const testing::TestParamInfoGetParam(); auto ngPrc = FuncTestUtils::PrecisionUtils::convertIE2nGraphPrc(networkPrecision); - auto target_shape_const = ngraph::opset3::Constant::create(ngraph::element::i64, {targetShape.size()}, targetShape); + auto target_shape_const = ov::op::v0::Constant::create(ov::element::i64, {targetShape.size()}, targetShape); auto params = ngraph::builder::makeParams(ngPrc, {inputShape}); auto broadcast = ngraph::builder::makeBroadcast(params[0], target_shape_const, mode, axesMapping); - ngraph::ResultVector results{std::make_shared(broadcast)}; - function = std::make_shared(results, params, "BroadcastInference"); + ov::ResultVector results{std::make_shared(broadcast)}; + function = std::make_shared(results, params, "BroadcastInference"); } } // namespace LayerTestsDefinitions diff --git a/inference-engine/tests/functional/shared_test_classes/src/single_layer/matrix_nms.cpp b/inference-engine/tests/functional/shared_test_classes/src/single_layer/matrix_nms.cpp index de4787cdf22..237b52bc0d4 100644 --- a/inference-engine/tests/functional/shared_test_classes/src/single_layer/matrix_nms.cpp +++ b/inference-engine/tests/functional/shared_test_classes/src/single_layer/matrix_nms.cpp @@ -2,16 +2,23 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "ngraph_functions/builders.hpp" +#include "functional_test_utils/ov_tensor_utils.hpp" #include "shared_test_classes/single_layer/matrix_nms.hpp" +#include "shared_test_classes/base/layer_test_utils.hpp" -namespace LayerTestsDefinitions { +#include "functional_test_utils/plugin_cache.hpp" + +namespace ov { +namespace test { +namespace subgraph { using namespace ngraph; using namespace InferenceEngine; -using namespace FuncTestUtils::PrecisionUtils; +using ngraph::helpers::operator<<; std::string MatrixNmsLayerTest::getTestCaseName(const testing::TestParamInfo& obj) { - InputShapeParams inShapeParams; + std::vector shapes; InputPrecisions inPrecisions; op::v8::MatrixNms::SortResultType sortResultType; element::Type outType; @@ -21,13 +28,10 @@ std::string MatrixNmsLayerTest::getTestCaseName(const testing::TestParamInfo& targetInputStaticShapes) { + inputs.clear(); - if (it == 1) { - blob = make_blob_with_precision(info->getTensorDesc()); - blob->allocate(); - CommonTestUtils::fill_data_random_float(blob, 1, 0, 100000); + const auto& funcInputs = function->inputs(); + for (int i = 0; i < funcInputs.size(); ++i) { + const auto& funcInput = funcInputs[i]; + ov::runtime::Tensor tensor; + + if (i == 1) { + tensor = ov::runtime::Tensor(funcInput.get_element_type(), targetInputStaticShapes[i]); + + const size_t range = 1; + const size_t startFrom = 0; + const size_t k = 1000; + const int seed = 1; + std::default_random_engine random(seed); + std::uniform_int_distribution distribution(k * startFrom, k * (startFrom + range)); + + auto *dataPtr = tensor.data(); + for (size_t i = 0; i < tensor.get_size(); i++) { + auto value = static_cast(distribution(random)); + dataPtr[i] = value / static_cast(k); + } } else { - blob = GenerateInput(*info); + tensor = ov::test::utils::create_and_fill_tensor(funcInput.get_element_type(), targetInputStaticShapes[i]); } - inputs.push_back(blob); - it++; + + inputs.insert({funcInput.get_node_shared_ptr(), tensor}); } } -void MatrixNmsLayerTest::Compare(const std::vector>> &expectedOutputs, - const std::vector &actualOutputs) { +void MatrixNmsLayerTest::GetOutputParams(size_t& numBatches, size_t& maxOutputBoxesPerBatch) { + size_t it = 0; + size_t numBoxes = 0, numClasses = 0; + const auto& funcInputs = function->inputs(); + for (int i = 0; i < funcInputs.size(); ++i) { + const auto& funcInput = funcInputs[i]; + const auto& dims = inputs[funcInput.get_node_shared_ptr()].get_shape(); + + if (it == 1) { + numClasses = dims[1]; + } else { + numBatches = dims[0]; + numBoxes = dims[1]; + } + it++; + } + + ASSERT_TRUE(numBatches > 0 && numBoxes > 0 && numClasses > 0) + << "Expected numBatches, numBoxes, numClasses > 0, got:" << numBatches << ", " << numBoxes << ", " << numClasses; + + auto realClasses = numClasses; + if (m_attrs.background_class >= 0 && m_attrs.background_class < numClasses) { + realClasses = realClasses - 1; + } + + size_t maxOutputBoxesPerClass = 0; + if (m_attrs.nms_top_k >= 0) + maxOutputBoxesPerClass = std::min(numBoxes, static_cast(m_attrs.nms_top_k)); + else + maxOutputBoxesPerClass = numBoxes; + + maxOutputBoxesPerBatch = maxOutputBoxesPerClass * realClasses; + if (m_attrs.keep_top_k >= 0) + maxOutputBoxesPerBatch = + std::min(maxOutputBoxesPerBatch, static_cast(m_attrs.keep_top_k)); +} + +void MatrixNmsLayerTest::compare(const std::vector &expectedOutputs, + const std::vector &actualOutputs) { auto batchIndex = -1; + size_t numBatches, maxOutputBoxesPerBatch; + GetOutputParams(numBatches, maxOutputBoxesPerBatch); std::vector numPerBatch(numBatches); for (int outputIndex = static_cast(expectedOutputs.size()) - 1; outputIndex >= 0 ; outputIndex--) { const auto& actual = actualOutputs[outputIndex]; - const auto _dims = actual->getTensorDesc().getDims(); + const auto _dims = actual.get_shape(); if (_dims.size() == 1 && _dims[0] == numBatches) { batchIndex = outputIndex; - auto memory = InferenceEngine::as(actual); - IE_ASSERT(memory); - const auto lockedMemory = memory->wmap(); - const auto actualBuffer = lockedMemory.as(); - auto buffer = reinterpret_cast(actualBuffer); + auto buffer = reinterpret_cast(actual.data()); std::copy_n(buffer, numBatches, numPerBatch.begin()); } } @@ -86,39 +148,30 @@ void MatrixNmsLayerTest::Compare(const std::vector(expectedOutputs.size()) - 1; outputIndex >= 0 ; outputIndex--) { const auto& expected = expectedOutputs[outputIndex]; const auto& actual = actualOutputs[outputIndex]; + const auto actualBuffer = static_cast(actual.data()); + const auto expectedBuffer = static_cast(expected.data()); //Compare Selected Outputs & Selected Indices if (outputIndex != batchIndex) { - const auto &expectedBuffer = expected.second.data(); - auto memory = InferenceEngine::as(actual); - IE_ASSERT(memory); - const auto lockedMemory = memory->wmap(); - const auto actualBuffer = lockedMemory.as(); - - auto k = static_cast(expected.first.size()) / actual->getTensorDesc().getPrecision().size(); - // W/A for int4, uint4 - if (expected.first == ngraph::element::Type_t::u4 || expected.first == ngraph::element::Type_t::i4) { - k /= 2; - } if (outputIndex == 2) { - if (expected.second.size() != k * actual->byteSize()) + if (expected.get_size() != actual.get_size()) throw std::runtime_error("Expected and actual size 3rd output have different size"); } - const auto &precision = actual->getTensorDesc().getPrecision(); + const auto& precision = actual.get_element_type(); auto expected_offset = 0; auto actual_offset = 0; for (size_t i = 0; i < numPerBatch.size(); i++) { auto validNums = numPerBatch[i]; switch (precision) { - case InferenceEngine::Precision::FP32: { - switch (expected.first) { - case ngraph::element::Type_t::f32: + case ov::element::f32: { + switch (expected.get_element_type()) { + case ov::element::f32: LayerTestsUtils::LayerTestsCommon::Compare( reinterpret_cast(expectedBuffer) + expected_offset * 6, reinterpret_cast(actualBuffer) + actual_offset * 6, validNums * 6, 1e-5f); break; - case ngraph::element::Type_t::f64: + case ov::element::f64: LayerTestsUtils::LayerTestsCommon::Compare( reinterpret_cast(expectedBuffer) + expected_offset * 6, reinterpret_cast(actualBuffer) + actual_offset * 6, validNums *6, 1e-5f); @@ -126,22 +179,23 @@ void MatrixNmsLayerTest::Compare(const std::vector(); - for (size_t tailing = validNums * 6; tailing < maxOutputBoxesPerBatch * 6; tailing++) { - ASSERT_TRUE(std::abs(fBuffer[(actual_offset * 6 + tailing)] - -1.f) < 1e-5) - << "Invalid default value: " << fBuffer[i] << " at index: " << i; + if (m_outStaticShape) { + const auto fBuffer = static_cast(actual.data()); + for (size_t tailing = validNums * 6; tailing < maxOutputBoxesPerBatch * 6; tailing++) { + ASSERT_TRUE(std::abs(fBuffer[(actual_offset * 6 + tailing)] - -1.f) < 1e-5) + << "Invalid default value: " << fBuffer[i] << " at index: " << i; + } } break; } - case InferenceEngine::Precision::I32: { - switch (expected.first) { - case ngraph::element::Type_t::i32: + case ov::element::i32: { + switch (expected.get_element_type()) { + case ov::element::i32: LayerTestsUtils::LayerTestsCommon::Compare( reinterpret_cast(expectedBuffer) + expected_offset, reinterpret_cast(actualBuffer) + actual_offset, validNums, 0); break; - case ngraph::element::Type_t::i64: + case ov::element::i64: LayerTestsUtils::LayerTestsCommon::Compare( reinterpret_cast(expectedBuffer) + expected_offset, reinterpret_cast(actualBuffer) + actual_offset, validNums, 0); @@ -149,46 +203,42 @@ void MatrixNmsLayerTest::Compare(const std::vector(); - for (size_t tailing = validNums; tailing < maxOutputBoxesPerBatch; tailing++) { - ASSERT_TRUE(iBuffer[actual_offset + tailing] == -1) << "Invalid default value: " << iBuffer[i] << " at index: " << i; + if (m_outStaticShape) { + const auto iBuffer = static_cast(actual.data()); + for (size_t tailing = validNums; tailing < maxOutputBoxesPerBatch; tailing++) { + ASSERT_TRUE(iBuffer[actual_offset + tailing] == -1) << "Invalid default value: " << iBuffer[i] << " at index: " << i; + } } break; } default: FAIL() << "Comparator for " << precision << " precision isn't supported"; } - expected_offset += validNums; - actual_offset += maxOutputBoxesPerBatch; + if (!m_outStaticShape) { + expected_offset += validNums; + actual_offset += validNums; + } else { + expected_offset += validNums; + actual_offset += maxOutputBoxesPerBatch; + } } } else { - const auto &expectedBuffer = expected.second.data(); - auto memory = InferenceEngine::as(actual); - IE_ASSERT(memory); - const auto lockedMemory = memory->wmap(); - const auto actualBuffer = lockedMemory.as(); - - auto k = static_cast(expected.first.size()) / actual->getTensorDesc().getPrecision().size(); - // W/A for int4, uint4 - if (expected.first == ngraph::element::Type_t::u4 || expected.first == ngraph::element::Type_t::i4) { - k /= 2; - } if (outputIndex == 2) { - if (expected.second.size() != k * actual->byteSize()) + if (expected.get_size() != actual.get_size()) throw std::runtime_error("Expected and actual size 3rd output have different size"); } - const auto &precision = actual->getTensorDesc().getPrecision(); - size_t size = expected.second.size() / (k * actual->getTensorDesc().getPrecision().size()); + const auto& precision = actual.get_element_type(); + size_t size = expected.get_size(); switch (precision) { - case InferenceEngine::Precision::I32: { - switch (expected.first) { - case ngraph::element::Type_t::i32: + case ov::element::i32: { + switch (expected.get_element_type()) { + case ov::element::i32: LayerTestsUtils::LayerTestsCommon::Compare( reinterpret_cast(expectedBuffer), reinterpret_cast(actualBuffer), size, 0); break; - case ngraph::element::Type_t::i64: + case ov::element::i64: LayerTestsUtils::LayerTestsCommon::Compare( reinterpret_cast(expectedBuffer), reinterpret_cast(actualBuffer), size, 0); @@ -206,45 +256,48 @@ void MatrixNmsLayerTest::Compare(const std::vector shapes; InputPrecisions inPrecisions; - op::v8::MatrixNms::Attributes attrs; TopKParams topKParams; ThresholdParams thresholdParams; - std::tie(inShapeParams, inPrecisions, attrs.sort_result_type, attrs.output_type, topKParams, thresholdParams, - attrs.background_class, attrs.normalized, attrs.decay_function, targetDevice) = this->GetParam(); + std::tie(shapes, inPrecisions, m_attrs.sort_result_type, m_attrs.output_type, topKParams, thresholdParams, + m_attrs.background_class, m_attrs.normalized, m_attrs.decay_function, targetDevice) = this->GetParam(); - std::tie(attrs.nms_top_k, attrs.keep_top_k) = topKParams; - std::tie(attrs.score_threshold, attrs.gaussian_sigma, attrs.post_threshold) = thresholdParams; - std::tie(numBatches, numBoxes, numClasses) = inShapeParams; - auto realClasses = numClasses; - if (attrs.background_class >=0 && attrs.background_class <= numClasses) { - realClasses = realClasses - 1; - } + std::tie(m_attrs.nms_top_k, m_attrs.keep_top_k) = topKParams; + std::tie(m_attrs.score_threshold, m_attrs.gaussian_sigma, m_attrs.post_threshold) = thresholdParams; - maxOutputBoxesPerClass = 0; - if (attrs.nms_top_k >= 0) - maxOutputBoxesPerClass = std::min(numBoxes, static_cast(attrs.nms_top_k)); - else - maxOutputBoxesPerClass = numBoxes; + init_input_shapes(shapes); - maxOutputBoxesPerBatch = maxOutputBoxesPerClass * realClasses; - if (attrs.keep_top_k >= 0) - maxOutputBoxesPerBatch = - std::min(maxOutputBoxesPerBatch, static_cast(attrs.keep_top_k)); - Precision paramsPrec, maxBoxPrec, thrPrec; + // input is dynamic shape -> output will be dynamic shape + // input is static shape -> output will be static shape + const auto inputDynamicParam = {shapes[0].first, shapes[1].first}; + m_outStaticShape = std::any_of(inputDynamicParam.begin(), inputDynamicParam.end(), [](const ov::PartialShape& shape) { + return shape.rank() == 0; + }); + + ElementType paramsPrec, maxBoxPrec, thrPrec; std::tie(paramsPrec, maxBoxPrec, thrPrec) = inPrecisions; - - const std::vector boxesShape{numBatches, numBoxes, 4}, scoresShape{numBatches, numClasses, numBoxes}; - auto ngPrc = convertIE2nGraphPrc(paramsPrec); - auto params = builder::makeParams(ngPrc, {boxesShape, scoresShape}); - auto paramOuts = helpers::convert2OutputVector(helpers::castOps2Nodes(params)); - auto nms = std::make_shared(paramOuts[0], paramOuts[1], attrs); - auto nms_0_identity = std::make_shared(nms->output(0), opset5::Constant::create(element::f32, Shape{1}, {1})); - auto nms_1_identity = std::make_shared(nms->output(1), opset5::Constant::create(attrs.output_type, Shape{1}, {1})); - auto nms_2_identity = std::make_shared(nms->output(2), opset5::Constant::create(attrs.output_type, Shape{1}, {1})); - function = std::make_shared(OutputVector{nms_0_identity, nms_1_identity, nms_2_identity}, params, "NMS"); + const auto params = ngraph::builder::makeDynamicParams(paramsPrec, inputDynamicShapes); + const auto paramOuts = + ngraph::helpers::convert2OutputVector(ngraph::helpers::castOps2Nodes(params)); + auto nms = std::make_shared(paramOuts[0], paramOuts[1], m_attrs); + if (!m_outStaticShape) { + auto result = std::make_shared(nms); + function = std::make_shared(result, params, "MatrixNMS"); + } else { + auto nms_0_identity = std::make_shared(nms->output(0), opset5::Constant::create(element::f32, Shape{1}, {1})); + auto nms_1_identity = std::make_shared(nms->output(1), opset5::Constant::create(m_attrs.output_type, Shape{1}, {1})); + auto nms_2_identity = std::make_shared(nms->output(2), opset5::Constant::create(m_attrs.output_type, Shape{1}, {1})); + OutputVector results = { + std::make_shared(nms_0_identity), + std::make_shared(nms_1_identity), + std::make_shared(nms_2_identity) + }; + function = std::make_shared(results, params, "MatrixNMS"); + } } -} // namespace LayerTestsDefinitions +} // namespace subgraph +} // namespace test +} // namespace ov diff --git a/inference-engine/tests/functional/shared_test_classes/src/single_layer/multiclass_nms.cpp b/inference-engine/tests/functional/shared_test_classes/src/single_layer/multiclass_nms.cpp index dd42206f63f..48363ae778f 100644 --- a/inference-engine/tests/functional/shared_test_classes/src/single_layer/multiclass_nms.cpp +++ b/inference-engine/tests/functional/shared_test_classes/src/single_layer/multiclass_nms.cpp @@ -2,16 +2,23 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "ngraph_functions/builders.hpp" +#include "functional_test_utils/ov_tensor_utils.hpp" #include "shared_test_classes/single_layer/multiclass_nms.hpp" +#include "shared_test_classes/base/layer_test_utils.hpp" -namespace LayerTestsDefinitions { +#include "functional_test_utils/plugin_cache.hpp" + +namespace ov { +namespace test { +namespace subgraph { using namespace ngraph; using namespace InferenceEngine; -using namespace FuncTestUtils::PrecisionUtils; +using ngraph::helpers::operator<<; std::string MulticlassNmsLayerTest::getTestCaseName(const testing::TestParamInfo& obj) { - InputShapeParams inShapeParams; + std::vector shapes; InputPrecisions inPrecisions; int32_t nmsTopK, backgroundClass, keepTopK; element::Type outType; @@ -23,12 +30,9 @@ std::string MulticlassNmsLayerTest::getTestCaseName(const testing::TestParamInfo std::string targetDevice; - std::tie(inShapeParams, inPrecisions, nmsTopK, inFloatVar, backgroundClass, keepTopK, outType, sortResultType, inboolVar, targetDevice) = obj.param; + std::tie(shapes, inPrecisions, nmsTopK, inFloatVar, backgroundClass, keepTopK, outType, sortResultType, inboolVar, targetDevice) = obj.param; - size_t numBatches, numBoxes, numClasses; - std::tie(numBatches, numBoxes, numClasses) = inShapeParams; - - Precision paramsPrec, maxBoxPrec, thrPrec; + ElementType paramsPrec, maxBoxPrec, thrPrec; std::tie(paramsPrec, maxBoxPrec, thrPrec) = inPrecisions; float iouThr, scoreThr, nmsEta; @@ -38,8 +42,18 @@ std::string MulticlassNmsLayerTest::getTestCaseName(const testing::TestParamInfo std::tie(sortResCB, normalized) = inboolVar; std::ostringstream result; - result << "numBatches=" << numBatches << "_numBoxes=" << numBoxes << "_numClasses=" << numClasses << "_"; - result << "paramsPrec=" << paramsPrec << "_maxBoxPrec=" << maxBoxPrec << "_thrPrec=" << thrPrec << "_"; + result << "IS=("; + for (const auto& shape : shapes) { + result << CommonTestUtils::partialShape2str({shape.first}) << "_"; + } + result << ")_TS=("; + for (const auto& shape : shapes) { + for (const auto& item : shape.second) { + result << CommonTestUtils::vec2str(item) << "_"; + } + } + + result << ")_paramsPrec=" << paramsPrec << "_maxBoxPrec=" << maxBoxPrec << "_thrPrec=" << thrPrec << "_"; result << "nmsTopK=" << nmsTopK << "_"; result << "iouThr=" << iouThr << "_scoreThr=" << scoreThr << "_backgroundClass=" << backgroundClass << "_"; result << "keepTopK=" << keepTopK << "_outType=" << outType << "_"; @@ -48,38 +62,86 @@ std::string MulticlassNmsLayerTest::getTestCaseName(const testing::TestParamInfo return result.str(); } -void MulticlassNmsLayerTest::GenerateInputs() { - size_t it = 0; - for (const auto& input : cnnNetwork.getInputsInfo()) { - const auto& info = input.second; - Blob::Ptr blob; +void MulticlassNmsLayerTest::generate_inputs(const std::vector& targetInputStaticShapes) { + inputs.clear(); - if (it == 1) { - blob = make_blob_with_precision(info->getTensorDesc()); - blob->allocate(); - CommonTestUtils::fill_data_random_float(blob, 1, 0, 1000); + const auto& funcInputs = function->inputs(); + for (int i = 0; i < funcInputs.size(); ++i) { + const auto& funcInput = funcInputs[i]; + ov::runtime::Tensor tensor; + + if (i == 1) { + tensor = ov::runtime::Tensor(funcInput.get_element_type(), targetInputStaticShapes[i]); + + const size_t range = 1; + const size_t startFrom = 0; + const size_t k = 1000; + const int seed = 1; + std::default_random_engine random(seed); + std::uniform_int_distribution distribution(k * startFrom, k * (startFrom + range)); + + auto *dataPtr = tensor.data(); + for (size_t i = 0; i < tensor.get_size(); i++) { + auto value = static_cast(distribution(random)); + dataPtr[i] = value / static_cast(k); + } } else { - blob = GenerateInput(*info); + tensor = ov::test::utils::create_and_fill_tensor(funcInput.get_element_type(), targetInputStaticShapes[i]); } - inputs.push_back(blob); - it++; + + inputs.insert({funcInput.get_node_shared_ptr(), tensor}); } } -void MulticlassNmsLayerTest::Compare(const std::vector>>& expectedOutputs, - const std::vector& actualOutputs) { +void MulticlassNmsLayerTest::GetOutputParams(size_t& numBatches, size_t& maxOutputBoxesPerBatch) { + size_t it = 0; + size_t numBoxes = 0, numClasses = 0; + const auto& funcInputs = function->inputs(); + for (int i = 0; i < funcInputs.size(); ++i) { + const auto& funcInput = funcInputs[i]; + const auto& dims = inputs[funcInput.get_node_shared_ptr()].get_shape(); + + if (it == 1) { + numClasses = dims[1]; + } else { + numBatches = dims[0]; + numBoxes = dims[1]; + } + it++; + } + + ASSERT_TRUE(numBatches > 0 && numBoxes > 0 && numClasses > 0) + << "Expected numBatches, numBoxes, numClasses > 0, got:" << numBatches << ", " << numBoxes << ", " << numClasses; + + auto realClasses = numClasses; + if (m_attrs.background_class >= 0 && m_attrs.background_class < numClasses) { + realClasses = realClasses - 1; + } + + size_t maxOutputBoxesPerClass = 0; + if (m_attrs.nms_top_k >= 0) + maxOutputBoxesPerClass = std::min(numBoxes, static_cast(m_attrs.nms_top_k)); + else + maxOutputBoxesPerClass = numBoxes; + + maxOutputBoxesPerBatch = maxOutputBoxesPerClass * realClasses; + if (m_attrs.keep_top_k >= 0) + maxOutputBoxesPerBatch = + std::min(maxOutputBoxesPerBatch, static_cast(m_attrs.keep_top_k)); +} + +void MulticlassNmsLayerTest::compare(const std::vector &expectedOutputs, + const std::vector &actualOutputs) { auto batchIndex = -1; + size_t numBatches, maxOutputBoxesPerBatch; + GetOutputParams(numBatches, maxOutputBoxesPerBatch); std::vector numPerBatch(numBatches); for (int outputIndex = static_cast(expectedOutputs.size()) - 1; outputIndex >= 0; outputIndex--) { const auto& actual = actualOutputs[outputIndex]; - const auto _dims = actual->getTensorDesc().getDims(); + const auto _dims = actual.get_shape(); if (_dims.size() == 1 && _dims[0] == numBatches) { batchIndex = outputIndex; - auto memory = InferenceEngine::as(actual); - IE_ASSERT(memory); - const auto lockedMemory = memory->wmap(); - const auto actualBuffer = lockedMemory.as(); - auto buffer = reinterpret_cast(actualBuffer); + auto buffer = reinterpret_cast(actual.data()); std::copy_n(buffer, numBatches, numPerBatch.begin()); } } @@ -87,39 +149,30 @@ void MulticlassNmsLayerTest::Compare(const std::vector(expectedOutputs.size()) - 1; outputIndex >= 0; outputIndex--) { const auto& expected = expectedOutputs[outputIndex]; const auto& actual = actualOutputs[outputIndex]; + const auto actualBuffer = static_cast(actual.data()); + const auto expectedBuffer = static_cast(expected.data()); // Compare Selected Outputs & Selected Indices if (outputIndex != batchIndex) { - const auto& expectedBuffer = expected.second.data(); - auto memory = InferenceEngine::as(actual); - IE_ASSERT(memory); - const auto lockedMemory = memory->wmap(); - const auto actualBuffer = lockedMemory.as(); - - auto k = static_cast(expected.first.size()) / actual->getTensorDesc().getPrecision().size(); - // W/A for int4, uint4 - if (expected.first == ngraph::element::Type_t::u4 || expected.first == ngraph::element::Type_t::i4) { - k /= 2; - } if (outputIndex == 2) { - if (expected.second.size() != k * actual->byteSize()) + if (expected.get_size() != actual.get_size()) throw std::runtime_error("Expected and actual size 3rd output have different " "size"); } - const auto& precision = actual->getTensorDesc().getPrecision(); + const auto& precision = actual.get_element_type(); auto expected_offset = 0; auto actual_offset = 0; for (size_t i = 0; i < numPerBatch.size(); i++) { auto validNums = numPerBatch[i]; switch (precision) { - case InferenceEngine::Precision::FP32: { - switch (expected.first) { - case ngraph::element::Type_t::f32: + case ov::element::f32: { + switch (expected.get_element_type()) { + case ov::element::f32: LayerTestsUtils::LayerTestsCommon::Compare(reinterpret_cast(expectedBuffer) + expected_offset * 6, reinterpret_cast(actualBuffer) + actual_offset * 6, validNums * 6, 1e-5f); break; - case ngraph::element::Type_t::f64: + case ov::element::f64: LayerTestsUtils::LayerTestsCommon::Compare(reinterpret_cast(expectedBuffer) + expected_offset * 6, reinterpret_cast(actualBuffer) + actual_offset * 6, validNums * 6, 1e-5f); break; @@ -127,66 +180,64 @@ void MulticlassNmsLayerTest::Compare(const std::vector(); - for (size_t tailing = validNums * 6; tailing < maxOutputBoxesPerBatch * 6; tailing++) { - ASSERT_TRUE(std::abs(fBuffer[(actual_offset * 6 + tailing)] - -1.f) < 1e-5) - << "Invalid default value: " << fBuffer[i] << " at index: " << i; + if (m_outStaticShape) { + const auto fBuffer = static_cast(actual.data()); + for (size_t tailing = validNums * 6; tailing < maxOutputBoxesPerBatch * 6; tailing++) { + ASSERT_TRUE(std::abs(fBuffer[(actual_offset * 6 + tailing)] - -1.f) < 1e-5) + << "Invalid default value: " << fBuffer[i] << " at index: " << i; + } } break; } - case InferenceEngine::Precision::I32: { - switch (expected.first) { - case ngraph::element::Type_t::i32: + case ov::element::i32: { + switch (expected.get_element_type()) { + case ov::element::i32: LayerTestsUtils::LayerTestsCommon::Compare(reinterpret_cast(expectedBuffer) + expected_offset, reinterpret_cast(actualBuffer) + actual_offset, validNums, 0); break; - case ngraph::element::Type_t::i64: + case ov::element::i64: LayerTestsUtils::LayerTestsCommon::Compare(reinterpret_cast(expectedBuffer) + expected_offset, reinterpret_cast(actualBuffer) + actual_offset, validNums, 0); break; default: break; } - const auto iBuffer = lockedMemory.as(); - for (size_t tailing = validNums; tailing < maxOutputBoxesPerBatch; tailing++) { - ASSERT_TRUE(iBuffer[actual_offset + tailing] == -1) << "Invalid default value: " << iBuffer[i] << " at index: " << i; + if (m_outStaticShape) { + const auto iBuffer = static_cast(actual.data()); + for (size_t tailing = validNums; tailing < maxOutputBoxesPerBatch; tailing++) { + ASSERT_TRUE(iBuffer[actual_offset + tailing] == -1) << "Invalid default value: " << iBuffer[i] << " at index: " << i; + } } break; } default: FAIL() << "Comparator for " << precision << " precision isn't supported"; } - expected_offset += validNums; - actual_offset += maxOutputBoxesPerBatch; + if (!m_outStaticShape) { + expected_offset += validNums; + actual_offset += validNums; + } else { + expected_offset += validNums; + actual_offset += maxOutputBoxesPerBatch; + } } } else { - const auto& expectedBuffer = expected.second.data(); - auto memory = InferenceEngine::as(actual); - IE_ASSERT(memory); - const auto lockedMemory = memory->wmap(); - const auto actualBuffer = lockedMemory.as(); - - auto k = static_cast(expected.first.size()) / actual->getTensorDesc().getPrecision().size(); - // W/A for int4, uint4 - if (expected.first == ngraph::element::Type_t::u4 || expected.first == ngraph::element::Type_t::i4) { - k /= 2; - } if (outputIndex == 2) { - if (expected.second.size() != k * actual->byteSize()) + if (expected.get_size() != actual.get_size()) throw std::runtime_error("Expected and actual size 3rd output have different " "size"); } - const auto& precision = actual->getTensorDesc().getPrecision(); - size_t size = expected.second.size() / (k * actual->getTensorDesc().getPrecision().size()); + const auto& precision = actual.get_element_type(); + size_t size = expected.get_size(); switch (precision) { - case InferenceEngine::Precision::I32: { - switch (expected.first) { - case ngraph::element::Type_t::i32: + case ov::element::i32: { + switch (expected.get_element_type()) { + case ov::element::i32: LayerTestsUtils::LayerTestsCommon::Compare(reinterpret_cast(expectedBuffer), reinterpret_cast(actualBuffer), size, 0); break; - case ngraph::element::Type_t::i64: + case ov::element::i64: LayerTestsUtils::LayerTestsCommon::Compare(reinterpret_cast(expectedBuffer), reinterpret_cast(actualBuffer), size, 0); break; @@ -203,9 +254,8 @@ void MulticlassNmsLayerTest::Compare(const std::vector shapes; InputPrecisions inPrecisions; - op::v8::MulticlassNms::Attributes attrs; size_t maxOutBoxesPerClass, backgroundClass, keepTopK; element::Type outType; @@ -214,27 +264,19 @@ void MulticlassNmsLayerTest::SetUp() { InputfloatVar inFloatVar; InputboolVar inboolVar; - std::tie(inShapeParams, inPrecisions, maxOutBoxesPerClass, inFloatVar, backgroundClass, keepTopK, outType, sortResultType, inboolVar, targetDevice) = + std::tie(shapes, inPrecisions, maxOutBoxesPerClass, inFloatVar, backgroundClass, keepTopK, outType, sortResultType, inboolVar, targetDevice) = this->GetParam(); - // size_t numBatches, numBoxes, numClasses; - std::tie(numBatches, numBoxes, numClasses) = inShapeParams; - auto realClasses = numClasses; - if (backgroundClass >= 0 && backgroundClass <= numClasses) { - realClasses = realClasses - 1; - } + init_input_shapes(shapes); - maxOutputBoxesPerClass = 0; - if (maxOutBoxesPerClass >= 0) - maxOutputBoxesPerClass = std::min(numBoxes, static_cast(maxOutBoxesPerClass)); - else - maxOutputBoxesPerClass = numBoxes; + // input is dynamic shape -> output will be dynamic shape + // input is static shape -> output will be static shape + const auto inputDynamicParam = {shapes[0].first, shapes[1].first}; + m_outStaticShape = std::any_of(inputDynamicParam.begin(), inputDynamicParam.end(), [](const ov::PartialShape& shape) { + return shape.rank() == 0; + }); - maxOutputBoxesPerBatch = maxOutputBoxesPerClass * realClasses; - if (keepTopK >= 0) - maxOutputBoxesPerBatch = std::min(maxOutputBoxesPerBatch, static_cast(keepTopK)); - - Precision paramsPrec, maxBoxPrec, thrPrec; + ElementType paramsPrec, maxBoxPrec, thrPrec; std::tie(paramsPrec, maxBoxPrec, thrPrec) = inPrecisions; float iouThr, scoreThr, nmsEta; @@ -243,28 +285,39 @@ void MulticlassNmsLayerTest::SetUp() { bool sortResCB, normalized; std::tie(sortResCB, normalized) = inboolVar; - const std::vector boxesShape {numBatches, numBoxes, 4}, scoresShape {numBatches, numClasses, numBoxes}; - auto ngPrc = convertIE2nGraphPrc(paramsPrec); - auto params = builder::makeParams(ngPrc, {boxesShape, scoresShape}); - auto paramOuts = helpers::convert2OutputVector(helpers::castOps2Nodes(params)); + const auto params = ngraph::builder::makeDynamicParams(paramsPrec, inputDynamicShapes); + const auto paramOuts = + ngraph::helpers::convert2OutputVector(ngraph::helpers::castOps2Nodes(params)); - attrs.iou_threshold = iouThr; - attrs.score_threshold = scoreThr; - attrs.nms_eta = nmsEta; - attrs.sort_result_type = sortResultType; - attrs.sort_result_across_batch = sortResCB; - attrs.output_type = outType; - attrs.nms_top_k = maxOutBoxesPerClass; - attrs.keep_top_k = keepTopK; - attrs.background_class = backgroundClass; - attrs.normalized = normalized; + m_attrs.iou_threshold = iouThr; + m_attrs.score_threshold = scoreThr; + m_attrs.nms_eta = nmsEta; + m_attrs.sort_result_type = sortResultType; + m_attrs.sort_result_across_batch = sortResCB; + m_attrs.output_type = outType; + m_attrs.nms_top_k = maxOutBoxesPerClass; + m_attrs.keep_top_k = keepTopK; + m_attrs.background_class = backgroundClass; + m_attrs.normalized = normalized; - auto nms = std::make_shared(paramOuts[0], paramOuts[1], attrs); + auto nms = std::make_shared(paramOuts[0], paramOuts[1], m_attrs); - auto nms_0_identity = std::make_shared(nms->output(0), opset5::Constant::create(ngPrc, Shape {1}, {1})); - auto nms_1_identity = std::make_shared(nms->output(1), opset5::Constant::create(outType, Shape {1}, {1})); - auto nms_2_identity = std::make_shared(nms->output(2), opset5::Constant::create(outType, Shape {1}, {1})); - function = std::make_shared(OutputVector {nms_0_identity, nms_1_identity, nms_2_identity}, params, "MulticlassNMS"); + if (!m_outStaticShape) { + auto result = std::make_shared(nms); + function = std::make_shared(result, params, "MulticlassNMS"); + } else { + auto nms_0_identity = std::make_shared(nms->output(0), opset5::Constant::create(paramsPrec, Shape {1}, {1})); + auto nms_1_identity = std::make_shared(nms->output(1), opset5::Constant::create(outType, Shape {1}, {1})); + auto nms_2_identity = std::make_shared(nms->output(2), opset5::Constant::create(outType, Shape {1}, {1})); + OutputVector results = { + std::make_shared(nms_0_identity), + std::make_shared(nms_1_identity), + std::make_shared(nms_2_identity) + }; + function = std::make_shared(results, params, "MulticlassNMS"); + } } -} // namespace LayerTestsDefinitions +} // namespace subgraph +} // namespace test +} // namespace ov diff --git a/inference-engine/tests/functional/shared_test_classes/src/single_layer/prior_box.cpp b/inference-engine/tests/functional/shared_test_classes/src/single_layer/prior_box.cpp index f3b95141ae0..b901dfd7bfd 100644 --- a/inference-engine/tests/functional/shared_test_classes/src/single_layer/prior_box.cpp +++ b/inference-engine/tests/functional/shared_test_classes/src/single_layer/prior_box.cpp @@ -21,10 +21,10 @@ std::string PriorBoxLayerTest::getTestCaseName(const testing::TestParamInfo min_size, max_size, aspect_ratio, density, fixed_ratio, fixed_size, variance; float step, offset; - bool clip, flip, scale_all_sizes; + bool clip, flip, scale_all_sizes, min_max_aspect_ratios_order; std::tie(min_size, max_size, aspect_ratio, density, fixed_ratio, fixed_size, clip, - flip, step, offset, variance, scale_all_sizes) = specParams; + flip, step, offset, variance, scale_all_sizes, min_max_aspect_ratios_order) = specParams; std::ostringstream result; const char separator = '_'; @@ -47,6 +47,7 @@ std::string PriorBoxLayerTest::getTestCaseName(const testing::TestParamInfo obj) { + std::vector inputShape; + size_t splitsNum; + std::map config; + InferenceEngine::Precision netPrecision; + std::string targetName; + bool withFC; + std::tie(netPrecision, targetName, config, inputShape, splitsNum, withFC) = obj.param; + std::ostringstream result; + result << "IS=" << CommonTestUtils::vec2str(inputShape) << "_"; + result << "SplitsN=" << splitsNum << "_"; + result << "netPRC=" << netPrecision.name() << "_"; + result << "trgDev=" << targetName << "_"; + result << "FC=" << withFC; + for (auto const& configItem : config) { + result << "_configItem=" << configItem.first << "_" << configItem.second; + } + return result.str(); +} + +void SplitConcatMultiInputsTest::SetUp() { + std::vector inputShape; + size_t splitsNum; + std::map tempConfig; + InferenceEngine::Precision netPrecision; + bool withFC; + std::tie(netPrecision, targetDevice, tempConfig, inputShape, splitsNum, withFC) = this->GetParam(); + configuration.insert(tempConfig.begin(), tempConfig.end()); + + inputShape[1] *= splitsNum; + auto ngPrc = FuncTestUtils::PrecisionUtils::convertIE2nGraphPrc(netPrecision); + auto params = ngraph::builder::makeParams(ngPrc, {inputShape}); + + auto split = ngraph::builder::makeSplit(params[0], ngPrc, splitsNum, 1); + ngraph::OutputVector concatInputs = split->outputs(); + + auto concat = std::make_shared(concatInputs, 1); + + if (withFC) { + auto mul_const = ngraph::builder::makeConstant(ngPrc, { 10, inputShape[1] }, + CommonTestUtils::generate_float_numbers(10 * inputShape[1], -0.2f, 0.2f), false); + auto matmul = std::make_shared(concat, mul_const, false, true); + function = std::make_shared(matmul, params, "SplitConcatMultiInputs"); + } else { + function = std::make_shared(concat, params, "SplitConcatMultiInputs"); + } +} + +InferenceEngine::Blob::Ptr SplitConcatMultiInputsTest::GenerateInput(const InferenceEngine::InputInfo &info) const { + return FuncTestUtils::createAndFillBlob(info.getTensorDesc(), inputDataMax - inputDataMin, inputDataMin, 1 / inputDataResolution, + seed); +} +} // namespace SubgraphTestsDefinitions diff --git a/inference-engine/tests/ie_test_utils/common_test_utils/ov_common_utils.hpp b/inference-engine/tests/ie_test_utils/common_test_utils/ov_common_utils.hpp new file mode 100644 index 00000000000..728d335c2dc --- /dev/null +++ b/inference-engine/tests/ie_test_utils/common_test_utils/ov_common_utils.hpp @@ -0,0 +1,27 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace ov { +namespace test { + static void PrintTo(const Any& any, std::ostream* os) { + any.print(*os); + } +} // namespace test +} // namespace ov diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/fake_quantize_and_convolution_function.cpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/fake_quantize_and_convolution_function.cpp index 1ae071fd508..74ee87c469e 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/fake_quantize_and_convolution_function.cpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/fake_quantize_and_convolution_function.cpp @@ -19,6 +19,10 @@ std::shared_ptr FakeQuantizeAndConvolutionFunction::get( const ngraph::PartialShape& inputShape, const FakeQuantizeOnData& fqOnData, const FakeQuantizeOnWeights& fqOnWeights) { + const auto rankLength = inputShape.rank().is_dynamic() ? 4 : inputShape.rank().get_length(); + if ((rankLength != 3ul) && (rankLength != 4ul)) { + throw ov::Exception("not supported input shape rank: " + std::to_string(rankLength)); + } const auto input = std::make_shared(precision, inputShape); const auto fakeQuantizeOnActivations = fqOnData.empty() ? @@ -34,28 +38,31 @@ std::shared_ptr FakeQuantizeAndConvolutionFunction::get( const size_t outputChannelsCount = 2 * inputShape[1].get_length(); const auto weights = ngraph::opset1::Constant::create( precision, - ngraph::Shape{ outputChannelsCount, inputChannelsCount, 1, 1 }, + rankLength == 3ul ? + (ngraph::Shape{ outputChannelsCount, inputChannelsCount, 1}) : + (ngraph::Shape{ outputChannelsCount, inputChannelsCount, 1, 1 }), std::vector(outputChannelsCount * inputChannelsCount, 1)); auto maxPool = std::make_shared( fqOnData.empty() ? input : fakeQuantizeOnActivations, - Strides{ 1, 1 }, - Shape{ 1, 1 }, - Shape{ 0, 0 }, - Shape{ 2, 2 }, + Strides(rankLength - 2, 1ul), + Shape(rankLength - 2, 1ul), + Shape(rankLength - 2, 0ul), + Shape(rankLength - 2, 2ul), op::RoundingType::FLOOR); maxPool->set_friendly_name("maxPool"); const auto convolution = std::make_shared( maxPool, //fqOnData.empty() ? input : fakeQuantizeOnActivations, - fqOnWeights.empty() ? weights->output(0) : - ngraph::builder::makeFakeQuantize( - weights, precision, fqOnWeights.quantizationLevel, fqOnWeights.constantShape, - fqOnWeights.inputLowValues, fqOnWeights.inputHighValues, fqOnWeights.outputLowValues, fqOnWeights.outputHighValues), - ngraph::Strides{ 1, 1 }, - ngraph::CoordinateDiff{ 0, 0 }, - ngraph::CoordinateDiff{ 0, 0 }, - ngraph::Strides{ 1, 1 }); + fqOnWeights.empty() ? + weights->output(0) : + ngraph::builder::makeFakeQuantize( + weights, precision, fqOnWeights.quantizationLevel, fqOnWeights.constantShape, + fqOnWeights.inputLowValues, fqOnWeights.inputHighValues, fqOnWeights.outputLowValues, fqOnWeights.outputHighValues), + ngraph::Strides(rankLength - 2, 1ul), + ngraph::CoordinateDiff(rankLength - 2, 0ul), + ngraph::CoordinateDiff(rankLength - 2, 0ul), + ngraph::Strides(rankLength - 2, 1ul)); convolution->set_friendly_name("convolution"); ngraph::ResultVector results{ std::make_shared(convolution) }; diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/group_convolution_function.cpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/group_convolution_function.cpp index fb6f82696cb..335f6f44df4 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/group_convolution_function.cpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/group_convolution_function.cpp @@ -22,6 +22,7 @@ namespace builder { namespace subgraph { std::shared_ptr createWeightsOriginal( + const long long int rankLength, const ngraph::element::Type precision, const size_t inputChannelsCount, const size_t outputChannelsCount, @@ -35,7 +36,9 @@ std::shared_ptr createWeightsOriginal( if (fakeQuantizeOnWeights.empty() && dequantizationOnWeights.empty()) { weights = ngraph::opset1::Constant::create( precision, - ngraph::Shape{ outputChannelsCount, inputChannelsCount, 1, 1 }, + rankLength == 3 ? + ngraph::Shape{ outputChannelsCount, inputChannelsCount, 1 } : + ngraph::Shape{ outputChannelsCount, inputChannelsCount, 1, 1 }, weightsValues.size() == 1ul ? std::vector(outputChannelsCount * inputChannelsCount, weightsValues[0]) : weightsValues); @@ -43,9 +46,15 @@ std::shared_ptr createWeightsOriginal( const size_t inputChannelsPerGroup = inputChannelsCount / groupCount; weights = ngraph::opset1::Constant::create( precision, - ngraph::Shape{ outputChannelsCount, inputChannelsPerGroup, kernelSize, kernelSize }, + rankLength == 3 ? + ngraph::Shape{ outputChannelsCount, inputChannelsPerGroup, kernelSize } : + ngraph::Shape{ outputChannelsCount, inputChannelsPerGroup, kernelSize, kernelSize }, weightsValues.size() == 1ul ? - std::vector(outputChannelsCount * kernelSize * kernelSize * inputChannelsPerGroup, weightsValues[0]) : + std::vector( + rankLength == 3 ? + outputChannelsCount * kernelSize * inputChannelsPerGroup : + outputChannelsCount * kernelSize * kernelSize * inputChannelsPerGroup, + weightsValues[0]) : weightsValues); if (!fakeQuantizeOnWeights.empty()) { @@ -53,7 +62,9 @@ std::shared_ptr createWeightsOriginal( weights, precision, fakeQuantizeOnWeights.quantizationLevel, - { outputChannelsCount, 1, 1, 1 }, + rankLength == 3 ? + std::vector{ outputChannelsCount, 1, 1 } : + std::vector{ outputChannelsCount, 1, 1, 1 }, fakeQuantizeOnWeights.inputLowValues, fakeQuantizeOnWeights.inputHighValues, fakeQuantizeOnWeights.outputLowValues, @@ -68,13 +79,19 @@ std::shared_ptr createWeightsOriginal( weights, ngraph::opset1::Constant::create( element::i64, - Shape{ 5 }, - std::vector { - calculatedDimention == 0 ? -1 : static_cast(groupCount), - calculatedDimention == 1 ? -1 : static_cast(outputChannelsCount / groupCount), - static_cast(inputChannelsPerGroup), - static_cast(kernelSize), - static_cast(kernelSize) }), + Shape{ static_cast(rankLength) + 1ul }, + rankLength == 3 ? + std::vector { + calculatedDimention == 0 ? -1 : static_cast(groupCount), + calculatedDimention == 1 ? -1 : static_cast(outputChannelsCount / groupCount), + static_cast(inputChannelsPerGroup), + static_cast(kernelSize) } : + std::vector { + calculatedDimention == 0 ? -1 : static_cast(groupCount), + calculatedDimention == 1 ? -1 : static_cast(outputChannelsCount / groupCount), + static_cast(inputChannelsPerGroup), + static_cast(kernelSize), + static_cast(kernelSize) }), true); } @@ -90,6 +107,11 @@ std::shared_ptr GroupConvolutionFunction::getOriginal( const ngraph::builder::subgraph::DequantizationOperations& dequantizationBefore, std::shared_ptr weightsConst, const ngraph::builder::subgraph::FakeQuantizeOnWeights fakeQuantizeOnWeights) { + const auto rankLength = inputShape.size(); + if ((rankLength != 3) && (rankLength != 4)) { + throw ov::Exception("not supported input shape rank: " + std::to_string(rankLength)); + } + const auto input = std::make_shared(precision, inputShape); const auto dequantization = makeDequantization(input, dequantizationBefore); @@ -103,6 +125,7 @@ std::shared_ptr GroupConvolutionFunction::getOriginal( } std::shared_ptr weights = createWeightsOriginal( + rankLength, weightsConst->get_element_type(), inputChannelsCount, outputChannelsCount, @@ -135,23 +158,49 @@ std::shared_ptr GroupConvolutionFunction::getOriginal( const FakeQuantizeOnData& fakeQuantizeOnData, const FakeQuantizeOnWeights& fakeQuantizeOnWeights, const bool addPrecisionPreserved) { + const auto rankLength = inputShape.rank().is_dynamic() ? 4 : inputShape.rank().get_length(); + if ((rankLength != 3) && (rankLength != 4)) { + throw ov::Exception("not supported input shape rank: " + std::to_string(rankLength)); + } + const auto input = std::make_shared(precision, inputShape); std::shared_ptr parent = input; if (!fakeQuantizeOnData.empty()) { parent = std::make_shared( input, - std::make_shared(precision, Shape{ 1, fakeQuantizeOnData.inputLowValues.size(), 1, 1 }, fakeQuantizeOnData.inputLowValues), - std::make_shared(precision, Shape{ 1, fakeQuantizeOnData.inputHighValues.size(), 1, 1 }, fakeQuantizeOnData.inputHighValues), - std::make_shared(precision, Shape{ 1, fakeQuantizeOnData.outputLowValues.size(), 1, 1 }, fakeQuantizeOnData.outputLowValues), - std::make_shared(precision, Shape{ 1, fakeQuantizeOnData.outputHighValues.size(), 1, 1 }, fakeQuantizeOnData.outputHighValues), + std::make_shared( + precision, + rankLength == 3 ? + Shape{ 1, fakeQuantizeOnData.inputLowValues.size(), 1 } : + Shape{ 1, fakeQuantizeOnData.inputLowValues.size(), 1, 1 }, + fakeQuantizeOnData.inputLowValues), + std::make_shared( + precision, + rankLength == 3 ? + Shape{ 1, fakeQuantizeOnData.inputHighValues.size(), 1 } : + Shape{ 1, fakeQuantizeOnData.inputHighValues.size(), 1, 1 }, + fakeQuantizeOnData.inputHighValues), + std::make_shared( + precision, + rankLength == 3 ? + Shape{ 1, fakeQuantizeOnData.outputLowValues.size(), 1 } : + Shape{ 1, fakeQuantizeOnData.outputLowValues.size(), 1, 1 }, + fakeQuantizeOnData.outputLowValues), + std::make_shared( + precision, + rankLength == 3 ? + Shape{ 1, fakeQuantizeOnData.outputHighValues.size(), 1 } : + Shape{ 1, fakeQuantizeOnData.outputHighValues.size(), 1, 1 }, + fakeQuantizeOnData.outputHighValues), fakeQuantizeOnData.quantizationLevel); } if (addPrecisionPreserved) { - const std::vector stride = { 1, 1 }; - const std::vector padBegin = { 0, 0 }; - const std::vector padEnd = { 0, 0 }; + const std::vector stride(rankLength - 2, 1ul); + const std::vector padBegin(rankLength - 2, 0ul); + const std::vector padEnd(rankLength - 2, 0ul); + const std::vector padKernel(rankLength - 2, 3ul); const ngraph::op::PadType padType = ngraph::op::PadType::NOTSET; const ngraph::op::RoundingType roundingType = ngraph::op::RoundingType::FLOOR; const auto pooling = std::make_shared( @@ -159,7 +208,7 @@ std::shared_ptr GroupConvolutionFunction::getOriginal( stride, padBegin, padEnd, - ngraph::Shape{ 3, 3 }, + padKernel, roundingType, padType); parent = pooling; @@ -173,6 +222,7 @@ std::shared_ptr GroupConvolutionFunction::getOriginal( std::vector weightsValues = { 1.f }; std::shared_ptr weights = createWeightsOriginal( + rankLength, precision, inputChannelsCount, outputChannelsCount, @@ -186,10 +236,10 @@ std::shared_ptr GroupConvolutionFunction::getOriginal( const auto convolution = std::make_shared( parent, weights, - ngraph::Strides{ 1, 1 }, - ngraph::CoordinateDiff{ 0, 0 }, - ngraph::CoordinateDiff{ 0, 0 }, - ngraph::Strides{ 1, 1 }); + ngraph::Strides(rankLength - 2, 1ul), + ngraph::CoordinateDiff(rankLength - 2, 0), + ngraph::CoordinateDiff(rankLength - 2, 0), + ngraph::Strides(rankLength - 2, 1)); ngraph::ResultVector results{ std::make_shared(convolution) }; return std::make_shared(results, ngraph::ParameterVector{ input }, "GroupConvolutionTransformation"); @@ -208,6 +258,11 @@ std::shared_ptr GroupConvolutionFunction::get( const ngraph::element::Type precisionAfterOperation, const ngraph::builder::subgraph::DequantizationOperations& dequantizationAfter, const ngraph::element::Type precisionAfterDequantization) { + const auto rankLength = inputShape.rank().is_dynamic() ? 4 : inputShape.rank().get_length(); + if ((rankLength != 3) && (rankLength != 4)) { + throw ov::Exception("not supported input shape rank: " + std::to_string(rankLength)); + } + const auto input = std::make_shared(precision, inputShape); const auto deqBefore = makeDequantization(input, dequantizationBefore); @@ -235,6 +290,7 @@ std::shared_ptr GroupConvolutionFunction::get( weightsConst->cast_vector()[0]) : weightsConst->cast_vector()); } else { weights = createWeightsOriginal( + rankLength, weightsConst->get_element_type(), inputChannelsCount, outputChannelsCount, diff --git a/inference-engine/tests/ngraph_helpers/ngraph_functions/include/ngraph_functions/builders.hpp b/inference-engine/tests/ngraph_helpers/ngraph_functions/include/ngraph_functions/builders.hpp index be1b755ae0f..473788f19e5 100644 --- a/inference-engine/tests/ngraph_helpers/ngraph_functions/include/ngraph_functions/builders.hpp +++ b/inference-engine/tests/ngraph_helpers/ngraph_functions/include/ngraph_functions/builders.hpp @@ -26,6 +26,8 @@ ngraph::ParameterVector makeParams(const element::Type &type, const std::vector< ngraph::ParameterVector makeDynamicParams(const element::Type &type, const std::vector &shapes); +ngraph::ParameterVector makeDynamicParams(const std::vector& types, const std::vector& shapes); + ngraph::ParameterVector makeParams(const element::Type &type, const std::vector>> &inputs); diff --git a/inference-engine/tests/ngraph_helpers/ngraph_functions/include/ngraph_functions/utils/ngraph_helpers.hpp b/inference-engine/tests/ngraph_helpers/ngraph_functions/include/ngraph_functions/utils/ngraph_helpers.hpp index 76e4db937db..37533b5d446 100644 --- a/inference-engine/tests/ngraph_helpers/ngraph_functions/include/ngraph_functions/utils/ngraph_helpers.hpp +++ b/inference-engine/tests/ngraph_helpers/ngraph_functions/include/ngraph_functions/utils/ngraph_helpers.hpp @@ -320,6 +320,10 @@ std::ostream& operator<<(std::ostream & os, SequenceTestsMode type); std::ostream& operator<<(std::ostream & os, MemoryTransformation type); +std::ostream& operator<<(std::ostream & os, op::util::NmsBase::SortResultType type); + +std::ostream& operator<<(std::ostream & os, op::v8::MatrixNms::DecayFunction type); + void resize_function(std::shared_ptr function, const std::vector& targetInputStaticShapes); } // namespace helpers diff --git a/inference-engine/tests/ngraph_helpers/ngraph_functions/src/broadcast.cpp b/inference-engine/tests/ngraph_helpers/ngraph_functions/src/broadcast.cpp index 5e825ec369a..a30044725bb 100644 --- a/inference-engine/tests/ngraph_helpers/ngraph_functions/src/broadcast.cpp +++ b/inference-engine/tests/ngraph_helpers/ngraph_functions/src/broadcast.cpp @@ -19,7 +19,7 @@ std::shared_ptr makeBroadcast(const ngraph::Output &in, target_shape, axisSetConst, mode); - } else { // numpy/bidiractional modes + } else { // numpy/bidirectional modes return std::make_shared(in, target_shape, mode); diff --git a/inference-engine/tests/ngraph_helpers/ngraph_functions/src/params_vector.cpp b/inference-engine/tests/ngraph_helpers/ngraph_functions/src/params_vector.cpp index cddc5361823..fe396baf6db 100644 --- a/inference-engine/tests/ngraph_helpers/ngraph_functions/src/params_vector.cpp +++ b/inference-engine/tests/ngraph_helpers/ngraph_functions/src/params_vector.cpp @@ -43,5 +43,15 @@ ngraph::ParameterVector makeDynamicParams(const element::Type &type, const std:: return outs; } +ngraph::ParameterVector makeDynamicParams(const std::vector& types, const std::vector& shapes) { + ngraph::ParameterVector outs; + NGRAPH_CHECK(types.size() == shapes.size()); + for (size_t i = 0; i < types.size(); i++) { + auto paramNode = std::make_shared(types[i], shapes[i]); + outs.push_back(paramNode); + } + return outs; +} + } // namespace builder } // namespace ngraph \ No newline at end of file diff --git a/inference-engine/tests/ngraph_helpers/ngraph_functions/src/utils/ngraph_helpers.cpp b/inference-engine/tests/ngraph_helpers/ngraph_functions/src/utils/ngraph_helpers.cpp index 5d1c813a8b2..4f52894c941 100644 --- a/inference-engine/tests/ngraph_helpers/ngraph_functions/src/utils/ngraph_helpers.cpp +++ b/inference-engine/tests/ngraph_helpers/ngraph_functions/src/utils/ngraph_helpers.cpp @@ -903,6 +903,37 @@ std::ostream& operator<<(std::ostream & os, MemoryTransformation type) { return os; } +std::ostream& operator<<(std::ostream & os, ngraph::op::util::NmsBase::SortResultType type) { + switch (type) { + case op::util::NmsBase::SortResultType::CLASSID: + os << "CLASSID"; + break; + case op::util::NmsBase::SortResultType::SCORE: + os << "SCORE"; + break; + case op::util::NmsBase::SortResultType::NONE: + os << "NONE"; + break; + default: + throw std::runtime_error("NOT_SUPPORTED_TYPE"); + } + return os; +} + +std::ostream& operator<<(std::ostream & os, op::v8::MatrixNms::DecayFunction type) { + switch (type) { + case op::v8::MatrixNms::DecayFunction::GAUSSIAN: + os << "GAUSSIAN"; + break; + case op::v8::MatrixNms::DecayFunction::LINEAR: + os << "LINEAR"; + break; + default: + throw std::runtime_error("NOT_SUPPORTED_TYPE"); + } + return os; +} + void resize_function(std::shared_ptr function, const std::vector& targetInputStaticShapes) { auto inputs = function->inputs(); diff --git a/inference-engine/tests/unit/cpu/mkldnn_memory_desc_test.cpp b/inference-engine/tests/unit/cpu/mkldnn_memory_desc_test.cpp index 90efd5b9f77..c4ff9feb0cb 100644 --- a/inference-engine/tests/unit/cpu/mkldnn_memory_desc_test.cpp +++ b/inference-engine/tests/unit/cpu/mkldnn_memory_desc_test.cpp @@ -540,3 +540,15 @@ TEST(cloneWithParamsChange, UndefinedAndDefaultParams) { cloneWithParamsChangeCpu(tc); } } + +TEST(makeDummyDesc, LowerBoundMoreThenDummyValie) { + Shape shape(ngraph::PartialShape{1, 3, 85, {144, 1444}}); + auto desc = std::make_shared(shape, mkldnn::memory::data_type::f32, mkldnn::memory::format_tag::nchw); + ASSERT_FALSE(desc->isDefined()); + + MemoryDescPtr definedDesc; + ASSERT_NO_THROW(definedDesc = MemoryDescUtils::makeDummyDesc(*desc)); + + ASSERT_TRUE(definedDesc->isDefined()); + ASSERT_EQ((VectorDims{1, 3, 85, 144}), definedDesc->getShape().getStaticDims()); +} diff --git a/inference-engine/tests/unit/inference_engine/ie_executable_network_test.cpp b/inference-engine/tests/unit/inference_engine/ie_executable_network_test.cpp index 3595c5194f4..9c1e54a5d60 100644 --- a/inference-engine/tests/unit/inference_engine/ie_executable_network_test.cpp +++ b/inference-engine/tests/unit/inference_engine/ie_executable_network_test.cpp @@ -29,7 +29,7 @@ using testing::SetArgReferee; // 1. void Export(const std::string& modelFileName) // 2. void Export(std::ostream& networkModel) // 4. CNNNetwork GetExecGraphInfo() -// 5. void SetConfig(const std::map& config) +// 5. void SetConfig(const std::map& config) // 6. Parameter GetConfig(const std::string& name) const // 7. Parameter GetMetric(const std::string& name) const // 8. RemoteContext::Ptr GetContext() diff --git a/inference-engine/tests/unit/multi/CMakeLists.txt b/inference-engine/tests/unit/multi/CMakeLists.txt index 09990de09d2..4456c3100f9 100644 --- a/inference-engine/tests/unit/multi/CMakeLists.txt +++ b/inference-engine/tests/unit/multi/CMakeLists.txt @@ -11,9 +11,9 @@ add_definitions(-DMULTIUNITTEST) addIeTargetTest( NAME ${TARGET_NAME} ROOT ${CMAKE_CURRENT_SOURCE_DIR} - ADDITIONAL_SOURCE_DIRS ${IE_MAIN_SOURCE_DIR}/src/multi_device + ADDITIONAL_SOURCE_DIRS ${IE_MAIN_SOURCE_DIR}/src/multi_device ${IE_MAIN_SOURCE_DIR}/src/multi_device/utils INCLUDES - ${IE_MAIN_SOURCE_DIR}/src/multi_device + ${IE_MAIN_SOURCE_DIR}/src/multi_device ${CMAKE_CURRENT_SOURCE_DIR} LINK_LIBRARIES inference_engine_lp_transformations ngraphFunctions diff --git a/inference-engine/tests/unit/multi/auto_select_device_failed_test.cpp b/inference-engine/tests/unit/multi/auto_select_device_failed_test.cpp index 261af289ae5..98aefa36eb3 100644 --- a/inference-engine/tests/unit/multi/auto_select_device_failed_test.cpp +++ b/inference-engine/tests/unit/multi/auto_select_device_failed_test.cpp @@ -127,6 +127,10 @@ public: IE_SET_METRIC(OPTIMAL_NUMBER_OF_INFER_REQUESTS, optimalNum, 2); ON_CALL(*mockIExeNet.get(), GetMetric(StrEq(METRIC_KEY(OPTIMAL_NUMBER_OF_INFER_REQUESTS)))) .WillByDefault(Return(optimalNum)); + IE_SET_METRIC(SUPPORTED_CONFIG_KEYS, supportConfigs, {}); + ON_CALL(*core, GetMetric(_, StrEq(METRIC_KEY(SUPPORTED_CONFIG_KEYS)), _)) + .WillByDefault(Return(supportConfigs)); + EXPECT_CALL(*core, GetMetric(_, StrEq(METRIC_KEY(SUPPORTED_CONFIG_KEYS)), _)).Times(AnyNumber()); } }; diff --git a/inference-engine/tests/unit/multi/log_utils_test.cpp b/inference-engine/tests/unit/multi/log_utils_test.cpp new file mode 100644 index 00000000000..5c694b30d99 --- /dev/null +++ b/inference-engine/tests/unit/multi/log_utils_test.cpp @@ -0,0 +1,133 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + + +#include +#include +#include "utils/log_util.hpp" +#include +using ::testing::_; +using namespace MockMultiDevice; +#if (defined(_WIN32) || defined(_WIN64)) +#include +#elif defined(__linux__) +#include +#elif defined(__APPLE__) +#include +#else +#endif + +MockLog* MockLog::_mockLog = NULL; +using ConfigParams = std::tuple< + std::string, // logLevel + std::string, // envlogLevel + int // expectCallNum + >; +class LogUtilsTest : public ::testing::TestWithParam { +public: + std::string _logLevel; + std::string _envLogLevel; + int _expectCallNum; + +public: + static std::string getTestCaseName(testing::TestParamInfo obj) { + std::string logLevel; + std::string envLogLevel; + int expectCallNum; + std::tie(logLevel, envLogLevel, expectCallNum) = obj.param; + std::ostringstream result; + result << "logLevel_" << logLevel << "_expectCallNum_" << expectCallNum + << "envlogLevel" << envLogLevel; + return result.str(); + } + + void SetTestEnv(std::string key, std::string value) { +#ifdef WIN32 + SetEnvironmentVariable(key.c_str(), value.c_str()); +#elif defined(__linux__) + ::setenv(key.c_str(), value.c_str(), true); +#elif defined(__APPLE__) + ::setenv(key.c_str(), value.c_str(), true); +#else +#endif + } + + void SetUp() override { + std::tie(_logLevel, _envLogLevel, _expectCallNum) = this->GetParam(); + } + + void TearDown() override { + MockLog::Release(); + } + + void printLog() { + LOG_TRACE(true, "test", "TRACE"); + LOG_DEBUG("DEBUG"); + LOG_INFO("INFO"); + LOG_WARNING("WARNING"); + LOG_ERROR("ERROR"); + LOG_TRACE(true, "test", "%s", "TRACE"); + LOG_DEBUG("%s", "DEBUG"); + LOG_INFO("%s", "INFO"); + LOG_WARNING("%s", "WARNING"); + LOG_ERROR("%s", "ERROR"); + } +}; + +TEST_P(LogUtilsTest, setLogLevel) { + EXPECT_CALL(*(HLogger), print(_)).Times(_expectCallNum); + setLogLevel(_logLevel); + printLog(); +} + +TEST_P(LogUtilsTest, setEnvNotAffectSetLogLevel) { + EXPECT_CALL(*(HLogger), print(_)).Times(_expectCallNum); + setLogLevel(_logLevel); + SetTestEnv("OPENVINO_LOG_LEVEL", "3"); + printLog(); +} + +//can not test ENV case. because of the ENV variable is readed at the +//beginning of test application and modify it in runtime is not valid +//still need to test it in different platform manully +//TEST_P(LogUtilsTest, setEnvLogLevel) { +// SetTestEnv("AUTO_LOG_LEVEL", _envLogLevel); +// EXPECT_CALL(*(HLogger), print(_)).Times(_expectCallNum); +// printLog(); +//} +// + +TEST(smoke_Auto_BehaviorTests, LogUtilsSingleton) { + std::vector> futureVect; + std::shared_ptr instanceVector[20]; + for (unsigned int i = 0; i < 20; i++) { + auto future = std::async(std::launch::async, [this, &instanceVector, i] { + instanceVector[i] = Log::instance(); + }); + futureVect.push_back(std::move(future)); + } + + for (auto& future : futureVect) { + future.wait(); + } + + for (unsigned int i = 0; i < 19; i++) { + EXPECT_NE(instanceVector[i].get(), nullptr); + EXPECT_EQ(instanceVector[i].get(), instanceVector[i+1].get()); + } +} + +const std::vector testConfigs = +{ConfigParams {"LOG_NONE", "0", 0}, + ConfigParams {"LOG_NONE", "1", 0}, + ConfigParams {"LOG_ERROR", "2", 2}, + ConfigParams {"LOG_WARNING", "3", 4}, + ConfigParams {"LOG_INFO", "4", 6}, + ConfigParams {"LOG_DEBUG", "5", 8}, + ConfigParams {"LOG_TRACE", "6", 10}}; + +INSTANTIATE_TEST_SUITE_P(smoke_Auto_BehaviorTests, LogUtilsTest, + ::testing::ValuesIn(testConfigs), + LogUtilsTest::getTestCaseName); + diff --git a/inference-engine/tests/unit/multi/plugin/mock_log_utils.hpp b/inference-engine/tests/unit/multi/plugin/mock_log_utils.hpp new file mode 100644 index 00000000000..99ff9f29e7e --- /dev/null +++ b/inference-engine/tests/unit/multi/plugin/mock_log_utils.hpp @@ -0,0 +1,30 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once +#include +#include "utils/log.hpp" +using namespace MockMultiDevicePlugin; +namespace MockMultiDevice { + +class MockLog : public Log { +public: + MOCK_METHOD(void, print, (std::stringstream& stream), (override)); + MockLog(std::string unittest):Log(unittest) { + } + static MockLog* GetInstance() { + if (_mockLog == NULL) { + _mockLog = new MockLog("unittest"); + } + return _mockLog; + } + static void Release() { + if (_mockLog) { + delete _mockLog; + _mockLog = NULL; + } + } + static MockLog* _mockLog; +}; +}// namespace MockMultiDevice diff --git a/inference-engine/tests_deprecated/CMakeLists.txt b/inference-engine/tests_deprecated/CMakeLists.txt index 31f5a9f7f96..996b8796461 100644 --- a/inference-engine/tests_deprecated/CMakeLists.txt +++ b/inference-engine/tests_deprecated/CMakeLists.txt @@ -8,6 +8,7 @@ if(NOT MSVC) ie_add_compiler_flags(-Wno-unused-variable) endif() +add_subdirectory(readers) add_subdirectory(helpers) if (ENABLE_GAPI_TESTS) diff --git a/inference-engine/tests_deprecated/functional/gna/CMakeLists.txt b/inference-engine/tests_deprecated/functional/gna/CMakeLists.txt index d8a66f32830..06b8a48e12f 100644 --- a/inference-engine/tests_deprecated/functional/gna/CMakeLists.txt +++ b/inference-engine/tests_deprecated/functional/gna/CMakeLists.txt @@ -16,7 +16,7 @@ file(GLOB TEST_SRC list(APPEND DEPENDENCIES GNAPlugin) if(ENABLE_HETERO) - list(APPEND DEPENDENCIES HeteroPlugin) + list(APPEND DEPENDENCIES ov_hetero_plugin) endif() if(ENABLE_MKL_DNN) diff --git a/inference-engine/tests_deprecated/functional/shared_tests/CMakeLists.txt b/inference-engine/tests_deprecated/functional/shared_tests/CMakeLists.txt index 98a91873b8a..d16ccb821b6 100644 --- a/inference-engine/tests_deprecated/functional/shared_tests/CMakeLists.txt +++ b/inference-engine/tests_deprecated/functional/shared_tests/CMakeLists.txt @@ -61,7 +61,7 @@ endif() target_link_libraries(${TARGET_NAME} PUBLIC ${SHARED_LIBRARIES}) if(ENABLE_HETERO) - add_dependencies(${TARGET_NAME} HeteroPlugin) + add_dependencies(${TARGET_NAME} ov_hetero_plugin) endif() # developer package diff --git a/inference-engine/tests_deprecated/functional/vpu/CMakeLists.txt b/inference-engine/tests_deprecated/functional/vpu/CMakeLists.txt index c6fa691c53d..7e70aaf90dc 100644 --- a/inference-engine/tests_deprecated/functional/vpu/CMakeLists.txt +++ b/inference-engine/tests_deprecated/functional/vpu/CMakeLists.txt @@ -8,7 +8,7 @@ set(VPU_DEPENDENCIES if (ENABLE_CLDNN) list(APPEND VPU_DEPENDENCIES clDNNPlugin) if(ENABLE_HETERO) - list(APPEND VPU_DEPENDENCIES HeteroPlugin) + list(APPEND VPU_DEPENDENCIES ov_hetero_plugin) endif() endif() diff --git a/inference-engine/tests_deprecated/readers/CMakeLists.txt b/inference-engine/tests_deprecated/readers/CMakeLists.txt new file mode 100644 index 00000000000..108468dcfa9 --- /dev/null +++ b/inference-engine/tests_deprecated/readers/CMakeLists.txt @@ -0,0 +1,8 @@ +# Copyright (C) 2018-2021 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 +# + +if(ENABLE_IR_V7_READER) + add_subdirectory(ir_reader_v7) + add_dependencies(ov_runtime_libraries inference_engine_ir_v7_reader) +endif() diff --git a/inference-engine/src/readers/ir_reader_v7/CMakeLists.txt b/inference-engine/tests_deprecated/readers/ir_reader_v7/CMakeLists.txt similarity index 95% rename from inference-engine/src/readers/ir_reader_v7/CMakeLists.txt rename to inference-engine/tests_deprecated/readers/ir_reader_v7/CMakeLists.txt index 663649c4048..e69de57f879 100644 --- a/inference-engine/src/readers/ir_reader_v7/CMakeLists.txt +++ b/inference-engine/tests_deprecated/readers/ir_reader_v7/CMakeLists.txt @@ -34,7 +34,7 @@ target_compile_definitions(${TARGET_NAME} PRIVATE IMPLEMENT_INFERENCE_ENGINE_PLU target_include_directories(${TARGET_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/") -target_link_libraries(${TARGET_NAME} PRIVATE inference_engine_reader_api inference_engine_plugin_api +target_link_libraries(${TARGET_NAME} PRIVATE inference_engine_plugin_api inference_engine_legacy pugixml::static openvino::itt) ie_add_api_validator_post_build_step(TARGET ${TARGET_NAME}) diff --git a/inference-engine/src/readers/ir_reader_v7/ie_blob_proxy.hpp b/inference-engine/tests_deprecated/readers/ir_reader_v7/ie_blob_proxy.hpp similarity index 100% rename from inference-engine/src/readers/ir_reader_v7/ie_blob_proxy.hpp rename to inference-engine/tests_deprecated/readers/ir_reader_v7/ie_blob_proxy.hpp diff --git a/inference-engine/src/readers/ir_reader_v7/ie_cnn_net_reader_impl.cpp b/inference-engine/tests_deprecated/readers/ir_reader_v7/ie_cnn_net_reader_impl.cpp similarity index 100% rename from inference-engine/src/readers/ir_reader_v7/ie_cnn_net_reader_impl.cpp rename to inference-engine/tests_deprecated/readers/ir_reader_v7/ie_cnn_net_reader_impl.cpp diff --git a/inference-engine/src/readers/ir_reader_v7/ie_cnn_net_reader_impl.h b/inference-engine/tests_deprecated/readers/ir_reader_v7/ie_cnn_net_reader_impl.h similarity index 100% rename from inference-engine/src/readers/ir_reader_v7/ie_cnn_net_reader_impl.h rename to inference-engine/tests_deprecated/readers/ir_reader_v7/ie_cnn_net_reader_impl.h diff --git a/inference-engine/src/readers/ir_reader_v7/ie_format_parser.cpp b/inference-engine/tests_deprecated/readers/ir_reader_v7/ie_format_parser.cpp similarity index 100% rename from inference-engine/src/readers/ir_reader_v7/ie_format_parser.cpp rename to inference-engine/tests_deprecated/readers/ir_reader_v7/ie_format_parser.cpp diff --git a/inference-engine/src/readers/ir_reader_v7/ie_format_parser.h b/inference-engine/tests_deprecated/readers/ir_reader_v7/ie_format_parser.h similarity index 100% rename from inference-engine/src/readers/ir_reader_v7/ie_format_parser.h rename to inference-engine/tests_deprecated/readers/ir_reader_v7/ie_format_parser.h diff --git a/inference-engine/src/readers/ir_reader_v7/ie_ir_itt.hpp b/inference-engine/tests_deprecated/readers/ir_reader_v7/ie_ir_itt.hpp similarity index 100% rename from inference-engine/src/readers/ir_reader_v7/ie_ir_itt.hpp rename to inference-engine/tests_deprecated/readers/ir_reader_v7/ie_ir_itt.hpp diff --git a/inference-engine/src/readers/ir_reader_v7/ie_ir_parser.cpp b/inference-engine/tests_deprecated/readers/ir_reader_v7/ie_ir_parser.cpp similarity index 76% rename from inference-engine/src/readers/ir_reader_v7/ie_ir_parser.cpp rename to inference-engine/tests_deprecated/readers/ir_reader_v7/ie_ir_parser.cpp index 8d15d0f5752..e52431de5cd 100644 --- a/inference-engine/src/readers/ir_reader_v7/ie_ir_parser.cpp +++ b/inference-engine/tests_deprecated/readers/ir_reader_v7/ie_ir_parser.cpp @@ -2,13 +2,13 @@ // SPDX-License-Identifier: Apache-2.0 // -#include "ie_reader.hpp" #include "ie_ir_parser.hpp" #include "ie_cnn_net_reader_impl.h" +#include "legacy/ie_reader.hpp" using namespace InferenceEngine; -IRParser::IRParser(size_t version): IRParser(version, {}) {} +IRParser::IRParser(size_t version) : IRParser(version, {}) {} IRParser::IRParser(size_t version, const std::vector& exts) { if (version < 10) { parser = std::make_shared(); @@ -29,29 +29,25 @@ class WeightsHolderBlob : public TBlob { Blob::CPtr originBlob; public: - explicit WeightsHolderBlob(const Blob::CPtr& weights) : - TBlob(weights->getTensorDesc(), - weights->cbuffer().as()), - originBlob(weights) { } + explicit WeightsHolderBlob(const Blob::CPtr& weights) + : TBlob(weights->getTensorDesc(), weights->cbuffer().as()), originBlob(weights) {} }; CNNNetwork CNNParser::parse(const pugi::xml_node& root, const Blob::CPtr& weights) { details::CNNNetReaderImpl reader(std::make_shared()); ResponseDesc resp; StatusCode ret = reader.ReadNetwork(root, &resp); - if (ret != OK) - IE_THROW() << resp.msg; + if (ret != OK) IE_THROW() << resp.msg; TBlob::Ptr weightsPtr; if (weights != nullptr) { weightsPtr = TBlob::Ptr(new WeightsHolderBlob(weights)); } else { - weightsPtr = std::make_shared>(TensorDesc(Precision::U8, { 0 }, Layout::C)); + weightsPtr = std::make_shared>(TensorDesc(Precision::U8, {0}, Layout::C)); weightsPtr->allocate(); } ret = reader.SetWeights(weightsPtr, &resp); - if (ret != OK) - IE_THROW() << resp.msg; + if (ret != OK) IE_THROW() << resp.msg; return reader.getNetwork(); } diff --git a/inference-engine/src/readers/ir_reader_v7/ie_ir_parser.hpp b/inference-engine/tests_deprecated/readers/ir_reader_v7/ie_ir_parser.hpp similarity index 100% rename from inference-engine/src/readers/ir_reader_v7/ie_ir_parser.hpp rename to inference-engine/tests_deprecated/readers/ir_reader_v7/ie_ir_parser.hpp diff --git a/inference-engine/src/readers/ir_reader_v7/ie_ir_reader.cpp b/inference-engine/tests_deprecated/readers/ir_reader_v7/ie_ir_reader.cpp similarity index 97% rename from inference-engine/src/readers/ir_reader_v7/ie_ir_reader.cpp rename to inference-engine/tests_deprecated/readers/ir_reader_v7/ie_ir_reader.cpp index 1e27c8b6fb7..193fd6e0f19 100644 --- a/inference-engine/src/readers/ir_reader_v7/ie_ir_reader.cpp +++ b/inference-engine/tests_deprecated/readers/ir_reader_v7/ie_ir_reader.cpp @@ -5,7 +5,7 @@ #include #include "openvino/runtime/common.hpp" -#include +#include #include #include #include diff --git a/inference-engine/src/readers/ir_reader_v7/ie_ir_reader.hpp b/inference-engine/tests_deprecated/readers/ir_reader_v7/ie_ir_reader.hpp similarity index 85% rename from inference-engine/src/readers/ir_reader_v7/ie_ir_reader.hpp rename to inference-engine/tests_deprecated/readers/ir_reader_v7/ie_ir_reader.hpp index ad72c1e52d3..cb0ed861410 100644 --- a/inference-engine/src/readers/ir_reader_v7/ie_ir_reader.hpp +++ b/inference-engine/tests_deprecated/readers/ir_reader_v7/ie_ir_reader.hpp @@ -9,7 +9,7 @@ #include #include -#include +#include #include #include #include @@ -25,7 +25,7 @@ namespace InferenceEngine { /** * @brief This class is the main interface to build and parse a network from a given IR */ -class IRReader: public IReader { +class IRReader : public IReader { public: /** * @brief Checks that reader supports format of the model @@ -49,7 +49,9 @@ public: * * @return CNNNetwork */ - CNNNetwork read(std::istream& model, const Blob::CPtr& weights, const std::vector& exts) const override; + CNNNetwork read(std::istream& model, + const Blob::CPtr& weights, + const std::vector& exts) const override; std::vector getDataFileExtensions() const override { return {"bin"}; diff --git a/inference-engine/src/readers/ir_reader_v7/ie_layer_parsers.cpp b/inference-engine/tests_deprecated/readers/ir_reader_v7/ie_layer_parsers.cpp similarity index 100% rename from inference-engine/src/readers/ir_reader_v7/ie_layer_parsers.cpp rename to inference-engine/tests_deprecated/readers/ir_reader_v7/ie_layer_parsers.cpp diff --git a/inference-engine/src/readers/ir_reader_v7/ie_layer_parsers.h b/inference-engine/tests_deprecated/readers/ir_reader_v7/ie_layer_parsers.h similarity index 100% rename from inference-engine/src/readers/ir_reader_v7/ie_layer_parsers.h rename to inference-engine/tests_deprecated/readers/ir_reader_v7/ie_layer_parsers.h diff --git a/inference-engine/src/readers/ir_reader_v7/ie_layer_validators.cpp b/inference-engine/tests_deprecated/readers/ir_reader_v7/ie_layer_validators.cpp similarity index 100% rename from inference-engine/src/readers/ir_reader_v7/ie_layer_validators.cpp rename to inference-engine/tests_deprecated/readers/ir_reader_v7/ie_layer_validators.cpp diff --git a/inference-engine/src/readers/ir_reader_v7/ie_layer_validators.hpp b/inference-engine/tests_deprecated/readers/ir_reader_v7/ie_layer_validators.hpp similarity index 100% rename from inference-engine/src/readers/ir_reader_v7/ie_layer_validators.hpp rename to inference-engine/tests_deprecated/readers/ir_reader_v7/ie_layer_validators.hpp diff --git a/inference-engine/src/readers/ir_reader_v7/parsers.h b/inference-engine/tests_deprecated/readers/ir_reader_v7/parsers.h similarity index 100% rename from inference-engine/src/readers/ir_reader_v7/parsers.h rename to inference-engine/tests_deprecated/readers/ir_reader_v7/parsers.h diff --git a/inference-engine/tests_deprecated/unit/engines/gna/fp32_non_quantized_tests.cpp b/inference-engine/tests_deprecated/unit/engines/gna/fp32_non_quantized_tests.cpp index 8166d0be1e5..2f7a0e7d1b2 100644 --- a/inference-engine/tests_deprecated/unit/engines/gna/fp32_non_quantized_tests.cpp +++ b/inference-engine/tests_deprecated/unit/engines/gna/fp32_non_quantized_tests.cpp @@ -378,113 +378,6 @@ TEST_F(FP32NonQuantizedTest, TwoOutputsDiffPrecisionPropagateForward) { .called_with().input("input_1", input_data).result().equals_to(result1).And().equals_to(result2); } -TEST_F(FP32NonQuantizedTest, SplitToConcatWith2InputsNotAlignedNoFC) { - std::vector input_data(20); - std::iota(input_data.begin(), input_data.end(), 1.0f); - assert_that().onInferModel(SplitToConcatWith2InputsNotAlignedNoFC()) - .inNotCompactMode().gna().propagate_forward().onCPU() - .called_with_input(input_data).equals_to(input_data); -} - -TEST_F(FP32NonQuantizedTest, SplitToConcatWith2By50InputsNotAlignedNoFC) { - std::vector input_data(100); - std::iota(input_data.begin(), input_data.end(), 1.0f); - assert_that().onInferModel(SplitToConcatWith2By50InputsNotAlignedNoFC()) - .inNotCompactMode().gna().propagate_forward().onCPU() - .called_with_input(input_data).equals_to(input_data); -} - -TEST_F(FP32NonQuantizedTest, SplitToConcatWith2By50InputsNotAlignedNoFCWithInCopyWithOutCopy) { - std::vector input_data(100); - std::iota(input_data.begin(), input_data.end(), 1.0f); - assert_that().onInferModel(SplitToConcatWith2By50InputsNotAlignedNoFCWithInCopyWithOutCopy()) - .inNotCompactMode().gna().propagate_forward().onCPU() - .called_with_input(input_data).equals_to(input_data); -} - -TEST_F(FP32NonQuantizedTest, SplitToConcatWith3InputsNotAlignedNoFC) { - std::vector input_data(30); - std::iota(input_data.begin(), input_data.end(), 1.0f); - assert_that().onInferModel(SplitToConcatWith3InputsNotAlignedNoFC()) - .inNotCompactMode().gna().propagate_forward().onCPU() - .called_with_input(input_data).equals_to(input_data); -} - -TEST_F(FP32NonQuantizedTest, SplitToConcatWith4InputsNotAlignedNoFC) { - std::vector input_data(40); - std::iota(input_data.begin(), input_data.end(), 1.0f); - assert_that().onInferModel(SplitToConcatWith4InputsNotAlignedNoFC()) - .inNotCompactMode().gna().propagate_forward().onCPU() - .called_with_input(input_data).equals_to(input_data); -} - -TEST_F(FP32NonQuantizedTest, SplitToConcatWith4InputsNotAlignedNoFCWithOutCopy) { - std::vector input_data(40); - std::iota(input_data.begin(), input_data.end(), 1.0f); - assert_that().onInferModel(SplitToConcatWith4InputsNotAlignedNoFCWithOutCopy()) - .inNotCompactMode().gna().propagate_forward().onCPU() - .called_with_input(input_data).equals_to(input_data); -} - -TEST_F(FP32NonQuantizedTest, SplitToConcatWith10InputsNotAlignedNoFC) { - std::vector input_data(100); - std::iota(input_data.begin(), input_data.end(), 1.0f); - assert_that().onInferModel(SplitToConcatWith10InputsNotAlignedNoFC()) - .inNotCompactMode().gna().propagate_forward().onCPU() - .called_with_input(input_data).equals_to(input_data); -} - -TEST_F(FP32NonQuantizedTest, SplitToConcatWith10InputsNotAlignedNoFCWithOutCopy) { - std::vector input_data(100); - std::iota(input_data.begin(), input_data.end(), 1.0f); - assert_that().onInferModel(SplitToConcatWith10InputsNotAlignedNoFCWithOutCopy()) - .inNotCompactMode().gna().propagate_forward().onCPU() - .called_with_input(input_data).equals_to(input_data); -} - -TEST_F(FP32NonQuantizedTest, SplitToConcatWith10By1InputsNotAlignedNoFCWithOutCopy) { - std::vector input_data(10); - std::iota(input_data.begin(), input_data.end(), 1.0f); - assert_that().onInferModel(SplitToConcatWith10By1InputsNotAlignedNoFCWithOutCopy()) - .inNotCompactMode().gna().propagate_forward().onCPU() - .called_with_input(input_data).equals_to(input_data); -} - -TEST_F(FP32NonQuantizedTest, SplitToConcatWith2InputsNotAlignedWithFC) { - std::vector input_data(20); - std::iota(input_data.begin(), input_data.end(), 1.0f); - std::vector expected_result(10, 211.0f); - assert_that().onInferModel(SplitToConcatWith2InputsNotAlignedWithFC()) - .inNotCompactMode().withWeigthsPattern({1}).gna().propagate_forward().onCPU() - .called_with_input(input_data).equals_to(expected_result); -} - -TEST_F(FP32NonQuantizedTest, SplitToConcatWith3InputsNotAlignedWithFC) { - std::vector input_data(30); - std::iota(input_data.begin(), input_data.end(), 1.0f); - std::vector expected_result(10, 466.0f); - assert_that().onInferModel(SplitToConcatWith3InputsNotAlignedWithFC()) - .inNotCompactMode().withWeigthsPattern({1}).gna().propagate_forward().onCPU() - .called_with_input(input_data).equals_to(expected_result); -} - -TEST_F(FP32NonQuantizedTest, SplitToConcatWith3By512InputsWithOutCopy) { - std::vector input_data(1536); - std::iota(input_data.begin(), input_data.end(), 1.0f); - assert_that().onInferModel(SplitToConcatWith3By512InputsWithOutCopy()) - .inNotCompactMode().gna().propagate_forward().onCPU() - .called_with_input(input_data).equals_to(input_data); -} - -TEST_F(FP32NonQuantizedTest, SplitToConcatWith10InputsNotAlignedWithFC) { - std::vector input_data(100); - std::iota(input_data.begin(), input_data.end(), 1.0f); - std::vector expected_result(10, 5051.0f); - assert_that().onInferModel(SplitToConcatWith10InputsNotAlignedWithFC()) - .inNotCompactMode().withWeigthsPattern({1}).gna().propagate_forward().onCPU() - .called_with_input(input_data).equals_to(expected_result); -} - TEST_F(FP32NonQuantizedTest, DISABLED_SplitToConcatWith2InputsAlignedNoFC) { std::vector input_data(64); std::iota(input_data.begin(), input_data.end(), 1.0f); @@ -501,30 +394,6 @@ TEST_F(FP32NonQuantizedTest, DISABLED_SplitToConcatWith2By64InputsAlignedNoFC) { .called_with_input(input_data).equals_to(input_data); } -TEST_F(FP32NonQuantizedTest, SplitToConcatWith2Inputs1360NotAlignedNoFC) { - std::vector input_data(1360); - std::iota(input_data.begin(), input_data.end(), 1.0f); - assert_that().onInferModel(SplitToConcatWith2Inputs1360NotAlignedNoFC()) - .inNotCompactMode().gna().propagate_forward().onCPU() - .called_with_input(input_data).equals_to(input_data); -} - -TEST_F(FP32NonQuantizedTest, SplitToConcatWith2By64InputsAlignedNoFCWithOutCopy) { - std::vector input_data(128); - std::iota(input_data.begin(), input_data.end(), 1.0f); - assert_that().onInferModel(SplitToConcatWith2By64InputsAlignedNoFCWithOutCopy()) - .inNotCompactMode().gna().propagate_forward().onCPU() - .called_with_input(input_data).equals_to(input_data); -} - -TEST_F(FP32NonQuantizedTest, SplitToConcatWith2InputsAlignedNoFCWithInCopyWithOutCopy) { - std::vector input_data(64); - std::iota(input_data.begin(), input_data.end(), 1.0f); - assert_that().onInferModel(SplitToConcatWith2InputsAlignedNoFCWithInCopyWithOutCopy()) - .inNotCompactMode().gna().propagate_forward().onCPU() - .called_with_input(input_data).equals_to(input_data); -} - TEST_F(FP32NonQuantizedTest, DISABLED_SplitToConcatWith3InputsAlignedNoFC) { std::vector input_data(96); std::iota(input_data.begin(), input_data.end(), 1.0f); @@ -533,14 +402,6 @@ TEST_F(FP32NonQuantizedTest, DISABLED_SplitToConcatWith3InputsAlignedNoFC) { .called_with_input(input_data).equals_to(input_data); } -TEST_F(FP32NonQuantizedTest, SplitToConcatWith3InputsAlignedNoFCWithInCopyWithOutCopy) { - std::vector input_data(96); - std::iota(input_data.begin(), input_data.end(), 1.0f); - assert_that().onInferModel(SplitToConcatWith3InputsAlignedNoFCWithInCopyWithOutCopy()) - .inNotCompactMode().gna().propagate_forward().onCPU() - .called_with_input(input_data).equals_to(input_data); -} - TEST_F(FP32NonQuantizedTest, DISABLED_SplitToConcatWith10InputsAlignedNoFC) { std::vector input_data(320); std::iota(input_data.begin(), input_data.end(), 1.0f); @@ -549,68 +410,6 @@ TEST_F(FP32NonQuantizedTest, DISABLED_SplitToConcatWith10InputsAlignedNoFC) { .called_with_input(input_data).equals_to(input_data); } -TEST_F(FP32NonQuantizedTest, SplitToConcatWith10InputsAlignedNoFCWithInCopyWithOutCopy) { - std::vector input_data(320); - std::iota(input_data.begin(), input_data.end(), 1.0f); - assert_that().onInferModel(SplitToConcatWith10InputsAlignedNoFCWithInCopyWithOutCopy()) - .inNotCompactMode().gna().propagate_forward().onCPU() - .called_with_input(input_data).equals_to(input_data); -} - -TEST_F(FP32NonQuantizedTest, SplitToConcatWith2InputsAlignedWithFC) { - std::vector input_data(64); - std::iota(input_data.begin(), input_data.end(), 1.0f); - std::vector expected_result(32, 2081.0f); - assert_that().onInferModel(SplitToConcatWith2InputsAlignedWithFC()) - .inNotCompactMode().withWeigthsPattern({1}).gna().propagate_forward().onCPU() - .called_with_input(input_data).equals_to(expected_result); -} - -TEST_F(FP32NonQuantizedTest, SplitToConcatWith2InputsAlignedWithFCWithInCopy) { - std::vector input_data(64); - std::iota(input_data.begin(), input_data.end(), 1.0f); - std::vector expected_result(32, 2081.0f); - assert_that().onInferModel(SplitToConcatWith2InputsAlignedWithFCWithInCopy()) - .inNotCompactMode().withWeigthsPattern({1}).gna().propagate_forward().onCPU() - .called_with_input(input_data).equals_to(expected_result); -} - -TEST_F(FP32NonQuantizedTest, SplitToConcatWith3InputsAlignedWithFC) { - std::vector input_data(96); - std::iota(input_data.begin(), input_data.end(), 1.0f); - std::vector expected_result(32, 4657.0f); - assert_that().onInferModel(SplitToConcatWith3InputsAlignedWithFC()) - .inNotCompactMode().withWeigthsPattern({1}).gna().propagate_forward().onCPU() - .called_with_input(input_data).equals_to(expected_result); -} - -TEST_F(FP32NonQuantizedTest, SplitToConcatWith3InputsAlignedWithFCWithInCopy) { - std::vector input_data(96); - std::iota(input_data.begin(), input_data.end(), 1.0f); - std::vector expected_result(32, 4657.0f); - assert_that().onInferModel(SplitToConcatWith3InputsAlignedWithFCWithInCopy()) - .inNotCompactMode().withWeigthsPattern({1}).gna().propagate_forward().onCPU() - .called_with_input(input_data).equals_to(expected_result); -} - -TEST_F(FP32NonQuantizedTest, SplitToConcatWith10InputsAlignedWithFC) { - std::vector input_data(320); - std::iota(input_data.begin(), input_data.end(), 1.0f); - std::vector expected_result(32, 51361.0f); - assert_that().onInferModel(SplitToConcatWith10InputsAlignedWithFC()) - .inNotCompactMode().withWeigthsPattern({1}).gna().propagate_forward().onCPU() - .called_with_input(input_data).equals_to(expected_result); -} - -TEST_F(FP32NonQuantizedTest, SplitToConcatWith10InputsAlignedWithFCWithInCopy) { - std::vector input_data(320); - std::iota(input_data.begin(), input_data.end(), 1.0f); - std::vector expected_result(32, 51361.0f); - assert_that().onInferModel(SplitToConcatWith10InputsAlignedWithFCWithInCopy()) - .inNotCompactMode().withWeigthsPattern({1}).gna().propagate_forward().onCPU() - .called_with_input(input_data).equals_to(expected_result); -} - TEST_F(FP32NonQuantizedTest, ReshapeConvolutionLessThan48Filters) { std::vector input_data(800, 1.f); std::vector expected_result(1600, 8.f); diff --git a/inference-engine/thirdparty/CMakeLists.txt b/inference-engine/thirdparty/CMakeLists.txt index 10d9e495254..ef56e007e62 100644 --- a/inference-engine/thirdparty/CMakeLists.txt +++ b/inference-engine/thirdparty/CMakeLists.txt @@ -32,7 +32,7 @@ function(ie_add_mkldnn) set(DNNL_ENABLE_ITT_TASKS ${BUILD_SHARED_LIBS} CACHE BOOL "" FORCE) set(DNNL_ENABLE_CONCURRENT_EXEC ON CACHE BOOL "" FORCE) set(DNNL_ENABLE_PRIMITIVE_CACHE OFF CACHE BOOL "" FORCE) ## TODO: try it later - set(DNNL_ENABLE_MAX_CPU_ISA OFF CACHE BOOL "" FORCE) ## TODO: try it later + set(DNNL_ENABLE_MAX_CPU_ISA ON CACHE BOOL "" FORCE) set(DNNL_LIBRARY_TYPE STATIC CACHE BOOL "" FORCE) set(DNNL_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) set(DNNL_BUILD_TESTS OFF CACHE BOOL "" FORCE) diff --git a/inference-engine/thirdparty/clDNN/CMakeLists.txt b/inference-engine/thirdparty/clDNN/CMakeLists.txt index 954fda6f1ca..26e249d0ba2 100644 --- a/inference-engine/thirdparty/clDNN/CMakeLists.txt +++ b/inference-engine/thirdparty/clDNN/CMakeLists.txt @@ -12,9 +12,6 @@ project("${CLDNN__PROJ_NAME}") # ====================================== HELPER CONSTANT VARIABLES ===================================== # ====================================================================================================== # ====================================================================================================== -if (ENABLE_ONEDNN_FOR_GPU) - set(ONEDNN_LIBRARY onednn_gpu_tgt) -endif() if(ENABLE_GPU_DEBUG_CAPS) add_definitions(-DGPU_DEBUG_CONFIG=1) diff --git a/inference-engine/thirdparty/clDNN/api/cldnn/graph/network.hpp b/inference-engine/thirdparty/clDNN/api/cldnn/graph/network.hpp index f2fecc79412..ea3af7000ad 100644 --- a/inference-engine/thirdparty/clDNN/api/cldnn/graph/network.hpp +++ b/inference-engine/thirdparty/clDNN/api/cldnn/graph/network.hpp @@ -160,6 +160,7 @@ public: // Implementation specific calls std::shared_ptr get_primitive(const primitive_id& id); std::string get_primitive_info(const primitive_id& id) const; + std::string get_implementation_info(const primitive_id& id) const; const event::ptr& get_primitive_event(const primitive_id& id) const { return _events.at(id); } bool has_event(const primitive_id& id) const { return _events.count(id); } std::vector> get_primitives(const std::vector& ids); diff --git a/inference-engine/thirdparty/clDNN/api/cldnn/graph/program.hpp b/inference-engine/thirdparty/clDNN/api/cldnn/graph/program.hpp index 98184293bd3..0d65175db0e 100644 --- a/inference-engine/thirdparty/clDNN/api/cldnn/graph/program.hpp +++ b/inference-engine/thirdparty/clDNN/api/cldnn/graph/program.hpp @@ -206,6 +206,8 @@ public: std::function const& filter = nullptr) const; const primitives_info& get_primitives_info() const; + data_types get_inference_precision(const program_node& node) const; + std::string get_implementation_info(const primitive_id& id) const; const graph_optimizer_info& get_optimizer_passes_info() const; void save_pass_info(std::string pass_name); diff --git a/inference-engine/thirdparty/clDNN/api/cldnn/primitives/gather_nd.hpp b/inference-engine/thirdparty/clDNN/api/cldnn/primitives/gather_nd.hpp index bb3cc10e915..58482455ef5 100644 --- a/inference-engine/thirdparty/clDNN/api/cldnn/primitives/gather_nd.hpp +++ b/inference-engine/thirdparty/clDNN/api/cldnn/primitives/gather_nd.hpp @@ -23,6 +23,7 @@ struct gather_nd : public primitive_base { /// @param id This primitive id. /// @param data Input data primitive id. /// @param indices Input indexes primitive id. + /// @param input_rank Rank of input data. /// @param indices_rank Rank of indices. /// @param batch_dims batch_dims as an attribute of GatherND. Optional. /// @param batch_merged_output batched output shape is merged as a dimention for v5. @@ -32,16 +33,21 @@ struct gather_nd : public primitive_base { gather_nd(const primitive_id& id, const primitive_id& data, const primitive_id& indices, + const uint8_t input_rank, const uint8_t indices_rank, const uint8_t batch_dims = 0, const bool batch_merged_output = true, const primitive_id& ext_prim_id = "", const padding& output_padding = padding()) : primitive_base(id, {data, indices}, ext_prim_id, output_padding), + input_rank(input_rank), indices_rank(indices_rank), batch_dims(batch_dims), batch_merged_output(batch_merged_output) {} + /// @brief GatherND input_rank + uint8_t input_rank; + /// @brief GatherND indices_rank uint8_t indices_rank; diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/CMakeLists.txt b/inference-engine/thirdparty/clDNN/kernel_selector/CMakeLists.txt index 2622eac0004..a8f804318a7 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/CMakeLists.txt +++ b/inference-engine/thirdparty/clDNN/kernel_selector/CMakeLists.txt @@ -125,9 +125,8 @@ add_library("${CLDNN_BUILD__PROJ}" STATIC ${__CLDNN_AllSources} ) -if(CMAKE_BUILD_TYPE STREQUAL "Release") - target_compile_options(${CLDNN_BUILD__PROJ} PRIVATE -Os) -endif() +target_compile_options("${CLDNN_BUILD__PROJ}" PRIVATE + $<$:$,/Os,-Os>>) set_property(TARGET "${CLDNN_BUILD__PROJ}" PROPERTY PROJECT_LABEL "${CLDNN_BUILD__PROJ_LABEL}") diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/resample/resample_kernel_base.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/resample/resample_kernel_base.cpp index dbb4376ebb3..2b1c714dd01 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/resample/resample_kernel_base.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/resample/resample_kernel_base.cpp @@ -107,6 +107,7 @@ bool ResampleKernelBase::Validate(const Params& p, const optional_params& o) con const auto& input = params.inputs[0]; if ((input.GetDType() == Datatype::UINT8 || input.GetDType() == Datatype::INT8) && params.resampleType != ResampleType::NEAREST_NEIGHBOR && + params.resampleType != ResampleType::CAFFE_BILINEAR_INTERP && params.resampleType != ResampleType::BILINEAR_INTERP) return false; diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/strided_slice/strided_slice_kernel_ref.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/strided_slice/strided_slice_kernel_ref.cpp index 6326c208519..63fa006c0ac 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/strided_slice/strided_slice_kernel_ref.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/strided_slice/strided_slice_kernel_ref.cpp @@ -41,10 +41,14 @@ ParamsKey StridedSliceKernelRef::GetSupportedKey() const { ParamsKey k; k.EnableInputDataType(Datatype::F16); k.EnableInputDataType(Datatype::F32); + k.EnableInputDataType(Datatype::UINT8); + k.EnableInputDataType(Datatype::INT8); k.EnableInputDataType(Datatype::INT32); k.EnableInputDataType(Datatype::INT64); k.EnableOutputDataType(Datatype::F16); k.EnableOutputDataType(Datatype::F32); + k.EnableOutputDataType(Datatype::UINT8); + k.EnableOutputDataType(Datatype::INT8); k.EnableOutputDataType(Datatype::INT32); k.EnableOutputDataType(Datatype::INT64); k.EnableAllInputLayout(); diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/cache/cache.json b/inference-engine/thirdparty/clDNN/kernel_selector/core/cache/cache.json index 57cd1548eb5..f19efc6a793 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/cache/cache.json +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/cache/cache.json @@ -1436,7 +1436,7 @@ "F32_BFYX_v1_p0_0_v1_p0_0_v2048_p0_0_v300_p0_0;F32_FB_v300_p0_0_v21_p0_0": ["fully_connected_gpu_fb_oi_ref", 0], "F32_BFYX_v1_p0_0_v1_p0_0_v2048_p0_0_v300_p0_0;F32_FB_v300_p0_0_v84_p0_0": ["fully_connected_gpu_fb_oi_ref", 0], "F32_BFYX_v1792_p0_0_v1_p0_0_v1_p0_0_v1_p0_0;F32_BF_v512_p0_0_v1_p0_0": ["fully_connected_gpu_bf_io_input_spatial", 2] - }, + } }, "64": { "CONVOLUTION": { @@ -2320,7 +2320,7 @@ "F16_YXFB_v300_p0_0_v4096_p0_0_v1_p0_0_v1_p0_0;F16_FB_v300_p0_0_v6565_p0_0": ["fully_connected_gpu_yxfb_ref", 0], "F16_YXFB_v300_p0_0_v4096_p0_0_v1_p0_0_v1_p0_0;F16_FB_v300_p0_0_v101_p0_0": ["fully_connected_gpu_fb_oi_ref", 2], "F16_BFYX_v71_p0_0_v88_p0_0_v1_p0_0_v1_p0_0;F16_BF_v128_p0_0_v1_p0_0": ["fully_connected_gpu_bf_io_gemm", 1] - }, + } } }, "version_1": { diff --git a/inference-engine/thirdparty/clDNN/runtime/CMakeLists.txt b/inference-engine/thirdparty/clDNN/runtime/CMakeLists.txt index d5ec92eb561..26d02fba2f7 100644 --- a/inference-engine/thirdparty/clDNN/runtime/CMakeLists.txt +++ b/inference-engine/thirdparty/clDNN/runtime/CMakeLists.txt @@ -47,9 +47,8 @@ add_library("${CLDNN_BUILD__PROJ}" STATIC ${__CLDNN_AllSources} ) -if(CMAKE_BUILD_TYPE STREQUAL "Release") - target_compile_options(${CLDNN_BUILD__PROJ} PRIVATE -Os) -endif() +target_compile_options("${CLDNN_BUILD__PROJ}" PRIVATE + $<$:$,/Os,-Os>>) set_property(TARGET "${CLDNN_BUILD__PROJ}" PROPERTY PROJECT_LABEL "${CLDNN_BUILD__PROJ_LABEL}") @@ -67,15 +66,7 @@ target_link_libraries("${CLDNN_BUILD__PROJ}" PRIVATE ) if(ENABLE_ONEDNN_FOR_GPU) - get_property(isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) - if (isMultiConfig) - add_dependencies(${CLDNN_BUILD__PROJ} onednn_gpu_build) - foreach(dir IN LISTS ONEDNN_INCLUDE_DIRS) - target_include_directories("${CLDNN_BUILD__PROJ}" PUBLIC $) - endforeach() - target_compile_definitions("${CLDNN_BUILD__PROJ}" PUBLIC ENABLE_ONEDNN_FOR_GPU) - endif() - target_link_libraries("${CLDNN_BUILD__PROJ}" PUBLIC ${ONEDNN_LIBRARY}) + target_link_libraries("${CLDNN_BUILD__PROJ}" PUBLIC onednn_gpu_tgt) endif() if(WIN32) diff --git a/inference-engine/thirdparty/clDNN/runtime/kernels_cache.cpp b/inference-engine/thirdparty/clDNN/runtime/kernels_cache.cpp index 300995163f7..b9943418e4c 100644 --- a/inference-engine/thirdparty/clDNN/runtime/kernels_cache.cpp +++ b/inference-engine/thirdparty/clDNN/runtime/kernels_cache.cpp @@ -74,8 +74,10 @@ static std::vector loadBinaryFromFile(std::string path) { if (fp) { fseek(fp, 0, SEEK_END); auto sz = ftell(fp); - if (sz < 0) + if (sz < 0) { + fclose(fp); return {}; + } auto nsize = static_cast(sz); fseek(fp, 0, SEEK_SET); diff --git a/inference-engine/thirdparty/clDNN/runtime/ocl/ocl_stream.cpp b/inference-engine/thirdparty/clDNN/runtime/ocl/ocl_stream.cpp index fe11564911c..9083c116a4e 100644 --- a/inference-engine/thirdparty/clDNN/runtime/ocl/ocl_stream.cpp +++ b/inference-engine/thirdparty/clDNN/runtime/ocl/ocl_stream.cpp @@ -455,7 +455,7 @@ void ocl_stream::wait_for_events(const std::vector& events) { void ocl_stream::sync_events(std::vector const& deps, bool is_output) { bool needs_barrier = false; for (auto& dep : deps) { - auto* ocl_base_ev = dynamic_cast(dep.get()); + auto* ocl_base_ev = downcast(dep.get()); if (ocl_base_ev->get_queue_stamp() > _last_barrier) { needs_barrier = true; } diff --git a/inference-engine/thirdparty/clDNN/src/CMakeLists.txt b/inference-engine/thirdparty/clDNN/src/CMakeLists.txt index d90f593fdd7..1da07e6055e 100644 --- a/inference-engine/thirdparty/clDNN/src/CMakeLists.txt +++ b/inference-engine/thirdparty/clDNN/src/CMakeLists.txt @@ -111,9 +111,8 @@ add_library("${CLDNN_BUILD__PROJ}" STATIC ${__CLDNN_AllSources} ) -if(CMAKE_BUILD_TYPE STREQUAL "Release") - target_compile_options(${CLDNN_BUILD__PROJ} PRIVATE -Os) -endif() +target_compile_options("${CLDNN_BUILD__PROJ}" PRIVATE + $<$:$,/Os,-Os>>) set_property(TARGET "${CLDNN_BUILD__PROJ}" PROPERTY PROJECT_LABEL "${CLDNN_BUILD__PROJ_LABEL}") @@ -128,15 +127,7 @@ target_link_libraries("${CLDNN_BUILD__PROJ}" PRIVATE ) if(ENABLE_ONEDNN_FOR_GPU) - get_property(isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) - if (isMultiConfig) - add_dependencies(${CLDNN_BUILD__PROJ} onednn_gpu_build) - foreach(dir IN LISTS ONEDNN_INCLUDE_DIRS) - target_include_directories("${CLDNN_BUILD__PROJ}" PUBLIC $) - endforeach() - target_compile_definitions("${CLDNN_BUILD__PROJ}" PUBLIC ENABLE_ONEDNN_FOR_GPU) - endif() - target_link_libraries("${CLDNN_BUILD__PROJ}" PUBLIC ${ONEDNN_LIBRARY}) + target_link_libraries("${CLDNN_BUILD__PROJ}" PUBLIC onednn_gpu_tgt) endif() if(COMMAND add_cpplint_target) diff --git a/inference-engine/thirdparty/clDNN/src/gather_nd.cpp b/inference-engine/thirdparty/clDNN/src/gather_nd.cpp index 43ad9f028a5..01b664e1995 100644 --- a/inference-engine/thirdparty/clDNN/src/gather_nd.cpp +++ b/inference-engine/thirdparty/clDNN/src/gather_nd.cpp @@ -24,8 +24,7 @@ layout gather_nd_inst::calc_output_layout(gather_nd_node const& node) { auto input_layout = input_layout_origin.size.sizes(input_layout_origin.format); auto indices_layout = indices_layout_origin.size.sizes(indices_layout_origin.format); - const size_t input_dims = input_layout.size(); - + const auto input_rank = static_cast(op->input_rank); const auto indices_rank = op->indices_rank; const auto batch_dims = op->batch_dims; @@ -37,7 +36,7 @@ layout gather_nd_inst::calc_output_layout(gather_nd_node const& node) { } const size_t indices_last_dim = indices_layout[indices_rank - 1]; - for (size_t x = static_cast(batch_dims + indices_last_dim); x < input_dims; x++) { + for (size_t x = static_cast(batch_dims + indices_last_dim); x < input_rank; x++) { output_sizes.push_back(input_layout[x]); } diff --git a/inference-engine/thirdparty/clDNN/src/graph_optimizer/compile_graph.cpp b/inference-engine/thirdparty/clDNN/src/graph_optimizer/compile_graph.cpp index 98cb74dfd17..4dac88c97d9 100644 --- a/inference-engine/thirdparty/clDNN/src/graph_optimizer/compile_graph.cpp +++ b/inference-engine/thirdparty/clDNN/src/graph_optimizer/compile_graph.cpp @@ -54,5 +54,9 @@ void compile_graph::run(program& p) { task_executor->runAndWait(tasks); tasks.clear(); + + if (exception) { + std::rethrow_exception(exception); + } } } diff --git a/inference-engine/thirdparty/clDNN/src/graph_optimizer/pre_replace_deconv.cpp b/inference-engine/thirdparty/clDNN/src/graph_optimizer/pre_replace_deconv.cpp index 0be55da5cd8..1d95823d426 100644 --- a/inference-engine/thirdparty/clDNN/src/graph_optimizer/pre_replace_deconv.cpp +++ b/inference-engine/thirdparty/clDNN/src/graph_optimizer/pre_replace_deconv.cpp @@ -84,9 +84,10 @@ void pre_replace_deconv::run(program& p) { p.remove_connection(*weights_node_ptr, deconv_node); } + auto filter_z = deconv_prim->grouped_weights_shape ? 1 : (filter_size.spatial[2] - 1); pad.spatial[0] = (filter_size.spatial[0] - 1) - std::abs(pad.spatial[0]); pad.spatial[1] = (filter_size.spatial[1] - 1) - std::abs(pad.spatial[1]); - pad.spatial[2] = (filter_size.spatial[2] - 1) - std::abs(pad.spatial[2]); + pad.spatial[2] = filter_z - std::abs(pad.spatial[2]); std::vector> bias_connections; for (auto& bias_id : biases_nodes_id) { diff --git a/inference-engine/thirdparty/clDNN/src/impls/ocl/strided_slice.cpp b/inference-engine/thirdparty/clDNN/src/impls/ocl/strided_slice.cpp index bc788c5a5e4..81c3d1c4737 100644 --- a/inference-engine/thirdparty/clDNN/src/impls/ocl/strided_slice.cpp +++ b/inference-engine/thirdparty/clDNN/src/impls/ocl/strided_slice.cpp @@ -118,10 +118,15 @@ attach_strided_slice_impl::attach_strided_slice_impl() { std::make_tuple(data_types::f16, format::bfyx), std::make_tuple(data_types::i32, format::bfyx), std::make_tuple(data_types::i64, format::bfyx), + std::make_tuple(data_types::i8, format::bfyx), + std::make_tuple(data_types::u8, format::bfyx), + std::make_tuple(data_types::f32, format::bfzyx), std::make_tuple(data_types::f16, format::bfzyx), std::make_tuple(data_types::i32, format::bfzyx), std::make_tuple(data_types::i64, format::bfzyx), + std::make_tuple(data_types::i8, format::bfzyx), + std::make_tuple(data_types::u8, format::bfzyx), }); } diff --git a/inference-engine/thirdparty/clDNN/src/include/deformable_convolution_inst.h b/inference-engine/thirdparty/clDNN/src/include/deformable_convolution_inst.h index bb3e6cecd5b..76f2f136e27 100644 --- a/inference-engine/thirdparty/clDNN/src/include/deformable_convolution_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/deformable_convolution_inst.h @@ -21,6 +21,7 @@ public: : parent(prim, prog), split(this->get_primitive()->split()), depthwise_sep_opt(false), + transposed(false), groups(this->get_primitive()->groups) { support_padding_all(true); } diff --git a/inference-engine/thirdparty/clDNN/src/layout_optimizer.cpp b/inference-engine/thirdparty/clDNN/src/layout_optimizer.cpp index e5dbc7daf73..9549399c2d6 100644 --- a/inference-engine/thirdparty/clDNN/src/layout_optimizer.cpp +++ b/inference-engine/thirdparty/clDNN/src/layout_optimizer.cpp @@ -856,7 +856,7 @@ layout layout_optimizer::get_expected_layout(layout const& current_layout, bool non_grouped = prim->groups == 1; bool is_2d = input_layout.format.spatial_num() == 2; bool onednn_valid_post_ops = get_post_ops_count(node) <= 32; - bool use_onednn_impls = _optimization_attributes.use_onednn_impls; + bool use_onednn_impls = _optimization_attributes.use_onednn_impls && input_layout.data_type != data_types::f32; bool i8_u8_input = input_layout.data_type == data_types::u8 || input_layout.data_type == data_types::i8; if (use_onednn_impls && onednn_valid_post_ops) { @@ -876,6 +876,18 @@ layout layout_optimizer::get_expected_layout(layout const& current_layout, } if (use_onednn_impls) { + std::function has_any_convolutions_below; + has_any_convolutions_below = [&](const program_node& node) -> bool { + if (node.get_users().empty()) + return false; + for (auto& usr : node.get_users()) { + if (usr->is_type()) + return true; + return has_any_convolutions_below(*usr); + } + return false; + }; + /* ***************************** OneDNN impls format selection part ****************************** */ bool valid_grouped = !is_dw && prim->groups > 1 && (ofm_per_group % compute_block == 0 && ifm_per_group % compute_block == 0); if (i8_u8_input) { @@ -883,7 +895,12 @@ layout layout_optimizer::get_expected_layout(layout const& current_layout, if (input_layout.size.batch[0] % 16 == 0) { expected_format = cldnn::format::bs_fs_yx_bsv32_fsv32; } else { - expected_format = cldnn::format::b_fs_yx_fsv32; + if (data_type_traits::is_floating_point(output_layout.data_type) && + !has_any_convolutions_below(node)) { + expected_format = cldnn::format::b_fs_yx_fsv16; + } else { + expected_format = cldnn::format::b_fs_yx_fsv32; + } } } else if ((_optimization_attributes.b_fs_yx_fsv16_network && convolution_b_fs_yx_fsv16_opt(input_layout, output_layout, weights_layout, prim)) && is_2d) { @@ -1147,7 +1164,9 @@ impl_types layout_optimizer::get_preferred_impl_type(program_node& node, format auto& detection_output_node = node.as(); auto confidence_layout = detection_output_node.confidence().get_output_layout(); auto prim = detection_output_node.get_primitive(); - if (confidence_layout.size.batch[0] <= lws_max && confidence_layout.size.batch[0] >= 4 && prim->confidence_threshold >= 0.1 && + auto batch_size_limitations = (device_info.supports_immad && device_info.execution_units_count >= 256) ? true : confidence_layout.size.batch[0] >= 4; + if (confidence_layout.size.batch[0] <= lws_max && batch_size_limitations && + prim->confidence_threshold >= 0.1 && prim->top_k <= 400 && prim->num_classes >= 16 && confidence_layout.size.feature[0] > 10000) preferred_impl = impl_types::ocl; else diff --git a/inference-engine/thirdparty/clDNN/src/network.cpp b/inference-engine/thirdparty/clDNN/src/network.cpp index 6d126d9b481..59703aed498 100644 --- a/inference-engine/thirdparty/clDNN/src/network.cpp +++ b/inference-engine/thirdparty/clDNN/src/network.cpp @@ -466,6 +466,10 @@ std::string network::get_primitive_info(const primitive_id& id) const { return node.type()->to_string(node); } +std::string network::get_implementation_info(const primitive_id& id) const { + return _program->get_implementation_info(id); +} + memory::ptr network::get_output_memory(const primitive_id& output_id) { return get_primitive(output_id)->output_memory_ptr(); } diff --git a/inference-engine/thirdparty/clDNN/src/program.cpp b/inference-engine/thirdparty/clDNN/src/program.cpp index 9764b03b04b..dbf1a264b5d 100644 --- a/inference-engine/thirdparty/clDNN/src/program.cpp +++ b/inference-engine/thirdparty/clDNN/src/program.cpp @@ -192,7 +192,7 @@ program_node& program::get_node(primitive_id const& id) { try { return *nodes_map.at(id); } catch (...) { - throw std::runtime_error("Program doesn't contain primtive node: " + id); + throw std::runtime_error("Program doesn't contain primitive node: " + id); } } @@ -200,7 +200,7 @@ program_node const& program::get_node(primitive_id const& id) const { try { return *nodes_map.at(id); } catch (...) { - throw std::runtime_error("Program doesn't contain primtive node: " + id); + throw std::runtime_error("Program doesn't contain primitive node: " + id); } } @@ -1122,47 +1122,57 @@ void program::dump_program(const char* stage, dump_graph_optimized(graph, *this); } +data_types program::get_inference_precision(const program_node& node) const { + if (node.is_input()) { + return node.get_output_layout().data_type; + } + std::vector input_dts; + for (auto& dep : node.get_dependencies()) { + input_dts.push_back(dep->get_output_layout().data_type); + } + data_types output_dt = node.get_output_layout().data_type; + + assert(!input_dts.empty()); + if (node.is_type()) { + // If reorder has different input/output types - pick the max one as runtime precision + return data_type_traits::max_type(input_dts[0], output_dt); + } else if (node.is_type()) { + if (data_type_traits::is_quantized(output_dt)) + return output_dt; + return data_type_traits::max_type(input_dts[0], output_dt); + } else if (node.is_type()) { + auto max_dt = input_dts[0]; + for (size_t i = 1; i < input_dts.size(); i++) { + max_dt = data_type_traits::max_type(max_dt, input_dts[i]); + } + return max_dt; + } else if (node.is_type() || node.is_type() || node.is_type() || node.is_type()) { + if (input_dts.size() < 2) { + throw std::runtime_error("[clDNN] Invalid inputs count in node " + node.id() + " during stage info collection. Expected >= 2 inputs"); + } + if (data_type_traits::is_quantized(input_dts[0]) && data_type_traits::is_quantized(input_dts[1])) { + return input_dts[0]; + } else { + return data_type_traits::max_type(input_dts[0], input_dts[1]); + } + } + + return input_dts[0]; +} + +std::string program::get_implementation_info(const primitive_id& id) const { + try { + const auto& node = get_node(id); + auto impl = node.get_selected_impl(); + return impl ? (impl->get_kernel_name() + "__" + dt_to_str(get_inference_precision(node))) : "undef"; + } catch (...) { } + + return "undef"; +} + program::primitives_info program::get_current_stage_info() const { primitives_info info; - auto get_inference_precision = [](program_node& node) -> data_types { - if (node.is_input()) { - return node.get_output_layout().data_type; - } - std::vector input_dts; - for (auto& dep : node.get_dependencies()) { - input_dts.push_back(dep->get_output_layout().data_type); - } - data_types output_dt = node.get_output_layout().data_type; - - assert(!input_dts.empty()); - if (node.is_type()) { - // If reorder has different input/output types - pick the max one as runtime precision - return data_type_traits::max_type(input_dts[0], output_dt); - } else if (node.is_type()) { - if (data_type_traits::is_quantized(output_dt)) - return output_dt; - return data_type_traits::max_type(input_dts[0], output_dt); - } else if (node.is_type()) { - auto max_dt = input_dts[0]; - for (size_t i = 1; i < input_dts.size(); i++) { - max_dt = data_type_traits::max_type(max_dt, input_dts[i]); - } - return max_dt; - } else if (node.is_type() || node.is_type() || node.is_type() || node.is_type()) { - if (input_dts.size() < 2) { - throw std::runtime_error("[clDNN] Invalid inputs count in node " + node.id() + " during stage info collection. Expected >= 2 inputs"); - } - if (data_type_traits::is_quantized(input_dts[0]) && data_type_traits::is_quantized(input_dts[1])) { - return input_dts[0]; - } else { - return data_type_traits::max_type(input_dts[0], input_dts[1]); - } - } - - return input_dts[0]; - }; - // Get info for actually executed graph nodes int exec_id = 0; for (auto& p : get_processing_order()) { @@ -1191,7 +1201,7 @@ program::primitives_info program::get_current_stage_info() const { fused, p->get_output_layout(), fmt_to_str(p->get_output_layout().format), - p->selected_impl ? p->selected_impl->get_kernel_name() : "", + get_implementation_info(p->id()), get_inference_precision(*p), p->selected_impl ? p->selected_impl->is_cpu() : false, exec_id++); diff --git a/inference-engine/thirdparty/clDNN/tests/test_cases/cache_test.cpp b/inference-engine/thirdparty/clDNN/tests/test_cases/cache_test.cpp index 24cdc27cc49..0c49194320c 100644 --- a/inference-engine/thirdparty/clDNN/tests/test_cases/cache_test.cpp +++ b/inference-engine/thirdparty/clDNN/tests/test_cases/cache_test.cpp @@ -223,13 +223,10 @@ public: network.execute(); if (compare_implementation.compare) { - std::string exec_impl; - for (auto& info : network.get_primitives_info()) { - if (info.original_id == "conv") { - exec_impl = info.kernel_id; - break; - } - } + std::string exec_impl = network.get_implementation_info("conv"); + auto precision_pos = exec_impl.find("__"); + exec_impl = exec_impl.substr(0, precision_pos); + if (compare_implementation.not_equal) { EXPECT_NE(exec_impl, compare_implementation.value); } else { diff --git a/inference-engine/thirdparty/clDNN/tests/test_cases/fusings_gpu_test.cpp b/inference-engine/thirdparty/clDNN/tests/test_cases/fusings_gpu_test.cpp index 1b10eadb02f..f2defd6e2cb 100644 --- a/inference-engine/thirdparty/clDNN/tests/test_cases/fusings_gpu_test.cpp +++ b/inference-engine/thirdparty/clDNN/tests/test_cases/fusings_gpu_test.cpp @@ -8749,13 +8749,23 @@ public: class gather_nd_quantize : public GatherNDPrimitiveFusingTest {}; TEST_P(gather_nd_quantize, basic) { auto p = GetParam(); + + auto input_rank = 0; + if (p.input_format == format::bfyx) { + input_rank = 4; + } else if (p.input_format == format::bfzyx) { + input_rank = 5; + } else if (p.input_format == format::bfwzyx) { + input_rank = 6; + } + create_topologies(input_layout("input", get_input_layout(p)), data("gather_nd_indices", get_mem(get_indices_layout(p), 0, p.max_number_in_indices - 1)), data("in_lo", get_mem(get_per_channel_layout(p), min_random, 0)), data("in_hi", get_mem(get_per_channel_layout(p), 1, max_random)), data("out_lo", get_mem(get_single_element_layout(p), -127)), data("out_hi", get_mem(get_single_element_layout(p), 127)), - gather_nd("gather_nd_prim", "input", "gather_nd_indices", p.indices_rank, p.batch_dims), + gather_nd("gather_nd_prim", "input", "gather_nd_indices", input_rank, p.indices_rank, p.batch_dims), quantize("quantize", "gather_nd_prim", "in_lo", "in_hi", "out_lo", "out_hi", 255, data_types::i8), reorder("reorder_bfyx", "quantize", p.default_format, data_types::f32) ); @@ -8802,11 +8812,20 @@ class gather_nd_activation_scale_eltwise : public GatherNDPrimitiveFusingTest {} TEST_P(gather_nd_activation_scale_eltwise, basic) { auto p = GetParam(); + auto input_rank = 0; + if (p.input_format == format::bfyx) { + input_rank = 4; + } else if (p.input_format == format::bfzyx) { + input_rank = 5; + } else if (p.input_format == format::bfwzyx) { + input_rank = 6; + } + create_topologies(input_layout("input", get_input_layout(p)), data("gather_nd_indices", get_mem(get_indices_layout(p), 0, p.max_number_in_indices - 1)), data("scale_data", get_mem(get_per_channel_layout(p), 1.0f / 255)), data("eltwise_data", get_mem(get_output_layout(p))), - gather_nd("gather_nd_prim", "input", "gather_nd_indices", p.indices_rank, p.batch_dims), + gather_nd("gather_nd_prim", "input", "gather_nd_indices", input_rank, p.indices_rank, p.batch_dims), activation("activation", "gather_nd_prim", activation_func::abs), scale("scale", "activation", "scale_data"), eltwise("eltwise", { "scale", "eltwise_data" }, eltwise_mode::sum, p.data_type), diff --git a/inference-engine/thirdparty/clDNN/tests/test_cases/gather_nd_gpu_test.cpp b/inference-engine/thirdparty/clDNN/tests/test_cases/gather_nd_gpu_test.cpp index 7dbffa73b07..ec9b8332041 100644 --- a/inference-engine/thirdparty/clDNN/tests/test_cases/gather_nd_gpu_test.cpp +++ b/inference-engine/thirdparty/clDNN/tests/test_cases/gather_nd_gpu_test.cpp @@ -21,7 +21,19 @@ inline void DoTestBase(engine& engine, const tensor ts, const bool batch_merged_output) { topology topology; - auto gather_nd_inst = gather_nd("gather_nd", "InputData", "InputIndices", indices_rank, batch_dims, batch_merged_output); + + int input_rank = 0; + if (input0->get_layout().format == format::bfyx) { + input_rank = 4; + } else if (input0->get_layout().format == format::bfzyx) { + input_rank = 5; + } else if (input0->get_layout().format == format::bfwzyx) { + input_rank = 6; + } else { + FAIL(); + } + + auto gather_nd_inst = gather_nd("gather_nd", "InputData", "InputIndices", input_rank, indices_rank, batch_dims, batch_merged_output); topology.add(input_layout("InputData", input0->get_layout())); topology.add(input_layout("InputIndices", input1->get_layout())); topology.add(gather_nd_inst); diff --git a/inference-engine/thirdparty/clDNN/tests/test_cases/strided_slice_gpu_test.cpp b/inference-engine/thirdparty/clDNN/tests/test_cases/strided_slice_gpu_test.cpp index aa4ec3aa0d3..470623e28d8 100644 --- a/inference-engine/thirdparty/clDNN/tests/test_cases/strided_slice_gpu_test.cpp +++ b/inference-engine/thirdparty/clDNN/tests/test_cases/strided_slice_gpu_test.cpp @@ -1081,6 +1081,59 @@ TEST(strided_slice_gpu_f32_i64, test_2x2x2x1x1) { } } + +TEST(strided_slice_gpu_i8_i64, test_2x2x2x1x1) { + // Input (BFZYX): 2x2x2x1x1 + // Output (BFZYX): 1x2x2x1x1 + + auto& engine = get_test_engine(); + auto input = engine.allocate_memory({ data_types::i8, format::bfzyx, { 2, 2, 1, 1, 2 } }); + auto begin = engine.allocate_memory({ data_types::i64, format::bfyx, { 3, 1, 1, 1 } }); + auto end = engine.allocate_memory({ data_types::i64, format::bfyx, { 3, 1, 1, 1 } }); + auto strides = engine.allocate_memory({ data_types::i64, format::bfyx, { 3, 1, 1, 1 } }); + + set_values(input, { + 0, 1, 2, 3, 4, 5, 6, 7 + }); + set_values(begin, { + 0, 0, 0 + }); + set_values(end, { + 1, 2, 2 + }); + set_values(strides, { + 1, 1, 1 + }); + + topology topology; + topology.add(input_layout("input", input->get_layout())); + topology.add(data("input2", begin)); + topology.add(data("input3", end)); + topology.add(data("input4", strides)); + topology.add(strided_slice("strided_slice", "input", "input2", "input3", "input4", {}, {}, {}, {}, tensor{1, 2, 1, 2})); + + network network(engine, topology); + + network.set_input_data("input", input); + + auto outputs = network.execute(); + + EXPECT_EQ(outputs.size(), size_t(1)); + EXPECT_EQ(outputs.begin()->first, "strided_slice"); + + auto output = outputs.at("strided_slice").get_memory(); + + std::vector answers = { + 0, 1, 2, 3 + }; + + cldnn::mem_lock output_ptr(output, get_test_stream()); + + for (size_t i = 0; i < answers.size(); ++i) { + EXPECT_TRUE(are_equal(answers[i], output_ptr[i])); + } +} + TEST(strided_slice_gpu_f32_i32, test_2x2x2x1x1_2) { // Input (BFZYX): 2x2x2x1x1 // Output (BFZYX): 2x1x1x1x1 diff --git a/inference-engine/thirdparty/mkl-dnn b/inference-engine/thirdparty/mkl-dnn index 93ad2b1bf5a..deab85766ff 160000 --- a/inference-engine/thirdparty/mkl-dnn +++ b/inference-engine/thirdparty/mkl-dnn @@ -1 +1 @@ -Subproject commit 93ad2b1bf5aa9c6677b09fbd80967e341b50168c +Subproject commit deab85766ff3fb547ae34eeff94fca4e73bd3053 diff --git a/model-optimizer/extensions/front/global_pooling_to_reduce.py b/model-optimizer/extensions/front/global_pooling_to_reduce.py index 135dd22548c..9a5fb98d310 100644 --- a/model-optimizer/extensions/front/global_pooling_to_reduce.py +++ b/model-optimizer/extensions/front/global_pooling_to_reduce.py @@ -45,8 +45,8 @@ class GlobalPoolingToReduce(FrontReplacementPattern): pooling.out_port(0).get_connection().set_source(reduce.out_port(0)) src = pooling.in_port(0).get_connection().get_source() - pooling.in_port(0).disconnect() - src.connect(reduce.in_port(0)) + + reduce.in_port(0).get_connection().set_source(src) start = Const(graph, {'value': int64_array(2)}).create_node() end = Rank(graph, {'name': name + '/input_rank'}).create_node() diff --git a/model-optimizer/extensions/middle/ReverseV2ToReverseSequence.py b/model-optimizer/extensions/middle/ReverseV2ToReverseSequence.py index f9f9a4ade40..26e9e06af7f 100644 --- a/model-optimizer/extensions/middle/ReverseV2ToReverseSequence.py +++ b/model-optimizer/extensions/middle/ReverseV2ToReverseSequence.py @@ -1,16 +1,27 @@ # Copyright (C) 2018-2021 Intel Corporation # SPDX-License-Identifier: Apache-2.0 -import numpy as np - from extensions.ops.reverse_sequence import ReverseSequence +from mo.front.common.partial_infer.utils import int64_array from mo.front.tf.graph_utils import create_op_node_with_second_input from mo.graph.graph import Graph, rename_node from mo.middle.replacement import MiddleReplacementPattern -from mo.utils.error import Error +from mo.ops.broadcast import Broadcast +from mo.ops.shape import Shape +from mo.ops.squeeze import Squeeze +from mo.ops.unsqueeze import Unsqueeze +from mo.utils.shape import node_to_get_shape_value_of_indices class ReverseToReverseSequence(MiddleReplacementPattern): + """ + Transformation converts Reverse to ReverseSequence operation. + Parameters for ReverseSequence calculates in the following way: + * seq_axis - set axis value from Reverse operation + * batch_axis - set 0 if seq_axis is not 0 otherwise set 1 + * seq_lengths - take from shape shape[seq_axis] value and broadcast it to vector with shape[batch_axis] length + If input is 1D tensor then we add one more dimension to set different seq_axis and batch_axis. + """ enabled = True def run_after(self): @@ -21,40 +32,57 @@ class ReverseToReverseSequence(MiddleReplacementPattern): from extensions.middle.reverse_tensor_iterator import ReverseTensorIteratorLSTM return [ReverseTensorIteratorLSTM] - @staticmethod - def pattern(): - return dict( - nodes=[ - ('reverse', dict(kind='op', op='Reverse')) - ], - edges=[] - ) + def find_and_replace_pattern(self, graph: Graph): + reverse_nodes = graph.get_op_nodes(op='Reverse') + for reverse in reverse_nodes: + reverse_name = reverse.soft_get('name', reverse.id) - def replace_pattern(self, graph: Graph, match: dict): - reverse = match['reverse'] - input_data_shape = reverse.in_node(0).shape + assert reverse.in_port(1).disconnected() + assert reverse.has_valid('axis') - if len(input_data_shape) == 1: - raise Error('Reverse operation name = {} is\'t supported because of 1D input.'.format(reverse.name)) + in_shape_rank = len(reverse.in_port(0).data.get_shape()) + # 1. Add new dimension as batch for rank = 1 to have batch != seq_axis + if in_shape_rank == 1: + unsq_node = create_op_node_with_second_input(graph, Unsqueeze, int64_array([0]), + {'name': reverse_name+"/Unsqueeze"}) + reverse.in_port(0).get_source().connect(unsq_node.in_port(0)) + new_in = unsq_node.out_port(0) + batch_axis = 0 + seq_axis = 1 + else: + new_in = reverse.in_port(0).get_source() + seq_axis = reverse['axis'] + batch_axis = 0 if seq_axis != 0 else 1 - assert reverse.in_port(1).disconnected() + # 2. For ReverseSequence 1-port input is seq_lengths => create this input node as + # shape[seq_axis] broadcasted to shape[batch_axis] + # in ---> ShapeOf ----> Gather(seq_axis) ----> Broadcast-----> + # | | + # | -------> Gather(batch_axis)----------| + shape_node = Shape(graph, {'name': reverse_name + "/Shape"}).create_node() + new_in.connect(shape_node.in_port(0)) + seq_axis_node = node_to_get_shape_value_of_indices(shape_node, [seq_axis]) + batch_node = node_to_get_shape_value_of_indices(shape_node, [batch_axis]) + broadcast_node = Broadcast(graph, {'name': reverse_name + "/Broadcast"}).create_node() + broadcast_node.in_port(0).connect(seq_axis_node.out_port(0)) + broadcast_node.in_port(1).connect(batch_node.out_port(0)) - seq_axis = reverse['axis'] - # We need to choose arbitrary batch_axis != sequence_axis - batch_axis = int(not seq_axis) + # 3. Create new ReverseSequence node and reconnect all inputs/outputs to it + rename_node(reverse, reverse_name + '/to_delete') + reverse_sequence = ReverseSequence(graph, {'name': reverse_name, 'seq_axis': seq_axis, + 'batch_axis': batch_axis}).create_node() + reverse_sequence.in_port(0).connect(new_in) + reverse_sequence.in_port(1).connect(broadcast_node.out_port(0)) - # 1. For ReverseSequence 1-port input is seq_lengths => create this input node - seq_lengths = np.ones(input_data_shape[batch_axis]) * input_data_shape[seq_axis] + # 4. remove added dimension for rank = 1 + if in_shape_rank == 1: + rename_node(reverse_sequence, reverse_name + '/ReverseSequence') + squeeze_node = create_op_node_with_second_input(graph, Squeeze, int64_array([0]), + {'name': reverse_name}) + squeeze_node.in_port(0).connect(reverse_sequence.out_port(0)) + reverse.out_port(0).get_connection().set_source(squeeze_node.out_port(0)) + else: + reverse.out_port(0).get_connection().set_source(reverse_sequence.out_port(0)) - reverse_name = reverse.soft_get('name', reverse.id) - rename_node(reverse, reverse_name + '/to_delete') - # 2. Create new ReverseSequence node and reconnect all inputs/outputs to it - reverse_sequence = create_op_node_with_second_input(graph, ReverseSequence, seq_lengths, - {'name': reverse_name, 'seq_axis': seq_axis, - 'batch_axis': batch_axis}) - rename_node(reverse_sequence, reverse_name) - reverse.in_port(0).get_connection().set_destination(reverse_sequence.in_port(0)) - reverse.out_port(0).get_connection().set_source(reverse_sequence.out_port(0)) - - # 3. Delete old Reverse node - graph.remove_node(reverse.id) + # 5. Delete old Reverse node + graph.remove_nodes_from([reverse.id for reverse in reverse_nodes]) diff --git a/model-optimizer/extensions/middle/reverse_tensor_iterator.py b/model-optimizer/extensions/middle/reverse_tensor_iterator.py index 558551ae899..2b7e99ef85f 100644 --- a/model-optimizer/extensions/middle/reverse_tensor_iterator.py +++ b/model-optimizer/extensions/middle/reverse_tensor_iterator.py @@ -5,6 +5,7 @@ import numpy as np from extensions.middle.ONNXRNNSequenceNormalize import ONNXRNNSequenceNormalize from extensions.middle.permute_tensor_iterator import TransposeTensorIteratorLSTM +from mo.front.common.partial_infer.utils import is_fully_defined from mo.graph.graph import Graph, Node from mo.middle.passes.eliminate import remove_op_node_with_data_node from mo.middle.replacement import MiddleReplacementPattern @@ -18,6 +19,7 @@ class ReverseTensorIteratorLSTM(MiddleReplacementPattern): """ enabled = True + force_clean_up = True def run_after(self): return [ @@ -32,39 +34,55 @@ class ReverseTensorIteratorLSTM(MiddleReplacementPattern): @staticmethod def is_fusable_reverse_sequence(node: Node): sequence_lengths = node.in_port(1).data.get_value() - assert sequence_lengths is not None input_shape = node.in_port(0).data.get_shape() assert input_shape is not None seq_len = input_shape[node.seq_axis] - return np.all(sequence_lengths == seq_len) + if sequence_lengths is not None and is_fully_defined(sequence_lengths) and is_fully_defined(seq_len): + return np.all(sequence_lengths == seq_len) + else: + # check that we take sequence_length from input shape based on ReverseV2ToReverseSequence transformation + broadcast_node = node.in_port(1).get_source().node + if broadcast_node.op != 'Broadcast': + return False + gather_node = broadcast_node.in_port(0).get_source().node + if gather_node.op != "Gather" or \ + (np.all(gather_node.in_port(2).data.get_value() != [0]) or + np.all(gather_node.in_port(1).data.get_value() != [node.seq_axis])): + return False + gather_node_2 = broadcast_node.in_port(1).get_source().node + if gather_node_2.op != "Gather" or \ + (np.all(gather_node_2.in_port(2).data.get_value() != [0]) or + np.all(gather_node_2.in_port(1).data.get_value() != [node.batch_axis])): + return False + shape_node = gather_node.in_port(0).get_source().node + if shape_node.op != "ShapeOf": + return False + if shape_node.in_port(0).get_source().node != node.in_port(0).get_source().node: + return False + + return True def pattern(self): return dict( nodes=[ ('input', dict(kind='data')), - ('const', dict(type='Const')), - ('const_d', dict(kind='data')), - + ('direct_seq_len_d', dict(kind='data')), ('direct_reverse', dict(op='ReverseSequence')), ('input_reversed', dict(kind='data')), ('init_hidden', dict(kind='data')), ('ti', dict(kind='op', op='TensorIterator')), - ('output_reversed', dict(kind='data')), - ('const_1', dict(type='Const')), - ('const_1_d', dict(kind='data')), - + ('inverse_seq_len_d', dict(kind='data')), ('inverse_reverse', dict(op='ReverseSequence')), ('output', dict(kind='data')), ], edges=[ ('input', 'direct_reverse', {'in': 0}), - ('const', 'const_d'), - ('const_d', 'direct_reverse', {'in': 1}), + ('direct_seq_len_d', 'direct_reverse', {'in': 1}), ('direct_reverse', 'input_reversed'), ('input_reversed', 'ti', {'in': 0}), @@ -72,8 +90,7 @@ class ReverseTensorIteratorLSTM(MiddleReplacementPattern): ('ti', 'output_reversed', {'out': 0}), ('output_reversed', 'inverse_reverse', {'in': 0}), - ('const_1', 'const_1_d'), - ('const_1_d', 'inverse_reverse', {'in': 1}), + ('inverse_seq_len_d', 'inverse_reverse', {'in': 1}), ('inverse_reverse', 'output'), ] ) @@ -106,9 +123,12 @@ class ReverseTensorIteratorLSTM(MiddleReplacementPattern): port['start'] = -1 port['end'] = 0 elif port['stride'] == 1: - port['start'] = None - port['end'] = None + port['start'] = 0 + port['end'] = -1 + # disconnect subgraph for seq length calculation + direct_reverse.in_port(1).disconnect() + inverse_reverse.in_port(1).disconnect() # Remove reverses remove_op_node_with_data_node(graph, direct_reverse) remove_op_node_with_data_node(graph, inverse_reverse) diff --git a/model-optimizer/extensions/ops/random_uniform.py b/model-optimizer/extensions/ops/random_uniform.py index 86dfcec2656..fde3719de1d 100644 --- a/model-optimizer/extensions/ops/random_uniform.py +++ b/model-optimizer/extensions/ops/random_uniform.py @@ -4,6 +4,7 @@ import numpy as np from mo.graph.graph import Graph, Node +from mo.graph.perm_inputs import PermuteInputs from mo.middle.passes.convert_data_type import np_data_type_to_destination_type from mo.ops.op import Op @@ -51,6 +52,8 @@ class RandomUniform(Op): node.in_node(1)['correct_data_type'] = True node.in_node(2)['correct_data_type'] = True + PermuteInputs().set_input_permutation(node.in_node(0), node, 'output:0', 'shape') + class AttributedRandomUniform(Op): """ RandomUniform operation that generates a sequence of random values from uniform distribution. diff --git a/model-optimizer/extensions/ops/reverse_sequence.py b/model-optimizer/extensions/ops/reverse_sequence.py index 06509ec0e59..3b3fe9550d7 100644 --- a/model-optimizer/extensions/ops/reverse_sequence.py +++ b/model-optimizer/extensions/ops/reverse_sequence.py @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 from mo.graph.graph import Graph -from mo.ops.op import Op +from mo.ops.op import Op, PermuteAttrs class ReverseSequence(Op): @@ -35,3 +35,6 @@ class ReverseSequence(Op): assert len(node.out_nodes()) == 1 node.out_port(0).data.set_shape(input_data_shape) + + PermuteAttrs.create_permute_attrs(node, attrs=[('seq_axis', 'input:0')]) + PermuteAttrs.create_permute_attrs(node, attrs=[('batch_axis', 'input:0')]) diff --git a/model-optimizer/mo/ops/op.py b/model-optimizer/mo/ops/op.py index ff9f923d171..db3dabcc0ab 100644 --- a/model-optimizer/mo/ops/op.py +++ b/model-optimizer/mo/ops/op.py @@ -374,6 +374,8 @@ class PermuteAttrs: 'ellipsis_mask': slice_permutation, 'axes': common_permutation_inv, 'axis': common_permutation_inv, + 'seq_axis': common_permutation_inv, + 'batch_axis': common_permutation_inv, 'batch_dims': common_permutation_inv, 'channel_dims': common_permutation_inv, 'spatial_dims': common_permutation_inv, diff --git a/model-optimizer/unit_tests/extensions/front/GlobalPoolingToReduce_test.py b/model-optimizer/unit_tests/extensions/front/GlobalPoolingToReduce_test.py new file mode 100644 index 00000000000..051c175771a --- /dev/null +++ b/model-optimizer/unit_tests/extensions/front/GlobalPoolingToReduce_test.py @@ -0,0 +1,55 @@ +# Copyright (C) 2018-2021 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +import unittest + +from extensions.front.global_pooling_to_reduce import GlobalPoolingToReduce +from mo.front.common.partial_infer.utils import int64_array +from mo.graph.graph import Node +from mo.utils.ir_engine.compare_graphs import compare_graphs +from unit_tests.utils.graph import build_graph, regular_op, result, build_graph_with_edge_attrs, const + +nodes = {**regular_op('input', {'type': 'Parameter'}), + + **regular_op('relu', {'type': 'Relu'}), + **regular_op('pooling', {'type': 'Pooling', 'global_pool': True, 'pool_method': 'avg'}), + + **result('result'), + + **regular_op('rank', {'type': 'Rank'}), + **regular_op('reduce_mean', {'type': 'ReduceMean'}), + **regular_op('range', {'type': 'Range'}), + **const('const_1', int64_array(2)), + **const('const_2', int64_array(1)), + + } +edges = [('input', 'relu', {'in': 0, 'out': 0}), ('relu', 'pooling', {'in': 0, 'out': 0}), + ('pooling', 'result', {'in': 0, 'out': 0})] +ref_edges = [('input', 'relu', {'in': 0, 'out': 0}), ('relu', 'rank', {'in': 0, 'out': 0}), + ('rank', 'range', {'in': 1, 'out': 0}), + ('relu', 'reduce_mean', {'in': 0, 'out': 0}), + ('const_1', 'range', {'in': 0, 'out': 0}), ('const_2', 'range', {'in': 2, 'out': 0}), + ('range', 'reduce_mean', {'in': 1, 'out': 0}), + ('reduce_mean', 'result', {'in': 0, 'out': 0})] + + +class GlobalPoolingToReduceTest(unittest.TestCase): + def test_global_pooling_to_reduce(self): + graph = build_graph_with_edge_attrs(nodes, edges) + + graph_ref = build_graph(nodes, ref_edges) + graph.stage = 'front' + graph.graph['layout'] = 'NCHW' + node = Node(graph, 'relu') + node.out_edge(0)['fw_tensor_debug_info'] = [('Relu_0', 'Relu_tensor')] + + GlobalPoolingToReduce().find_and_replace_pattern(graph) + graph.clean_up() + + (flag, resp) = compare_graphs(graph, graph_ref, 'result') + self.assertTrue(flag, resp) + + node = Node(graph, 'relu') + edge_attrs = node.out_port(0).get_destinations()[0].get_in_edge_attrs() + self.assertTrue('fw_tensor_debug_info' in edge_attrs) + self.assertTrue(edge_attrs['fw_tensor_debug_info'] == [('Relu_0', 'Relu_tensor')]) diff --git a/model-optimizer/unit_tests/extensions/middle/reverse_tensor_iterator_test.py b/model-optimizer/unit_tests/extensions/middle/reverse_tensor_iterator_test.py new file mode 100644 index 00000000000..1dd81ea2bd8 --- /dev/null +++ b/model-optimizer/unit_tests/extensions/middle/reverse_tensor_iterator_test.py @@ -0,0 +1,117 @@ +# Copyright (C) 2018-2021 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +import unittest + +import numpy as np + +from extensions.middle.reverse_tensor_iterator import ReverseTensorIteratorLSTM +from mo.utils.ir_engine.compare_graphs import compare_graphs +from unit_tests.utils.graph import build_graph, regular_op_with_shaped_data, connect, \ + valued_const_with_data, regular_op_with_empty_data, result + +nodes = { + **regular_op_with_shaped_data('parameter', [1, 3, 227, 227], + {'type': 'Parameter', 'op': 'Parameter', 'shape': [1, 3, 227, 227]}), + **valued_const_with_data('seq_len', np.array([227])), + **regular_op_with_empty_data('shapeof', {'type': 'ShapeOf', 'op': 'ShapeOf'}), + **valued_const_with_data('gather_axis', np.array([0])), + **valued_const_with_data('gather_batch_ind', np.array([0])), + **valued_const_with_data('gather_seq_ind', np.array([2])), + **regular_op_with_empty_data('gather_batch', {'type': 'Gather', 'op': 'Gather'}), + **regular_op_with_empty_data('gather_seq', {'type': 'Gather', 'op': 'Gather'}), + **regular_op_with_empty_data('broadcast', {'type': 'Broadcast', 'op': 'Broadcast'}), + **regular_op_with_shaped_data('direct_reverse', [1, 3, 227, 227], {'type': 'ReverseSequence', + 'op': 'ReverseSequence', + 'seq_axis': 2, 'batch_axis': 0}), + **regular_op_with_empty_data('init_hidden', {'type': 'Init', 'op': 'Init'}), + + **regular_op_with_shaped_data('ti', [1, 2, 34, 56], {'type': 'TensorIterator', 'op': 'TensorIterator', + 'output_port_map': [{'axis': 2, 'start': 0, 'end': -1, + 'stride': 1, 'external_port_id': 0}], + 'input_port_map': [{'axis': 2, 'start': -1, 'end': 0, + 'stride': -1, 'external_port_id': 0}]}), + **valued_const_with_data('inverse_seq_len', np.array([34])), + **regular_op_with_empty_data('inverse_shapeof', {'type': 'ShapeOf', 'op': 'ShapeOf'}), + **regular_op_with_empty_data('inverse_gather_batch', {'type': 'Gather', 'op': 'Gather'}), + **regular_op_with_empty_data('inverse_gather_seq', {'type': 'Gather', 'op': 'Gather'}), + **regular_op_with_empty_data('inverse_broadcast', {'type': 'Broadcast', 'op': 'Broadcast'}), + **regular_op_with_shaped_data('inverse_reverse', [1, 2, 34, 56], {'type': 'ReverseSequence', + 'op': 'ReverseSequence', + 'seq_axis': 2, 'batch_axis': 0}), + **regular_op_with_empty_data('some_op', {'op': 'SomeOp'}), + **result() +} + +ref_nodes = { + **regular_op_with_shaped_data('parameter', [1, 3, 227, 227], + {'type': 'Parameter', 'op': 'Parameter', 'shape': [1, 3, 227, 227]}), + **regular_op_with_empty_data('init_hidden', {'type': 'Init', 'op': 'Init'}), + **regular_op_with_empty_data('ti', {'type': 'TensorIterator', 'op': 'TensorIterator', + 'output_port_map': [{'axis': 2, 'start': -1, 'end': 0, 'stride': -1, + 'external_port_id': 0}], + 'input_port_map': [{'axis': 2, 'start': 0, 'end': -1, 'stride': 1, + 'external_port_id': 0}]}), + **regular_op_with_empty_data('some_op', {'op': 'SomeOp'}), + **result() +} + + +class ReverseTensorIteratorTest(unittest.TestCase): + def test_ti_reverse(self): + graph = build_graph(nodes, [*connect('parameter:0', '0:direct_reverse'), + *connect('parameter:0', 'shapeof', skip_data=True), + *connect('shapeof:0', '0:gather_batch'), + *connect('gather_batch_ind', '1:gather_batch'), + *connect('gather_axis', '2:gather_batch'), + *connect('shapeof:0', '0:gather_seq', skip_data=True), + *connect('gather_seq_ind', '1:gather_seq'), + *connect('gather_axis', '2:gather_seq'), + *connect('gather_seq', '0:broadcast'), + *connect('gather_batch', '1:broadcast'), + *connect('broadcast', '1:direct_reverse'), + *connect('direct_reverse', '0:ti'), + *connect('init_hidden', '1:ti'), + *connect('ti', 'inverse_shapeof'), + *connect('inverse_shapeof:0', '0:inverse_gather_batch'), + *connect('gather_batch_ind', '1:inverse_gather_batch'), + *connect('gather_axis', '2:inverse_gather_batch'), + *connect('inverse_shapeof:0', '0:inverse_gather_seq', skip_data=True), + *connect('gather_seq_ind', '1:inverse_gather_seq'), + *connect('gather_axis', '2:inverse_gather_seq'), + *connect('inverse_gather_seq', '0:inverse_broadcast'), + *connect('inverse_gather_batch', '1:inverse_broadcast'), + *connect('ti', '0:inverse_reverse', skip_data=True), + *connect('inverse_broadcast', '1:inverse_reverse'), + *connect('inverse_reverse', 'some_op'), + *connect('some_op', 'output')], nodes_with_edges_only=True) + + ReverseTensorIteratorLSTM().find_and_replace_pattern(graph) + graph.clean_up() + + ref_graph = build_graph(ref_nodes, [*connect('parameter', '0:ti'), + *connect('init_hidden', '1:ti'), + *connect('ti', 'some_op'), + *connect('some_op', 'output')]) + flag, resp = compare_graphs(graph, ref_graph, 'output', check_op_attrs=True) + self.assertTrue(flag, resp) + + def test_ti_reverse_const(self): + graph = build_graph(nodes, [*connect('parameter:0', '0:direct_reverse'), + *connect('seq_len', '1:direct_reverse'), + *connect('direct_reverse', '0:ti'), + *connect('init_hidden', '1:ti'), + *connect('ti', '0:inverse_reverse'), + *connect('inverse_seq_len', '1:inverse_reverse'), + *connect('inverse_reverse', 'some_op'), + *connect('some_op', 'output')], nodes_with_edges_only=True) + + ReverseTensorIteratorLSTM().find_and_replace_pattern(graph) + graph.clean_up() + + ref_graph = build_graph(ref_nodes, [*connect('parameter', '0:ti'), + *connect('init_hidden', '1:ti'), + *connect('ti', 'some_op'), + *connect('some_op', 'output')]) + flag, resp = compare_graphs(graph, ref_graph, 'output', check_op_attrs=True) + self.assertTrue(flag, resp) diff --git a/ngraph/.gitignore b/ngraph/.gitignore deleted file mode 100644 index 588daa92a64..00000000000 --- a/ngraph/.gitignore +++ /dev/null @@ -1,123 +0,0 @@ -# Compiled Object files -*.slo -*.lo -*.o -*.obj -*.pyc - -# Precompiled Headers -*.gch -*.pch - -# Compiled Dynamic libraries -*.so -*.dylib -*.dll - -*.db - -# Fortran module files -*.mod - -# Compiled Static libraries -*.lai -*.la -*.a -*.lib - -# Executables -*.exe -*.out -*.app - -# QT Creator -*.creator -*.config -*.files -*.includes -*.creator.user* -*.autosave - -.DS_Store -@eaDir/ -.d/ -bin/ -*.log -output/ -*.png -*.jpg -*.mp2 -*.mpg -*.cpio -*.wav -*.backup -doc/source/generated -.cache/ -nervana_aeon.egg-info/ -*.xsd -*.xslt -.vscode - -# emacs -*~ - -# vim -*.swp -*.swo -tags - -build/ -scripts/ - -# makeenv and test intermediate files -tmp/ - -# Apple -*.AppleDouble - -config_args.txt -.nfs* -venv/ -.vscode/ -.vs/ - -# VisualGDB files -VisualGDB/ -toolchain.cmake - -# docbuild artifacts -doc/sphinx/build/* -doc/doxygen/*.xml -doc/doxygen/*.html -doc/doxygen/man/* -doc/doxygen/latex/* -doc/doxygen/xml/* -doc/doxygen/html/* - - -# python venv things that might get added accidentally -../ -python-wheels/ -.whl -*.whl -.venv - -# python wheels -python/share/* - -# git merge -*.orig -\#* -\.#* - -# remnants from a failed in-source build -CMakeCache.txt -CMakeFiles/ -CMakeSettings.json - -# don't add dot-save files! - -.save - -# YouCompleteMe -.ycm_extra_conf.py diff --git a/ngraph/CMakeLists.txt b/ngraph/CMakeLists.txt deleted file mode 100644 index 9681640b96b..00000000000 --- a/ngraph/CMakeLists.txt +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright (C) 2018-2021 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 -# - -if(ENABLE_LTO) - set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE ON) -endif() - -set(NGRAPH_INCLUDE_PATH - ${CMAKE_CURRENT_SOURCE_DIR}/core/include -) - -project (ngraph) - -#----------------------------------------------------------------------------------------------- -# Installation logic... -#----------------------------------------------------------------------------------------------- - -set(NGRAPH_TARGETS_FILE "${CMAKE_CURRENT_BINARY_DIR}/ngraphTargets.cmake") - -add_definitions(-DPROJECT_ROOT_DIR="${CMAKE_CURRENT_SOURCE_DIR}") - -#----------------------------------------------------------------------------------------------- -# External projects install directory -#----------------------------------------------------------------------------------------------- - -add_subdirectory(core) - -add_subdirectory(frontend) - -add_subdirectory(test) diff --git a/ngraph/core/include/openvino/op/prior_box.hpp b/ngraph/core/include/openvino/op/prior_box.hpp deleted file mode 100644 index 53924c19d73..00000000000 --- a/ngraph/core/include/openvino/op/prior_box.hpp +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (C) 2018-2021 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#pragma once - -#include "openvino/op/op.hpp" - -namespace ov { -namespace op { -namespace v0 { -/// \brief Layer which generates prior boxes of specified sizes -/// normalized to input image size -class OPENVINO_API PriorBox : public Op { -public: - OPENVINO_OP("PriorBox", "opset1"); - BWDCMP_RTTI_DECLARATION; - struct Attributes { - // min_size Desired min_size of prior boxes - // max_size Desired max_size of prior boxes - // aspect_ratio Aspect ratios of prior boxes - // clip Clip output to [0,1] - // flip Flip aspect ratios - // step Distance between prior box centers - // offset Box offset relative to top center of image - // variance Values to adjust prior boxes with - // scale_all_sizes Scale all sizes - std::vector min_size; - std::vector max_size; - std::vector aspect_ratio; - std::vector density; - std::vector fixed_ratio; - std::vector fixed_size; - bool clip = false; - bool flip = false; - float step = 0.0f; - float offset = 0.0f; - std::vector variance; - bool scale_all_sizes = true; - }; - - PriorBox() = default; - /// \brief Constructs a PriorBox operation - /// - /// \param layer_shape Shape of layer for which prior boxes are computed - /// \param image_shape Shape of image to which prior boxes are scaled - /// \param attrs PriorBox attributes - PriorBox(const Output& layer_shape, const Output& image_shape, const Attributes& attrs); - - void validate_and_infer_types() override; - std::shared_ptr clone_with_new_inputs(const OutputVector& new_args) const override; - - static int64_t number_of_priors(const Attributes& attrs); - - static std::vector normalized_aspect_ratio(const std::vector& aspect_ratio, bool flip); - const Attributes& get_attrs() const { - return m_attrs; - } - bool visit_attributes(AttributeVisitor& visitor) override; - OPENVINO_SUPPRESS_DEPRECATED_START - bool evaluate(const HostTensorVector& outputs, const HostTensorVector& inputs) const override; - OPENVINO_SUPPRESS_DEPRECATED_END - bool has_evaluate() const override; - -private: - Attributes m_attrs; -}; -} // namespace v0 -} // namespace op -} // namespace ov diff --git a/ngraph/core/src/op/prior_box.cpp b/ngraph/core/src/op/prior_box.cpp deleted file mode 100644 index b19b136cd09..00000000000 --- a/ngraph/core/src/op/prior_box.cpp +++ /dev/null @@ -1,192 +0,0 @@ -// Copyright (C) 2018-2021 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#include "ngraph/op/prior_box.hpp" - -#include - -#include "itt.hpp" -#include "ngraph/op/constant.hpp" -#include "ngraph/runtime/host_tensor.hpp" -#include "ngraph/runtime/reference/prior_box.hpp" - -using namespace std; -using namespace ngraph; - -BWDCMP_RTTI_DEFINITION(op::v0::PriorBox); - -op::PriorBox::PriorBox(const Output& layer_shape, - const Output& image_shape, - const PriorBox::Attributes& attrs) - : Op({layer_shape, image_shape}), - m_attrs(attrs) { - constructor_validate_and_infer_types(); -} - -void op::PriorBox::validate_and_infer_types() { - NGRAPH_OP_SCOPE(v0_PriorBox_validate_and_infer_types); - // shape node should have integer data type. For now we only allow i64 - auto layer_shape_et = get_input_element_type(0); - NODE_VALIDATION_CHECK(this, - layer_shape_et.is_integral_number(), - "layer shape input must be an integral number, but is: ", - layer_shape_et); - - auto image_shape_et = get_input_element_type(1); - NODE_VALIDATION_CHECK(this, - image_shape_et.is_integral_number(), - "image shape input must be an integral number, but is: ", - image_shape_et); - - auto layer_shape_rank = get_input_partial_shape(0).rank(); - auto image_shape_rank = get_input_partial_shape(1).rank(); - NODE_VALIDATION_CHECK(this, - layer_shape_rank.compatible(image_shape_rank), - "layer shape input rank ", - layer_shape_rank, - " must match image shape input rank ", - image_shape_rank); - - set_input_is_relevant_to_shape(0); - - if (auto const_shape = get_constant_from_source(input_value(0))) { - NODE_VALIDATION_CHECK(this, - shape_size(const_shape->get_shape()) == 2, - "Layer shape must have rank 2", - const_shape->get_shape()); - - auto layer_shape = const_shape->get_shape_val(); - - set_output_type( - 0, - element::f32, - ov::Shape{2, 4 * layer_shape[0] * layer_shape[1] * static_cast(number_of_priors(m_attrs))}); - } else { - set_output_type(0, element::f32, ov::PartialShape{2, Dimension::dynamic()}); - } -} - -shared_ptr op::PriorBox::clone_with_new_inputs(const OutputVector& new_args) const { - NGRAPH_OP_SCOPE(v0_PriorBox_clone_with_new_inputs); - check_new_args_count(this, new_args); - return make_shared(new_args.at(0), new_args.at(1), m_attrs); -} - -int64_t op::PriorBox::number_of_priors(const PriorBox::Attributes& attrs) { - // Starting with 0 number of prior and then various conditions on attributes will contribute - // real number of prior boxes as PriorBox is a fat thing with several modes of - // operation that will be checked in order in the next statements. - int64_t num_priors = 0; - - // Total number of boxes around each point; depends on whether flipped boxes are included - // plus one box 1x1. - int64_t total_aspect_ratios = normalized_aspect_ratio(attrs.aspect_ratio, attrs.flip).size(); - - if (attrs.scale_all_sizes) - num_priors = total_aspect_ratios * attrs.min_size.size() + attrs.max_size.size(); - else - num_priors = total_aspect_ratios + attrs.min_size.size() - 1; - - if (!attrs.fixed_size.empty()) - num_priors = total_aspect_ratios * attrs.fixed_size.size(); - - for (auto density : attrs.density) { - auto rounded_density = static_cast(density); - auto density_2d = (rounded_density * rounded_density - 1); - if (!attrs.fixed_ratio.empty()) - num_priors += attrs.fixed_ratio.size() * density_2d; - else - num_priors += total_aspect_ratios * density_2d; - } - return num_priors; -} - -std::vector op::PriorBox::normalized_aspect_ratio(const std::vector& aspect_ratio, bool flip) { - std::set unique_ratios; - for (auto ratio : aspect_ratio) { - unique_ratios.insert(std::round(ratio * 1e6) / 1e6); - if (flip) - unique_ratios.insert(std::round(1 / ratio * 1e6) / 1e6); - } - unique_ratios.insert(1); - return std::vector(unique_ratios.begin(), unique_ratios.end()); -} - -bool op::PriorBox::visit_attributes(AttributeVisitor& visitor) { - NGRAPH_OP_SCOPE(v0_PriorBox_visit_attributes); - visitor.on_attribute("min_size", m_attrs.min_size); - visitor.on_attribute("max_size", m_attrs.max_size); - visitor.on_attribute("aspect_ratio", m_attrs.aspect_ratio); - visitor.on_attribute("density", m_attrs.density); - visitor.on_attribute("fixed_ratio", m_attrs.fixed_ratio); - visitor.on_attribute("fixed_size", m_attrs.fixed_size); - visitor.on_attribute("clip", m_attrs.clip); - visitor.on_attribute("flip", m_attrs.flip); - visitor.on_attribute("step", m_attrs.step); - visitor.on_attribute("offset", m_attrs.offset); - visitor.on_attribute("variance", m_attrs.variance); - visitor.on_attribute("scale_all_sizes", m_attrs.scale_all_sizes); - return true; -} - -namespace prior_box { -namespace { -template -bool evaluate(const HostTensorPtr& arg0, - const HostTensorPtr& arg1, - const HostTensorPtr& out, - op::PriorBox::Attributes attrs) { - runtime::reference::prior_box(arg0->get_data_ptr(), - arg1->get_data_ptr(), - out->get_data_ptr(), - out->get_shape(), - attrs); - return true; -} - -bool evaluate_prior_box(const HostTensorPtr& arg0, - const HostTensorPtr& arg1, - const HostTensorPtr& out, - const op::PriorBox::Attributes& attrs) { - bool rc = true; - switch (arg0->get_element_type()) { - NGRAPH_TYPE_CASE(evaluate_prior_box, i8, arg0, arg1, out, attrs); - NGRAPH_TYPE_CASE(evaluate_prior_box, i16, arg0, arg1, out, attrs); - NGRAPH_TYPE_CASE(evaluate_prior_box, i32, arg0, arg1, out, attrs); - NGRAPH_TYPE_CASE(evaluate_prior_box, i64, arg0, arg1, out, attrs); - NGRAPH_TYPE_CASE(evaluate_prior_box, u8, arg0, arg1, out, attrs); - NGRAPH_TYPE_CASE(evaluate_prior_box, u16, arg0, arg1, out, attrs); - NGRAPH_TYPE_CASE(evaluate_prior_box, u32, arg0, arg1, out, attrs); - NGRAPH_TYPE_CASE(evaluate_prior_box, u64, arg0, arg1, out, attrs); - default: - rc = false; - break; - } - return rc; -} -} // namespace -} // namespace prior_box - -bool op::v0::PriorBox::evaluate(const HostTensorVector& outputs, const HostTensorVector& inputs) const { - NGRAPH_OP_SCOPE(v0_PriorBox_evaluate); - return prior_box::evaluate_prior_box(inputs[0], inputs[1], outputs[0], get_attrs()); -} - -bool op::v0::PriorBox::has_evaluate() const { - NGRAPH_OP_SCOPE(v0_PriorBox_has_evaluate); - switch (get_input_element_type(0)) { - case ngraph::element::i8: - case ngraph::element::i16: - case ngraph::element::i32: - case ngraph::element::i64: - case ngraph::element::u8: - case ngraph::element::u16: - case ngraph::element::u32: - case ngraph::element::u64: - return true; - default: - break; - } - return false; -} diff --git a/ngraph/environment_variables.md b/ngraph/environment_variables.md deleted file mode 100644 index 505ced47448..00000000000 --- a/ngraph/environment_variables.md +++ /dev/null @@ -1,16 +0,0 @@ -# Environment Variables - -| Name | Default | Description | -| ------------------------------------|:---:| --- | -| NGRAPH_ENABLE_REPLACE_CHECK | | -| NGRAPH_ENABLE_TRACING | | -| NGRAPH_ENABLE_VISUALIZE_TRACING | | -| NGRAPH_FAIL_MATCH_AT | | -| NGRAPH_GRAPH_REWRITE_RERUN_DYNAMIC_CHECK | | -| NGRAPH_GTEST_INFO | | -| NGRAPH_PROFILE_PASS_ENABLE | | -| NGRAPH_VISUALIZE_EDGE_JUMP_DISTANCE | | -| NGRAPH_VISUALIZE_EDGE_LABELS | | -| NGRAPH_VISUALIZE_TRACING_FORMAT | | -| NGRAPH_VISUALIZE_TREE_OUTPUT_SHAPES | | -| NGRAPH_VISUALIZE_TREE_OUTPUT_TYPES | | diff --git a/ngraph/frontend/ir/CMakeLists.txt b/ngraph/frontend/ir/CMakeLists.txt deleted file mode 100644 index b43bfcdc797..00000000000 --- a/ngraph/frontend/ir/CMakeLists.txt +++ /dev/null @@ -1,56 +0,0 @@ -# Copyright (C) 2018-2021 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 -# - -set(TARGET_NAME "ir_ov_frontend") - -file(GLOB_RECURSE LIBRARY_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) -file(GLOB_RECURSE LIBRARY_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/src/*.hpp) -file(GLOB_RECURSE LIBRARY_PUBLIC_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include/*.hpp) - -set(${TARGET_NAME}_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include) - -# Add include path to so_extension.hpp -set_property(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/src/frontend.cpp - APPEND PROPERTY INCLUDE_DIRECTORIES "${OpenVINO_SOURCE_DIR}/ngraph/core/src/") - -# Create named folders for the sources within the .vcproj -# Empty name lists them directly under the .vcproj - -source_group("src" FILES ${LIBRARY_SRC}) -source_group("include" FILES ${LIBRARY_HEADERS}) -source_group("public include" FILES ${LIBRARY_PUBLIC_HEADERS}) - -# Create library -add_library(${TARGET_NAME} SHARED ${LIBRARY_SRC} ${LIBRARY_HEADERS} ${LIBRARY_PUBLIC_HEADERS}) - -ov_ncc_naming_style(FOR_TARGET ${TARGET_NAME} - INCLUDE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include" - ADDITIONAL_INCLUDE_DIRECTORIES - $) - -target_include_directories(${TARGET_NAME} - PUBLIC - $ - PRIVATE - ${CMAKE_CURRENT_SOURCE_DIR}/src - ${CMAKE_CURRENT_BINARY_DIR}) - -target_include_directories(${TARGET_NAME} SYSTEM PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) - -ie_add_vs_version_file(NAME ${TARGET_NAME} - FILEDESCRIPTION "FrontEnd to load and convert OpenVINO IR file format") - -ie_add_api_validator_post_build_step(TARGET ${TARGET_NAME}) - -target_link_libraries(${TARGET_NAME} PRIVATE frontend_common::static - ngraph::builder inference_engine_transformations - inference_engine pugixml::static inference_engine_plugin_api) - -add_clang_format_target(${TARGET_NAME}_clang FOR_TARGETS ${TARGET_NAME} - EXCLUDE_PATTERNS ${PROTO_SRCS} ${PROTO_HDRS}) - -install(TARGETS ${TARGET_NAME} - RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT ngraph - ARCHIVE DESTINATION ${IE_CPACK_ARCHIVE_PATH} COMPONENT ngraph - LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT ngraph) diff --git a/ngraph/frontend/onnx/frontend/CMakeLists.txt b/ngraph/frontend/onnx/frontend/CMakeLists.txt deleted file mode 100644 index 2ebb43e038d..00000000000 --- a/ngraph/frontend/onnx/frontend/CMakeLists.txt +++ /dev/null @@ -1,68 +0,0 @@ -# Copyright (C) 2021 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 -# - -set(TARGET_NAME onnx_ov_frontend) - -set(ONNX_OPSET_VERSION 13 CACHE INTERNAL "Supported version of ONNX operator set") -set(ONNX_FRONTEND_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include) - -file(GLOB_RECURSE LIBRARY_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) -file(GLOB_RECURSE LIBRARY_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/src/*.hpp) -file(GLOB_RECURSE LIBRARY_PUBLIC_HEADERS ${ONNX_FRONTEND_INCLUDE_DIR}/*.hpp) - -# Remove disabled ops -list(REMOVE_ITEM LIBRARY_SRC - ${CMAKE_CURRENT_SOURCE_DIR}/src/op/quant_conv.cpp - ) -list(REMOVE_ITEM LIBRARY_HEADERS - ${CMAKE_CURRENT_SOURCE_DIR}/src/op/quant_conv.hpp - ) - -# Create named folders for the sources within the .vcproj -# Empty name lists them directly under the .vcproj - -source_group("src" FILES ${LIBRARY_SRC}) -source_group("include" FILES ${LIBRARY_HEADERS}) -source_group("public include" FILES ${LIBRARY_PUBLIC_HEADERS}) - -# Create library -add_library(${TARGET_NAME} SHARED ${LIBRARY_SRC} ${LIBRARY_HEADERS} ${LIBRARY_PUBLIC_HEADERS}) -add_library(openvino::frontend::onnx ALIAS ${TARGET_NAME}) - -add_clang_format_target(${TARGET_NAME}_clang FOR_TARGETS ${TARGET_NAME}) - -ov_ncc_naming_style(FOR_TARGET ${TARGET_NAME} - INCLUDE_DIRECTORY "${ONNX_FRONTEND_INCLUDE_DIR}" - DEFINITIONS - $ - ADDITIONAL_INCLUDE_DIRECTORIES - $) - -ie_add_vs_version_file(NAME ${TARGET_NAME} - FILEDESCRIPTION "nGraph ONNX frontend library") - -ie_add_api_validator_post_build_step(TARGET ${TARGET_NAME}) - -target_link_libraries(${TARGET_NAME} PUBLIC ngraph PRIVATE frontend_common ngraph::builder openvino::util onnx_common inference_engine_transformations) - -target_include_directories(${TARGET_NAME} PUBLIC $ - $) -target_include_directories(${TARGET_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src) - -target_compile_definitions(${TARGET_NAME} PRIVATE ONNX_OPSET_VERSION=${ONNX_OPSET_VERSION}) - -set_target_properties(${TARGET_NAME} PROPERTIES EXPORT_NAME frontend::onnx) -install(TARGETS ${TARGET_NAME} EXPORT OpenVINOTargets - RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT ngraph - ARCHIVE DESTINATION ${IE_CPACK_ARCHIVE_PATH} COMPONENT ngraph - LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT ngraph) - -install(DIRECTORY ${ONNX_FRONTEND_INCLUDE_DIR}/onnx_frontend - ${ONNX_FRONTEND_INCLUDE_DIR}/onnx_import - DESTINATION ${FRONTEND_INSTALL_INCLUDE} - COMPONENT ngraph_dev - FILES_MATCHING PATTERN "*.hpp") - -export(TARGETS ${TARGET_NAME} NAMESPACE openvino:: - APPEND FILE "${CMAKE_BINARY_DIR}/OpenVINOTargets.cmake") diff --git a/ngraph/frontend/onnx/frontend/include/onnx_import/onnx_importer_visibility.hpp b/ngraph/frontend/onnx/frontend/include/onnx_import/onnx_importer_visibility.hpp deleted file mode 100644 index d2bd18de52c..00000000000 --- a/ngraph/frontend/onnx/frontend/include/onnx_import/onnx_importer_visibility.hpp +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (C) 2018-2021 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#include "ngraph/visibility.hpp" - -#ifdef onnx_ov_frontend_EXPORTS -# define ONNX_IMPORTER_API OPENVINO_CORE_EXPORTS -#else -# define ONNX_IMPORTER_API OPENVINO_CORE_IMPORTS -#endif diff --git a/ngraph/frontend/onnx/frontend/src/op/quant_conv.hpp b/ngraph/frontend/onnx/frontend/src/op/quant_conv.hpp deleted file mode 100644 index 01f2034cd32..00000000000 --- a/ngraph/frontend/onnx/frontend/src/op/quant_conv.hpp +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (C) 2018-2021 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -// Disabled in CMakeList -// Update to higher opset required - -#pragma once - -#include "ngraph/node.hpp" -#include "onnx_import/core/node.hpp" - -namespace ngraph -{ - namespace onnx_import - { - namespace op - { - namespace set_1 - { - /// \brief Performs ONNX Quant Conv operation. - /// - /// \param node The ONNX node object representing this operation. - /// - /// \return The vector containing Ngraph nodes producing output of ONNX quantizied - /// convolution operation. - OutputVector quant_conv(const Node& node); - - } // namespace set_1 - - } // namespace op - - } // namespace onnx_import - -} // namespace ngraph diff --git a/ngraph/frontend/paddlepaddle/CMakeLists.txt b/ngraph/frontend/paddlepaddle/CMakeLists.txt deleted file mode 100644 index 89f6fb9f97a..00000000000 --- a/ngraph/frontend/paddlepaddle/CMakeLists.txt +++ /dev/null @@ -1,97 +0,0 @@ -# Copyright (C) 2018-2021 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 -# - -set(TARGET_NAME "paddlepaddle_ov_frontend") - -file(GLOB_RECURSE LIBRARY_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) -file(GLOB_RECURSE LIBRARY_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/src/*.hpp) -file(GLOB_RECURSE LIBRARY_PUBLIC_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include/*.hpp) - -set(${TARGET_NAME}_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include) - -# Create named folders for the sources within the .vcproj -# Empty name lists them directly under the .vcproj - -source_group("src" FILES ${LIBRARY_SRC}) -source_group("include" FILES ${LIBRARY_HEADERS}) -source_group("public include" FILES ${LIBRARY_PUBLIC_HEADERS}) - -set(PROTO_SRCS) -set(PROTO_HDRS) - -# Generate protobuf file on build time for each '.proto' file in src/proto -file(GLOB proto_files ${CMAKE_CURRENT_SOURCE_DIR}/src/proto/*.proto) - -foreach(INFILE ${proto_files}) - get_filename_component(FILE_DIR ${INFILE} DIRECTORY) - get_filename_component(FILE_WE ${INFILE} NAME_WE) - set(OUTPUT_PB_SRC ${CMAKE_CURRENT_BINARY_DIR}/${FILE_WE}.pb.cc) - set(OUTPUT_PB_HEADER ${CMAKE_CURRENT_BINARY_DIR}/${FILE_WE}.pb.h) - set(GENERATED_PROTO ${INFILE}) - add_custom_command( - OUTPUT "${OUTPUT_PB_SRC}" "${OUTPUT_PB_HEADER}" - COMMAND ${PROTOC_EXECUTABLE} ARGS --cpp_out ${CMAKE_CURRENT_BINARY_DIR} -I ${FILE_DIR} ${FILE_WE}.proto - DEPENDS ${PROTOC_EXECUTABLE} ${GENERATED_PROTO} - COMMENT "Running C++ protocol buffer compiler (${PROTOC_EXECUTABLE}) on ${GENERATED_PROTO}" - VERBATIM - COMMAND_EXPAND_LISTS) - list(APPEND PROTO_SRCS "${OUTPUT_PB_SRC}") - list(APPEND PROTO_HDRS "${OUTPUT_PB_HEADER}") -endforeach() - -add_custom_target(${TARGET_NAME}_proto DEPENDS ${PROTO_SRCS} ${PROTO_HDRS}) - -set_source_files_properties(${PROTO_SRCS} ${PROTO_HDRS} PROPERTIES GENERATED TRUE) - -# Disable all warnings for generated code -set_source_files_properties(${PROTO_SRCS} ${PROTO_HDRS} PROPERTIES COMPILE_OPTIONS -w) - -# Create library -add_library(${TARGET_NAME} SHARED ${LIBRARY_SRC} ${LIBRARY_HEADERS} ${LIBRARY_PUBLIC_HEADERS} ${PROTO_SRCS} ${PROTO_HDRS}) -add_library(openvino::frontend::paddlepaddle ALIAS ${TARGET_NAME}) - -add_dependencies(${TARGET_NAME} ${TARGET_NAME}_proto) - -ov_ncc_naming_style(FOR_TARGET ${TARGET_NAME} - INCLUDE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include" - ADDITIONAL_INCLUDE_DIRECTORIES - $) - -target_include_directories(${TARGET_NAME} - PUBLIC - $ - $ - PRIVATE - ${CMAKE_CURRENT_SOURCE_DIR}/src - ${CMAKE_CURRENT_BINARY_DIR}) - -target_include_directories(${TARGET_NAME} SYSTEM PRIVATE ${Protobuf_INCLUDE_DIRS} - ${CMAKE_CURRENT_BINARY_DIR}) - -ie_add_vs_version_file(NAME ${TARGET_NAME} - FILEDESCRIPTION "FrontEnd to load and convert PaddlePaddle file format") - -ie_add_api_validator_post_build_step(TARGET ${TARGET_NAME}) - -link_system_libraries(${TARGET_NAME} PRIVATE ${Protobuf_LITE_LIBRARIES}) - -target_link_libraries(${TARGET_NAME} PRIVATE frontend_common::static - PRIVATE ngraph::builder inference_engine_transformations) - -add_clang_format_target(${TARGET_NAME}_clang FOR_TARGETS ${TARGET_NAME} - EXCLUDE_PATTERNS ${PROTO_SRCS} ${PROTO_HDRS}) - -set_target_properties(${TARGET_NAME} PROPERTIES EXPORT_NAME frontend::paddlepaddle) -install(TARGETS ${TARGET_NAME} EXPORT OpenVINOTargets - RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT ngraph - ARCHIVE DESTINATION ${IE_CPACK_ARCHIVE_PATH} COMPONENT ngraph - LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT ngraph) - -install(DIRECTORY ${${TARGET_NAME}_INCLUDE_DIR}/paddlepaddle_frontend - DESTINATION ${FRONTEND_INSTALL_INCLUDE} - COMPONENT ngraph_dev - FILES_MATCHING PATTERN "*.hpp") - -export(TARGETS ${TARGET_NAME} NAMESPACE openvino:: - APPEND FILE "${CMAKE_BINARY_DIR}/OpenVINOTargets.cmake") diff --git a/ngraph/frontend/paddlepaddle/src/op/argmax.cpp b/ngraph/frontend/paddlepaddle/src/op/argmax.cpp deleted file mode 100644 index e2ad9a8fe6d..00000000000 --- a/ngraph/frontend/paddlepaddle/src/op/argmax.cpp +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (C) 2018-2021 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#include -#include - -namespace ov { -namespace frontend { -namespace pdpd { -namespace op { -NamedOutputs argmax(const NodeContext& node) { - auto data = node.get_ng_input("X"); - bool flatten = node.get_attribute("flatten"); - const element::Type& index_element_type = element::i64; - const Output k = ngraph::opset6::Constant::create(ngraph::element::i64, {}, {1}); - - if (!flatten) { - auto axis = node.get_attribute("axis"); - const auto axis_to_remove = ngraph::opset6::Constant::create(element::u64, Shape{}, {axis}); - auto node_topk = std::make_shared(data, k, axis, "max", "index", index_element_type); - const auto reshaped_indices = std::make_shared(node_topk->output(1), axis_to_remove); - return node.default_single_output_mapping( - {std::make_shared(reshaped_indices, element::i64)}, - {"Out"}); - } else { - int64_t axis = 0; - const Output reshape_flatten = ngraph::opset6::Constant::create(ngraph::element::i64, {1}, {-1}); - auto node_reshape = std::make_shared(data, reshape_flatten, true); - auto node_topk = - std::make_shared(node_reshape, k, axis, "max", "index", index_element_type); - return node.default_single_output_mapping( - {std::make_shared(node_topk->output(1), element::i64)}, - {"Out"}); - } -} - -} // namespace op -} // namespace pdpd -} // namespace frontend -} // namespace ov diff --git a/ngraph/frontend/paddlepaddle/src/op/conv2d_utils.hpp b/ngraph/frontend/paddlepaddle/src/op/conv2d_utils.hpp deleted file mode 100644 index 0dc62aec2d7..00000000000 --- a/ngraph/frontend/paddlepaddle/src/op/conv2d_utils.hpp +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (C) 2021 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#pragma once -#include "node_context.hpp" - -namespace ov { -namespace frontend { -namespace pdpd { -namespace op { -ngraph::op::PadType get_auto_pad(const NodeContext& node); -std::pair get_pads(const NodeContext& node); -std::shared_ptr get_reshaped_filter(const Output& filters, int32_t groups); - -template -NamedOutputs conv2d_base(const NodeContext& node) { - auto data = node.get_ng_input("Input"); - auto filters = node.get_ng_input("Filter"); - - const auto strides = node.get_attribute>("strides"); - const auto dilations = node.get_attribute>("dilations"); - const auto auto_pad_type = get_auto_pad(node); - const auto paddings = get_pads(node); - const auto pads_begin = paddings.first; - const auto pads_end = paddings.second; - const auto groups = node.get_attribute("groups"); - const auto data_format = node.get_attribute("data_format"); - // TODO Support Other data layout #55423 - PDPD_ASSERT(data_format == "NCHW", "conv2d only supports NCHW now"); - - if (groups > 1) { - const auto reshaped_filters = get_reshaped_filter(filters, groups); - - return node.default_single_output_mapping( - {std::make_shared(data, - reshaped_filters, - ngraph::Strides(strides.begin(), strides.end()), - pads_begin, - pads_end, - ngraph::Strides(dilations.begin(), dilations.end()), - auto_pad_type)}, - {"Output"}); - } else { - return node.default_single_output_mapping( - {std::make_shared(data, - filters, - ngraph::Strides(strides.begin(), strides.end()), - pads_begin, - pads_end, - ngraph::Strides(dilations.begin(), dilations.end()), - auto_pad_type)}, - {"Output"}); - } -} - -} // namespace op -} // namespace pdpd -} // namespace frontend -} // namespace ov diff --git a/ngraph/frontend/paddlepaddle/src/op/prior_box.cpp b/ngraph/frontend/paddlepaddle/src/op/prior_box.cpp deleted file mode 100644 index a6ffb1a90bc..00000000000 --- a/ngraph/frontend/paddlepaddle/src/op/prior_box.cpp +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright (C) 2018-2021 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#include "ngraph/op/prior_box.hpp" - -#include - -#include "default_opset.hpp" - -namespace ov { -namespace frontend { -namespace pdpd { -namespace op { -using namespace default_opset; -using namespace element; -namespace detail { -namespace { -std::shared_ptr make_slice(const std::shared_ptr& node, int64_t start, int64_t end) { - return std::make_shared(node, - Constant::create(i64, Shape{1}, std::vector{start}), - Constant::create(i64, Shape{1}, std::vector{end}), - std::vector{0}, // begin mask - std::vector{0}); // end mask -} -} // namespace -} // namespace detail -NamedOutputs prior_box(const NodeContext& node) { - auto input = node.get_ng_input("Input"); - auto Image = node.get_ng_input("Image"); - const auto input_shape = std::make_shared(input); - const auto Image_shape = std::make_shared(Image); - const auto output_shape_slice = detail::make_slice(input_shape, 2, 4); - const auto image_shape_slice = detail::make_slice(Image_shape, 2, 4); - - ngraph::op::PriorBoxAttrs attrs; - attrs.min_size = node.get_attribute>("min_sizes", {}); - attrs.max_size = node.get_attribute>("max_sizes", {}); - attrs.aspect_ratio = node.get_attribute>("aspect_ratios", {1.0}); - attrs.flip = node.get_attribute("flip", false); - attrs.clip = node.get_attribute("clip", false); - attrs.step = node.get_attribute("step_w", 0); - - attrs.offset = node.get_attribute("offset", 0.5); - attrs.variance = node.get_attribute>("variances", {0.1, 0.1, 0.2, 0.2}); - - bool min_max_aspect_ratios_order = node.get_attribute("min_max_aspect_ratios_order", false); - - const auto ov_prior_box_node = std::make_shared(output_shape_slice, image_shape_slice, attrs); - - const auto split_axis_node = Constant::create(i64, ngraph::Shape{}, {0}); - const auto node_prior_box_split = std::make_shared(ov_prior_box_node, split_axis_node, 2); - - const auto node_boxes_origin = node_prior_box_split->output(0); - const auto node_variances_origin = node_prior_box_split->output(1); - - const auto out_shape = - std::make_shared(NodeVector{output_shape_slice, Constant::create(i64, {2}, {-1, 4})}, 0); - - auto node_boxes_reshape = std::make_shared(node_boxes_origin, out_shape, true); - const auto node_variances_reshape = std::make_shared(node_variances_origin, out_shape, true); - - int64_t total_aspect_ratios = ngraph::op::PriorBox::normalized_aspect_ratio(attrs.aspect_ratio, attrs.flip).size(); - if ((total_aspect_ratios > 1) && !attrs.min_size.empty() && !attrs.max_size.empty() && - !min_max_aspect_ratios_order) { - std::vector mask{1, 1, 1, 0, 1}; - int64_t min_size_len = static_cast(attrs.min_size.size()); - - const auto out_shape_div_numpri = std::make_shared( - NodeVector{output_shape_slice, Constant::create(i64, {3}, {min_size_len, -1, 4})}, - 0); - const auto node_boxes_div_numpri = std::make_shared(node_boxes_reshape, out_shape_div_numpri, true); - - const auto slice_begin_min = Constant::create(i64, Shape{5}, std::vector{0, 0, 0, 0, 0}); - const auto slice_end_min = std::make_shared( - NodeVector{output_shape_slice, Constant::create(i64, {3}, {min_size_len, 1, 4})}, - 0); - const auto slice_min_node = - std::make_shared(node_boxes_div_numpri, slice_begin_min, slice_end_min, mask, mask); - - const auto slice_begin_max = Constant::create(i64, Shape{5}, std::vector{0, 0, 0, 1, 0}); - const auto slice_end_max = std::make_shared( - NodeVector{output_shape_slice, Constant::create(i64, {3}, {min_size_len, 2, 4})}, - 0); - const auto slice_max_node = - std::make_shared(node_boxes_div_numpri, slice_begin_max, slice_end_max, mask, mask); - - const auto slice_begin_aspect_ratios = Constant::create(i64, Shape{5}, std::vector{0, 0, 0, 2, 0}); - const auto slice_end_aspect_ratios = std::make_shared( - NodeVector{output_shape_slice, - Constant::create(i64, {3}, {min_size_len, 2 + (total_aspect_ratios - 1), 4})}, - 0); - const auto slice_aspect_ratios_node = std::make_shared(node_boxes_div_numpri, - slice_begin_aspect_ratios, - slice_end_aspect_ratios, - mask, - mask); - - const auto node_boxes_div_numpri_reorder = - std::make_shared(NodeVector{slice_min_node, slice_aspect_ratios_node, slice_max_node}, 3); - node_boxes_reshape = std::make_shared(node_boxes_div_numpri_reorder, out_shape, true); - } - - NamedOutputs outputs; - outputs["Boxes"] = {node_boxes_reshape}; - outputs["Variances"] = {node_variances_reshape}; - return outputs; -} -} // namespace op -} // namespace pdpd -} // namespace frontend -} // namespace ov diff --git a/ngraph/frontend/tensorflow/CMakeLists.txt b/ngraph/frontend/tensorflow/CMakeLists.txt deleted file mode 100644 index e419e13a6ad..00000000000 --- a/ngraph/frontend/tensorflow/CMakeLists.txt +++ /dev/null @@ -1,104 +0,0 @@ -# Copyright (C) 2018-2021 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 -# - -set(TARGET_NAME "tensorflow_ov_frontend") - -file(GLOB_RECURSE LIBRARY_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) -file(GLOB_RECURSE LIBRARY_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/src/*.hpp) -file(GLOB_RECURSE LIBRARY_PUBLIC_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include/*.hpp) - -set(${TARGET_NAME}_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include) - -# Create named folders for the sources within the .vcproj -# Empty name lists them directly under the .vcproj - -source_group("src" FILES ${LIBRARY_SRC}) -source_group("include" FILES ${LIBRARY_HEADERS}) -source_group("public include" FILES ${LIBRARY_PUBLIC_HEADERS}) - -set(PROTO_SRCS) -set(PROTO_HDRS) - -# Generate protobuf file on build time for each '.proto' file in src/proto -file(GLOB proto_files ${CMAKE_CURRENT_SOURCE_DIR}/src/proto/*.proto) - -foreach(INFILE ${proto_files}) - get_filename_component(FILE_DIR ${INFILE} DIRECTORY) - get_filename_component(FILE_WE ${INFILE} NAME_WE) - set(OUTPUT_PB_SRC ${CMAKE_CURRENT_BINARY_DIR}/${FILE_WE}.pb.cc) - set(OUTPUT_PB_HEADER ${CMAKE_CURRENT_BINARY_DIR}/${FILE_WE}.pb.h) - set(GENERATED_PROTO ${INFILE}) - add_custom_command( - OUTPUT "${OUTPUT_PB_SRC}" "${OUTPUT_PB_HEADER}" - COMMAND ${PROTOC_EXECUTABLE} ARGS --cpp_out ${CMAKE_CURRENT_BINARY_DIR} -I ${FILE_DIR} ${FILE_WE}.proto - DEPENDS ${PROTOC_EXECUTABLE} ${GENERATED_PROTO} - COMMENT "Running C++ protocol buffer compiler (${PROTOC_EXECUTABLE}) on ${GENERATED_PROTO}" - VERBATIM - COMMAND_EXPAND_LISTS) - list(APPEND PROTO_SRCS "${OUTPUT_PB_SRC}") - list(APPEND PROTO_HDRS "${OUTPUT_PB_HEADER}") -endforeach() - -add_custom_target(${TARGET_NAME}_proto DEPENDS ${PROTO_SRCS} ${PROTO_HDRS}) - -set_source_files_properties(${PROTO_SRCS} ${PROTO_HDRS} PROPERTIES GENERATED TRUE) - -# Disable all warnings for generated code -set_source_files_properties(${PROTO_SRCS} ${PROTO_HDRS} PROPERTIES COMPILE_OPTIONS -w) - -# Create library -add_library(${TARGET_NAME} SHARED ${LIBRARY_SRC} ${LIBRARY_HEADERS} ${LIBRARY_PUBLIC_HEADERS} ${PROTO_SRCS} ${PROTO_HDRS}) -add_library(openvino::frontend::tensorflow ALIAS ${TARGET_NAME}) - -add_dependencies(${TARGET_NAME} ${TARGET_NAME}_proto) - -ov_ncc_naming_style(FOR_TARGET ${TARGET_NAME} - INCLUDE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include" - ADDITIONAL_INCLUDE_DIRECTORIES - $) - -target_include_directories(${TARGET_NAME} - PUBLIC - $ - $ - PRIVATE - ${CMAKE_CURRENT_SOURCE_DIR}/src - ${CMAKE_CURRENT_BINARY_DIR}) - -target_include_directories(${TARGET_NAME} SYSTEM PRIVATE ${Protobuf_INCLUDE_DIRS} - ${CMAKE_CURRENT_BINARY_DIR}) - -ie_add_vs_version_file(NAME ${TARGET_NAME} - FILEDESCRIPTION "FrontEnd to load and convert TensorFlow file format") - -ie_add_api_validator_post_build_step(TARGET ${TARGET_NAME}) - -link_system_libraries(${TARGET_NAME} PRIVATE ${Protobuf_LITE_LIBRARIES}) - -target_link_libraries(${TARGET_NAME} PRIVATE frontend_common::static - PRIVATE inference_engine_transformations libprotobuf openvino::util) - -add_clang_format_target(${TARGET_NAME}_clang FOR_TARGETS ${TARGET_NAME} - EXCLUDE_PATTERNS ${PROTO_SRCS} ${PROTO_HDRS}) - -set_target_properties(${TARGET_NAME} PROPERTIES EXPORT_NAME frontend::tensorflow) - -install(TARGETS ${TARGET_NAME} - RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT tests EXCLUDE_FROM_ALL - ARCHIVE DESTINATION ${IE_CPACK_ARCHIVE_PATH} COMPONENT tests EXCLUDE_FROM_ALL - LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT tests EXCLUDE_FROM_ALL) - -# TODO: add install commands once TensorFlow frontend is complete, and delete the install above -#install(TARGETS ${TARGET_NAME} EXPORT OpenVINOTargets -# RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT ngraph -# ARCHIVE DESTINATION ${IE_CPACK_ARCHIVE_PATH} COMPONENT ngraph -# LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT ngraph) - -#install(DIRECTORY ${${TARGET_NAME}_INCLUDE_DIR}/tensorflow_frontend -# DESTINATION ${FRONTEND_INSTALL_INCLUDE} -# COMPONENT ngraph_dev -# FILES_MATCHING PATTERN "*.hpp") -# -#export(TARGETS ${TARGET_NAME} NAMESPACE openvino:: -# APPEND FILE "${CMAKE_BINARY_DIR}/OpenVINOTargets.cmake") diff --git a/ngraph/frontend/tensorflow/include/tensorflow_frontend/utility.hpp b/ngraph/frontend/tensorflow/include/tensorflow_frontend/utility.hpp deleted file mode 100644 index 50c922f0673..00000000000 --- a/ngraph/frontend/tensorflow/include/tensorflow_frontend/utility.hpp +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (C) 2018-2021 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#pragma once - -#include "common/frontend_exceptions.hpp" - -#ifdef tensorflow_ov_frontend_EXPORTS -# define TF_API OPENVINO_CORE_EXPORTS -#else -# define TF_API OPENVINO_CORE_IMPORTS -#endif // tensorflow_ov_frontend_EXPORTS diff --git a/ngraph/test/backend/matrix_nms.in.cpp b/ngraph/test/backend/matrix_nms.in.cpp deleted file mode 100644 index 09c1d59f46a..00000000000 --- a/ngraph/test/backend/matrix_nms.in.cpp +++ /dev/null @@ -1,597 +0,0 @@ -// Copyright (C) 2018-2021 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -// clang-format off -#ifdef ${BACKEND_NAME}_FLOAT_TOLERANCE_BITS -#define DEFAULT_FLOAT_TOLERANCE_BITS ${BACKEND_NAME}_FLOAT_TOLERANCE_BITS -#endif - -#ifdef ${BACKEND_NAME}_DOUBLE_TOLERANCE_BITS -#define DEFAULT_DOUBLE_TOLERANCE_BITS ${BACKEND_NAME}_DOUBLE_TOLERANCE_BITS -#endif -// clang-format on - -#include "gtest/gtest.h" -#include "ngraph/ngraph.hpp" -#include "engines_util/test_engines.hpp" -#include "engines_util/test_case.hpp" -#include "util/test_control.hpp" - -using namespace std; -using namespace ngraph; - -static string s_manifest = "${MANIFEST}"; -using TestEngine = test::ENGINE_CLASS_NAME(${BACKEND_NAME}); - -NGRAPH_TEST(${BACKEND_NAME}, matrix_nms_output_type_i64) { - std::vector boxes_data = {0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, - 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0}; - - std::vector scores_data = {0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3}; - - op::v8::MatrixNms::Attributes attrs; - attrs.nms_top_k = 3; - attrs.score_threshold = 0.0f; - attrs.sort_result_type = op::v8::MatrixNms::SortResultType::SCORE; - attrs.keep_top_k = -1; - attrs.background_class = 0; - - const auto boxes_shape = Shape{1, 6, 4}; // N 1, C 2, M 6 - const auto scores_shape = Shape{1, 2, 6}; - - const auto boxes = make_shared(element::f32, boxes_shape); - const auto scores = make_shared(element::f32, scores_shape); - attrs.decay_function = op::v8::MatrixNms::DecayFunction::LINEAR; - attrs.gaussian_sigma = 2.0f; - attrs.post_threshold = 0.0f; - - auto nms = make_shared(boxes, scores, attrs); - - auto f = make_shared(nms, ParameterVector{boxes, scores}); - - std::vector expected_selected_indices = {0, 3, 1}; - std::vector expected_selected_scores = - {1.00, 0.95, 0.00, 0.00, 1.00, 1.00, 1.00, 0.8, 0.00, 10.00, 1.00, 11.00, 1.00, 0.13636364, 0.0, 0.1, 1.0, 1.1}; - std::vector expected_valid_outputs = {3}; - - auto test_case = test::TestCase(f); - test_case.add_multiple_inputs({boxes_data, scores_data}); - test_case.add_expected_output({3, 6}, expected_selected_scores); - test_case.add_expected_output({3, 1}, expected_selected_indices); - test_case.add_expected_output({1}, expected_valid_outputs); - test_case.run(); -} - -NGRAPH_TEST(${BACKEND_NAME}, matrix_nms_output_type_i32) { - std::vector boxes_data = {0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, - 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0}; - - std::vector scores_data = {0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3}; - - op::v8::MatrixNms::Attributes attrs; - attrs.nms_top_k = 3; - attrs.score_threshold = 0.0f; - attrs.sort_result_type = op::v8::MatrixNms::SortResultType::SCORE; - attrs.keep_top_k = -1; - attrs.background_class = 0; - - const auto boxes_shape = Shape{1, 6, 4}; // N 1, C 2, M 6 - const auto scores_shape = Shape{1, 2, 6}; - attrs.decay_function = op::v8::MatrixNms::DecayFunction::LINEAR; - attrs.gaussian_sigma = 2.0f; - attrs.post_threshold = 0.0f; - attrs.output_type = ngraph::element::i32; - - const auto boxes = make_shared(element::f32, boxes_shape); - const auto scores = make_shared(element::f32, scores_shape); - - auto nms = make_shared(boxes, scores, attrs); - - auto f = make_shared(nms, ParameterVector{boxes, scores}); - - std::vector expected_selected_indices = {0, 3, 1}; - std::vector expected_selected_scores = - {1.00, 0.95, 0.00, 0.00, 1.00, 1.00, 1.00, 0.8, 0.00, 10.00, 1.00, 11.00, 1.00, 0.13636364, 0.0, 0.1, 1.0, 1.1}; - std::vector expected_valid_outputs = {3}; - - auto test_case = test::TestCase(f); - test_case.add_multiple_inputs({boxes_data, scores_data}); - test_case.add_expected_output({3, 6}, expected_selected_scores); - test_case.add_expected_output({3, 1}, expected_selected_indices); - test_case.add_expected_output({1}, expected_valid_outputs); - test_case.run(); -} - -NGRAPH_TEST(${BACKEND_NAME}, matrix_nms_gaussian) { - std::vector boxes_data = {0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, - 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0}; - - std::vector scores_data = {0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3}; - - op::v8::MatrixNms::Attributes attrs; - attrs.nms_top_k = 3; - attrs.score_threshold = 0.0f; - attrs.sort_result_type = op::v8::MatrixNms::SortResultType::SCORE; - attrs.keep_top_k = -1; - attrs.background_class = 0; - - const auto boxes_shape = Shape{1, 6, 4}; // N 1, C 2, M 6 - const auto scores_shape = Shape{1, 2, 6}; - - const auto boxes = make_shared(element::f32, boxes_shape); - const auto scores = make_shared(element::f32, scores_shape); - attrs.decay_function = op::v8::MatrixNms::DecayFunction::GAUSSIAN; - attrs.gaussian_sigma = 2.0f; - attrs.post_threshold = 0.0f; - - auto nms = make_shared(boxes, scores, attrs); - - auto f = make_shared(nms, ParameterVector{boxes, scores}); - - std::vector expected_selected_indices = {0, 3, 1}; - std::vector expected_selected_scores = - {1.00, 0.95, 0.00, 0.00, 1.00, 1.00, 1.00, 0.8, 0.00, 10.00, 1.00, 11.00, 1.00, 0.1966116, 0.0, 0.1, 1.0, 1.1}; - std::vector expected_valid_outputs = {3}; - - auto test_case = test::TestCase(f); - test_case.add_multiple_inputs({boxes_data, scores_data}); - test_case.add_expected_output({3, 6}, expected_selected_scores); - test_case.add_expected_output({3, 1}, expected_selected_indices); - test_case.add_expected_output({1}, expected_valid_outputs); - test_case.run(); -} - -NGRAPH_TEST(${BACKEND_NAME}, matrix_nms_two_batches_two_classes) { - std::vector boxes_data = {0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, - 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0, // 0 - 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, - 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0}; // 1 - - std::vector scores_data = {0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3, // 0 - 0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3}; // 1 - - op::v8::MatrixNms::Attributes attrs; - attrs.nms_top_k = 3; - attrs.score_threshold = 0.0f; - attrs.sort_result_type = op::v8::MatrixNms::SortResultType::SCORE; - attrs.keep_top_k = -1; - attrs.background_class = 0; - - const auto boxes_shape = Shape{2, 6, 4}; // N 2, C 2, M 6 - const auto scores_shape = Shape{2, 2, 6}; - attrs.decay_function = op::v8::MatrixNms::DecayFunction::LINEAR; - attrs.gaussian_sigma = 2.0f; - attrs.post_threshold = 0.0f; - - const auto boxes = make_shared(element::f32, boxes_shape); - const auto scores = make_shared(element::f32, scores_shape); - - auto nms = make_shared(boxes, scores, attrs); - - auto f = make_shared(nms, ParameterVector{boxes, scores}); - - std::vector expected_selected_indices = {0, 3, 1, 6, 9, 7}; - std::vector expected_selected_scores = { - 1.00, 0.95, 0.00, 0.00, 1.00, 1.00, 1.00, 0.8, 0.00, 10.00, 1.00, 11.00, 1.00, 0.13636364, 0.0, 0.1, 1.0, 1.1, - 1.00, 0.95, 0.00, 0.00, 1.00, 1.00, 1.00, 0.8, 0.00, 10.00, 1.00, 11.00, 1.00, 0.13636364, 0.0, 0.1, 1.0, 1.1}; - std::vector expected_valid_outputs = {3, 3}; - - auto test_case = test::TestCase(f); - test_case.add_multiple_inputs({boxes_data, scores_data}); - test_case.add_expected_output({6, 6}, expected_selected_scores); - test_case.add_expected_output({6, 1}, expected_selected_indices); - test_case.add_expected_output({2}, expected_valid_outputs); - test_case.run(); -} - -NGRAPH_TEST(${BACKEND_NAME}, matrix_nms_two_batches_two_classes_by_score_cross_batch) { - std::vector boxes_data = {0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, - 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0, // 0 - 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, - 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0}; // 1 - - std::vector scores_data = {0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3, // 0 - 0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3}; // 1 - - op::v8::MatrixNms::Attributes attrs; - attrs.nms_top_k = 3; - attrs.score_threshold = 0.0f; - attrs.sort_result_type = op::v8::MatrixNms::SortResultType::SCORE; - attrs.keep_top_k = -1; - attrs.background_class = -1; - - const auto boxes_shape = Shape{2, 6, 4}; // N 2, C 2, M 6 - const auto scores_shape = Shape{2, 2, 6}; - attrs.decay_function = op::v8::MatrixNms::DecayFunction::LINEAR; - attrs.gaussian_sigma = 2.0f; - attrs.post_threshold = 0.5; - attrs.sort_result_across_batch = true; - - const auto boxes = make_shared(element::f32, boxes_shape); - const auto scores = make_shared(element::f32, scores_shape); - - auto nms = make_shared(boxes, scores, attrs); - - auto f = make_shared(nms, ParameterVector{boxes, scores}); - - std::vector expected_selected_indices = {3, 0, 9, 6, 0, 6, 3, 9}; - std::vector expected_selected_scores = {0.00, 0.95, 0.00, 10.00, 1.00, 11.00, // 3 - 1.00, 0.95, 0.00, 0.00, 1.00, 1.00, // 0 - 0.00, 0.95, 0.00, 10.00, 1.00, 11.00, // 9 - 1.00, 0.95, 0.00, 0.00, 1.00, 1.00, // 6 - 0.00, 0.90, 0.00, 0.00, 1.00, 1.00, // 0 - 0.00, 0.90, 0.00, 0.00, 1.00, 1.00, // 6 - 1.00, 0.80, 0.00, 10.00, 1.00, 11.00, // 3 - 1.00, 0.80, 0.00, 10.00, 1.00, 11.00}; // 9 - std::vector expected_valid_outputs = {4, 4}; - - auto test_case = test::TestCase(f); - test_case.add_multiple_inputs({boxes_data, scores_data}); - test_case.add_expected_output({8, 6}, expected_selected_scores); - test_case.add_expected_output({8, 1}, expected_selected_indices); - test_case.add_expected_output({2}, expected_valid_outputs); - test_case.run(); -} - -NGRAPH_TEST(${BACKEND_NAME}, matrix_nms_two_batches_two_classes_by_classid_cross_batch) { - std::vector boxes_data = {0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, - 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0, // 0 - 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, - 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0}; // 1 - - std::vector scores_data = {0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3, // 0 - 0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3}; // 1 - - op::v8::MatrixNms::Attributes attrs; - attrs.nms_top_k = 3; - attrs.score_threshold = 0.0f; - attrs.sort_result_type = op::v8::MatrixNms::SortResultType::CLASSID; - attrs.keep_top_k = -1; - attrs.background_class = -1; - - const auto boxes_shape = Shape{2, 6, 4}; // N 2, C 2, M 6 - const auto scores_shape = Shape{2, 2, 6}; - attrs.decay_function = op::v8::MatrixNms::DecayFunction::LINEAR; - attrs.gaussian_sigma = 2.0f; - attrs.post_threshold = 0.5; - attrs.sort_result_across_batch = true; - - const auto boxes = make_shared(element::f32, boxes_shape); - const auto scores = make_shared(element::f32, scores_shape); - - auto nms = make_shared(boxes, scores, attrs); - - auto f = make_shared(nms, ParameterVector{boxes, scores}); - - std::vector expected_selected_indices = {3, 0, 9, 6, 0, 3, 6, 9}; - std::vector expected_selected_scores = {0.00, 0.95, 0.00, 10.00, 1.00, 11.00, // 3 - 0.00, 0.90, 0.00, 0.00, 1.00, 1.00, // 0 - 0.00, 0.95, 0.00, 10.00, 1.00, 11.00, // 9 - 0.00, 0.90, 0.00, 0.00, 1.00, 1.00, // 6 - 1.00, 0.95, 0.00, 0.00, 1.00, 1.00, // 0 - 1.00, 0.80, 0.00, 10.00, 1.00, 11.00, // 3 - 1.00, 0.95, 0.00, 0.00, 1.00, 1.00, // 6 - 1.00, 0.80, 0.00, 10.00, 1.00, 11.00}; // 9 - std::vector expected_valid_outputs = {4, 4}; - - auto test_case = test::TestCase(f); - test_case.add_multiple_inputs({boxes_data, scores_data}); - test_case.add_expected_output({8, 6}, expected_selected_scores); - test_case.add_expected_output({8, 1}, expected_selected_indices); - test_case.add_expected_output({2}, expected_valid_outputs); - test_case.run(); -} - -NGRAPH_TEST(${BACKEND_NAME}, matrix_nms_by_keep_top_k) { - std::vector boxes_data = {0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, - 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0, // 0 - 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, - 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0}; // 1 - - std::vector scores_data = {0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3, // 0 - 0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3}; // 1 - - op::v8::MatrixNms::Attributes attrs; - attrs.nms_top_k = 3; - attrs.score_threshold = 0.0f; - attrs.sort_result_type = op::v8::MatrixNms::SortResultType::CLASSID; - attrs.keep_top_k = 3; - attrs.background_class = 0; - - const auto boxes_shape = Shape{2, 6, 4}; // N 2, C 2, M 6 - const auto scores_shape = Shape{2, 2, 6}; - attrs.decay_function = op::v8::MatrixNms::DecayFunction::LINEAR; - attrs.gaussian_sigma = 2.0f; - attrs.post_threshold = 0.0f; - - const auto boxes = make_shared(element::f32, boxes_shape); - const auto scores = make_shared(element::f32, scores_shape); - auto nms = make_shared(boxes, scores, attrs); - - auto f = make_shared(nms, ParameterVector{boxes, scores}); - - std::vector expected_selected_indices = {0, 3, 1, 6, 9, 7}; - std::vector expected_selected_scores = { - 1.00, 0.95, 0.00, 0.00, 1.00, 1.00, 1.00, 0.8, 0.00, 10.00, 1.00, 11.00, 1.00, 0.13636364, 0.0, 0.1, 1.0, 1.1, - 1.00, 0.95, 0.00, 0.00, 1.00, 1.00, 1.00, 0.8, 0.00, 10.00, 1.00, 11.00, 1.00, 0.13636364, 0.0, 0.1, 1.0, 1.1}; - std::vector expected_valid_outputs = {3, 3}; - - auto test_case = test::TestCase(f); - test_case.add_multiple_inputs({boxes_data, scores_data}); - test_case.add_expected_output({6, 6}, expected_selected_scores); - test_case.add_expected_output({6, 1}, expected_selected_indices); - test_case.add_expected_output({2}, expected_valid_outputs); - test_case.run(); -} - -NGRAPH_TEST(${BACKEND_NAME}, matrix_nms_background) { - std::vector boxes_data = {0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, - 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0}; - - std::vector scores_data = {0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3}; - - op::v8::MatrixNms::Attributes attrs; - attrs.nms_top_k = 3; - attrs.score_threshold = 0.0f; - attrs.sort_result_type = op::v8::MatrixNms::SortResultType::SCORE; - attrs.keep_top_k = -1; - attrs.background_class = -1; - - const auto boxes_shape = Shape{1, 6, 4}; // N 1, C 2, M 6 - const auto scores_shape = Shape{1, 2, 6}; - - const auto boxes = make_shared(element::f32, boxes_shape); - const auto scores = make_shared(element::f32, scores_shape); - attrs.decay_function = op::v8::MatrixNms::DecayFunction::LINEAR; - attrs.gaussian_sigma = 2.0f; - attrs.post_threshold = 0.0f; - - auto nms = make_shared(boxes, scores, attrs); - - auto f = make_shared(nms, ParameterVector{boxes, scores}); - - std::vector expected_selected_indices = {3, 0, 0, 3, 1, 1}; - std::vector expected_selected_scores = { - 0.00, 0.95, 0.0, 10.0, 1.0, 11.0, 1.00, 0.95, 0.0, 0.0, 1.0, 1.0, 0.00, 0.9, 0.0, 0.0, 1.0, 1.0, - 1.00, 0.8, 0.0, 10.0, 1.0, 11.0, 0.00, 0.13636364, 0.0, 0.1, 1.0, 1.1, 1.00, 0.13636364, 0.0, 0.1, 1.0, 1.1}; - std::vector expected_valid_outputs = {6}; - - auto test_case = test::TestCase(f); - test_case.add_multiple_inputs({boxes_data, scores_data}); - test_case.add_expected_output({6, 6}, expected_selected_scores); - test_case.add_expected_output({6, 1}, expected_selected_indices); - test_case.add_expected_output({1}, expected_valid_outputs); - test_case.run(); -} - -NGRAPH_TEST(${BACKEND_NAME}, matrix_nms_flipped_coordinates) { - std::vector boxes_data = {1.0, 1.0, 0.0, 0.0, 0.0, 0.1, 1.0, 1.1, 0.0, 0.9, 1.0, -0.1, - 0.0, 10.0, 1.0, 11.0, 1.0, 10.1, 0.0, 11.1, 1.0, 101.0, 0.0, 100.0}; - - std::vector scores_data = {0.9, 0.75, 0.6, 0.95, 0.5, 0.3}; - - op::v8::MatrixNms::Attributes attrs; - attrs.nms_top_k = 3; - attrs.score_threshold = 0.0f; - attrs.sort_result_type = op::v8::MatrixNms::SortResultType::SCORE; - attrs.keep_top_k = -1; - attrs.background_class = -1; - - const auto boxes_shape = Shape{1, 6, 4}; // N 1, C 1, M 6 - const auto scores_shape = Shape{1, 1, 6}; - - const auto boxes = make_shared(element::f32, boxes_shape); - const auto scores = make_shared(element::f32, scores_shape); - attrs.decay_function = op::v8::MatrixNms::DecayFunction::LINEAR; - attrs.gaussian_sigma = 2.0f; - attrs.post_threshold = 0.0f; - - auto nms = make_shared(boxes, scores, attrs); - - auto f = make_shared(nms, ParameterVector{boxes, scores}); - - std::vector expected_selected_indices = {3, 0, 1}; - std::vector expected_selected_scores = - {0.00, 0.95, 0.0, 10.0, 1.0, 11.0, 0.00, 0.9, 1.0, 1.0, 0.0, 0.0, 0.00, 0.75, 0.0, 0.1, 1.0, 1.1}; - std::vector expected_valid_outputs = {3}; - - auto test_case = test::TestCase(f); - test_case.add_multiple_inputs({boxes_data, scores_data}); - test_case.add_expected_output({3, 6}, expected_selected_scores); - test_case.add_expected_output({3, 1}, expected_selected_indices); - test_case.add_expected_output({1}, expected_valid_outputs); - test_case.run(); -} - -NGRAPH_TEST(${BACKEND_NAME}, matrix_nms_post_threshold) { - std::vector boxes_data = {0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, - 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0}; - - std::vector scores_data = {0.9, 0.75, 0.6, 0.95, 0.5, 0.3}; - - op::v8::MatrixNms::Attributes attrs; - attrs.nms_top_k = 3; - attrs.score_threshold = 0.00; - attrs.sort_result_type = op::v8::MatrixNms::SortResultType::SCORE; - attrs.keep_top_k = -1; - attrs.background_class = -1; - - const auto boxes_shape = Shape{1, 6, 4}; // N 1, C 2, M 6 - const auto scores_shape = Shape{1, 1, 6}; - - const auto boxes = make_shared(element::f32, boxes_shape); - const auto scores = make_shared(element::f32, scores_shape); - attrs.decay_function = op::v8::MatrixNms::DecayFunction::LINEAR; - attrs.gaussian_sigma = 2.0f; - attrs.post_threshold = 0.8; - - auto nms = make_shared(boxes, scores, attrs); - - auto f = make_shared(nms, ParameterVector{boxes, scores}); - - std::vector expected_selected_indices = {3, 0}; - std::vector expected_selected_scores = - {0.00, 0.95, 0.00, 10.00, 1.00, 11.00, 0.00, 0.9, 0.00, 0.00, 1.00, 1.00}; - std::vector expected_valid_outputs = {2}; - - auto test_case = test::TestCase(f); - test_case.add_multiple_inputs({boxes_data, scores_data}); - test_case.add_expected_output({2, 6}, expected_selected_scores); - test_case.add_expected_output({2, 1}, expected_selected_indices); - test_case.add_expected_output({1}, expected_valid_outputs); - test_case.run(); -} - -NGRAPH_TEST(${BACKEND_NAME}, matrix_nms_identical_boxes) { - std::vector boxes_data = {0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, - 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, - 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0}; - - std::vector scores_data = {0.4, 0.01, 0.2, 0.09, 0.15, 0.05, 0.02, 0.03, 0.05, 0.0}; - - op::v8::MatrixNms::Attributes attrs; - attrs.nms_top_k = 3; - attrs.score_threshold = 0.0f; - attrs.sort_result_type = op::v8::MatrixNms::SortResultType::SCORE; - attrs.keep_top_k = -1; - attrs.background_class = -1; - - const auto boxes_shape = Shape{1, 10, 4}; // N 1, C 1, M 10 - const auto scores_shape = Shape{1, 1, 10}; - - const auto boxes = make_shared(element::f32, boxes_shape); - const auto scores = make_shared(element::f32, scores_shape); - attrs.decay_function = op::v8::MatrixNms::DecayFunction::LINEAR; - attrs.gaussian_sigma = 2.0f; - attrs.post_threshold = 0.3; - - auto nms = make_shared(boxes, scores, attrs); - - auto f = make_shared(nms, ParameterVector{boxes, scores}); - - std::vector expected_selected_indices = {0}; - std::vector expected_selected_scores = {0.00, 0.40, 0.00, 0.00, 1.00, 1.00}; - std::vector expected_valid_outputs = {1}; - - auto test_case = test::TestCase(f); - test_case.add_multiple_inputs({boxes_data, scores_data}); - test_case.add_expected_output({1, 6}, expected_selected_scores); - test_case.add_expected_output({1, 1}, expected_selected_indices); - test_case.add_expected_output({1}, expected_valid_outputs); - test_case.run(); -} - -NGRAPH_TEST(${BACKEND_NAME}, matrix_nms_nms_top_k) { - std::vector boxes_data = {0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, - 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0}; - - std::vector scores_data = {0.9, 0.75, 0.6, 0.95, 0.5, 0.3}; - - op::v8::MatrixNms::Attributes attrs; - attrs.nms_top_k = 2; - attrs.score_threshold = 0.0f; - attrs.sort_result_type = op::v8::MatrixNms::SortResultType::SCORE; - attrs.keep_top_k = -1; - attrs.background_class = -1; - - const auto boxes_shape = Shape{1, 6, 4}; - const auto scores_shape = Shape{1, 1, 6}; - - const auto boxes = make_shared(element::f32, boxes_shape); - const auto scores = make_shared(element::f32, scores_shape); - attrs.decay_function = op::v8::MatrixNms::DecayFunction::LINEAR; - attrs.gaussian_sigma = 2.0f; - attrs.post_threshold = 0.0f; - - auto nms = make_shared(boxes, scores, attrs); - - auto f = make_shared(nms, ParameterVector{boxes, scores}); - - std::vector expected_selected_indices = {3, 0}; - std::vector expected_selected_scores = - {0.00, 0.95, 0.00, 10.00, 1.00, 11.00, 0.00, 0.90, 0.00, 0.00, 1.00, 1.00}; - std::vector expected_valid_outputs = {2}; - - auto test_case = test::TestCase(f); - test_case.add_multiple_inputs({boxes_data, scores_data}); - test_case.add_expected_output({2, 6}, expected_selected_scores); - test_case.add_expected_output({2, 1}, expected_selected_indices); - test_case.add_expected_output({1}, expected_valid_outputs); - test_case.run(); -} - -NGRAPH_TEST(${BACKEND_NAME}, matrix_nms_single_box) { - std::vector boxes_data = {0.0, 0.0, 1.0, 1.0}; - - std::vector scores_data = {0.9}; - - op::v8::MatrixNms::Attributes attrs; - attrs.nms_top_k = 3; - attrs.score_threshold = 0.0f; - attrs.sort_result_type = op::v8::MatrixNms::SortResultType::SCORE; - attrs.keep_top_k = -1; - attrs.background_class = -1; - - const auto boxes_shape = Shape{1, 1, 4}; - const auto scores_shape = Shape{1, 1, 1}; - - const auto boxes = make_shared(element::f32, boxes_shape); - const auto scores = make_shared(element::f32, scores_shape); - attrs.decay_function = op::v8::MatrixNms::DecayFunction::LINEAR; - attrs.gaussian_sigma = 2.0f; - attrs.post_threshold = 0.0f; - - auto nms = make_shared(boxes, scores, attrs); - - auto f = make_shared(nms, ParameterVector{boxes, scores}); - - std::vector expected_selected_indices = {0}; - std::vector expected_selected_scores = {0.00, 0.90, 0.00, 0.00, 1.00, 1.00}; - std::vector expected_valid_outputs = {1}; - - auto test_case = test::TestCase(f); - test_case.add_multiple_inputs({boxes_data, scores_data}); - test_case.add_expected_output({1, 6}, expected_selected_scores); - test_case.add_expected_output({1, 1}, expected_selected_indices); - test_case.add_expected_output({1}, expected_valid_outputs); - test_case.run(); -} - -NGRAPH_TEST(${BACKEND_NAME}, matrix_nms_no_output) { - std::vector boxes_data = {0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, - 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0}; - - std::vector scores_data = {0.9, 0.75, 0.6, 0.95, 0.5, 0.3}; - - op::v8::MatrixNms::Attributes attrs; - attrs.nms_top_k = 3; - attrs.score_threshold = 2.0f; - attrs.sort_result_type = op::v8::MatrixNms::SortResultType::SCORE; - attrs.keep_top_k = -1; - attrs.background_class = -1; - - const auto boxes_shape = Shape{1, 6, 4}; - const auto scores_shape = Shape{1, 1, 6}; - - const auto boxes = make_shared(element::f32, boxes_shape); - const auto scores = make_shared(element::f32, scores_shape); - attrs.decay_function = op::v8::MatrixNms::DecayFunction::LINEAR; - attrs.gaussian_sigma = 2.0f; - attrs.post_threshold = 0.0f; - - auto nms = make_shared(boxes, scores, attrs); - - auto f = make_shared(nms, ParameterVector{boxes, scores}); - - std::vector expected_selected_indices = {}; - std::vector expected_selected_scores = {}; - std::vector expected_valid_outputs = {0}; - - auto test_case = test::TestCase(f); - test_case.add_multiple_inputs({boxes_data, scores_data}); - test_case.add_expected_output({0, 6}, expected_selected_scores); - test_case.add_expected_output({0, 1}, expected_selected_indices); - test_case.add_expected_output({1}, expected_valid_outputs); - test_case.run(); -} diff --git a/ngraph/test/backend/multiclass_nms.in.cpp b/ngraph/test/backend/multiclass_nms.in.cpp deleted file mode 100644 index 6143f9d1c54..00000000000 --- a/ngraph/test/backend/multiclass_nms.in.cpp +++ /dev/null @@ -1,735 +0,0 @@ -// Copyright (C) 2018-2021 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -// clang-format off -#ifdef ${BACKEND_NAME}_FLOAT_TOLERANCE_BITS -#define DEFAULT_FLOAT_TOLERANCE_BITS ${BACKEND_NAME}_FLOAT_TOLERANCE_BITS -#endif - -#ifdef ${BACKEND_NAME}_DOUBLE_TOLERANCE_BITS -#define DEFAULT_DOUBLE_TOLERANCE_BITS ${BACKEND_NAME}_DOUBLE_TOLERANCE_BITS -#endif -// clang-format on - -#include "gtest/gtest.h" -#include "ngraph/ngraph.hpp" -#include "engines_util/test_engines.hpp" -#include "engines_util/test_case.hpp" -#include "util/test_control.hpp" - -using namespace std; -using namespace ngraph; - -static string s_manifest = "${MANIFEST}"; -using TestEngine = test::ENGINE_CLASS_NAME(${BACKEND_NAME}); - -NGRAPH_TEST(${BACKEND_NAME}, multiclass_nms_by_score) { - std::vector boxes_data = {0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, - 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0}; - - std::vector scores_data = {0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3}; - - op::v8::MulticlassNms::Attributes attrs; - attrs.nms_top_k = 3; - attrs.iou_threshold = 0.5f; - attrs.score_threshold = 0.0f; - attrs.sort_result_type = op::v8::MulticlassNms::SortResultType::SCORE; - attrs.keep_top_k = -1; - attrs.background_class = -1; - attrs.nms_eta = 1.0f; - - const auto boxes_shape = Shape{1, 6, 4}; // N 1, C 2, M 6 - const auto scores_shape = Shape{1, 2, 6}; - - const auto boxes = make_shared(element::f32, boxes_shape); - const auto scores = make_shared(element::f32, scores_shape); - - auto nms = make_shared(boxes, scores, attrs); - - auto f = make_shared(nms, ParameterVector{boxes, scores}); - - std::vector expected_selected_indices = {3, 0, 0, 3}; - std::vector expected_selected_scores = {0.00, 0.95, 0.00, 10.00, 1.00, 11.00, 1.00, 0.95, - 0.00, 0.00, 1.00, 1.00, 0.00, 0.90, 0.00, 0.00, - 1.00, 1.00, 1.00, 0.80, 0.00, 10.00, 1.00, 11.00}; - std::vector expected_valid_outputs = {4}; - - auto test_case = test::TestCase(f); - test_case.add_multiple_inputs({boxes_data, scores_data}); - test_case.add_expected_output({4, 6}, expected_selected_scores); - test_case.add_expected_output({4, 1}, expected_selected_indices); - test_case.add_expected_output({1}, expected_valid_outputs); - test_case.run(); -} - -NGRAPH_TEST(${BACKEND_NAME}, multiclass_nms_by_class_id) { - std::vector boxes_data = {0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, - 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0}; - - std::vector scores_data = {0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3}; - - op::v8::MulticlassNms::Attributes attrs; - attrs.nms_top_k = 3; - attrs.iou_threshold = 0.5f; - attrs.score_threshold = 0.0f; - attrs.sort_result_type = op::v8::MulticlassNms::SortResultType::CLASSID; - attrs.keep_top_k = -1; - attrs.background_class = -1; - attrs.nms_eta = 1.0f; - - const auto boxes_shape = Shape{1, 6, 4}; // N 1, C 2, M 6 - const auto scores_shape = Shape{1, 2, 6}; - - const auto boxes = make_shared(element::f32, boxes_shape); - const auto scores = make_shared(element::f32, scores_shape); - - auto nms = make_shared(boxes, scores, attrs); - - auto f = make_shared(nms, ParameterVector{boxes, scores}); - - std::vector expected_selected_indices = {3, 0, 0, 3}; - std::vector expected_selected_scores = {0.00, 0.95, 0.00, 10.00, 1.00, 11.00, 0.00, 0.90, - 0.00, 0.00, 1.00, 1.00, 1.00, 0.95, 0.00, 0.00, - 1.00, 1.00, 1.00, 0.80, 0.00, 10.00, 1.00, 11.00}; - std::vector expected_valid_outputs = {4}; - - auto test_case = test::TestCase(f); - test_case.add_multiple_inputs({boxes_data, scores_data}); - test_case.add_expected_output({4, 6}, expected_selected_scores); - test_case.add_expected_output({4, 1}, expected_selected_indices); - test_case.add_expected_output({1}, expected_valid_outputs); - test_case.run(); -} - -NGRAPH_TEST(${BACKEND_NAME}, multiclass_nms_output_type_i32) { - std::vector boxes_data = {0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, - 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0}; - - std::vector scores_data = {0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3}; - - op::v8::MulticlassNms::Attributes attrs; - attrs.nms_top_k = 3; - attrs.iou_threshold = 0.5f; - attrs.score_threshold = 0.0f; - attrs.sort_result_type = op::v8::MulticlassNms::SortResultType::CLASSID; - attrs.keep_top_k = -1; - attrs.background_class = -1; - attrs.nms_eta = 1.0f; - attrs.output_type = element::i32; - - const auto boxes_shape = Shape{1, 6, 4}; // N 1, C 2, M 6 - const auto scores_shape = Shape{1, 2, 6}; - - const auto boxes = make_shared(element::f32, boxes_shape); - const auto scores = make_shared(element::f32, scores_shape); - - auto nms = make_shared(boxes, scores, attrs); - - auto f = make_shared(nms, ParameterVector{boxes, scores}); - - std::vector expected_selected_indices = {3, 0, 0, 3}; - std::vector expected_selected_scores = {0.00, 0.95, 0.00, 10.00, 1.00, 11.00, 0.00, 0.90, - 0.00, 0.00, 1.00, 1.00, 1.00, 0.95, 0.00, 0.00, - 1.00, 1.00, 1.00, 0.80, 0.00, 10.00, 1.00, 11.00}; - std::vector expected_valid_outputs = {4}; - - auto test_case = test::TestCase(f); - test_case.add_multiple_inputs({boxes_data, scores_data}); - test_case.add_expected_output({4, 6}, expected_selected_scores); - test_case.add_expected_output({4, 1}, expected_selected_indices); - test_case.add_expected_output({1}, expected_valid_outputs); - test_case.run(); -} - -NGRAPH_TEST(${BACKEND_NAME}, multiclass_nms_two_batches_two_classes_by_score) { - std::vector boxes_data = { - 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, - 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0, // 0 - 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, - 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0 // 1 - }; - - std::vector scores_data = { - 0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3, // 0 - 0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3 // 1 - }; - - op::v8::MulticlassNms::Attributes attrs; - attrs.nms_top_k = 3; - attrs.iou_threshold = 0.5f; - attrs.score_threshold = 0.0f; - attrs.sort_result_type = op::v8::MulticlassNms::SortResultType::SCORE; - attrs.keep_top_k = -1; - attrs.background_class = -1; - attrs.nms_eta = 1.0f; - - const auto boxes_shape = Shape{2, 6, 4}; // N 2, C 2, M 6 - const auto scores_shape = Shape{2, 2, 6}; - - const auto boxes = make_shared(element::f32, boxes_shape); - const auto scores = make_shared(element::f32, scores_shape); - - auto nms = make_shared(boxes, scores, attrs); - - auto f = make_shared(nms, ParameterVector{boxes, scores}); - - std::vector expected_selected_indices = {3, 0, 0, 3, 9, 6, 6, 9}; - std::vector expected_selected_scores = { - 0.00, 0.95, 0.00, 10.00, 1.00, 11.00, 1.00, 0.95, 0.00, 0.00, 1.00, 1.00, - 0.00, 0.90, 0.00, 0.00, 1.00, 1.00, 1.00, 0.80, 0.00, 10.00, 1.00, 11.00, // 0 - 0.00, 0.95, 0.00, 10.00, 1.00, 11.00, 1.00, 0.95, 0.00, 0.00, 1.00, 1.00, - 0.00, 0.90, 0.00, 0.00, 1.00, 1.00, 1.00, 0.80, 0.00, 10.00, 1.00, 11.00}; // 1 - std::vector expected_valid_outputs = {4, 4}; - - auto test_case = test::TestCase(f); - test_case.add_multiple_inputs({boxes_data, scores_data}); - test_case.add_expected_output({8, 6}, expected_selected_scores); - test_case.add_expected_output({8, 1}, expected_selected_indices); - test_case.add_expected_output({2}, expected_valid_outputs); - test_case.run(); -} - -NGRAPH_TEST(${BACKEND_NAME}, multiclass_nms_two_batches_two_classes_by_class_id) { - std::vector boxes_data = { - 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, - 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0, // 0 - 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, - 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0 // 1 - }; - - std::vector scores_data = { - 0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3, // 0 - 0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3 // 1 - }; - - op::v8::MulticlassNms::Attributes attrs; - attrs.nms_top_k = 3; - attrs.iou_threshold = 0.5f; - attrs.score_threshold = 0.0f; - attrs.sort_result_type = op::v8::MulticlassNms::SortResultType::CLASSID; - attrs.keep_top_k = -1; - attrs.background_class = -1; - attrs.nms_eta = 1.0f; - - const auto boxes_shape = Shape{2, 6, 4}; // N 2, C 2, M 6 - const auto scores_shape = Shape{2, 2, 6}; - - const auto boxes = make_shared(element::f32, boxes_shape); - const auto scores = make_shared(element::f32, scores_shape); - auto nms = make_shared(boxes, scores, attrs); - - auto f = make_shared(nms, ParameterVector{boxes, scores}); - - std::vector expected_selected_indices = {3, 0, 0, 3, 9, 6, 6, 9}; - std::vector expected_selected_scores = { - 0.00, 0.95, 0.00, 10.00, 1.00, 11.00, 0.00, 0.90, 0.00, 0.00, 1.00, 1.00, - 1.00, 0.95, 0.00, 0.00, 1.00, 1.00, 1.00, 0.80, 0.00, 10.00, 1.00, 11.00, // 0 - 0.00, 0.95, 0.00, 10.00, 1.00, 11.00, 0.00, 0.90, 0.00, 0.00, 1.00, 1.00, - 1.00, 0.95, 0.00, 0.00, 1.00, 1.00, 1.00, 0.80, 0.00, 10.00, 1.00, 11.00}; // 1 - std::vector expected_valid_outputs = {4, 4}; - - auto test_case = test::TestCase(f); - test_case.add_multiple_inputs({boxes_data, scores_data}); - test_case.add_expected_output({8, 6}, expected_selected_scores); - test_case.add_expected_output({8, 1}, expected_selected_indices); - test_case.add_expected_output({2}, expected_valid_outputs); - test_case.run(); -} - -NGRAPH_TEST(${BACKEND_NAME}, multiclass_nms_two_batches_two_classes_by_score_cross_batch) { - std::vector boxes_data = { - 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, - 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0, // 0 - 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, - 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0 // 1 - }; - - std::vector scores_data = { - 0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3, // 0 - 0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3 // 1 - }; - - op::v8::MulticlassNms::Attributes attrs; - attrs.nms_top_k = 3; - attrs.iou_threshold = 0.5f; - attrs.score_threshold = 0.0f; - attrs.sort_result_type = op::v8::MulticlassNms::SortResultType::SCORE; - attrs.keep_top_k = -1; - attrs.background_class = -1; - attrs.nms_eta = 1.0f; - attrs.sort_result_across_batch = true; - - const auto boxes_shape = Shape{2, 6, 4}; // N 2, C 2, M 6 - const auto scores_shape = Shape{2, 2, 6}; - - const auto boxes = make_shared(element::f32, boxes_shape); - const auto scores = make_shared(element::f32, scores_shape); - - auto nms = make_shared(boxes, scores, attrs); - - auto f = make_shared(nms, ParameterVector{boxes, scores}); - - std::vector expected_selected_indices = {3, 0, 9, 6, 0, 6, 3, 9}; - std::vector expected_selected_scores = {0.00, 0.95, 0.00, 10.00, 1.00, 11.00, // 3 - 1.00, 0.95, 0.00, 0.00, 1.00, 1.00, // 0 - 0.00, 0.95, 0.00, 10.00, 1.00, 11.00, // 9 - 1.00, 0.95, 0.00, 0.00, 1.00, 1.00, // 6 - 0.00, 0.90, 0.00, 0.00, 1.00, 1.00, // 0 - 0.00, 0.90, 0.00, 0.00, 1.00, 1.00, // 6 - 1.00, 0.80, 0.00, 10.00, 1.00, 11.00, // 3 - 1.00, 0.80, 0.00, 10.00, 1.00, 11.00}; // 9 - std::vector expected_valid_outputs = {4, 4}; - - auto test_case = test::TestCase(f); - test_case.add_multiple_inputs({boxes_data, scores_data}); - test_case.add_expected_output({8, 6}, expected_selected_scores); - test_case.add_expected_output({8, 1}, expected_selected_indices); - test_case.add_expected_output({2}, expected_valid_outputs); - test_case.run(); -} - -NGRAPH_TEST(${BACKEND_NAME}, multiclass_nms_two_batches_two_classes_by_class_id_cross_batch) { - std::vector boxes_data = { - 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, - 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0, // 0 - 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, - 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0 // 1 - }; - - std::vector scores_data = { - 0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3, // 0 - 0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3 // 1 - }; - - op::v8::MulticlassNms::Attributes attrs; - attrs.nms_top_k = 3; - attrs.iou_threshold = 0.5f; - attrs.score_threshold = 0.0f; - attrs.sort_result_type = op::v8::MulticlassNms::SortResultType::CLASSID; - attrs.keep_top_k = -1; - attrs.background_class = -1; - attrs.nms_eta = 1.0f; - attrs.sort_result_across_batch = true; - - const auto boxes_shape = Shape{2, 6, 4}; // N 2, C 2, M 6 - const auto scores_shape = Shape{2, 2, 6}; - - const auto boxes = make_shared(element::f32, boxes_shape); - const auto scores = make_shared(element::f32, scores_shape); - auto nms = make_shared(boxes, scores, attrs); - - auto f = make_shared(nms, ParameterVector{boxes, scores}); - - std::vector expected_selected_indices = {3, 0, 9, 6, 0, 3, 6, 9}; - std::vector expected_selected_scores = {0.00, 0.95, 0.00, 10.00, 1.00, 11.00, // 3 - 0.00, 0.90, 0.00, 0.00, 1.00, 1.00, // 0 - 0.00, 0.95, 0.00, 10.00, 1.00, 11.00, // 9 - 0.00, 0.90, 0.00, 0.00, 1.00, 1.00, // 6 - 1.00, 0.95, 0.00, 0.00, 1.00, 1.00, // 0 - 1.00, 0.80, 0.00, 10.00, 1.00, 11.00, // 3 - 1.00, 0.95, 0.00, 0.00, 1.00, 1.00, // 6 - 1.00, 0.80, 0.00, 10.00, 1.00, 11.00}; // 9 - std::vector expected_valid_outputs = {4, 4}; - - auto test_case = test::TestCase(f); - test_case.add_multiple_inputs({boxes_data, scores_data}); - test_case.add_expected_output({8, 6}, expected_selected_scores); - test_case.add_expected_output({8, 1}, expected_selected_indices); - test_case.add_expected_output({2}, expected_valid_outputs); - test_case.run(); -} - -NGRAPH_TEST(${BACKEND_NAME}, multiclass_nms_flipped_coordinates) { - std::vector boxes_data = {1.0, 1.0, 0.0, 0.0, 0.0, 0.1, 1.0, 1.1, 0.0, 0.9, 1.0, -0.1, - 0.0, 10.0, 1.0, 11.0, 1.0, 10.1, 0.0, 11.1, 1.0, 101.0, 0.0, 100.0}; - - std::vector scores_data = {0.9, 0.75, 0.6, 0.95, 0.5, 0.3}; - - op::v8::MulticlassNms::Attributes attrs; - attrs.nms_top_k = 3; - attrs.iou_threshold = 0.5f; - attrs.score_threshold = 0.0f; - attrs.sort_result_type = op::v8::MulticlassNms::SortResultType::SCORE; - attrs.keep_top_k = -1; - attrs.background_class = -1; - attrs.nms_eta = 1.0f; - - const auto boxes_shape = Shape{1, 6, 4}; // N 1, C 1, M 6 - const auto scores_shape = Shape{1, 1, 6}; - - const auto boxes = make_shared(element::f32, boxes_shape); - const auto scores = make_shared(element::f32, scores_shape); - auto nms = make_shared(boxes, scores, attrs); - - auto f = make_shared(nms, ParameterVector{boxes, scores}); - - std::vector expected_selected_indices = {3, 0, 1}; - std::vector expected_selected_scores = - {0.00, 0.95, 0.00, 10.00, 1.00, 11.00, 0.00, 0.90, 1.00, 1.00, 0.00, 0.00, 0.00, 0.75, 0.00, 0.10, 1.00, 1.10}; - std::vector expected_valid_outputs = {3}; - - auto test_case = test::TestCase(f); - test_case.add_multiple_inputs({boxes_data, scores_data}); - test_case.add_expected_output({3, 6}, expected_selected_scores); - test_case.add_expected_output({3, 1}, expected_selected_indices); - test_case.add_expected_output({1}, expected_valid_outputs); - test_case.run(); -} - -NGRAPH_TEST(${BACKEND_NAME}, multiclass_nms_identical_boxes) { - std::vector boxes_data = {0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, - 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, - 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0}; - - std::vector scores_data = {0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9}; - - op::v8::MulticlassNms::Attributes attrs; - attrs.nms_top_k = 3; - attrs.iou_threshold = 0.5f; - attrs.score_threshold = 0.0f; - attrs.sort_result_type = op::v8::MulticlassNms::SortResultType::SCORE; - attrs.keep_top_k = -1; - attrs.background_class = -1; - attrs.nms_eta = 1.0f; - - const auto boxes_shape = Shape{1, 10, 4}; // N 1, C 1, M 10 - const auto scores_shape = Shape{1, 1, 10}; - - const auto boxes = make_shared(element::f32, boxes_shape); - const auto scores = make_shared(element::f32, scores_shape); - auto nms = make_shared(boxes, scores, attrs); - - auto f = make_shared(nms, ParameterVector{boxes, scores}); - - std::vector expected_selected_indices = {0}; - std::vector expected_selected_scores = {0.00, 0.90, 0.00, 0.00, 1.00, 1.00}; - std::vector expected_valid_outputs = {1}; - - auto test_case = test::TestCase(f); - test_case.add_multiple_inputs({boxes_data, scores_data}); - test_case.add_expected_output({1, 6}, expected_selected_scores); - test_case.add_expected_output({1, 1}, expected_selected_indices); - test_case.add_expected_output({1}, expected_valid_outputs); - test_case.run(); -} - -NGRAPH_TEST(${BACKEND_NAME}, multiclass_nms_limit_output_size) { - std::vector boxes_data = {0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, - 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0}; - - std::vector scores_data = {0.9, 0.75, 0.6, 0.95, 0.5, 0.3}; - - op::v8::MulticlassNms::Attributes attrs; - attrs.nms_top_k = 2; - attrs.iou_threshold = 0.5f; - attrs.score_threshold = 0.0f; - attrs.sort_result_type = op::v8::MulticlassNms::SortResultType::SCORE; - attrs.keep_top_k = -1; - attrs.background_class = -1; - attrs.nms_eta = 1.0f; - - const auto boxes_shape = Shape{1, 6, 4}; - const auto scores_shape = Shape{1, 1, 6}; - - const auto boxes = make_shared(element::f32, boxes_shape); - const auto scores = make_shared(element::f32, scores_shape); - auto nms = make_shared(boxes, scores, attrs); - - auto f = make_shared(nms, ParameterVector{boxes, scores}); - - std::vector expected_selected_indices = {3, 0}; - std::vector expected_selected_scores = - {0.00, 0.95, 0.00, 10.00, 1.00, 11.00, 0.00, 0.90, 0.00, 0.00, 1.00, 1.00}; - std::vector expected_valid_outputs = {2}; - - auto test_case = test::TestCase(f); - test_case.add_multiple_inputs({boxes_data, scores_data}); - test_case.add_expected_output({2, 6}, expected_selected_scores); - test_case.add_expected_output({2, 1}, expected_selected_indices); - test_case.add_expected_output({1}, expected_valid_outputs); - test_case.run(); -} - -NGRAPH_TEST(${BACKEND_NAME}, multiclass_nms_single_box) { - std::vector boxes_data = {0.0, 0.0, 1.0, 1.0}; - - std::vector scores_data = {0.9}; - - op::v8::MulticlassNms::Attributes attrs; - attrs.nms_top_k = 3; - attrs.iou_threshold = 0.5f; - attrs.score_threshold = 0.0f; - attrs.sort_result_type = op::v8::MulticlassNms::SortResultType::SCORE; - attrs.keep_top_k = -1; - attrs.background_class = -1; - attrs.nms_eta = 1.0f; - - const auto boxes_shape = Shape{1, 1, 4}; - const auto scores_shape = Shape{1, 1, 1}; - - const auto boxes = make_shared(element::f32, boxes_shape); - const auto scores = make_shared(element::f32, scores_shape); - auto nms = make_shared(boxes, scores, attrs); - - auto f = make_shared(nms, ParameterVector{boxes, scores}); - - std::vector expected_selected_indices = {0}; - std::vector expected_selected_scores = {0.00, 0.90, 0.00, 0.00, 1.00, 1.00}; - std::vector expected_valid_outputs = {1}; - - auto test_case = test::TestCase(f); - test_case.add_multiple_inputs({boxes_data, scores_data}); - test_case.add_expected_output({1, 6}, expected_selected_scores); - test_case.add_expected_output({1, 1}, expected_selected_indices); - test_case.add_expected_output({1}, expected_valid_outputs); - test_case.run(); -} - -NGRAPH_TEST(${BACKEND_NAME}, multiclass_nms_by_IOU) { - std::vector boxes_data = {0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, - 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0}; - - std::vector scores_data = {0.9, 0.75, 0.6, 0.95, 0.5, 0.3}; - - op::v8::MulticlassNms::Attributes attrs; - attrs.nms_top_k = 3; - attrs.iou_threshold = 0.2f; - attrs.score_threshold = 0.0f; - attrs.sort_result_type = op::v8::MulticlassNms::SortResultType::SCORE; - attrs.keep_top_k = -1; - attrs.background_class = -1; - attrs.nms_eta = 1.0f; - - const auto boxes_shape = Shape{1, 6, 4}; - const auto scores_shape = Shape{1, 1, 6}; - - const auto boxes = make_shared(element::f32, boxes_shape); - const auto scores = make_shared(element::f32, scores_shape); - auto nms = make_shared(boxes, scores, attrs); - - auto f = make_shared(nms, ParameterVector{boxes, scores}); - - std::vector expected_selected_indices = {3, 0}; - std::vector expected_selected_scores = - {0.00, 0.95, 0.00, 10.00, 1.00, 11.00, 0.00, 0.90, 0.00, 0.00, 1.00, 1.00}; - std::vector expected_valid_outputs = {2}; - - auto test_case = test::TestCase(f); - test_case.add_multiple_inputs({boxes_data, scores_data}); - test_case.add_expected_output({2, 6}, expected_selected_scores); - test_case.add_expected_output({2, 1}, expected_selected_indices); - test_case.add_expected_output({1}, expected_valid_outputs); - test_case.run(); -} - -NGRAPH_TEST(${BACKEND_NAME}, multiclass_nms_by_IOU_and_scores) { - std::vector boxes_data = {0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, - 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0}; - - std::vector scores_data = {0.9, 0.75, 0.6, 0.95, 0.5, 0.3}; - - op::v8::MulticlassNms::Attributes attrs; - attrs.nms_top_k = 3; - attrs.iou_threshold = 0.5f; - attrs.score_threshold = 0.95f; - attrs.sort_result_type = op::v8::MulticlassNms::SortResultType::SCORE; - attrs.keep_top_k = -1; - attrs.background_class = -1; - attrs.nms_eta = 1.0f; - - const auto boxes_shape = Shape{1, 6, 4}; - const auto scores_shape = Shape{1, 1, 6}; - - const auto boxes = make_shared(element::f32, boxes_shape); - const auto scores = make_shared(element::f32, scores_shape); - auto nms = make_shared(boxes, scores, attrs); - - auto f = make_shared(nms, ParameterVector{boxes, scores}); - - std::vector expected_selected_indices = {3}; - std::vector expected_selected_scores = {0.00, 0.95, 0.00, 10.00, 1.00, 11.00}; - std::vector expected_valid_outputs = {1}; - - auto test_case = test::TestCase(f); - test_case.add_multiple_inputs({boxes_data, scores_data}); - test_case.add_expected_output({1, 6}, expected_selected_scores); - test_case.add_expected_output({1, 1}, expected_selected_indices); - test_case.add_expected_output({1}, expected_valid_outputs); - test_case.run(); -} - -NGRAPH_TEST(${BACKEND_NAME}, multiclass_nms_no_output) { - std::vector boxes_data = {0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, - 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0}; - - std::vector scores_data = {0.9, 0.75, 0.6, 0.95, 0.5, 0.3}; - - op::v8::MulticlassNms::Attributes attrs; - attrs.nms_top_k = 3; - attrs.iou_threshold = 0.5f; - attrs.score_threshold = 2.0f; - attrs.sort_result_type = op::v8::MulticlassNms::SortResultType::SCORE; - attrs.keep_top_k = -1; - attrs.background_class = -1; - attrs.nms_eta = 1.0f; - - const auto boxes_shape = Shape{1, 6, 4}; - const auto scores_shape = Shape{1, 1, 6}; - - const auto boxes = make_shared(element::f32, boxes_shape); - const auto scores = make_shared(element::f32, scores_shape); - auto nms = make_shared(boxes, scores, attrs); - - auto f = make_shared(nms, ParameterVector{boxes, scores}); - - std::vector expected_selected_indices = {}; - std::vector expected_selected_scores = {}; - std::vector expected_valid_outputs = {0}; - - auto test_case = test::TestCase(f); - test_case.add_multiple_inputs({boxes_data, scores_data}); - test_case.add_expected_output({0, 6}, expected_selected_scores); - test_case.add_expected_output({0, 1}, expected_selected_indices); - test_case.add_expected_output({1}, expected_valid_outputs); - test_case.run(); -} - -NGRAPH_TEST(${BACKEND_NAME}, multiclass_nms_by_background) { - std::vector boxes_data = { - 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, - 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0, // 0 - 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, - 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0 // 1 - }; - - std::vector scores_data = { - 0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3, // 0 - 0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3 // 1 - }; - - op::v8::MulticlassNms::Attributes attrs; - attrs.nms_top_k = 3; - attrs.iou_threshold = 0.5f; - attrs.score_threshold = 0.0f; - attrs.sort_result_type = op::v8::MulticlassNms::SortResultType::CLASSID; - attrs.keep_top_k = -1; - attrs.background_class = 0; - attrs.nms_eta = 1.0f; - - const auto boxes_shape = Shape{2, 6, 4}; // N 2, C 2, M 6 - const auto scores_shape = Shape{2, 2, 6}; - - const auto boxes = make_shared(element::f32, boxes_shape); - const auto scores = make_shared(element::f32, scores_shape); - auto nms = make_shared(boxes, scores, attrs); - - auto f = make_shared(nms, ParameterVector{boxes, scores}); - - std::vector expected_selected_indices = {0, 3, 6, 9}; - std::vector expected_selected_scores = { - 1.00, 0.95, 0.00, 0.00, 1.00, 1.00, 1.00, 0.80, 0.00, 10.00, 1.00, 11.00, // 0 - 1.00, 0.95, 0.00, 0.00, 1.00, 1.00, 1.00, 0.80, 0.00, 10.00, 1.00, 11.00}; // 1 - std::vector expected_valid_outputs = {2, 2}; - - auto test_case = test::TestCase(f); - test_case.add_multiple_inputs({boxes_data, scores_data}); - test_case.add_expected_output({4, 6}, expected_selected_scores); - test_case.add_expected_output({4, 1}, expected_selected_indices); - test_case.add_expected_output({2}, expected_valid_outputs); - test_case.run(); -} - -NGRAPH_TEST(${BACKEND_NAME}, multiclass_nms_by_keep_top_k) { - std::vector boxes_data = { - 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, - 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0, // 0 - 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, - 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0 // 1 - }; - - std::vector scores_data = { - 0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3, // 0 - 0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3 // 1 - }; - - op::v8::MulticlassNms::Attributes attrs; - attrs.nms_top_k = 3; - attrs.iou_threshold = 0.5f; - attrs.score_threshold = 0.0f; - attrs.sort_result_type = op::v8::MulticlassNms::SortResultType::CLASSID; - attrs.keep_top_k = 3; - attrs.background_class = -1; - attrs.nms_eta = 1.0f; - - const auto boxes_shape = Shape{2, 6, 4}; // N 2, C 2, M 6 - const auto scores_shape = Shape{2, 2, 6}; - - const auto boxes = make_shared(element::f32, boxes_shape); - const auto scores = make_shared(element::f32, scores_shape); - auto nms = make_shared(boxes, scores, attrs); - - auto f = make_shared(nms, ParameterVector{boxes, scores}); - - std::vector expected_selected_indices = {3, 0, 0, 9, 6, 6}; - std::vector expected_selected_scores = {0.00, 0.95, 0.00, 10.00, 1.00, 11.00, 0.00, 0.90, 0.00, - 0.00, 1.00, 1.00, 1.00, 0.95, 0.00, 0.00, 1.00, 1.00, // 0 - 0.00, 0.95, 0.00, 10.00, 1.00, 11.00, 0.00, 0.90, 0.00, - 0.00, 1.00, 1.00, 1.00, 0.95, 0.00, 0.00, 1.00, 1.00}; // 1 - std::vector expected_valid_outputs = {3, 3}; - - auto test_case = test::TestCase(f); - test_case.add_multiple_inputs({boxes_data, scores_data}); - test_case.add_expected_output({6, 6}, expected_selected_scores); - test_case.add_expected_output({6, 1}, expected_selected_indices); - test_case.add_expected_output({2}, expected_valid_outputs); - test_case.run(); -} - -NGRAPH_TEST(${BACKEND_NAME}, multiclass_nms_by_nms_eta) { - std::vector boxes_data = { - 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, - 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0, // 0 - 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, - 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0 // 1 - }; - - std::vector scores_data = { - 0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3, // 0 - 0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3 // 1 - }; - - op::v8::MulticlassNms::Attributes attrs; - attrs.nms_top_k = -1; - attrs.iou_threshold = 1.0f; - attrs.score_threshold = 0.0f; - attrs.sort_result_type = op::v8::MulticlassNms::SortResultType::CLASSID; - attrs.keep_top_k = -1; - attrs.background_class = -1; - attrs.nms_eta = 0.1f; - - const auto boxes_shape = Shape{2, 6, 4}; // N 2, C 2, M 6 - const auto scores_shape = Shape{2, 2, 6}; - - const auto boxes = make_shared(element::f32, boxes_shape); - const auto scores = make_shared(element::f32, scores_shape); - auto nms = make_shared(boxes, scores, attrs); - - auto f = make_shared(nms, ParameterVector{boxes, scores}); - - std::vector expected_selected_indices = {3, 0, 5, 0, 3, 5, 9, 6, 11, 6, 9, 11}; - std::vector expected_selected_scores = { - 0.00, 0.95, 0.00, 10.00, 1.00, 11.00, 0.00, 0.90, 0.00, 0.00, 1.00, 1.00, 0.00, 0.30, 0.00, - 100.00, 1.00, 101.00, 1.00, 0.95, 0.00, 0.00, 1.00, 1.00, 1.00, 0.80, 0.00, 10.00, 1.00, 11.00, - 1.00, 0.30, 0.00, 100.00, 1.00, 101.00, 0.00, 0.95, 0.00, 10.00, 1.00, 11.00, 0.00, 0.90, 0.00, - 0.00, 1.00, 1.00, 0.00, 0.30, 0.00, 100.00, 1.00, 101.00, 1.00, 0.95, 0.00, 0.00, 1.00, 1.00, - 1.00, 0.80, 0.00, 10.00, 1.00, 11.00, 1.00, 0.30, 0.00, 100.00, 1.00, 101.00}; - std::vector expected_valid_outputs = {6, 6}; - - auto test_case = test::TestCase(f); - test_case.add_multiple_inputs({boxes_data, scores_data}); - test_case.add_expected_output({12, 6}, expected_selected_scores); - test_case.add_expected_output({12, 1}, expected_selected_indices); - test_case.add_expected_output({2}, expected_valid_outputs); - test_case.run(); -} diff --git a/ngraph/test/backend/non_max_suppression.in.cpp b/ngraph/test/backend/non_max_suppression.in.cpp deleted file mode 100644 index 652e2bfafa2..00000000000 --- a/ngraph/test/backend/non_max_suppression.in.cpp +++ /dev/null @@ -1,638 +0,0 @@ -// Copyright (C) 2018-2021 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -// clang-format off -#ifdef ${BACKEND_NAME}_FLOAT_TOLERANCE_BITS -#define DEFAULT_FLOAT_TOLERANCE_BITS ${BACKEND_NAME}_FLOAT_TOLERANCE_BITS -#endif - -#ifdef ${BACKEND_NAME}_DOUBLE_TOLERANCE_BITS -#define DEFAULT_DOUBLE_TOLERANCE_BITS ${BACKEND_NAME}_DOUBLE_TOLERANCE_BITS -#endif -// clang-format on - -#include "gtest/gtest.h" -#include "runtime/backend.hpp" -#include "ngraph/runtime/tensor.hpp" -#include "ngraph/ngraph.hpp" -#include "util/all_close.hpp" -#include "util/all_close_f.hpp" -#include "util/ndarray.hpp" -#include "util/test_control.hpp" -#include "engines_util/execute_tools.hpp" - -NGRAPH_SUPPRESS_DEPRECATED_START - -using namespace std; -using namespace ngraph; - -static string s_manifest = "${MANIFEST}"; - -NGRAPH_TEST(${BACKEND_NAME}, nonmaxsuppression_center_point_box_format) { - std::vector boxes_data = {0.5, 0.5, 1.0, 1.0, 0.5, 0.6, 1.0, 1.0, 0.5, 0.4, 1.0, 1.0, - 0.5, 10.5, 1.0, 1.0, 0.5, 10.6, 1.0, 1.0, 0.5, 100.5, 1.0, 1.0}; - - std::vector scores_data = {0.9, 0.75, 0.6, 0.95, 0.5, 0.3}; - - const int64_t max_output_boxes_per_class_data = 3; - const float iou_threshold_data = 0.5f; - const float score_threshold_data = 0.0f; - const auto box_encoding = op::v5::NonMaxSuppression::BoxEncodingType::CENTER; - const auto boxes_shape = Shape{1, 6, 4}; - const auto scores_shape = Shape{1, 1, 6}; - - const auto boxes = make_shared(element::f32, boxes_shape); - const auto scores = make_shared(element::f32, scores_shape); - auto max_output_boxes_per_class = - op::Constant::create(element::i64, Shape{}, {max_output_boxes_per_class_data}); - auto iou_threshold = op::Constant::create(element::f32, Shape{}, {iou_threshold_data}); - auto score_threshold = op::Constant::create(element::f32, Shape{}, {score_threshold_data}); - auto soft_nms_sigma = op::Constant::create(element::f32, Shape{}, {0.0f}); - auto nms = make_shared(boxes, - scores, - max_output_boxes_per_class, - iou_threshold, - score_threshold, - soft_nms_sigma, - box_encoding, - false); - - auto f = make_shared(nms, ParameterVector{boxes, scores}); - - auto backend = runtime::Backend::create("${BACKEND_NAME}"); - - auto selected_indeces = backend->create_tensor(element::i64, Shape{3, 3}); - auto selected_scores = backend->create_tensor(element::f32, Shape{3, 3}); - auto valid_outputs = backend->create_tensor(element::i64, Shape{1}); - - auto backend_boxes = backend->create_tensor(element::f32, boxes_shape); - auto backend_scores = backend->create_tensor(element::f32, scores_shape); - copy_data(backend_boxes, boxes_data); - copy_data(backend_scores, scores_data); - - auto handle = backend->compile(f); - - handle->call({selected_indeces, selected_scores, valid_outputs}, {backend_boxes, backend_scores}); - - auto selected_indeces_value = read_vector(selected_indeces); - auto selected_scores_value = read_vector(selected_scores); - auto valid_outputs_value = read_vector(valid_outputs); - - std::vector expected_selected_indices = {0, 0, 3, 0, 0, 0, 0, 0, 5}; - std::vector expected_selected_scores = {0.0, 0.0, 0.95, 0.0, 0.0, 0.9, 0.0, 0.0, 0.3}; - std::vector expected_valid_outputs = {3}; - - EXPECT_EQ(expected_selected_indices, selected_indeces_value); - EXPECT_EQ(expected_selected_scores, selected_scores_value); - EXPECT_EQ(expected_valid_outputs, valid_outputs_value); -} - -NGRAPH_TEST(${BACKEND_NAME}, nonmaxsuppression_flipped_coordinates) { - std::vector boxes_data = {1.0, 1.0, 0.0, 0.0, 0.0, 0.1, 1.0, 1.1, 0.0, 0.9, 1.0, -0.1, - 0.0, 10.0, 1.0, 11.0, 1.0, 10.1, 0.0, 11.1, 1.0, 101.0, 0.0, 100.0}; - - std::vector scores_data = {0.9, 0.75, 0.6, 0.95, 0.5, 0.3}; - - const int64_t max_output_boxes_per_class_data = 3; - const float iou_threshold_data = 0.5f; - const float score_threshold_data = 0.0f; - const auto box_encoding = op::v5::NonMaxSuppression::BoxEncodingType::CORNER; - const auto boxes_shape = Shape{1, 6, 4}; - const auto scores_shape = Shape{1, 1, 6}; - - const auto boxes = make_shared(element::f32, boxes_shape); - const auto scores = make_shared(element::f32, scores_shape); - auto max_output_boxes_per_class = - op::Constant::create(element::i64, Shape{}, {max_output_boxes_per_class_data}); - auto iou_threshold = op::Constant::create(element::f32, Shape{}, {iou_threshold_data}); - auto score_threshold = op::Constant::create(element::f32, Shape{}, {score_threshold_data}); - auto soft_nms_sigma = op::Constant::create(element::f32, Shape{}, {0.0f}); - auto nms = make_shared(boxes, - scores, - max_output_boxes_per_class, - iou_threshold, - score_threshold, - soft_nms_sigma, - box_encoding, - false); - - auto f = make_shared(nms, ParameterVector{boxes, scores}); - - auto backend = runtime::Backend::create("${BACKEND_NAME}"); - - auto selected_indeces = backend->create_tensor(element::i64, Shape{3, 3}); - auto selected_scores = backend->create_tensor(element::f32, Shape{3, 3}); - auto valid_outputs = backend->create_tensor(element::i64, Shape{1}); - - auto backend_boxes = backend->create_tensor(element::f32, boxes_shape); - auto backend_scores = backend->create_tensor(element::f32, scores_shape); - copy_data(backend_boxes, boxes_data); - copy_data(backend_scores, scores_data); - - auto handle = backend->compile(f); - - handle->call({selected_indeces, selected_scores, valid_outputs}, {backend_boxes, backend_scores}); - - auto selected_indeces_value = read_vector(selected_indeces); - auto selected_scores_value = read_vector(selected_scores); - auto valid_outputs_value = read_vector(valid_outputs); - - std::vector expected_selected_indices = {0, 0, 3, 0, 0, 0, 0, 0, 5}; - std::vector expected_selected_scores = {0.0, 0.0, 0.95, 0.0, 0.0, 0.9, 0.0, 0.0, 0.3}; - std::vector expected_valid_outputs = {3}; - - EXPECT_EQ(expected_selected_indices, selected_indeces_value); - EXPECT_EQ(expected_selected_scores, selected_scores_value); - EXPECT_EQ(expected_valid_outputs, valid_outputs_value); -} - -NGRAPH_TEST(${BACKEND_NAME}, nonmaxsuppression_identical_boxes) { - std::vector boxes_data = {0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, - 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, - 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0}; - - std::vector scores_data = {0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9}; - - const int64_t max_output_boxes_per_class_data = 3; - const float iou_threshold_data = 0.5f; - const float score_threshold_data = 0.0f; - const auto box_encoding = op::v5::NonMaxSuppression::BoxEncodingType::CORNER; - const auto boxes_shape = Shape{1, 10, 4}; - const auto scores_shape = Shape{1, 1, 10}; - - const auto boxes = make_shared(element::f32, boxes_shape); - const auto scores = make_shared(element::f32, scores_shape); - auto max_output_boxes_per_class = - op::Constant::create(element::i64, Shape{}, {max_output_boxes_per_class_data}); - auto iou_threshold = op::Constant::create(element::f32, Shape{}, {iou_threshold_data}); - auto score_threshold = op::Constant::create(element::f32, Shape{}, {score_threshold_data}); - auto soft_nms_sigma = op::Constant::create(element::f32, Shape{}, {0.0f}); - auto nms = make_shared(boxes, - scores, - max_output_boxes_per_class, - iou_threshold, - score_threshold, - soft_nms_sigma, - box_encoding, - false); - - auto f = make_shared(nms, ParameterVector{boxes, scores}); - - auto backend = runtime::Backend::create("${BACKEND_NAME}"); - - auto selected_indeces = backend->create_tensor(element::i64, Shape{1, 3}); - auto selected_scores = backend->create_tensor(element::f32, Shape{1, 3}); - auto valid_outputs = backend->create_tensor(element::i64, Shape{1}); - - auto backend_boxes = backend->create_tensor(element::f32, boxes_shape); - auto backend_scores = backend->create_tensor(element::f32, scores_shape); - copy_data(backend_boxes, boxes_data); - copy_data(backend_scores, scores_data); - - auto handle = backend->compile(f); - - handle->call({selected_indeces, selected_scores, valid_outputs}, {backend_boxes, backend_scores}); - - auto selected_indeces_value = read_vector(selected_indeces); - auto selected_scores_value = read_vector(selected_scores); - auto valid_outputs_value = read_vector(valid_outputs); - - std::vector expected_selected_indices = {0, 0, 0}; - std::vector expected_selected_scores = {0.0, 0.0, 0.9}; - std::vector expected_valid_outputs = {1}; - - EXPECT_EQ(expected_selected_indices, selected_indeces_value); - EXPECT_EQ(expected_selected_scores, selected_scores_value); - EXPECT_EQ(expected_valid_outputs, valid_outputs_value); -} - -NGRAPH_TEST(${BACKEND_NAME}, nonmaxsuppression_limit_output_size) { - std::vector boxes_data = {0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, - 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0}; - - std::vector scores_data = {0.9, 0.75, 0.6, 0.95, 0.5, 0.3}; - - const int64_t max_output_boxes_per_class_data = 2; - const float iou_threshold_data = 0.5f; - const float score_threshold_data = 0.0f; - const auto box_encoding = op::v5::NonMaxSuppression::BoxEncodingType::CORNER; - const auto boxes_shape = Shape{1, 6, 4}; - const auto scores_shape = Shape{1, 1, 6}; - - const auto boxes = make_shared(element::f32, boxes_shape); - const auto scores = make_shared(element::f32, scores_shape); - auto max_output_boxes_per_class = - op::Constant::create(element::i64, Shape{}, {max_output_boxes_per_class_data}); - auto iou_threshold = op::Constant::create(element::f32, Shape{}, {iou_threshold_data}); - auto score_threshold = op::Constant::create(element::f32, Shape{}, {score_threshold_data}); - auto soft_nms_sigma = op::Constant::create(element::f32, Shape{}, {0.0f}); - auto nms = make_shared(boxes, - scores, - max_output_boxes_per_class, - iou_threshold, - score_threshold, - soft_nms_sigma, - box_encoding, - false); - - auto f = make_shared(nms, ParameterVector{boxes, scores}); - - auto backend = runtime::Backend::create("${BACKEND_NAME}"); - - auto selected_indeces = backend->create_tensor(element::i64, Shape{2, 3}); - auto selected_scores = backend->create_tensor(element::f32, Shape{2, 3}); - auto valid_outputs = backend->create_tensor(element::i64, Shape{1}); - - auto backend_boxes = backend->create_tensor(element::f32, boxes_shape); - auto backend_scores = backend->create_tensor(element::f32, scores_shape); - copy_data(backend_boxes, boxes_data); - copy_data(backend_scores, scores_data); - - auto handle = backend->compile(f); - - handle->call({selected_indeces, selected_scores, valid_outputs}, {backend_boxes, backend_scores}); - - auto selected_indeces_value = read_vector(selected_indeces); - auto selected_scores_value = read_vector(selected_scores); - auto valid_outputs_value = read_vector(valid_outputs); - - std::vector expected_selected_indices = {0, 0, 3, 0, 0, 0}; - std::vector expected_selected_scores = {0.0, 0.0, 0.95, 0.0, 0.0, 0.9}; - std::vector expected_valid_outputs = {2}; - - EXPECT_EQ(expected_selected_indices, selected_indeces_value); - EXPECT_EQ(expected_selected_scores, selected_scores_value); - EXPECT_EQ(expected_valid_outputs, valid_outputs_value); -} - -NGRAPH_TEST(${BACKEND_NAME}, nonmaxsuppression_single_box) { - std::vector boxes_data = {0.0, 0.0, 1.0, 1.0}; - - std::vector scores_data = {0.9}; - - const int64_t max_output_boxes_per_class_data = 3; - const float iou_threshold_data = 0.5f; - const float score_threshold_data = 0.0f; - const auto box_encoding = op::v5::NonMaxSuppression::BoxEncodingType::CORNER; - const auto boxes_shape = Shape{1, 1, 4}; - const auto scores_shape = Shape{1, 1, 1}; - - const auto boxes = make_shared(element::f32, boxes_shape); - const auto scores = make_shared(element::f32, scores_shape); - auto max_output_boxes_per_class = - op::Constant::create(element::i64, Shape{}, {max_output_boxes_per_class_data}); - auto iou_threshold = op::Constant::create(element::f32, Shape{}, {iou_threshold_data}); - auto score_threshold = op::Constant::create(element::f32, Shape{}, {score_threshold_data}); - auto soft_nms_sigma = op::Constant::create(element::f32, Shape{}, {0.0f}); - auto nms = make_shared(boxes, - scores, - max_output_boxes_per_class, - iou_threshold, - score_threshold, - soft_nms_sigma, - box_encoding, - false); - - auto f = make_shared(nms, ParameterVector{boxes, scores}); - - auto backend = runtime::Backend::create("${BACKEND_NAME}"); - - auto selected_indeces = backend->create_tensor(element::i64, Shape{1, 3}); - auto selected_scores = backend->create_tensor(element::f32, Shape{1, 3}); - auto valid_outputs = backend->create_tensor(element::i64, Shape{1}); - - auto backend_boxes = backend->create_tensor(element::f32, boxes_shape); - auto backend_scores = backend->create_tensor(element::f32, scores_shape); - copy_data(backend_boxes, boxes_data); - copy_data(backend_scores, scores_data); - - auto handle = backend->compile(f); - - handle->call({selected_indeces, selected_scores, valid_outputs}, {backend_boxes, backend_scores}); - - auto selected_indeces_value = read_vector(selected_indeces); - auto selected_scores_value = read_vector(selected_scores); - auto valid_outputs_value = read_vector(valid_outputs); - - std::vector expected_selected_indices = {0, 0, 0}; - std::vector expected_selected_scores = {0.0, 0.0, 0.9}; - std::vector expected_valid_outputs = {1}; - - EXPECT_EQ(expected_selected_indices, selected_indeces_value); - EXPECT_EQ(expected_selected_scores, selected_scores_value); - EXPECT_EQ(expected_valid_outputs, valid_outputs_value); -} - -NGRAPH_TEST(${BACKEND_NAME}, nonmaxsuppression_suppress_by_IOU) { - std::vector boxes_data = {0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, - 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0}; - - std::vector scores_data = {0.9, 0.75, 0.6, 0.95, 0.5, 0.3}; - - const int64_t max_output_boxes_per_class_data = 3; - const float iou_threshold_data = 0.5f; - const float score_threshold_data = 0.0f; - const auto box_encoding = op::v5::NonMaxSuppression::BoxEncodingType::CORNER; - const auto boxes_shape = Shape{1, 6, 4}; - const auto scores_shape = Shape{1, 1, 6}; - - const auto boxes = make_shared(element::f32, boxes_shape); - const auto scores = make_shared(element::f32, scores_shape); - auto max_output_boxes_per_class = - op::Constant::create(element::i64, Shape{}, {max_output_boxes_per_class_data}); - auto iou_threshold = op::Constant::create(element::f32, Shape{}, {iou_threshold_data}); - auto score_threshold = op::Constant::create(element::f32, Shape{}, {score_threshold_data}); - auto soft_nms_sigma = op::Constant::create(element::f32, Shape{}, {0.0f}); - auto nms = make_shared(boxes, - scores, - max_output_boxes_per_class, - iou_threshold, - score_threshold, - soft_nms_sigma, - box_encoding, - false); - - auto f = make_shared(nms, ParameterVector{boxes, scores}); - - auto backend = runtime::Backend::create("${BACKEND_NAME}"); - - auto selected_indeces = backend->create_tensor(element::i64, Shape{3, 3}); - auto selected_scores = backend->create_tensor(element::f32, Shape{3, 3}); - auto valid_outputs = backend->create_tensor(element::i64, Shape{1}); - - auto backend_boxes = backend->create_tensor(element::f32, boxes_shape); - auto backend_scores = backend->create_tensor(element::f32, scores_shape); - copy_data(backend_boxes, boxes_data); - copy_data(backend_scores, scores_data); - - auto handle = backend->compile(f); - - handle->call({selected_indeces, selected_scores, valid_outputs}, {backend_boxes, backend_scores}); - - auto selected_indeces_value = read_vector(selected_indeces); - auto selected_scores_value = read_vector(selected_scores); - auto valid_outputs_value = read_vector(valid_outputs); - - std::vector expected_selected_indices = {0, 0, 3, 0, 0, 0, 0, 0, 5}; - std::vector expected_selected_scores = {0.0, 0.0, 0.95, 0.0, 0.0, 0.9, 0.0, 0.0, 0.3}; - std::vector expected_valid_outputs = {3}; - - EXPECT_EQ(expected_selected_indices, selected_indeces_value); - EXPECT_EQ(expected_selected_scores, selected_scores_value); - EXPECT_EQ(expected_valid_outputs, valid_outputs_value); -} - -NGRAPH_TEST(${BACKEND_NAME}, nonmaxsuppression_suppress_by_IOU_and_scores) { - std::vector boxes_data = {0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, - 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0}; - - std::vector scores_data = {0.9, 0.75, 0.6, 0.95, 0.5, 0.3}; - - const int64_t max_output_boxes_per_class_data = 3; - const float iou_threshold_data = 0.5f; - const float score_threshold_data = 0.4f; - const auto box_encoding = op::v5::NonMaxSuppression::BoxEncodingType::CORNER; - const auto boxes_shape = Shape{1, 6, 4}; - const auto scores_shape = Shape{1, 1, 6}; - - const auto boxes = make_shared(element::f32, boxes_shape); - const auto scores = make_shared(element::f32, scores_shape); - auto max_output_boxes_per_class = - op::Constant::create(element::i64, Shape{}, {max_output_boxes_per_class_data}); - auto iou_threshold = op::Constant::create(element::f32, Shape{}, {iou_threshold_data}); - auto score_threshold = op::Constant::create(element::f32, Shape{}, {score_threshold_data}); - auto soft_nms_sigma = op::Constant::create(element::f32, Shape{}, {0.0f}); - auto nms = make_shared(boxes, - scores, - max_output_boxes_per_class, - iou_threshold, - score_threshold, - soft_nms_sigma, - box_encoding, - false); - - auto f = make_shared(nms, ParameterVector{boxes, scores}); - - auto backend = runtime::Backend::create("${BACKEND_NAME}"); - - auto selected_indeces = backend->create_tensor(element::i64, Shape{2, 3}); - auto selected_scores = backend->create_tensor(element::f32, Shape{2, 3}); - auto valid_outputs = backend->create_tensor(element::i64, Shape{1}); - - auto backend_boxes = backend->create_tensor(element::f32, boxes_shape); - auto backend_scores = backend->create_tensor(element::f32, scores_shape); - copy_data(backend_boxes, boxes_data); - copy_data(backend_scores, scores_data); - - auto handle = backend->compile(f); - - handle->call({selected_indeces, selected_scores, valid_outputs}, {backend_boxes, backend_scores}); - - auto selected_indeces_value = read_vector(selected_indeces); - auto selected_scores_value = read_vector(selected_scores); - auto valid_outputs_value = read_vector(valid_outputs); - - std::vector expected_selected_indices = {0, 0, 3, 0, 0, 0}; - std::vector expected_selected_scores = {0.0, 0.0, 0.95, 0.0, 0.0, 0.9}; - std::vector expected_valid_outputs = {2}; - - EXPECT_EQ(expected_selected_indices, selected_indeces_value); - EXPECT_EQ(expected_selected_scores, selected_scores_value); - EXPECT_EQ(expected_valid_outputs, valid_outputs_value); -} - -NGRAPH_TEST(${BACKEND_NAME}, nonmaxsuppression_two_batches) { - std::vector boxes_data = {0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, - 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0, - 0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, - 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0}; - - std::vector scores_data = {0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.9, 0.75, 0.6, 0.95, 0.5, 0.3}; - - const int64_t max_output_boxes_per_class_data = 2; - const float iou_threshold_data = 0.5f; - const float score_threshold_data = 0.0f; - const auto box_encoding = op::v5::NonMaxSuppression::BoxEncodingType::CORNER; - const auto boxes_shape = Shape{2, 6, 4}; - const auto scores_shape = Shape{2, 1, 6}; - - const auto boxes = make_shared(element::f32, boxes_shape); - const auto scores = make_shared(element::f32, scores_shape); - auto max_output_boxes_per_class = - op::Constant::create(element::i64, Shape{}, {max_output_boxes_per_class_data}); - auto iou_threshold = op::Constant::create(element::f32, Shape{}, {iou_threshold_data}); - auto score_threshold = op::Constant::create(element::f32, Shape{}, {score_threshold_data}); - auto soft_nms_sigma = op::Constant::create(element::f32, Shape{}, {0.0f}); - auto nms = make_shared(boxes, - scores, - max_output_boxes_per_class, - iou_threshold, - score_threshold, - soft_nms_sigma, - box_encoding, - false); - - auto f = make_shared(nms, ParameterVector{boxes, scores}); - - auto backend = runtime::Backend::create("${BACKEND_NAME}"); - - auto selected_indeces = backend->create_tensor(element::i64, Shape{4, 3}); - auto selected_scores = backend->create_tensor(element::f32, Shape{4, 3}); - auto valid_outputs = backend->create_tensor(element::i64, Shape{1}); - - auto backend_boxes = backend->create_tensor(element::f32, boxes_shape); - auto backend_scores = backend->create_tensor(element::f32, scores_shape); - copy_data(backend_boxes, boxes_data); - copy_data(backend_scores, scores_data); - - auto handle = backend->compile(f); - - handle->call({selected_indeces, selected_scores, valid_outputs}, {backend_boxes, backend_scores}); - - auto selected_indeces_value = read_vector(selected_indeces); - auto selected_scores_value = read_vector(selected_scores); - auto valid_outputs_value = read_vector(valid_outputs); - - std::vector expected_selected_indices = {0, 0, 3, 0, 0, 0, 1, 0, 3, 1, 0, 0}; - std::vector expected_selected_scores = {0.0, 0.0, 0.95, 0.0, 0.0, 0.9, 1.0, 0.0, 0.95, 1.0, 0.0, 0.9}; - std::vector expected_valid_outputs = {4}; - - EXPECT_EQ(expected_selected_indices, selected_indeces_value); - EXPECT_EQ(expected_selected_scores, selected_scores_value); - EXPECT_EQ(expected_valid_outputs, valid_outputs_value); -} - -NGRAPH_TEST(${BACKEND_NAME}, nonmaxsuppression_two_classes) { - std::vector boxes_data = {0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, 0.0, -0.1, 1.0, 0.9, - 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0}; - - std::vector scores_data = {0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.9, 0.75, 0.6, 0.95, 0.5, 0.3}; - - const int64_t max_output_boxes_per_class_data = 2; - const float iou_threshold_data = 0.5f; - const float score_threshold_data = 0.0f; - const auto box_encoding = op::v5::NonMaxSuppression::BoxEncodingType::CORNER; - const auto boxes_shape = Shape{1, 6, 4}; - const auto scores_shape = Shape{1, 2, 6}; - - const auto boxes = make_shared(element::f32, boxes_shape); - const auto scores = make_shared(element::f32, scores_shape); - auto max_output_boxes_per_class = - op::Constant::create(element::i64, Shape{}, {max_output_boxes_per_class_data}); - auto iou_threshold = op::Constant::create(element::f32, Shape{}, {iou_threshold_data}); - auto score_threshold = op::Constant::create(element::f32, Shape{}, {score_threshold_data}); - auto soft_nms_sigma = op::Constant::create(element::f32, Shape{}, {0.0f}); - auto nms = make_shared(boxes, - scores, - max_output_boxes_per_class, - iou_threshold, - score_threshold, - soft_nms_sigma, - box_encoding, - false); - - auto f = make_shared(nms, ParameterVector{boxes, scores}); - - auto backend = runtime::Backend::create("${BACKEND_NAME}"); - - auto selected_indeces = backend->create_tensor(element::i64, Shape{4, 3}); - auto selected_scores = backend->create_tensor(element::f32, Shape{4, 3}); - auto valid_outputs = backend->create_tensor(element::i64, Shape{1}); - - auto backend_boxes = backend->create_tensor(element::f32, boxes_shape); - auto backend_scores = backend->create_tensor(element::f32, scores_shape); - copy_data(backend_boxes, boxes_data); - copy_data(backend_scores, scores_data); - - auto handle = backend->compile(f); - - handle->call({selected_indeces, selected_scores, valid_outputs}, {backend_boxes, backend_scores}); - - auto selected_indeces_value = read_vector(selected_indeces); - auto selected_scores_value = read_vector(selected_scores); - auto valid_outputs_value = read_vector(valid_outputs); - - std::vector expected_selected_indices = {0, 0, 3, 0, 0, 0, 0, 1, 3, 0, 1, 0}; - std::vector expected_selected_scores = {0.0, 0.0, 0.95, 0.0, 0.0, 0.9, 0.0, 1.0, 0.95, 0.0, 1.0, 0.9}; - std::vector expected_valid_outputs = {4}; - - EXPECT_EQ(expected_selected_indices, selected_indeces_value); - EXPECT_EQ(expected_selected_scores, selected_scores_value); - EXPECT_EQ(expected_valid_outputs, valid_outputs_value); -} - -NGRAPH_TEST(${BACKEND_NAME}, nonmaxsuppression_suppress_by_IOU_and_scores_without_constants) { - std::vector boxes_data = {0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.1f, 1.0f, 1.1f, 0.0f, -0.1f, 1.0f, 0.9f, - 0.0f, 10.0f, 1.0f, 11.0f, 0.0f, 10.1f, 1.0f, 11.1f, 0.0f, 100.0f, 1.0f, 101.0f}; - - std::vector scores_data = {0.9f, 0.75f, 0.6f, 0.95f, 0.5f, 0.3f}; - - std::vector max_output_boxes_per_class_data = {1}; - std::vector iou_threshold_data = {0.4f}; - std::vector score_threshold_data = {0.2f}; - const auto box_encoding = op::v5::NonMaxSuppression::BoxEncodingType::CORNER; - const auto boxes_shape = Shape{1, 6, 4}; - const auto scores_shape = Shape{1, 1, 6}; - - const auto boxes = make_shared(element::f32, boxes_shape); - const auto scores = make_shared(element::f32, scores_shape); - const auto max_output_boxes_per_class = make_shared(element::i64, Shape{1}); - const auto score_treshold = make_shared(element::f32, Shape{1}); - const auto iou_threshold = make_shared(element::f32, Shape{1}); - const auto soft_nms_sigma = make_shared(element::f32, Shape{1}); - - auto nms = make_shared(boxes, - scores, - max_output_boxes_per_class, - iou_threshold, - score_treshold, - soft_nms_sigma, - box_encoding, - false); - - auto f = make_shared( - nms, - ParameterVector{boxes, scores, max_output_boxes_per_class, iou_threshold, score_treshold, soft_nms_sigma}); - - auto backend = runtime::Backend::create("${BACKEND_NAME}"); - - auto selected_indeces = backend->create_tensor(element::i64, Shape{1, 3}); - auto selected_scores = backend->create_tensor(element::f32, Shape{1, 3}); - auto valid_outputs = backend->create_tensor(element::i64, Shape{1}); - - auto backend_boxes = backend->create_tensor(element::f32, boxes_shape); - auto backend_scores = backend->create_tensor(element::f32, scores_shape); - auto backend_max_output_boxes_per_class = backend->create_tensor(element::i64, {1}); - auto backend_iou_threshold = backend->create_tensor(element::f32, {1}); - auto backend_score_threshold = backend->create_tensor(element::f32, {1}); - auto backend_soft_nms_sigma = backend->create_tensor(element::f32, {1}); - copy_data(backend_boxes, boxes_data); - copy_data(backend_scores, scores_data); - copy_data(backend_max_output_boxes_per_class, max_output_boxes_per_class_data); - copy_data(backend_iou_threshold, iou_threshold_data); - copy_data(backend_score_threshold, score_threshold_data); - copy_data(backend_soft_nms_sigma, std::vector(0.0)); - - auto handle = backend->compile(f); - - handle->call({selected_indeces, selected_scores, valid_outputs}, - {backend_boxes, - backend_scores, - backend_max_output_boxes_per_class, - backend_iou_threshold, - backend_score_threshold, - backend_soft_nms_sigma}); - - auto selected_indeces_value = read_vector(selected_indeces); - auto selected_scores_value = read_vector(selected_scores); - auto valid_outputs_value = read_vector(valid_outputs); - - std::vector expected_selected_indices = {0, 0, 3}; - std::vector expected_selected_scores = {0.0f, 0.0f, 0.95f}; - std::vector expected_valid_outputs = {1}; - - EXPECT_EQ(expected_selected_indices, selected_indeces_value); - EXPECT_EQ(expected_selected_scores, selected_scores_value); - EXPECT_EQ(expected_valid_outputs, valid_outputs_value); -} diff --git a/ngraph/test/type_prop/prior_box.cpp b/ngraph/test/type_prop/prior_box.cpp deleted file mode 100644 index 251ad801794..00000000000 --- a/ngraph/test/type_prop/prior_box.cpp +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (C) 2018-2021 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#include "ngraph/op/prior_box.hpp" - -#include "gtest/gtest.h" -#include "ngraph/ngraph.hpp" - -using namespace ngraph; - -TEST(type_prop, prior_box1) { - op::PriorBoxAttrs attrs; - attrs.min_size = {2.0f, 3.0f}; - attrs.aspect_ratio = {1.5f, 2.0f, 2.5f}; - attrs.scale_all_sizes = false; - - auto layer_shape = op::Constant::create(element::i64, Shape{2}, {32, 32}); - auto image_shape = op::Constant::create(element::i64, Shape{2}, {300, 300}); - auto pb = std::make_shared(layer_shape, image_shape, attrs); - ASSERT_EQ(pb->get_shape(), (Shape{2, 20480})); -} - -TEST(type_prop, prior_box2) { - op::PriorBoxAttrs attrs; - attrs.min_size = {2.0f, 3.0f}; - attrs.aspect_ratio = {1.5f, 2.0f, 2.5f}; - attrs.flip = true; - attrs.scale_all_sizes = false; - - auto layer_shape = op::Constant::create(element::i64, Shape{2}, {32, 32}); - auto image_shape = op::Constant::create(element::i64, Shape{2}, {300, 300}); - auto pb = std::make_shared(layer_shape, image_shape, attrs); - ASSERT_EQ(pb->get_shape(), (Shape{2, 32768})); -} - -TEST(type_prop, prior_box3) { - op::PriorBoxAttrs attrs; - attrs.min_size = {256.0f}; - attrs.max_size = {315.0f}; - attrs.aspect_ratio = {2.0f}; - attrs.flip = true; - - auto layer_shape = op::Constant::create(element::i64, Shape{2}, {1, 1}); - auto image_shape = op::Constant::create(element::i64, Shape{2}, {300, 300}); - auto pb = std::make_shared(layer_shape, image_shape, attrs); - ASSERT_EQ(pb->get_shape(), (Shape{2, 16})); -} \ No newline at end of file diff --git a/ngraph/test/util/unit-test-execution/README.md b/ngraph/test/util/unit-test-execution/README.md deleted file mode 100644 index f6bb6b52538..00000000000 --- a/ngraph/test/util/unit-test-execution/README.md +++ /dev/null @@ -1,24 +0,0 @@ -These test executes 'unit-test'. - -To run please do the following: -1. To run tests required installing some dependencies: - - pip3 install -r requirements.txt -2. Set environment variable: - a. Required: - export PATH_TO_EXE= -3. To run all tests: - a. cd folder where unit_test_executable.py locates - b. pytest --gtest_filter="*" -4. To run exact test: - a. cd folder where unit_test_executable.py locates - b. pytest --gtest_filter="" -5. To get html report add "--html=report.html" to pytest cmd line - (but before install this module "pip install pytest-html") -6.This test get result of opset1 operation (passed and failed) and also creates csv file 'nodes_coverage.csv' and - 'nodes_coverage.html' after execution. Here you may find name of operations and its passrate and coverage - for several plugins. - Example: - Operation | GPU passed / total | CPU passed / total - Abs | 1/2 | 1/2 - - Here operation 'Abs': 1 test of 2 passed on GPU and CPU \ No newline at end of file diff --git a/ngraph/test/util/unit-test-execution/conftest.py b/ngraph/test/util/unit-test-execution/conftest.py deleted file mode 100644 index 796e74b3f40..00000000000 --- a/ngraph/test/util/unit-test-execution/conftest.py +++ /dev/null @@ -1,96 +0,0 @@ -# Copyright (C) 2018-2021 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 - -import logging as log -import sys -import subprocess -import os -import pytest - - -def pytest_addoption(parser): - parser.addoption( - "--gtest_filter", - help="Attributes to gtest", - type=str, - required=True, - ) - - -@pytest.fixture(scope="session") -def gtest_filter(request): - return request.config.getoption('gtest_filter') - - -def shell(cmd, env=None): - """ - Run command execution in specified environment - :param cmd: list containing command and its parameters - :param env: set of environment variables to set for this command - :return: - """ - if sys.platform.startswith('linux') or sys.platform == 'darwin': - cmd = ['/bin/bash', '-c', "unset OMP_NUM_THREADS; " + cmd] - else: - cmd = " ".join(cmd) - - sys.stdout.write("Running command:\n" + "".join(cmd) + "\n") - p = subprocess.Popen(cmd, env=env, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, - universal_newlines=True) - stdout = [] - while True: - line = p.stdout.readline() - stdout.append(line) - print(line.rstrip()) - if line == '' and p.poll() != None: - break - return p.returncode, ''.join(stdout) - - -def create_list_test(stdout): - # Example of stdout content: - # 'CPU' - # ' zero_sized_abs' - # ' zero_sized_ceiling' - # ... - # So, list of test will be concatenation of 'CPU' and the second part (starting with ' '): - # 'CPU.zero_sized_abs' - # 'CPU.zero_sized_ceiling' - list_test = [] - first_name, second_name = [''] * 2 - for line in stdout: - if not line.startswith(' '): - first_name = line - else: - second_name = line - # Several test has gtest mark 'DISABLED' inside test - no test will be executed - if not 'DISABLED' in line: - list_test.append(first_name + second_name.strip()) - return list_test - - -def pytest_generate_tests(metafunc): - gtest_filter = metafunc.config.getoption(name='gtest_filter') - if 'gtest_filter' in metafunc.fixturenames and gtest_filter is not None: - executable = os.path.join(os.environ.get('PATH_TO_EXE'), "unit-test") - cmd_line = executable + ' --gtest_filter=' + gtest_filter + ' --gtest_list_tests' - log.info('Executing {} for getting list of test'.format(executable)) - retcode, stdout = shell(cmd=cmd_line) - assert retcode == 0, "unit-test --gtest_list_tests execution failed. Return code: {}".format(retcode) - stdout = stdout.split('\n') - list_test = create_list_test(stdout) - - # Find all opset1 operations: execute test 'opset.dump' - cmd_line_all_op = executable + ' --gtest_filter=opset.dump' - log.info('Executing {} for getting list of test'.format(cmd_line_all_op)) - retcode_op1, stdout_op1 = shell(cmd=cmd_line_all_op) - assert retcode_op1 == 0, "unit-test --gtest_filter=opset.dump execution failed. Return code: {}".format(retcode) - # Parsing stdout to storing name of opset1 operations - stdout_op1 = stdout_op1.split('\n') - operation_opset1 = [] - for line in stdout_op1: - if 'All opset1 operations:' in line: - operation_opset1 = list(set(line.replace('All opset1 operations:', '').strip().split(' '))) - for op in operation_opset1: - pytest.operation_dictionary[op] = {} - metafunc.parametrize(argnames="gtest_filter", argvalues=list_test) diff --git a/ngraph/test/util/unit-test-execution/requirements.txt b/ngraph/test/util/unit-test-execution/requirements.txt deleted file mode 100644 index 55b033e901c..00000000000 --- a/ngraph/test/util/unit-test-execution/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -pytest \ No newline at end of file diff --git a/ngraph/test/util/unit-test-execution/unit_test_executable.py b/ngraph/test/util/unit-test-execution/unit_test_executable.py deleted file mode 100644 index 173d973f089..00000000000 --- a/ngraph/test/util/unit-test-execution/unit_test_executable.py +++ /dev/null @@ -1,143 +0,0 @@ -# Copyright (C) 2018-2021 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 - -import logging as log -import sys -import os -import csv -import pytest -import re -from conftest import shell - -log.basicConfig(format="[ %(levelname)s ] %(msg)s", stream=sys.stdout, level=log.INFO) - -pytest.operation_dictionary = {} -pytest.avaliable_plugins = [] - - -def save_coverage_to_csv(csv_path, header): - with open(csv_path, 'w', newline='') as f: - csv_writer = csv.writer(f, delimiter='|', quotechar='|', quoting=csv.QUOTE_MINIMAL) - csv_writer.writerow(i for i in header) - i = 1 - for key in sorted(pytest.operation_dictionary): - line = [i, key] - for plugin in pytest.avaliable_plugins: - if not plugin in pytest.operation_dictionary[key]: - line.append('0/0') - else: - line.append('/'.join(str(x) for x in pytest.operation_dictionary[key][plugin])) - csv_writer.writerow(line) - i += 1 - - -def get_color(value): - if '/' in value: - passed, total = [int(x.strip()) for x in value.split('/')] - if passed == total and total != 0: - return "#d1ffd3" - elif passed == total and total == 0: - return "#dadada" - else: - return "#ffdbdb" - else: - return "white" - - -def csv_to_html_table(csv_path, html_path, headers=None, delimiter=","): - with open(csv_path) as f: - content = f.readlines() - - # reading file content into list - rows = [x.strip() for x in content] - table = "Opset1 operations results" - - # creating HTML header row if header is provided - if headers is not None: - table += "" - table += "".join(["" for cell in headers]) - table += "" - else: - table += "" - table += "".join(["" for cell in rows[0].split(delimiter)]) - table += "" - rows = rows[1:] - - # Converting csv to html row by row - for row in rows: - table += "" + "".join(["" - for cell in row.split(delimiter)]) + "" + "\n" - table += "
" + cell + "
" + cell + "
" % (get_color(cell)) + cell + "

" - - # Saving html file - fh = open(html_path, "w") - fh.write(table) - fh.close() - - -def setup_module(): - try: - os.environ.get('PATH_TO_EXE') - except KeyError: - raise ImportError('PATH_TO_EXE is upsent in your environment variables. ' - 'Please, do "export PATH_TO_EXE=') - - -def teardown_module(): - """ - Creating CSV file at the end of test with nGraph nodes coverage - :return: - """ - csv_path = "nodes_coverage.csv" - header = ["#", "Operation"] + [p + " passed / total" for p in pytest.avaliable_plugins] - save_coverage_to_csv(csv_path=csv_path, header=header) - - # Convert csv file to html for better visualization - html_path = "nodes_coverage.html" - csv_to_html_table(csv_path=csv_path, html_path=html_path, delimiter="|") - - -def test(gtest_filter): - executable = os.path.join(os.environ.get('PATH_TO_EXE'), "unit-test") - cmd_line = executable + ' --gtest_filter=' + gtest_filter - retcode, stdout = shell(cmd=cmd_line) - - # Parsing output of single test - stdout = stdout.split('\n') - nodes_list = [] - for line in stdout: - if 'UNSUPPORTED OPS DETECTED!' in line: - pytest.skip('Skip from pytest because unit-test send error UNSUPPORTED OPS DETECTED!') - elif 'Nodes in test:' in line: - nodes_list = list(set(line.replace('Nodes in test:', '').strip().split(' '))) - - if not nodes_list: - pytest.skip('Skip from pytest because inside test no one ngraph function created') - - # Added one more loop, because condition below must be executed only if some nodes_list found - # (it means that test includes opset1 operations) - for line in stdout: - if re.match('.*1 test from\s([A-Z]+)', line): - matches = re.search(r'.*1 test from\s([A-Z]+)', line) - plugin = matches.group(1) - if plugin not in pytest.avaliable_plugins: - pytest.avaliable_plugins.append(plugin) - - # Filling dictionary with operation coverage - # How many time one operation is tested - for n in nodes_list: - if plugin in pytest.operation_dictionary[n]: - numerator, denominator = pytest.operation_dictionary[n][plugin] - pytest.operation_dictionary[n][plugin] = (numerator if retcode != 0 else numerator + 1, - denominator + 1) - else: - pytest.operation_dictionary[n][plugin] = (0, 1) if retcode != 0 else (1, 1) - - # This check is at the end, because with 99% it will return 0 or 1 (when function check of test failed) - # Because the same cmd line executed by pytest_generate_tests with --gtest_list_tests. - # So, most of the issue cached there. - assert retcode == 0, "unit-test execution failed. Gtest failed. Return code: {}".format(retcode) - - -if __name__ == '__main__': - log.warning("Please run {} by pytest like so:\npytest {} --gtest_filter=") diff --git a/openvino/CMakeLists.txt b/openvino/CMakeLists.txt deleted file mode 100644 index e13df8efbf0..00000000000 --- a/openvino/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -# Copyright (C) 2018-2021 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 -# - -add_subdirectory(pp) -add_subdirectory(itt) -add_subdirectory(conditional_compilation) -add_subdirectory(util) - -openvino_developer_export_targets(COMPONENT openvino_common TARGETS openvino::pp openvino::itt openvino::conditional_compilation) diff --git a/openvino/pp/CMakeLists.txt b/openvino/pp/CMakeLists.txt deleted file mode 100644 index e2060db6b3f..00000000000 --- a/openvino/pp/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright (C) 2018-2021 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 -# - -set(TARGET_NAME openvino_preprocessor) - -add_library(${TARGET_NAME} INTERFACE) - -add_library(openvino::pp ALIAS ${TARGET_NAME}) - -target_include_directories(${TARGET_NAME} INTERFACE - $) - -ov_install_static_lib(${TARGET_NAME} ngraph) diff --git a/openvino/pp/include/openvino/pp.hpp b/openvino/pp/include/openvino/pp.hpp deleted file mode 100644 index 6931c8f1845..00000000000 --- a/openvino/pp/include/openvino/pp.hpp +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (C) 2018-2021 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -/** - * @brief Set of macro used by openvino - * @file pp.hpp - */ - -#pragma once - -// Macros for string conversion -#define OV_PP_TOSTRING(...) OV_PP_TOSTRING_(__VA_ARGS__) -#define OV_PP_TOSTRING_(...) #__VA_ARGS__ - -#define OV_PP_EXPAND(X) X - -#define OV_PP_NARG(...) OV_PP_EXPAND( OV_PP_NARG_(__VA_ARGS__, OV_PP_RSEQ_N()) ) -#define OV_PP_NARG_(...) OV_PP_EXPAND( OV_PP_ARG_N(__VA_ARGS__) ) -#define OV_PP_ARG_N(_0, _1, _2, _3, _4, N, ...) N -#define OV_PP_RSEQ_N() 0, 4, 3, 2, 1, 0 -#define OV_PP_NO_ARGS(NAME) ,,,, - -// Macros for names concatenation -#define OV_PP_CAT_(x, y) x ## y -#define OV_PP_CAT(x, y) OV_PP_CAT_(x, y) -#define OV_PP_CAT3_(x, y, z) x ## y ## z -#define OV_PP_CAT3(x, y, z) OV_PP_CAT3_(x, y, z) -#define OV_PP_CAT4_(x, y, z, w) x ## y ## z ## w -#define OV_PP_CAT4(x, y, z, w) OV_PP_CAT4_(x, y, z, w) - -#define OV_PP_OVERLOAD(NAME, ...) OV_PP_EXPAND( OV_PP_CAT3(NAME, _, OV_PP_EXPAND( OV_PP_NARG(OV_PP_NO_ARGS __VA_ARGS__ (NAME)) ))(__VA_ARGS__) ) - -// Placeholder for first macro argument -#define OV_PP_ARG_PLACEHOLDER_1 0, - -// This macro returns second argument, first argument is ignored -#define OV_PP_SECOND_ARG(...) OV_PP_EXPAND(OV_PP_SECOND_ARG_(__VA_ARGS__, 0)) -#define OV_PP_SECOND_ARG_(...) OV_PP_EXPAND(OV_PP_SECOND_ARG_GET(__VA_ARGS__)) -#define OV_PP_SECOND_ARG_GET(ignored, val, ...) val - -// Return macro argument value -#define OV_PP_IS_ENABLED(x) OV_PP_IS_ENABLED1(x) - -// Generate junk macro or {0, } sequence if val is 1 -#define OV_PP_IS_ENABLED1(val) OV_PP_IS_ENABLED2(OV_PP_CAT(OV_PP_ARG_PLACEHOLDER_, val)) - -// Return second argument from possible sequences {1, 0}, {0, 1, 0} -#define OV_PP_IS_ENABLED2(arg1_or_junk) OV_PP_SECOND_ARG(arg1_or_junk 1, 0) diff --git a/runtime/bindings/python/src/compatibility/pyngraph/variant.cpp b/runtime/bindings/python/src/compatibility/pyngraph/variant.cpp deleted file mode 100644 index 602954fee14..00000000000 --- a/runtime/bindings/python/src/compatibility/pyngraph/variant.cpp +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (C) 2018-2021 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#include "ngraph/variant.hpp" // ngraph::Variant - -#include - -#include "pyngraph/variant.hpp" - -namespace py = pybind11; - -void regclass_pyngraph_Variant(py::module m) { - py::class_> variant_base(m, "Variant", py::module_local()); - variant_base.doc() = "ngraph.impl.Variant wraps ngraph::Variant"; -} - -template void regclass_pyngraph_VariantWrapper(py::module m, std::string typestring); -template void regclass_pyngraph_VariantWrapper(py::module m, std::string typestring); diff --git a/runtime/bindings/python/src/compatibility/pyngraph/variant.hpp b/runtime/bindings/python/src/compatibility/pyngraph/variant.hpp deleted file mode 100644 index 7041f5cd0ce..00000000000 --- a/runtime/bindings/python/src/compatibility/pyngraph/variant.hpp +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (C) 2018-2021 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#pragma once - -#include -#include - -#include -#include - -#include "ngraph/variant.hpp" // ngraph::Variant - -namespace py = pybind11; - -void regclass_pyngraph_Variant(py::module m); - -template -extern void regclass_pyngraph_VariantWrapper(py::module m, std::string typestring) -{ - auto pyclass_name = py::detail::c_str((std::string("Variant") + typestring)); - py::class_, - std::shared_ptr>, - ngraph::Variant> - variant_wrapper(m, pyclass_name, py::module_local()); - variant_wrapper.doc() = - "ngraph.impl.Variant[typestring] wraps ngraph::VariantWrapper"; - - variant_wrapper.def(py::init()); - - variant_wrapper.def( - "__eq__", - [](const ngraph::VariantWrapper& a, const ngraph::VariantWrapper& b) { - return a.get() == b.get(); - }, - py::is_operator()); - variant_wrapper.def( - "__eq__", - [](const ngraph::VariantWrapper& a, const std::string& b) { - return a.get() == b; - }, - py::is_operator()); - variant_wrapper.def( - "__eq__", - [](const ngraph::VariantWrapper& a, const int64_t& b) { return a.get() == b; }, - py::is_operator()); - - variant_wrapper.def("__repr__", [](const ngraph::VariantWrapper self) { - std::stringstream ret; - ret << self.get(); - return ret.str(); - }); - - variant_wrapper.def("get", - (VT & (ngraph::VariantWrapper::*)()) & ngraph::VariantWrapper::get, - R"( - Returns - ---------- - get : Variant - Value of Variant. - )"); - variant_wrapper.def("set", - &ngraph::VariantWrapper::set, - R"( - Parameters - ---------- - set : str or int - Value to be set in Variant. - )"); - - variant_wrapper.def_property("value", - (VT & (ngraph::VariantWrapper::*)()) & - ngraph::VariantWrapper::get, - &ngraph::VariantWrapper::set); -} diff --git a/runtime/bindings/python/src/pyopenvino/graph/preprocess/pre_post_process.cpp b/runtime/bindings/python/src/pyopenvino/graph/preprocess/pre_post_process.cpp deleted file mode 100644 index 2bc775c1dfc..00000000000 --- a/runtime/bindings/python/src/pyopenvino/graph/preprocess/pre_post_process.cpp +++ /dev/null @@ -1,540 +0,0 @@ -// Copyright (C) 2021 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#include "pyopenvino/graph/preprocess/pre_post_process.hpp" - -#include -#include - -#include "openvino/core/function.hpp" -#include "openvino/core/node.hpp" -#include "openvino/core/preprocess/pre_post_process.hpp" - -namespace py = pybind11; - -static void regclass_graph_PreProcessSteps(py::module m) { - py::class_> steps( - m, - "PreProcessSteps"); - steps.doc() = "openvino.impl.preprocess.PreProcessSteps wraps ov::preprocess::PreProcessSteps"; - - steps.def(py::init<>()); - - steps.def( - "mean", - [](const std::shared_ptr& me, float value) { - me->mean(value); - return me; - }, - py::arg("value"), - R"( - Subtracts single float value from each element in input tensor. - Input tensor must have ov.Type.f32 data type. - Parameters - ---------- - value : float - Value to subtract. - Returns - ---------- - mean : PreProcessSteps - Reference to itself to allow chaining of calls in client's code in a builder-like manner. - )"); - steps.def( - "mean", - [](const std::shared_ptr& me, const std::vector& values) { - me->mean(values); - return me; - }, - py::arg("values"), - R"( - Subtracts a given single float value from each element in a given channel from input tensor. - Input tensor must have ov.Type.f32 data type. - Parameters - ---------- - values : List - Values to subtract. - Returns - ---------- - mean : PreProcessSteps - Reference to itself to allow chaining of calls in client's code in a builder-like manner. - )"); - steps.def( - "scale", - [](const std::shared_ptr& me, float value) { - me->scale(value); - return me; - }, - py::arg("value"), - R"( - Divides each element in input tensor by specified constant float value. - Input tensor must have ov.Type.f32 data type. - Parameters - ---------- - value : float - Value to divide. - Returns - ---------- - scale : PreProcessSteps - Reference to itself to allow chaining of calls in client's code in a builder-like manner. - )"); - steps.def( - "scale", - [](const std::shared_ptr& me, const std::vector& values) { - me->scale(values); - return me; - }, - py::arg("values"), - R"( - Divides each element in a given channel from input tensor by a given single float value. - Input tensor must have ov.Type.f32 data type. - Parameters - ---------- - value : List - Value to divide. - Returns - ---------- - scale : PreProcessSteps - Reference to itself to allow chaining of calls in client's code in a builder-like manner. - )"); - steps.def( - "convert_element_type", - [](const std::shared_ptr& me, ov::element::Type type) { - me->convert_element_type(type); - return me; - }, - py::arg("type"), - R"( - Converts input tensor element type to specified type. - Input tensor must have openvino.Type.f32 data type. - Parameters - ---------- - type : Type - Destination type. - Returns - ---------- - convert_element_type : PreProcessSteps - Reference to itself to allow chaining of calls in client's code in a builder-like manner. - )"); - steps.def( - "custom", - [](const std::shared_ptr& me, py::function op) { - me->custom(op.cast()); - return me; - }, - py::arg("operation"), - R"( - Adds custom preprocessing operation. - Parameters - ---------- - operation : function taking Output as input argument and returning Output after preprocessing. - Returns - ---------- - custom : PreProcessSteps - Reference to itself to allow chaining of calls in client's code in a builder-like manner. - )"); - steps.def( - "convert_color", - [](const std::shared_ptr& me, const ov::preprocess::ColorFormat& dst_format) { - me->convert_color(dst_format); - return me; - }, - py::arg("dst_format")); - steps.def( - "resize", - [](const std::shared_ptr& me, - ov::preprocess::ResizeAlgorithm alg, - size_t dst_height, - size_t dst_width) { - me->resize(alg, dst_height, dst_width); - return me; - }, - py::arg("alg"), - py::arg("dst_height"), - py::arg("dst_width")); - steps.def( - "resize", - [](const std::shared_ptr& me, ov::preprocess::ResizeAlgorithm alg) { - me->resize(alg); - return me; - }, - py::arg("alg")); - steps.def( - "convert_layout", - [](const std::shared_ptr& me, const ov::Layout& layout = {}) { - me->convert_layout(layout); - return me; - }, - py::arg("dst_layout")); - steps.def( - "convert_layout", - [](const std::shared_ptr& me, const std::vector& dims) { - me->convert_layout(dims); - return me; - }, - py::arg("dims")); - steps.def("reverse_channels", [](const std::shared_ptr& me) { - me->reverse_channels(); - return me; - }); -} - -static void regclass_graph_PostProcessSteps(py::module m) { - py::class_> steps( - m, - "PostProcessSteps"); - steps.doc() = "openvino.impl.preprocess.PostprocessSteps wraps ov::preprocess::PostProcessSteps"; - - steps.def(py::init<>()); - - steps.def( - "convert_element_type", - [](const std::shared_ptr& me, ov::element::Type type) { - me->convert_element_type(type); - return me; - }, - py::arg("type"), - R"( - Converts tensor element type to specified type. - Tensor must have openvino.Type.f32 data type. - Parameters - ---------- - type : Type - Destination type. - Returns - ---------- - convert_element_type : PostProcessSteps - Reference to itself to allow chaining of calls in client's code in a builder-like manner. - )"); - steps.def( - "convert_layout", - [](const std::shared_ptr& me, const ov::Layout& layout = {}) { - me->convert_layout(layout); - return me; - }, - py::arg("dst_layout")); - steps.def( - "convert_layout", - [](const std::shared_ptr& me, const std::vector& dims) { - me->convert_layout(dims); - return me; - }, - py::arg("dims")); - steps.def( - "custom", - [](const std::shared_ptr& me, py::function op) { - me->custom(op.cast()); - return me; - }, - py::arg("operation"), - R"( - Adds custom postprocessing operation. - Parameters - ---------- - operation : function taking Output as input argument and returning Output after postprocessing. - Returns - ---------- - custom : PostProcessSteps - Reference to itself to allow chaining of calls in client's code in a builder-like manner. - )"); -} - -static void regclass_graph_InputTensorInfo(py::module m) { - py::class_> info( - m, - "InputTensorInfo"); - info.doc() = "openvino.impl.preprocess.InputTensorInfo wraps ov::preprocess::InputTensorInfo"; - - info.def(py::init<>()); - - info.def( - "set_element_type", - [](const std::shared_ptr& me, const ov::element::Type& type) { - me->set_element_type(type); - return me; - }, - py::arg("type"), - R"( - Set initial client's tensor element type. If type is not the same as network's element type, - conversion of element type will be done automatically. - Parameters - ---------- - type : Type - Client's input tensor element type. - Returns - ---------- - tensor : InputTensorInfo - Reference to itself to allow chaining of calls in client's code in a builder-like manner. - )"); - info.def("set_layout", [](const std::shared_ptr& me, const ov::Layout& layout) { - me->set_layout(layout); - return me; - }); - info.def("set_spatial_dynamic_shape", [](const std::shared_ptr& me) { - me->set_spatial_dynamic_shape(); - return me; - }); - info.def("set_spatial_static_shape", - [](const std::shared_ptr& me, size_t height, size_t width) { - me->set_spatial_static_shape(height, width); - return me; - }); - info.def("set_color_format", - [](const std::shared_ptr& me, - const ov::preprocess::ColorFormat& format, - const std::vector& sub_names = {}) { - me->set_color_format(format, sub_names); - return me; - }); -} - -static void regclass_graph_OutputTensorInfo(py::module m) { - py::class_> info( - m, - "OutputTensorInfo"); - info.doc() = "openvino.impl.preprocess.OutputTensorInfo wraps ov::preprocess::OutputTensorInfo"; - - info.def(py::init<>()); - - info.def( - "set_element_type", - [](const std::shared_ptr& me, const ov::element::Type& type) { - me->set_element_type(type); - return me; - }, - py::arg("type"), - R"( - Set client's output tensor element type. If type is not the same as network's element type, - conversion of element type will be done automatically. - Parameters - ---------- - type : Type - Client's output tensor element type. - Returns - ---------- - tensor : OutputTensorInfo - Reference to itself to allow chaining of calls in client's code in a builder-like manner. - )"); - info.def("set_layout", [](const std::shared_ptr& me, const ov::Layout& layout) { - me->set_layout(layout); - return me; - }); -} - -static void regclass_graph_InputInfo(py::module m) { - py::class_> inp(m, "InputInfo"); - inp.doc() = "openvino.impl.preprocess.InputInfo wraps ov::preprocess::InputInfo"; - - inp.def(py::init<>(), R"(Default constructor, can be used only for networks with exactly one input)"); - inp.def(py::init(), R"(Constructor with parameter index as argument)"); - inp.def(py::init(), R"(Constructor with input tensor name as argument)"); - - inp.def( - "tensor", - [](const std::shared_ptr& me, - const std::shared_ptr& inputTensorInfo) { - me->tensor(std::move(*inputTensorInfo)); - return me; - }, - py::arg("tensor"), - R"( - Adds builder for actual tensor information of client's input. - Parameters - ---------- - tensor : InputTensorInfo - Client's input tensor information. It's internal data will be moved to parent InputInfo object. - Returns - ---------- - tensor : InputInfo - Reference to itself to allow chaining of calls in client's code in a builder-like manner. - )"); - inp.def( - "preprocess", - [](const std::shared_ptr& me, - const std::shared_ptr& preProcessSteps) { - me->preprocess(std::move(*preProcessSteps)); - return me; - }, - py::arg("pre_process_steps"), - R"( - Adds builder for actual preprocessing steps for input parameter. - Steps can specify various actions, like 'mean', 'scale' and others. - Parameters - ---------- - pre_process_steps : PreProcessSteps - Preprocessing steps. It's internal data will be moved to parent InputInfo object. - Returns - ---------- - preprocess : InputInfo - Reference to itself to allow chaining of calls in client's code in a builder-like manner. - )"); - inp.def( - "network", - [](const std::shared_ptr& me, - const std::shared_ptr& inputNetworkInfo) { - me->network(std::move(*inputNetworkInfo)); - return me; - }, - py::arg("input_network_info")); -} - -static void regclass_graph_OutputInfo(py::module m) { - py::class_> out(m, "OutputInfo"); - out.doc() = "openvino.impl.preprocess.OutputInfo wraps ov::preprocess::OutputInfo"; - - out.def(py::init<>(), R"(Default constructor, can be used only for networks with exactly one output)"); - out.def(py::init(), R"(Constructor with parameter index as argument)"); - out.def(py::init(), R"(Constructor with tensor name as argument)"); - - out.def( - "tensor", - [](const std::shared_ptr& me, - const std::shared_ptr& outputTensorInfo) { - me->tensor(std::move(*outputTensorInfo)); - return me; - }, - py::arg("tensor"), - R"( - Adds builder for actual tensor information of client's output. - Parameters - ---------- - tensor : OutputTensorInfo - Client's output tensor information. It's internal data will be moved to parent OutputInfo object. - Returns - ---------- - tensor : OutputInfo - Reference to itself to allow chaining of calls in client's code in a builder-like manner. - )"); - out.def( - "postprocess", - [](const std::shared_ptr& me, - const std::shared_ptr& postProcessSteps) { - me->postprocess(std::move(*postProcessSteps)); - return me; - }, - py::arg("post_process_steps"), - R"( - Adds builder for actual postprocessing steps for output parameter. - Parameters - ---------- - post_process_steps : PostProcessSteps - Postprocessing steps. It's internal data will be moved to parent OutputInfo object. - Returns - ---------- - preprocess : OutputInfo - Reference to itself to allow chaining of calls in client's code in a builder-like manner. - )"); - out.def( - "network", - [](const std::shared_ptr& me, - const std::shared_ptr& outputNetworkInfo) { - me->network(std::move(*outputNetworkInfo)); - return me; - }, - py::arg("output_network_info")); -} - -static void regclass_graph_OutputNetworkInfo(py::module m) { - py::class_> info( - m, - "OutputNetworkInfo"); - info.doc() = "openvino.impl.preprocess.OutputNetworkInfo wraps ov::preprocess::OutputNetworkInfo"; - - info.def(py::init<>()); - - info.def("set_layout", [](const std::shared_ptr& me, const ov::Layout& layout) { - me->set_layout(layout); - return me; - }); -} - -static void regclass_graph_InputNetworkInfo(py::module m) { - py::class_> info( - m, - "InputNetworkInfo"); - info.doc() = "openvino.impl.preprocess.InputNetworkInfo wraps ov::preprocess::InputNetworkInfo"; - - info.def(py::init<>()); - - info.def("set_layout", [](const std::shared_ptr& me, const ov::Layout& layout) { - me->set_layout(layout); - return me; - }); -} - -static void regenum_graph_ColorFormat(py::module m) { - py::enum_(m, "ColorFormat") - .value("UNDEFINED", ov::preprocess::ColorFormat::UNDEFINED) - .value("NV12_SINGLE_PLANE", ov::preprocess::ColorFormat::NV12_SINGLE_PLANE) - .value("NV12_TWO_PLANES", ov::preprocess::ColorFormat::NV12_TWO_PLANES) - .value("RGB", ov::preprocess::ColorFormat::RGB) - .value("BGR", ov::preprocess::ColorFormat::BGR) - .export_values(); -} - -static void regenum_graph_ResizeAlgorithm(py::module m) { - py::enum_(m, "ResizeAlgorithm") - .value("RESIZE_LINEAR", ov::preprocess::ResizeAlgorithm::RESIZE_LINEAR) - .value("RESIZE_CUBIC", ov::preprocess::ResizeAlgorithm::RESIZE_CUBIC) - .value("RESIZE_NEAREST", ov::preprocess::ResizeAlgorithm::RESIZE_NEAREST) - .export_values(); -} - -void regclass_graph_PrePostProcessor(py::module m) { - regclass_graph_PreProcessSteps(m); - regclass_graph_PostProcessSteps(m); - regclass_graph_InputInfo(m); - regclass_graph_OutputInfo(m); - regclass_graph_InputTensorInfo(m); - regclass_graph_OutputTensorInfo(m); - regclass_graph_InputNetworkInfo(m); - regclass_graph_OutputNetworkInfo(m); - regenum_graph_ColorFormat(m); - regenum_graph_ResizeAlgorithm(m); - py::class_> proc( - m, - "PrePostProcessor"); - proc.doc() = "openvino.impl.preprocess.PrePostProcessor wraps ov::preprocess::PrePostProcessor"; - - proc.def(py::init&>()); - - proc.def( - "input", - [](const std::shared_ptr& me, - const std::shared_ptr& info) { - me->input(std::move(*info)); - return me; - }, - py::arg("input_info"), - R"( - Adds builder for preprocessing info for input parameter. - Parameters - ---------- - input_info : InputInfo - Preprocessing info for input parameter. It's internal data will be moved to PreProcessing object. - Returns - ---------- - in : PrePostProcessor - Reference to itself to allow chaining of calls in client's code. - )"); - proc.def( - "output", - [](const std::shared_ptr& me, - const std::shared_ptr& info) { - me->output(std::move(*info)); - return me; - }, - py::arg("output_info"), - R"( - Adds builder for preprocessing info for output parameter. - Parameters - ---------- - output_info : OutputInfo - Preprocessing info for output parameter. It's internal data will be moved to PreProcessing object. - Returns - ---------- - in : PrePostProcessor - Reference to itself to allow chaining of calls in client's code. - )"); - proc.def("build", &ov::preprocess::PrePostProcessor::build); -} diff --git a/runtime/bindings/python/src/pyopenvino/graph/variant.cpp b/runtime/bindings/python/src/pyopenvino/graph/variant.cpp deleted file mode 100644 index 407b3965797..00000000000 --- a/runtime/bindings/python/src/pyopenvino/graph/variant.cpp +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (C) 2018-2021 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#include "openvino/core/variant.hpp" // ov::Variant - -#include - -#include "pyopenvino/graph/variant.hpp" - -namespace py = pybind11; - -void regclass_graph_Variant(py::module m) { - py::class_> variant_base(m, "Variant"); - variant_base.doc() = "openvino.impl.Variant wraps ov::Variant"; -} - -template void regclass_graph_VariantWrapper(py::module m, std::string typestring); -template void regclass_graph_VariantWrapper(py::module m, std::string typestring); diff --git a/runtime/bindings/python/src/pyopenvino/graph/variant.hpp b/runtime/bindings/python/src/pyopenvino/graph/variant.hpp deleted file mode 100644 index 6d4bc06f0f5..00000000000 --- a/runtime/bindings/python/src/pyopenvino/graph/variant.hpp +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (C) 2018-2021 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#pragma once - -#include -#include - -#include -#include - -#include "openvino/core/variant.hpp" // ov::Variant - -namespace py = pybind11; - -void regclass_graph_Variant(py::module m); - -template -extern void regclass_graph_VariantWrapper(py::module m, std::string typestring) -{ - auto pyclass_name = py::detail::c_str((std::string("Variant") + typestring)); - py::class_, - std::shared_ptr>, - ov::Variant> - variant_wrapper(m, pyclass_name ); - variant_wrapper.doc() = - "openvino.impl.Variant[typestring] wraps ov::VariantWrapper"; - - variant_wrapper.def(py::init()); - - variant_wrapper.def( - "__eq__", - [](const ov::VariantWrapper& a, const ov::VariantWrapper& b) { - return a.get() == b.get(); - }, - py::is_operator()); - variant_wrapper.def( - "__eq__", - [](const ov::VariantWrapper& a, const std::string& b) { - return a.get() == b; - }, - py::is_operator()); - variant_wrapper.def( - "__eq__", - [](const ov::VariantWrapper& a, const int64_t& b) { return a.get() == b; }, - py::is_operator()); - - variant_wrapper.def("__repr__", [](const ov::VariantWrapper self) { - std::stringstream ret; - ret << self.get(); - return ret.str(); - }); - - variant_wrapper.def("get", - (VT & (ov::VariantWrapper::*)()) & ov::VariantWrapper::get, - R"( - Returns - ---------- - get : Variant - Value of Variant. - )"); - variant_wrapper.def("set", - &ov::VariantWrapper::set, - R"( - Parameters - ---------- - set : str or int - Value to be set in Variant. - )"); - - variant_wrapper.def_property("value", - (VT & (ov::VariantWrapper::*)()) & - ov::VariantWrapper::get, - &ov::VariantWrapper::set); -} diff --git a/runtime/bindings/python/tests/test_inference_engine/test_function.py b/runtime/bindings/python/tests/test_inference_engine/test_function.py deleted file mode 100644 index 7db18b1fdb0..00000000000 --- a/runtime/bindings/python/tests/test_inference_engine/test_function.py +++ /dev/null @@ -1,142 +0,0 @@ -# Copyright (C) 2021 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 - -import numpy as np -import pytest - -import openvino.opset8 as ops - -from openvino import Function -from openvino.descriptor import Tensor -from openvino.impl import PartialShape - - -def test_function_add_outputs_tensor_name(): - input_shape = PartialShape([1]) - param = ops.parameter(input_shape, dtype=np.float32, name="data") - relu1 = ops.relu(param, name="relu1") - relu1.get_output_tensor(0).set_names({"relu_t1"}) - assert "relu_t1" in relu1.get_output_tensor(0).names - relu2 = ops.relu(relu1, name="relu2") - function = Function(relu2, [param], "TestFunction") - assert len(function.get_results()) == 1 - function.add_outputs("relu_t1") - assert len(function.get_results()) == 2 - assert isinstance(function.outputs[1].get_tensor(), Tensor) - assert "relu_t1" in function.outputs[1].get_tensor().names - - -def test_function_add_outputs_op_name(): - input_shape = PartialShape([1]) - param = ops.parameter(input_shape, dtype=np.float32, name="data") - relu1 = ops.relu(param, name="relu1") - relu1.get_output_tensor(0).set_names({"relu_t1"}) - relu2 = ops.relu(relu1, name="relu2") - function = Function(relu2, [param], "TestFunction") - assert len(function.get_results()) == 1 - function.add_outputs(("relu1", 0)) - assert len(function.get_results()) == 2 - - -def test_function_add_output_port(): - input_shape = PartialShape([1]) - param = ops.parameter(input_shape, dtype=np.float32, name="data") - relu1 = ops.relu(param, name="relu1") - relu1.get_output_tensor(0).set_names({"relu_t1"}) - relu2 = ops.relu(relu1, name="relu2") - function = Function(relu2, [param], "TestFunction") - assert len(function.get_results()) == 1 - function.add_outputs(relu1.output(0)) - assert len(function.get_results()) == 2 - - -def test_function_add_output_incorrect_tensor_name(): - input_shape = PartialShape([1]) - param = ops.parameter(input_shape, dtype=np.float32, name="data") - relu1 = ops.relu(param, name="relu1") - relu1.get_output_tensor(0).set_names({"relu_t1"}) - relu2 = ops.relu(relu1, name="relu2") - function = Function(relu2, [param], "TestFunction") - assert len(function.get_results()) == 1 - with pytest.raises(RuntimeError) as e: - function.add_outputs("relu_t") - assert "Tensor name relu_t was not found." in str(e.value) - - -def test_function_add_output_incorrect_idx(): - input_shape = PartialShape([1]) - param = ops.parameter(input_shape, dtype=np.float32, name="data") - relu1 = ops.relu(param, name="relu1") - relu1.get_output_tensor(0).set_names({"relu_t1"}) - relu2 = ops.relu(relu1, name="relu2") - function = Function(relu2, [param], "TestFunction") - assert len(function.get_results()) == 1 - with pytest.raises(RuntimeError) as e: - function.add_outputs(("relu1", 10)) - assert "Cannot add output to port 10 operation relu1 has only 1 outputs." in str(e.value) - - -def test_function_add_output_incorrect_name(): - input_shape = PartialShape([1]) - param = ops.parameter(input_shape, dtype=np.float32, name="data") - relu1 = ops.relu(param, name="relu1") - relu1.get_output_tensor(0).set_names({"relu_t1"}) - relu2 = ops.relu(relu1, name="relu2") - function = Function(relu2, [param], "TestFunction") - assert len(function.get_results()) == 1 - with pytest.raises(RuntimeError) as e: - function.add_outputs(("relu_1", 0)) - assert "Port 0 for operation with name relu_1 was not found." in str(e.value) - - -def test_add_outputs_several_tensors(): - input_shape = PartialShape([1]) - param = ops.parameter(input_shape, dtype=np.float32, name="data") - relu1 = ops.relu(param, name="relu1") - relu1.get_output_tensor(0).set_names({"relu_t1"}) - relu2 = ops.relu(relu1, name="relu2") - relu2.get_output_tensor(0).set_names({"relu_t2"}) - relu3 = ops.relu(relu2, name="relu3") - function = Function(relu3, [param], "TestFunction") - assert len(function.get_results()) == 1 - function.add_outputs(["relu_t1", "relu_t2"]) - assert len(function.get_results()) == 3 - - -def test_add_outputs_several_ports(): - input_shape = PartialShape([1]) - param = ops.parameter(input_shape, dtype=np.float32, name="data") - relu1 = ops.relu(param, name="relu1") - relu1.get_output_tensor(0).set_names({"relu_t1"}) - relu2 = ops.relu(relu1, name="relu2") - relu2.get_output_tensor(0).set_names({"relu_t2"}) - relu3 = ops.relu(relu2, name="relu3") - function = Function(relu3, [param], "TestFunction") - assert len(function.get_results()) == 1 - function.add_outputs([("relu1", 0), ("relu2", 0)]) - assert len(function.get_results()) == 3 - - -def test_add_outputs_incorrect_value(): - input_shape = PartialShape([1]) - param = ops.parameter(input_shape, dtype=np.float32, name="data") - relu1 = ops.relu(param, name="relu1") - relu1.get_output_tensor(0).set_names({"relu_t1"}) - relu2 = ops.relu(relu1, name="relu2") - function = Function(relu2, [param], "TestFunction") - assert len(function.get_results()) == 1 - with pytest.raises(TypeError) as e: - function.add_outputs(0) - assert "Incorrect type of a value to add as output." in str(e.value) - - -def test_add_outputs_incorrect_outputs_list(): - input_shape = PartialShape([1]) - param = ops.parameter(input_shape, dtype=np.float32, name="data") - relu1 = ops.relu(param, name="relu1") - relu1.get_output_tensor(0).set_names({"relu_t1"}) - function = Function(relu1, [param], "TestFunction") - assert len(function.get_results()) == 1 - with pytest.raises(TypeError) as e: - function.add_outputs([0, 0]) - assert "Incorrect type of a value to add as output at index 0" in str(e.value) diff --git a/runtime/bindings/python/tests/test_transformations/test_offline_api.py b/runtime/bindings/python/tests/test_transformations/test_offline_api.py deleted file mode 100644 index 72b72c811ec..00000000000 --- a/runtime/bindings/python/tests/test_transformations/test_offline_api.py +++ /dev/null @@ -1,62 +0,0 @@ -# Copyright (C) 2018-2021 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 - -# TODO: change the module name according to the description in 69196 -from openvino.offline_transformations_pybind import apply_moc_transformations, apply_pot_transformations, \ - apply_low_latency_transformation, apply_pruning_transformation, apply_make_stateful_transformation - -from openvino import Function, PartialShape -import openvino as ov - - -def get_test_function(): - param = ov.opset8.parameter(PartialShape([1, 3, 22, 22]), name="parameter") - relu = ov.opset8.relu(param) - res = ov.opset8.result(relu, name="result") - return Function([res], [param], "test") - - -def test_moc_transformations(): - function = get_test_function() - - apply_moc_transformations(function, False) - - assert function is not None - assert len(function.get_ops()) == 3 - - -def test_pot_transformations(): - function = get_test_function() - - apply_pot_transformations(function, "GNA") - - assert function is not None - assert len(function.get_ops()) == 3 - - -def test_low_latency_transformation(): - function = get_test_function() - - apply_low_latency_transformation(function, True) - - assert function is not None - assert len(function.get_ops()) == 3 - - -def test_pruning_transformation(): - function = get_test_function() - - apply_pruning_transformation(function) - - assert function is not None - assert len(function.get_ops()) == 3 - - -def test_make_stateful_transformations(): - function = get_test_function() - - apply_make_stateful_transformation(function, {"parameter": "result"}) - - assert function is not None - assert len(function.get_parameters()) == 0 - assert len(function.get_results()) == 0 diff --git a/samples/cpp/CMakeLists.txt b/samples/cpp/CMakeLists.txt index 7e08d4f6697..6c6d14af94e 100644 --- a/samples/cpp/CMakeLists.txt +++ b/samples/cpp/CMakeLists.txt @@ -9,10 +9,8 @@ cmake_policy(SET CMP0025 NEW) project(Samples) -if (CMAKE_BUILD_TYPE STREQUAL "") - message(STATUS "CMAKE_BUILD_TYPE not defined, 'Release' will be used") - set(CMAKE_BUILD_TYPE "Release") -endif() +set(CMAKE_BUILD_TYPE "Release" CACHE STRING "CMake build type") +set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Release" "Debug" "RelWithDebInfo" "MinSizeRel") set_property(GLOBAL PROPERTY USE_FOLDERS ON) diff --git a/samples/cpp/hello_query_device/main.cpp b/samples/cpp/hello_query_device/main.cpp index 9bf079dd85c..2e204b7f7f9 100644 --- a/samples/cpp/hello_query_device/main.cpp +++ b/samples/cpp/hello_query_device/main.cpp @@ -32,7 +32,7 @@ std::ostream& operator<<(std::ostream& stream, const std::vector& v) { * @param reference on IE Parameter * @return void */ -void printParameterValue(const ov::runtime::Parameter& value) { +void printAnyValue(const ov::Any& value) { if (value.empty()) { std::cout << "EMPTY VALUE" << std::endl; } else if (value.is()) { @@ -83,7 +83,14 @@ void printParameterValue(const ov::runtime::Parameter& value) { std::cout << " }"; std::cout << std::endl; } else { - std::cout << "UNSUPPORTED TYPE" << std::endl; + std::stringstream strm; + value.print(strm); + auto str = strm.str(); + if (str.empty()) { + std::cout << "UNSUPPORTED TYPE" << std::endl; + } else { + std::cout << str << std::endl; + } } } @@ -117,7 +124,7 @@ int main(int argc, char* argv[]) { for (auto&& metricName : supportedMetrics) { if (metricName != METRIC_KEY(SUPPORTED_METRICS) && metricName != METRIC_KEY(SUPPORTED_CONFIG_KEYS)) { std::cout << "\t\t" << metricName << " : " << std::flush; - printParameterValue(core.get_metric(device, metricName)); + printAnyValue(core.get_metric(device, metricName)); } } @@ -129,7 +136,7 @@ int main(int argc, char* argv[]) { core.get_metric(device, METRIC_KEY(SUPPORTED_CONFIG_KEYS)); for (auto&& configKey : supportedConfigKeys) { std::cout << "\t\t" << configKey << " : " << std::flush; - printParameterValue(core.get_config(device, configKey)); + printAnyValue(core.get_config(device, configKey)); } } diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index d4b41058500..1afd8a06c20 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -10,15 +10,15 @@ ie_shellcheck_process(DIRECTORY "${OpenVINO_SOURCE_DIR}" SKIP "${OpenVINO_SOURCE_DIR}/bin" "${OpenVINO_SOURCE_DIR}/build" "${OpenVINO_SOURCE_DIR}/thirdparty" - "${OpenVINO_SOURCE_DIR}/runtime/bindings/python/thirdparty/pybind11" + "${OpenVINO_SOURCE_DIR}/src/bindings/python/thirdparty/pybind11" "${IE_MAIN_SOURCE_DIR}/thirdparty" "${OpenVINO_SOURCE_DIR}/tools/pot/thirdparty" "${TEMP}" # TODO fix and enable back: "${OpenVINO_SOURCE_DIR}/scripts/install_dependencies/install_NEO_OCL_driver.sh" "${OpenVINO_SOURCE_DIR}/scripts/install_dependencies/install_openvino_dependencies.sh" - "${OpenVINO_SOURCE_DIR}/runtime/bindings/python/tests/test_onnx/model_zoo_preprocess.sh" - "${OpenVINO_SOURCE_DIR}/runtime/bindings/python/tests_compatibility/test_onnx/model_zoo_preprocess.sh" + "${OpenVINO_SOURCE_DIR}/src/bindings/python/tests/test_onnx/model_zoo_preprocess.sh" + "${OpenVINO_SOURCE_DIR}/src/bindings/python/tests_compatibility/test_onnx/model_zoo_preprocess.sh" ) # diff --git a/scripts/setupvars/setupvars.sh b/scripts/setupvars/setupvars.sh index 8a6676db1e6..deaf26adad9 100755 --- a/scripts/setupvars/setupvars.sh +++ b/scripts/setupvars/setupvars.sh @@ -8,7 +8,7 @@ INSTALLDIR="${SCRIPT_DIR}" export INTEL_OPENVINO_DIR="$INSTALLDIR" # parse command line options -while [[ $# -gt 0 ]] +while [ $# -gt 0 ] do key="$1" case $key in diff --git a/inference-engine/src/inference_engine/.clang-format b/src/.clang-format similarity index 100% rename from inference-engine/src/inference_engine/.clang-format rename to src/.clang-format diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 00000000000..a98635a36a3 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,46 @@ +# Copyright (C) 2021 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 +# + +if(ENABLE_LTO) + set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE ON) +endif() +add_definitions(-DPROJECT_ROOT_DIR="${CMAKE_CURRENT_SOURCE_DIR}") + +add_custom_target(ov_runtime_libraries ALL) + +# TODO: Fix Wall for core, frontends, tests and c binding +add_subdirectory(core) +add_subdirectory(frontends) +# TODO: remove ngraph/ngraph.hpp usage +add_subdirectory(core/tests) +add_subdirectory(bindings) + +if(CMAKE_COMPILER_IS_GNUCXX) + ie_add_compiler_flags(-Wall) + ie_add_compiler_flags(-Wmissing-declarations) +endif() + +add_subdirectory(plugins) +add_subdirectory(inference) +add_subdirectory(common) + + +if(NGRAPH_IR_FRONTEND_ENABLE) + if(BUILD_SHARED_LIBS) + add_dependencies(ov_runtime_libraries ir_ov_frontend) + endif() + # use this one once CVS-69781 is fixed + # add_dependencies(inference_engine ir_ov_frontend) +endif() +if(NGRAPH_ONNX_FRONTEND_ENABLE) + add_dependencies(inference_engine onnx_ov_frontend) +endif() + +if(NGRAPH_PDPD_FRONTEND_ENABLE) + add_dependencies(inference_engine paddlepaddle_ov_frontend) +endif() + +if(NGRAPH_TF_FRONTEND_ENABLE) + add_dependencies(inference_engine tensorflow_ov_frontend) +endif() diff --git a/runtime/CMakeLists.txt b/src/bindings/CMakeLists.txt similarity index 67% rename from runtime/CMakeLists.txt rename to src/bindings/CMakeLists.txt index 88bc7064127..4811a833112 100644 --- a/runtime/CMakeLists.txt +++ b/src/bindings/CMakeLists.txt @@ -2,6 +2,9 @@ # SPDX-License-Identifier: Apache-2.0 # +add_subdirectory(c) + if(ENABLE_PYTHON) - add_subdirectory(bindings/python) + add_subdirectory(python) endif() + diff --git a/inference-engine/ie_bridges/c/CMakeLists.txt b/src/bindings/c/CMakeLists.txt similarity index 100% rename from inference-engine/ie_bridges/c/CMakeLists.txt rename to src/bindings/c/CMakeLists.txt diff --git a/inference-engine/ie_bridges/c/docs/api_overview.md b/src/bindings/c/docs/api_overview.md similarity index 100% rename from inference-engine/ie_bridges/c/docs/api_overview.md rename to src/bindings/c/docs/api_overview.md diff --git a/inference-engine/ie_bridges/c/include/c_api/ie_c_api.h b/src/bindings/c/include/c_api/ie_c_api.h similarity index 100% rename from inference-engine/ie_bridges/c/include/c_api/ie_c_api.h rename to src/bindings/c/include/c_api/ie_c_api.h diff --git a/inference-engine/ie_bridges/c/src/CMakeLists.txt b/src/bindings/c/src/CMakeLists.txt similarity index 100% rename from inference-engine/ie_bridges/c/src/CMakeLists.txt rename to src/bindings/c/src/CMakeLists.txt diff --git a/inference-engine/ie_bridges/c/src/ie_c_api.cpp b/src/bindings/c/src/ie_c_api.cpp similarity index 100% rename from inference-engine/ie_bridges/c/src/ie_c_api.cpp rename to src/bindings/c/src/ie_c_api.cpp diff --git a/inference-engine/ie_bridges/c/tests/CMakeLists.txt b/src/bindings/c/tests/CMakeLists.txt similarity index 100% rename from inference-engine/ie_bridges/c/tests/CMakeLists.txt rename to src/bindings/c/tests/CMakeLists.txt diff --git a/inference-engine/ie_bridges/c/tests/ie_c_api_test.cpp b/src/bindings/c/tests/ie_c_api_test.cpp similarity index 100% rename from inference-engine/ie_bridges/c/tests/ie_c_api_test.cpp rename to src/bindings/c/tests/ie_c_api_test.cpp diff --git a/inference-engine/ie_bridges/c/tests/test_model_repo.hpp b/src/bindings/c/tests/test_model_repo.hpp similarity index 100% rename from inference-engine/ie_bridges/c/tests/test_model_repo.hpp rename to src/bindings/c/tests/test_model_repo.hpp diff --git a/inference-engine/src/plugin_api/.clang-format b/src/bindings/python/.clang-format similarity index 100% rename from inference-engine/src/plugin_api/.clang-format rename to src/bindings/python/.clang-format diff --git a/runtime/bindings/python/.gitignore b/src/bindings/python/.gitignore similarity index 100% rename from runtime/bindings/python/.gitignore rename to src/bindings/python/.gitignore diff --git a/runtime/bindings/python/BUILDING.md b/src/bindings/python/BUILDING.md similarity index 100% rename from runtime/bindings/python/BUILDING.md rename to src/bindings/python/BUILDING.md diff --git a/runtime/bindings/python/CMakeLists.txt b/src/bindings/python/CMakeLists.txt similarity index 100% rename from runtime/bindings/python/CMakeLists.txt rename to src/bindings/python/CMakeLists.txt diff --git a/runtime/bindings/python/docs/api_overview.md b/src/bindings/python/docs/api_overview.md similarity index 100% rename from runtime/bindings/python/docs/api_overview.md rename to src/bindings/python/docs/api_overview.md diff --git a/runtime/bindings/python/requirements.txt b/src/bindings/python/requirements.txt similarity index 100% rename from runtime/bindings/python/requirements.txt rename to src/bindings/python/requirements.txt diff --git a/runtime/bindings/python/requirements_test.txt b/src/bindings/python/requirements_test.txt similarity index 100% rename from runtime/bindings/python/requirements_test.txt rename to src/bindings/python/requirements_test.txt diff --git a/runtime/bindings/python/setup.py b/src/bindings/python/setup.py similarity index 99% rename from runtime/bindings/python/setup.py rename to src/bindings/python/setup.py index 0881c0c2110..60d2365500e 100644 --- a/runtime/bindings/python/setup.py +++ b/src/bindings/python/setup.py @@ -19,7 +19,7 @@ from distutils.command.build import build as _build __version__ = os.environ.get("NGRAPH_VERSION", "0.0.0.dev0") PYTHON_API_ROOT_DIR = os.path.abspath(os.path.dirname(__file__)) OPENVINO_ROOT_DIR = os.path.normpath(os.path.join(PYTHON_API_ROOT_DIR, "../../..")) -# Change current working directory to runtime/bindings/python +# Change current working directory to src/bindings/python os.chdir(PYTHON_API_ROOT_DIR) NGRAPH_LIBS = ["ngraph", "openvino"] diff --git a/runtime/bindings/python/src/CMakeLists.txt b/src/bindings/python/src/CMakeLists.txt similarity index 100% rename from runtime/bindings/python/src/CMakeLists.txt rename to src/bindings/python/src/CMakeLists.txt diff --git a/runtime/bindings/python/src/compatibility/CMakeLists.txt b/src/bindings/python/src/compatibility/CMakeLists.txt similarity index 100% rename from runtime/bindings/python/src/compatibility/CMakeLists.txt rename to src/bindings/python/src/compatibility/CMakeLists.txt diff --git a/runtime/bindings/python/src/compatibility/ngraph/__init__.py b/src/bindings/python/src/compatibility/ngraph/__init__.py similarity index 100% rename from runtime/bindings/python/src/compatibility/ngraph/__init__.py rename to src/bindings/python/src/compatibility/ngraph/__init__.py diff --git a/runtime/bindings/python/src/compatibility/ngraph/exceptions.py b/src/bindings/python/src/compatibility/ngraph/exceptions.py similarity index 100% rename from runtime/bindings/python/src/compatibility/ngraph/exceptions.py rename to src/bindings/python/src/compatibility/ngraph/exceptions.py diff --git a/runtime/bindings/python/src/compatibility/ngraph/frontend/__init__.py b/src/bindings/python/src/compatibility/ngraph/frontend/__init__.py similarity index 100% rename from runtime/bindings/python/src/compatibility/ngraph/frontend/__init__.py rename to src/bindings/python/src/compatibility/ngraph/frontend/__init__.py diff --git a/runtime/bindings/python/src/compatibility/ngraph/helpers.py b/src/bindings/python/src/compatibility/ngraph/helpers.py similarity index 100% rename from runtime/bindings/python/src/compatibility/ngraph/helpers.py rename to src/bindings/python/src/compatibility/ngraph/helpers.py diff --git a/runtime/bindings/python/src/compatibility/ngraph/impl/__init__.py b/src/bindings/python/src/compatibility/ngraph/impl/__init__.py similarity index 100% rename from runtime/bindings/python/src/compatibility/ngraph/impl/__init__.py rename to src/bindings/python/src/compatibility/ngraph/impl/__init__.py diff --git a/runtime/bindings/python/src/compatibility/ngraph/impl/op/__init__.py b/src/bindings/python/src/compatibility/ngraph/impl/op/__init__.py similarity index 100% rename from runtime/bindings/python/src/compatibility/ngraph/impl/op/__init__.py rename to src/bindings/python/src/compatibility/ngraph/impl/op/__init__.py diff --git a/runtime/bindings/python/src/compatibility/ngraph/impl/op/util/__init__.py b/src/bindings/python/src/compatibility/ngraph/impl/op/util/__init__.py similarity index 100% rename from runtime/bindings/python/src/compatibility/ngraph/impl/op/util/__init__.py rename to src/bindings/python/src/compatibility/ngraph/impl/op/util/__init__.py diff --git a/runtime/bindings/python/src/compatibility/ngraph/impl/passes/__init__.py b/src/bindings/python/src/compatibility/ngraph/impl/passes/__init__.py similarity index 100% rename from runtime/bindings/python/src/compatibility/ngraph/impl/passes/__init__.py rename to src/bindings/python/src/compatibility/ngraph/impl/passes/__init__.py diff --git a/runtime/bindings/python/src/compatibility/ngraph/opset1/__init__.py b/src/bindings/python/src/compatibility/ngraph/opset1/__init__.py similarity index 100% rename from runtime/bindings/python/src/compatibility/ngraph/opset1/__init__.py rename to src/bindings/python/src/compatibility/ngraph/opset1/__init__.py diff --git a/runtime/bindings/python/src/compatibility/ngraph/opset1/ops.py b/src/bindings/python/src/compatibility/ngraph/opset1/ops.py similarity index 100% rename from runtime/bindings/python/src/compatibility/ngraph/opset1/ops.py rename to src/bindings/python/src/compatibility/ngraph/opset1/ops.py diff --git a/runtime/bindings/python/src/compatibility/ngraph/opset2/__init__.py b/src/bindings/python/src/compatibility/ngraph/opset2/__init__.py similarity index 100% rename from runtime/bindings/python/src/compatibility/ngraph/opset2/__init__.py rename to src/bindings/python/src/compatibility/ngraph/opset2/__init__.py diff --git a/runtime/bindings/python/src/compatibility/ngraph/opset2/ops.py b/src/bindings/python/src/compatibility/ngraph/opset2/ops.py similarity index 100% rename from runtime/bindings/python/src/compatibility/ngraph/opset2/ops.py rename to src/bindings/python/src/compatibility/ngraph/opset2/ops.py diff --git a/runtime/bindings/python/src/compatibility/ngraph/opset3/__init__.py b/src/bindings/python/src/compatibility/ngraph/opset3/__init__.py similarity index 100% rename from runtime/bindings/python/src/compatibility/ngraph/opset3/__init__.py rename to src/bindings/python/src/compatibility/ngraph/opset3/__init__.py diff --git a/runtime/bindings/python/src/compatibility/ngraph/opset3/ops.py b/src/bindings/python/src/compatibility/ngraph/opset3/ops.py similarity index 100% rename from runtime/bindings/python/src/compatibility/ngraph/opset3/ops.py rename to src/bindings/python/src/compatibility/ngraph/opset3/ops.py diff --git a/runtime/bindings/python/src/compatibility/ngraph/opset4/__init__.py b/src/bindings/python/src/compatibility/ngraph/opset4/__init__.py similarity index 100% rename from runtime/bindings/python/src/compatibility/ngraph/opset4/__init__.py rename to src/bindings/python/src/compatibility/ngraph/opset4/__init__.py diff --git a/runtime/bindings/python/src/compatibility/ngraph/opset4/ops.py b/src/bindings/python/src/compatibility/ngraph/opset4/ops.py similarity index 100% rename from runtime/bindings/python/src/compatibility/ngraph/opset4/ops.py rename to src/bindings/python/src/compatibility/ngraph/opset4/ops.py diff --git a/runtime/bindings/python/src/compatibility/ngraph/opset5/__init__.py b/src/bindings/python/src/compatibility/ngraph/opset5/__init__.py similarity index 100% rename from runtime/bindings/python/src/compatibility/ngraph/opset5/__init__.py rename to src/bindings/python/src/compatibility/ngraph/opset5/__init__.py diff --git a/runtime/bindings/python/src/compatibility/ngraph/opset5/ops.py b/src/bindings/python/src/compatibility/ngraph/opset5/ops.py similarity index 100% rename from runtime/bindings/python/src/compatibility/ngraph/opset5/ops.py rename to src/bindings/python/src/compatibility/ngraph/opset5/ops.py diff --git a/runtime/bindings/python/src/compatibility/ngraph/opset6/__init__.py b/src/bindings/python/src/compatibility/ngraph/opset6/__init__.py similarity index 100% rename from runtime/bindings/python/src/compatibility/ngraph/opset6/__init__.py rename to src/bindings/python/src/compatibility/ngraph/opset6/__init__.py diff --git a/runtime/bindings/python/src/compatibility/ngraph/opset6/ops.py b/src/bindings/python/src/compatibility/ngraph/opset6/ops.py similarity index 100% rename from runtime/bindings/python/src/compatibility/ngraph/opset6/ops.py rename to src/bindings/python/src/compatibility/ngraph/opset6/ops.py diff --git a/runtime/bindings/python/src/compatibility/ngraph/opset7/__init__.py b/src/bindings/python/src/compatibility/ngraph/opset7/__init__.py similarity index 100% rename from runtime/bindings/python/src/compatibility/ngraph/opset7/__init__.py rename to src/bindings/python/src/compatibility/ngraph/opset7/__init__.py diff --git a/runtime/bindings/python/src/compatibility/ngraph/opset7/ops.py b/src/bindings/python/src/compatibility/ngraph/opset7/ops.py similarity index 100% rename from runtime/bindings/python/src/compatibility/ngraph/opset7/ops.py rename to src/bindings/python/src/compatibility/ngraph/opset7/ops.py diff --git a/runtime/bindings/python/src/compatibility/ngraph/opset8/__init__.py b/src/bindings/python/src/compatibility/ngraph/opset8/__init__.py similarity index 99% rename from runtime/bindings/python/src/compatibility/ngraph/opset8/__init__.py rename to src/bindings/python/src/compatibility/ngraph/opset8/__init__.py index 74029d8869e..8c00720f620 100644 --- a/runtime/bindings/python/src/compatibility/ngraph/opset8/__init__.py +++ b/src/bindings/python/src/compatibility/ngraph/opset8/__init__.py @@ -102,7 +102,7 @@ from ngraph.opset1.ops import pad from ngraph.opset1.ops import parameter from ngraph.opset1.ops import power from ngraph.opset1.ops import prelu -from ngraph.opset1.ops import prior_box +from ngraph.opset8.ops import prior_box from ngraph.opset1.ops import prior_box_clustered from ngraph.opset1.ops import psroi_pooling from ngraph.opset4.ops import proposal diff --git a/runtime/bindings/python/src/compatibility/ngraph/opset8/ops.py b/src/bindings/python/src/compatibility/ngraph/opset8/ops.py similarity index 73% rename from runtime/bindings/python/src/compatibility/ngraph/opset8/ops.py rename to src/bindings/python/src/compatibility/ngraph/opset8/ops.py index fdf71ea6f86..19d8f9cf731 100644 --- a/runtime/bindings/python/src/compatibility/ngraph/opset8/ops.py +++ b/src/bindings/python/src/compatibility/ngraph/opset8/ops.py @@ -417,3 +417,108 @@ def gather_nd( } return _get_node_factory_opset8().create("GatherND", inputs, attributes) + + +def prior_box( + layer_shape: Node, image_shape: NodeInput, attrs: dict, name: Optional[str] = None +) -> Node: + """Generate prior boxes of specified sizes and aspect ratios across all dimensions. + + @param layer_shape: Shape of layer for which prior boxes are computed. + @param image_shape: Shape of image to which prior boxes are scaled. + @param attrs: The dictionary containing key, value pairs for attributes. + @param name: Optional name for the output node. + @return Node representing prior box operation. + Available attributes are: + * min_size The minimum box size (in pixels). + Range of values: positive floating point numbers + Default value: [] + Required: no + * max_size The maximum box size (in pixels). + Range of values: positive floating point numbers + Default value: [] + Required: no + * aspect_ratio Aspect ratios of prior boxes. + Range of values: set of positive floating point numbers + Default value: [] + Required: no + * flip The flag that denotes that each aspect_ratio is duplicated and flipped. + Range of values: {True, False} + Default value: False + Required: no + * clip The flag that denotes if each value in the output tensor should be clipped + to [0,1] interval. + Range of values: {True, False} + Default value: False + Required: no + * step The distance between box centers. + Range of values: floating point non-negative number + Default value: 0 + Required: no + * offset This is a shift of box respectively to top left corner. + Range of values: floating point non-negative number + Default value: None + Required: yes + * variance The variance denotes a variance of adjusting bounding boxes. The attribute + could contain 0, 1 or 4 elements. + Range of values: floating point positive numbers + Default value: [] + Required: no + * scale_all_sizes The flag that denotes type of inference. + Range of values: False - max_size is ignored + True - max_size is used + Default value: True + Required: no + * fixed_ratio This is an aspect ratio of a box. + Range of values: a list of positive floating-point numbers + Default value: None + Required: no + * fixed_size This is an initial box size (in pixels). + Range of values: a list of positive floating-point numbers + Default value: None + Required: no + * density This is the square root of the number of boxes of each type. + Range of values: a list of positive floating-point numbers + Default value: None + Required: no + * min_max_aspect_ratios_order The flag that denotes the order of output prior box. + Range of values: False - the output prior box is in order of + [min, aspect_ratios, max] + True - the output prior box is in order of + [min, max, aspect_ratios] + Default value: True + Required: no + Example of attribute dictionary: + @code{.py} + # just required ones + attrs = { + 'offset': 85, + } + attrs = { + 'offset': 85, + 'flip': True, + 'clip': True, + 'fixed_size': [32, 64, 128] + } + @endcode + Optional attributes which are absent from dictionary will be set with corresponding default. + """ + requirements = [ + ("offset", True, np.floating, is_non_negative_value), + ("min_size", False, np.floating, is_positive_value), + ("max_size", False, np.floating, is_positive_value), + ("aspect_ratio", False, np.floating, is_positive_value), + ("flip", False, np.bool_, None), + ("clip", False, np.bool_, None), + ("step", False, np.floating, is_non_negative_value), + ("variance", False, np.floating, is_positive_value), + ("scale_all_sizes", False, np.bool_, None), + ("fixed_ratio", False, np.floating, is_positive_value), + ("fixed_size", False, np.floating, is_positive_value), + ("density", False, np.floating, is_positive_value), + ("min_max_aspect_ratios_order", False, np.bool_, None), + ] + + check_valid_attributes("PriorBox", attrs, requirements) + + return _get_node_factory_opset8().create("PriorBox", [layer_shape, as_node(image_shape)], attrs) diff --git a/runtime/bindings/python/src/compatibility/ngraph/opset_utils.py b/src/bindings/python/src/compatibility/ngraph/opset_utils.py similarity index 100% rename from runtime/bindings/python/src/compatibility/ngraph/opset_utils.py rename to src/bindings/python/src/compatibility/ngraph/opset_utils.py diff --git a/runtime/bindings/python/src/compatibility/ngraph/utils/__init__.py b/src/bindings/python/src/compatibility/ngraph/utils/__init__.py similarity index 100% rename from runtime/bindings/python/src/compatibility/ngraph/utils/__init__.py rename to src/bindings/python/src/compatibility/ngraph/utils/__init__.py diff --git a/runtime/bindings/python/src/compatibility/ngraph/utils/broadcasting.py b/src/bindings/python/src/compatibility/ngraph/utils/broadcasting.py similarity index 100% rename from runtime/bindings/python/src/compatibility/ngraph/utils/broadcasting.py rename to src/bindings/python/src/compatibility/ngraph/utils/broadcasting.py diff --git a/runtime/bindings/python/src/compatibility/ngraph/utils/decorators.py b/src/bindings/python/src/compatibility/ngraph/utils/decorators.py similarity index 100% rename from runtime/bindings/python/src/compatibility/ngraph/utils/decorators.py rename to src/bindings/python/src/compatibility/ngraph/utils/decorators.py diff --git a/runtime/bindings/python/src/compatibility/ngraph/utils/input_validation.py b/src/bindings/python/src/compatibility/ngraph/utils/input_validation.py similarity index 100% rename from runtime/bindings/python/src/compatibility/ngraph/utils/input_validation.py rename to src/bindings/python/src/compatibility/ngraph/utils/input_validation.py diff --git a/runtime/bindings/python/src/compatibility/ngraph/utils/node_factory.py b/src/bindings/python/src/compatibility/ngraph/utils/node_factory.py similarity index 100% rename from runtime/bindings/python/src/compatibility/ngraph/utils/node_factory.py rename to src/bindings/python/src/compatibility/ngraph/utils/node_factory.py diff --git a/runtime/bindings/python/src/compatibility/ngraph/utils/reduction.py b/src/bindings/python/src/compatibility/ngraph/utils/reduction.py similarity index 100% rename from runtime/bindings/python/src/compatibility/ngraph/utils/reduction.py rename to src/bindings/python/src/compatibility/ngraph/utils/reduction.py diff --git a/runtime/bindings/python/src/compatibility/ngraph/utils/tensor_iterator_types.py b/src/bindings/python/src/compatibility/ngraph/utils/tensor_iterator_types.py similarity index 100% rename from runtime/bindings/python/src/compatibility/ngraph/utils/tensor_iterator_types.py rename to src/bindings/python/src/compatibility/ngraph/utils/tensor_iterator_types.py diff --git a/runtime/bindings/python/src/compatibility/ngraph/utils/types.py b/src/bindings/python/src/compatibility/ngraph/utils/types.py similarity index 100% rename from runtime/bindings/python/src/compatibility/ngraph/utils/types.py rename to src/bindings/python/src/compatibility/ngraph/utils/types.py diff --git a/runtime/bindings/python/src/compatibility/pyngraph/CMakeLists.txt b/src/bindings/python/src/compatibility/pyngraph/CMakeLists.txt similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/CMakeLists.txt rename to src/bindings/python/src/compatibility/pyngraph/CMakeLists.txt diff --git a/runtime/bindings/python/src/compatibility/pyngraph/axis_set.cpp b/src/bindings/python/src/compatibility/pyngraph/axis_set.cpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/axis_set.cpp rename to src/bindings/python/src/compatibility/pyngraph/axis_set.cpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/axis_set.hpp b/src/bindings/python/src/compatibility/pyngraph/axis_set.hpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/axis_set.hpp rename to src/bindings/python/src/compatibility/pyngraph/axis_set.hpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/axis_vector.cpp b/src/bindings/python/src/compatibility/pyngraph/axis_vector.cpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/axis_vector.cpp rename to src/bindings/python/src/compatibility/pyngraph/axis_vector.cpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/axis_vector.hpp b/src/bindings/python/src/compatibility/pyngraph/axis_vector.hpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/axis_vector.hpp rename to src/bindings/python/src/compatibility/pyngraph/axis_vector.hpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/coordinate.cpp b/src/bindings/python/src/compatibility/pyngraph/coordinate.cpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/coordinate.cpp rename to src/bindings/python/src/compatibility/pyngraph/coordinate.cpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/coordinate.hpp b/src/bindings/python/src/compatibility/pyngraph/coordinate.hpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/coordinate.hpp rename to src/bindings/python/src/compatibility/pyngraph/coordinate.hpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/coordinate_diff.cpp b/src/bindings/python/src/compatibility/pyngraph/coordinate_diff.cpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/coordinate_diff.cpp rename to src/bindings/python/src/compatibility/pyngraph/coordinate_diff.cpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/coordinate_diff.hpp b/src/bindings/python/src/compatibility/pyngraph/coordinate_diff.hpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/coordinate_diff.hpp rename to src/bindings/python/src/compatibility/pyngraph/coordinate_diff.hpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/dict_attribute_visitor.cpp b/src/bindings/python/src/compatibility/pyngraph/dict_attribute_visitor.cpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/dict_attribute_visitor.cpp rename to src/bindings/python/src/compatibility/pyngraph/dict_attribute_visitor.cpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/dict_attribute_visitor.hpp b/src/bindings/python/src/compatibility/pyngraph/dict_attribute_visitor.hpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/dict_attribute_visitor.hpp rename to src/bindings/python/src/compatibility/pyngraph/dict_attribute_visitor.hpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/dimension.cpp b/src/bindings/python/src/compatibility/pyngraph/dimension.cpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/dimension.cpp rename to src/bindings/python/src/compatibility/pyngraph/dimension.cpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/dimension.hpp b/src/bindings/python/src/compatibility/pyngraph/dimension.hpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/dimension.hpp rename to src/bindings/python/src/compatibility/pyngraph/dimension.hpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/discrete_type_info.cpp b/src/bindings/python/src/compatibility/pyngraph/discrete_type_info.cpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/discrete_type_info.cpp rename to src/bindings/python/src/compatibility/pyngraph/discrete_type_info.cpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/discrete_type_info.hpp b/src/bindings/python/src/compatibility/pyngraph/discrete_type_info.hpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/discrete_type_info.hpp rename to src/bindings/python/src/compatibility/pyngraph/discrete_type_info.hpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/frontend/frontend.cpp b/src/bindings/python/src/compatibility/pyngraph/frontend/frontend.cpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/frontend/frontend.cpp rename to src/bindings/python/src/compatibility/pyngraph/frontend/frontend.cpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/frontend/frontend.hpp b/src/bindings/python/src/compatibility/pyngraph/frontend/frontend.hpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/frontend/frontend.hpp rename to src/bindings/python/src/compatibility/pyngraph/frontend/frontend.hpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/frontend/frontend_manager.cpp b/src/bindings/python/src/compatibility/pyngraph/frontend/frontend_manager.cpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/frontend/frontend_manager.cpp rename to src/bindings/python/src/compatibility/pyngraph/frontend/frontend_manager.cpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/frontend/frontend_manager.hpp b/src/bindings/python/src/compatibility/pyngraph/frontend/frontend_manager.hpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/frontend/frontend_manager.hpp rename to src/bindings/python/src/compatibility/pyngraph/frontend/frontend_manager.hpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/frontend/inputmodel.cpp b/src/bindings/python/src/compatibility/pyngraph/frontend/inputmodel.cpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/frontend/inputmodel.cpp rename to src/bindings/python/src/compatibility/pyngraph/frontend/inputmodel.cpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/frontend/inputmodel.hpp b/src/bindings/python/src/compatibility/pyngraph/frontend/inputmodel.hpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/frontend/inputmodel.hpp rename to src/bindings/python/src/compatibility/pyngraph/frontend/inputmodel.hpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/frontend/place.cpp b/src/bindings/python/src/compatibility/pyngraph/frontend/place.cpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/frontend/place.cpp rename to src/bindings/python/src/compatibility/pyngraph/frontend/place.cpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/frontend/place.hpp b/src/bindings/python/src/compatibility/pyngraph/frontend/place.hpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/frontend/place.hpp rename to src/bindings/python/src/compatibility/pyngraph/frontend/place.hpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/function.cpp b/src/bindings/python/src/compatibility/pyngraph/function.cpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/function.cpp rename to src/bindings/python/src/compatibility/pyngraph/function.cpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/function.hpp b/src/bindings/python/src/compatibility/pyngraph/function.hpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/function.hpp rename to src/bindings/python/src/compatibility/pyngraph/function.hpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/node.cpp b/src/bindings/python/src/compatibility/pyngraph/node.cpp similarity index 99% rename from runtime/bindings/python/src/compatibility/pyngraph/node.cpp rename to src/bindings/python/src/compatibility/pyngraph/node.cpp index 956297a2357..ab8c8e910be 100644 --- a/runtime/bindings/python/src/compatibility/pyngraph/node.cpp +++ b/src/bindings/python/src/compatibility/pyngraph/node.cpp @@ -31,7 +31,7 @@ public: namespace py = pybind11; -using PyRTMap = std::map>; +using PyRTMap = ngraph::Node::RTMap; PYBIND11_MAKE_OPAQUE(PyRTMap); diff --git a/runtime/bindings/python/src/compatibility/pyngraph/node.hpp b/src/bindings/python/src/compatibility/pyngraph/node.hpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/node.hpp rename to src/bindings/python/src/compatibility/pyngraph/node.hpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/node_factory.cpp b/src/bindings/python/src/compatibility/pyngraph/node_factory.cpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/node_factory.cpp rename to src/bindings/python/src/compatibility/pyngraph/node_factory.cpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/node_factory.hpp b/src/bindings/python/src/compatibility/pyngraph/node_factory.hpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/node_factory.hpp rename to src/bindings/python/src/compatibility/pyngraph/node_factory.hpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/node_input.cpp b/src/bindings/python/src/compatibility/pyngraph/node_input.cpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/node_input.cpp rename to src/bindings/python/src/compatibility/pyngraph/node_input.cpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/node_input.hpp b/src/bindings/python/src/compatibility/pyngraph/node_input.hpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/node_input.hpp rename to src/bindings/python/src/compatibility/pyngraph/node_input.hpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/node_output.cpp b/src/bindings/python/src/compatibility/pyngraph/node_output.cpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/node_output.cpp rename to src/bindings/python/src/compatibility/pyngraph/node_output.cpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/node_output.hpp b/src/bindings/python/src/compatibility/pyngraph/node_output.hpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/node_output.hpp rename to src/bindings/python/src/compatibility/pyngraph/node_output.hpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/ops/constant.cpp b/src/bindings/python/src/compatibility/pyngraph/ops/constant.cpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/ops/constant.cpp rename to src/bindings/python/src/compatibility/pyngraph/ops/constant.cpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/ops/constant.hpp b/src/bindings/python/src/compatibility/pyngraph/ops/constant.hpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/ops/constant.hpp rename to src/bindings/python/src/compatibility/pyngraph/ops/constant.hpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/ops/parameter.cpp b/src/bindings/python/src/compatibility/pyngraph/ops/parameter.cpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/ops/parameter.cpp rename to src/bindings/python/src/compatibility/pyngraph/ops/parameter.cpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/ops/parameter.hpp b/src/bindings/python/src/compatibility/pyngraph/ops/parameter.hpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/ops/parameter.hpp rename to src/bindings/python/src/compatibility/pyngraph/ops/parameter.hpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/ops/result.cpp b/src/bindings/python/src/compatibility/pyngraph/ops/result.cpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/ops/result.cpp rename to src/bindings/python/src/compatibility/pyngraph/ops/result.cpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/ops/result.hpp b/src/bindings/python/src/compatibility/pyngraph/ops/result.hpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/ops/result.hpp rename to src/bindings/python/src/compatibility/pyngraph/ops/result.hpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/ops/util/arithmetic_reduction.cpp b/src/bindings/python/src/compatibility/pyngraph/ops/util/arithmetic_reduction.cpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/ops/util/arithmetic_reduction.cpp rename to src/bindings/python/src/compatibility/pyngraph/ops/util/arithmetic_reduction.cpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/ops/util/arithmetic_reduction.hpp b/src/bindings/python/src/compatibility/pyngraph/ops/util/arithmetic_reduction.hpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/ops/util/arithmetic_reduction.hpp rename to src/bindings/python/src/compatibility/pyngraph/ops/util/arithmetic_reduction.hpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/ops/util/binary_elementwise_arithmetic.cpp b/src/bindings/python/src/compatibility/pyngraph/ops/util/binary_elementwise_arithmetic.cpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/ops/util/binary_elementwise_arithmetic.cpp rename to src/bindings/python/src/compatibility/pyngraph/ops/util/binary_elementwise_arithmetic.cpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/ops/util/binary_elementwise_arithmetic.hpp b/src/bindings/python/src/compatibility/pyngraph/ops/util/binary_elementwise_arithmetic.hpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/ops/util/binary_elementwise_arithmetic.hpp rename to src/bindings/python/src/compatibility/pyngraph/ops/util/binary_elementwise_arithmetic.hpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/ops/util/binary_elementwise_comparison.cpp b/src/bindings/python/src/compatibility/pyngraph/ops/util/binary_elementwise_comparison.cpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/ops/util/binary_elementwise_comparison.cpp rename to src/bindings/python/src/compatibility/pyngraph/ops/util/binary_elementwise_comparison.cpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/ops/util/binary_elementwise_comparison.hpp b/src/bindings/python/src/compatibility/pyngraph/ops/util/binary_elementwise_comparison.hpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/ops/util/binary_elementwise_comparison.hpp rename to src/bindings/python/src/compatibility/pyngraph/ops/util/binary_elementwise_comparison.hpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/ops/util/binary_elementwise_logical.cpp b/src/bindings/python/src/compatibility/pyngraph/ops/util/binary_elementwise_logical.cpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/ops/util/binary_elementwise_logical.cpp rename to src/bindings/python/src/compatibility/pyngraph/ops/util/binary_elementwise_logical.cpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/ops/util/binary_elementwise_logical.hpp b/src/bindings/python/src/compatibility/pyngraph/ops/util/binary_elementwise_logical.hpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/ops/util/binary_elementwise_logical.hpp rename to src/bindings/python/src/compatibility/pyngraph/ops/util/binary_elementwise_logical.hpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/ops/util/index_reduction.cpp b/src/bindings/python/src/compatibility/pyngraph/ops/util/index_reduction.cpp similarity index 98% rename from runtime/bindings/python/src/compatibility/pyngraph/ops/util/index_reduction.cpp rename to src/bindings/python/src/compatibility/pyngraph/ops/util/index_reduction.cpp index 26734aae7d4..51e7352b0b6 100644 --- a/runtime/bindings/python/src/compatibility/pyngraph/ops/util/index_reduction.cpp +++ b/src/bindings/python/src/compatibility/pyngraph/ops/util/index_reduction.cpp @@ -15,7 +15,7 @@ namespace py = pybind11; void regclass_pyngraph_op_util_IndexReduction(py::module m) { py::class_> indexReduction( m, - "IndexRedection", + "IndexReduction", py::module_local()); indexReduction.def("get_reduction_axis", &ngraph::op::util::IndexReduction::get_reduction_axis); diff --git a/runtime/bindings/python/src/compatibility/pyngraph/ops/util/index_reduction.hpp b/src/bindings/python/src/compatibility/pyngraph/ops/util/index_reduction.hpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/ops/util/index_reduction.hpp rename to src/bindings/python/src/compatibility/pyngraph/ops/util/index_reduction.hpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/ops/util/op_annotations.cpp b/src/bindings/python/src/compatibility/pyngraph/ops/util/op_annotations.cpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/ops/util/op_annotations.cpp rename to src/bindings/python/src/compatibility/pyngraph/ops/util/op_annotations.cpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/ops/util/op_annotations.hpp b/src/bindings/python/src/compatibility/pyngraph/ops/util/op_annotations.hpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/ops/util/op_annotations.hpp rename to src/bindings/python/src/compatibility/pyngraph/ops/util/op_annotations.hpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/ops/util/regmodule_pyngraph_op_util.cpp b/src/bindings/python/src/compatibility/pyngraph/ops/util/regmodule_pyngraph_op_util.cpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/ops/util/regmodule_pyngraph_op_util.cpp rename to src/bindings/python/src/compatibility/pyngraph/ops/util/regmodule_pyngraph_op_util.cpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/ops/util/regmodule_pyngraph_op_util.hpp b/src/bindings/python/src/compatibility/pyngraph/ops/util/regmodule_pyngraph_op_util.hpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/ops/util/regmodule_pyngraph_op_util.hpp rename to src/bindings/python/src/compatibility/pyngraph/ops/util/regmodule_pyngraph_op_util.hpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/ops/util/unary_elementwise_arithmetic.cpp b/src/bindings/python/src/compatibility/pyngraph/ops/util/unary_elementwise_arithmetic.cpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/ops/util/unary_elementwise_arithmetic.cpp rename to src/bindings/python/src/compatibility/pyngraph/ops/util/unary_elementwise_arithmetic.cpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/ops/util/unary_elementwise_arithmetic.hpp b/src/bindings/python/src/compatibility/pyngraph/ops/util/unary_elementwise_arithmetic.hpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/ops/util/unary_elementwise_arithmetic.hpp rename to src/bindings/python/src/compatibility/pyngraph/ops/util/unary_elementwise_arithmetic.hpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/partial_shape.cpp b/src/bindings/python/src/compatibility/pyngraph/partial_shape.cpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/partial_shape.cpp rename to src/bindings/python/src/compatibility/pyngraph/partial_shape.cpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/partial_shape.hpp b/src/bindings/python/src/compatibility/pyngraph/partial_shape.hpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/partial_shape.hpp rename to src/bindings/python/src/compatibility/pyngraph/partial_shape.hpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/passes/manager.cpp b/src/bindings/python/src/compatibility/pyngraph/passes/manager.cpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/passes/manager.cpp rename to src/bindings/python/src/compatibility/pyngraph/passes/manager.cpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/passes/manager.hpp b/src/bindings/python/src/compatibility/pyngraph/passes/manager.hpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/passes/manager.hpp rename to src/bindings/python/src/compatibility/pyngraph/passes/manager.hpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/passes/regmodule_pyngraph_passes.cpp b/src/bindings/python/src/compatibility/pyngraph/passes/regmodule_pyngraph_passes.cpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/passes/regmodule_pyngraph_passes.cpp rename to src/bindings/python/src/compatibility/pyngraph/passes/regmodule_pyngraph_passes.cpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/passes/regmodule_pyngraph_passes.hpp b/src/bindings/python/src/compatibility/pyngraph/passes/regmodule_pyngraph_passes.hpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/passes/regmodule_pyngraph_passes.hpp rename to src/bindings/python/src/compatibility/pyngraph/passes/regmodule_pyngraph_passes.hpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/pyngraph.cpp b/src/bindings/python/src/compatibility/pyngraph/pyngraph.cpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/pyngraph.cpp rename to src/bindings/python/src/compatibility/pyngraph/pyngraph.cpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/rt_map.cpp b/src/bindings/python/src/compatibility/pyngraph/rt_map.cpp similarity index 69% rename from runtime/bindings/python/src/compatibility/pyngraph/rt_map.cpp rename to src/bindings/python/src/compatibility/pyngraph/rt_map.cpp index ebd49a9a86b..535594f0564 100644 --- a/runtime/bindings/python/src/compatibility/pyngraph/rt_map.cpp +++ b/src/bindings/python/src/compatibility/pyngraph/rt_map.cpp @@ -20,29 +20,19 @@ namespace py = pybind11; -using PyRTMap = std::map>; +using PyRTMap = std::map; PYBIND11_MAKE_OPAQUE(PyRTMap); -template -void _set_with_variant(PyRTMap& m, const std::string& k, const T v) { - auto new_v = std::make_shared>(ngraph::VariantWrapper(v)); - auto it = m.find(k); - if (it != m.end()) - it->second = new_v; - else - m.emplace(k, new_v); -} - void regclass_pyngraph_PyRTMap(py::module m) { auto py_map = py::bind_map(m, "PyRTMap"); py_map.doc() = "ngraph.impl.PyRTMap makes bindings for std::map>, which can later be used as ngraph::Node::RTMap"; py_map.def("__setitem__", [](PyRTMap& m, const std::string& k, const std::string v) { - _set_with_variant(m, k, v); + m[k] = v; }); py_map.def("__setitem__", [](PyRTMap& m, const std::string& k, const int64_t v) { - _set_with_variant(m, k, v); + m[k] = v; }); } diff --git a/runtime/bindings/python/src/compatibility/pyngraph/rt_map.hpp b/src/bindings/python/src/compatibility/pyngraph/rt_map.hpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/rt_map.hpp rename to src/bindings/python/src/compatibility/pyngraph/rt_map.hpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/shape.cpp b/src/bindings/python/src/compatibility/pyngraph/shape.cpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/shape.cpp rename to src/bindings/python/src/compatibility/pyngraph/shape.cpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/shape.hpp b/src/bindings/python/src/compatibility/pyngraph/shape.hpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/shape.hpp rename to src/bindings/python/src/compatibility/pyngraph/shape.hpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/strides.cpp b/src/bindings/python/src/compatibility/pyngraph/strides.cpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/strides.cpp rename to src/bindings/python/src/compatibility/pyngraph/strides.cpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/strides.hpp b/src/bindings/python/src/compatibility/pyngraph/strides.hpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/strides.hpp rename to src/bindings/python/src/compatibility/pyngraph/strides.hpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/types/element_type.cpp b/src/bindings/python/src/compatibility/pyngraph/types/element_type.cpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/types/element_type.cpp rename to src/bindings/python/src/compatibility/pyngraph/types/element_type.cpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/types/element_type.hpp b/src/bindings/python/src/compatibility/pyngraph/types/element_type.hpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/types/element_type.hpp rename to src/bindings/python/src/compatibility/pyngraph/types/element_type.hpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/types/regmodule_pyngraph_types.cpp b/src/bindings/python/src/compatibility/pyngraph/types/regmodule_pyngraph_types.cpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/types/regmodule_pyngraph_types.cpp rename to src/bindings/python/src/compatibility/pyngraph/types/regmodule_pyngraph_types.cpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/types/regmodule_pyngraph_types.hpp b/src/bindings/python/src/compatibility/pyngraph/types/regmodule_pyngraph_types.hpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/types/regmodule_pyngraph_types.hpp rename to src/bindings/python/src/compatibility/pyngraph/types/regmodule_pyngraph_types.hpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/util.cpp b/src/bindings/python/src/compatibility/pyngraph/util.cpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/util.cpp rename to src/bindings/python/src/compatibility/pyngraph/util.cpp diff --git a/runtime/bindings/python/src/compatibility/pyngraph/util.hpp b/src/bindings/python/src/compatibility/pyngraph/util.hpp similarity index 100% rename from runtime/bindings/python/src/compatibility/pyngraph/util.hpp rename to src/bindings/python/src/compatibility/pyngraph/util.hpp diff --git a/src/bindings/python/src/compatibility/pyngraph/variant.cpp b/src/bindings/python/src/compatibility/pyngraph/variant.cpp new file mode 100644 index 00000000000..62fc1486912 --- /dev/null +++ b/src/bindings/python/src/compatibility/pyngraph/variant.cpp @@ -0,0 +1,44 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "ngraph/variant.hpp" // ngraph::Variant + +#include + +#include "pyngraph/variant.hpp" + +namespace py = pybind11; + +void regclass_pyngraph_Variant(py::module m) { + py::class_ variant_base(m, "Variant", py::module_local()); + variant_base.doc() = "ngraph.impl.Variant wraps ngraph::Variant"; + + variant_base.def( + "__eq__", + [](const ov::Any& a, const ov::Any& b) { + return a == b; + }, + py::is_operator()); + variant_base.def( + "__eq__", + [](const ov::Any& a, const std::string& b) { + return a.as() == b; + }, + py::is_operator()); + variant_base.def( + "__eq__", + [](const ov::Any& a, const int64_t& b) { + return a.as() == b; + }, + py::is_operator()); + + variant_base.def("__repr__", [](const ov::Any self) { + std::stringstream ret; + self.print(ret); + return ret.str(); + }); +} + +template void regclass_pyngraph_VariantWrapper(py::module m, std::string typestring); +template void regclass_pyngraph_VariantWrapper(py::module m, std::string typestring); diff --git a/src/bindings/python/src/compatibility/pyngraph/variant.hpp b/src/bindings/python/src/compatibility/pyngraph/variant.hpp new file mode 100644 index 00000000000..81e5abea860 --- /dev/null +++ b/src/bindings/python/src/compatibility/pyngraph/variant.hpp @@ -0,0 +1,86 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include +#include + +#include +#include + +#include "openvino/core/any.hpp" + +namespace py = pybind11; + +void regclass_pyngraph_Variant(py::module m); + +template +struct AnyT : public ov::Any { + using ov::Any::Any; +}; + + +template +extern void regclass_pyngraph_VariantWrapper(py::module m, std::string typestring) { + auto pyclass_name = py::detail::c_str((std::string("Variant") + typestring)); + py::class_, ov::Any> + variant_wrapper(m, pyclass_name, py::module_local()); + variant_wrapper.doc() = + "openvino.impl.Variant[" + typestring + "] wraps ov::Any with " + typestring; + + variant_wrapper.def(py::init()); + + variant_wrapper.def( + "__eq__", + [](const AnyT& a, const AnyT& b) { + return a.template as() == b.template as(); + }, + py::is_operator()); + variant_wrapper.def( + "__eq__", + [](const AnyT& a, const std::string& b) { + return a.template as() == b; + }, + py::is_operator()); + variant_wrapper.def( + "__eq__", + [](const AnyT& a, const int64_t& b) { return a.template as() == b; }, + py::is_operator()); + + variant_wrapper.def("__repr__", [](const AnyT self) { + std::stringstream ret; + self.print(ret); + return ret.str(); + }); + + variant_wrapper.def("get", + [] (const AnyT& self) { + return self.template as(); + }, + R"( + Returns + ---------- + get : Variant + Value of ov::Any. + )"); + variant_wrapper.def("set", + [] (AnyT& self, const VT value) { + self = value; + }, + R"( + Parameters + ---------- + set : str or int + Value to be set in ov::Any. + )"); + + variant_wrapper.def_property("value", + [] (const AnyT& self) { + return self.template as(); + }, + [] (AnyT& self, const VT value) { + self = value; + }); +} diff --git a/runtime/bindings/python/src/openvino/__init__.py b/src/bindings/python/src/openvino/__init__.py similarity index 100% rename from runtime/bindings/python/src/openvino/__init__.py rename to src/bindings/python/src/openvino/__init__.py diff --git a/runtime/bindings/python/src/openvino/descriptor/__init__.py b/src/bindings/python/src/openvino/descriptor/__init__.py similarity index 100% rename from runtime/bindings/python/src/openvino/descriptor/__init__.py rename to src/bindings/python/src/openvino/descriptor/__init__.py diff --git a/runtime/bindings/python/src/openvino/exceptions.py b/src/bindings/python/src/openvino/exceptions.py similarity index 100% rename from runtime/bindings/python/src/openvino/exceptions.py rename to src/bindings/python/src/openvino/exceptions.py diff --git a/runtime/bindings/python/src/openvino/ie_api.py b/src/bindings/python/src/openvino/ie_api.py similarity index 100% rename from runtime/bindings/python/src/openvino/ie_api.py rename to src/bindings/python/src/openvino/ie_api.py diff --git a/runtime/bindings/python/src/openvino/impl/__init__.py b/src/bindings/python/src/openvino/impl/__init__.py similarity index 100% rename from runtime/bindings/python/src/openvino/impl/__init__.py rename to src/bindings/python/src/openvino/impl/__init__.py diff --git a/runtime/bindings/python/src/openvino/impl/op/__init__.py b/src/bindings/python/src/openvino/impl/op/__init__.py similarity index 100% rename from runtime/bindings/python/src/openvino/impl/op/__init__.py rename to src/bindings/python/src/openvino/impl/op/__init__.py diff --git a/runtime/bindings/python/src/openvino/impl/op/util/__init__.py b/src/bindings/python/src/openvino/impl/op/util/__init__.py similarity index 84% rename from runtime/bindings/python/src/openvino/impl/op/util/__init__.py rename to src/bindings/python/src/openvino/impl/op/util/__init__.py index 26c7dce579c..f29de64f8d7 100644 --- a/runtime/bindings/python/src/openvino/impl/op/util/__init__.py +++ b/src/bindings/python/src/openvino/impl/op/util/__init__.py @@ -11,6 +11,7 @@ from openvino.pyopenvino.op.util import UnaryElementwiseArithmetic from openvino.pyopenvino.op.util import BinaryElementwiseComparison from openvino.pyopenvino.op.util import BinaryElementwiseArithmetic from openvino.pyopenvino.op.util import BinaryElementwiseLogical -from openvino.pyopenvino.op.util import OpAnnotations from openvino.pyopenvino.op.util import ArithmeticReduction from openvino.pyopenvino.op.util import IndexReduction +from openvino.pyopenvino.op.util import VariableInfo +from openvino.pyopenvino.op.util import Variable diff --git a/runtime/bindings/python/src/openvino/impl/passes/__init__.py b/src/bindings/python/src/openvino/impl/passes/__init__.py similarity index 100% rename from runtime/bindings/python/src/openvino/impl/passes/__init__.py rename to src/bindings/python/src/openvino/impl/passes/__init__.py diff --git a/runtime/bindings/python/src/openvino/offline_transformations_pybind/__init__.py b/src/bindings/python/src/openvino/offline_transformations_pybind/__init__.py similarity index 79% rename from runtime/bindings/python/src/openvino/offline_transformations_pybind/__init__.py rename to src/bindings/python/src/openvino/offline_transformations_pybind/__init__.py index 567d667c072..3b77f599de0 100644 --- a/runtime/bindings/python/src/openvino/offline_transformations_pybind/__init__.py +++ b/src/bindings/python/src/openvino/offline_transformations_pybind/__init__.py @@ -8,3 +8,5 @@ from openvino.pyopenvino.offline_transformations_pybind import apply_low_latency from openvino.pyopenvino.offline_transformations_pybind import apply_pruning_transformation from openvino.pyopenvino.offline_transformations_pybind import generate_mapping_file from openvino.pyopenvino.offline_transformations_pybind import apply_make_stateful_transformation +from openvino.pyopenvino.offline_transformations_pybind import serialize +from openvino.pyopenvino.offline_transformations_pybind import compress_model_transformation diff --git a/runtime/bindings/python/src/openvino/opset1/__init__.py b/src/bindings/python/src/openvino/opset1/__init__.py similarity index 100% rename from runtime/bindings/python/src/openvino/opset1/__init__.py rename to src/bindings/python/src/openvino/opset1/__init__.py diff --git a/runtime/bindings/python/src/openvino/opset1/ops.py b/src/bindings/python/src/openvino/opset1/ops.py similarity index 100% rename from runtime/bindings/python/src/openvino/opset1/ops.py rename to src/bindings/python/src/openvino/opset1/ops.py diff --git a/runtime/bindings/python/src/openvino/opset2/__init__.py b/src/bindings/python/src/openvino/opset2/__init__.py similarity index 100% rename from runtime/bindings/python/src/openvino/opset2/__init__.py rename to src/bindings/python/src/openvino/opset2/__init__.py diff --git a/runtime/bindings/python/src/openvino/opset2/ops.py b/src/bindings/python/src/openvino/opset2/ops.py similarity index 100% rename from runtime/bindings/python/src/openvino/opset2/ops.py rename to src/bindings/python/src/openvino/opset2/ops.py diff --git a/runtime/bindings/python/src/openvino/opset3/__init__.py b/src/bindings/python/src/openvino/opset3/__init__.py similarity index 100% rename from runtime/bindings/python/src/openvino/opset3/__init__.py rename to src/bindings/python/src/openvino/opset3/__init__.py diff --git a/runtime/bindings/python/src/openvino/opset3/ops.py b/src/bindings/python/src/openvino/opset3/ops.py similarity index 100% rename from runtime/bindings/python/src/openvino/opset3/ops.py rename to src/bindings/python/src/openvino/opset3/ops.py diff --git a/runtime/bindings/python/src/openvino/opset4/__init__.py b/src/bindings/python/src/openvino/opset4/__init__.py similarity index 100% rename from runtime/bindings/python/src/openvino/opset4/__init__.py rename to src/bindings/python/src/openvino/opset4/__init__.py diff --git a/runtime/bindings/python/src/openvino/opset4/ops.py b/src/bindings/python/src/openvino/opset4/ops.py similarity index 100% rename from runtime/bindings/python/src/openvino/opset4/ops.py rename to src/bindings/python/src/openvino/opset4/ops.py diff --git a/runtime/bindings/python/src/openvino/opset5/__init__.py b/src/bindings/python/src/openvino/opset5/__init__.py similarity index 100% rename from runtime/bindings/python/src/openvino/opset5/__init__.py rename to src/bindings/python/src/openvino/opset5/__init__.py diff --git a/runtime/bindings/python/src/openvino/opset5/ops.py b/src/bindings/python/src/openvino/opset5/ops.py similarity index 100% rename from runtime/bindings/python/src/openvino/opset5/ops.py rename to src/bindings/python/src/openvino/opset5/ops.py diff --git a/runtime/bindings/python/src/openvino/opset6/__init__.py b/src/bindings/python/src/openvino/opset6/__init__.py similarity index 100% rename from runtime/bindings/python/src/openvino/opset6/__init__.py rename to src/bindings/python/src/openvino/opset6/__init__.py diff --git a/runtime/bindings/python/src/openvino/opset6/ops.py b/src/bindings/python/src/openvino/opset6/ops.py similarity index 100% rename from runtime/bindings/python/src/openvino/opset6/ops.py rename to src/bindings/python/src/openvino/opset6/ops.py diff --git a/runtime/bindings/python/src/openvino/opset7/__init__.py b/src/bindings/python/src/openvino/opset7/__init__.py similarity index 100% rename from runtime/bindings/python/src/openvino/opset7/__init__.py rename to src/bindings/python/src/openvino/opset7/__init__.py diff --git a/runtime/bindings/python/src/openvino/opset7/ops.py b/src/bindings/python/src/openvino/opset7/ops.py similarity index 100% rename from runtime/bindings/python/src/openvino/opset7/ops.py rename to src/bindings/python/src/openvino/opset7/ops.py diff --git a/runtime/bindings/python/src/openvino/opset8/__init__.py b/src/bindings/python/src/openvino/opset8/__init__.py similarity index 99% rename from runtime/bindings/python/src/openvino/opset8/__init__.py rename to src/bindings/python/src/openvino/opset8/__init__.py index c53da9026b8..7e188be3b6a 100644 --- a/runtime/bindings/python/src/openvino/opset8/__init__.py +++ b/src/bindings/python/src/openvino/opset8/__init__.py @@ -102,7 +102,7 @@ from openvino.opset1.ops import pad from openvino.opset1.ops import parameter from openvino.opset1.ops import power from openvino.opset1.ops import prelu -from openvino.opset1.ops import prior_box +from openvino.opset8.ops import prior_box from openvino.opset1.ops import prior_box_clustered from openvino.opset1.ops import psroi_pooling from openvino.opset4.ops import proposal diff --git a/runtime/bindings/python/src/openvino/opset8/ops.py b/src/bindings/python/src/openvino/opset8/ops.py similarity index 73% rename from runtime/bindings/python/src/openvino/opset8/ops.py rename to src/bindings/python/src/openvino/opset8/ops.py index 67559a8dc49..728ea50dc5d 100644 --- a/runtime/bindings/python/src/openvino/opset8/ops.py +++ b/src/bindings/python/src/openvino/opset8/ops.py @@ -417,3 +417,109 @@ def gather_nd( } return _get_node_factory_opset8().create("GatherND", inputs, attributes) + + +@nameable_op +def prior_box( + layer_shape: Node, image_shape: NodeInput, attrs: dict, name: Optional[str] = None +) -> Node: + """Generate prior boxes of specified sizes and aspect ratios across all dimensions. + + @param layer_shape: Shape of layer for which prior boxes are computed. + @param image_shape: Shape of image to which prior boxes are scaled. + @param attrs: The dictionary containing key, value pairs for attributes. + @param name: Optional name for the output node. + @return Node representing prior box operation. + Available attributes are: + * min_size The minimum box size (in pixels). + Range of values: positive floating point numbers + Default value: [] + Required: no + * max_size The maximum box size (in pixels). + Range of values: positive floating point numbers + Default value: [] + Required: no + * aspect_ratio Aspect ratios of prior boxes. + Range of values: set of positive floating point numbers + Default value: [] + Required: no + * flip The flag that denotes that each aspect_ratio is duplicated and flipped. + Range of values: {True, False} + Default value: False + Required: no + * clip The flag that denotes if each value in the output tensor should be clipped + to [0,1] interval. + Range of values: {True, False} + Default value: False + Required: no + * step The distance between box centers. + Range of values: floating point non-negative number + Default value: 0 + Required: no + * offset This is a shift of box respectively to top left corner. + Range of values: floating point non-negative number + Default value: None + Required: yes + * variance The variance denotes a variance of adjusting bounding boxes. The attribute + could contain 0, 1 or 4 elements. + Range of values: floating point positive numbers + Default value: [] + Required: no + * scale_all_sizes The flag that denotes type of inference. + Range of values: False - max_size is ignored + True - max_size is used + Default value: True + Required: no + * fixed_ratio This is an aspect ratio of a box. + Range of values: a list of positive floating-point numbers + Default value: None + Required: no + * fixed_size This is an initial box size (in pixels). + Range of values: a list of positive floating-point numbers + Default value: None + Required: no + * density This is the square root of the number of boxes of each type. + Range of values: a list of positive floating-point numbers + Default value: None + Required: no + * min_max_aspect_ratios_order The flag that denotes the order of output prior box. + Range of values: False - the output prior box is in order of + [min, aspect_ratios, max] + True - the output prior box is in order of + [min, max, aspect_ratios] + Default value: True + Required: no + Example of attribute dictionary: + @code{.py} + # just required ones + attrs = { + 'offset': 85, + } + attrs = { + 'offset': 85, + 'flip': True, + 'clip': True, + 'fixed_size': [32, 64, 128] + } + @endcode + Optional attributes which are absent from dictionary will be set with corresponding default. + """ + requirements = [ + ("offset", True, np.floating, is_non_negative_value), + ("min_size", False, np.floating, is_positive_value), + ("max_size", False, np.floating, is_positive_value), + ("aspect_ratio", False, np.floating, is_positive_value), + ("flip", False, np.bool_, None), + ("clip", False, np.bool_, None), + ("step", False, np.floating, is_non_negative_value), + ("variance", False, np.floating, is_positive_value), + ("scale_all_sizes", False, np.bool_, None), + ("fixed_ratio", False, np.floating, is_positive_value), + ("fixed_size", False, np.floating, is_positive_value), + ("density", False, np.floating, is_positive_value), + ("min_max_aspect_ratios_order", False, np.bool_, None), + ] + + check_valid_attributes("PriorBox", attrs, requirements) + + return _get_node_factory_opset8().create("PriorBox", [layer_shape, as_node(image_shape)], attrs) diff --git a/runtime/bindings/python/src/openvino/opset_utils.py b/src/bindings/python/src/openvino/opset_utils.py similarity index 100% rename from runtime/bindings/python/src/openvino/opset_utils.py rename to src/bindings/python/src/openvino/opset_utils.py diff --git a/runtime/bindings/python/src/openvino/preprocess/__init__.py b/src/bindings/python/src/openvino/preprocess/__init__.py similarity index 100% rename from runtime/bindings/python/src/openvino/preprocess/__init__.py rename to src/bindings/python/src/openvino/preprocess/__init__.py diff --git a/runtime/bindings/python/src/openvino/utils/__init__.py b/src/bindings/python/src/openvino/utils/__init__.py similarity index 100% rename from runtime/bindings/python/src/openvino/utils/__init__.py rename to src/bindings/python/src/openvino/utils/__init__.py diff --git a/runtime/bindings/python/src/openvino/utils/broadcasting.py b/src/bindings/python/src/openvino/utils/broadcasting.py similarity index 100% rename from runtime/bindings/python/src/openvino/utils/broadcasting.py rename to src/bindings/python/src/openvino/utils/broadcasting.py diff --git a/runtime/bindings/python/src/openvino/utils/decorators.py b/src/bindings/python/src/openvino/utils/decorators.py similarity index 100% rename from runtime/bindings/python/src/openvino/utils/decorators.py rename to src/bindings/python/src/openvino/utils/decorators.py diff --git a/runtime/bindings/python/src/openvino/utils/input_validation.py b/src/bindings/python/src/openvino/utils/input_validation.py similarity index 100% rename from runtime/bindings/python/src/openvino/utils/input_validation.py rename to src/bindings/python/src/openvino/utils/input_validation.py diff --git a/runtime/bindings/python/src/openvino/utils/node_factory.py b/src/bindings/python/src/openvino/utils/node_factory.py similarity index 100% rename from runtime/bindings/python/src/openvino/utils/node_factory.py rename to src/bindings/python/src/openvino/utils/node_factory.py diff --git a/runtime/bindings/python/src/openvino/utils/reduction.py b/src/bindings/python/src/openvino/utils/reduction.py similarity index 100% rename from runtime/bindings/python/src/openvino/utils/reduction.py rename to src/bindings/python/src/openvino/utils/reduction.py diff --git a/runtime/bindings/python/src/openvino/utils/tensor_iterator_types.py b/src/bindings/python/src/openvino/utils/tensor_iterator_types.py similarity index 100% rename from runtime/bindings/python/src/openvino/utils/tensor_iterator_types.py rename to src/bindings/python/src/openvino/utils/tensor_iterator_types.py diff --git a/runtime/bindings/python/src/openvino/utils/types.py b/src/bindings/python/src/openvino/utils/types.py similarity index 100% rename from runtime/bindings/python/src/openvino/utils/types.py rename to src/bindings/python/src/openvino/utils/types.py diff --git a/runtime/bindings/python/src/pyopenvino/CMakeLists.txt b/src/bindings/python/src/pyopenvino/CMakeLists.txt similarity index 100% rename from runtime/bindings/python/src/pyopenvino/CMakeLists.txt rename to src/bindings/python/src/pyopenvino/CMakeLists.txt diff --git a/runtime/bindings/python/src/pyopenvino/core/async_infer_queue.cpp b/src/bindings/python/src/pyopenvino/core/async_infer_queue.cpp similarity index 92% rename from runtime/bindings/python/src/pyopenvino/core/async_infer_queue.cpp rename to src/bindings/python/src/pyopenvino/core/async_infer_queue.cpp index 160a3ef2307..e8cbd691649 100644 --- a/runtime/bindings/python/src/pyopenvino/core/async_infer_queue.cpp +++ b/src/bindings/python/src/pyopenvino/core/async_infer_queue.cpp @@ -40,7 +40,8 @@ public: _cv.wait(lock, [this] { return !(_idle_handles.empty()); }); - + if (_errors.size() > 0) + throw _errors.front(); return !(_idle_handles.empty()); } @@ -51,7 +52,8 @@ public: _cv.wait(lock, [this] { return !(_idle_handles.empty()); }); - + if (_errors.size() > 0) + throw _errors.front(); return _idle_handles.front(); } @@ -63,6 +65,8 @@ public: _cv.wait(lock, [this] { return _idle_handles.size() == _requests.size(); }); + if (_errors.size() > 0) + throw _errors.front(); } void set_default_callbacks() { @@ -90,7 +94,12 @@ public: } // Acquire GIL, execute Python function py::gil_scoped_acquire acquire; - f_callback(_requests[handle], _user_ids[handle]); + try { + f_callback(_requests[handle], _user_ids[handle]); + } catch (py::error_already_set py_error) { + assert(PyErr_Occurred()); + _errors.push(py_error); + } // Add idle handle to queue _idle_handles.push(handle); // Notify locks in getIdleRequestId() or waitAll() functions @@ -104,6 +113,7 @@ public: std::vector _user_ids; // user ID can be any Python object std::mutex _mutex; std::condition_variable _cv; + std::queue _errors; }; void regclass_AsyncInferQueue(py::module m) { diff --git a/runtime/bindings/python/src/pyopenvino/core/async_infer_queue.hpp b/src/bindings/python/src/pyopenvino/core/async_infer_queue.hpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/core/async_infer_queue.hpp rename to src/bindings/python/src/pyopenvino/core/async_infer_queue.hpp diff --git a/runtime/bindings/python/src/pyopenvino/core/common.cpp b/src/bindings/python/src/pyopenvino/core/common.cpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/core/common.cpp rename to src/bindings/python/src/pyopenvino/core/common.cpp diff --git a/runtime/bindings/python/src/pyopenvino/core/common.hpp b/src/bindings/python/src/pyopenvino/core/common.hpp similarity index 77% rename from runtime/bindings/python/src/pyopenvino/core/common.hpp rename to src/bindings/python/src/pyopenvino/core/common.hpp index 7e2e0f0dfc9..68d28ec6396 100644 --- a/runtime/bindings/python/src/pyopenvino/core/common.hpp +++ b/src/bindings/python/src/pyopenvino/core/common.hpp @@ -43,4 +43,17 @@ namespace Common PyObject* parse_parameter(const InferenceEngine::Parameter& param); uint32_t get_optimal_number_of_requests(const ov::runtime::ExecutableNetwork& actual); + + // Use only with classes that are not creatable by users on Python's side, because + // Objects created in Python that are wrapped with such wrapper will cause memory leaks. + template + class ref_wrapper { + std::reference_wrapper impl; + + public: + explicit ref_wrapper(T* p) : impl(*p) {} + T* get() const { + return &impl.get(); + } +}; }; // namespace Common diff --git a/runtime/bindings/python/src/pyopenvino/core/containers.cpp b/src/bindings/python/src/pyopenvino/core/containers.cpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/core/containers.cpp rename to src/bindings/python/src/pyopenvino/core/containers.cpp diff --git a/runtime/bindings/python/src/pyopenvino/core/containers.hpp b/src/bindings/python/src/pyopenvino/core/containers.hpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/core/containers.hpp rename to src/bindings/python/src/pyopenvino/core/containers.hpp diff --git a/runtime/bindings/python/src/pyopenvino/core/core.cpp b/src/bindings/python/src/pyopenvino/core/core.cpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/core/core.cpp rename to src/bindings/python/src/pyopenvino/core/core.cpp diff --git a/runtime/bindings/python/src/pyopenvino/core/core.hpp b/src/bindings/python/src/pyopenvino/core/core.hpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/core/core.hpp rename to src/bindings/python/src/pyopenvino/core/core.hpp diff --git a/runtime/bindings/python/src/pyopenvino/core/executable_network.cpp b/src/bindings/python/src/pyopenvino/core/executable_network.cpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/core/executable_network.cpp rename to src/bindings/python/src/pyopenvino/core/executable_network.cpp diff --git a/runtime/bindings/python/src/pyopenvino/core/executable_network.hpp b/src/bindings/python/src/pyopenvino/core/executable_network.hpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/core/executable_network.hpp rename to src/bindings/python/src/pyopenvino/core/executable_network.hpp diff --git a/runtime/bindings/python/src/pyopenvino/core/ie_parameter.cpp b/src/bindings/python/src/pyopenvino/core/ie_parameter.cpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/core/ie_parameter.cpp rename to src/bindings/python/src/pyopenvino/core/ie_parameter.cpp diff --git a/runtime/bindings/python/src/pyopenvino/core/ie_parameter.hpp b/src/bindings/python/src/pyopenvino/core/ie_parameter.hpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/core/ie_parameter.hpp rename to src/bindings/python/src/pyopenvino/core/ie_parameter.hpp diff --git a/runtime/bindings/python/src/pyopenvino/core/infer_request.cpp b/src/bindings/python/src/pyopenvino/core/infer_request.cpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/core/infer_request.cpp rename to src/bindings/python/src/pyopenvino/core/infer_request.cpp diff --git a/runtime/bindings/python/src/pyopenvino/core/infer_request.hpp b/src/bindings/python/src/pyopenvino/core/infer_request.hpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/core/infer_request.hpp rename to src/bindings/python/src/pyopenvino/core/infer_request.hpp diff --git a/runtime/bindings/python/src/pyopenvino/core/offline_transformations.cpp b/src/bindings/python/src/pyopenvino/core/offline_transformations.cpp similarity index 73% rename from runtime/bindings/python/src/pyopenvino/core/offline_transformations.cpp rename to src/bindings/python/src/pyopenvino/core/offline_transformations.cpp index f58bcc6eedf..411087c73ac 100644 --- a/runtime/bindings/python/src/pyopenvino/core/offline_transformations.cpp +++ b/src/bindings/python/src/pyopenvino/core/offline_transformations.cpp @@ -10,7 +10,10 @@ #include #include #include +#include +#include #include +#include #include "openvino/pass/low_latency.hpp" #include "openvino/pass/manager.hpp" @@ -81,4 +84,26 @@ void regmodule_offline_transformations(py::module m) { }, py::arg("function"), py::arg("param_res_names")); + + m_offline_transformations.def( + "compress_model_transformation", + [](std::shared_ptr function) { + ov::pass::Manager manager; + manager.register_pass(); + manager.register_pass(); + manager.run_passes(function); + }, + py::arg("function")); + + // todo: remove as serialize as part of passManager api will be merged + m_offline_transformations.def( + "serialize", + [](std::shared_ptr function, const std::string& path_to_xml, const std::string& path_to_bin) { + ov::pass::Manager manager; + manager.register_pass(path_to_xml, path_to_bin); + manager.run_passes(function); + }, + py::arg("function"), + py::arg("model_path"), + py::arg("weights_path")); } diff --git a/runtime/bindings/python/src/pyopenvino/core/offline_transformations.hpp b/src/bindings/python/src/pyopenvino/core/offline_transformations.hpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/core/offline_transformations.hpp rename to src/bindings/python/src/pyopenvino/core/offline_transformations.hpp diff --git a/runtime/bindings/python/src/pyopenvino/core/profiling_info.cpp b/src/bindings/python/src/pyopenvino/core/profiling_info.cpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/core/profiling_info.cpp rename to src/bindings/python/src/pyopenvino/core/profiling_info.cpp diff --git a/runtime/bindings/python/src/pyopenvino/core/profiling_info.hpp b/src/bindings/python/src/pyopenvino/core/profiling_info.hpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/core/profiling_info.hpp rename to src/bindings/python/src/pyopenvino/core/profiling_info.hpp diff --git a/runtime/bindings/python/src/pyopenvino/core/tensor.cpp b/src/bindings/python/src/pyopenvino/core/tensor.cpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/core/tensor.cpp rename to src/bindings/python/src/pyopenvino/core/tensor.cpp diff --git a/runtime/bindings/python/src/pyopenvino/core/tensor.hpp b/src/bindings/python/src/pyopenvino/core/tensor.hpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/core/tensor.hpp rename to src/bindings/python/src/pyopenvino/core/tensor.hpp diff --git a/runtime/bindings/python/src/pyopenvino/core/variable_state.cpp b/src/bindings/python/src/pyopenvino/core/variable_state.cpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/core/variable_state.cpp rename to src/bindings/python/src/pyopenvino/core/variable_state.cpp diff --git a/runtime/bindings/python/src/pyopenvino/core/variable_state.hpp b/src/bindings/python/src/pyopenvino/core/variable_state.hpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/core/variable_state.hpp rename to src/bindings/python/src/pyopenvino/core/variable_state.hpp diff --git a/runtime/bindings/python/src/pyopenvino/core/version.cpp b/src/bindings/python/src/pyopenvino/core/version.cpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/core/version.cpp rename to src/bindings/python/src/pyopenvino/core/version.cpp diff --git a/runtime/bindings/python/src/pyopenvino/core/version.hpp b/src/bindings/python/src/pyopenvino/core/version.hpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/core/version.hpp rename to src/bindings/python/src/pyopenvino/core/version.hpp diff --git a/runtime/bindings/python/src/pyopenvino/graph/axis_set.cpp b/src/bindings/python/src/pyopenvino/graph/axis_set.cpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/graph/axis_set.cpp rename to src/bindings/python/src/pyopenvino/graph/axis_set.cpp diff --git a/runtime/bindings/python/src/pyopenvino/graph/axis_set.hpp b/src/bindings/python/src/pyopenvino/graph/axis_set.hpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/graph/axis_set.hpp rename to src/bindings/python/src/pyopenvino/graph/axis_set.hpp diff --git a/runtime/bindings/python/src/pyopenvino/graph/axis_vector.cpp b/src/bindings/python/src/pyopenvino/graph/axis_vector.cpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/graph/axis_vector.cpp rename to src/bindings/python/src/pyopenvino/graph/axis_vector.cpp diff --git a/runtime/bindings/python/src/pyopenvino/graph/axis_vector.hpp b/src/bindings/python/src/pyopenvino/graph/axis_vector.hpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/graph/axis_vector.hpp rename to src/bindings/python/src/pyopenvino/graph/axis_vector.hpp diff --git a/runtime/bindings/python/src/pyopenvino/graph/coordinate.cpp b/src/bindings/python/src/pyopenvino/graph/coordinate.cpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/graph/coordinate.cpp rename to src/bindings/python/src/pyopenvino/graph/coordinate.cpp diff --git a/runtime/bindings/python/src/pyopenvino/graph/coordinate.hpp b/src/bindings/python/src/pyopenvino/graph/coordinate.hpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/graph/coordinate.hpp rename to src/bindings/python/src/pyopenvino/graph/coordinate.hpp diff --git a/runtime/bindings/python/src/pyopenvino/graph/coordinate_diff.cpp b/src/bindings/python/src/pyopenvino/graph/coordinate_diff.cpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/graph/coordinate_diff.cpp rename to src/bindings/python/src/pyopenvino/graph/coordinate_diff.cpp diff --git a/runtime/bindings/python/src/pyopenvino/graph/coordinate_diff.hpp b/src/bindings/python/src/pyopenvino/graph/coordinate_diff.hpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/graph/coordinate_diff.hpp rename to src/bindings/python/src/pyopenvino/graph/coordinate_diff.hpp diff --git a/runtime/bindings/python/src/pyopenvino/graph/descriptors/tensor.cpp b/src/bindings/python/src/pyopenvino/graph/descriptors/tensor.cpp similarity index 98% rename from runtime/bindings/python/src/pyopenvino/graph/descriptors/tensor.cpp rename to src/bindings/python/src/pyopenvino/graph/descriptors/tensor.cpp index 547b9d8d3c6..b23a103368c 100644 --- a/runtime/bindings/python/src/pyopenvino/graph/descriptors/tensor.cpp +++ b/src/bindings/python/src/pyopenvino/graph/descriptors/tensor.cpp @@ -13,7 +13,7 @@ namespace py = pybind11; -using PyRTMap = std::map>; +using PyRTMap = ov::RTMap; PYBIND11_MAKE_OPAQUE(PyRTMap); diff --git a/runtime/bindings/python/src/pyopenvino/graph/descriptors/tensor.hpp b/src/bindings/python/src/pyopenvino/graph/descriptors/tensor.hpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/graph/descriptors/tensor.hpp rename to src/bindings/python/src/pyopenvino/graph/descriptors/tensor.hpp diff --git a/runtime/bindings/python/src/pyopenvino/graph/dict_attribute_visitor.cpp b/src/bindings/python/src/pyopenvino/graph/dict_attribute_visitor.cpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/graph/dict_attribute_visitor.cpp rename to src/bindings/python/src/pyopenvino/graph/dict_attribute_visitor.cpp diff --git a/runtime/bindings/python/src/pyopenvino/graph/dict_attribute_visitor.hpp b/src/bindings/python/src/pyopenvino/graph/dict_attribute_visitor.hpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/graph/dict_attribute_visitor.hpp rename to src/bindings/python/src/pyopenvino/graph/dict_attribute_visitor.hpp diff --git a/runtime/bindings/python/src/pyopenvino/graph/dimension.cpp b/src/bindings/python/src/pyopenvino/graph/dimension.cpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/graph/dimension.cpp rename to src/bindings/python/src/pyopenvino/graph/dimension.cpp diff --git a/runtime/bindings/python/src/pyopenvino/graph/dimension.hpp b/src/bindings/python/src/pyopenvino/graph/dimension.hpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/graph/dimension.hpp rename to src/bindings/python/src/pyopenvino/graph/dimension.hpp diff --git a/runtime/bindings/python/src/pyopenvino/graph/function.cpp b/src/bindings/python/src/pyopenvino/graph/function.cpp similarity index 58% rename from runtime/bindings/python/src/pyopenvino/graph/function.cpp rename to src/bindings/python/src/pyopenvino/graph/function.cpp index c064ddbdd3c..24f81fa5789 100644 --- a/runtime/bindings/python/src/pyopenvino/graph/function.cpp +++ b/src/bindings/python/src/pyopenvino/graph/function.cpp @@ -10,12 +10,20 @@ #include "openvino/core/partial_shape.hpp" #include "openvino/op/parameter.hpp" // ov::op::v0::Parameter #include "openvino/op/sink.hpp" +#include "pyopenvino/core/tensor.hpp" #include "pyopenvino/graph/function.hpp" +#include "pyopenvino/graph/ops/result.hpp" +#include "pyopenvino/graph/ops/util/variable.hpp" +#include "pyopenvino/graph/rt_map.hpp" namespace py = pybind11; static const char* CAPSULE_NAME = "openvino_function"; +using PyRTMap = ov::RTMap; + +PYBIND11_MAKE_OPAQUE(PyRTMap); + void set_tensor_names(const ov::ParameterVector& parameters) { for (const auto& param : parameters) { ov::Output p = param; @@ -26,6 +34,16 @@ void set_tensor_names(const ov::ParameterVector& parameters) { } } +ov::SinkVector cast_to_sink_vector(const std::vector>& nodes) { + ov::SinkVector sinks; + for (const auto& node : nodes) { + auto sink = std::dynamic_pointer_cast(node); + NGRAPH_CHECK(sink != nullptr, "Node {} is not instance of Sink"); + sinks.push_back(sink); + } + return sinks; +} + void regclass_graph_Function(py::module m) { py::class_> function(m, "Function", py::module_local()); function.doc() = "openvino.impl.Function wraps ov::Function"; @@ -34,12 +52,8 @@ void regclass_graph_Function(py::module m) { const std::vector>& nodes, const ov::ParameterVector& params, const std::string& name) { - ov::SinkVector sinks; - for (const auto& node : nodes) { - auto sink = std::dynamic_pointer_cast(node); - NGRAPH_CHECK(sink != nullptr, "Node {} is not instance of Sink"); - sinks.push_back(sink); - } + set_tensor_names(params); + const auto sinks = cast_to_sink_vector(nodes); return std::make_shared(res, sinks, params, name); }), py::arg("results"), @@ -88,11 +102,11 @@ void regclass_graph_Function(py::module m) { String to set as function's friendly name. )"); - function.def(py::init([](const std::shared_ptr& results, + function.def(py::init([](const std::shared_ptr& result, const ov::ParameterVector& parameters, const std::string& name) { set_tensor_names(parameters); - return std::make_shared(results, parameters, name); + return std::make_shared(result, parameters, name); }), py::arg("result"), py::arg("parameters"), @@ -102,7 +116,7 @@ void regclass_graph_Function(py::module m) { Parameters ---------- - results : Node + result : Node Node to be used as result. parameters : List[op.Parameter] @@ -112,6 +126,188 @@ void regclass_graph_Function(py::module m) { String to set as function's friendly name. )"); + function.def( + py::init([](const ov::OutputVector& results, const ov::ParameterVector& parameters, const std::string& name) { + set_tensor_names(parameters); + return std::make_shared(results, parameters, name); + }), + py::arg("results"), + py::arg("parameters"), + py::arg("name") = "", + R"( + Create user-defined Function which is a representation of a model + + Parameters + ---------- + results : List[Output] + List of outputs. + + parameters : List[op.Parameter] + List of parameters. + + name : str + String to set as function's friendly name. + )"); + + function.def(py::init([](const ov::OutputVector& results, + const std::vector>& nodes, + const ov::ParameterVector& parameters, + const std::string& name) { + set_tensor_names(parameters); + const auto sinks = cast_to_sink_vector(nodes); + return std::make_shared(results, sinks, parameters, name); + }), + py::arg("results"), + py::arg("sinks"), + py::arg("parameters"), + py::arg("name") = "", + R"( + Create user-defined Function which is a representation of a model + + Parameters + ---------- + results : List[Output] + List of outputs. + + sinks : List[Node] + List of Nodes to be used as Sinks (e.g. Assign ops). + + parameters : List[op.Parameter] + List of parameters. + + name : str + String to set as function's friendly name. + )"); + function.def(py::init([](const ov::ResultVector& results, + const std::vector>& nodes, + const ov::ParameterVector& parameters, + const ov::op::util::VariableVector& variables, + const std::string& name) { + set_tensor_names(parameters); + const auto sinks = cast_to_sink_vector(nodes); + return std::make_shared(results, sinks, parameters, variables, name); + }), + py::arg("results"), + py::arg("sinks"), + py::arg("parameters"), + py::arg("variables"), + py::arg("name") = "", + R"( + Create user-defined Function which is a representation of a model + + Parameters + ---------- + results : List[op.Result] + List of results. + + sinks : List[Node] + List of Nodes to be used as Sinks (e.g. Assign ops). + + parameters : List[op.Parameter] + List of parameters. + + variables : List[op.util.Variable] + List of variables. + + name : str + String to set as function's friendly name. + )"); + + function.def(py::init([](const ov::OutputVector& results, + const std::vector>& nodes, + const ov::ParameterVector& parameters, + const ov::op::util::VariableVector& variables, + const std::string& name) { + set_tensor_names(parameters); + const auto sinks = cast_to_sink_vector(nodes); + return std::make_shared(results, sinks, parameters, variables, name); + }), + py::arg("results"), + py::arg("sinks"), + py::arg("parameters"), + py::arg("variables"), + py::arg("name") = "", + R"( + Create user-defined Function which is a representation of a model + + Parameters + ---------- + results : List[Output] + List of results. + + sinks : List[Node] + List of Nodes to be used as Sinks (e.g. Assign ops). + + parameters : List[op.Parameter] + List of parameters. + + variables : List[op.util.Variable] + List of variables. + + name : str + String to set as function's friendly name. + )"); + + function.def(py::init([](const ov::ResultVector& results, + const ov::ParameterVector& parameters, + const ov::op::util::VariableVector& variables, + const std::string& name) { + set_tensor_names(parameters); + return std::make_shared(results, parameters, variables, name); + }), + py::arg("results"), + py::arg("parameters"), + py::arg("variables"), + py::arg("name") = "", + R"( + Create user-defined Function which is a representation of a model + + Parameters + ---------- + results : List[op.Result] + List of results. + + parameters : List[op.Parameter] + List of parameters. + + variables : List[op.util.Variable] + List of variables. + + name : str + String to set as function's friendly name. + )"); + + function.def(py::init([](const ov::OutputVector& results, + const ov::ParameterVector& parameters, + const ov::op::util::VariableVector& variables, + const std::string& name) { + set_tensor_names(parameters); + return std::make_shared(results, parameters, variables, name); + }), + py::arg("results"), + py::arg("parameters"), + py::arg("variables"), + py::arg("name") = "", + R"( + Create user-defined Function which is a representation of a model + + Parameters + ---------- + results : List[Output] + List of results. + + parameters : List[op.Parameter] + List of parameters. + + variables : List[op.util.Variable] + List of variables. + + name : str + String to set as function's friendly name. + )"); + + function.def("validate_nodes_and_infer_types", &ov::Function::validate_nodes_and_infer_types); + function.def( "reshape", [](ov::Function& self, const std::map& partial_shapes) { @@ -270,6 +466,43 @@ void regclass_graph_Function(py::module m) { get_result : Node Node object representing result. )"); + function.def("get_result_index", + (int64_t(ov::Function::*)(const ov::Output&) const) & ov::Function::get_result_index, + py::arg("value"), + R"( + Return index of result. + + Return -1 if `value` not matched. + + Parameters + ---------- + value : Output + Output containing Node + + Returns + ---------- + get_result_index : int + Index for value referencing it. + )"); + function.def("get_result_index", + (int64_t(ov::Function::*)(const ov::Output&) const) & ov::Function::get_result_index, + py::arg("value"), + R"( + Return index of result. + + Return -1 if `value` not matched. + + Parameters + ---------- + value : Output + Output containing Node + + Returns + ---------- + get_result_index : int + Index for value referencing it. + )"); + function.def("get_name", &ov::Function::get_name, R"( @@ -309,7 +542,7 @@ void regclass_graph_Function(py::module m) { function.def("is_dynamic", &ov::Function::is_dynamic, R"( - Returns true if any of the op's defined in the function + Returns true if any of the op's defined in the function contains partial shape. Returns @@ -356,6 +589,7 @@ void regclass_graph_Function(py::module m) { "add_outputs", [](ov::Function& self, py::handle& outputs) { int i = 0; + std::vector> new_outputs; py::list _outputs; if (!py::isinstance(outputs)) { if (py::isinstance(outputs)) { @@ -372,22 +606,91 @@ void regclass_graph_Function(py::module m) { } for (py::handle output : _outputs) { + ov::Output out; if (py::isinstance(_outputs[i])) { - self.add_output(output.cast()); + out = self.add_output(output.cast()); } else if (py::isinstance(output)) { py::tuple output_tuple = output.cast(); - self.add_output(output_tuple[0].cast(), output_tuple[1].cast()); + out = self.add_output(output_tuple[0].cast(), output_tuple[1].cast()); } else if (py::isinstance>(_outputs[i])) { - self.add_output(output.cast>()); + out = self.add_output(output.cast>()); } else { throw py::type_error("Incorrect type of a value to add as output at index " + std::to_string(i) + "."); } + new_outputs.emplace_back(out); i++; } + return new_outputs; }, py::arg("outputs")); + function.def("replace_parameter", + &ov::Function::replace_parameter, + py::arg("parameter_index"), + py::arg("parameter"), + R"( + Replace the `parameter_index`th parameter of the function with `parameter`. + + All users of the `parameter_index`th parameter are redirected to `parameter`, and the + `parameter_index`th entry in the function parameter list is replaced with `parameter`. + + Parameters + ---------- + parameter_index : int + The index of the parameter to replace. + parameter: op.Parameter + The parameter to substitute for the `parameter_index`th parameter. + )"); + + function.def("get_parameter_index", + (int64_t(ov::Function::*)(const std::shared_ptr&) const) & + ov::Function::get_parameter_index, + py::arg("parameter"), + R"( + Return the index position of `parameter`. + + Return -1 if parameter not matched. + + Parameters + ---------- + parameter : op.Parameter + + Returns + ---------- + get_parameter_index : int + Index for parameter + )"); + + function.def( + "evaluate", + [](ov::Function& self, + ov::runtime::TensorVector& output_tensors, + const ov::runtime::TensorVector& input_tensors, + PyRTMap evaluation_context) -> bool { + return self.evaluate(output_tensors, input_tensors, evaluation_context); + }, + py::arg("output_tensors"), + py::arg("input_tensors"), + py::arg("evaluation_context") = PyRTMap(), + R"( + Evaluate the function on inputs, putting results in outputs + + Parameters + ---------- + output_tensors : List[op.Tensor] + Tensors for the outputs to compute. One for each result + input_tensors : List[op.Tensor] + Tensors for the inputs. One for each inputs. + evaluation_context: PyRTMap + Storage of additional settings and attributes that can be used + when evaluating the function. This additional information can be shared across nodes. + + Returns + ---------- + evaluate : bool + + )"); function.def("__repr__", [](const ov::Function& self) { std::string class_name = py::cast(self).get_type().attr("__name__").cast(); std::stringstream shapes_ss; diff --git a/runtime/bindings/python/src/pyopenvino/graph/function.hpp b/src/bindings/python/src/pyopenvino/graph/function.hpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/graph/function.hpp rename to src/bindings/python/src/pyopenvino/graph/function.hpp diff --git a/runtime/bindings/python/src/pyopenvino/graph/layout.cpp b/src/bindings/python/src/pyopenvino/graph/layout.cpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/graph/layout.cpp rename to src/bindings/python/src/pyopenvino/graph/layout.cpp diff --git a/runtime/bindings/python/src/pyopenvino/graph/layout.hpp b/src/bindings/python/src/pyopenvino/graph/layout.hpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/graph/layout.hpp rename to src/bindings/python/src/pyopenvino/graph/layout.hpp diff --git a/runtime/bindings/python/src/pyopenvino/graph/layout_helpers.cpp b/src/bindings/python/src/pyopenvino/graph/layout_helpers.cpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/graph/layout_helpers.cpp rename to src/bindings/python/src/pyopenvino/graph/layout_helpers.cpp diff --git a/runtime/bindings/python/src/pyopenvino/graph/layout_helpers.hpp b/src/bindings/python/src/pyopenvino/graph/layout_helpers.hpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/graph/layout_helpers.hpp rename to src/bindings/python/src/pyopenvino/graph/layout_helpers.hpp diff --git a/runtime/bindings/python/src/pyopenvino/graph/node.cpp b/src/bindings/python/src/pyopenvino/graph/node.cpp similarity index 98% rename from runtime/bindings/python/src/pyopenvino/graph/node.cpp rename to src/bindings/python/src/pyopenvino/graph/node.cpp index ce20f8147fc..adaefe67966 100644 --- a/runtime/bindings/python/src/pyopenvino/graph/node.cpp +++ b/src/bindings/python/src/pyopenvino/graph/node.cpp @@ -31,7 +31,7 @@ public: namespace py = pybind11; -using PyRTMap = std::map>; +using PyRTMap = ov::Node::RTMap; PYBIND11_MAKE_OPAQUE(PyRTMap); @@ -174,7 +174,7 @@ void regclass_graph_Node(py::module m) { Returns ---------- get_type_name : str - String repesenting Type's name. + String repesenting Type's name. )"); node.def("get_name", &ov::Node::get_name, @@ -189,7 +189,7 @@ void regclass_graph_Node(py::module m) { node.def("get_friendly_name", &ov::Node::get_friendly_name, R"( - Gets the friendly name for a node. If no friendly name has + Gets the friendly name for a node. If no friendly name has been set via set_friendly_name then the node's unique name is returned. @@ -204,7 +204,7 @@ void regclass_graph_Node(py::module m) { py::arg("name"), R"( Sets a friendly name for a node. This does not overwrite the unique name - of the node and is retrieved via get_friendly_name(). Used mainly for + of the node and is retrieved via get_friendly_name(). Used mainly for debugging. The friendly name may be set exactly once. Parameters diff --git a/runtime/bindings/python/src/pyopenvino/graph/node.hpp b/src/bindings/python/src/pyopenvino/graph/node.hpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/graph/node.hpp rename to src/bindings/python/src/pyopenvino/graph/node.hpp diff --git a/runtime/bindings/python/src/pyopenvino/graph/node_factory.cpp b/src/bindings/python/src/pyopenvino/graph/node_factory.cpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/graph/node_factory.cpp rename to src/bindings/python/src/pyopenvino/graph/node_factory.cpp diff --git a/runtime/bindings/python/src/pyopenvino/graph/node_factory.hpp b/src/bindings/python/src/pyopenvino/graph/node_factory.hpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/graph/node_factory.hpp rename to src/bindings/python/src/pyopenvino/graph/node_factory.hpp diff --git a/runtime/bindings/python/src/pyopenvino/graph/node_input.cpp b/src/bindings/python/src/pyopenvino/graph/node_input.cpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/graph/node_input.cpp rename to src/bindings/python/src/pyopenvino/graph/node_input.cpp diff --git a/runtime/bindings/python/src/pyopenvino/graph/node_input.hpp b/src/bindings/python/src/pyopenvino/graph/node_input.hpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/graph/node_input.hpp rename to src/bindings/python/src/pyopenvino/graph/node_input.hpp diff --git a/runtime/bindings/python/src/pyopenvino/graph/node_output.cpp b/src/bindings/python/src/pyopenvino/graph/node_output.cpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/graph/node_output.cpp rename to src/bindings/python/src/pyopenvino/graph/node_output.cpp diff --git a/runtime/bindings/python/src/pyopenvino/graph/node_output.hpp b/src/bindings/python/src/pyopenvino/graph/node_output.hpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/graph/node_output.hpp rename to src/bindings/python/src/pyopenvino/graph/node_output.hpp diff --git a/runtime/bindings/python/src/pyopenvino/graph/ops/constant.cpp b/src/bindings/python/src/pyopenvino/graph/ops/constant.cpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/graph/ops/constant.cpp rename to src/bindings/python/src/pyopenvino/graph/ops/constant.cpp diff --git a/runtime/bindings/python/src/pyopenvino/graph/ops/constant.hpp b/src/bindings/python/src/pyopenvino/graph/ops/constant.hpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/graph/ops/constant.hpp rename to src/bindings/python/src/pyopenvino/graph/ops/constant.hpp diff --git a/runtime/bindings/python/src/pyopenvino/graph/ops/parameter.cpp b/src/bindings/python/src/pyopenvino/graph/ops/parameter.cpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/graph/ops/parameter.cpp rename to src/bindings/python/src/pyopenvino/graph/ops/parameter.cpp diff --git a/runtime/bindings/python/src/pyopenvino/graph/ops/parameter.hpp b/src/bindings/python/src/pyopenvino/graph/ops/parameter.hpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/graph/ops/parameter.hpp rename to src/bindings/python/src/pyopenvino/graph/ops/parameter.hpp diff --git a/runtime/bindings/python/src/pyopenvino/graph/ops/result.cpp b/src/bindings/python/src/pyopenvino/graph/ops/result.cpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/graph/ops/result.cpp rename to src/bindings/python/src/pyopenvino/graph/ops/result.cpp diff --git a/runtime/bindings/python/src/pyopenvino/graph/ops/result.hpp b/src/bindings/python/src/pyopenvino/graph/ops/result.hpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/graph/ops/result.hpp rename to src/bindings/python/src/pyopenvino/graph/ops/result.hpp diff --git a/runtime/bindings/python/src/pyopenvino/graph/ops/util/arithmetic_reduction.cpp b/src/bindings/python/src/pyopenvino/graph/ops/util/arithmetic_reduction.cpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/graph/ops/util/arithmetic_reduction.cpp rename to src/bindings/python/src/pyopenvino/graph/ops/util/arithmetic_reduction.cpp diff --git a/runtime/bindings/python/src/pyopenvino/graph/ops/util/arithmetic_reduction.hpp b/src/bindings/python/src/pyopenvino/graph/ops/util/arithmetic_reduction.hpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/graph/ops/util/arithmetic_reduction.hpp rename to src/bindings/python/src/pyopenvino/graph/ops/util/arithmetic_reduction.hpp diff --git a/runtime/bindings/python/src/pyopenvino/graph/ops/util/binary_elementwise_arithmetic.cpp b/src/bindings/python/src/pyopenvino/graph/ops/util/binary_elementwise_arithmetic.cpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/graph/ops/util/binary_elementwise_arithmetic.cpp rename to src/bindings/python/src/pyopenvino/graph/ops/util/binary_elementwise_arithmetic.cpp diff --git a/runtime/bindings/python/src/pyopenvino/graph/ops/util/binary_elementwise_arithmetic.hpp b/src/bindings/python/src/pyopenvino/graph/ops/util/binary_elementwise_arithmetic.hpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/graph/ops/util/binary_elementwise_arithmetic.hpp rename to src/bindings/python/src/pyopenvino/graph/ops/util/binary_elementwise_arithmetic.hpp diff --git a/runtime/bindings/python/src/pyopenvino/graph/ops/util/binary_elementwise_comparison.cpp b/src/bindings/python/src/pyopenvino/graph/ops/util/binary_elementwise_comparison.cpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/graph/ops/util/binary_elementwise_comparison.cpp rename to src/bindings/python/src/pyopenvino/graph/ops/util/binary_elementwise_comparison.cpp diff --git a/runtime/bindings/python/src/pyopenvino/graph/ops/util/binary_elementwise_comparison.hpp b/src/bindings/python/src/pyopenvino/graph/ops/util/binary_elementwise_comparison.hpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/graph/ops/util/binary_elementwise_comparison.hpp rename to src/bindings/python/src/pyopenvino/graph/ops/util/binary_elementwise_comparison.hpp diff --git a/runtime/bindings/python/src/pyopenvino/graph/ops/util/binary_elementwise_logical.cpp b/src/bindings/python/src/pyopenvino/graph/ops/util/binary_elementwise_logical.cpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/graph/ops/util/binary_elementwise_logical.cpp rename to src/bindings/python/src/pyopenvino/graph/ops/util/binary_elementwise_logical.cpp diff --git a/runtime/bindings/python/src/pyopenvino/graph/ops/util/binary_elementwise_logical.hpp b/src/bindings/python/src/pyopenvino/graph/ops/util/binary_elementwise_logical.hpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/graph/ops/util/binary_elementwise_logical.hpp rename to src/bindings/python/src/pyopenvino/graph/ops/util/binary_elementwise_logical.hpp diff --git a/runtime/bindings/python/src/pyopenvino/graph/ops/util/index_reduction.cpp b/src/bindings/python/src/pyopenvino/graph/ops/util/index_reduction.cpp similarity index 98% rename from runtime/bindings/python/src/pyopenvino/graph/ops/util/index_reduction.cpp rename to src/bindings/python/src/pyopenvino/graph/ops/util/index_reduction.cpp index bcbd8c1e668..a2285b6b759 100644 --- a/runtime/bindings/python/src/pyopenvino/graph/ops/util/index_reduction.cpp +++ b/src/bindings/python/src/pyopenvino/graph/ops/util/index_reduction.cpp @@ -15,7 +15,7 @@ namespace py = pybind11; void regclass_graph_op_util_IndexReduction(py::module m) { py::class_> indexReduction( m, - "IndexRedection"); + "IndexReduction"); indexReduction.def("get_reduction_axis", &ov::op::util::IndexReduction::get_reduction_axis); indexReduction.def("set_reduction_axis", &ov::op::util::IndexReduction::set_reduction_axis); diff --git a/runtime/bindings/python/src/pyopenvino/graph/ops/util/index_reduction.hpp b/src/bindings/python/src/pyopenvino/graph/ops/util/index_reduction.hpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/graph/ops/util/index_reduction.hpp rename to src/bindings/python/src/pyopenvino/graph/ops/util/index_reduction.hpp diff --git a/runtime/bindings/python/src/pyopenvino/graph/ops/util/regmodule_graph_op_util.cpp b/src/bindings/python/src/pyopenvino/graph/ops/util/regmodule_graph_op_util.cpp similarity index 94% rename from runtime/bindings/python/src/pyopenvino/graph/ops/util/regmodule_graph_op_util.cpp rename to src/bindings/python/src/pyopenvino/graph/ops/util/regmodule_graph_op_util.cpp index 1ae197b06f0..0e4f1e5d852 100644 --- a/runtime/bindings/python/src/pyopenvino/graph/ops/util/regmodule_graph_op_util.cpp +++ b/src/bindings/python/src/pyopenvino/graph/ops/util/regmodule_graph_op_util.cpp @@ -19,4 +19,5 @@ void regmodule_graph_op_util(py::module m) { // regclass_graph_op_util_UnaryElementwise(m_util); regclass_graph_op_util_UnaryElementwiseArithmetic(m_util); regclass_graph_op_util_IndexReduction(m_util); + regclass_graph_op_util_Variable(m_util); } diff --git a/runtime/bindings/python/src/pyopenvino/graph/ops/util/regmodule_graph_op_util.hpp b/src/bindings/python/src/pyopenvino/graph/ops/util/regmodule_graph_op_util.hpp similarity index 92% rename from runtime/bindings/python/src/pyopenvino/graph/ops/util/regmodule_graph_op_util.hpp rename to src/bindings/python/src/pyopenvino/graph/ops/util/regmodule_graph_op_util.hpp index fcd016ac64b..746e424a81a 100644 --- a/runtime/bindings/python/src/pyopenvino/graph/ops/util/regmodule_graph_op_util.hpp +++ b/src/bindings/python/src/pyopenvino/graph/ops/util/regmodule_graph_op_util.hpp @@ -5,12 +5,14 @@ #pragma once #include + #include "pyopenvino/graph/ops/util/arithmetic_reduction.hpp" #include "pyopenvino/graph/ops/util/binary_elementwise_arithmetic.hpp" #include "pyopenvino/graph/ops/util/binary_elementwise_comparison.hpp" #include "pyopenvino/graph/ops/util/binary_elementwise_logical.hpp" #include "pyopenvino/graph/ops/util/index_reduction.hpp" #include "pyopenvino/graph/ops/util/unary_elementwise_arithmetic.hpp" +#include "pyopenvino/graph/ops/util/variable.hpp" namespace py = pybind11; diff --git a/runtime/bindings/python/src/pyopenvino/graph/ops/util/unary_elementwise_arithmetic.cpp b/src/bindings/python/src/pyopenvino/graph/ops/util/unary_elementwise_arithmetic.cpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/graph/ops/util/unary_elementwise_arithmetic.cpp rename to src/bindings/python/src/pyopenvino/graph/ops/util/unary_elementwise_arithmetic.cpp diff --git a/runtime/bindings/python/src/pyopenvino/graph/ops/util/unary_elementwise_arithmetic.hpp b/src/bindings/python/src/pyopenvino/graph/ops/util/unary_elementwise_arithmetic.hpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/graph/ops/util/unary_elementwise_arithmetic.hpp rename to src/bindings/python/src/pyopenvino/graph/ops/util/unary_elementwise_arithmetic.hpp diff --git a/src/bindings/python/src/pyopenvino/graph/ops/util/variable.cpp b/src/bindings/python/src/pyopenvino/graph/ops/util/variable.cpp new file mode 100644 index 00000000000..04354883444 --- /dev/null +++ b/src/bindings/python/src/pyopenvino/graph/ops/util/variable.cpp @@ -0,0 +1,28 @@ +#include "pyopenvino/graph/ops/util/variable.hpp" + +#include +#include +#include + +#include "openvino/op/util/variable.hpp" + +namespace py = pybind11; + +void regclass_graph_op_util_Variable(py::module m) { + py::class_ variable_info(m, "VariableInfo"); + variable_info.doc() = "openvino.impl.op.util.VariableInfo wraps ov::op::util::VariableInfo"; + variable_info.def(py::init<>()); + variable_info.def_readwrite("data_shape", &ov::op::util::VariableInfo::data_shape); + variable_info.def_readwrite("data_type", &ov::op::util::VariableInfo::data_type); + variable_info.def_readwrite("variable_id", &ov::op::util::VariableInfo::variable_id); + + py::class_> variable(m, "Variable"); + variable.doc() = "openvino.impl.op.util.Variable wraps ov::op::util::Variable"; + variable.def(py::init([](const ov::op::util::VariableInfo& info) { + return ov::op::util::Variable{info}; + }), + py::arg("info")); + variable.def_property_readonly("info", &ov::op::util::Variable::get_info); + variable.def("get_info", &ov::op::util::Variable::get_info); + variable.def("update", &ov::op::util::Variable::update, py::arg("variable_info")); +} diff --git a/src/bindings/python/src/pyopenvino/graph/ops/util/variable.hpp b/src/bindings/python/src/pyopenvino/graph/ops/util/variable.hpp new file mode 100644 index 00000000000..fe984017654 --- /dev/null +++ b/src/bindings/python/src/pyopenvino/graph/ops/util/variable.hpp @@ -0,0 +1,11 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include + +namespace py = pybind11; + +void regclass_graph_op_util_Variable(py::module m); diff --git a/runtime/bindings/python/src/pyopenvino/graph/partial_shape.cpp b/src/bindings/python/src/pyopenvino/graph/partial_shape.cpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/graph/partial_shape.cpp rename to src/bindings/python/src/pyopenvino/graph/partial_shape.cpp diff --git a/runtime/bindings/python/src/pyopenvino/graph/partial_shape.hpp b/src/bindings/python/src/pyopenvino/graph/partial_shape.hpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/graph/partial_shape.hpp rename to src/bindings/python/src/pyopenvino/graph/partial_shape.hpp diff --git a/runtime/bindings/python/src/pyopenvino/graph/passes/manager.cpp b/src/bindings/python/src/pyopenvino/graph/passes/manager.cpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/graph/passes/manager.cpp rename to src/bindings/python/src/pyopenvino/graph/passes/manager.cpp diff --git a/runtime/bindings/python/src/pyopenvino/graph/passes/manager.hpp b/src/bindings/python/src/pyopenvino/graph/passes/manager.hpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/graph/passes/manager.hpp rename to src/bindings/python/src/pyopenvino/graph/passes/manager.hpp diff --git a/runtime/bindings/python/src/pyopenvino/graph/passes/regmodule_graph_passes.cpp b/src/bindings/python/src/pyopenvino/graph/passes/regmodule_graph_passes.cpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/graph/passes/regmodule_graph_passes.cpp rename to src/bindings/python/src/pyopenvino/graph/passes/regmodule_graph_passes.cpp diff --git a/runtime/bindings/python/src/pyopenvino/graph/passes/regmodule_graph_passes.hpp b/src/bindings/python/src/pyopenvino/graph/passes/regmodule_graph_passes.hpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/graph/passes/regmodule_graph_passes.hpp rename to src/bindings/python/src/pyopenvino/graph/passes/regmodule_graph_passes.hpp diff --git a/src/bindings/python/src/pyopenvino/graph/preprocess/pre_post_process.cpp b/src/bindings/python/src/pyopenvino/graph/preprocess/pre_post_process.cpp new file mode 100644 index 00000000000..1393ff7494c --- /dev/null +++ b/src/bindings/python/src/pyopenvino/graph/preprocess/pre_post_process.cpp @@ -0,0 +1,420 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "pyopenvino/graph/preprocess/pre_post_process.hpp" + +#include +#include + +#include "openvino/core/function.hpp" +#include "openvino/core/node.hpp" +#include "openvino/core/preprocess/pre_post_process.hpp" +#include "pyopenvino/core/common.hpp" + +namespace py = pybind11; + +// Custom holder wrapping returned references to preprocessing objects +PYBIND11_DECLARE_HOLDER_TYPE(T, Common::ref_wrapper) + +static void regclass_graph_PreProcessSteps(py::module m) { + py::class_> steps( + m, + "PreProcessSteps"); + steps.doc() = "openvino.impl.preprocess.PreProcessSteps wraps ov::preprocess::PreProcessSteps"; + + steps.def( + "mean", + [](ov::preprocess::PreProcessSteps& me, float value) { + return &me.mean(value); + }, + py::arg("value"), + R"( + Subtracts single float value from each element in input tensor. + Input tensor must have ov.Type.f32 data type. + Parameters + ---------- + value : float + Value to subtract. + Returns + ---------- + mean : PreProcessSteps + Reference to itself to allow chaining of calls in client's code in a builder-like manner. + )"); + steps.def( + "mean", + [](ov::preprocess::PreProcessSteps& me, const std::vector& values) { + return &me.mean(values); + }, + py::arg("values"), + R"( + Subtracts a given single float value from each element in a given channel from input tensor. + Input tensor must have ov.Type.f32 data type. + Parameters + ---------- + values : List + Values to subtract. + Returns + ---------- + mean : PreProcessSteps + Reference to itself to allow chaining of calls in client's code in a builder-like manner. + )"); + steps.def( + "scale", + [](ov::preprocess::PreProcessSteps& me, float value) { + return &me.scale(value); + }, + py::arg("value"), + R"( + Divides each element in input tensor by specified constant float value. + Input tensor must have ov.Type.f32 data type. + Parameters + ---------- + value : float + Value to divide. + Returns + ---------- + scale : PreProcessSteps + Reference to itself to allow chaining of calls in client's code in a builder-like manner. + )"); + steps.def( + "scale", + [](ov::preprocess::PreProcessSteps& me, const std::vector& values) { + return &me.scale(values); + }, + py::arg("values"), + R"( + Divides each element in a given channel from input tensor by a given single float value. + Input tensor must have ov.Type.f32 data type. + Parameters + ---------- + value : List + Value to divide. + Returns + ---------- + scale : PreProcessSteps + Reference to itself to allow chaining of calls in client's code in a builder-like manner. + )"); + steps.def( + "convert_element_type", + [](ov::preprocess::PreProcessSteps& me, ov::element::Type type) { + return &me.convert_element_type(type); + }, + py::arg("type"), + R"( + Converts input tensor element type to specified type. + Input tensor must have openvino.Type.f32 data type. + Parameters + ---------- + type : Type + Destination type. + Returns + ---------- + convert_element_type : PreProcessSteps + Reference to itself to allow chaining of calls in client's code in a builder-like manner. + )"); + steps.def( + "custom", + [](ov::preprocess::PreProcessSteps& me, py::function op) { + return &me.custom(op.cast()); + }, + py::arg("operation"), + R"( + Adds custom preprocessing operation. + Parameters + ---------- + operation : function taking Output as input argument and returning Output after preprocessing. + Returns + ---------- + custom : PreProcessSteps + Reference to itself to allow chaining of calls in client's code in a builder-like manner. + )"); + steps.def( + "convert_color", + [](ov::preprocess::PreProcessSteps& me, const ov::preprocess::ColorFormat& dst_format) { + return &me.convert_color(dst_format); + }, + py::arg("dst_format")); + steps.def( + "resize", + [](ov::preprocess::PreProcessSteps& me, + ov::preprocess::ResizeAlgorithm alg, + size_t dst_height, + size_t dst_width) { + return &me.resize(alg, dst_height, dst_width); + }, + py::arg("alg"), + py::arg("dst_height"), + py::arg("dst_width")); + steps.def( + "resize", + [](ov::preprocess::PreProcessSteps& me, ov::preprocess::ResizeAlgorithm alg) { + return &me.resize(alg); + }, + py::arg("alg")); + steps.def( + "convert_layout", + [](ov::preprocess::PreProcessSteps& me, const ov::Layout& layout = {}) { + return &me.convert_layout(layout); + }, + py::arg("dst_layout")); + steps.def( + "convert_layout", + [](ov::preprocess::PreProcessSteps& me, const std::vector& dims) { + return &me.convert_layout(dims); + }, + py::arg("dims")); + steps.def("reverse_channels", [](ov::preprocess::PreProcessSteps& me) { + return &me.reverse_channels(); + }); +} + +static void regclass_graph_PostProcessSteps(py::module m) { + py::class_> steps( + m, + "PostProcessSteps"); + steps.doc() = "openvino.impl.preprocess.PostprocessSteps wraps ov::preprocess::PostProcessSteps"; + + steps.def( + "convert_element_type", + [](ov::preprocess::PostProcessSteps& me, ov::element::Type type) { + return &me.convert_element_type(type); + }, + py::arg("type"), + R"( + Converts tensor element type to specified type. + Tensor must have openvino.Type.f32 data type. + Parameters + ---------- + type : Type + Destination type. + Returns + ---------- + convert_element_type : PostProcessSteps + Reference to itself to allow chaining of calls in client's code in a builder-like manner. + )"); + steps.def( + "convert_layout", + [](ov::preprocess::PostProcessSteps& me, const ov::Layout& layout = {}) { + return &me.convert_layout(layout); + }, + py::arg("dst_layout")); + steps.def( + "convert_layout", + [](ov::preprocess::PostProcessSteps& me, const std::vector& dims) { + return &me.convert_layout(dims); + }, + py::arg("dims")); + steps.def( + "custom", + [](ov::preprocess::PostProcessSteps& me, py::function op) { + return &me.custom(op.cast()); + }, + py::arg("operation"), + R"( + Adds custom postprocessing operation. + Parameters + ---------- + operation : function taking Output as input argument and returning Output after postprocessing. + Returns + ---------- + custom : PostProcessSteps + Reference to itself to allow chaining of calls in client's code in a builder-like manner. + )"); +} + +static void regclass_graph_InputTensorInfo(py::module m) { + py::class_> info( + m, + "InputTensorInfo"); + info.doc() = "openvino.impl.preprocess.InputTensorInfo wraps ov::preprocess::InputTensorInfo"; + + info.def( + "set_element_type", + [](ov::preprocess::InputTensorInfo& me, const ov::element::Type& type) { + return &me.set_element_type(type); + }, + py::arg("type"), + R"( + Set initial client's tensor element type. If type is not the same as network's element type, + conversion of element type will be done automatically. + Parameters + ---------- + type : Type + Client's input tensor element type. + Returns + ---------- + tensor : InputTensorInfo + Reference to itself to allow chaining of calls in client's code in a builder-like manner. + )"); + info.def("set_layout", [](ov::preprocess::InputTensorInfo& me, const ov::Layout& layout) { + return &me.set_layout(layout); + }); + info.def("set_spatial_dynamic_shape", [](ov::preprocess::InputTensorInfo& me) { + return &me.set_spatial_dynamic_shape(); + }); + info.def("set_spatial_static_shape", [](ov::preprocess::InputTensorInfo& me, size_t height, size_t width) { + return &me.set_spatial_static_shape(height, width); + ; + }); + info.def("set_color_format", + [](ov::preprocess::InputTensorInfo& me, + const ov::preprocess::ColorFormat& format, + const std::vector& sub_names = {}) { + return &me.set_color_format(format, sub_names); + }); +} + +static void regclass_graph_OutputTensorInfo(py::module m) { + py::class_> info( + m, + "OutputTensorInfo"); + info.doc() = "openvino.impl.preprocess.OutputTensorInfo wraps ov::preprocess::OutputTensorInfo"; + + info.def( + "set_element_type", + [](ov::preprocess::OutputTensorInfo& me, const ov::element::Type& type) { + return &me.set_element_type(type); + }, + py::arg("type"), + R"( + Set client's output tensor element type. If type is not the same as network's element type, + conversion of element type will be done automatically. + Parameters + ---------- + type : Type + Client's output tensor element type. + Returns + ---------- + tensor : OutputTensorInfo + Reference to itself to allow chaining of calls in client's code in a builder-like manner. + )"); + info.def("set_layout", [](ov::preprocess::OutputTensorInfo& me, const ov::Layout& layout) { + return &me.set_layout(layout); + }); +} + +static void regclass_graph_InputInfo(py::module m) { + py::class_> inp(m, "InputInfo"); + inp.doc() = "openvino.impl.preprocess.InputInfo wraps ov::preprocess::InputInfo"; + + inp.def("tensor", [](ov::preprocess::InputInfo& me) { + return &me.tensor(); + }); + inp.def("preprocess", [](ov::preprocess::InputInfo& me) { + return &me.preprocess(); + }); + inp.def("network", [](ov::preprocess::InputInfo& me) { + return &me.network(); + }); +} + +static void regclass_graph_OutputInfo(py::module m) { + py::class_> out(m, "OutputInfo"); + out.doc() = "openvino.impl.preprocess.OutputInfo wraps ov::preprocess::OutputInfo"; + + out.def("tensor", [](ov::preprocess::OutputInfo& me) { + return &me.tensor(); + }); + out.def("postprocess", [](ov::preprocess::OutputInfo& me) { + return &me.postprocess(); + }); + out.def("network", [](ov::preprocess::OutputInfo& me) { + return &me.network(); + }); +} + +static void regclass_graph_OutputNetworkInfo(py::module m) { + py::class_> info( + m, + "OutputNetworkInfo"); + info.doc() = "openvino.impl.preprocess.OutputNetworkInfo wraps ov::preprocess::OutputNetworkInfo"; + + info.def("set_layout", [](ov::preprocess::OutputNetworkInfo& me, const ov::Layout& layout) { + return &me.set_layout(layout); + }); +} + +static void regclass_graph_InputNetworkInfo(py::module m) { + py::class_> info( + m, + "InputNetworkInfo"); + info.doc() = "openvino.impl.preprocess.InputNetworkInfo wraps ov::preprocess::InputNetworkInfo"; + + info.def("set_layout", [](ov::preprocess::InputNetworkInfo& me, const ov::Layout& layout) { + return &me.set_layout(layout); + }); +} + +static void regenum_graph_ColorFormat(py::module m) { + py::enum_(m, "ColorFormat") + .value("UNDEFINED", ov::preprocess::ColorFormat::UNDEFINED) + .value("NV12_SINGLE_PLANE", ov::preprocess::ColorFormat::NV12_SINGLE_PLANE) + .value("NV12_TWO_PLANES", ov::preprocess::ColorFormat::NV12_TWO_PLANES) + .value("I420_SINGLE_PLANE", ov::preprocess::ColorFormat::I420_SINGLE_PLANE) + .value("I420_THREE_PLANES", ov::preprocess::ColorFormat::I420_THREE_PLANES) + .value("RGB", ov::preprocess::ColorFormat::RGB) + .value("BGR", ov::preprocess::ColorFormat::BGR) + .value("RGBX", ov::preprocess::ColorFormat::RGBX) + .value("BGRX", ov::preprocess::ColorFormat::BGRX) + .export_values(); +} + +static void regenum_graph_ResizeAlgorithm(py::module m) { + py::enum_(m, "ResizeAlgorithm") + .value("RESIZE_LINEAR", ov::preprocess::ResizeAlgorithm::RESIZE_LINEAR) + .value("RESIZE_CUBIC", ov::preprocess::ResizeAlgorithm::RESIZE_CUBIC) + .value("RESIZE_NEAREST", ov::preprocess::ResizeAlgorithm::RESIZE_NEAREST) + .export_values(); +} + +void regclass_graph_PrePostProcessor(py::module m) { + regclass_graph_PreProcessSteps(m); + regclass_graph_PostProcessSteps(m); + regclass_graph_InputInfo(m); + regclass_graph_OutputInfo(m); + regclass_graph_InputTensorInfo(m); + regclass_graph_OutputTensorInfo(m); + regclass_graph_InputNetworkInfo(m); + regclass_graph_OutputNetworkInfo(m); + regenum_graph_ColorFormat(m); + regenum_graph_ResizeAlgorithm(m); + py::class_> proc( + m, + "PrePostProcessor"); + proc.doc() = "openvino.impl.preprocess.PrePostProcessor wraps ov::preprocess::PrePostProcessor"; + + proc.def(py::init&>()); + + proc.def("input", [](ov::preprocess::PrePostProcessor& me) { + return &me.input(); + }); + proc.def( + "input", + [](ov::preprocess::PrePostProcessor& me, const std::string& tensor_name) { + return &me.input(tensor_name); + }, + py::arg("tensor_name")); + proc.def( + "input", + [](ov::preprocess::PrePostProcessor& me, size_t input_index) { + return &me.input(input_index); + }, + py::arg("input_index")); + proc.def("output", [](ov::preprocess::PrePostProcessor& me) { + return &me.output(); + }); + proc.def( + "output", + [](ov::preprocess::PrePostProcessor& me, const std::string& tensor_name) { + return &me.output(tensor_name); + }, + py::arg("tensor_name")); + proc.def( + "output", + [](ov::preprocess::PrePostProcessor& me, size_t output_index) { + return &me.output(output_index); + }, + py::arg("output_index")); + proc.def("build", &ov::preprocess::PrePostProcessor::build); +} diff --git a/runtime/bindings/python/src/pyopenvino/graph/preprocess/pre_post_process.hpp b/src/bindings/python/src/pyopenvino/graph/preprocess/pre_post_process.hpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/graph/preprocess/pre_post_process.hpp rename to src/bindings/python/src/pyopenvino/graph/preprocess/pre_post_process.hpp diff --git a/runtime/bindings/python/src/pyopenvino/graph/rt_map.cpp b/src/bindings/python/src/pyopenvino/graph/rt_map.cpp similarity index 59% rename from runtime/bindings/python/src/pyopenvino/graph/rt_map.cpp rename to src/bindings/python/src/pyopenvino/graph/rt_map.cpp index ba52c2ca5c5..95f1d8f0f42 100644 --- a/runtime/bindings/python/src/pyopenvino/graph/rt_map.cpp +++ b/src/bindings/python/src/pyopenvino/graph/rt_map.cpp @@ -20,29 +20,19 @@ namespace py = pybind11; -using PyRTMap = std::map>; +using PyRTMap = ov::RTMap; PYBIND11_MAKE_OPAQUE(PyRTMap); -template -void _set_with_variant(PyRTMap& m, const std::string& k, const T v) { - auto new_v = std::make_shared>(ov::VariantWrapper(v)); - auto it = m.find(k); - if (it != m.end()) - it->second = new_v; - else - m.emplace(k, new_v); -} - void regclass_graph_PyRTMap(py::module m) { auto py_map = py::bind_map(m, "PyRTMap"); - py_map.doc() = "ngraph.impl.PyRTMap makes bindings for std::map>, which can later be used as ov::Node::RTMap"; + py_map.doc() = "openvino.impl.PyRTMap makes bindings for std::map + +#include "openvino/core/any.hpp" + +namespace py = pybind11; + +void regclass_graph_Variant(py::module m) { + py::class_ variant_base(m, "Variant", py::module_local()); + variant_base.doc() = "openvino.impl.Variant wraps ov::Any"; + + variant_base.def( + "__eq__", + [](const ov::Any& a, const ov::Any& b) { + return a == b; + }, + py::is_operator()); + variant_base.def( + "__eq__", + [](const ov::Any& a, const std::string& b) { + return a.as() == b; + }, + py::is_operator()); + variant_base.def( + "__eq__", + [](const ov::Any& a, const int64_t& b) { + return a.as() == b; + }, + py::is_operator()); + + variant_base.def("__repr__", [](const ov::Any self) { + std::stringstream ret; + self.print(ret); + return ret.str(); + }); +} + +template void regclass_graph_VariantWrapper(py::module m, std::string typestring); +template void regclass_graph_VariantWrapper(py::module m, std::string typestring); diff --git a/src/bindings/python/src/pyopenvino/graph/variant.hpp b/src/bindings/python/src/pyopenvino/graph/variant.hpp new file mode 100644 index 00000000000..3dee3c6d6f0 --- /dev/null +++ b/src/bindings/python/src/pyopenvino/graph/variant.hpp @@ -0,0 +1,86 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include +#include + +#include +#include + +#include "openvino/core/any.hpp" // ov::Variant + +namespace py = pybind11; + +void regclass_graph_Variant(py::module m); + +template +struct AnyT : public ov::Any { + using ov::Any::Any; +}; + +template +extern void regclass_graph_VariantWrapper(py::module m, std::string typestring) +{ + auto pyclass_name = py::detail::c_str((std::string("Variant") + typestring)); + py::class_, ov::Any> + variant_wrapper(m, pyclass_name, py::module_local()); + variant_wrapper.doc() = + "openvino.impl.Variant[" + typestring + "] wraps ov::Any with " + typestring; + + variant_wrapper.def(py::init()); + + variant_wrapper.def( + "__eq__", + [](const ov::Any& a, const ov::Any& b) { + return a.as() == b.as(); + }, + py::is_operator()); + variant_wrapper.def( + "__eq__", + [](const ov::Any& a, const std::string& b) { + return a.as() == b; + }, + py::is_operator()); + variant_wrapper.def( + "__eq__", + [](const ov::Any& a, const int64_t& b) { return a.as() == b; }, + py::is_operator()); + + variant_wrapper.def("__repr__", [](const ov::Any self) { + std::stringstream ret; + self.print(ret); + return ret.str(); + }); + + variant_wrapper.def("get", + [] (const ov::Any& self) { + return self.as(); + }, + R"( + Returns + ---------- + get : Variant + Value of ov::Any. + )"); + variant_wrapper.def("set", + [] (ov::Any& self, const VT value) { + self = value; + }, + R"( + Parameters + ---------- + set : str or int + Value to be set in ov::Any. + )"); + + variant_wrapper.def_property("value", + [] (const ov::Any& self) { + return self.as(); + }, + [] (ov::Any& self, const VT value) { + self = value; + }); +} diff --git a/runtime/bindings/python/src/pyopenvino/pyopenvino.cpp b/src/bindings/python/src/pyopenvino/pyopenvino.cpp similarity index 100% rename from runtime/bindings/python/src/pyopenvino/pyopenvino.cpp rename to src/bindings/python/src/pyopenvino/pyopenvino.cpp diff --git a/runtime/bindings/python/tests/__init__.py b/src/bindings/python/tests/__init__.py similarity index 100% rename from runtime/bindings/python/tests/__init__.py rename to src/bindings/python/tests/__init__.py diff --git a/runtime/bindings/python/tests/conftest.py b/src/bindings/python/tests/conftest.py similarity index 100% rename from runtime/bindings/python/tests/conftest.py rename to src/bindings/python/tests/conftest.py diff --git a/runtime/bindings/python/tests/mock/mock_py_ov_frontend/CMakeLists.txt b/src/bindings/python/tests/mock/mock_py_ov_frontend/CMakeLists.txt similarity index 100% rename from runtime/bindings/python/tests/mock/mock_py_ov_frontend/CMakeLists.txt rename to src/bindings/python/tests/mock/mock_py_ov_frontend/CMakeLists.txt diff --git a/runtime/bindings/python/tests/mock/mock_py_ov_frontend/mock_py_frontend.cpp b/src/bindings/python/tests/mock/mock_py_ov_frontend/mock_py_frontend.cpp similarity index 100% rename from runtime/bindings/python/tests/mock/mock_py_ov_frontend/mock_py_frontend.cpp rename to src/bindings/python/tests/mock/mock_py_ov_frontend/mock_py_frontend.cpp diff --git a/runtime/bindings/python/tests/mock/mock_py_ov_frontend/mock_py_frontend.hpp b/src/bindings/python/tests/mock/mock_py_ov_frontend/mock_py_frontend.hpp similarity index 100% rename from runtime/bindings/python/tests/mock/mock_py_ov_frontend/mock_py_frontend.hpp rename to src/bindings/python/tests/mock/mock_py_ov_frontend/mock_py_frontend.hpp diff --git a/runtime/bindings/python/tests/mock/pyngraph_fe_mock_api/CMakeLists.txt b/src/bindings/python/tests/mock/pyngraph_fe_mock_api/CMakeLists.txt similarity index 100% rename from runtime/bindings/python/tests/mock/pyngraph_fe_mock_api/CMakeLists.txt rename to src/bindings/python/tests/mock/pyngraph_fe_mock_api/CMakeLists.txt diff --git a/runtime/bindings/python/tests/mock/pyngraph_fe_mock_api/pyngraph_mock_frontend_api.cpp b/src/bindings/python/tests/mock/pyngraph_fe_mock_api/pyngraph_mock_frontend_api.cpp similarity index 100% rename from runtime/bindings/python/tests/mock/pyngraph_fe_mock_api/pyngraph_mock_frontend_api.cpp rename to src/bindings/python/tests/mock/pyngraph_fe_mock_api/pyngraph_mock_frontend_api.cpp diff --git a/runtime/bindings/python/tests/runtime.py b/src/bindings/python/tests/runtime.py similarity index 100% rename from runtime/bindings/python/tests/runtime.py rename to src/bindings/python/tests/runtime.py diff --git a/runtime/bindings/python/tests/test_inference_engine/__init__.py b/src/bindings/python/tests/test_inference_engine/__init__.py similarity index 100% rename from runtime/bindings/python/tests/test_inference_engine/__init__.py rename to src/bindings/python/tests/test_inference_engine/__init__.py diff --git a/runtime/bindings/python/tests/test_inference_engine/test_core.py b/src/bindings/python/tests/test_inference_engine/test_core.py similarity index 100% rename from runtime/bindings/python/tests/test_inference_engine/test_core.py rename to src/bindings/python/tests/test_inference_engine/test_core.py diff --git a/runtime/bindings/python/tests/test_inference_engine/test_executable_network.py b/src/bindings/python/tests/test_inference_engine/test_executable_network.py similarity index 100% rename from runtime/bindings/python/tests/test_inference_engine/test_executable_network.py rename to src/bindings/python/tests/test_inference_engine/test_executable_network.py diff --git a/src/bindings/python/tests/test_inference_engine/test_function.py b/src/bindings/python/tests/test_inference_engine/test_function.py new file mode 100644 index 00000000000..6929ca56c47 --- /dev/null +++ b/src/bindings/python/tests/test_inference_engine/test_function.py @@ -0,0 +1,262 @@ +# Copyright (C) 2021 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +import numpy as np +import pytest + +import openvino.opset8 as ops + +from openvino import Function, Tensor +from openvino.descriptor import Tensor as DescriptorTensor + +from openvino.impl import PartialShape, Shape + + +def test_function_add_outputs_tensor_name(): + input_shape = PartialShape([1]) + param = ops.parameter(input_shape, dtype=np.float32, name="data") + relu1 = ops.relu(param, name="relu1") + relu1.get_output_tensor(0).set_names({"relu_t1"}) + assert "relu_t1" in relu1.get_output_tensor(0).names + relu2 = ops.relu(relu1, name="relu2") + function = Function(relu2, [param], "TestFunction") + assert len(function.get_results()) == 1 + new_outs = function.add_outputs("relu_t1") + assert len(function.get_results()) == 2 + assert isinstance(function.outputs[1].get_tensor(), DescriptorTensor) + assert "relu_t1" in function.outputs[1].get_tensor().names + assert len(new_outs) == 1 + assert new_outs[0].get_node() == function.outputs[1].get_node() + assert new_outs[0].get_index() == function.outputs[1].get_index() + + +def test_function_add_outputs_op_name(): + input_shape = PartialShape([1]) + param = ops.parameter(input_shape, dtype=np.float32, name="data") + relu1 = ops.relu(param, name="relu1") + relu1.get_output_tensor(0).set_names({"relu_t1"}) + relu2 = ops.relu(relu1, name="relu2") + function = Function(relu2, [param], "TestFunction") + assert len(function.get_results()) == 1 + new_outs = function.add_outputs(("relu1", 0)) + assert len(function.get_results()) == 2 + assert len(new_outs) == 1 + assert new_outs[0].get_node() == function.outputs[1].get_node() + assert new_outs[0].get_index() == function.outputs[1].get_index() + + +def test_function_add_output_port(): + input_shape = PartialShape([1]) + param = ops.parameter(input_shape, dtype=np.float32, name="data") + relu1 = ops.relu(param, name="relu1") + relu1.get_output_tensor(0).set_names({"relu_t1"}) + relu2 = ops.relu(relu1, name="relu2") + function = Function(relu2, [param], "TestFunction") + assert len(function.get_results()) == 1 + new_outs = function.add_outputs(relu1.output(0)) + assert len(function.get_results()) == 2 + assert len(new_outs) == 1 + assert new_outs[0].get_node() == function.outputs[1].get_node() + assert new_outs[0].get_index() == function.outputs[1].get_index() + + +def test_function_add_output_incorrect_tensor_name(): + input_shape = PartialShape([1]) + param = ops.parameter(input_shape, dtype=np.float32, name="data") + relu1 = ops.relu(param, name="relu1") + relu1.get_output_tensor(0).set_names({"relu_t1"}) + relu2 = ops.relu(relu1, name="relu2") + function = Function(relu2, [param], "TestFunction") + assert len(function.get_results()) == 1 + with pytest.raises(RuntimeError) as e: + function.add_outputs("relu_t") + assert "Tensor name relu_t was not found." in str(e.value) + + +def test_function_add_output_incorrect_idx(): + input_shape = PartialShape([1]) + param = ops.parameter(input_shape, dtype=np.float32, name="data") + relu1 = ops.relu(param, name="relu1") + relu1.get_output_tensor(0).set_names({"relu_t1"}) + relu2 = ops.relu(relu1, name="relu2") + function = Function(relu2, [param], "TestFunction") + assert len(function.get_results()) == 1 + with pytest.raises(RuntimeError) as e: + function.add_outputs(("relu1", 10)) + assert "Cannot add output to port 10 operation relu1 has only 1 outputs." in str( + e.value + ) + + +def test_function_add_output_incorrect_name(): + input_shape = PartialShape([1]) + param = ops.parameter(input_shape, dtype=np.float32, name="data") + relu1 = ops.relu(param, name="relu1") + relu1.get_output_tensor(0).set_names({"relu_t1"}) + relu2 = ops.relu(relu1, name="relu2") + function = Function(relu2, [param], "TestFunction") + assert len(function.get_results()) == 1 + with pytest.raises(RuntimeError) as e: + function.add_outputs(("relu_1", 0)) + assert "Port 0 for operation with name relu_1 was not found." in str(e.value) + + +def test_add_outputs_several_tensors(): + input_shape = PartialShape([1]) + param = ops.parameter(input_shape, dtype=np.float32, name="data") + relu1 = ops.relu(param, name="relu1") + relu1.get_output_tensor(0).set_names({"relu_t1"}) + relu2 = ops.relu(relu1, name="relu2") + relu2.get_output_tensor(0).set_names({"relu_t2"}) + relu3 = ops.relu(relu2, name="relu3") + function = Function(relu3, [param], "TestFunction") + assert len(function.get_results()) == 1 + new_outs = function.add_outputs(["relu_t1", "relu_t2"]) + assert len(function.get_results()) == 3 + assert len(new_outs) == 2 + assert new_outs[0].get_node() == function.outputs[1].get_node() + assert new_outs[0].get_index() == function.outputs[1].get_index() + assert new_outs[1].get_node() == function.outputs[2].get_node() + assert new_outs[1].get_index() == function.outputs[2].get_index() + + +def test_add_outputs_several_ports(): + input_shape = PartialShape([1]) + param = ops.parameter(input_shape, dtype=np.float32, name="data") + relu1 = ops.relu(param, name="relu1") + relu1.get_output_tensor(0).set_names({"relu_t1"}) + relu2 = ops.relu(relu1, name="relu2") + relu2.get_output_tensor(0).set_names({"relu_t2"}) + relu3 = ops.relu(relu2, name="relu3") + function = Function(relu3, [param], "TestFunction") + assert len(function.get_results()) == 1 + new_outs = function.add_outputs([("relu1", 0), ("relu2", 0)]) + assert len(function.get_results()) == 3 + assert len(new_outs) == 2 + assert new_outs[0].get_node() == function.outputs[1].get_node() + assert new_outs[0].get_index() == function.outputs[1].get_index() + assert new_outs[1].get_node() == function.outputs[2].get_node() + assert new_outs[1].get_index() == function.outputs[2].get_index() + + +def test_add_outputs_incorrect_value(): + input_shape = PartialShape([1]) + param = ops.parameter(input_shape, dtype=np.float32, name="data") + relu1 = ops.relu(param, name="relu1") + relu1.get_output_tensor(0).set_names({"relu_t1"}) + relu2 = ops.relu(relu1, name="relu2") + function = Function(relu2, [param], "TestFunction") + assert len(function.get_results()) == 1 + with pytest.raises(TypeError) as e: + function.add_outputs(0) + assert "Incorrect type of a value to add as output." in str(e.value) + + +def test_add_outputs_incorrect_outputs_list(): + input_shape = PartialShape([1]) + param = ops.parameter(input_shape, dtype=np.float32, name="data") + relu1 = ops.relu(param, name="relu1") + relu1.get_output_tensor(0).set_names({"relu_t1"}) + function = Function(relu1, [param], "TestFunction") + assert len(function.get_results()) == 1 + with pytest.raises(TypeError) as e: + function.add_outputs([0, 0]) + assert "Incorrect type of a value to add as output at index 0" in str(e.value) + + +def test_validate_nodes_and_infer_types(): + param1 = ops.parameter(Shape([2, 1]), dtype=np.float32, name="data1") + param2 = ops.parameter(Shape([2, 1]), dtype=np.float32, name="data2") + add = ops.add(param1, param2) + func = Function(add, [param1, param2], "TestFunction") + + invalid_shape = Shape([3, 7]) + param3 = ops.parameter(invalid_shape, dtype=np.float32, name="data3") + func.replace_parameter(0, param3) + + with pytest.raises(RuntimeError) as e: + func.validate_nodes_and_infer_types() + assert "Argument shapes are inconsistent" in str(e.value) + + +def test_get_result_index(): + input_shape = PartialShape([1]) + param = ops.parameter(input_shape, dtype=np.float32, name="data") + relu = ops.relu(param, name="relu") + function = Function(relu, [param], "TestFunction") + assert len(function.outputs) == 1 + assert function.get_result_index(function.outputs[0]) == 0 + + +def test_get_result_index_invalid(): + shape1 = PartialShape([1]) + param1 = ops.parameter(shape1, dtype=np.float32, name="data1") + relu1 = ops.relu(param1, name="relu1") + function = Function(relu1, [param1], "TestFunction") + + shape2 = PartialShape([2]) + param2 = ops.parameter(shape2, dtype=np.float32, name="data2") + relu2 = ops.relu(param2, name="relu2") + invalid_output = relu2.outputs()[0] + assert len(function.outputs) == 1 + assert function.get_result_index(invalid_output) == -1 + + +def test_parameter_index(): + input_shape = PartialShape([1]) + param = ops.parameter(input_shape, dtype=np.float32, name="data") + relu = ops.relu(param, name="relu") + function = Function(relu, [param], "TestFunction") + assert function.get_parameter_index(param) == 0 + + +def test_parameter_index_invalid(): + shape1 = PartialShape([1]) + param1 = ops.parameter(shape1, dtype=np.float32, name="data1") + relu = ops.relu(param1, name="relu") + function = Function(relu, [param1], "TestFunction") + shape2 = PartialShape([2]) + param2 = ops.parameter(shape2, dtype=np.float32, name="data2") + assert function.get_parameter_index(param2) == -1 + + +def test_replace_parameter(): + shape1 = PartialShape([1]) + param1 = ops.parameter(shape1, dtype=np.float32, name="data") + shape2 = PartialShape([2]) + param2 = ops.parameter(shape2, dtype=np.float32, name="data") + relu = ops.relu(param1, name="relu") + + function = Function(relu, [param1], "TestFunction") + param_index = function.get_parameter_index(param1) + function.replace_parameter(param_index, param2) + assert function.get_parameter_index(param2) == param_index + assert function.get_parameter_index(param1) == -1 + + +def test_evaluate(): + param1 = ops.parameter(Shape([2, 1]), dtype=np.float32, name="data1") + param2 = ops.parameter(Shape([2, 1]), dtype=np.float32, name="data2") + add = ops.add(param1, param2) + func = Function(add, [param1, param2], "TestFunction") + + input1 = np.array([2, 1], dtype=np.float32).reshape(2, 1) + input2 = np.array([3, 7], dtype=np.float32).reshape(2, 1) + out_tensor = Tensor("float32", Shape([2, 1])) + + assert func.evaluate([out_tensor], [Tensor(input1), Tensor(input2)]) + assert np.allclose(out_tensor.data, np.array([5, 8]).reshape(2, 1)) + + +def test_evaluate_invalid_input_shape(): + param1 = ops.parameter(Shape([2, 1]), dtype=np.float32, name="data1") + param2 = ops.parameter(Shape([2, 1]), dtype=np.float32, name="data2") + add = ops.add(param1, param2) + func = Function(add, [param1, param2], "TestFunction") + + with pytest.raises(RuntimeError) as e: + assert func.evaluate( + [Tensor("float32", Shape([2, 1]))], + [Tensor("float32", Shape([3, 1])), Tensor("float32", Shape([3, 1]))], + ) + assert "must be compatible with the partial shape: {2,1}" in str(e.value) diff --git a/runtime/bindings/python/tests/test_inference_engine/test_infer_request.py b/src/bindings/python/tests/test_inference_engine/test_infer_request.py similarity index 88% rename from runtime/bindings/python/tests/test_inference_engine/test_infer_request.py rename to src/bindings/python/tests/test_inference_engine/test_infer_request.py index 0785e200e31..b97ed6e6a2d 100644 --- a/runtime/bindings/python/tests/test_inference_engine/test_infer_request.py +++ b/src/bindings/python/tests/test_inference_engine/test_infer_request.py @@ -212,6 +212,52 @@ def test_infer_queue(device): assert all(job["latency"] > 0 for job in jobs_done) +def test_infer_queue_fail_on_cpp_func(device): + jobs = 6 + num_request = 4 + core = Core() + func = core.read_model(test_net_xml, test_net_bin) + exec_net = core.compile_model(func, device) + infer_queue = AsyncInferQueue(exec_net, num_request) + + def callback(request, _): + request.get_tensor("Unknown") + + img = read_image() + infer_queue.set_callback(callback) + assert infer_queue.is_ready + + with pytest.raises(RuntimeError) as e: + for _ in range(jobs): + infer_queue.start_async({"data": img}) + infer_queue.wait_all() + + assert "Port for tensor name Unknown was not found" in str(e.value) + + +def test_infer_queue_fail_on_py_func(device): + jobs = 1 + num_request = 1 + core = Core() + func = core.read_model(test_net_xml, test_net_bin) + exec_net = core.compile_model(func, device) + infer_queue = AsyncInferQueue(exec_net, num_request) + + def callback(request, _): + request = request + 21 + + img = read_image() + infer_queue.set_callback(callback) + assert infer_queue.is_ready + + with pytest.raises(TypeError) as e: + for _ in range(jobs): + infer_queue.start_async({"data": img}) + infer_queue.wait_all() + + assert "unsupported operand type(s) for +" in str(e.value) + + @pytest.mark.parametrize("data_type", [np.float32, np.int32, diff --git a/runtime/bindings/python/tests/test_inference_engine/test_output_const_node.py b/src/bindings/python/tests/test_inference_engine/test_output_const_node.py similarity index 100% rename from runtime/bindings/python/tests/test_inference_engine/test_output_const_node.py rename to src/bindings/python/tests/test_inference_engine/test_output_const_node.py diff --git a/runtime/bindings/python/tests/test_inference_engine/test_tensor.py b/src/bindings/python/tests/test_inference_engine/test_tensor.py similarity index 100% rename from runtime/bindings/python/tests/test_inference_engine/test_tensor.py rename to src/bindings/python/tests/test_inference_engine/test_tensor.py diff --git a/runtime/bindings/python/tests/test_ngraph/__init__.py b/src/bindings/python/tests/test_ngraph/__init__.py similarity index 100% rename from runtime/bindings/python/tests/test_ngraph/__init__.py rename to src/bindings/python/tests/test_ngraph/__init__.py diff --git a/runtime/bindings/python/tests/test_ngraph/test_adaptive_pool.py b/src/bindings/python/tests/test_ngraph/test_adaptive_pool.py similarity index 100% rename from runtime/bindings/python/tests/test_ngraph/test_adaptive_pool.py rename to src/bindings/python/tests/test_ngraph/test_adaptive_pool.py diff --git a/runtime/bindings/python/tests/test_ngraph/test_basic.py b/src/bindings/python/tests/test_ngraph/test_basic.py similarity index 100% rename from runtime/bindings/python/tests/test_ngraph/test_basic.py rename to src/bindings/python/tests/test_ngraph/test_basic.py diff --git a/runtime/bindings/python/tests/test_ngraph/test_convolution.py b/src/bindings/python/tests/test_ngraph/test_convolution.py similarity index 100% rename from runtime/bindings/python/tests/test_ngraph/test_convolution.py rename to src/bindings/python/tests/test_ngraph/test_convolution.py diff --git a/runtime/bindings/python/tests/test_ngraph/test_core.py b/src/bindings/python/tests/test_ngraph/test_core.py similarity index 100% rename from runtime/bindings/python/tests/test_ngraph/test_core.py rename to src/bindings/python/tests/test_ngraph/test_core.py diff --git a/runtime/bindings/python/tests/test_ngraph/test_create_op.py b/src/bindings/python/tests/test_ngraph/test_create_op.py similarity index 100% rename from runtime/bindings/python/tests/test_ngraph/test_create_op.py rename to src/bindings/python/tests/test_ngraph/test_create_op.py diff --git a/runtime/bindings/python/tests/test_ngraph/test_ctc_loss.py b/src/bindings/python/tests/test_ngraph/test_ctc_loss.py similarity index 100% rename from runtime/bindings/python/tests/test_ngraph/test_ctc_loss.py rename to src/bindings/python/tests/test_ngraph/test_ctc_loss.py diff --git a/runtime/bindings/python/tests/test_ngraph/test_data_movement.py b/src/bindings/python/tests/test_ngraph/test_data_movement.py similarity index 100% rename from runtime/bindings/python/tests/test_ngraph/test_data_movement.py rename to src/bindings/python/tests/test_ngraph/test_data_movement.py diff --git a/runtime/bindings/python/tests/test_ngraph/test_descriptor.py b/src/bindings/python/tests/test_ngraph/test_descriptor.py similarity index 100% rename from runtime/bindings/python/tests/test_ngraph/test_descriptor.py rename to src/bindings/python/tests/test_ngraph/test_descriptor.py diff --git a/runtime/bindings/python/tests/test_ngraph/test_dft.py b/src/bindings/python/tests/test_ngraph/test_dft.py similarity index 100% rename from runtime/bindings/python/tests/test_ngraph/test_dft.py rename to src/bindings/python/tests/test_ngraph/test_dft.py diff --git a/runtime/bindings/python/tests/test_ngraph/test_dyn_attributes.py b/src/bindings/python/tests/test_ngraph/test_dyn_attributes.py similarity index 100% rename from runtime/bindings/python/tests/test_ngraph/test_dyn_attributes.py rename to src/bindings/python/tests/test_ngraph/test_dyn_attributes.py diff --git a/runtime/bindings/python/tests/test_ngraph/test_einsum.py b/src/bindings/python/tests/test_ngraph/test_einsum.py similarity index 100% rename from runtime/bindings/python/tests/test_ngraph/test_einsum.py rename to src/bindings/python/tests/test_ngraph/test_einsum.py diff --git a/runtime/bindings/python/tests/test_ngraph/test_gather.py b/src/bindings/python/tests/test_ngraph/test_gather.py similarity index 100% rename from runtime/bindings/python/tests/test_ngraph/test_gather.py rename to src/bindings/python/tests/test_ngraph/test_gather.py diff --git a/runtime/bindings/python/tests/test_ngraph/test_idft.py b/src/bindings/python/tests/test_ngraph/test_idft.py similarity index 100% rename from runtime/bindings/python/tests/test_ngraph/test_idft.py rename to src/bindings/python/tests/test_ngraph/test_idft.py diff --git a/runtime/bindings/python/tests/test_ngraph/test_input_validation.py b/src/bindings/python/tests/test_ngraph/test_input_validation.py similarity index 100% rename from runtime/bindings/python/tests/test_ngraph/test_input_validation.py rename to src/bindings/python/tests/test_ngraph/test_input_validation.py diff --git a/runtime/bindings/python/tests/test_ngraph/test_log_softmax.py b/src/bindings/python/tests/test_ngraph/test_log_softmax.py similarity index 100% rename from runtime/bindings/python/tests/test_ngraph/test_log_softmax.py rename to src/bindings/python/tests/test_ngraph/test_log_softmax.py diff --git a/runtime/bindings/python/tests/test_ngraph/test_manager.py b/src/bindings/python/tests/test_ngraph/test_manager.py similarity index 100% rename from runtime/bindings/python/tests/test_ngraph/test_manager.py rename to src/bindings/python/tests/test_ngraph/test_manager.py diff --git a/runtime/bindings/python/tests/test_ngraph/test_node_factory.py b/src/bindings/python/tests/test_ngraph/test_node_factory.py similarity index 100% rename from runtime/bindings/python/tests/test_ngraph/test_node_factory.py rename to src/bindings/python/tests/test_ngraph/test_node_factory.py diff --git a/runtime/bindings/python/tests/test_ngraph/test_normalization.py b/src/bindings/python/tests/test_ngraph/test_normalization.py similarity index 100% rename from runtime/bindings/python/tests/test_ngraph/test_normalization.py rename to src/bindings/python/tests/test_ngraph/test_normalization.py diff --git a/runtime/bindings/python/tests/test_ngraph/test_ops.py b/src/bindings/python/tests/test_ngraph/test_ops.py similarity index 100% rename from runtime/bindings/python/tests/test_ngraph/test_ops.py rename to src/bindings/python/tests/test_ngraph/test_ops.py diff --git a/runtime/bindings/python/tests/test_ngraph/test_ops_binary.py b/src/bindings/python/tests/test_ngraph/test_ops_binary.py similarity index 100% rename from runtime/bindings/python/tests/test_ngraph/test_ops_binary.py rename to src/bindings/python/tests/test_ngraph/test_ops_binary.py diff --git a/runtime/bindings/python/tests/test_ngraph/test_ops_fused.py b/src/bindings/python/tests/test_ngraph/test_ops_fused.py similarity index 100% rename from runtime/bindings/python/tests/test_ngraph/test_ops_fused.py rename to src/bindings/python/tests/test_ngraph/test_ops_fused.py diff --git a/runtime/bindings/python/tests/test_ngraph/test_ops_matmul.py b/src/bindings/python/tests/test_ngraph/test_ops_matmul.py similarity index 100% rename from runtime/bindings/python/tests/test_ngraph/test_ops_matmul.py rename to src/bindings/python/tests/test_ngraph/test_ops_matmul.py diff --git a/runtime/bindings/python/tests/test_ngraph/test_ops_multioutput.py b/src/bindings/python/tests/test_ngraph/test_ops_multioutput.py similarity index 100% rename from runtime/bindings/python/tests/test_ngraph/test_ops_multioutput.py rename to src/bindings/python/tests/test_ngraph/test_ops_multioutput.py diff --git a/runtime/bindings/python/tests/test_ngraph/test_ops_reshape.py b/src/bindings/python/tests/test_ngraph/test_ops_reshape.py similarity index 100% rename from runtime/bindings/python/tests/test_ngraph/test_ops_reshape.py rename to src/bindings/python/tests/test_ngraph/test_ops_reshape.py diff --git a/runtime/bindings/python/tests/test_ngraph/test_ops_scatter.py b/src/bindings/python/tests/test_ngraph/test_ops_scatter.py similarity index 100% rename from runtime/bindings/python/tests/test_ngraph/test_ops_scatter.py rename to src/bindings/python/tests/test_ngraph/test_ops_scatter.py diff --git a/runtime/bindings/python/tests/test_ngraph/test_ops_unary.py b/src/bindings/python/tests/test_ngraph/test_ops_unary.py similarity index 100% rename from runtime/bindings/python/tests/test_ngraph/test_ops_unary.py rename to src/bindings/python/tests/test_ngraph/test_ops_unary.py diff --git a/src/bindings/python/tests/test_ngraph/test_ops_util_variable.py b/src/bindings/python/tests/test_ngraph/test_ops_util_variable.py new file mode 100644 index 00000000000..dd41a4af32e --- /dev/null +++ b/src/bindings/python/tests/test_ngraph/test_ops_util_variable.py @@ -0,0 +1,46 @@ +# Copyright (C) 2021 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +from openvino.impl import PartialShape, Type +from openvino.impl.op.util import VariableInfo, Variable + + +def test_info_as_property(): + info = VariableInfo() + info.data_shape = PartialShape([1]) + info.data_type = Type.f32 + info.variable_id = "test_id" + variable = Variable(info) + assert variable.info.data_shape == info.data_shape + assert variable.info.data_type == info.data_type + assert variable.info.variable_id == info.variable_id + + +def test_get_info(): + info = VariableInfo() + info.data_shape = PartialShape([1]) + info.data_type = Type.f32 + info.variable_id = "test_id" + variable = Variable(info) + assert variable.get_info().data_shape == info.data_shape + assert variable.get_info().data_type == info.data_type + assert variable.get_info().variable_id == info.variable_id + + +def test_info_update(): + info1 = VariableInfo() + info1.data_shape = PartialShape([1]) + info1.data_type = Type.f32 + info1.variable_id = "test_id" + + variable = Variable(info1) + + info2 = VariableInfo() + info2.data_shape = PartialShape([2, 1]) + info2.data_type = Type.i64 + info2.variable_id = "test_id2" + + variable.update(info2) + assert variable.info.data_shape == info2.data_shape + assert variable.info.data_type == info2.data_type + assert variable.info.variable_id == info2.variable_id diff --git a/runtime/bindings/python/tests/test_ngraph/test_pooling.py b/src/bindings/python/tests/test_ngraph/test_pooling.py similarity index 100% rename from runtime/bindings/python/tests/test_ngraph/test_pooling.py rename to src/bindings/python/tests/test_ngraph/test_pooling.py diff --git a/runtime/bindings/python/tests/test_ngraph/test_preprocess.py b/src/bindings/python/tests/test_ngraph/test_preprocess.py similarity index 65% rename from runtime/bindings/python/tests/test_ngraph/test_preprocess.py rename to src/bindings/python/tests/test_ngraph/test_preprocess.py index a5afaa5c3ee..df811d21da5 100644 --- a/runtime/bindings/python/tests/test_ngraph/test_preprocess.py +++ b/src/bindings/python/tests/test_ngraph/test_preprocess.py @@ -10,9 +10,7 @@ from openvino.impl import Function, Output, Type from openvino.utils.decorators import custom_preprocess_function from openvino import Core from tests.runtime import get_runtime -from openvino.preprocess import PrePostProcessor, InputInfo, PreProcessSteps, InputTensorInfo, \ - OutputTensorInfo, OutputNetworkInfo, InputNetworkInfo, ColorFormat, OutputInfo, \ - PostProcessSteps, ResizeAlgorithm +from openvino.preprocess import PrePostProcessor, ColorFormat, ResizeAlgorithm def test_ngraph_preprocess_mean(): @@ -21,13 +19,11 @@ def test_ngraph_preprocess_mean(): model = parameter_a function = Function(model, [parameter_a], "TestFunction") - function = PrePostProcessor(function)\ - .input(InputInfo() - .preprocess(PreProcessSteps() - .mean(1.) - ) - )\ - .build() + p = PrePostProcessor(function) + inp = p.input() + prep = inp.preprocess() + prep.mean(1.0) + function = p.build() input_data = np.array([[1, 2], [3, 4]]).astype(np.float32) expected_output = np.array([[0, 1], [2, 3]]).astype(np.float32) @@ -45,14 +41,10 @@ def test_ngraph_preprocess_mean_vector(): function = Function(model, [parameter_a], "TestFunction") layout = ov.Layout("NCHW") - function = PrePostProcessor(function)\ - .input(InputInfo() - .tensor(InputTensorInfo().set_layout(layout)) - .preprocess(PreProcessSteps() - .mean([1., 2.]) - ) - )\ - .build() + p = PrePostProcessor(function) + p.input().tensor().set_layout(layout) + p.input().preprocess().mean([1., 2.]) + function = p.build() input_data = np.array([[1, 2], [3, 4]]).astype(np.float32) expected_output = np.array([[0, 0], [2, 2]]).astype(np.float32) @@ -70,14 +62,11 @@ def test_ngraph_preprocess_scale_vector(): function = Function(model, [parameter_a], "TestFunction") layout = ov.Layout("NCHW") - function = PrePostProcessor(function)\ - .input(InputInfo() - .tensor(InputTensorInfo().set_layout(layout)) - .preprocess(PreProcessSteps() - .scale([0.5, 2.]) - ) - )\ - .build() + p = PrePostProcessor(function) + inp = p.input() + inp.tensor().set_layout(layout) + inp.preprocess().scale([0.5, 2.0]) + function = p.build() input_data = np.array([[1, 2], [3, 4]]).astype(np.float32) expected_output = np.array([[2, 1], [6, 2]]).astype(np.float32) @@ -98,24 +87,13 @@ def test_ngraph_preprocess_mean_scale_convert(): def custom_preprocess(output: Output): return ops.abs(output) - function = PrePostProcessor(function) \ - .input(InputInfo(1) - .tensor(InputTensorInfo() - .set_element_type(Type.i32)) - .preprocess(PreProcessSteps() - .convert_element_type(Type.f32) - .mean(1.) - .scale(2.) - ) - ) \ - .input(InputInfo(0) - .preprocess(PreProcessSteps() - .convert_element_type(Type.f32) - .mean(1.) - .custom(custom_preprocess) - ) - ) \ - .build() + p = PrePostProcessor(function) + inp2 = p.input(1) + inp2.tensor().set_element_type(Type.i32) + inp2.preprocess().convert_element_type(Type.f32).mean(1.).scale(2.) + inp1 = p.input(0) + inp1.preprocess().convert_element_type(Type.f32).mean(1.).custom(custom_preprocess) + function = p.build() input_data1 = np.array([[0, 1], [2, -2]]).astype(np.int32) input_data2 = np.array([[1, 3], [5, 7]]).astype(np.int32) @@ -129,6 +107,40 @@ def test_ngraph_preprocess_mean_scale_convert(): assert np.equal(output2, expected_output2).all() +def test_ngraph_preprocess_input_output_by_name(): + shape = [2, 2] + param1 = ops.parameter(shape, dtype=np.int32, name="A") + param2 = ops.parameter(shape, dtype=np.int32, name="B") + function = Function([param1, param2], [param1, param2], "TestFunction") + + @custom_preprocess_function + def custom_preprocess(output: Output): + return ops.abs(output) + + p = PrePostProcessor(function) + inp2 = p.input("B") + inp2.tensor().set_element_type(Type.i32) + inp2.preprocess().convert_element_type(Type.f32).mean(1.).scale(2.) + inp1 = p.input("A") + inp1.preprocess().convert_element_type(Type.f32).mean(1.) + out1 = p.output("A") + out1.postprocess().custom(custom_preprocess) + out2 = p.output("B") + out2.postprocess().custom(custom_preprocess) + function = p.build() + + input_data1 = np.array([[0, 1], [2, -2]]).astype(np.int32) + input_data2 = np.array([[-1, 3], [5, 7]]).astype(np.int32) + expected_output1 = np.array([[1, 0], [1, 3]]).astype(np.float32) + expected_output2 = np.array([[1, 1], [2, 3]]).astype(np.float32) + + runtime = get_runtime() + computation = runtime.computation(function) + [output1, output2] = computation(input_data1, input_data2) + assert np.equal(output1, expected_output1).all() + assert np.equal(output2, expected_output2).all() + + def test_ngraph_preprocess_output_postprocess(): shape = [2, 2] parameter_a = ops.parameter(shape, dtype=np.int32, name="A") @@ -142,20 +154,15 @@ def test_ngraph_preprocess_output_postprocess(): def custom_postprocess(output: Output): return ops.abs(output) - function = PrePostProcessor(function)\ - .input(InputInfo() - .tensor(InputTensorInfo().set_layout(layout1)) - .preprocess(PreProcessSteps() - .convert_element_type(Type.f32) - .mean([1., 2.]) - ) - ) \ - .output(OutputInfo().postprocess(PostProcessSteps() - .convert_element_type(Type.f32) - .convert_layout(layout2) - .convert_layout(layout3) - .custom(custom_postprocess))) \ - .build() + p = PrePostProcessor(function) + inp = p.input() + inp.tensor().set_layout(layout1) + inp.preprocess().convert_element_type(Type.f32).mean([1., 2.]) + out = p.output() + out.postprocess().convert_element_type(Type.f32) \ + .convert_layout(layout2) \ + .convert_layout(layout3).custom(custom_postprocess) + function = p.build() input_data = np.array([[-1, -2], [-3, -4]]).astype(np.int32) expected_output = np.array([[2, 4], [4, 6]]).astype(np.float32) @@ -174,24 +181,16 @@ def test_ngraph_preprocess_spatial_static_shape(): layout = ov.Layout("CHW") color_format = ColorFormat.RGB - function = PrePostProcessor(function)\ - .input(InputInfo() - .tensor(InputTensorInfo() - .set_layout(layout) - .set_spatial_static_shape(2, 2) - .set_color_format(color_format, [])) - .preprocess(PreProcessSteps() - .convert_element_type(Type.f32) - .mean([1., 2]) - ) - .network(InputNetworkInfo().set_layout(layout)) - ) \ - .output(OutputInfo() - .tensor(OutputTensorInfo() - .set_layout(layout) - .set_element_type(Type.f32)) - .network(OutputNetworkInfo().set_layout(layout))) \ - .build() + + p = PrePostProcessor(function) + inp = p.input() + inp.tensor().set_layout(layout).set_spatial_static_shape(2, 2).set_color_format(color_format, []) + inp.preprocess().convert_element_type(Type.f32).mean([1., 2.]) + inp.network().set_layout(layout) + out = p.output() + out.tensor().set_layout(layout).set_element_type(Type.f32) + out.network().set_layout(layout) + function = p.build() input_data = np.array([[[1, 2], [3, 4]], [[5, 6], [7, 8]]]).astype(np.int32) expected_output = np.array([[[0, 1], [2, 3]], [[3, 4], [5, 6]]]).astype(np.float32) @@ -205,11 +204,20 @@ def test_ngraph_preprocess_spatial_static_shape(): @pytest.mark.parametrize( "algorithm, color_format1, color_format2, is_failing", [(ResizeAlgorithm.RESIZE_LINEAR, ColorFormat.UNDEFINED, ColorFormat.BGR, True), + (ResizeAlgorithm.RESIZE_NEAREST, ColorFormat.RGB, ColorFormat.I420_SINGLE_PLANE, True), + (ResizeAlgorithm.RESIZE_NEAREST, ColorFormat.RGB, ColorFormat.I420_THREE_PLANES, True), (ResizeAlgorithm.RESIZE_LINEAR, ColorFormat.RGB, ColorFormat.NV12_SINGLE_PLANE, True), + (ResizeAlgorithm.RESIZE_LINEAR, ColorFormat.RGB, ColorFormat.RGBX, True), + (ResizeAlgorithm.RESIZE_LINEAR, ColorFormat.RGB, ColorFormat.BGRX, True), (ResizeAlgorithm.RESIZE_LINEAR, ColorFormat.RGB, ColorFormat.NV12_TWO_PLANES, True), + (ResizeAlgorithm.RESIZE_LINEAR, ColorFormat.UNDEFINED, ColorFormat.I420_SINGLE_PLANE, True), (ResizeAlgorithm.RESIZE_CUBIC, ColorFormat.RGB, ColorFormat.UNDEFINED, True), (ResizeAlgorithm.RESIZE_CUBIC, ColorFormat.RGB, ColorFormat.BGR, False), (ResizeAlgorithm.RESIZE_CUBIC, ColorFormat.BGR, ColorFormat.RGB, False), + (ResizeAlgorithm.RESIZE_CUBIC, ColorFormat.BGR, ColorFormat.RGBX, True), + (ResizeAlgorithm.RESIZE_CUBIC, ColorFormat.BGR, ColorFormat.BGRX, True), + (ResizeAlgorithm.RESIZE_NEAREST, ColorFormat.BGR, ColorFormat.I420_SINGLE_PLANE, True), + (ResizeAlgorithm.RESIZE_NEAREST, ColorFormat.BGR, ColorFormat.I420_THREE_PLANES, True), (ResizeAlgorithm.RESIZE_NEAREST, ColorFormat.BGR, ColorFormat.NV12_SINGLE_PLANE, True), (ResizeAlgorithm.RESIZE_NEAREST, ColorFormat.BGR, ColorFormat.NV12_TWO_PLANES, True), (ResizeAlgorithm.RESIZE_NEAREST, ColorFormat.BGR, ColorFormat.UNDEFINED, True)]) @@ -220,16 +228,12 @@ def test_ngraph_preprocess_steps(algorithm, color_format1, color_format2, is_fai function = Function(model, [parameter_a], "TestFunction") layout1 = ov.Layout("NCWH") layout2 = ov.Layout("NCHW") - custom_processor = PrePostProcessor(function)\ - .input(InputInfo() - .tensor(InputTensorInfo() - .set_layout(layout1) - .set_color_format(color_format1, [])) - .preprocess(PreProcessSteps() - .mean(1.) - .resize(algorithm, 3, 3) - .convert_layout(layout2) - .convert_color(color_format2))) + + custom_processor = PrePostProcessor(function) + inp = custom_processor.input() + inp.tensor().set_layout(layout1).set_color_format(color_format1, []) + inp.preprocess().mean(1.).resize(algorithm, 3, 3).convert_layout(layout2).convert_color(color_format2) + if is_failing: with pytest.raises(RuntimeError) as e: function = custom_processor.build() @@ -253,20 +257,13 @@ def test_ngraph_preprocess_postprocess_layout(): layout1 = ov.Layout("NCWH") layout2 = ov.Layout("NCHW") - function = PrePostProcessor(function)\ - .input(InputInfo() - .tensor(InputTensorInfo() - .set_layout(layout1)) - .preprocess(PreProcessSteps() - .mean(1.) - .convert_layout(layout2) - .reverse_channels() - ) - ) \ - .output(OutputInfo() - .postprocess(PostProcessSteps() - .convert_layout([0, 1, 2, 3]))) \ - .build() + p = PrePostProcessor(function) + inp = p.input() + inp.tensor().set_layout(layout1) + inp.preprocess().mean(1.).convert_layout(layout2).reverse_channels() + out = p.output() + out.postprocess().convert_layout([0, 1, 2, 3]) + function = p.build() input_data = np.array([[[[1, 2, 3], [4, 5, 6], [7, 8, 9]]]]).astype(np.float32) expected_output = np.array([[[[0, 3, 6], [1, 4, 7], [2, 5, 8]]]]).astype(np.float32) @@ -284,16 +281,11 @@ def test_ngraph_preprocess_reverse_channels(): function = Function(model, [parameter_a], "TestFunction") layout1 = ov.Layout("NCWH") - function = PrePostProcessor(function)\ - .input(InputInfo() - .tensor(InputTensorInfo() - .set_layout(layout1)) - .preprocess(PreProcessSteps() - .mean(1.) - .reverse_channels() - ) - ) \ - .build() + p = PrePostProcessor(function) + inp = p.input() + inp.tensor().set_layout(layout1) + inp.preprocess().mean(1.).reverse_channels() + function = p.build() input_data = np.array([[[[1, 2], [3, 4]], [[5, 6], [7, 8]]]]).astype(np.float32) expected_output = np.array([[[[4, 5], [6, 7]], [[0, 1], [2, 3]]]]).astype(np.float32) @@ -312,15 +304,11 @@ def test_ngraph_preprocess_resize_algorithm(): resize_alg = ResizeAlgorithm.RESIZE_CUBIC layout1 = ov.Layout("NCWH") - function = PrePostProcessor(function)\ - .input(InputInfo() - .tensor(InputTensorInfo() - .set_layout(layout1)) - .preprocess(PreProcessSteps() - .mean(1.) - .resize(resize_alg, 3, 3)) - )\ - .build() + p = PrePostProcessor(function) + inp = p.input() + inp.tensor().set_layout(layout1) + inp.preprocess().mean(1.).resize(resize_alg, 3, 3) + function = p.build() input_data = np.array([[[[1, 2, 3], [4, 5, 6], [7, 8, 9]]]]).astype(np.float32) expected_output = np.array([[[[0, 1, 2], [3, 4, 5], [6, 7, 8]]]]).astype(np.float32) @@ -398,21 +386,11 @@ def test_ngraph_preprocess_model(): def custom_preprocess(output: Output): return ops.abs(output) - function = PrePostProcessor(function) \ - .input(InputInfo(1) - .preprocess(PreProcessSteps() - .convert_element_type(Type.f32) - .scale(0.5) - ) - ) \ - .input(InputInfo(0) - .preprocess(PreProcessSteps() - .convert_element_type(Type.f32) - .mean(5.))) \ - .output(OutputInfo(0) - .postprocess(PostProcessSteps() - .custom(custom_preprocess))) \ - .build() + p = PrePostProcessor(function) + p.input(1).preprocess().convert_element_type(Type.f32).scale(0.5) + p.input(0).preprocess().convert_element_type(Type.f32).mean(5.) + p.output(0).postprocess().custom(custom_preprocess) + function = p.build() input_data = np.array([[[1, 2], [3, 4]], [[5, 6], [7, 8]]]).astype(np.float32) expected_output = np.array([[[2, 1], [4, 7]], [[10, 13], [16, 19]]]).astype(np.float32) diff --git a/runtime/bindings/python/tests/test_ngraph/test_proposal.py b/src/bindings/python/tests/test_ngraph/test_proposal.py similarity index 100% rename from runtime/bindings/python/tests/test_ngraph/test_proposal.py rename to src/bindings/python/tests/test_ngraph/test_proposal.py diff --git a/runtime/bindings/python/tests/test_ngraph/test_random_uniform.py b/src/bindings/python/tests/test_ngraph/test_random_uniform.py similarity index 100% rename from runtime/bindings/python/tests/test_ngraph/test_random_uniform.py rename to src/bindings/python/tests/test_ngraph/test_random_uniform.py diff --git a/runtime/bindings/python/tests/test_ngraph/test_reduction.py b/src/bindings/python/tests/test_ngraph/test_reduction.py similarity index 100% rename from runtime/bindings/python/tests/test_ngraph/test_reduction.py rename to src/bindings/python/tests/test_ngraph/test_reduction.py diff --git a/runtime/bindings/python/tests/test_ngraph/test_roll.py b/src/bindings/python/tests/test_ngraph/test_roll.py similarity index 100% rename from runtime/bindings/python/tests/test_ngraph/test_roll.py rename to src/bindings/python/tests/test_ngraph/test_roll.py diff --git a/runtime/bindings/python/tests/test_ngraph/test_sequence_processing.py b/src/bindings/python/tests/test_ngraph/test_sequence_processing.py similarity index 100% rename from runtime/bindings/python/tests/test_ngraph/test_sequence_processing.py rename to src/bindings/python/tests/test_ngraph/test_sequence_processing.py diff --git a/runtime/bindings/python/tests/test_ngraph/test_swish.py b/src/bindings/python/tests/test_ngraph/test_swish.py similarity index 100% rename from runtime/bindings/python/tests/test_ngraph/test_swish.py rename to src/bindings/python/tests/test_ngraph/test_swish.py diff --git a/runtime/bindings/python/tests/test_ngraph/test_utils.py b/src/bindings/python/tests/test_ngraph/test_utils.py similarity index 100% rename from runtime/bindings/python/tests/test_ngraph/test_utils.py rename to src/bindings/python/tests/test_ngraph/test_utils.py diff --git a/runtime/bindings/python/tests/test_ngraph/util.py b/src/bindings/python/tests/test_ngraph/util.py similarity index 100% rename from runtime/bindings/python/tests/test_ngraph/util.py rename to src/bindings/python/tests/test_ngraph/util.py diff --git a/runtime/bindings/python/tests/test_onnx/__init__.py b/src/bindings/python/tests/test_onnx/__init__.py similarity index 100% rename from runtime/bindings/python/tests/test_onnx/__init__.py rename to src/bindings/python/tests/test_onnx/__init__.py diff --git a/runtime/bindings/python/tests/test_onnx/model_zoo_preprocess.sh b/src/bindings/python/tests/test_onnx/model_zoo_preprocess.sh similarity index 100% rename from runtime/bindings/python/tests/test_onnx/model_zoo_preprocess.sh rename to src/bindings/python/tests/test_onnx/model_zoo_preprocess.sh diff --git a/runtime/bindings/python/tests/test_onnx/models/add_abc.onnx b/src/bindings/python/tests/test_onnx/models/add_abc.onnx similarity index 100% rename from runtime/bindings/python/tests/test_onnx/models/add_abc.onnx rename to src/bindings/python/tests/test_onnx/models/add_abc.onnx diff --git a/runtime/bindings/python/tests/test_onnx/models/data/tensor.data b/src/bindings/python/tests/test_onnx/models/data/tensor.data similarity index 100% rename from runtime/bindings/python/tests/test_onnx/models/data/tensor.data rename to src/bindings/python/tests/test_onnx/models/data/tensor.data diff --git a/runtime/bindings/python/tests/test_onnx/models/external_data.onnx b/src/bindings/python/tests/test_onnx/models/external_data.onnx similarity index 100% rename from runtime/bindings/python/tests/test_onnx/models/external_data.onnx rename to src/bindings/python/tests/test_onnx/models/external_data.onnx diff --git a/runtime/bindings/python/tests/test_onnx/test_backend.py b/src/bindings/python/tests/test_onnx/test_backend.py similarity index 99% rename from runtime/bindings/python/tests/test_onnx/test_backend.py rename to src/bindings/python/tests/test_onnx/test_backend.py index 51a95bb416f..daeace44ce5 100644 --- a/runtime/bindings/python/tests/test_onnx/test_backend.py +++ b/src/bindings/python/tests/test_onnx/test_backend.py @@ -128,7 +128,6 @@ tests_expected_to_fail = [ ( xfail_issue_39658, "OnnxBackendNodeModelTest.test_tile_cpu", - "OnnxBackendNodeModelTest.test_tile_precomputed_cpu", ), ( xfail_issue_39662, diff --git a/runtime/bindings/python/tests/test_onnx/test_onnx_external_data.py b/src/bindings/python/tests/test_onnx/test_onnx_external_data.py similarity index 100% rename from runtime/bindings/python/tests/test_onnx/test_onnx_external_data.py rename to src/bindings/python/tests/test_onnx/test_onnx_external_data.py diff --git a/runtime/bindings/python/tests/test_onnx/test_onnx_import.py b/src/bindings/python/tests/test_onnx/test_onnx_import.py similarity index 100% rename from runtime/bindings/python/tests/test_onnx/test_onnx_import.py rename to src/bindings/python/tests/test_onnx/test_onnx_import.py diff --git a/runtime/bindings/python/tests/test_onnx/test_ops_batchnorm.py b/src/bindings/python/tests/test_onnx/test_ops_batchnorm.py similarity index 100% rename from runtime/bindings/python/tests/test_onnx/test_ops_batchnorm.py rename to src/bindings/python/tests/test_onnx/test_ops_batchnorm.py diff --git a/runtime/bindings/python/tests/test_onnx/test_ops_binary.py b/src/bindings/python/tests/test_onnx/test_ops_binary.py similarity index 100% rename from runtime/bindings/python/tests/test_onnx/test_ops_binary.py rename to src/bindings/python/tests/test_onnx/test_ops_binary.py diff --git a/runtime/bindings/python/tests/test_onnx/test_ops_convpool.py b/src/bindings/python/tests/test_onnx/test_ops_convpool.py similarity index 100% rename from runtime/bindings/python/tests/test_onnx/test_ops_convpool.py rename to src/bindings/python/tests/test_onnx/test_ops_convpool.py diff --git a/runtime/bindings/python/tests/test_onnx/test_ops_logical.py b/src/bindings/python/tests/test_onnx/test_ops_logical.py similarity index 100% rename from runtime/bindings/python/tests/test_onnx/test_ops_logical.py rename to src/bindings/python/tests/test_onnx/test_ops_logical.py diff --git a/runtime/bindings/python/tests/test_onnx/test_ops_matmul.py b/src/bindings/python/tests/test_onnx/test_ops_matmul.py similarity index 100% rename from runtime/bindings/python/tests/test_onnx/test_ops_matmul.py rename to src/bindings/python/tests/test_onnx/test_ops_matmul.py diff --git a/runtime/bindings/python/tests/test_onnx/test_ops_nonlinear.py b/src/bindings/python/tests/test_onnx/test_ops_nonlinear.py similarity index 100% rename from runtime/bindings/python/tests/test_onnx/test_ops_nonlinear.py rename to src/bindings/python/tests/test_onnx/test_ops_nonlinear.py diff --git a/runtime/bindings/python/tests/test_onnx/test_ops_random.py b/src/bindings/python/tests/test_onnx/test_ops_random.py similarity index 100% rename from runtime/bindings/python/tests/test_onnx/test_ops_random.py rename to src/bindings/python/tests/test_onnx/test_ops_random.py diff --git a/runtime/bindings/python/tests/test_onnx/test_ops_reduction.py b/src/bindings/python/tests/test_onnx/test_ops_reduction.py similarity index 100% rename from runtime/bindings/python/tests/test_onnx/test_ops_reduction.py rename to src/bindings/python/tests/test_onnx/test_ops_reduction.py diff --git a/runtime/bindings/python/tests/test_onnx/test_ops_reshape.py b/src/bindings/python/tests/test_onnx/test_ops_reshape.py similarity index 100% rename from runtime/bindings/python/tests/test_onnx/test_ops_reshape.py rename to src/bindings/python/tests/test_onnx/test_ops_reshape.py diff --git a/runtime/bindings/python/tests/test_onnx/test_ops_unary.py b/src/bindings/python/tests/test_onnx/test_ops_unary.py similarity index 100% rename from runtime/bindings/python/tests/test_onnx/test_ops_unary.py rename to src/bindings/python/tests/test_onnx/test_ops_unary.py diff --git a/runtime/bindings/python/tests/test_onnx/test_ops_variadic.py b/src/bindings/python/tests/test_onnx/test_ops_variadic.py similarity index 100% rename from runtime/bindings/python/tests/test_onnx/test_ops_variadic.py rename to src/bindings/python/tests/test_onnx/test_ops_variadic.py diff --git a/runtime/bindings/python/tests/test_onnx/test_zoo_models.py b/src/bindings/python/tests/test_onnx/test_zoo_models.py similarity index 100% rename from runtime/bindings/python/tests/test_onnx/test_zoo_models.py rename to src/bindings/python/tests/test_onnx/test_zoo_models.py diff --git a/runtime/bindings/python/tests/test_onnx/utils/__init__.py b/src/bindings/python/tests/test_onnx/utils/__init__.py similarity index 100% rename from runtime/bindings/python/tests/test_onnx/utils/__init__.py rename to src/bindings/python/tests/test_onnx/utils/__init__.py diff --git a/runtime/bindings/python/tests/test_onnx/utils/model_importer.py b/src/bindings/python/tests/test_onnx/utils/model_importer.py similarity index 100% rename from runtime/bindings/python/tests/test_onnx/utils/model_importer.py rename to src/bindings/python/tests/test_onnx/utils/model_importer.py diff --git a/runtime/bindings/python/tests/test_onnx/utils/onnx_backend.py b/src/bindings/python/tests/test_onnx/utils/onnx_backend.py similarity index 100% rename from runtime/bindings/python/tests/test_onnx/utils/onnx_backend.py rename to src/bindings/python/tests/test_onnx/utils/onnx_backend.py diff --git a/runtime/bindings/python/tests/test_onnx/utils/onnx_helpers.py b/src/bindings/python/tests/test_onnx/utils/onnx_helpers.py similarity index 100% rename from runtime/bindings/python/tests/test_onnx/utils/onnx_helpers.py rename to src/bindings/python/tests/test_onnx/utils/onnx_helpers.py diff --git a/src/bindings/python/tests/test_transformations/test_offline_api.py b/src/bindings/python/tests/test_transformations/test_offline_api.py new file mode 100644 index 00000000000..d593085f92c --- /dev/null +++ b/src/bindings/python/tests/test_transformations/test_offline_api.py @@ -0,0 +1,119 @@ +# Copyright (C) 2018-2021 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +import os +import numpy as np +# TODO: change the module name according to the description in 69196 +from openvino.offline_transformations_pybind import apply_moc_transformations, apply_pot_transformations, \ + apply_low_latency_transformation, apply_pruning_transformation, apply_make_stateful_transformation, \ + compress_model_transformation, serialize + +from openvino import Function, PartialShape, Core +import openvino as ov + + +def get_test_function(): + param = ov.opset8.parameter(PartialShape([1, 3, 22, 22]), name="parameter") + relu = ov.opset8.relu(param) + res = ov.opset8.result(relu, name="result") + return Function([res], [param], "test") + + +def test_moc_transformations(): + function = get_test_function() + + apply_moc_transformations(function, False) + + assert function is not None + assert len(function.get_ops()) == 3 + + +def test_pot_transformations(): + function = get_test_function() + + apply_pot_transformations(function, "GNA") + + assert function is not None + assert len(function.get_ops()) == 3 + + +def test_low_latency_transformation(): + function = get_test_function() + + apply_low_latency_transformation(function, True) + + assert function is not None + assert len(function.get_ops()) == 3 + + +def test_pruning_transformation(): + function = get_test_function() + + apply_pruning_transformation(function) + + assert function is not None + assert len(function.get_ops()) == 3 + + +def test_make_stateful_transformations(): + function = get_test_function() + + apply_make_stateful_transformation(function, {"parameter": "result"}) + + assert function is not None + assert len(function.get_parameters()) == 0 + assert len(function.get_results()) == 0 + + +def test_serialize_pass(): + core = Core() + xml_path = "serialized_function.xml" + bin_path = "serialized_function.bin" + + func = get_test_function() + + serialize(func, xml_path, bin_path) + + assert func is not None + + res_func = core.read_model(model=xml_path, weights=bin_path) + + assert func.get_parameters() == res_func.get_parameters() + assert func.get_ordered_ops() == res_func.get_ordered_ops() + + os.remove(xml_path) + os.remove(bin_path) + + +def test_serialize_pass_v2(): + core = Core() + xml_path = "./serialized_function.xml" + bin_path = "./serialized_function.bin" + shape = [100, 100, 2] + parameter_a = ov.opset8.parameter(shape, dtype=np.float32, name="A") + parameter_b = ov.opset8.parameter(shape, dtype=np.float32, name="B") + model = ov.opset8.floor(ov.opset8.minimum(ov.opset8.abs(parameter_a), parameter_b)) + func = Function(model, [parameter_a, parameter_b], "Function") + + serialize(func, xml_path, bin_path) + + assert func is not None + + res_func = core.read_model(model=xml_path, weights=bin_path) + + assert func.get_parameters() == res_func.get_parameters() + assert func.get_ordered_ops() == res_func.get_ordered_ops() + + os.remove(xml_path) + os.remove(bin_path) + + +def test_compress_model_transformation(): + node_constant = ov.opset8.constant(np.array([[0.0, 0.1, -0.1], [-2.5, 2.5, 3.0]], dtype=np.float32)) + node_ceil = ov.opset8.ceiling(node_constant) + func = Function(node_ceil, [], "TestFunction") + assert func.get_ordered_ops()[0].get_element_type().get_type_name() == "f32" + compress_model_transformation(func) + + assert func is not None + assert func.get_ordered_ops()[0].get_element_type().get_type_name() == "f16" diff --git a/runtime/bindings/python/tests_compatibility/__init__.py b/src/bindings/python/tests_compatibility/__init__.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/__init__.py rename to src/bindings/python/tests_compatibility/__init__.py diff --git a/runtime/bindings/python/tests_compatibility/conftest.py b/src/bindings/python/tests_compatibility/conftest.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/conftest.py rename to src/bindings/python/tests_compatibility/conftest.py diff --git a/runtime/bindings/python/tests_compatibility/mock/mock_py_ngraph_frontend/CMakeLists.txt b/src/bindings/python/tests_compatibility/mock/mock_py_ngraph_frontend/CMakeLists.txt similarity index 100% rename from runtime/bindings/python/tests_compatibility/mock/mock_py_ngraph_frontend/CMakeLists.txt rename to src/bindings/python/tests_compatibility/mock/mock_py_ngraph_frontend/CMakeLists.txt diff --git a/runtime/bindings/python/tests_compatibility/mock/mock_py_ngraph_frontend/mock_py_frontend.cpp b/src/bindings/python/tests_compatibility/mock/mock_py_ngraph_frontend/mock_py_frontend.cpp similarity index 100% rename from runtime/bindings/python/tests_compatibility/mock/mock_py_ngraph_frontend/mock_py_frontend.cpp rename to src/bindings/python/tests_compatibility/mock/mock_py_ngraph_frontend/mock_py_frontend.cpp diff --git a/runtime/bindings/python/tests_compatibility/mock/mock_py_ngraph_frontend/mock_py_frontend.hpp b/src/bindings/python/tests_compatibility/mock/mock_py_ngraph_frontend/mock_py_frontend.hpp similarity index 100% rename from runtime/bindings/python/tests_compatibility/mock/mock_py_ngraph_frontend/mock_py_frontend.hpp rename to src/bindings/python/tests_compatibility/mock/mock_py_ngraph_frontend/mock_py_frontend.hpp diff --git a/runtime/bindings/python/tests_compatibility/mock/pyngraph_fe_mock_api/CMakeLists.txt b/src/bindings/python/tests_compatibility/mock/pyngraph_fe_mock_api/CMakeLists.txt similarity index 100% rename from runtime/bindings/python/tests_compatibility/mock/pyngraph_fe_mock_api/CMakeLists.txt rename to src/bindings/python/tests_compatibility/mock/pyngraph_fe_mock_api/CMakeLists.txt diff --git a/runtime/bindings/python/tests_compatibility/mock/pyngraph_fe_mock_api/pyngraph_mock_frontend_api.cpp b/src/bindings/python/tests_compatibility/mock/pyngraph_fe_mock_api/pyngraph_mock_frontend_api.cpp similarity index 100% rename from runtime/bindings/python/tests_compatibility/mock/pyngraph_fe_mock_api/pyngraph_mock_frontend_api.cpp rename to src/bindings/python/tests_compatibility/mock/pyngraph_fe_mock_api/pyngraph_mock_frontend_api.cpp diff --git a/runtime/bindings/python/tests_compatibility/runtime.py b/src/bindings/python/tests_compatibility/runtime.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/runtime.py rename to src/bindings/python/tests_compatibility/runtime.py diff --git a/runtime/bindings/python/tests_compatibility/test_frontend/test_frontend_onnx.py b/src/bindings/python/tests_compatibility/test_frontend/test_frontend_onnx.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_frontend/test_frontend_onnx.py rename to src/bindings/python/tests_compatibility/test_frontend/test_frontend_onnx.py diff --git a/runtime/bindings/python/tests_compatibility/test_frontend/test_frontend_onnx_editor.py b/src/bindings/python/tests_compatibility/test_frontend/test_frontend_onnx_editor.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_frontend/test_frontend_onnx_editor.py rename to src/bindings/python/tests_compatibility/test_frontend/test_frontend_onnx_editor.py diff --git a/runtime/bindings/python/tests_compatibility/test_frontend/test_frontendmanager.py b/src/bindings/python/tests_compatibility/test_frontend/test_frontendmanager.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_frontend/test_frontendmanager.py rename to src/bindings/python/tests_compatibility/test_frontend/test_frontendmanager.py diff --git a/runtime/bindings/python/tests_compatibility/test_ngraph/__init__.py b/src/bindings/python/tests_compatibility/test_ngraph/__init__.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_ngraph/__init__.py rename to src/bindings/python/tests_compatibility/test_ngraph/__init__.py diff --git a/runtime/bindings/python/tests_compatibility/test_ngraph/test_adaptive_pool.py b/src/bindings/python/tests_compatibility/test_ngraph/test_adaptive_pool.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_ngraph/test_adaptive_pool.py rename to src/bindings/python/tests_compatibility/test_ngraph/test_adaptive_pool.py diff --git a/runtime/bindings/python/tests_compatibility/test_ngraph/test_basic.py b/src/bindings/python/tests_compatibility/test_ngraph/test_basic.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_ngraph/test_basic.py rename to src/bindings/python/tests_compatibility/test_ngraph/test_basic.py diff --git a/runtime/bindings/python/tests_compatibility/test_ngraph/test_convolution.py b/src/bindings/python/tests_compatibility/test_ngraph/test_convolution.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_ngraph/test_convolution.py rename to src/bindings/python/tests_compatibility/test_ngraph/test_convolution.py diff --git a/runtime/bindings/python/tests_compatibility/test_ngraph/test_core.py b/src/bindings/python/tests_compatibility/test_ngraph/test_core.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_ngraph/test_core.py rename to src/bindings/python/tests_compatibility/test_ngraph/test_core.py diff --git a/runtime/bindings/python/tests_compatibility/test_ngraph/test_create_op.py b/src/bindings/python/tests_compatibility/test_ngraph/test_create_op.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_ngraph/test_create_op.py rename to src/bindings/python/tests_compatibility/test_ngraph/test_create_op.py diff --git a/runtime/bindings/python/tests_compatibility/test_ngraph/test_ctc_loss.py b/src/bindings/python/tests_compatibility/test_ngraph/test_ctc_loss.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_ngraph/test_ctc_loss.py rename to src/bindings/python/tests_compatibility/test_ngraph/test_ctc_loss.py diff --git a/runtime/bindings/python/tests_compatibility/test_ngraph/test_data_movement.py b/src/bindings/python/tests_compatibility/test_ngraph/test_data_movement.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_ngraph/test_data_movement.py rename to src/bindings/python/tests_compatibility/test_ngraph/test_data_movement.py diff --git a/runtime/bindings/python/tests_compatibility/test_ngraph/test_dft.py b/src/bindings/python/tests_compatibility/test_ngraph/test_dft.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_ngraph/test_dft.py rename to src/bindings/python/tests_compatibility/test_ngraph/test_dft.py diff --git a/runtime/bindings/python/tests_compatibility/test_ngraph/test_dyn_attributes.py b/src/bindings/python/tests_compatibility/test_ngraph/test_dyn_attributes.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_ngraph/test_dyn_attributes.py rename to src/bindings/python/tests_compatibility/test_ngraph/test_dyn_attributes.py diff --git a/runtime/bindings/python/tests_compatibility/test_ngraph/test_einsum.py b/src/bindings/python/tests_compatibility/test_ngraph/test_einsum.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_ngraph/test_einsum.py rename to src/bindings/python/tests_compatibility/test_ngraph/test_einsum.py diff --git a/runtime/bindings/python/tests_compatibility/test_ngraph/test_gather.py b/src/bindings/python/tests_compatibility/test_ngraph/test_gather.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_ngraph/test_gather.py rename to src/bindings/python/tests_compatibility/test_ngraph/test_gather.py diff --git a/runtime/bindings/python/tests_compatibility/test_ngraph/test_idft.py b/src/bindings/python/tests_compatibility/test_ngraph/test_idft.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_ngraph/test_idft.py rename to src/bindings/python/tests_compatibility/test_ngraph/test_idft.py diff --git a/runtime/bindings/python/tests_compatibility/test_ngraph/test_input_validation.py b/src/bindings/python/tests_compatibility/test_ngraph/test_input_validation.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_ngraph/test_input_validation.py rename to src/bindings/python/tests_compatibility/test_ngraph/test_input_validation.py diff --git a/runtime/bindings/python/tests_compatibility/test_ngraph/test_log_softmax.py b/src/bindings/python/tests_compatibility/test_ngraph/test_log_softmax.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_ngraph/test_log_softmax.py rename to src/bindings/python/tests_compatibility/test_ngraph/test_log_softmax.py diff --git a/runtime/bindings/python/tests_compatibility/test_ngraph/test_manager.py b/src/bindings/python/tests_compatibility/test_ngraph/test_manager.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_ngraph/test_manager.py rename to src/bindings/python/tests_compatibility/test_ngraph/test_manager.py diff --git a/runtime/bindings/python/tests_compatibility/test_ngraph/test_node_factory.py b/src/bindings/python/tests_compatibility/test_ngraph/test_node_factory.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_ngraph/test_node_factory.py rename to src/bindings/python/tests_compatibility/test_ngraph/test_node_factory.py diff --git a/runtime/bindings/python/tests_compatibility/test_ngraph/test_normalization.py b/src/bindings/python/tests_compatibility/test_ngraph/test_normalization.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_ngraph/test_normalization.py rename to src/bindings/python/tests_compatibility/test_ngraph/test_normalization.py diff --git a/runtime/bindings/python/tests_compatibility/test_ngraph/test_ops.py b/src/bindings/python/tests_compatibility/test_ngraph/test_ops.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_ngraph/test_ops.py rename to src/bindings/python/tests_compatibility/test_ngraph/test_ops.py diff --git a/runtime/bindings/python/tests_compatibility/test_ngraph/test_ops_binary.py b/src/bindings/python/tests_compatibility/test_ngraph/test_ops_binary.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_ngraph/test_ops_binary.py rename to src/bindings/python/tests_compatibility/test_ngraph/test_ops_binary.py diff --git a/runtime/bindings/python/tests_compatibility/test_ngraph/test_ops_fused.py b/src/bindings/python/tests_compatibility/test_ngraph/test_ops_fused.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_ngraph/test_ops_fused.py rename to src/bindings/python/tests_compatibility/test_ngraph/test_ops_fused.py diff --git a/runtime/bindings/python/tests_compatibility/test_ngraph/test_ops_matmul.py b/src/bindings/python/tests_compatibility/test_ngraph/test_ops_matmul.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_ngraph/test_ops_matmul.py rename to src/bindings/python/tests_compatibility/test_ngraph/test_ops_matmul.py diff --git a/runtime/bindings/python/tests_compatibility/test_ngraph/test_ops_multioutput.py b/src/bindings/python/tests_compatibility/test_ngraph/test_ops_multioutput.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_ngraph/test_ops_multioutput.py rename to src/bindings/python/tests_compatibility/test_ngraph/test_ops_multioutput.py diff --git a/runtime/bindings/python/tests_compatibility/test_ngraph/test_ops_reshape.py b/src/bindings/python/tests_compatibility/test_ngraph/test_ops_reshape.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_ngraph/test_ops_reshape.py rename to src/bindings/python/tests_compatibility/test_ngraph/test_ops_reshape.py diff --git a/runtime/bindings/python/tests_compatibility/test_ngraph/test_ops_scatter.py b/src/bindings/python/tests_compatibility/test_ngraph/test_ops_scatter.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_ngraph/test_ops_scatter.py rename to src/bindings/python/tests_compatibility/test_ngraph/test_ops_scatter.py diff --git a/runtime/bindings/python/tests_compatibility/test_ngraph/test_ops_unary.py b/src/bindings/python/tests_compatibility/test_ngraph/test_ops_unary.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_ngraph/test_ops_unary.py rename to src/bindings/python/tests_compatibility/test_ngraph/test_ops_unary.py diff --git a/runtime/bindings/python/tests_compatibility/test_ngraph/test_pooling.py b/src/bindings/python/tests_compatibility/test_ngraph/test_pooling.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_ngraph/test_pooling.py rename to src/bindings/python/tests_compatibility/test_ngraph/test_pooling.py diff --git a/runtime/bindings/python/tests_compatibility/test_ngraph/test_proposal.py b/src/bindings/python/tests_compatibility/test_ngraph/test_proposal.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_ngraph/test_proposal.py rename to src/bindings/python/tests_compatibility/test_ngraph/test_proposal.py diff --git a/runtime/bindings/python/tests_compatibility/test_ngraph/test_random_uniform.py b/src/bindings/python/tests_compatibility/test_ngraph/test_random_uniform.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_ngraph/test_random_uniform.py rename to src/bindings/python/tests_compatibility/test_ngraph/test_random_uniform.py diff --git a/runtime/bindings/python/tests_compatibility/test_ngraph/test_reduction.py b/src/bindings/python/tests_compatibility/test_ngraph/test_reduction.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_ngraph/test_reduction.py rename to src/bindings/python/tests_compatibility/test_ngraph/test_reduction.py diff --git a/runtime/bindings/python/tests_compatibility/test_ngraph/test_roll.py b/src/bindings/python/tests_compatibility/test_ngraph/test_roll.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_ngraph/test_roll.py rename to src/bindings/python/tests_compatibility/test_ngraph/test_roll.py diff --git a/runtime/bindings/python/tests_compatibility/test_ngraph/test_sequence_processing.py b/src/bindings/python/tests_compatibility/test_ngraph/test_sequence_processing.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_ngraph/test_sequence_processing.py rename to src/bindings/python/tests_compatibility/test_ngraph/test_sequence_processing.py diff --git a/runtime/bindings/python/tests_compatibility/test_ngraph/test_swish.py b/src/bindings/python/tests_compatibility/test_ngraph/test_swish.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_ngraph/test_swish.py rename to src/bindings/python/tests_compatibility/test_ngraph/test_swish.py diff --git a/runtime/bindings/python/tests_compatibility/test_ngraph/test_utils.py b/src/bindings/python/tests_compatibility/test_ngraph/test_utils.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_ngraph/test_utils.py rename to src/bindings/python/tests_compatibility/test_ngraph/test_utils.py diff --git a/runtime/bindings/python/tests_compatibility/test_ngraph/util.py b/src/bindings/python/tests_compatibility/test_ngraph/util.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_ngraph/util.py rename to src/bindings/python/tests_compatibility/test_ngraph/util.py diff --git a/runtime/bindings/python/tests_compatibility/test_onnx/__init__.py b/src/bindings/python/tests_compatibility/test_onnx/__init__.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_onnx/__init__.py rename to src/bindings/python/tests_compatibility/test_onnx/__init__.py diff --git a/runtime/bindings/python/tests_compatibility/test_onnx/model_zoo_preprocess.sh b/src/bindings/python/tests_compatibility/test_onnx/model_zoo_preprocess.sh similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_onnx/model_zoo_preprocess.sh rename to src/bindings/python/tests_compatibility/test_onnx/model_zoo_preprocess.sh diff --git a/runtime/bindings/python/tests_compatibility/test_onnx/models/add_abc.onnx b/src/bindings/python/tests_compatibility/test_onnx/models/add_abc.onnx similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_onnx/models/add_abc.onnx rename to src/bindings/python/tests_compatibility/test_onnx/models/add_abc.onnx diff --git a/runtime/bindings/python/tests_compatibility/test_onnx/models/data/tensor.data b/src/bindings/python/tests_compatibility/test_onnx/models/data/tensor.data similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_onnx/models/data/tensor.data rename to src/bindings/python/tests_compatibility/test_onnx/models/data/tensor.data diff --git a/runtime/bindings/python/tests_compatibility/test_onnx/models/external_data.onnx b/src/bindings/python/tests_compatibility/test_onnx/models/external_data.onnx similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_onnx/models/external_data.onnx rename to src/bindings/python/tests_compatibility/test_onnx/models/external_data.onnx diff --git a/runtime/bindings/python/tests_compatibility/test_onnx/test_backend.py b/src/bindings/python/tests_compatibility/test_onnx/test_backend.py similarity index 99% rename from runtime/bindings/python/tests_compatibility/test_onnx/test_backend.py rename to src/bindings/python/tests_compatibility/test_onnx/test_backend.py index bd4d8284b2c..c6bbe3d6a57 100644 --- a/runtime/bindings/python/tests_compatibility/test_onnx/test_backend.py +++ b/src/bindings/python/tests_compatibility/test_onnx/test_backend.py @@ -113,7 +113,6 @@ tests_expected_to_fail = [ ( xfail_issue_39658, "OnnxBackendNodeModelTest.test_tile_cpu", - "OnnxBackendNodeModelTest.test_tile_precomputed_cpu", ), ( xfail_issue_39662, diff --git a/runtime/bindings/python/tests_compatibility/test_onnx/test_onnx_external_data.py b/src/bindings/python/tests_compatibility/test_onnx/test_onnx_external_data.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_onnx/test_onnx_external_data.py rename to src/bindings/python/tests_compatibility/test_onnx/test_onnx_external_data.py diff --git a/runtime/bindings/python/tests_compatibility/test_onnx/test_onnx_import.py b/src/bindings/python/tests_compatibility/test_onnx/test_onnx_import.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_onnx/test_onnx_import.py rename to src/bindings/python/tests_compatibility/test_onnx/test_onnx_import.py diff --git a/runtime/bindings/python/tests_compatibility/test_onnx/test_ops_batchnorm.py b/src/bindings/python/tests_compatibility/test_onnx/test_ops_batchnorm.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_onnx/test_ops_batchnorm.py rename to src/bindings/python/tests_compatibility/test_onnx/test_ops_batchnorm.py diff --git a/runtime/bindings/python/tests_compatibility/test_onnx/test_ops_binary.py b/src/bindings/python/tests_compatibility/test_onnx/test_ops_binary.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_onnx/test_ops_binary.py rename to src/bindings/python/tests_compatibility/test_onnx/test_ops_binary.py diff --git a/runtime/bindings/python/tests_compatibility/test_onnx/test_ops_convpool.py b/src/bindings/python/tests_compatibility/test_onnx/test_ops_convpool.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_onnx/test_ops_convpool.py rename to src/bindings/python/tests_compatibility/test_onnx/test_ops_convpool.py diff --git a/runtime/bindings/python/tests_compatibility/test_onnx/test_ops_logical.py b/src/bindings/python/tests_compatibility/test_onnx/test_ops_logical.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_onnx/test_ops_logical.py rename to src/bindings/python/tests_compatibility/test_onnx/test_ops_logical.py diff --git a/runtime/bindings/python/tests_compatibility/test_onnx/test_ops_matmul.py b/src/bindings/python/tests_compatibility/test_onnx/test_ops_matmul.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_onnx/test_ops_matmul.py rename to src/bindings/python/tests_compatibility/test_onnx/test_ops_matmul.py diff --git a/runtime/bindings/python/tests_compatibility/test_onnx/test_ops_nonlinear.py b/src/bindings/python/tests_compatibility/test_onnx/test_ops_nonlinear.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_onnx/test_ops_nonlinear.py rename to src/bindings/python/tests_compatibility/test_onnx/test_ops_nonlinear.py diff --git a/runtime/bindings/python/tests_compatibility/test_onnx/test_ops_reduction.py b/src/bindings/python/tests_compatibility/test_onnx/test_ops_reduction.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_onnx/test_ops_reduction.py rename to src/bindings/python/tests_compatibility/test_onnx/test_ops_reduction.py diff --git a/runtime/bindings/python/tests_compatibility/test_onnx/test_ops_reshape.py b/src/bindings/python/tests_compatibility/test_onnx/test_ops_reshape.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_onnx/test_ops_reshape.py rename to src/bindings/python/tests_compatibility/test_onnx/test_ops_reshape.py diff --git a/runtime/bindings/python/tests_compatibility/test_onnx/test_ops_unary.py b/src/bindings/python/tests_compatibility/test_onnx/test_ops_unary.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_onnx/test_ops_unary.py rename to src/bindings/python/tests_compatibility/test_onnx/test_ops_unary.py diff --git a/runtime/bindings/python/tests_compatibility/test_onnx/test_ops_variadic.py b/src/bindings/python/tests_compatibility/test_onnx/test_ops_variadic.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_onnx/test_ops_variadic.py rename to src/bindings/python/tests_compatibility/test_onnx/test_ops_variadic.py diff --git a/runtime/bindings/python/tests_compatibility/test_onnx/test_zoo_models.py b/src/bindings/python/tests_compatibility/test_onnx/test_zoo_models.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_onnx/test_zoo_models.py rename to src/bindings/python/tests_compatibility/test_onnx/test_zoo_models.py diff --git a/runtime/bindings/python/tests_compatibility/test_onnx/utils/__init__.py b/src/bindings/python/tests_compatibility/test_onnx/utils/__init__.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_onnx/utils/__init__.py rename to src/bindings/python/tests_compatibility/test_onnx/utils/__init__.py diff --git a/runtime/bindings/python/tests_compatibility/test_onnx/utils/model_importer.py b/src/bindings/python/tests_compatibility/test_onnx/utils/model_importer.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_onnx/utils/model_importer.py rename to src/bindings/python/tests_compatibility/test_onnx/utils/model_importer.py diff --git a/runtime/bindings/python/tests_compatibility/test_onnx/utils/onnx_backend.py b/src/bindings/python/tests_compatibility/test_onnx/utils/onnx_backend.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_onnx/utils/onnx_backend.py rename to src/bindings/python/tests_compatibility/test_onnx/utils/onnx_backend.py diff --git a/runtime/bindings/python/tests_compatibility/test_onnx/utils/onnx_helpers.py b/src/bindings/python/tests_compatibility/test_onnx/utils/onnx_helpers.py similarity index 100% rename from runtime/bindings/python/tests_compatibility/test_onnx/utils/onnx_helpers.py rename to src/bindings/python/tests_compatibility/test_onnx/utils/onnx_helpers.py diff --git a/runtime/bindings/python/thirdparty/pybind11 b/src/bindings/python/thirdparty/pybind11 similarity index 100% rename from runtime/bindings/python/thirdparty/pybind11 rename to src/bindings/python/thirdparty/pybind11 diff --git a/runtime/bindings/python/tox.ini b/src/bindings/python/tox.ini similarity index 100% rename from runtime/bindings/python/tox.ini rename to src/bindings/python/tox.ini diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt new file mode 100644 index 00000000000..35f24cd8c13 --- /dev/null +++ b/src/common/CMakeLists.txt @@ -0,0 +1,19 @@ +# Copyright (C) 2018-2021 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 +# + +add_subdirectory(itt) +add_subdirectory(conditional_compilation) +add_subdirectory(util) + +add_subdirectory(snippets) +add_subdirectory(legacy) +add_subdirectory(preprocessing) +add_subdirectory(transformations) +add_subdirectory(low_precision_transformations) + +add_dependencies(ov_runtime_libraries inference_engine_legacy + inference_engine_transformations + inference_engine_lp_transformations + inference_engine_preproc + inference_engine_snippets) diff --git a/openvino/conditional_compilation/CMakeLists.txt b/src/common/conditional_compilation/CMakeLists.txt similarity index 95% rename from openvino/conditional_compilation/CMakeLists.txt rename to src/common/conditional_compilation/CMakeLists.txt index 70fb4484e76..541cf953907 100644 --- a/openvino/conditional_compilation/CMakeLists.txt +++ b/src/common/conditional_compilation/CMakeLists.txt @@ -50,3 +50,4 @@ ov_install_static_lib(${TARGET_NAME} ngraph) file(GLOB_RECURSE hdrs ${CMAKE_CURRENT_SOURCE_DIR}/include/*.h ${CMAKE_CURRENT_SOURCE_DIR}/include/*.hpp) add_cpplint_target(${TARGET_NAME}_cpplint FOR_SOURCES ${hdrs}) +openvino_developer_export_targets(COMPONENT openvino_common TARGETS openvino::conditional_compilation) diff --git a/openvino/conditional_compilation/include/openvino/cc/factory.h b/src/common/conditional_compilation/include/openvino/cc/factory.h similarity index 100% rename from openvino/conditional_compilation/include/openvino/cc/factory.h rename to src/common/conditional_compilation/include/openvino/cc/factory.h diff --git a/openvino/conditional_compilation/include/openvino/cc/ngraph/itt.hpp b/src/common/conditional_compilation/include/openvino/cc/ngraph/itt.hpp similarity index 100% rename from openvino/conditional_compilation/include/openvino/cc/ngraph/itt.hpp rename to src/common/conditional_compilation/include/openvino/cc/ngraph/itt.hpp diff --git a/openvino/conditional_compilation/include/openvino/cc/selective_build.h b/src/common/conditional_compilation/include/openvino/cc/selective_build.h similarity index 99% rename from openvino/conditional_compilation/include/openvino/cc/selective_build.h rename to src/common/conditional_compilation/include/openvino/cc/selective_build.h index 756179695a3..fe36e50ef03 100644 --- a/openvino/conditional_compilation/include/openvino/cc/selective_build.h +++ b/src/common/conditional_compilation/include/openvino/cc/selective_build.h @@ -55,7 +55,7 @@ * */ -#include +#include #include #define OV_CC_EXPAND OV_PP_EXPAND diff --git a/openvino/conditional_compilation/scripts/ccheader.py b/src/common/conditional_compilation/scripts/ccheader.py similarity index 100% rename from openvino/conditional_compilation/scripts/ccheader.py rename to src/common/conditional_compilation/scripts/ccheader.py diff --git a/openvino/itt/CMakeLists.txt b/src/common/itt/CMakeLists.txt similarity index 88% rename from openvino/itt/CMakeLists.txt rename to src/common/itt/CMakeLists.txt index fbeab9f3e0d..da5421f6737 100644 --- a/openvino/itt/CMakeLists.txt +++ b/src/common/itt/CMakeLists.txt @@ -10,7 +10,7 @@ add_library(${TARGET_NAME} STATIC ${SOURCES}) add_library(openvino::itt ALIAS ${TARGET_NAME}) -target_link_libraries(${TARGET_NAME} PUBLIC openvino::pp) +target_link_libraries(${TARGET_NAME} PUBLIC openvino::util) if(TARGET ittnotify) target_link_libraries(${TARGET_NAME} PUBLIC ittnotify) @@ -36,3 +36,4 @@ target_include_directories(${TARGET_NAME} PUBLIC ov_install_static_lib(${TARGET_NAME} openvino_common) add_cpplint_target(${TARGET_NAME}_cpplint FOR_TARGETS ${TARGET_NAME}) +openvino_developer_export_targets(COMPONENT openvino_common TARGETS openvino::itt) diff --git a/openvino/itt/cmake/ITTConfig.cmake b/src/common/itt/cmake/ITTConfig.cmake similarity index 100% rename from openvino/itt/cmake/ITTConfig.cmake rename to src/common/itt/cmake/ITTConfig.cmake diff --git a/openvino/itt/include/openvino/function_name.hpp b/src/common/itt/include/openvino/function_name.hpp similarity index 100% rename from openvino/itt/include/openvino/function_name.hpp rename to src/common/itt/include/openvino/function_name.hpp diff --git a/openvino/itt/include/openvino/itt.hpp b/src/common/itt/include/openvino/itt.hpp similarity index 99% rename from openvino/itt/include/openvino/itt.hpp rename to src/common/itt/include/openvino/itt.hpp index 8a22efa54fe..ee276fa1feb 100644 --- a/openvino/itt/include/openvino/itt.hpp +++ b/src/common/itt/include/openvino/itt.hpp @@ -9,7 +9,7 @@ #pragma once #include -#include +#include #include #include diff --git a/openvino/itt/src/itt.cpp b/src/common/itt/src/itt.cpp similarity index 100% rename from openvino/itt/src/itt.cpp rename to src/common/itt/src/itt.cpp diff --git a/inference-engine/src/legacy_api/CMakeLists.txt b/src/common/legacy/CMakeLists.txt similarity index 100% rename from inference-engine/src/legacy_api/CMakeLists.txt rename to src/common/legacy/CMakeLists.txt diff --git a/inference-engine/src/legacy_api/include/legacy/cnn_network_impl.hpp b/src/common/legacy/include/legacy/cnn_network_impl.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/cnn_network_impl.hpp rename to src/common/legacy/include/legacy/cnn_network_impl.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/convert_function_to_cnn_network.hpp b/src/common/legacy/include/legacy/convert_function_to_cnn_network.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/convert_function_to_cnn_network.hpp rename to src/common/legacy/include/legacy/convert_function_to_cnn_network.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/details/ie_cnn_network_iterator.hpp b/src/common/legacy/include/legacy/details/ie_cnn_network_iterator.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/details/ie_cnn_network_iterator.hpp rename to src/common/legacy/include/legacy/details/ie_cnn_network_iterator.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/details/ie_cnn_network_tools.h b/src/common/legacy/include/legacy/details/ie_cnn_network_tools.h similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/details/ie_cnn_network_tools.h rename to src/common/legacy/include/legacy/details/ie_cnn_network_tools.h diff --git a/inference-engine/src/legacy_api/include/legacy/graph_tools.hpp b/src/common/legacy/include/legacy/graph_tools.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/graph_tools.hpp rename to src/common/legacy/include/legacy/graph_tools.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/graph_transformer.h b/src/common/legacy/include/legacy/graph_transformer.h similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/graph_transformer.h rename to src/common/legacy/include/legacy/graph_transformer.h diff --git a/inference-engine/src/readers/ir_reader_v7/ie_ir_version.hpp b/src/common/legacy/include/legacy/ie_ir_version.hpp similarity index 100% rename from inference-engine/src/readers/ir_reader_v7/ie_ir_version.hpp rename to src/common/legacy/include/legacy/ie_ir_version.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/ie_layers.h b/src/common/legacy/include/legacy/ie_layers.h similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/ie_layers.h rename to src/common/legacy/include/legacy/ie_layers.h diff --git a/inference-engine/src/legacy_api/include/legacy/ie_layers_internal.hpp b/src/common/legacy/include/legacy/ie_layers_internal.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/ie_layers_internal.hpp rename to src/common/legacy/include/legacy/ie_layers_internal.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/ie_layers_property.hpp b/src/common/legacy/include/legacy/ie_layers_property.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/ie_layers_property.hpp rename to src/common/legacy/include/legacy/ie_layers_property.hpp diff --git a/inference-engine/src/readers/reader_api/ie_reader.hpp b/src/common/legacy/include/legacy/ie_reader.hpp similarity index 100% rename from inference-engine/src/readers/reader_api/ie_reader.hpp rename to src/common/legacy/include/legacy/ie_reader.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/ie_util_internal.hpp b/src/common/legacy/include/legacy/ie_util_internal.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/ie_util_internal.hpp rename to src/common/legacy/include/legacy/ie_util_internal.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/layer_transform.hpp b/src/common/legacy/include/legacy/layer_transform.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/layer_transform.hpp rename to src/common/legacy/include/legacy/layer_transform.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/net_pass.h b/src/common/legacy/include/legacy/net_pass.h similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/net_pass.h rename to src/common/legacy/include/legacy/net_pass.h diff --git a/inference-engine/src/legacy_api/include/legacy/ngraph_ops/crop_ie.hpp b/src/common/legacy/include/legacy/ngraph_ops/crop_ie.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/ngraph_ops/crop_ie.hpp rename to src/common/legacy/include/legacy/ngraph_ops/crop_ie.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/ngraph_ops/eltwise.hpp b/src/common/legacy/include/legacy/ngraph_ops/eltwise.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/ngraph_ops/eltwise.hpp rename to src/common/legacy/include/legacy/ngraph_ops/eltwise.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/ngraph_ops/fully_connected.hpp b/src/common/legacy/include/legacy/ngraph_ops/fully_connected.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/ngraph_ops/fully_connected.hpp rename to src/common/legacy/include/legacy/ngraph_ops/fully_connected.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/ngraph_ops/gather_ie.hpp b/src/common/legacy/include/legacy/ngraph_ops/gather_ie.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/ngraph_ops/gather_ie.hpp rename to src/common/legacy/include/legacy/ngraph_ops/gather_ie.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/ngraph_ops/gather_tree_ie.hpp b/src/common/legacy/include/legacy/ngraph_ops/gather_tree_ie.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/ngraph_ops/gather_tree_ie.hpp rename to src/common/legacy/include/legacy/ngraph_ops/gather_tree_ie.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/ngraph_ops/gru_cell_ie.hpp b/src/common/legacy/include/legacy/ngraph_ops/gru_cell_ie.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/ngraph_ops/gru_cell_ie.hpp rename to src/common/legacy/include/legacy/ngraph_ops/gru_cell_ie.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/ngraph_ops/gru_sequence_ie.hpp b/src/common/legacy/include/legacy/ngraph_ops/gru_sequence_ie.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/ngraph_ops/gru_sequence_ie.hpp rename to src/common/legacy/include/legacy/ngraph_ops/gru_sequence_ie.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/ngraph_ops/hard_sigmoid_ie.hpp b/src/common/legacy/include/legacy/ngraph_ops/hard_sigmoid_ie.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/ngraph_ops/hard_sigmoid_ie.hpp rename to src/common/legacy/include/legacy/ngraph_ops/hard_sigmoid_ie.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/ngraph_ops/interp.hpp b/src/common/legacy/include/legacy/ngraph_ops/interp.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/ngraph_ops/interp.hpp rename to src/common/legacy/include/legacy/ngraph_ops/interp.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/ngraph_ops/lrn_ie.hpp b/src/common/legacy/include/legacy/ngraph_ops/lrn_ie.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/ngraph_ops/lrn_ie.hpp rename to src/common/legacy/include/legacy/ngraph_ops/lrn_ie.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/ngraph_ops/lstm_cell_ie.hpp b/src/common/legacy/include/legacy/ngraph_ops/lstm_cell_ie.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/ngraph_ops/lstm_cell_ie.hpp rename to src/common/legacy/include/legacy/ngraph_ops/lstm_cell_ie.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/ngraph_ops/lstm_sequence_ie.hpp b/src/common/legacy/include/legacy/ngraph_ops/lstm_sequence_ie.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/ngraph_ops/lstm_sequence_ie.hpp rename to src/common/legacy/include/legacy/ngraph_ops/lstm_sequence_ie.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/ngraph_ops/nms_ie.hpp b/src/common/legacy/include/legacy/ngraph_ops/nms_ie.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/ngraph_ops/nms_ie.hpp rename to src/common/legacy/include/legacy/ngraph_ops/nms_ie.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/ngraph_ops/normalize_ie.hpp b/src/common/legacy/include/legacy/ngraph_ops/normalize_ie.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/ngraph_ops/normalize_ie.hpp rename to src/common/legacy/include/legacy/ngraph_ops/normalize_ie.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/ngraph_ops/onehot_ie.hpp b/src/common/legacy/include/legacy/ngraph_ops/onehot_ie.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/ngraph_ops/onehot_ie.hpp rename to src/common/legacy/include/legacy/ngraph_ops/onehot_ie.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/ngraph_ops/pad_ie.hpp b/src/common/legacy/include/legacy/ngraph_ops/pad_ie.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/ngraph_ops/pad_ie.hpp rename to src/common/legacy/include/legacy/ngraph_ops/pad_ie.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/ngraph_ops/power.hpp b/src/common/legacy/include/legacy/ngraph_ops/power.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/ngraph_ops/power.hpp rename to src/common/legacy/include/legacy/ngraph_ops/power.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/ngraph_ops/proposal_ie.hpp b/src/common/legacy/include/legacy/ngraph_ops/proposal_ie.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/ngraph_ops/proposal_ie.hpp rename to src/common/legacy/include/legacy/ngraph_ops/proposal_ie.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/ngraph_ops/relu_ie.hpp b/src/common/legacy/include/legacy/ngraph_ops/relu_ie.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/ngraph_ops/relu_ie.hpp rename to src/common/legacy/include/legacy/ngraph_ops/relu_ie.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/ngraph_ops/rnn_cell_ie.hpp b/src/common/legacy/include/legacy/ngraph_ops/rnn_cell_ie.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/ngraph_ops/rnn_cell_ie.hpp rename to src/common/legacy/include/legacy/ngraph_ops/rnn_cell_ie.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/ngraph_ops/rnn_sequence_ie.hpp b/src/common/legacy/include/legacy/ngraph_ops/rnn_sequence_ie.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/ngraph_ops/rnn_sequence_ie.hpp rename to src/common/legacy/include/legacy/ngraph_ops/rnn_sequence_ie.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/ngraph_ops/scaleshift.hpp b/src/common/legacy/include/legacy/ngraph_ops/scaleshift.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/ngraph_ops/scaleshift.hpp rename to src/common/legacy/include/legacy/ngraph_ops/scaleshift.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/ngraph_ops/selu_ie.hpp b/src/common/legacy/include/legacy/ngraph_ops/selu_ie.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/ngraph_ops/selu_ie.hpp rename to src/common/legacy/include/legacy/ngraph_ops/selu_ie.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/ngraph_ops/swish_ie.hpp b/src/common/legacy/include/legacy/ngraph_ops/swish_ie.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/ngraph_ops/swish_ie.hpp rename to src/common/legacy/include/legacy/ngraph_ops/swish_ie.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/ngraph_ops/tile_ie.hpp b/src/common/legacy/include/legacy/ngraph_ops/tile_ie.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/ngraph_ops/tile_ie.hpp rename to src/common/legacy/include/legacy/ngraph_ops/tile_ie.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/ngraph_ops/topk_ie.hpp b/src/common/legacy/include/legacy/ngraph_ops/topk_ie.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/ngraph_ops/topk_ie.hpp rename to src/common/legacy/include/legacy/ngraph_ops/topk_ie.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_cells_to_cells_ie.hpp b/src/common/legacy/include/legacy/transformations/convert_opset1_to_legacy/convert_cells_to_cells_ie.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_cells_to_cells_ie.hpp rename to src/common/legacy/include/legacy/transformations/convert_opset1_to_legacy/convert_cells_to_cells_ie.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_gather_to_gather_ie.hpp b/src/common/legacy/include/legacy/transformations/convert_opset1_to_legacy/convert_gather_to_gather_ie.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_gather_to_gather_ie.hpp rename to src/common/legacy/include/legacy/transformations/convert_opset1_to_legacy/convert_gather_to_gather_ie.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_gathertree_to_gathertree_ie.hpp b/src/common/legacy/include/legacy/transformations/convert_opset1_to_legacy/convert_gathertree_to_gathertree_ie.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_gathertree_to_gathertree_ie.hpp rename to src/common/legacy/include/legacy/transformations/convert_opset1_to_legacy/convert_gathertree_to_gathertree_ie.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_hard_sigmoid_to_hard_sigmoid_ie.hpp b/src/common/legacy/include/legacy/transformations/convert_opset1_to_legacy/convert_hard_sigmoid_to_hard_sigmoid_ie.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_hard_sigmoid_to_hard_sigmoid_ie.hpp rename to src/common/legacy/include/legacy/transformations/convert_opset1_to_legacy/convert_hard_sigmoid_to_hard_sigmoid_ie.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_interpolate_to_interp_or_resample.hpp b/src/common/legacy/include/legacy/transformations/convert_opset1_to_legacy/convert_interpolate_to_interp_or_resample.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_interpolate_to_interp_or_resample.hpp rename to src/common/legacy/include/legacy/transformations/convert_opset1_to_legacy/convert_interpolate_to_interp_or_resample.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_lrn_to_lrn_ie.hpp b/src/common/legacy/include/legacy/transformations/convert_opset1_to_legacy/convert_lrn_to_lrn_ie.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_lrn_to_lrn_ie.hpp rename to src/common/legacy/include/legacy/transformations/convert_opset1_to_legacy/convert_lrn_to_lrn_ie.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_matmul_to_fc_or_gemm.hpp b/src/common/legacy/include/legacy/transformations/convert_opset1_to_legacy/convert_matmul_to_fc_or_gemm.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_matmul_to_fc_or_gemm.hpp rename to src/common/legacy/include/legacy/transformations/convert_opset1_to_legacy/convert_matmul_to_fc_or_gemm.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_mul_add_to_scaleshift_or_power.hpp b/src/common/legacy/include/legacy/transformations/convert_opset1_to_legacy/convert_mul_add_to_scaleshift_or_power.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_mul_add_to_scaleshift_or_power.hpp rename to src/common/legacy/include/legacy/transformations/convert_opset1_to_legacy/convert_mul_add_to_scaleshift_or_power.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_mul_or_add_finally.hpp b/src/common/legacy/include/legacy/transformations/convert_opset1_to_legacy/convert_mul_or_add_finally.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_mul_or_add_finally.hpp rename to src/common/legacy/include/legacy/transformations/convert_opset1_to_legacy/convert_mul_or_add_finally.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_nms_5_to_legacy.hpp b/src/common/legacy/include/legacy/transformations/convert_opset1_to_legacy/convert_nms_5_to_legacy.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_nms_5_to_legacy.hpp rename to src/common/legacy/include/legacy/transformations/convert_opset1_to_legacy/convert_nms_5_to_legacy.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_nms_to_nms_ie.hpp b/src/common/legacy/include/legacy/transformations/convert_opset1_to_legacy/convert_nms_to_nms_ie.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_nms_to_nms_ie.hpp rename to src/common/legacy/include/legacy/transformations/convert_opset1_to_legacy/convert_nms_to_nms_ie.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_normalizel2_to_normalize_ie.hpp b/src/common/legacy/include/legacy/transformations/convert_opset1_to_legacy/convert_normalizel2_to_normalize_ie.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_normalizel2_to_normalize_ie.hpp rename to src/common/legacy/include/legacy/transformations/convert_opset1_to_legacy/convert_normalizel2_to_normalize_ie.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_one_hot_to_one_hot_ie.hpp b/src/common/legacy/include/legacy/transformations/convert_opset1_to_legacy/convert_one_hot_to_one_hot_ie.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_one_hot_to_one_hot_ie.hpp rename to src/common/legacy/include/legacy/transformations/convert_opset1_to_legacy/convert_one_hot_to_one_hot_ie.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_opset1_to_legacy.hpp b/src/common/legacy/include/legacy/transformations/convert_opset1_to_legacy/convert_opset1_to_legacy.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_opset1_to_legacy.hpp rename to src/common/legacy/include/legacy/transformations/convert_opset1_to_legacy/convert_opset1_to_legacy.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_pad_to_pad_ie.hpp b/src/common/legacy/include/legacy/transformations/convert_opset1_to_legacy/convert_pad_to_pad_ie.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_pad_to_pad_ie.hpp rename to src/common/legacy/include/legacy/transformations/convert_opset1_to_legacy/convert_pad_to_pad_ie.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_power_to_power_ie.hpp b/src/common/legacy/include/legacy/transformations/convert_opset1_to_legacy/convert_power_to_power_ie.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_power_to_power_ie.hpp rename to src/common/legacy/include/legacy/transformations/convert_opset1_to_legacy/convert_power_to_power_ie.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_prelu_to_relu_ie.hpp b/src/common/legacy/include/legacy/transformations/convert_opset1_to_legacy/convert_prelu_to_relu_ie.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_prelu_to_relu_ie.hpp rename to src/common/legacy/include/legacy/transformations/convert_opset1_to_legacy/convert_prelu_to_relu_ie.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_proposal_to_proposal_ie.hpp b/src/common/legacy/include/legacy/transformations/convert_opset1_to_legacy/convert_proposal_to_proposal_ie.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_proposal_to_proposal_ie.hpp rename to src/common/legacy/include/legacy/transformations/convert_opset1_to_legacy/convert_proposal_to_proposal_ie.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_selu_to_selu_ie.hpp b/src/common/legacy/include/legacy/transformations/convert_opset1_to_legacy/convert_selu_to_selu_ie.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_selu_to_selu_ie.hpp rename to src/common/legacy/include/legacy/transformations/convert_opset1_to_legacy/convert_selu_to_selu_ie.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_sequences_to_sequences_ie.hpp b/src/common/legacy/include/legacy/transformations/convert_opset1_to_legacy/convert_sequences_to_sequences_ie.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_sequences_to_sequences_ie.hpp rename to src/common/legacy/include/legacy/transformations/convert_opset1_to_legacy/convert_sequences_to_sequences_ie.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_sqrt_to_power_ie.hpp b/src/common/legacy/include/legacy/transformations/convert_opset1_to_legacy/convert_sqrt_to_power_ie.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_sqrt_to_power_ie.hpp rename to src/common/legacy/include/legacy/transformations/convert_opset1_to_legacy/convert_sqrt_to_power_ie.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_strided_slice_to_crop.hpp b/src/common/legacy/include/legacy/transformations/convert_opset1_to_legacy/convert_strided_slice_to_crop.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_strided_slice_to_crop.hpp rename to src/common/legacy/include/legacy/transformations/convert_opset1_to_legacy/convert_strided_slice_to_crop.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_swish_to_swish_ie.hpp b/src/common/legacy/include/legacy/transformations/convert_opset1_to_legacy/convert_swish_to_swish_ie.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_swish_to_swish_ie.hpp rename to src/common/legacy/include/legacy/transformations/convert_opset1_to_legacy/convert_swish_to_swish_ie.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_tile_to_ie_tile.hpp b/src/common/legacy/include/legacy/transformations/convert_opset1_to_legacy/convert_tile_to_ie_tile.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_tile_to_ie_tile.hpp rename to src/common/legacy/include/legacy/transformations/convert_opset1_to_legacy/convert_tile_to_ie_tile.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_topk_to_topk_ie.hpp b/src/common/legacy/include/legacy/transformations/convert_opset1_to_legacy/convert_topk_to_topk_ie.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/convert_topk_to_topk_ie.hpp rename to src/common/legacy/include/legacy/transformations/convert_opset1_to_legacy/convert_topk_to_topk_ie.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/fc_bias_fusion.hpp b/src/common/legacy/include/legacy/transformations/convert_opset1_to_legacy/fc_bias_fusion.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/fc_bias_fusion.hpp rename to src/common/legacy/include/legacy/transformations/convert_opset1_to_legacy/fc_bias_fusion.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/reshape_1d_ops.hpp b/src/common/legacy/include/legacy/transformations/convert_opset1_to_legacy/reshape_1d_ops.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/reshape_1d_ops.hpp rename to src/common/legacy/include/legacy/transformations/convert_opset1_to_legacy/reshape_1d_ops.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/reshape_fc_fusion.hpp b/src/common/legacy/include/legacy/transformations/convert_opset1_to_legacy/reshape_fc_fusion.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/reshape_fc_fusion.hpp rename to src/common/legacy/include/legacy/transformations/convert_opset1_to_legacy/reshape_fc_fusion.hpp diff --git a/inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/reshape_fully_connected.hpp b/src/common/legacy/include/legacy/transformations/convert_opset1_to_legacy/reshape_fully_connected.hpp similarity index 100% rename from inference-engine/src/legacy_api/include/legacy/transformations/convert_opset1_to_legacy/reshape_fully_connected.hpp rename to src/common/legacy/include/legacy/transformations/convert_opset1_to_legacy/reshape_fully_connected.hpp diff --git a/inference-engine/src/legacy_api/src/cnn_network_impl.cpp b/src/common/legacy/src/cnn_network_impl.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/cnn_network_impl.cpp rename to src/common/legacy/src/cnn_network_impl.cpp diff --git a/inference-engine/src/legacy_api/src/convert_function_to_cnn_network.cpp b/src/common/legacy/src/convert_function_to_cnn_network.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/convert_function_to_cnn_network.cpp rename to src/common/legacy/src/convert_function_to_cnn_network.cpp diff --git a/inference-engine/src/legacy_api/src/graph_tools.cpp b/src/common/legacy/src/graph_tools.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/graph_tools.cpp rename to src/common/legacy/src/graph_tools.cpp diff --git a/inference-engine/src/legacy_api/src/graph_transformer.cpp b/src/common/legacy/src/graph_transformer.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/graph_transformer.cpp rename to src/common/legacy/src/graph_transformer.cpp diff --git a/inference-engine/src/legacy_api/src/ie_layer_validators.cpp b/src/common/legacy/src/ie_layer_validators.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/ie_layer_validators.cpp rename to src/common/legacy/src/ie_layer_validators.cpp diff --git a/inference-engine/src/legacy_api/src/ie_layer_validators.hpp b/src/common/legacy/src/ie_layer_validators.hpp similarity index 100% rename from inference-engine/src/legacy_api/src/ie_layer_validators.hpp rename to src/common/legacy/src/ie_layer_validators.hpp diff --git a/inference-engine/src/legacy_api/src/ie_layers.cpp b/src/common/legacy/src/ie_layers.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/ie_layers.cpp rename to src/common/legacy/src/ie_layers.cpp diff --git a/inference-engine/src/legacy_api/src/ie_layers_internal.cpp b/src/common/legacy/src/ie_layers_internal.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/ie_layers_internal.cpp rename to src/common/legacy/src/ie_layers_internal.cpp diff --git a/inference-engine/src/legacy_api/src/ie_legacy_itt.hpp b/src/common/legacy/src/ie_legacy_itt.hpp similarity index 100% rename from inference-engine/src/legacy_api/src/ie_legacy_itt.hpp rename to src/common/legacy/src/ie_legacy_itt.hpp diff --git a/inference-engine/src/legacy_api/src/ie_util_internal.cpp b/src/common/legacy/src/ie_util_internal.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/ie_util_internal.cpp rename to src/common/legacy/src/ie_util_internal.cpp diff --git a/inference-engine/src/legacy_api/src/layer_transform.cpp b/src/common/legacy/src/layer_transform.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/layer_transform.cpp rename to src/common/legacy/src/layer_transform.cpp diff --git a/inference-engine/src/legacy_api/src/net_pass.cpp b/src/common/legacy/src/net_pass.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/net_pass.cpp rename to src/common/legacy/src/net_pass.cpp diff --git a/inference-engine/src/legacy_api/src/network_serializer_v7.cpp b/src/common/legacy/src/network_serializer_v7.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/network_serializer_v7.cpp rename to src/common/legacy/src/network_serializer_v7.cpp diff --git a/inference-engine/src/legacy_api/src/network_serializer_v7.hpp b/src/common/legacy/src/network_serializer_v7.hpp similarity index 100% rename from inference-engine/src/legacy_api/src/network_serializer_v7.hpp rename to src/common/legacy/src/network_serializer_v7.hpp diff --git a/inference-engine/src/legacy_api/src/ngraph_ops/crop_ie.cpp b/src/common/legacy/src/ngraph_ops/crop_ie.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/ngraph_ops/crop_ie.cpp rename to src/common/legacy/src/ngraph_ops/crop_ie.cpp diff --git a/inference-engine/src/legacy_api/src/ngraph_ops/eltwise.cpp b/src/common/legacy/src/ngraph_ops/eltwise.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/ngraph_ops/eltwise.cpp rename to src/common/legacy/src/ngraph_ops/eltwise.cpp diff --git a/inference-engine/src/legacy_api/src/ngraph_ops/fully_connected.cpp b/src/common/legacy/src/ngraph_ops/fully_connected.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/ngraph_ops/fully_connected.cpp rename to src/common/legacy/src/ngraph_ops/fully_connected.cpp diff --git a/inference-engine/src/legacy_api/src/ngraph_ops/gather_ie.cpp b/src/common/legacy/src/ngraph_ops/gather_ie.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/ngraph_ops/gather_ie.cpp rename to src/common/legacy/src/ngraph_ops/gather_ie.cpp diff --git a/inference-engine/src/legacy_api/src/ngraph_ops/gather_tree_ie.cpp b/src/common/legacy/src/ngraph_ops/gather_tree_ie.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/ngraph_ops/gather_tree_ie.cpp rename to src/common/legacy/src/ngraph_ops/gather_tree_ie.cpp diff --git a/inference-engine/src/legacy_api/src/ngraph_ops/gru_cell_ie.cpp b/src/common/legacy/src/ngraph_ops/gru_cell_ie.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/ngraph_ops/gru_cell_ie.cpp rename to src/common/legacy/src/ngraph_ops/gru_cell_ie.cpp diff --git a/inference-engine/src/legacy_api/src/ngraph_ops/gru_sequence_ie.cpp b/src/common/legacy/src/ngraph_ops/gru_sequence_ie.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/ngraph_ops/gru_sequence_ie.cpp rename to src/common/legacy/src/ngraph_ops/gru_sequence_ie.cpp diff --git a/inference-engine/src/legacy_api/src/ngraph_ops/hard_sigmoid_ie.cpp b/src/common/legacy/src/ngraph_ops/hard_sigmoid_ie.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/ngraph_ops/hard_sigmoid_ie.cpp rename to src/common/legacy/src/ngraph_ops/hard_sigmoid_ie.cpp diff --git a/inference-engine/src/legacy_api/src/ngraph_ops/interp.cpp b/src/common/legacy/src/ngraph_ops/interp.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/ngraph_ops/interp.cpp rename to src/common/legacy/src/ngraph_ops/interp.cpp diff --git a/inference-engine/src/legacy_api/src/ngraph_ops/lrn_ie.cpp b/src/common/legacy/src/ngraph_ops/lrn_ie.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/ngraph_ops/lrn_ie.cpp rename to src/common/legacy/src/ngraph_ops/lrn_ie.cpp diff --git a/inference-engine/src/legacy_api/src/ngraph_ops/lstm_cell_ie.cpp b/src/common/legacy/src/ngraph_ops/lstm_cell_ie.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/ngraph_ops/lstm_cell_ie.cpp rename to src/common/legacy/src/ngraph_ops/lstm_cell_ie.cpp diff --git a/inference-engine/src/legacy_api/src/ngraph_ops/lstm_sequence_ie.cpp b/src/common/legacy/src/ngraph_ops/lstm_sequence_ie.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/ngraph_ops/lstm_sequence_ie.cpp rename to src/common/legacy/src/ngraph_ops/lstm_sequence_ie.cpp diff --git a/inference-engine/src/legacy_api/src/ngraph_ops/nms_ie.cpp b/src/common/legacy/src/ngraph_ops/nms_ie.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/ngraph_ops/nms_ie.cpp rename to src/common/legacy/src/ngraph_ops/nms_ie.cpp diff --git a/inference-engine/src/legacy_api/src/ngraph_ops/normalize_ie.cpp b/src/common/legacy/src/ngraph_ops/normalize_ie.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/ngraph_ops/normalize_ie.cpp rename to src/common/legacy/src/ngraph_ops/normalize_ie.cpp diff --git a/inference-engine/src/legacy_api/src/ngraph_ops/onehot_ie.cpp b/src/common/legacy/src/ngraph_ops/onehot_ie.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/ngraph_ops/onehot_ie.cpp rename to src/common/legacy/src/ngraph_ops/onehot_ie.cpp diff --git a/inference-engine/src/legacy_api/src/ngraph_ops/pad_ie.cpp b/src/common/legacy/src/ngraph_ops/pad_ie.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/ngraph_ops/pad_ie.cpp rename to src/common/legacy/src/ngraph_ops/pad_ie.cpp diff --git a/inference-engine/src/legacy_api/src/ngraph_ops/power.cpp b/src/common/legacy/src/ngraph_ops/power.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/ngraph_ops/power.cpp rename to src/common/legacy/src/ngraph_ops/power.cpp diff --git a/inference-engine/src/legacy_api/src/ngraph_ops/proposal_ie.cpp b/src/common/legacy/src/ngraph_ops/proposal_ie.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/ngraph_ops/proposal_ie.cpp rename to src/common/legacy/src/ngraph_ops/proposal_ie.cpp diff --git a/inference-engine/src/legacy_api/src/ngraph_ops/relu_ie.cpp b/src/common/legacy/src/ngraph_ops/relu_ie.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/ngraph_ops/relu_ie.cpp rename to src/common/legacy/src/ngraph_ops/relu_ie.cpp diff --git a/inference-engine/src/legacy_api/src/ngraph_ops/rnn_cell_ie.cpp b/src/common/legacy/src/ngraph_ops/rnn_cell_ie.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/ngraph_ops/rnn_cell_ie.cpp rename to src/common/legacy/src/ngraph_ops/rnn_cell_ie.cpp diff --git a/inference-engine/src/legacy_api/src/ngraph_ops/rnn_sequence_ie.cpp b/src/common/legacy/src/ngraph_ops/rnn_sequence_ie.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/ngraph_ops/rnn_sequence_ie.cpp rename to src/common/legacy/src/ngraph_ops/rnn_sequence_ie.cpp diff --git a/inference-engine/src/legacy_api/src/ngraph_ops/scaleshift.cpp b/src/common/legacy/src/ngraph_ops/scaleshift.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/ngraph_ops/scaleshift.cpp rename to src/common/legacy/src/ngraph_ops/scaleshift.cpp diff --git a/inference-engine/src/legacy_api/src/ngraph_ops/selu_ie.cpp b/src/common/legacy/src/ngraph_ops/selu_ie.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/ngraph_ops/selu_ie.cpp rename to src/common/legacy/src/ngraph_ops/selu_ie.cpp diff --git a/inference-engine/src/legacy_api/src/ngraph_ops/swish_ie.cpp b/src/common/legacy/src/ngraph_ops/swish_ie.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/ngraph_ops/swish_ie.cpp rename to src/common/legacy/src/ngraph_ops/swish_ie.cpp diff --git a/inference-engine/src/legacy_api/src/ngraph_ops/tile_ie.cpp b/src/common/legacy/src/ngraph_ops/tile_ie.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/ngraph_ops/tile_ie.cpp rename to src/common/legacy/src/ngraph_ops/tile_ie.cpp diff --git a/inference-engine/src/legacy_api/src/ngraph_ops/topk_ie.cpp b/src/common/legacy/src/ngraph_ops/topk_ie.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/ngraph_ops/topk_ie.cpp rename to src/common/legacy/src/ngraph_ops/topk_ie.cpp diff --git a/inference-engine/src/legacy_api/src/precomp.hpp b/src/common/legacy/src/precomp.hpp similarity index 100% rename from inference-engine/src/legacy_api/src/precomp.hpp rename to src/common/legacy/src/precomp.hpp diff --git a/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_cells_to_cells_ie.cpp b/src/common/legacy/src/transformations/convert_opset1_to_legacy/convert_cells_to_cells_ie.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_cells_to_cells_ie.cpp rename to src/common/legacy/src/transformations/convert_opset1_to_legacy/convert_cells_to_cells_ie.cpp diff --git a/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_gather_to_gather_ie.cpp b/src/common/legacy/src/transformations/convert_opset1_to_legacy/convert_gather_to_gather_ie.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_gather_to_gather_ie.cpp rename to src/common/legacy/src/transformations/convert_opset1_to_legacy/convert_gather_to_gather_ie.cpp diff --git a/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_gathertree_to_gathertree_ie.cpp b/src/common/legacy/src/transformations/convert_opset1_to_legacy/convert_gathertree_to_gathertree_ie.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_gathertree_to_gathertree_ie.cpp rename to src/common/legacy/src/transformations/convert_opset1_to_legacy/convert_gathertree_to_gathertree_ie.cpp diff --git a/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_hard_sigmoid_to_hard_sigmoid_ie.cpp b/src/common/legacy/src/transformations/convert_opset1_to_legacy/convert_hard_sigmoid_to_hard_sigmoid_ie.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_hard_sigmoid_to_hard_sigmoid_ie.cpp rename to src/common/legacy/src/transformations/convert_opset1_to_legacy/convert_hard_sigmoid_to_hard_sigmoid_ie.cpp diff --git a/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_interpolate_to_interp_or_resample.cpp b/src/common/legacy/src/transformations/convert_opset1_to_legacy/convert_interpolate_to_interp_or_resample.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_interpolate_to_interp_or_resample.cpp rename to src/common/legacy/src/transformations/convert_opset1_to_legacy/convert_interpolate_to_interp_or_resample.cpp diff --git a/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_lrn_to_lrn_ie.cpp b/src/common/legacy/src/transformations/convert_opset1_to_legacy/convert_lrn_to_lrn_ie.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_lrn_to_lrn_ie.cpp rename to src/common/legacy/src/transformations/convert_opset1_to_legacy/convert_lrn_to_lrn_ie.cpp diff --git a/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_matmul_to_fc_or_gemm.cpp b/src/common/legacy/src/transformations/convert_opset1_to_legacy/convert_matmul_to_fc_or_gemm.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_matmul_to_fc_or_gemm.cpp rename to src/common/legacy/src/transformations/convert_opset1_to_legacy/convert_matmul_to_fc_or_gemm.cpp diff --git a/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_mul_add_to_scaleshift_or_power.cpp b/src/common/legacy/src/transformations/convert_opset1_to_legacy/convert_mul_add_to_scaleshift_or_power.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_mul_add_to_scaleshift_or_power.cpp rename to src/common/legacy/src/transformations/convert_opset1_to_legacy/convert_mul_add_to_scaleshift_or_power.cpp diff --git a/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_mul_or_add_finally.cpp b/src/common/legacy/src/transformations/convert_opset1_to_legacy/convert_mul_or_add_finally.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_mul_or_add_finally.cpp rename to src/common/legacy/src/transformations/convert_opset1_to_legacy/convert_mul_or_add_finally.cpp diff --git a/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_nms_5_to_legacy.cpp b/src/common/legacy/src/transformations/convert_opset1_to_legacy/convert_nms_5_to_legacy.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_nms_5_to_legacy.cpp rename to src/common/legacy/src/transformations/convert_opset1_to_legacy/convert_nms_5_to_legacy.cpp diff --git a/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_nms_to_nms_ie.cpp b/src/common/legacy/src/transformations/convert_opset1_to_legacy/convert_nms_to_nms_ie.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_nms_to_nms_ie.cpp rename to src/common/legacy/src/transformations/convert_opset1_to_legacy/convert_nms_to_nms_ie.cpp diff --git a/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_normalizel2_to_normalize_ie.cpp b/src/common/legacy/src/transformations/convert_opset1_to_legacy/convert_normalizel2_to_normalize_ie.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_normalizel2_to_normalize_ie.cpp rename to src/common/legacy/src/transformations/convert_opset1_to_legacy/convert_normalizel2_to_normalize_ie.cpp diff --git a/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_one_hot_to_one_hot_ie.cpp b/src/common/legacy/src/transformations/convert_opset1_to_legacy/convert_one_hot_to_one_hot_ie.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_one_hot_to_one_hot_ie.cpp rename to src/common/legacy/src/transformations/convert_opset1_to_legacy/convert_one_hot_to_one_hot_ie.cpp diff --git a/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_opset1_to_legacy.cpp b/src/common/legacy/src/transformations/convert_opset1_to_legacy/convert_opset1_to_legacy.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_opset1_to_legacy.cpp rename to src/common/legacy/src/transformations/convert_opset1_to_legacy/convert_opset1_to_legacy.cpp diff --git a/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_pad_to_pad_ie.cpp b/src/common/legacy/src/transformations/convert_opset1_to_legacy/convert_pad_to_pad_ie.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_pad_to_pad_ie.cpp rename to src/common/legacy/src/transformations/convert_opset1_to_legacy/convert_pad_to_pad_ie.cpp diff --git a/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_power_to_power_ie.cpp b/src/common/legacy/src/transformations/convert_opset1_to_legacy/convert_power_to_power_ie.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_power_to_power_ie.cpp rename to src/common/legacy/src/transformations/convert_opset1_to_legacy/convert_power_to_power_ie.cpp diff --git a/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_prelu_to_relu_ie.cpp b/src/common/legacy/src/transformations/convert_opset1_to_legacy/convert_prelu_to_relu_ie.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_prelu_to_relu_ie.cpp rename to src/common/legacy/src/transformations/convert_opset1_to_legacy/convert_prelu_to_relu_ie.cpp diff --git a/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_proposal_to_proposal_ie.cpp b/src/common/legacy/src/transformations/convert_opset1_to_legacy/convert_proposal_to_proposal_ie.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_proposal_to_proposal_ie.cpp rename to src/common/legacy/src/transformations/convert_opset1_to_legacy/convert_proposal_to_proposal_ie.cpp diff --git a/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_selu_to_selu_ie.cpp b/src/common/legacy/src/transformations/convert_opset1_to_legacy/convert_selu_to_selu_ie.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_selu_to_selu_ie.cpp rename to src/common/legacy/src/transformations/convert_opset1_to_legacy/convert_selu_to_selu_ie.cpp diff --git a/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_sequences_to_sequences_ie.cpp b/src/common/legacy/src/transformations/convert_opset1_to_legacy/convert_sequences_to_sequences_ie.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_sequences_to_sequences_ie.cpp rename to src/common/legacy/src/transformations/convert_opset1_to_legacy/convert_sequences_to_sequences_ie.cpp diff --git a/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_sqrt_to_power_ie.cpp b/src/common/legacy/src/transformations/convert_opset1_to_legacy/convert_sqrt_to_power_ie.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_sqrt_to_power_ie.cpp rename to src/common/legacy/src/transformations/convert_opset1_to_legacy/convert_sqrt_to_power_ie.cpp diff --git a/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_strided_slice_to_crop.cpp b/src/common/legacy/src/transformations/convert_opset1_to_legacy/convert_strided_slice_to_crop.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_strided_slice_to_crop.cpp rename to src/common/legacy/src/transformations/convert_opset1_to_legacy/convert_strided_slice_to_crop.cpp diff --git a/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_swish_to_swish_ie.cpp b/src/common/legacy/src/transformations/convert_opset1_to_legacy/convert_swish_to_swish_ie.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_swish_to_swish_ie.cpp rename to src/common/legacy/src/transformations/convert_opset1_to_legacy/convert_swish_to_swish_ie.cpp diff --git a/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_tile_to_ie_tile.cpp b/src/common/legacy/src/transformations/convert_opset1_to_legacy/convert_tile_to_ie_tile.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_tile_to_ie_tile.cpp rename to src/common/legacy/src/transformations/convert_opset1_to_legacy/convert_tile_to_ie_tile.cpp diff --git a/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_topk_to_topk_ie.cpp b/src/common/legacy/src/transformations/convert_opset1_to_legacy/convert_topk_to_topk_ie.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_topk_to_topk_ie.cpp rename to src/common/legacy/src/transformations/convert_opset1_to_legacy/convert_topk_to_topk_ie.cpp diff --git a/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/fc_bias_fusion.cpp b/src/common/legacy/src/transformations/convert_opset1_to_legacy/fc_bias_fusion.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/fc_bias_fusion.cpp rename to src/common/legacy/src/transformations/convert_opset1_to_legacy/fc_bias_fusion.cpp diff --git a/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/reshape_1d_ops.cpp b/src/common/legacy/src/transformations/convert_opset1_to_legacy/reshape_1d_ops.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/reshape_1d_ops.cpp rename to src/common/legacy/src/transformations/convert_opset1_to_legacy/reshape_1d_ops.cpp diff --git a/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/reshape_fc_fusion.cpp b/src/common/legacy/src/transformations/convert_opset1_to_legacy/reshape_fc_fusion.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/reshape_fc_fusion.cpp rename to src/common/legacy/src/transformations/convert_opset1_to_legacy/reshape_fc_fusion.cpp diff --git a/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/reshape_fully_connected.cpp b/src/common/legacy/src/transformations/convert_opset1_to_legacy/reshape_fully_connected.cpp similarity index 100% rename from inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/reshape_fully_connected.cpp rename to src/common/legacy/src/transformations/convert_opset1_to_legacy/reshape_fully_connected.cpp diff --git a/inference-engine/src/low_precision_transformations/CMakeLists.txt b/src/common/low_precision_transformations/CMakeLists.txt similarity index 100% rename from inference-engine/src/low_precision_transformations/CMakeLists.txt rename to src/common/low_precision_transformations/CMakeLists.txt diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/add.hpp b/src/common/low_precision_transformations/include/low_precision/add.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/add.hpp rename to src/common/low_precision_transformations/include/low_precision/add.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/align_quantization_intervals.hpp b/src/common/low_precision_transformations/include/low_precision/align_quantization_intervals.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/align_quantization_intervals.hpp rename to src/common/low_precision_transformations/include/low_precision/align_quantization_intervals.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/align_quantization_parameters.hpp b/src/common/low_precision_transformations/include/low_precision/align_quantization_parameters.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/align_quantization_parameters.hpp rename to src/common/low_precision_transformations/include/low_precision/align_quantization_parameters.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/avg_pool.hpp b/src/common/low_precision_transformations/include/low_precision/avg_pool.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/avg_pool.hpp rename to src/common/low_precision_transformations/include/low_precision/avg_pool.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/base_matcher_pass.hpp b/src/common/low_precision_transformations/include/low_precision/base_matcher_pass.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/base_matcher_pass.hpp rename to src/common/low_precision_transformations/include/low_precision/base_matcher_pass.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/clamp.hpp b/src/common/low_precision_transformations/include/low_precision/clamp.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/clamp.hpp rename to src/common/low_precision_transformations/include/low_precision/clamp.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/common/fake_quantize_dequantization.hpp b/src/common/low_precision_transformations/include/low_precision/common/fake_quantize_dequantization.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/common/fake_quantize_dequantization.hpp rename to src/common/low_precision_transformations/include/low_precision/common/fake_quantize_dequantization.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/common/ie_lpt_exception.hpp b/src/common/low_precision_transformations/include/low_precision/common/ie_lpt_exception.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/common/ie_lpt_exception.hpp rename to src/common/low_precision_transformations/include/low_precision/common/ie_lpt_exception.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/common/operation_per_tensor_quantization_restriction.hpp b/src/common/low_precision_transformations/include/low_precision/common/operation_per_tensor_quantization_restriction.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/common/operation_per_tensor_quantization_restriction.hpp rename to src/common/low_precision_transformations/include/low_precision/common/operation_per_tensor_quantization_restriction.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/common/operation_precision_restriction.hpp b/src/common/low_precision_transformations/include/low_precision/common/operation_precision_restriction.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/common/operation_precision_restriction.hpp rename to src/common/low_precision_transformations/include/low_precision/common/operation_precision_restriction.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/concat.hpp b/src/common/low_precision_transformations/include/low_precision/concat.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/concat.hpp rename to src/common/low_precision_transformations/include/low_precision/concat.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/convert.hpp b/src/common/low_precision_transformations/include/low_precision/convert.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/convert.hpp rename to src/common/low_precision_transformations/include/low_precision/convert.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/convert_subtract_constant.hpp b/src/common/low_precision_transformations/include/low_precision/convert_subtract_constant.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/convert_subtract_constant.hpp rename to src/common/low_precision_transformations/include/low_precision/convert_subtract_constant.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/convolution.hpp b/src/common/low_precision_transformations/include/low_precision/convolution.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/convolution.hpp rename to src/common/low_precision_transformations/include/low_precision/convolution.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/convolution_backprop_data.hpp b/src/common/low_precision_transformations/include/low_precision/convolution_backprop_data.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/convolution_backprop_data.hpp rename to src/common/low_precision_transformations/include/low_precision/convolution_backprop_data.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/create_attribute.hpp b/src/common/low_precision_transformations/include/low_precision/create_attribute.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/create_attribute.hpp rename to src/common/low_precision_transformations/include/low_precision/create_attribute.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/create_precisions_dependent_attribute.hpp b/src/common/low_precision_transformations/include/low_precision/create_precisions_dependent_attribute.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/create_precisions_dependent_attribute.hpp rename to src/common/low_precision_transformations/include/low_precision/create_precisions_dependent_attribute.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/depth_to_space.hpp b/src/common/low_precision_transformations/include/low_precision/depth_to_space.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/depth_to_space.hpp rename to src/common/low_precision_transformations/include/low_precision/depth_to_space.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/eltwise_base_transformation.hpp b/src/common/low_precision_transformations/include/low_precision/eltwise_base_transformation.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/eltwise_base_transformation.hpp rename to src/common/low_precision_transformations/include/low_precision/eltwise_base_transformation.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/fake_quantize.hpp b/src/common/low_precision_transformations/include/low_precision/fake_quantize.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/fake_quantize.hpp rename to src/common/low_precision_transformations/include/low_precision/fake_quantize.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/fake_quantize_decomposition.hpp b/src/common/low_precision_transformations/include/low_precision/fake_quantize_decomposition.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/fake_quantize_decomposition.hpp rename to src/common/low_precision_transformations/include/low_precision/fake_quantize_decomposition.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/fold_convert.hpp b/src/common/low_precision_transformations/include/low_precision/fold_convert.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/fold_convert.hpp rename to src/common/low_precision_transformations/include/low_precision/fold_convert.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/fold_fake_quantize.hpp b/src/common/low_precision_transformations/include/low_precision/fold_fake_quantize.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/fold_fake_quantize.hpp rename to src/common/low_precision_transformations/include/low_precision/fold_fake_quantize.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/fuse_convert.hpp b/src/common/low_precision_transformations/include/low_precision/fuse_convert.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/fuse_convert.hpp rename to src/common/low_precision_transformations/include/low_precision/fuse_convert.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/fuse_fake_quantize.hpp b/src/common/low_precision_transformations/include/low_precision/fuse_fake_quantize.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/fuse_fake_quantize.hpp rename to src/common/low_precision_transformations/include/low_precision/fuse_fake_quantize.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/fuse_multiply_to_fake_quantize.hpp b/src/common/low_precision_transformations/include/low_precision/fuse_multiply_to_fake_quantize.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/fuse_multiply_to_fake_quantize.hpp rename to src/common/low_precision_transformations/include/low_precision/fuse_multiply_to_fake_quantize.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/fuse_subtract_to_fake_quantize.hpp b/src/common/low_precision_transformations/include/low_precision/fuse_subtract_to_fake_quantize.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/fuse_subtract_to_fake_quantize.hpp rename to src/common/low_precision_transformations/include/low_precision/fuse_subtract_to_fake_quantize.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/group_convolution.hpp b/src/common/low_precision_transformations/include/low_precision/group_convolution.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/group_convolution.hpp rename to src/common/low_precision_transformations/include/low_precision/group_convolution.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/interpolate.hpp b/src/common/low_precision_transformations/include/low_precision/interpolate.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/interpolate.hpp rename to src/common/low_precision_transformations/include/low_precision/interpolate.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/layer_transformation.hpp b/src/common/low_precision_transformations/include/low_precision/layer_transformation.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/layer_transformation.hpp rename to src/common/low_precision_transformations/include/low_precision/layer_transformation.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/low_precision.hpp b/src/common/low_precision_transformations/include/low_precision/low_precision.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/low_precision.hpp rename to src/common/low_precision_transformations/include/low_precision/low_precision.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/lpt_itt.hpp b/src/common/low_precision_transformations/include/low_precision/lpt_itt.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/lpt_itt.hpp rename to src/common/low_precision_transformations/include/low_precision/lpt_itt.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/lpt_visibility.hpp b/src/common/low_precision_transformations/include/low_precision/lpt_visibility.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/lpt_visibility.hpp rename to src/common/low_precision_transformations/include/low_precision/lpt_visibility.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/markup_avg_pool_precision_preserved.hpp b/src/common/low_precision_transformations/include/low_precision/markup_avg_pool_precision_preserved.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/markup_avg_pool_precision_preserved.hpp rename to src/common/low_precision_transformations/include/low_precision/markup_avg_pool_precision_preserved.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/markup_can_be_quantized.hpp b/src/common/low_precision_transformations/include/low_precision/markup_can_be_quantized.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/markup_can_be_quantized.hpp rename to src/common/low_precision_transformations/include/low_precision/markup_can_be_quantized.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/markup_per_tensor_quantization.hpp b/src/common/low_precision_transformations/include/low_precision/markup_per_tensor_quantization.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/markup_per_tensor_quantization.hpp rename to src/common/low_precision_transformations/include/low_precision/markup_per_tensor_quantization.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/markup_precisions.hpp b/src/common/low_precision_transformations/include/low_precision/markup_precisions.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/markup_precisions.hpp rename to src/common/low_precision_transformations/include/low_precision/markup_precisions.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/mat_mul.hpp b/src/common/low_precision_transformations/include/low_precision/mat_mul.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/mat_mul.hpp rename to src/common/low_precision_transformations/include/low_precision/mat_mul.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/max_pool.hpp b/src/common/low_precision_transformations/include/low_precision/max_pool.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/max_pool.hpp rename to src/common/low_precision_transformations/include/low_precision/max_pool.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/move_fake_quantize.hpp b/src/common/low_precision_transformations/include/low_precision/move_fake_quantize.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/move_fake_quantize.hpp rename to src/common/low_precision_transformations/include/low_precision/move_fake_quantize.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/multiply.hpp b/src/common/low_precision_transformations/include/low_precision/multiply.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/multiply.hpp rename to src/common/low_precision_transformations/include/low_precision/multiply.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/multiply_to_group_convolution.hpp b/src/common/low_precision_transformations/include/low_precision/multiply_to_group_convolution.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/multiply_to_group_convolution.hpp rename to src/common/low_precision_transformations/include/low_precision/multiply_to_group_convolution.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/mvn.hpp b/src/common/low_precision_transformations/include/low_precision/mvn.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/mvn.hpp rename to src/common/low_precision_transformations/include/low_precision/mvn.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/network_helper.hpp b/src/common/low_precision_transformations/include/low_precision/network_helper.hpp similarity index 99% rename from inference-engine/src/low_precision_transformations/include/low_precision/network_helper.hpp rename to src/common/low_precision_transformations/include/low_precision/network_helper.hpp index cb0f56e51fc..9da92e72631 100644 --- a/inference-engine/src/low_precision_transformations/include/low_precision/network_helper.hpp +++ b/src/common/low_precision_transformations/include/low_precision/network_helper.hpp @@ -246,7 +246,7 @@ public: auto it = rt.find(name); if (it != rt.end()) { const auto currentAttribute = it->second; - if (oldAttribute.get() == currentAttribute.get()) { + if (oldAttribute == as_type_ptr(currentAttribute)) { rt[name] = newAttribute; } handleConnectedNodes = true; diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/normalize_l2.hpp b/src/common/low_precision_transformations/include/low_precision/normalize_l2.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/normalize_l2.hpp rename to src/common/low_precision_transformations/include/low_precision/normalize_l2.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/pad.hpp b/src/common/low_precision_transformations/include/low_precision/pad.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/pad.hpp rename to src/common/low_precision_transformations/include/low_precision/pad.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/prelu.hpp b/src/common/low_precision_transformations/include/low_precision/prelu.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/prelu.hpp rename to src/common/low_precision_transformations/include/low_precision/prelu.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/propagate_precisions.hpp b/src/common/low_precision_transformations/include/low_precision/propagate_precisions.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/propagate_precisions.hpp rename to src/common/low_precision_transformations/include/low_precision/propagate_precisions.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/propagate_shared_value.hpp b/src/common/low_precision_transformations/include/low_precision/propagate_shared_value.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/propagate_shared_value.hpp rename to src/common/low_precision_transformations/include/low_precision/propagate_shared_value.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/propagate_through_precision_preserved.hpp b/src/common/low_precision_transformations/include/low_precision/propagate_through_precision_preserved.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/propagate_through_precision_preserved.hpp rename to src/common/low_precision_transformations/include/low_precision/propagate_through_precision_preserved.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/propagate_to_input.hpp b/src/common/low_precision_transformations/include/low_precision/propagate_to_input.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/propagate_to_input.hpp rename to src/common/low_precision_transformations/include/low_precision/propagate_to_input.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/pull_reshape_through_dequantization.hpp b/src/common/low_precision_transformations/include/low_precision/pull_reshape_through_dequantization.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/pull_reshape_through_dequantization.hpp rename to src/common/low_precision_transformations/include/low_precision/pull_reshape_through_dequantization.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/pull_transpose_through_dequantization.hpp b/src/common/low_precision_transformations/include/low_precision/pull_transpose_through_dequantization.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/pull_transpose_through_dequantization.hpp rename to src/common/low_precision_transformations/include/low_precision/pull_transpose_through_dequantization.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/quantization_details.hpp b/src/common/low_precision_transformations/include/low_precision/quantization_details.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/quantization_details.hpp rename to src/common/low_precision_transformations/include/low_precision/quantization_details.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/reduce_base_transformation.hpp b/src/common/low_precision_transformations/include/low_precision/reduce_base_transformation.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/reduce_base_transformation.hpp rename to src/common/low_precision_transformations/include/low_precision/reduce_base_transformation.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/reduce_max.hpp b/src/common/low_precision_transformations/include/low_precision/reduce_max.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/reduce_max.hpp rename to src/common/low_precision_transformations/include/low_precision/reduce_max.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/reduce_mean.hpp b/src/common/low_precision_transformations/include/low_precision/reduce_mean.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/reduce_mean.hpp rename to src/common/low_precision_transformations/include/low_precision/reduce_mean.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/reduce_min.hpp b/src/common/low_precision_transformations/include/low_precision/reduce_min.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/reduce_min.hpp rename to src/common/low_precision_transformations/include/low_precision/reduce_min.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/reduce_sum.hpp b/src/common/low_precision_transformations/include/low_precision/reduce_sum.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/reduce_sum.hpp rename to src/common/low_precision_transformations/include/low_precision/reduce_sum.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/relu.hpp b/src/common/low_precision_transformations/include/low_precision/relu.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/relu.hpp rename to src/common/low_precision_transformations/include/low_precision/relu.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/reshape.hpp b/src/common/low_precision_transformations/include/low_precision/reshape.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/reshape.hpp rename to src/common/low_precision_transformations/include/low_precision/reshape.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/rt_info/attribute_parameters.hpp b/src/common/low_precision_transformations/include/low_precision/rt_info/attribute_parameters.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/rt_info/attribute_parameters.hpp rename to src/common/low_precision_transformations/include/low_precision/rt_info/attribute_parameters.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/rt_info/avg_pool_precision_preserved_attribute.hpp b/src/common/low_precision_transformations/include/low_precision/rt_info/avg_pool_precision_preserved_attribute.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/rt_info/avg_pool_precision_preserved_attribute.hpp rename to src/common/low_precision_transformations/include/low_precision/rt_info/avg_pool_precision_preserved_attribute.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/rt_info/intervals_alignment_attribute.hpp b/src/common/low_precision_transformations/include/low_precision/rt_info/intervals_alignment_attribute.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/rt_info/intervals_alignment_attribute.hpp rename to src/common/low_precision_transformations/include/low_precision/rt_info/intervals_alignment_attribute.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/rt_info/per_tensor_quantization_attribute.hpp b/src/common/low_precision_transformations/include/low_precision/rt_info/per_tensor_quantization_attribute.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/rt_info/per_tensor_quantization_attribute.hpp rename to src/common/low_precision_transformations/include/low_precision/rt_info/per_tensor_quantization_attribute.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/rt_info/precision_preserved_attribute.hpp b/src/common/low_precision_transformations/include/low_precision/rt_info/precision_preserved_attribute.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/rt_info/precision_preserved_attribute.hpp rename to src/common/low_precision_transformations/include/low_precision/rt_info/precision_preserved_attribute.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/rt_info/precisions_attribute.hpp b/src/common/low_precision_transformations/include/low_precision/rt_info/precisions_attribute.hpp similarity index 96% rename from inference-engine/src/low_precision_transformations/include/low_precision/rt_info/precisions_attribute.hpp rename to src/common/low_precision_transformations/include/low_precision/rt_info/precisions_attribute.hpp index 65d0a50ea25..b7057464c4f 100644 --- a/inference-engine/src/low_precision_transformations/include/low_precision/rt_info/precisions_attribute.hpp +++ b/src/common/low_precision_transformations/include/low_precision/rt_info/precisions_attribute.hpp @@ -51,7 +51,7 @@ public: VariantWrapper(const value_type& value) : VariantImpl(value) {} - std::shared_ptr init(const std::shared_ptr& node) override; + ov::Any init(const std::shared_ptr& node) override; std::shared_ptr get() { return this->m_value; } diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/rt_info/quantization_alignment_attribute.hpp b/src/common/low_precision_transformations/include/low_precision/rt_info/quantization_alignment_attribute.hpp similarity index 95% rename from inference-engine/src/low_precision_transformations/include/low_precision/rt_info/quantization_alignment_attribute.hpp rename to src/common/low_precision_transformations/include/low_precision/rt_info/quantization_alignment_attribute.hpp index 28503344f23..57f43d06cfe 100644 --- a/inference-engine/src/low_precision_transformations/include/low_precision/rt_info/quantization_alignment_attribute.hpp +++ b/src/common/low_precision_transformations/include/low_precision/rt_info/quantization_alignment_attribute.hpp @@ -50,7 +50,7 @@ public: VariantWrapper(const value_type& value) : VariantImpl(value) {} - std::shared_ptr init(const std::shared_ptr& node) override; + ov::Any init(const std::shared_ptr& node) override; std::shared_ptr get() { return this->m_value; } diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/rt_info/shared_value_attribute.hpp b/src/common/low_precision_transformations/include/low_precision/rt_info/shared_value_attribute.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/rt_info/shared_value_attribute.hpp rename to src/common/low_precision_transformations/include/low_precision/rt_info/shared_value_attribute.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/shuffle_channels.hpp b/src/common/low_precision_transformations/include/low_precision/shuffle_channels.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/shuffle_channels.hpp rename to src/common/low_precision_transformations/include/low_precision/shuffle_channels.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/split.hpp b/src/common/low_precision_transformations/include/low_precision/split.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/split.hpp rename to src/common/low_precision_transformations/include/low_precision/split.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/squeeze.hpp b/src/common/low_precision_transformations/include/low_precision/squeeze.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/squeeze.hpp rename to src/common/low_precision_transformations/include/low_precision/squeeze.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/strided_slice.hpp b/src/common/low_precision_transformations/include/low_precision/strided_slice.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/strided_slice.hpp rename to src/common/low_precision_transformations/include/low_precision/strided_slice.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/subtract.hpp b/src/common/low_precision_transformations/include/low_precision/subtract.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/subtract.hpp rename to src/common/low_precision_transformations/include/low_precision/subtract.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/transformation_context.hpp b/src/common/low_precision_transformations/include/low_precision/transformation_context.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/transformation_context.hpp rename to src/common/low_precision_transformations/include/low_precision/transformation_context.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/transparent_base_transformation.hpp b/src/common/low_precision_transformations/include/low_precision/transparent_base_transformation.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/transparent_base_transformation.hpp rename to src/common/low_precision_transformations/include/low_precision/transparent_base_transformation.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/transpose.hpp b/src/common/low_precision_transformations/include/low_precision/transpose.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/transpose.hpp rename to src/common/low_precision_transformations/include/low_precision/transpose.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/unsqueeze.hpp b/src/common/low_precision_transformations/include/low_precision/unsqueeze.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/unsqueeze.hpp rename to src/common/low_precision_transformations/include/low_precision/unsqueeze.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/update_shared_precision_preserved.hpp b/src/common/low_precision_transformations/include/low_precision/update_shared_precision_preserved.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/update_shared_precision_preserved.hpp rename to src/common/low_precision_transformations/include/low_precision/update_shared_precision_preserved.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/variadic_split.hpp b/src/common/low_precision_transformations/include/low_precision/variadic_split.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/variadic_split.hpp rename to src/common/low_precision_transformations/include/low_precision/variadic_split.hpp diff --git a/inference-engine/src/low_precision_transformations/include/low_precision/weightable_layer_transformation.hpp b/src/common/low_precision_transformations/include/low_precision/weightable_layer_transformation.hpp similarity index 100% rename from inference-engine/src/low_precision_transformations/include/low_precision/weightable_layer_transformation.hpp rename to src/common/low_precision_transformations/include/low_precision/weightable_layer_transformation.hpp diff --git a/inference-engine/src/low_precision_transformations/src/add.cpp b/src/common/low_precision_transformations/src/add.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/add.cpp rename to src/common/low_precision_transformations/src/add.cpp diff --git a/inference-engine/src/low_precision_transformations/src/align_quantization_intervals.cpp b/src/common/low_precision_transformations/src/align_quantization_intervals.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/align_quantization_intervals.cpp rename to src/common/low_precision_transformations/src/align_quantization_intervals.cpp diff --git a/inference-engine/src/low_precision_transformations/src/align_quantization_parameters.cpp b/src/common/low_precision_transformations/src/align_quantization_parameters.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/align_quantization_parameters.cpp rename to src/common/low_precision_transformations/src/align_quantization_parameters.cpp diff --git a/inference-engine/src/low_precision_transformations/src/avg_pool.cpp b/src/common/low_precision_transformations/src/avg_pool.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/avg_pool.cpp rename to src/common/low_precision_transformations/src/avg_pool.cpp diff --git a/inference-engine/src/low_precision_transformations/src/base_matcher_pass.cpp b/src/common/low_precision_transformations/src/base_matcher_pass.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/base_matcher_pass.cpp rename to src/common/low_precision_transformations/src/base_matcher_pass.cpp diff --git a/inference-engine/src/low_precision_transformations/src/clamp.cpp b/src/common/low_precision_transformations/src/clamp.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/clamp.cpp rename to src/common/low_precision_transformations/src/clamp.cpp diff --git a/inference-engine/src/low_precision_transformations/src/concat.cpp b/src/common/low_precision_transformations/src/concat.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/concat.cpp rename to src/common/low_precision_transformations/src/concat.cpp diff --git a/inference-engine/src/low_precision_transformations/src/convert.cpp b/src/common/low_precision_transformations/src/convert.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/convert.cpp rename to src/common/low_precision_transformations/src/convert.cpp diff --git a/inference-engine/src/low_precision_transformations/src/convert_subtract_constant.cpp b/src/common/low_precision_transformations/src/convert_subtract_constant.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/convert_subtract_constant.cpp rename to src/common/low_precision_transformations/src/convert_subtract_constant.cpp diff --git a/inference-engine/src/low_precision_transformations/src/convolution.cpp b/src/common/low_precision_transformations/src/convolution.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/convolution.cpp rename to src/common/low_precision_transformations/src/convolution.cpp diff --git a/inference-engine/src/low_precision_transformations/src/convolution_backprop_data.cpp b/src/common/low_precision_transformations/src/convolution_backprop_data.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/convolution_backprop_data.cpp rename to src/common/low_precision_transformations/src/convolution_backprop_data.cpp diff --git a/inference-engine/src/low_precision_transformations/src/depth_to_space.cpp b/src/common/low_precision_transformations/src/depth_to_space.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/depth_to_space.cpp rename to src/common/low_precision_transformations/src/depth_to_space.cpp diff --git a/inference-engine/src/low_precision_transformations/src/eltwise_base_transformation.cpp b/src/common/low_precision_transformations/src/eltwise_base_transformation.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/eltwise_base_transformation.cpp rename to src/common/low_precision_transformations/src/eltwise_base_transformation.cpp diff --git a/inference-engine/src/low_precision_transformations/src/fake_quantize.cpp b/src/common/low_precision_transformations/src/fake_quantize.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/fake_quantize.cpp rename to src/common/low_precision_transformations/src/fake_quantize.cpp diff --git a/inference-engine/src/low_precision_transformations/src/fake_quantize_decomposition.cpp b/src/common/low_precision_transformations/src/fake_quantize_decomposition.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/fake_quantize_decomposition.cpp rename to src/common/low_precision_transformations/src/fake_quantize_decomposition.cpp diff --git a/inference-engine/src/low_precision_transformations/src/fake_quantize_dequantization.cpp b/src/common/low_precision_transformations/src/fake_quantize_dequantization.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/fake_quantize_dequantization.cpp rename to src/common/low_precision_transformations/src/fake_quantize_dequantization.cpp diff --git a/inference-engine/src/low_precision_transformations/src/fold_convert.cpp b/src/common/low_precision_transformations/src/fold_convert.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/fold_convert.cpp rename to src/common/low_precision_transformations/src/fold_convert.cpp diff --git a/inference-engine/src/low_precision_transformations/src/fold_fake_quantize.cpp b/src/common/low_precision_transformations/src/fold_fake_quantize.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/fold_fake_quantize.cpp rename to src/common/low_precision_transformations/src/fold_fake_quantize.cpp diff --git a/inference-engine/src/low_precision_transformations/src/fuse_convert.cpp b/src/common/low_precision_transformations/src/fuse_convert.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/fuse_convert.cpp rename to src/common/low_precision_transformations/src/fuse_convert.cpp diff --git a/inference-engine/src/low_precision_transformations/src/fuse_fake_quantize.cpp b/src/common/low_precision_transformations/src/fuse_fake_quantize.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/fuse_fake_quantize.cpp rename to src/common/low_precision_transformations/src/fuse_fake_quantize.cpp diff --git a/inference-engine/src/low_precision_transformations/src/fuse_multiply_to_fake_quantize.cpp b/src/common/low_precision_transformations/src/fuse_multiply_to_fake_quantize.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/fuse_multiply_to_fake_quantize.cpp rename to src/common/low_precision_transformations/src/fuse_multiply_to_fake_quantize.cpp diff --git a/inference-engine/src/low_precision_transformations/src/fuse_subtract_to_fake_quantize.cpp b/src/common/low_precision_transformations/src/fuse_subtract_to_fake_quantize.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/fuse_subtract_to_fake_quantize.cpp rename to src/common/low_precision_transformations/src/fuse_subtract_to_fake_quantize.cpp diff --git a/inference-engine/src/low_precision_transformations/src/group_convolution.cpp b/src/common/low_precision_transformations/src/group_convolution.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/group_convolution.cpp rename to src/common/low_precision_transformations/src/group_convolution.cpp diff --git a/inference-engine/src/low_precision_transformations/src/interpolate.cpp b/src/common/low_precision_transformations/src/interpolate.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/interpolate.cpp rename to src/common/low_precision_transformations/src/interpolate.cpp diff --git a/inference-engine/src/low_precision_transformations/src/layer_transformation.cpp b/src/common/low_precision_transformations/src/layer_transformation.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/layer_transformation.cpp rename to src/common/low_precision_transformations/src/layer_transformation.cpp diff --git a/inference-engine/src/low_precision_transformations/src/low_precision.cpp b/src/common/low_precision_transformations/src/low_precision.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/low_precision.cpp rename to src/common/low_precision_transformations/src/low_precision.cpp diff --git a/inference-engine/src/low_precision_transformations/src/markup_avg_pool_precision_preserved.cpp b/src/common/low_precision_transformations/src/markup_avg_pool_precision_preserved.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/markup_avg_pool_precision_preserved.cpp rename to src/common/low_precision_transformations/src/markup_avg_pool_precision_preserved.cpp diff --git a/inference-engine/src/low_precision_transformations/src/markup_can_be_quantized.cpp b/src/common/low_precision_transformations/src/markup_can_be_quantized.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/markup_can_be_quantized.cpp rename to src/common/low_precision_transformations/src/markup_can_be_quantized.cpp diff --git a/inference-engine/src/low_precision_transformations/src/markup_per_tensor_quantization.cpp b/src/common/low_precision_transformations/src/markup_per_tensor_quantization.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/markup_per_tensor_quantization.cpp rename to src/common/low_precision_transformations/src/markup_per_tensor_quantization.cpp diff --git a/inference-engine/src/low_precision_transformations/src/markup_precisions.cpp b/src/common/low_precision_transformations/src/markup_precisions.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/markup_precisions.cpp rename to src/common/low_precision_transformations/src/markup_precisions.cpp diff --git a/inference-engine/src/low_precision_transformations/src/mat_mul.cpp b/src/common/low_precision_transformations/src/mat_mul.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/mat_mul.cpp rename to src/common/low_precision_transformations/src/mat_mul.cpp diff --git a/inference-engine/src/low_precision_transformations/src/max_pool.cpp b/src/common/low_precision_transformations/src/max_pool.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/max_pool.cpp rename to src/common/low_precision_transformations/src/max_pool.cpp diff --git a/inference-engine/src/low_precision_transformations/src/move_fake_quantize.cpp b/src/common/low_precision_transformations/src/move_fake_quantize.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/move_fake_quantize.cpp rename to src/common/low_precision_transformations/src/move_fake_quantize.cpp diff --git a/inference-engine/src/low_precision_transformations/src/multiply.cpp b/src/common/low_precision_transformations/src/multiply.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/multiply.cpp rename to src/common/low_precision_transformations/src/multiply.cpp diff --git a/inference-engine/src/low_precision_transformations/src/multiply_to_group_convolution.cpp b/src/common/low_precision_transformations/src/multiply_to_group_convolution.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/multiply_to_group_convolution.cpp rename to src/common/low_precision_transformations/src/multiply_to_group_convolution.cpp diff --git a/inference-engine/src/low_precision_transformations/src/mvn.cpp b/src/common/low_precision_transformations/src/mvn.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/mvn.cpp rename to src/common/low_precision_transformations/src/mvn.cpp diff --git a/inference-engine/src/low_precision_transformations/src/network_helper.cpp b/src/common/low_precision_transformations/src/network_helper.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/network_helper.cpp rename to src/common/low_precision_transformations/src/network_helper.cpp diff --git a/inference-engine/src/low_precision_transformations/src/normalize_l2.cpp b/src/common/low_precision_transformations/src/normalize_l2.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/normalize_l2.cpp rename to src/common/low_precision_transformations/src/normalize_l2.cpp diff --git a/inference-engine/src/low_precision_transformations/src/pad.cpp b/src/common/low_precision_transformations/src/pad.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/pad.cpp rename to src/common/low_precision_transformations/src/pad.cpp diff --git a/inference-engine/src/low_precision_transformations/src/prelu.cpp b/src/common/low_precision_transformations/src/prelu.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/prelu.cpp rename to src/common/low_precision_transformations/src/prelu.cpp diff --git a/inference-engine/src/low_precision_transformations/src/propagate_precisions.cpp b/src/common/low_precision_transformations/src/propagate_precisions.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/propagate_precisions.cpp rename to src/common/low_precision_transformations/src/propagate_precisions.cpp diff --git a/inference-engine/src/low_precision_transformations/src/pull_reshape_through_dequantization.cpp b/src/common/low_precision_transformations/src/pull_reshape_through_dequantization.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/pull_reshape_through_dequantization.cpp rename to src/common/low_precision_transformations/src/pull_reshape_through_dequantization.cpp diff --git a/inference-engine/src/low_precision_transformations/src/pull_transpose_through_dequantization.cpp b/src/common/low_precision_transformations/src/pull_transpose_through_dequantization.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/pull_transpose_through_dequantization.cpp rename to src/common/low_precision_transformations/src/pull_transpose_through_dequantization.cpp diff --git a/inference-engine/src/low_precision_transformations/src/quantization_details.cpp b/src/common/low_precision_transformations/src/quantization_details.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/quantization_details.cpp rename to src/common/low_precision_transformations/src/quantization_details.cpp diff --git a/inference-engine/src/low_precision_transformations/src/reduce_base_transformation.cpp b/src/common/low_precision_transformations/src/reduce_base_transformation.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/reduce_base_transformation.cpp rename to src/common/low_precision_transformations/src/reduce_base_transformation.cpp diff --git a/inference-engine/src/low_precision_transformations/src/reduce_max.cpp b/src/common/low_precision_transformations/src/reduce_max.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/reduce_max.cpp rename to src/common/low_precision_transformations/src/reduce_max.cpp diff --git a/inference-engine/src/low_precision_transformations/src/reduce_mean.cpp b/src/common/low_precision_transformations/src/reduce_mean.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/reduce_mean.cpp rename to src/common/low_precision_transformations/src/reduce_mean.cpp diff --git a/inference-engine/src/low_precision_transformations/src/reduce_min.cpp b/src/common/low_precision_transformations/src/reduce_min.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/reduce_min.cpp rename to src/common/low_precision_transformations/src/reduce_min.cpp diff --git a/inference-engine/src/low_precision_transformations/src/reduce_sum.cpp b/src/common/low_precision_transformations/src/reduce_sum.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/reduce_sum.cpp rename to src/common/low_precision_transformations/src/reduce_sum.cpp diff --git a/inference-engine/src/low_precision_transformations/src/relu.cpp b/src/common/low_precision_transformations/src/relu.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/relu.cpp rename to src/common/low_precision_transformations/src/relu.cpp diff --git a/inference-engine/src/low_precision_transformations/src/reshape.cpp b/src/common/low_precision_transformations/src/reshape.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/reshape.cpp rename to src/common/low_precision_transformations/src/reshape.cpp diff --git a/inference-engine/src/low_precision_transformations/src/rt_info/avg_pool_precision_preserved_attribute.cpp b/src/common/low_precision_transformations/src/rt_info/avg_pool_precision_preserved_attribute.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/rt_info/avg_pool_precision_preserved_attribute.cpp rename to src/common/low_precision_transformations/src/rt_info/avg_pool_precision_preserved_attribute.cpp diff --git a/inference-engine/src/low_precision_transformations/src/rt_info/intervals_alignment_attribute.cpp b/src/common/low_precision_transformations/src/rt_info/intervals_alignment_attribute.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/rt_info/intervals_alignment_attribute.cpp rename to src/common/low_precision_transformations/src/rt_info/intervals_alignment_attribute.cpp diff --git a/inference-engine/src/low_precision_transformations/src/rt_info/per_tensor_quantization_attribute.cpp b/src/common/low_precision_transformations/src/rt_info/per_tensor_quantization_attribute.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/rt_info/per_tensor_quantization_attribute.cpp rename to src/common/low_precision_transformations/src/rt_info/per_tensor_quantization_attribute.cpp diff --git a/inference-engine/src/low_precision_transformations/src/rt_info/precision_preserved_attribute.cpp b/src/common/low_precision_transformations/src/rt_info/precision_preserved_attribute.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/rt_info/precision_preserved_attribute.cpp rename to src/common/low_precision_transformations/src/rt_info/precision_preserved_attribute.cpp diff --git a/inference-engine/src/low_precision_transformations/src/rt_info/precisions_attribute.cpp b/src/common/low_precision_transformations/src/rt_info/precisions_attribute.cpp similarity index 94% rename from inference-engine/src/low_precision_transformations/src/rt_info/precisions_attribute.cpp rename to src/common/low_precision_transformations/src/rt_info/precisions_attribute.cpp index 2cc92e68e21..f7158632319 100644 --- a/inference-engine/src/low_precision_transformations/src/rt_info/precisions_attribute.cpp +++ b/src/common/low_precision_transformations/src/rt_info/precisions_attribute.cpp @@ -57,8 +57,8 @@ void VariantWrapper>::merge( } } -std::shared_ptr VariantWrapper>::init(const std::shared_ptr& node) { - return nullptr; +ov::Any VariantWrapper>::init(const std::shared_ptr& node) { + return {}; } std::string VariantWrapper>::to_string() { diff --git a/inference-engine/src/low_precision_transformations/src/rt_info/quantization_alignment_attribute.cpp b/src/common/low_precision_transformations/src/rt_info/quantization_alignment_attribute.cpp similarity index 96% rename from inference-engine/src/low_precision_transformations/src/rt_info/quantization_alignment_attribute.cpp rename to src/common/low_precision_transformations/src/rt_info/quantization_alignment_attribute.cpp index 26fd6711c34..f275f836f6d 100644 --- a/inference-engine/src/low_precision_transformations/src/rt_info/quantization_alignment_attribute.cpp +++ b/src/common/low_precision_transformations/src/rt_info/quantization_alignment_attribute.cpp @@ -24,7 +24,7 @@ template class ngraph::VariantImpl; constexpr VariantTypeInfo VariantWrapper::type_info; -std::shared_ptr VariantWrapper::init(const std::shared_ptr& node) { +ov::Any VariantWrapper::init(const std::shared_ptr& node) { return nullptr; } diff --git a/inference-engine/src/low_precision_transformations/src/shuffle_channels.cpp b/src/common/low_precision_transformations/src/shuffle_channels.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/shuffle_channels.cpp rename to src/common/low_precision_transformations/src/shuffle_channels.cpp diff --git a/inference-engine/src/low_precision_transformations/src/split.cpp b/src/common/low_precision_transformations/src/split.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/split.cpp rename to src/common/low_precision_transformations/src/split.cpp diff --git a/inference-engine/src/low_precision_transformations/src/squeeze.cpp b/src/common/low_precision_transformations/src/squeeze.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/squeeze.cpp rename to src/common/low_precision_transformations/src/squeeze.cpp diff --git a/inference-engine/src/low_precision_transformations/src/strided_slice.cpp b/src/common/low_precision_transformations/src/strided_slice.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/strided_slice.cpp rename to src/common/low_precision_transformations/src/strided_slice.cpp diff --git a/inference-engine/src/low_precision_transformations/src/subtract.cpp b/src/common/low_precision_transformations/src/subtract.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/subtract.cpp rename to src/common/low_precision_transformations/src/subtract.cpp diff --git a/inference-engine/src/low_precision_transformations/src/transformation_context.cpp b/src/common/low_precision_transformations/src/transformation_context.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/transformation_context.cpp rename to src/common/low_precision_transformations/src/transformation_context.cpp diff --git a/inference-engine/src/low_precision_transformations/src/transparent_base_transformation.cpp b/src/common/low_precision_transformations/src/transparent_base_transformation.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/transparent_base_transformation.cpp rename to src/common/low_precision_transformations/src/transparent_base_transformation.cpp diff --git a/inference-engine/src/low_precision_transformations/src/transpose.cpp b/src/common/low_precision_transformations/src/transpose.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/transpose.cpp rename to src/common/low_precision_transformations/src/transpose.cpp diff --git a/inference-engine/src/low_precision_transformations/src/unsqueeze.cpp b/src/common/low_precision_transformations/src/unsqueeze.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/unsqueeze.cpp rename to src/common/low_precision_transformations/src/unsqueeze.cpp diff --git a/inference-engine/src/low_precision_transformations/src/variadic_split.cpp b/src/common/low_precision_transformations/src/variadic_split.cpp similarity index 100% rename from inference-engine/src/low_precision_transformations/src/variadic_split.cpp rename to src/common/low_precision_transformations/src/variadic_split.cpp diff --git a/inference-engine/src/low_precision_transformations/src/weightable_layer_transformation.cpp b/src/common/low_precision_transformations/src/weightable_layer_transformation.cpp similarity index 99% rename from inference-engine/src/low_precision_transformations/src/weightable_layer_transformation.cpp rename to src/common/low_precision_transformations/src/weightable_layer_transformation.cpp index bc5ee3706ba..0a9a2a86690 100644 --- a/inference-engine/src/low_precision_transformations/src/weightable_layer_transformation.cpp +++ b/src/common/low_precision_transformations/src/weightable_layer_transformation.cpp @@ -96,7 +96,7 @@ bool WeightableLayerTransformation::canBeTransformed(const TransformationContext } const auto rankVal = rank.get_length(); - if ((rankVal != 4) && (rankVal != 5)) { + if ((rankVal < 3) || (rankVal > 5)) { return false; } } diff --git a/inference-engine/src/preprocessing/CMakeLists.txt b/src/common/preprocessing/CMakeLists.txt similarity index 100% rename from inference-engine/src/preprocessing/CMakeLists.txt rename to src/common/preprocessing/CMakeLists.txt diff --git a/inference-engine/src/preprocessing/arm_neon/ie_preprocess_gapi_kernels_neon.cpp b/src/common/preprocessing/arm_neon/ie_preprocess_gapi_kernels_neon.cpp similarity index 100% rename from inference-engine/src/preprocessing/arm_neon/ie_preprocess_gapi_kernels_neon.cpp rename to src/common/preprocessing/arm_neon/ie_preprocess_gapi_kernels_neon.cpp diff --git a/inference-engine/src/preprocessing/arm_neon/ie_preprocess_gapi_kernels_neon.hpp b/src/common/preprocessing/arm_neon/ie_preprocess_gapi_kernels_neon.hpp similarity index 100% rename from inference-engine/src/preprocessing/arm_neon/ie_preprocess_gapi_kernels_neon.hpp rename to src/common/preprocessing/arm_neon/ie_preprocess_gapi_kernels_neon.hpp diff --git a/inference-engine/src/preprocessing/cpu_x86_avx2/ie_preprocess_gapi_kernels_avx2.cpp b/src/common/preprocessing/cpu_x86_avx2/ie_preprocess_gapi_kernels_avx2.cpp similarity index 100% rename from inference-engine/src/preprocessing/cpu_x86_avx2/ie_preprocess_gapi_kernels_avx2.cpp rename to src/common/preprocessing/cpu_x86_avx2/ie_preprocess_gapi_kernels_avx2.cpp diff --git a/inference-engine/src/preprocessing/cpu_x86_avx2/ie_preprocess_gapi_kernels_avx2.hpp b/src/common/preprocessing/cpu_x86_avx2/ie_preprocess_gapi_kernels_avx2.hpp similarity index 100% rename from inference-engine/src/preprocessing/cpu_x86_avx2/ie_preprocess_gapi_kernels_avx2.hpp rename to src/common/preprocessing/cpu_x86_avx2/ie_preprocess_gapi_kernels_avx2.hpp diff --git a/inference-engine/src/preprocessing/cpu_x86_avx512/ie_preprocess_gapi_kernels_avx512.cpp b/src/common/preprocessing/cpu_x86_avx512/ie_preprocess_gapi_kernels_avx512.cpp similarity index 100% rename from inference-engine/src/preprocessing/cpu_x86_avx512/ie_preprocess_gapi_kernels_avx512.cpp rename to src/common/preprocessing/cpu_x86_avx512/ie_preprocess_gapi_kernels_avx512.cpp diff --git a/inference-engine/src/preprocessing/cpu_x86_avx512/ie_preprocess_gapi_kernels_avx512.hpp b/src/common/preprocessing/cpu_x86_avx512/ie_preprocess_gapi_kernels_avx512.hpp similarity index 100% rename from inference-engine/src/preprocessing/cpu_x86_avx512/ie_preprocess_gapi_kernels_avx512.hpp rename to src/common/preprocessing/cpu_x86_avx512/ie_preprocess_gapi_kernels_avx512.hpp diff --git a/inference-engine/src/preprocessing/cpu_x86_sse42/ie_preprocess_gapi_kernels_sse42.cpp b/src/common/preprocessing/cpu_x86_sse42/ie_preprocess_gapi_kernels_sse42.cpp similarity index 100% rename from inference-engine/src/preprocessing/cpu_x86_sse42/ie_preprocess_gapi_kernels_sse42.cpp rename to src/common/preprocessing/cpu_x86_sse42/ie_preprocess_gapi_kernels_sse42.cpp diff --git a/inference-engine/src/preprocessing/cpu_x86_sse42/ie_preprocess_gapi_kernels_sse42.hpp b/src/common/preprocessing/cpu_x86_sse42/ie_preprocess_gapi_kernels_sse42.hpp similarity index 100% rename from inference-engine/src/preprocessing/cpu_x86_sse42/ie_preprocess_gapi_kernels_sse42.hpp rename to src/common/preprocessing/cpu_x86_sse42/ie_preprocess_gapi_kernels_sse42.hpp diff --git a/inference-engine/src/preprocessing/ie_preprocess_data.cpp b/src/common/preprocessing/ie_preprocess_data.cpp similarity index 100% rename from inference-engine/src/preprocessing/ie_preprocess_data.cpp rename to src/common/preprocessing/ie_preprocess_data.cpp diff --git a/inference-engine/src/preprocessing/ie_preprocess_data.hpp b/src/common/preprocessing/ie_preprocess_data.hpp similarity index 100% rename from inference-engine/src/preprocessing/ie_preprocess_data.hpp rename to src/common/preprocessing/ie_preprocess_data.hpp diff --git a/inference-engine/src/preprocessing/ie_preprocess_gapi.cpp b/src/common/preprocessing/ie_preprocess_gapi.cpp similarity index 100% rename from inference-engine/src/preprocessing/ie_preprocess_gapi.cpp rename to src/common/preprocessing/ie_preprocess_gapi.cpp diff --git a/inference-engine/src/preprocessing/ie_preprocess_gapi.hpp b/src/common/preprocessing/ie_preprocess_gapi.hpp similarity index 100% rename from inference-engine/src/preprocessing/ie_preprocess_gapi.hpp rename to src/common/preprocessing/ie_preprocess_gapi.hpp diff --git a/inference-engine/src/preprocessing/ie_preprocess_gapi_kernels.cpp b/src/common/preprocessing/ie_preprocess_gapi_kernels.cpp similarity index 100% rename from inference-engine/src/preprocessing/ie_preprocess_gapi_kernels.cpp rename to src/common/preprocessing/ie_preprocess_gapi_kernels.cpp diff --git a/inference-engine/src/preprocessing/ie_preprocess_gapi_kernels.hpp b/src/common/preprocessing/ie_preprocess_gapi_kernels.hpp similarity index 100% rename from inference-engine/src/preprocessing/ie_preprocess_gapi_kernels.hpp rename to src/common/preprocessing/ie_preprocess_gapi_kernels.hpp diff --git a/inference-engine/src/preprocessing/ie_preprocess_gapi_kernels_impl.hpp b/src/common/preprocessing/ie_preprocess_gapi_kernels_impl.hpp similarity index 100% rename from inference-engine/src/preprocessing/ie_preprocess_gapi_kernels_impl.hpp rename to src/common/preprocessing/ie_preprocess_gapi_kernels_impl.hpp diff --git a/inference-engine/src/preprocessing/ie_preprocess_gapi_kernels_simd_impl.hpp b/src/common/preprocessing/ie_preprocess_gapi_kernels_simd_impl.hpp similarity index 100% rename from inference-engine/src/preprocessing/ie_preprocess_gapi_kernels_simd_impl.hpp rename to src/common/preprocessing/ie_preprocess_gapi_kernels_simd_impl.hpp diff --git a/inference-engine/src/preprocessing/ie_preprocess_itt.hpp b/src/common/preprocessing/ie_preprocess_itt.hpp similarity index 100% rename from inference-engine/src/preprocessing/ie_preprocess_itt.hpp rename to src/common/preprocessing/ie_preprocess_itt.hpp diff --git a/inference-engine/src/snippets/CMakeLists.txt b/src/common/snippets/CMakeLists.txt similarity index 100% rename from inference-engine/src/snippets/CMakeLists.txt rename to src/common/snippets/CMakeLists.txt diff --git a/inference-engine/src/snippets/include/snippets/emitter.hpp b/src/common/snippets/include/snippets/emitter.hpp similarity index 100% rename from inference-engine/src/snippets/include/snippets/emitter.hpp rename to src/common/snippets/include/snippets/emitter.hpp diff --git a/inference-engine/src/snippets/include/snippets/generator.hpp b/src/common/snippets/include/snippets/generator.hpp similarity index 100% rename from inference-engine/src/snippets/include/snippets/generator.hpp rename to src/common/snippets/include/snippets/generator.hpp diff --git a/inference-engine/src/snippets/include/snippets/op/blockedload.hpp b/src/common/snippets/include/snippets/op/blockedload.hpp similarity index 100% rename from inference-engine/src/snippets/include/snippets/op/blockedload.hpp rename to src/common/snippets/include/snippets/op/blockedload.hpp diff --git a/inference-engine/src/snippets/include/snippets/op/blockedparameter.hpp b/src/common/snippets/include/snippets/op/blockedparameter.hpp similarity index 100% rename from inference-engine/src/snippets/include/snippets/op/blockedparameter.hpp rename to src/common/snippets/include/snippets/op/blockedparameter.hpp diff --git a/inference-engine/src/snippets/include/snippets/op/broadcastload.hpp b/src/common/snippets/include/snippets/op/broadcastload.hpp similarity index 100% rename from inference-engine/src/snippets/include/snippets/op/broadcastload.hpp rename to src/common/snippets/include/snippets/op/broadcastload.hpp diff --git a/inference-engine/src/snippets/include/snippets/op/broadcastmove.hpp b/src/common/snippets/include/snippets/op/broadcastmove.hpp similarity index 100% rename from inference-engine/src/snippets/include/snippets/op/broadcastmove.hpp rename to src/common/snippets/include/snippets/op/broadcastmove.hpp diff --git a/inference-engine/src/snippets/include/snippets/op/kernel.hpp b/src/common/snippets/include/snippets/op/kernel.hpp similarity index 100% rename from inference-engine/src/snippets/include/snippets/op/kernel.hpp rename to src/common/snippets/include/snippets/op/kernel.hpp diff --git a/inference-engine/src/snippets/include/snippets/op/load.hpp b/src/common/snippets/include/snippets/op/load.hpp similarity index 100% rename from inference-engine/src/snippets/include/snippets/op/load.hpp rename to src/common/snippets/include/snippets/op/load.hpp diff --git a/inference-engine/src/snippets/include/snippets/op/nop.hpp b/src/common/snippets/include/snippets/op/nop.hpp similarity index 100% rename from inference-engine/src/snippets/include/snippets/op/nop.hpp rename to src/common/snippets/include/snippets/op/nop.hpp diff --git a/inference-engine/src/snippets/include/snippets/op/scalar.hpp b/src/common/snippets/include/snippets/op/scalar.hpp similarity index 100% rename from inference-engine/src/snippets/include/snippets/op/scalar.hpp rename to src/common/snippets/include/snippets/op/scalar.hpp diff --git a/inference-engine/src/snippets/include/snippets/op/scalarload.hpp b/src/common/snippets/include/snippets/op/scalarload.hpp similarity index 100% rename from inference-engine/src/snippets/include/snippets/op/scalarload.hpp rename to src/common/snippets/include/snippets/op/scalarload.hpp diff --git a/inference-engine/src/snippets/include/snippets/op/scalarstore.hpp b/src/common/snippets/include/snippets/op/scalarstore.hpp similarity index 100% rename from inference-engine/src/snippets/include/snippets/op/scalarstore.hpp rename to src/common/snippets/include/snippets/op/scalarstore.hpp diff --git a/inference-engine/src/snippets/include/snippets/op/staticpower.hpp b/src/common/snippets/include/snippets/op/staticpower.hpp similarity index 100% rename from inference-engine/src/snippets/include/snippets/op/staticpower.hpp rename to src/common/snippets/include/snippets/op/staticpower.hpp diff --git a/inference-engine/src/snippets/include/snippets/op/store.hpp b/src/common/snippets/include/snippets/op/store.hpp similarity index 100% rename from inference-engine/src/snippets/include/snippets/op/store.hpp rename to src/common/snippets/include/snippets/op/store.hpp diff --git a/inference-engine/src/snippets/include/snippets/op/subgraph.hpp b/src/common/snippets/include/snippets/op/subgraph.hpp similarity index 100% rename from inference-engine/src/snippets/include/snippets/op/subgraph.hpp rename to src/common/snippets/include/snippets/op/subgraph.hpp diff --git a/inference-engine/src/snippets/include/snippets/op/tile.hpp b/src/common/snippets/include/snippets/op/tile.hpp similarity index 100% rename from inference-engine/src/snippets/include/snippets/op/tile.hpp rename to src/common/snippets/include/snippets/op/tile.hpp diff --git a/inference-engine/src/snippets/include/snippets/op/vectorload.hpp b/src/common/snippets/include/snippets/op/vectorload.hpp similarity index 100% rename from inference-engine/src/snippets/include/snippets/op/vectorload.hpp rename to src/common/snippets/include/snippets/op/vectorload.hpp diff --git a/inference-engine/src/snippets/include/snippets/op/vectorstore.hpp b/src/common/snippets/include/snippets/op/vectorstore.hpp similarity index 100% rename from inference-engine/src/snippets/include/snippets/op/vectorstore.hpp rename to src/common/snippets/include/snippets/op/vectorstore.hpp diff --git a/inference-engine/src/snippets/include/snippets/pass/assign_registers.hpp b/src/common/snippets/include/snippets/pass/assign_registers.hpp similarity index 100% rename from inference-engine/src/snippets/include/snippets/pass/assign_registers.hpp rename to src/common/snippets/include/snippets/pass/assign_registers.hpp diff --git a/inference-engine/src/snippets/include/snippets/pass/collapse_subgraph.hpp b/src/common/snippets/include/snippets/pass/collapse_subgraph.hpp similarity index 100% rename from inference-engine/src/snippets/include/snippets/pass/collapse_subgraph.hpp rename to src/common/snippets/include/snippets/pass/collapse_subgraph.hpp diff --git a/inference-engine/src/snippets/include/snippets/pass/insert_load_store.hpp b/src/common/snippets/include/snippets/pass/insert_load_store.hpp similarity index 100% rename from inference-engine/src/snippets/include/snippets/pass/insert_load_store.hpp rename to src/common/snippets/include/snippets/pass/insert_load_store.hpp diff --git a/inference-engine/src/snippets/include/snippets/pass/insert_movebroadcast.hpp b/src/common/snippets/include/snippets/pass/insert_movebroadcast.hpp similarity index 100% rename from inference-engine/src/snippets/include/snippets/pass/insert_movebroadcast.hpp rename to src/common/snippets/include/snippets/pass/insert_movebroadcast.hpp diff --git a/inference-engine/src/snippets/include/snippets/pass/load_movebroadcast_to_broadcastload.hpp b/src/common/snippets/include/snippets/pass/load_movebroadcast_to_broadcastload.hpp similarity index 100% rename from inference-engine/src/snippets/include/snippets/pass/load_movebroadcast_to_broadcastload.hpp rename to src/common/snippets/include/snippets/pass/load_movebroadcast_to_broadcastload.hpp diff --git a/inference-engine/src/snippets/include/snippets/pass/vector_to_scalar.hpp b/src/common/snippets/include/snippets/pass/vector_to_scalar.hpp similarity index 100% rename from inference-engine/src/snippets/include/snippets/pass/vector_to_scalar.hpp rename to src/common/snippets/include/snippets/pass/vector_to_scalar.hpp diff --git a/inference-engine/src/snippets/include/snippets/register_info.hpp b/src/common/snippets/include/snippets/register_info.hpp similarity index 100% rename from inference-engine/src/snippets/include/snippets/register_info.hpp rename to src/common/snippets/include/snippets/register_info.hpp diff --git a/inference-engine/src/snippets/include/snippets/snippets_isa.hpp b/src/common/snippets/include/snippets/snippets_isa.hpp similarity index 100% rename from inference-engine/src/snippets/include/snippets/snippets_isa.hpp rename to src/common/snippets/include/snippets/snippets_isa.hpp diff --git a/inference-engine/src/snippets/include/snippets/snippets_isa_tbl.hpp b/src/common/snippets/include/snippets/snippets_isa_tbl.hpp similarity index 100% rename from inference-engine/src/snippets/include/snippets/snippets_isa_tbl.hpp rename to src/common/snippets/include/snippets/snippets_isa_tbl.hpp diff --git a/inference-engine/src/snippets/src/generator.cpp b/src/common/snippets/src/generator.cpp similarity index 96% rename from inference-engine/src/snippets/src/generator.cpp rename to src/common/snippets/src/generator.cpp index 91a50ad576d..33b373f2d29 100644 --- a/inference-engine/src/snippets/src/generator.cpp +++ b/src/common/snippets/src/generator.cpp @@ -17,7 +17,8 @@ auto ngraph::snippets::getRegisters(std::shared_ptr& n) -> ngraph: // ToDo: change to reg_t std::vector rout; - if (auto rinfo = rt["reginfo"]) { + auto rinfo = rt["reginfo"]; + if (!rinfo.empty()) { auto reginfo = ngraph::as_type_ptr>>(rinfo)->get(); for (auto reg : reginfo) { rout.push_back(reg); @@ -27,7 +28,8 @@ auto ngraph::snippets::getRegisters(std::shared_ptr& n) -> ngraph: std::vector rin; for (auto input : n->inputs()) { auto rt = input.get_source_output().get_node_shared_ptr()->get_rt_info(); - if (auto rinfo = rt["reginfo"]) { + auto rinfo = rt["reginfo"]; + if (!rinfo.empty()) { auto reginfo = ngraph::as_type_ptr>>(rinfo)->get(); for (auto reg : reginfo) { rin.push_back(reg); diff --git a/inference-engine/src/snippets/src/itt.hpp b/src/common/snippets/src/itt.hpp similarity index 100% rename from inference-engine/src/snippets/src/itt.hpp rename to src/common/snippets/src/itt.hpp diff --git a/inference-engine/src/snippets/src/op/blockedload.cpp b/src/common/snippets/src/op/blockedload.cpp similarity index 100% rename from inference-engine/src/snippets/src/op/blockedload.cpp rename to src/common/snippets/src/op/blockedload.cpp diff --git a/inference-engine/src/snippets/src/op/broadcastload.cpp b/src/common/snippets/src/op/broadcastload.cpp similarity index 100% rename from inference-engine/src/snippets/src/op/broadcastload.cpp rename to src/common/snippets/src/op/broadcastload.cpp diff --git a/inference-engine/src/snippets/src/op/broadcastmove.cpp b/src/common/snippets/src/op/broadcastmove.cpp similarity index 100% rename from inference-engine/src/snippets/src/op/broadcastmove.cpp rename to src/common/snippets/src/op/broadcastmove.cpp diff --git a/inference-engine/src/snippets/src/op/kernel.cpp b/src/common/snippets/src/op/kernel.cpp similarity index 100% rename from inference-engine/src/snippets/src/op/kernel.cpp rename to src/common/snippets/src/op/kernel.cpp diff --git a/inference-engine/src/snippets/src/op/load.cpp b/src/common/snippets/src/op/load.cpp similarity index 100% rename from inference-engine/src/snippets/src/op/load.cpp rename to src/common/snippets/src/op/load.cpp diff --git a/inference-engine/src/snippets/src/op/nop.cpp b/src/common/snippets/src/op/nop.cpp similarity index 100% rename from inference-engine/src/snippets/src/op/nop.cpp rename to src/common/snippets/src/op/nop.cpp diff --git a/inference-engine/src/snippets/src/op/scalarload.cpp b/src/common/snippets/src/op/scalarload.cpp similarity index 100% rename from inference-engine/src/snippets/src/op/scalarload.cpp rename to src/common/snippets/src/op/scalarload.cpp diff --git a/inference-engine/src/snippets/src/op/scalarstore.cpp b/src/common/snippets/src/op/scalarstore.cpp similarity index 100% rename from inference-engine/src/snippets/src/op/scalarstore.cpp rename to src/common/snippets/src/op/scalarstore.cpp diff --git a/inference-engine/src/snippets/src/op/store.cpp b/src/common/snippets/src/op/store.cpp similarity index 100% rename from inference-engine/src/snippets/src/op/store.cpp rename to src/common/snippets/src/op/store.cpp diff --git a/inference-engine/src/snippets/src/op/subgraph.cpp b/src/common/snippets/src/op/subgraph.cpp similarity index 100% rename from inference-engine/src/snippets/src/op/subgraph.cpp rename to src/common/snippets/src/op/subgraph.cpp diff --git a/inference-engine/src/snippets/src/op/tile.cpp b/src/common/snippets/src/op/tile.cpp similarity index 100% rename from inference-engine/src/snippets/src/op/tile.cpp rename to src/common/snippets/src/op/tile.cpp diff --git a/inference-engine/src/snippets/src/op/vectorload.cpp b/src/common/snippets/src/op/vectorload.cpp similarity index 100% rename from inference-engine/src/snippets/src/op/vectorload.cpp rename to src/common/snippets/src/op/vectorload.cpp diff --git a/inference-engine/src/snippets/src/op/vectorstore.cpp b/src/common/snippets/src/op/vectorstore.cpp similarity index 100% rename from inference-engine/src/snippets/src/op/vectorstore.cpp rename to src/common/snippets/src/op/vectorstore.cpp diff --git a/inference-engine/src/snippets/src/pass/assign_registers.cpp b/src/common/snippets/src/pass/assign_registers.cpp similarity index 100% rename from inference-engine/src/snippets/src/pass/assign_registers.cpp rename to src/common/snippets/src/pass/assign_registers.cpp diff --git a/inference-engine/src/snippets/src/pass/collapse_subgraph.cpp b/src/common/snippets/src/pass/collapse_subgraph.cpp similarity index 100% rename from inference-engine/src/snippets/src/pass/collapse_subgraph.cpp rename to src/common/snippets/src/pass/collapse_subgraph.cpp diff --git a/inference-engine/src/snippets/src/pass/insert_load_store.cpp b/src/common/snippets/src/pass/insert_load_store.cpp similarity index 100% rename from inference-engine/src/snippets/src/pass/insert_load_store.cpp rename to src/common/snippets/src/pass/insert_load_store.cpp diff --git a/inference-engine/src/snippets/src/pass/insert_movebroadcast.cpp b/src/common/snippets/src/pass/insert_movebroadcast.cpp similarity index 100% rename from inference-engine/src/snippets/src/pass/insert_movebroadcast.cpp rename to src/common/snippets/src/pass/insert_movebroadcast.cpp diff --git a/inference-engine/src/snippets/src/pass/load_movebroadcast_to_broadcastload.cpp b/src/common/snippets/src/pass/load_movebroadcast_to_broadcastload.cpp similarity index 100% rename from inference-engine/src/snippets/src/pass/load_movebroadcast_to_broadcastload.cpp rename to src/common/snippets/src/pass/load_movebroadcast_to_broadcastload.cpp diff --git a/inference-engine/src/snippets/src/pass/vector_to_scalar.cpp b/src/common/snippets/src/pass/vector_to_scalar.cpp similarity index 100% rename from inference-engine/src/snippets/src/pass/vector_to_scalar.cpp rename to src/common/snippets/src/pass/vector_to_scalar.cpp diff --git a/inference-engine/src/snippets/src/register_info.cpp b/src/common/snippets/src/register_info.cpp similarity index 100% rename from inference-engine/src/snippets/src/register_info.cpp rename to src/common/snippets/src/register_info.cpp diff --git a/inference-engine/src/snippets/src/remarks.hpp b/src/common/snippets/src/remarks.hpp similarity index 100% rename from inference-engine/src/snippets/src/remarks.hpp rename to src/common/snippets/src/remarks.hpp diff --git a/inference-engine/src/transformations/CMakeLists.txt b/src/common/transformations/CMakeLists.txt similarity index 100% rename from inference-engine/src/transformations/CMakeLists.txt rename to src/common/transformations/CMakeLists.txt diff --git a/inference-engine/src/transformations/include/ngraph_ops/convolution_ie.hpp b/src/common/transformations/include/ngraph_ops/convolution_ie.hpp similarity index 100% rename from inference-engine/src/transformations/include/ngraph_ops/convolution_ie.hpp rename to src/common/transformations/include/ngraph_ops/convolution_ie.hpp diff --git a/inference-engine/src/transformations/include/ngraph_ops/deconvolution_ie.hpp b/src/common/transformations/include/ngraph_ops/deconvolution_ie.hpp similarity index 100% rename from inference-engine/src/transformations/include/ngraph_ops/deconvolution_ie.hpp rename to src/common/transformations/include/ngraph_ops/deconvolution_ie.hpp diff --git a/inference-engine/src/transformations/include/ngraph_ops/nms_ie_internal.hpp b/src/common/transformations/include/ngraph_ops/nms_ie_internal.hpp similarity index 100% rename from inference-engine/src/transformations/include/ngraph_ops/nms_ie_internal.hpp rename to src/common/transformations/include/ngraph_ops/nms_ie_internal.hpp diff --git a/inference-engine/src/transformations/include/ngraph_ops/nms_static_shape_ie.hpp b/src/common/transformations/include/ngraph_ops/nms_static_shape_ie.hpp similarity index 96% rename from inference-engine/src/transformations/include/ngraph_ops/nms_static_shape_ie.hpp rename to src/common/transformations/include/ngraph_ops/nms_static_shape_ie.hpp index 2d33d7c3386..1328110266c 100644 --- a/inference-engine/src/transformations/include/ngraph_ops/nms_static_shape_ie.hpp +++ b/src/common/transformations/include/ngraph_ops/nms_static_shape_ie.hpp @@ -64,8 +64,8 @@ void NmsStaticShapeIE::validate_and_infer_types() { if (num_boxes_boxes.is_static() && scores_ps[0].is_static() && scores_ps[1].is_static()) { const auto num_boxes = num_boxes_boxes.get_length(); auto num_classes = scores_ps[1].get_length(); - if (this->m_attrs.background_class >=0 && this->m_attrs.background_class <= num_classes) { - num_classes = num_classes - 1; + if (this->m_attrs.background_class >= 0 && this->m_attrs.background_class < num_classes) { + num_classes = std::max(int64_t{1}, num_classes - 1); } int64_t max_output_boxes_per_class = 0; if (this->m_attrs.nms_top_k >= 0) diff --git a/inference-engine/src/transformations/include/ngraph_ops/type_relaxed.hpp b/src/common/transformations/include/ngraph_ops/type_relaxed.hpp similarity index 100% rename from inference-engine/src/transformations/include/ngraph_ops/type_relaxed.hpp rename to src/common/transformations/include/ngraph_ops/type_relaxed.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/add_fake_quantize_fusion.hpp b/src/common/transformations/include/transformations/common_optimizations/add_fake_quantize_fusion.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/add_fake_quantize_fusion.hpp rename to src/common/transformations/include/transformations/common_optimizations/add_fake_quantize_fusion.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/algebraic_simplification.hpp b/src/common/transformations/include/transformations/common_optimizations/algebraic_simplification.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/algebraic_simplification.hpp rename to src/common/transformations/include/transformations/common_optimizations/algebraic_simplification.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/batch_to_space_fusion.hpp b/src/common/transformations/include/transformations/common_optimizations/batch_to_space_fusion.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/batch_to_space_fusion.hpp rename to src/common/transformations/include/transformations/common_optimizations/batch_to_space_fusion.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/binarize_weights.hpp b/src/common/transformations/include/transformations/common_optimizations/binarize_weights.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/binarize_weights.hpp rename to src/common/transformations/include/transformations/common_optimizations/binarize_weights.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/broadcast_elementwise_fusion.hpp b/src/common/transformations/include/transformations/common_optimizations/broadcast_elementwise_fusion.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/broadcast_elementwise_fusion.hpp rename to src/common/transformations/include/transformations/common_optimizations/broadcast_elementwise_fusion.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/clamp_fusion.hpp b/src/common/transformations/include/transformations/common_optimizations/clamp_fusion.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/clamp_fusion.hpp rename to src/common/transformations/include/transformations/common_optimizations/clamp_fusion.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/common_optimizations.hpp b/src/common/transformations/include/transformations/common_optimizations/common_optimizations.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/common_optimizations.hpp rename to src/common/transformations/include/transformations/common_optimizations/common_optimizations.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/compress_float_constants.hpp b/src/common/transformations/include/transformations/common_optimizations/compress_float_constants.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/compress_float_constants.hpp rename to src/common/transformations/include/transformations/common_optimizations/compress_float_constants.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/conv_bias_fusion.hpp b/src/common/transformations/include/transformations/common_optimizations/conv_bias_fusion.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/conv_bias_fusion.hpp rename to src/common/transformations/include/transformations/common_optimizations/conv_bias_fusion.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/conv_mul_fusion.hpp b/src/common/transformations/include/transformations/common_optimizations/conv_mul_fusion.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/conv_mul_fusion.hpp rename to src/common/transformations/include/transformations/common_optimizations/conv_mul_fusion.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/conv_to_binary_conv.hpp b/src/common/transformations/include/transformations/common_optimizations/conv_to_binary_conv.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/conv_to_binary_conv.hpp rename to src/common/transformations/include/transformations/common_optimizations/conv_to_binary_conv.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/convert_compression_only_to_legacy.hpp b/src/common/transformations/include/transformations/common_optimizations/convert_compression_only_to_legacy.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/convert_compression_only_to_legacy.hpp rename to src/common/transformations/include/transformations/common_optimizations/convert_compression_only_to_legacy.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/convert_nms_gather_path_to_unsigned.hpp b/src/common/transformations/include/transformations/common_optimizations/convert_nms_gather_path_to_unsigned.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/convert_nms_gather_path_to_unsigned.hpp rename to src/common/transformations/include/transformations/common_optimizations/convert_nms_gather_path_to_unsigned.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/convert_quantize_dequantize.hpp b/src/common/transformations/include/transformations/common_optimizations/convert_quantize_dequantize.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/convert_quantize_dequantize.hpp rename to src/common/transformations/include/transformations/common_optimizations/convert_quantize_dequantize.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/depth_to_space_fusion.hpp b/src/common/transformations/include/transformations/common_optimizations/depth_to_space_fusion.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/depth_to_space_fusion.hpp rename to src/common/transformations/include/transformations/common_optimizations/depth_to_space_fusion.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/dilated_convolution_converter.hpp b/src/common/transformations/include/transformations/common_optimizations/dilated_convolution_converter.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/dilated_convolution_converter.hpp rename to src/common/transformations/include/transformations/common_optimizations/dilated_convolution_converter.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/disable_random_uniform_constant_folding.hpp b/src/common/transformations/include/transformations/common_optimizations/disable_random_uniform_constant_folding.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/disable_random_uniform_constant_folding.hpp rename to src/common/transformations/include/transformations/common_optimizations/disable_random_uniform_constant_folding.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/disable_shapeof_constant_folding.hpp b/src/common/transformations/include/transformations/common_optimizations/disable_shapeof_constant_folding.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/disable_shapeof_constant_folding.hpp rename to src/common/transformations/include/transformations/common_optimizations/disable_shapeof_constant_folding.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/divide_fusion.hpp b/src/common/transformations/include/transformations/common_optimizations/divide_fusion.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/divide_fusion.hpp rename to src/common/transformations/include/transformations/common_optimizations/divide_fusion.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/dropout_with_random_uniform_replacer.hpp b/src/common/transformations/include/transformations/common_optimizations/dropout_with_random_uniform_replacer.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/dropout_with_random_uniform_replacer.hpp rename to src/common/transformations/include/transformations/common_optimizations/dropout_with_random_uniform_replacer.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/eliminate_unsqueeze_gather.hpp b/src/common/transformations/include/transformations/common_optimizations/eliminate_unsqueeze_gather.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/eliminate_unsqueeze_gather.hpp rename to src/common/transformations/include/transformations/common_optimizations/eliminate_unsqueeze_gather.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/fq_mul_fusion.hpp b/src/common/transformations/include/transformations/common_optimizations/fq_mul_fusion.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/fq_mul_fusion.hpp rename to src/common/transformations/include/transformations/common_optimizations/fq_mul_fusion.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/fq_reshape_fusion.hpp b/src/common/transformations/include/transformations/common_optimizations/fq_reshape_fusion.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/fq_reshape_fusion.hpp rename to src/common/transformations/include/transformations/common_optimizations/fq_reshape_fusion.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/gelu_fusion.hpp b/src/common/transformations/include/transformations/common_optimizations/gelu_fusion.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/gelu_fusion.hpp rename to src/common/transformations/include/transformations/common_optimizations/gelu_fusion.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/hsigmoid_fusion.hpp b/src/common/transformations/include/transformations/common_optimizations/hsigmoid_fusion.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/hsigmoid_fusion.hpp rename to src/common/transformations/include/transformations/common_optimizations/hsigmoid_fusion.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/hswish_fusion.hpp b/src/common/transformations/include/transformations/common_optimizations/hswish_fusion.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/hswish_fusion.hpp rename to src/common/transformations/include/transformations/common_optimizations/hswish_fusion.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/interpolate_sequence_fusion.hpp b/src/common/transformations/include/transformations/common_optimizations/interpolate_sequence_fusion.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/interpolate_sequence_fusion.hpp rename to src/common/transformations/include/transformations/common_optimizations/interpolate_sequence_fusion.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/leaky_relu_fusion.hpp b/src/common/transformations/include/transformations/common_optimizations/leaky_relu_fusion.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/leaky_relu_fusion.hpp rename to src/common/transformations/include/transformations/common_optimizations/leaky_relu_fusion.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/lin_op_sequence_fusion.hpp b/src/common/transformations/include/transformations/common_optimizations/lin_op_sequence_fusion.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/lin_op_sequence_fusion.hpp rename to src/common/transformations/include/transformations/common_optimizations/lin_op_sequence_fusion.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/low_latency.hpp b/src/common/transformations/include/transformations/common_optimizations/low_latency.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/low_latency.hpp rename to src/common/transformations/include/transformations/common_optimizations/low_latency.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/mark_precision_sensitive_subgraphs.hpp b/src/common/transformations/include/transformations/common_optimizations/mark_precision_sensitive_subgraphs.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/mark_precision_sensitive_subgraphs.hpp rename to src/common/transformations/include/transformations/common_optimizations/mark_precision_sensitive_subgraphs.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/mish_fusion.hpp b/src/common/transformations/include/transformations/common_optimizations/mish_fusion.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/mish_fusion.hpp rename to src/common/transformations/include/transformations/common_optimizations/mish_fusion.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/moc_transformations.hpp b/src/common/transformations/include/transformations/common_optimizations/moc_transformations.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/moc_transformations.hpp rename to src/common/transformations/include/transformations/common_optimizations/moc_transformations.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/mul_conv_fusion.hpp b/src/common/transformations/include/transformations/common_optimizations/mul_conv_fusion.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/mul_conv_fusion.hpp rename to src/common/transformations/include/transformations/common_optimizations/mul_conv_fusion.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/mul_fake_quantize_fusion.hpp b/src/common/transformations/include/transformations/common_optimizations/mul_fake_quantize_fusion.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/mul_fake_quantize_fusion.hpp rename to src/common/transformations/include/transformations/common_optimizations/mul_fake_quantize_fusion.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/mvn_fusion.hpp b/src/common/transformations/include/transformations/common_optimizations/mvn_fusion.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/mvn_fusion.hpp rename to src/common/transformations/include/transformations/common_optimizations/mvn_fusion.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/nop_elimination.hpp b/src/common/transformations/include/transformations/common_optimizations/nop_elimination.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/nop_elimination.hpp rename to src/common/transformations/include/transformations/common_optimizations/nop_elimination.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/normalize_l2_fusion.hpp b/src/common/transformations/include/transformations/common_optimizations/normalize_l2_fusion.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/normalize_l2_fusion.hpp rename to src/common/transformations/include/transformations/common_optimizations/normalize_l2_fusion.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/optimize_strided_slice.hpp b/src/common/transformations/include/transformations/common_optimizations/optimize_strided_slice.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/optimize_strided_slice.hpp rename to src/common/transformations/include/transformations/common_optimizations/optimize_strided_slice.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/pad_fusion.hpp b/src/common/transformations/include/transformations/common_optimizations/pad_fusion.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/pad_fusion.hpp rename to src/common/transformations/include/transformations/common_optimizations/pad_fusion.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/pull_transpose_through_fq.hpp b/src/common/transformations/include/transformations/common_optimizations/pull_transpose_through_fq.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/pull_transpose_through_fq.hpp rename to src/common/transformations/include/transformations/common_optimizations/pull_transpose_through_fq.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/random_uniform_fusion.hpp b/src/common/transformations/include/transformations/common_optimizations/random_uniform_fusion.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/random_uniform_fusion.hpp rename to src/common/transformations/include/transformations/common_optimizations/random_uniform_fusion.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/relu_fake_quantize_fusion.hpp b/src/common/transformations/include/transformations/common_optimizations/relu_fake_quantize_fusion.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/relu_fake_quantize_fusion.hpp rename to src/common/transformations/include/transformations/common_optimizations/relu_fake_quantize_fusion.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/remove_filtering_boxes_by_size.hpp b/src/common/transformations/include/transformations/common_optimizations/remove_filtering_boxes_by_size.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/remove_filtering_boxes_by_size.hpp rename to src/common/transformations/include/transformations/common_optimizations/remove_filtering_boxes_by_size.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/reshape_sequence_fusion.hpp b/src/common/transformations/include/transformations/common_optimizations/reshape_sequence_fusion.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/reshape_sequence_fusion.hpp rename to src/common/transformations/include/transformations/common_optimizations/reshape_sequence_fusion.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/shuffle_channels_fusion.hpp b/src/common/transformations/include/transformations/common_optimizations/shuffle_channels_fusion.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/shuffle_channels_fusion.hpp rename to src/common/transformations/include/transformations/common_optimizations/shuffle_channels_fusion.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/simplify_shape_of_sub_graph.hpp b/src/common/transformations/include/transformations/common_optimizations/simplify_shape_of_sub_graph.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/simplify_shape_of_sub_graph.hpp rename to src/common/transformations/include/transformations/common_optimizations/simplify_shape_of_sub_graph.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/softmax_fusion.hpp b/src/common/transformations/include/transformations/common_optimizations/softmax_fusion.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/softmax_fusion.hpp rename to src/common/transformations/include/transformations/common_optimizations/softmax_fusion.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/softplus_fusion.hpp b/src/common/transformations/include/transformations/common_optimizations/softplus_fusion.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/softplus_fusion.hpp rename to src/common/transformations/include/transformations/common_optimizations/softplus_fusion.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/softplus_to_mish_fusion.hpp b/src/common/transformations/include/transformations/common_optimizations/softplus_to_mish_fusion.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/softplus_to_mish_fusion.hpp rename to src/common/transformations/include/transformations/common_optimizations/softplus_to_mish_fusion.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/space_to_batch_fusion.hpp b/src/common/transformations/include/transformations/common_optimizations/space_to_batch_fusion.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/space_to_batch_fusion.hpp rename to src/common/transformations/include/transformations/common_optimizations/space_to_batch_fusion.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/split_concat_pair_to_interpolate_fusion.hpp b/src/common/transformations/include/transformations/common_optimizations/split_concat_pair_to_interpolate_fusion.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/split_concat_pair_to_interpolate_fusion.hpp rename to src/common/transformations/include/transformations/common_optimizations/split_concat_pair_to_interpolate_fusion.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/split_squeeze_concat_fusion.hpp b/src/common/transformations/include/transformations/common_optimizations/split_squeeze_concat_fusion.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/split_squeeze_concat_fusion.hpp rename to src/common/transformations/include/transformations/common_optimizations/split_squeeze_concat_fusion.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/strides_optimization.hpp b/src/common/transformations/include/transformations/common_optimizations/strides_optimization.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/strides_optimization.hpp rename to src/common/transformations/include/transformations/common_optimizations/strides_optimization.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/subtract_fusion.hpp b/src/common/transformations/include/transformations/common_optimizations/subtract_fusion.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/subtract_fusion.hpp rename to src/common/transformations/include/transformations/common_optimizations/subtract_fusion.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/swish_fusion.hpp b/src/common/transformations/include/transformations/common_optimizations/swish_fusion.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/swish_fusion.hpp rename to src/common/transformations/include/transformations/common_optimizations/swish_fusion.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/transpose_sinking.hpp b/src/common/transformations/include/transformations/common_optimizations/transpose_sinking.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/transpose_sinking.hpp rename to src/common/transformations/include/transformations/common_optimizations/transpose_sinking.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/transpose_to_reshape.hpp b/src/common/transformations/include/transformations/common_optimizations/transpose_to_reshape.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/transpose_to_reshape.hpp rename to src/common/transformations/include/transformations/common_optimizations/transpose_to_reshape.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/weights_dequantize_to_fake_quantize.hpp b/src/common/transformations/include/transformations/common_optimizations/weights_dequantize_to_fake_quantize.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/weights_dequantize_to_fake_quantize.hpp rename to src/common/transformations/include/transformations/common_optimizations/weights_dequantize_to_fake_quantize.hpp diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/wrap_interpolate_into_transposes.hpp b/src/common/transformations/include/transformations/common_optimizations/wrap_interpolate_into_transposes.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/common_optimizations/wrap_interpolate_into_transposes.hpp rename to src/common/transformations/include/transformations/common_optimizations/wrap_interpolate_into_transposes.hpp diff --git a/inference-engine/src/transformations/include/transformations/control_flow/unroll_if.hpp b/src/common/transformations/include/transformations/control_flow/unroll_if.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/control_flow/unroll_if.hpp rename to src/common/transformations/include/transformations/control_flow/unroll_if.hpp diff --git a/inference-engine/src/transformations/include/transformations/control_flow/unroll_tensor_iterator.hpp b/src/common/transformations/include/transformations/control_flow/unroll_tensor_iterator.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/control_flow/unroll_tensor_iterator.hpp rename to src/common/transformations/include/transformations/control_flow/unroll_tensor_iterator.hpp diff --git a/inference-engine/src/transformations/include/transformations/convert_precision.hpp b/src/common/transformations/include/transformations/convert_precision.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/convert_precision.hpp rename to src/common/transformations/include/transformations/convert_precision.hpp diff --git a/inference-engine/src/transformations/include/transformations/disable_decompression_convert_constant_folding.hpp b/src/common/transformations/include/transformations/disable_decompression_convert_constant_folding.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/disable_decompression_convert_constant_folding.hpp rename to src/common/transformations/include/transformations/disable_decompression_convert_constant_folding.hpp diff --git a/inference-engine/src/transformations/include/transformations/hash.hpp b/src/common/transformations/include/transformations/hash.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/hash.hpp rename to src/common/transformations/include/transformations/hash.hpp diff --git a/inference-engine/src/transformations/include/transformations/init_node_info.hpp b/src/common/transformations/include/transformations/init_node_info.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/init_node_info.hpp rename to src/common/transformations/include/transformations/init_node_info.hpp diff --git a/inference-engine/src/transformations/include/transformations/low_precision/disable_convert_constant_folding_on_const_path.hpp b/src/common/transformations/include/transformations/low_precision/disable_convert_constant_folding_on_const_path.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/low_precision/disable_convert_constant_folding_on_const_path.hpp rename to src/common/transformations/include/transformations/low_precision/disable_convert_constant_folding_on_const_path.hpp diff --git a/inference-engine/src/transformations/include/transformations/op_conversions/batch_norm_decomposition.hpp b/src/common/transformations/include/transformations/op_conversions/batch_norm_decomposition.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/op_conversions/batch_norm_decomposition.hpp rename to src/common/transformations/include/transformations/op_conversions/batch_norm_decomposition.hpp diff --git a/inference-engine/src/transformations/include/transformations/op_conversions/bidirectional_sequences_decomposition.hpp b/src/common/transformations/include/transformations/op_conversions/bidirectional_sequences_decomposition.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/op_conversions/bidirectional_sequences_decomposition.hpp rename to src/common/transformations/include/transformations/op_conversions/bidirectional_sequences_decomposition.hpp diff --git a/inference-engine/src/transformations/include/transformations/op_conversions/convert_batch_to_space.hpp b/src/common/transformations/include/transformations/op_conversions/convert_batch_to_space.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/op_conversions/convert_batch_to_space.hpp rename to src/common/transformations/include/transformations/op_conversions/convert_batch_to_space.hpp diff --git a/inference-engine/src/transformations/include/transformations/op_conversions/convert_broadcast3.hpp b/src/common/transformations/include/transformations/op_conversions/convert_broadcast3.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/op_conversions/convert_broadcast3.hpp rename to src/common/transformations/include/transformations/op_conversions/convert_broadcast3.hpp diff --git a/inference-engine/src/transformations/include/transformations/op_conversions/convert_broadcast_to_tiles.hpp b/src/common/transformations/include/transformations/op_conversions/convert_broadcast_to_tiles.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/op_conversions/convert_broadcast_to_tiles.hpp rename to src/common/transformations/include/transformations/op_conversions/convert_broadcast_to_tiles.hpp diff --git a/inference-engine/src/transformations/include/transformations/op_conversions/convert_convolutions.hpp b/src/common/transformations/include/transformations/op_conversions/convert_convolutions.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/op_conversions/convert_convolutions.hpp rename to src/common/transformations/include/transformations/op_conversions/convert_convolutions.hpp diff --git a/inference-engine/src/transformations/include/transformations/op_conversions/convert_deformable_conv_v8_to_v1.hpp b/src/common/transformations/include/transformations/op_conversions/convert_deformable_conv_v8_to_v1.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/op_conversions/convert_deformable_conv_v8_to_v1.hpp rename to src/common/transformations/include/transformations/op_conversions/convert_deformable_conv_v8_to_v1.hpp diff --git a/inference-engine/src/transformations/include/transformations/op_conversions/convert_depth_to_space.hpp b/src/common/transformations/include/transformations/op_conversions/convert_depth_to_space.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/op_conversions/convert_depth_to_space.hpp rename to src/common/transformations/include/transformations/op_conversions/convert_depth_to_space.hpp diff --git a/inference-engine/src/transformations/include/transformations/op_conversions/convert_divide.hpp b/src/common/transformations/include/transformations/op_conversions/convert_divide.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/op_conversions/convert_divide.hpp rename to src/common/transformations/include/transformations/op_conversions/convert_divide.hpp diff --git a/inference-engine/src/transformations/include/transformations/op_conversions/convert_gather_0d.hpp b/src/common/transformations/include/transformations/op_conversions/convert_gather_0d.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/op_conversions/convert_gather_0d.hpp rename to src/common/transformations/include/transformations/op_conversions/convert_gather_0d.hpp diff --git a/inference-engine/src/transformations/include/transformations/op_conversions/convert_gather_downgrade.hpp b/src/common/transformations/include/transformations/op_conversions/convert_gather_downgrade.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/op_conversions/convert_gather_downgrade.hpp rename to src/common/transformations/include/transformations/op_conversions/convert_gather_downgrade.hpp diff --git a/inference-engine/src/transformations/include/transformations/op_conversions/convert_gather_upgrade.hpp b/src/common/transformations/include/transformations/op_conversions/convert_gather_upgrade.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/op_conversions/convert_gather_upgrade.hpp rename to src/common/transformations/include/transformations/op_conversions/convert_gather_upgrade.hpp diff --git a/inference-engine/src/transformations/include/transformations/op_conversions/convert_gelu.hpp b/src/common/transformations/include/transformations/op_conversions/convert_gelu.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/op_conversions/convert_gelu.hpp rename to src/common/transformations/include/transformations/op_conversions/convert_gelu.hpp diff --git a/inference-engine/src/transformations/include/transformations/op_conversions/convert_interpolate1_to_interpolate4.hpp b/src/common/transformations/include/transformations/op_conversions/convert_interpolate1_to_interpolate4.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/op_conversions/convert_interpolate1_to_interpolate4.hpp rename to src/common/transformations/include/transformations/op_conversions/convert_interpolate1_to_interpolate4.hpp diff --git a/inference-engine/src/transformations/include/transformations/op_conversions/convert_matrix_nms_to_matrix_nms_ie.hpp b/src/common/transformations/include/transformations/op_conversions/convert_matrix_nms_to_matrix_nms_ie.hpp similarity index 87% rename from inference-engine/src/transformations/include/transformations/op_conversions/convert_matrix_nms_to_matrix_nms_ie.hpp rename to src/common/transformations/include/transformations/op_conversions/convert_matrix_nms_to_matrix_nms_ie.hpp index 080a0868322..42705003123 100644 --- a/inference-engine/src/transformations/include/transformations/op_conversions/convert_matrix_nms_to_matrix_nms_ie.hpp +++ b/src/common/transformations/include/transformations/op_conversions/convert_matrix_nms_to_matrix_nms_ie.hpp @@ -22,5 +22,5 @@ class TRANSFORMATIONS_API ConvertMatrixNmsToMatrixNmsIE; class ngraph::pass::ConvertMatrixNmsToMatrixNmsIE: public ngraph::pass::MatcherPass { public: NGRAPH_RTTI_DECLARATION; - ConvertMatrixNmsToMatrixNmsIE(); + ConvertMatrixNmsToMatrixNmsIE(bool force_i32_output_type = true); }; diff --git a/inference-engine/src/transformations/include/transformations/op_conversions/convert_maxpool_downgrade.hpp b/src/common/transformations/include/transformations/op_conversions/convert_maxpool_downgrade.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/op_conversions/convert_maxpool_downgrade.hpp rename to src/common/transformations/include/transformations/op_conversions/convert_maxpool_downgrade.hpp diff --git a/inference-engine/src/transformations/include/transformations/op_conversions/convert_minimum_to_power_and_max.hpp b/src/common/transformations/include/transformations/op_conversions/convert_minimum_to_power_and_max.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/op_conversions/convert_minimum_to_power_and_max.hpp rename to src/common/transformations/include/transformations/op_conversions/convert_minimum_to_power_and_max.hpp diff --git a/inference-engine/src/transformations/include/transformations/op_conversions/convert_mod.hpp b/src/common/transformations/include/transformations/op_conversions/convert_mod.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/op_conversions/convert_mod.hpp rename to src/common/transformations/include/transformations/op_conversions/convert_mod.hpp diff --git a/inference-engine/src/transformations/include/transformations/op_conversions/convert_multiclass_nms_to_multiclass_nms_ie.hpp b/src/common/transformations/include/transformations/op_conversions/convert_multiclass_nms_to_multiclass_nms_ie.hpp similarity index 86% rename from inference-engine/src/transformations/include/transformations/op_conversions/convert_multiclass_nms_to_multiclass_nms_ie.hpp rename to src/common/transformations/include/transformations/op_conversions/convert_multiclass_nms_to_multiclass_nms_ie.hpp index b639364b24e..b818f425077 100644 --- a/inference-engine/src/transformations/include/transformations/op_conversions/convert_multiclass_nms_to_multiclass_nms_ie.hpp +++ b/src/common/transformations/include/transformations/op_conversions/convert_multiclass_nms_to_multiclass_nms_ie.hpp @@ -22,5 +22,5 @@ class TRANSFORMATIONS_API ConvertMulticlassNmsToMulticlassNmsIE; class ngraph::pass::ConvertMulticlassNmsToMulticlassNmsIE: public ngraph::pass::MatcherPass { public: NGRAPH_RTTI_DECLARATION; - ConvertMulticlassNmsToMulticlassNmsIE(); + ConvertMulticlassNmsToMulticlassNmsIE(bool force_i32_output_type = true); }; diff --git a/inference-engine/src/transformations/include/transformations/op_conversions/convert_mvn1_to_mvn6.hpp b/src/common/transformations/include/transformations/op_conversions/convert_mvn1_to_mvn6.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/op_conversions/convert_mvn1_to_mvn6.hpp rename to src/common/transformations/include/transformations/op_conversions/convert_mvn1_to_mvn6.hpp diff --git a/inference-engine/src/transformations/include/transformations/op_conversions/convert_negative.hpp b/src/common/transformations/include/transformations/op_conversions/convert_negative.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/op_conversions/convert_negative.hpp rename to src/common/transformations/include/transformations/op_conversions/convert_negative.hpp diff --git a/inference-engine/src/transformations/include/transformations/op_conversions/convert_nms_to_nms_ie_internal.hpp b/src/common/transformations/include/transformations/op_conversions/convert_nms_to_nms_ie_internal.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/op_conversions/convert_nms_to_nms_ie_internal.hpp rename to src/common/transformations/include/transformations/op_conversions/convert_nms_to_nms_ie_internal.hpp diff --git a/inference-engine/src/transformations/include/transformations/op_conversions/convert_pad_to_group_conv.hpp b/src/common/transformations/include/transformations/op_conversions/convert_pad_to_group_conv.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/op_conversions/convert_pad_to_group_conv.hpp rename to src/common/transformations/include/transformations/op_conversions/convert_pad_to_group_conv.hpp diff --git a/inference-engine/src/transformations/include/transformations/op_conversions/convert_previous_nms_to_nms_5.hpp b/src/common/transformations/include/transformations/op_conversions/convert_previous_nms_to_nms_5.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/op_conversions/convert_previous_nms_to_nms_5.hpp rename to src/common/transformations/include/transformations/op_conversions/convert_previous_nms_to_nms_5.hpp diff --git a/src/common/transformations/include/transformations/op_conversions/convert_prior_box_v8_to_v0.hpp b/src/common/transformations/include/transformations/op_conversions/convert_prior_box_v8_to_v0.hpp new file mode 100644 index 00000000000..593ec33f818 --- /dev/null +++ b/src/common/transformations/include/transformations/op_conversions/convert_prior_box_v8_to_v0.hpp @@ -0,0 +1,26 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include +#include + +namespace ngraph { +namespace pass { + +class TRANSFORMATIONS_API ConvertPriorBox8To0; + +} // namespace pass +} // namespace ngraph + +/** + * @ingroup ie_transformation_common_api + * @brief ConvertPriorBox8To1 converts v8::PriorBox into v0::PriorBox. + */ +class ngraph::pass::ConvertPriorBox8To0 : public ngraph::pass::MatcherPass { +public: + NGRAPH_RTTI_DECLARATION; + ConvertPriorBox8To0(); +}; \ No newline at end of file diff --git a/inference-engine/src/transformations/include/transformations/op_conversions/convert_reduce_to_pooling.hpp b/src/common/transformations/include/transformations/op_conversions/convert_reduce_to_pooling.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/op_conversions/convert_reduce_to_pooling.hpp rename to src/common/transformations/include/transformations/op_conversions/convert_reduce_to_pooling.hpp diff --git a/inference-engine/src/transformations/include/transformations/op_conversions/convert_scatter_elements_to_scatter.hpp b/src/common/transformations/include/transformations/op_conversions/convert_scatter_elements_to_scatter.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/op_conversions/convert_scatter_elements_to_scatter.hpp rename to src/common/transformations/include/transformations/op_conversions/convert_scatter_elements_to_scatter.hpp diff --git a/inference-engine/src/transformations/include/transformations/op_conversions/convert_sequences_to_tensor_iterator.hpp b/src/common/transformations/include/transformations/op_conversions/convert_sequences_to_tensor_iterator.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/op_conversions/convert_sequences_to_tensor_iterator.hpp rename to src/common/transformations/include/transformations/op_conversions/convert_sequences_to_tensor_iterator.hpp diff --git a/inference-engine/src/transformations/include/transformations/op_conversions/convert_shapeof3.hpp b/src/common/transformations/include/transformations/op_conversions/convert_shapeof3.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/op_conversions/convert_shapeof3.hpp rename to src/common/transformations/include/transformations/op_conversions/convert_shapeof3.hpp diff --git a/inference-engine/src/transformations/include/transformations/op_conversions/convert_shuffle_channels3.hpp b/src/common/transformations/include/transformations/op_conversions/convert_shuffle_channels3.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/op_conversions/convert_shuffle_channels3.hpp rename to src/common/transformations/include/transformations/op_conversions/convert_shuffle_channels3.hpp diff --git a/inference-engine/src/transformations/include/transformations/op_conversions/convert_slice_to_strided_slice.hpp b/src/common/transformations/include/transformations/op_conversions/convert_slice_to_strided_slice.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/op_conversions/convert_slice_to_strided_slice.hpp rename to src/common/transformations/include/transformations/op_conversions/convert_slice_to_strided_slice.hpp diff --git a/inference-engine/src/transformations/include/transformations/op_conversions/convert_space_to_batch.hpp b/src/common/transformations/include/transformations/op_conversions/convert_space_to_batch.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/op_conversions/convert_space_to_batch.hpp rename to src/common/transformations/include/transformations/op_conversions/convert_space_to_batch.hpp diff --git a/inference-engine/src/transformations/include/transformations/op_conversions/convert_space_to_depth.hpp b/src/common/transformations/include/transformations/op_conversions/convert_space_to_depth.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/op_conversions/convert_space_to_depth.hpp rename to src/common/transformations/include/transformations/op_conversions/convert_space_to_depth.hpp diff --git a/inference-engine/src/transformations/include/transformations/op_conversions/convert_subtract.hpp b/src/common/transformations/include/transformations/op_conversions/convert_subtract.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/op_conversions/convert_subtract.hpp rename to src/common/transformations/include/transformations/op_conversions/convert_subtract.hpp diff --git a/inference-engine/src/transformations/include/transformations/op_conversions/convert_ti_to_sequences.hpp b/src/common/transformations/include/transformations/op_conversions/convert_ti_to_sequences.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/op_conversions/convert_ti_to_sequences.hpp rename to src/common/transformations/include/transformations/op_conversions/convert_ti_to_sequences.hpp diff --git a/inference-engine/src/transformations/include/transformations/op_conversions/convert_topk3.hpp b/src/common/transformations/include/transformations/op_conversions/convert_topk3.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/op_conversions/convert_topk3.hpp rename to src/common/transformations/include/transformations/op_conversions/convert_topk3.hpp diff --git a/inference-engine/src/transformations/include/transformations/op_conversions/einsum_decomposition.hpp b/src/common/transformations/include/transformations/op_conversions/einsum_decomposition.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/op_conversions/einsum_decomposition.hpp rename to src/common/transformations/include/transformations/op_conversions/einsum_decomposition.hpp diff --git a/inference-engine/src/transformations/include/transformations/op_conversions/fq_decomposition.hpp b/src/common/transformations/include/transformations/op_conversions/fq_decomposition.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/op_conversions/fq_decomposition.hpp rename to src/common/transformations/include/transformations/op_conversions/fq_decomposition.hpp diff --git a/inference-engine/src/transformations/include/transformations/op_conversions/gather_normalize_negative_indices.hpp b/src/common/transformations/include/transformations/op_conversions/gather_normalize_negative_indices.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/op_conversions/gather_normalize_negative_indices.hpp rename to src/common/transformations/include/transformations/op_conversions/gather_normalize_negative_indices.hpp diff --git a/inference-engine/src/transformations/include/transformations/op_conversions/gelu7_downgrade.hpp b/src/common/transformations/include/transformations/op_conversions/gelu7_downgrade.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/op_conversions/gelu7_downgrade.hpp rename to src/common/transformations/include/transformations/op_conversions/gelu7_downgrade.hpp diff --git a/inference-engine/src/transformations/include/transformations/op_conversions/gru_cell_decomposition.hpp b/src/common/transformations/include/transformations/op_conversions/gru_cell_decomposition.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/op_conversions/gru_cell_decomposition.hpp rename to src/common/transformations/include/transformations/op_conversions/gru_cell_decomposition.hpp diff --git a/inference-engine/src/transformations/include/transformations/op_conversions/hsigmoid_decomposition.hpp b/src/common/transformations/include/transformations/op_conversions/hsigmoid_decomposition.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/op_conversions/hsigmoid_decomposition.hpp rename to src/common/transformations/include/transformations/op_conversions/hsigmoid_decomposition.hpp diff --git a/inference-engine/src/transformations/include/transformations/op_conversions/hswish_decomposition.hpp b/src/common/transformations/include/transformations/op_conversions/hswish_decomposition.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/op_conversions/hswish_decomposition.hpp rename to src/common/transformations/include/transformations/op_conversions/hswish_decomposition.hpp diff --git a/inference-engine/src/transformations/include/transformations/op_conversions/log_softmax_decomposition.hpp b/src/common/transformations/include/transformations/op_conversions/log_softmax_decomposition.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/op_conversions/log_softmax_decomposition.hpp rename to src/common/transformations/include/transformations/op_conversions/log_softmax_decomposition.hpp diff --git a/inference-engine/src/transformations/include/transformations/op_conversions/lstm_cell_decomposition.hpp b/src/common/transformations/include/transformations/op_conversions/lstm_cell_decomposition.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/op_conversions/lstm_cell_decomposition.hpp rename to src/common/transformations/include/transformations/op_conversions/lstm_cell_decomposition.hpp diff --git a/inference-engine/src/transformations/include/transformations/op_conversions/mvn6_decomposition.hpp b/src/common/transformations/include/transformations/op_conversions/mvn6_decomposition.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/op_conversions/mvn6_decomposition.hpp rename to src/common/transformations/include/transformations/op_conversions/mvn6_decomposition.hpp diff --git a/inference-engine/src/transformations/include/transformations/op_conversions/normalize_l2_decomposition.hpp b/src/common/transformations/include/transformations/op_conversions/normalize_l2_decomposition.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/op_conversions/normalize_l2_decomposition.hpp rename to src/common/transformations/include/transformations/op_conversions/normalize_l2_decomposition.hpp diff --git a/inference-engine/src/transformations/include/transformations/op_conversions/reduce_l1_decomposition.hpp b/src/common/transformations/include/transformations/op_conversions/reduce_l1_decomposition.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/op_conversions/reduce_l1_decomposition.hpp rename to src/common/transformations/include/transformations/op_conversions/reduce_l1_decomposition.hpp diff --git a/inference-engine/src/transformations/include/transformations/op_conversions/reduce_l2_decomposition.hpp b/src/common/transformations/include/transformations/op_conversions/reduce_l2_decomposition.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/op_conversions/reduce_l2_decomposition.hpp rename to src/common/transformations/include/transformations/op_conversions/reduce_l2_decomposition.hpp diff --git a/inference-engine/src/transformations/include/transformations/op_conversions/rnn_cell_decomposition.hpp b/src/common/transformations/include/transformations/op_conversions/rnn_cell_decomposition.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/op_conversions/rnn_cell_decomposition.hpp rename to src/common/transformations/include/transformations/op_conversions/rnn_cell_decomposition.hpp diff --git a/inference-engine/src/transformations/include/transformations/op_conversions/simplify_ctc_greedy_decoder_seq_len.hpp b/src/common/transformations/include/transformations/op_conversions/simplify_ctc_greedy_decoder_seq_len.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/op_conversions/simplify_ctc_greedy_decoder_seq_len.hpp rename to src/common/transformations/include/transformations/op_conversions/simplify_ctc_greedy_decoder_seq_len.hpp diff --git a/inference-engine/src/transformations/include/transformations/op_conversions/softmax_decomposition.hpp b/src/common/transformations/include/transformations/op_conversions/softmax_decomposition.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/op_conversions/softmax_decomposition.hpp rename to src/common/transformations/include/transformations/op_conversions/softmax_decomposition.hpp diff --git a/inference-engine/src/transformations/include/transformations/op_conversions/softplus_decomposition.hpp b/src/common/transformations/include/transformations/op_conversions/softplus_decomposition.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/op_conversions/softplus_decomposition.hpp rename to src/common/transformations/include/transformations/op_conversions/softplus_decomposition.hpp diff --git a/inference-engine/src/transformations/include/transformations/opset_conversions/convert_opset2_to_opset1.hpp b/src/common/transformations/include/transformations/opset_conversions/convert_opset2_to_opset1.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/opset_conversions/convert_opset2_to_opset1.hpp rename to src/common/transformations/include/transformations/opset_conversions/convert_opset2_to_opset1.hpp diff --git a/inference-engine/src/transformations/include/transformations/opset_conversions/convert_opset3_to_opset2.hpp b/src/common/transformations/include/transformations/opset_conversions/convert_opset3_to_opset2.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/opset_conversions/convert_opset3_to_opset2.hpp rename to src/common/transformations/include/transformations/opset_conversions/convert_opset3_to_opset2.hpp diff --git a/inference-engine/src/transformations/include/transformations/rt_info/attributes.hpp b/src/common/transformations/include/transformations/rt_info/attributes.hpp similarity index 77% rename from inference-engine/src/transformations/include/transformations/rt_info/attributes.hpp rename to src/common/transformations/include/transformations/rt_info/attributes.hpp index 0866171601d..11a0d515ccb 100644 --- a/inference-engine/src/transformations/include/transformations/rt_info/attributes.hpp +++ b/src/common/transformations/include/transformations/rt_info/attributes.hpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -31,15 +32,17 @@ public: Attributes(); ~Attributes(); - Variant* create_by_type_info(const ov::DiscreteTypeInfo& type_info); + std::shared_ptr create_by_type_info(const ov::DiscreteTypeInfo& type_info); private: template void register_factory() { - m_factory_registry.register_factory(ngraph::FactoryRegistry::template get_default_factory()); + m_factory_registry.emplace(T::get_type_info_static(), [] { + return std::make_shared(); + }); } - ngraph::FactoryRegistry m_factory_registry; + std::unordered_map()>> m_factory_registry; }; } // namespace pass } // namespace ov diff --git a/inference-engine/src/transformations/include/transformations/rt_info/decompression.hpp b/src/common/transformations/include/transformations/rt_info/decompression.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/rt_info/decompression.hpp rename to src/common/transformations/include/transformations/rt_info/decompression.hpp diff --git a/inference-engine/src/transformations/include/transformations/rt_info/disable_constant_folding.hpp b/src/common/transformations/include/transformations/rt_info/disable_constant_folding.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/rt_info/disable_constant_folding.hpp rename to src/common/transformations/include/transformations/rt_info/disable_constant_folding.hpp diff --git a/inference-engine/src/transformations/include/transformations/rt_info/disable_fp16_compression.hpp b/src/common/transformations/include/transformations/rt_info/disable_fp16_compression.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/rt_info/disable_fp16_compression.hpp rename to src/common/transformations/include/transformations/rt_info/disable_fp16_compression.hpp diff --git a/inference-engine/src/transformations/include/transformations/rt_info/fused_names_attribute.hpp b/src/common/transformations/include/transformations/rt_info/fused_names_attribute.hpp similarity index 93% rename from inference-engine/src/transformations/include/transformations/rt_info/fused_names_attribute.hpp rename to src/common/transformations/include/transformations/rt_info/fused_names_attribute.hpp index c80a4b1536b..98ab5b7ae9f 100644 --- a/inference-engine/src/transformations/include/transformations/rt_info/fused_names_attribute.hpp +++ b/src/common/transformations/include/transformations/rt_info/fused_names_attribute.hpp @@ -96,9 +96,9 @@ public: VariantWrapper(const value_type &value) : VariantImpl(value) {} - std::shared_ptr merge(const ngraph::NodeVector & nodes) override; + Any merge(const ngraph::NodeVector & nodes) override; - std::shared_ptr init(const std::shared_ptr & node) override; + Any init(const std::shared_ptr & node) override; bool visit_attributes(AttributeVisitor & visitor) override; }; diff --git a/inference-engine/src/transformations/include/transformations/rt_info/nms_selected_indices.hpp b/src/common/transformations/include/transformations/rt_info/nms_selected_indices.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/rt_info/nms_selected_indices.hpp rename to src/common/transformations/include/transformations/rt_info/nms_selected_indices.hpp diff --git a/inference-engine/src/transformations/include/transformations/rt_info/old_api_map_element_type_attribute.hpp b/src/common/transformations/include/transformations/rt_info/old_api_map_element_type_attribute.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/rt_info/old_api_map_element_type_attribute.hpp rename to src/common/transformations/include/transformations/rt_info/old_api_map_element_type_attribute.hpp diff --git a/inference-engine/src/transformations/include/transformations/rt_info/old_api_map_order_attribute.hpp b/src/common/transformations/include/transformations/rt_info/old_api_map_order_attribute.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/rt_info/old_api_map_order_attribute.hpp rename to src/common/transformations/include/transformations/rt_info/old_api_map_order_attribute.hpp diff --git a/inference-engine/src/transformations/include/transformations/rt_info/primitives_priority_attribute.hpp b/src/common/transformations/include/transformations/rt_info/primitives_priority_attribute.hpp similarity index 85% rename from inference-engine/src/transformations/include/transformations/rt_info/primitives_priority_attribute.hpp rename to src/common/transformations/include/transformations/rt_info/primitives_priority_attribute.hpp index eb387a57762..49ccfaf674f 100644 --- a/inference-engine/src/transformations/include/transformations/rt_info/primitives_priority_attribute.hpp +++ b/src/common/transformations/include/transformations/rt_info/primitives_priority_attribute.hpp @@ -32,11 +32,13 @@ public: PrimitivesPriority() = default; + ~PrimitivesPriority() override = default; + PrimitivesPriority(const value_type &value) : VariantImpl(value) {} - std::shared_ptr merge(const ngraph::NodeVector & nodes) override; + Any merge(const ngraph::NodeVector & nodes) override; - std::shared_ptr init(const std::shared_ptr & node) override; + Any init(const std::shared_ptr & node) override; bool visit_attributes(AttributeVisitor & visitor) override; }; diff --git a/inference-engine/src/transformations/include/transformations/rt_info/strides_property.hpp b/src/common/transformations/include/transformations/rt_info/strides_property.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/rt_info/strides_property.hpp rename to src/common/transformations/include/transformations/rt_info/strides_property.hpp diff --git a/inference-engine/src/transformations/include/transformations/serialize.hpp b/src/common/transformations/include/transformations/serialize.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/serialize.hpp rename to src/common/transformations/include/transformations/serialize.hpp diff --git a/inference-engine/src/transformations/include/transformations/smart_reshape/matmul_sr.hpp b/src/common/transformations/include/transformations/smart_reshape/matmul_sr.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/smart_reshape/matmul_sr.hpp rename to src/common/transformations/include/transformations/smart_reshape/matmul_sr.hpp diff --git a/inference-engine/src/transformations/include/transformations/smart_reshape/mimic_set_batch_size.hpp b/src/common/transformations/include/transformations/smart_reshape/mimic_set_batch_size.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/smart_reshape/mimic_set_batch_size.hpp rename to src/common/transformations/include/transformations/smart_reshape/mimic_set_batch_size.hpp diff --git a/inference-engine/src/transformations/include/transformations/smart_reshape/proposal_scales_stridedslice.hpp b/src/common/transformations/include/transformations/smart_reshape/proposal_scales_stridedslice.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/smart_reshape/proposal_scales_stridedslice.hpp rename to src/common/transformations/include/transformations/smart_reshape/proposal_scales_stridedslice.hpp diff --git a/inference-engine/src/transformations/include/transformations/smart_reshape/reshape_to_1D.hpp b/src/common/transformations/include/transformations/smart_reshape/reshape_to_1D.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/smart_reshape/reshape_to_1D.hpp rename to src/common/transformations/include/transformations/smart_reshape/reshape_to_1D.hpp diff --git a/inference-engine/src/transformations/include/transformations/smart_reshape/set_batch_size.hpp b/src/common/transformations/include/transformations/smart_reshape/set_batch_size.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/smart_reshape/set_batch_size.hpp rename to src/common/transformations/include/transformations/smart_reshape/set_batch_size.hpp diff --git a/inference-engine/src/transformations/include/transformations/smart_reshape/smart_reshape.hpp b/src/common/transformations/include/transformations/smart_reshape/smart_reshape.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/smart_reshape/smart_reshape.hpp rename to src/common/transformations/include/transformations/smart_reshape/smart_reshape.hpp diff --git a/inference-engine/src/transformations/include/transformations/smart_reshape/strided_slice_squeeze.hpp b/src/common/transformations/include/transformations/smart_reshape/strided_slice_squeeze.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/smart_reshape/strided_slice_squeeze.hpp rename to src/common/transformations/include/transformations/smart_reshape/strided_slice_squeeze.hpp diff --git a/inference-engine/src/transformations/include/transformations/utils/utils.hpp b/src/common/transformations/include/transformations/utils/utils.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations/utils/utils.hpp rename to src/common/transformations/include/transformations/utils/utils.hpp diff --git a/inference-engine/src/transformations/include/transformations_visibility.hpp b/src/common/transformations/include/transformations_visibility.hpp similarity index 100% rename from inference-engine/src/transformations/include/transformations_visibility.hpp rename to src/common/transformations/include/transformations_visibility.hpp diff --git a/inference-engine/src/transformations/src/itt.hpp b/src/common/transformations/src/itt.hpp similarity index 100% rename from inference-engine/src/transformations/src/itt.hpp rename to src/common/transformations/src/itt.hpp diff --git a/inference-engine/src/transformations/src/ngraph_ops/convolution_ie.cpp b/src/common/transformations/src/ngraph_ops/convolution_ie.cpp similarity index 100% rename from inference-engine/src/transformations/src/ngraph_ops/convolution_ie.cpp rename to src/common/transformations/src/ngraph_ops/convolution_ie.cpp diff --git a/inference-engine/src/transformations/src/ngraph_ops/deconvolution_ie.cpp b/src/common/transformations/src/ngraph_ops/deconvolution_ie.cpp similarity index 100% rename from inference-engine/src/transformations/src/ngraph_ops/deconvolution_ie.cpp rename to src/common/transformations/src/ngraph_ops/deconvolution_ie.cpp diff --git a/inference-engine/src/transformations/src/ngraph_ops/nms_ie_internal.cpp b/src/common/transformations/src/ngraph_ops/nms_ie_internal.cpp similarity index 100% rename from inference-engine/src/transformations/src/ngraph_ops/nms_ie_internal.cpp rename to src/common/transformations/src/ngraph_ops/nms_ie_internal.cpp diff --git a/inference-engine/src/transformations/src/ngraph_ops/nms_static_shape_ie.cpp b/src/common/transformations/src/ngraph_ops/nms_static_shape_ie.cpp similarity index 100% rename from inference-engine/src/transformations/src/ngraph_ops/nms_static_shape_ie.cpp rename to src/common/transformations/src/ngraph_ops/nms_static_shape_ie.cpp diff --git a/inference-engine/src/transformations/src/precomp.hpp b/src/common/transformations/src/precomp.hpp similarity index 100% rename from inference-engine/src/transformations/src/precomp.hpp rename to src/common/transformations/src/precomp.hpp diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/add_fake_quantize_fusion.cpp b/src/common/transformations/src/transformations/common_optimizations/add_fake_quantize_fusion.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/common_optimizations/add_fake_quantize_fusion.cpp rename to src/common/transformations/src/transformations/common_optimizations/add_fake_quantize_fusion.cpp diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/algebraic_simplification.cpp b/src/common/transformations/src/transformations/common_optimizations/algebraic_simplification.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/common_optimizations/algebraic_simplification.cpp rename to src/common/transformations/src/transformations/common_optimizations/algebraic_simplification.cpp diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/batch_to_space_fusion.cpp b/src/common/transformations/src/transformations/common_optimizations/batch_to_space_fusion.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/common_optimizations/batch_to_space_fusion.cpp rename to src/common/transformations/src/transformations/common_optimizations/batch_to_space_fusion.cpp diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/binarize_weights.cpp b/src/common/transformations/src/transformations/common_optimizations/binarize_weights.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/common_optimizations/binarize_weights.cpp rename to src/common/transformations/src/transformations/common_optimizations/binarize_weights.cpp diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/broadcast_elementwise_fusion.cpp b/src/common/transformations/src/transformations/common_optimizations/broadcast_elementwise_fusion.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/common_optimizations/broadcast_elementwise_fusion.cpp rename to src/common/transformations/src/transformations/common_optimizations/broadcast_elementwise_fusion.cpp diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/clamp_fusion.cpp b/src/common/transformations/src/transformations/common_optimizations/clamp_fusion.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/common_optimizations/clamp_fusion.cpp rename to src/common/transformations/src/transformations/common_optimizations/clamp_fusion.cpp diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/common_optimizations.cpp b/src/common/transformations/src/transformations/common_optimizations/common_optimizations.cpp similarity index 98% rename from inference-engine/src/transformations/src/transformations/common_optimizations/common_optimizations.cpp rename to src/common/transformations/src/transformations/common_optimizations/common_optimizations.cpp index a0456b926e1..ed32b6a1ae5 100644 --- a/inference-engine/src/transformations/src/transformations/common_optimizations/common_optimizations.cpp +++ b/src/common/transformations/src/transformations/common_optimizations/common_optimizations.cpp @@ -81,6 +81,7 @@ #include "transformations/op_conversions/convert_deformable_conv_v8_to_v1.hpp" #include "transformations/op_conversions/convert_maxpool_downgrade.hpp" #include "transformations/disable_decompression_convert_constant_folding.hpp" +#include "transformations/op_conversions/convert_prior_box_v8_to_v0.hpp" #include #include @@ -174,6 +175,7 @@ bool ngraph::pass::CommonOptimizations::run_on_function(std::shared_ptr(); manager.register_pass(); manager.register_pass(); + manager.register_pass(); // not plugins implemented priorbox8 auto fq_fusions = manager.register_pass(); fq_fusions->add_matcher(); diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/compress_float_constants.cpp b/src/common/transformations/src/transformations/common_optimizations/compress_float_constants.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/common_optimizations/compress_float_constants.cpp rename to src/common/transformations/src/transformations/common_optimizations/compress_float_constants.cpp diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/conv_bias_fusion.cpp b/src/common/transformations/src/transformations/common_optimizations/conv_bias_fusion.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/common_optimizations/conv_bias_fusion.cpp rename to src/common/transformations/src/transformations/common_optimizations/conv_bias_fusion.cpp diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/conv_mul_fusion.cpp b/src/common/transformations/src/transformations/common_optimizations/conv_mul_fusion.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/common_optimizations/conv_mul_fusion.cpp rename to src/common/transformations/src/transformations/common_optimizations/conv_mul_fusion.cpp diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/conv_to_binary_conv.cpp b/src/common/transformations/src/transformations/common_optimizations/conv_to_binary_conv.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/common_optimizations/conv_to_binary_conv.cpp rename to src/common/transformations/src/transformations/common_optimizations/conv_to_binary_conv.cpp diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/convert_compression_only_to_legacy.cpp b/src/common/transformations/src/transformations/common_optimizations/convert_compression_only_to_legacy.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/common_optimizations/convert_compression_only_to_legacy.cpp rename to src/common/transformations/src/transformations/common_optimizations/convert_compression_only_to_legacy.cpp diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/convert_nms_gather_path_to_unsigned.cpp b/src/common/transformations/src/transformations/common_optimizations/convert_nms_gather_path_to_unsigned.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/common_optimizations/convert_nms_gather_path_to_unsigned.cpp rename to src/common/transformations/src/transformations/common_optimizations/convert_nms_gather_path_to_unsigned.cpp diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/convert_quantize_dequantize.cpp b/src/common/transformations/src/transformations/common_optimizations/convert_quantize_dequantize.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/common_optimizations/convert_quantize_dequantize.cpp rename to src/common/transformations/src/transformations/common_optimizations/convert_quantize_dequantize.cpp diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/depth_to_space_fusion.cpp b/src/common/transformations/src/transformations/common_optimizations/depth_to_space_fusion.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/common_optimizations/depth_to_space_fusion.cpp rename to src/common/transformations/src/transformations/common_optimizations/depth_to_space_fusion.cpp diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/dilated_convolution_converter.cpp b/src/common/transformations/src/transformations/common_optimizations/dilated_convolution_converter.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/common_optimizations/dilated_convolution_converter.cpp rename to src/common/transformations/src/transformations/common_optimizations/dilated_convolution_converter.cpp diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/disable_random_uniform_constant_folding.cpp b/src/common/transformations/src/transformations/common_optimizations/disable_random_uniform_constant_folding.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/common_optimizations/disable_random_uniform_constant_folding.cpp rename to src/common/transformations/src/transformations/common_optimizations/disable_random_uniform_constant_folding.cpp diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/disable_shapeof_constant_folding.cpp b/src/common/transformations/src/transformations/common_optimizations/disable_shapeof_constant_folding.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/common_optimizations/disable_shapeof_constant_folding.cpp rename to src/common/transformations/src/transformations/common_optimizations/disable_shapeof_constant_folding.cpp diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/divide_fusion.cpp b/src/common/transformations/src/transformations/common_optimizations/divide_fusion.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/common_optimizations/divide_fusion.cpp rename to src/common/transformations/src/transformations/common_optimizations/divide_fusion.cpp diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/dropout_with_random_uniform_replacer.cpp b/src/common/transformations/src/transformations/common_optimizations/dropout_with_random_uniform_replacer.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/common_optimizations/dropout_with_random_uniform_replacer.cpp rename to src/common/transformations/src/transformations/common_optimizations/dropout_with_random_uniform_replacer.cpp diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/eliminate_unsqueeze_gather.cpp b/src/common/transformations/src/transformations/common_optimizations/eliminate_unsqueeze_gather.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/common_optimizations/eliminate_unsqueeze_gather.cpp rename to src/common/transformations/src/transformations/common_optimizations/eliminate_unsqueeze_gather.cpp diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/fq_mul_fusion.cpp b/src/common/transformations/src/transformations/common_optimizations/fq_mul_fusion.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/common_optimizations/fq_mul_fusion.cpp rename to src/common/transformations/src/transformations/common_optimizations/fq_mul_fusion.cpp diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/fq_reshape_fusion.cpp b/src/common/transformations/src/transformations/common_optimizations/fq_reshape_fusion.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/common_optimizations/fq_reshape_fusion.cpp rename to src/common/transformations/src/transformations/common_optimizations/fq_reshape_fusion.cpp diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/gelu_fusion.cpp b/src/common/transformations/src/transformations/common_optimizations/gelu_fusion.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/common_optimizations/gelu_fusion.cpp rename to src/common/transformations/src/transformations/common_optimizations/gelu_fusion.cpp diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/hsigmoid_fusion.cpp b/src/common/transformations/src/transformations/common_optimizations/hsigmoid_fusion.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/common_optimizations/hsigmoid_fusion.cpp rename to src/common/transformations/src/transformations/common_optimizations/hsigmoid_fusion.cpp diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/hswish_fusion.cpp b/src/common/transformations/src/transformations/common_optimizations/hswish_fusion.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/common_optimizations/hswish_fusion.cpp rename to src/common/transformations/src/transformations/common_optimizations/hswish_fusion.cpp diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/interpolate_sequence_fusion.cpp b/src/common/transformations/src/transformations/common_optimizations/interpolate_sequence_fusion.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/common_optimizations/interpolate_sequence_fusion.cpp rename to src/common/transformations/src/transformations/common_optimizations/interpolate_sequence_fusion.cpp diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/leaky_relu_fusion.cpp b/src/common/transformations/src/transformations/common_optimizations/leaky_relu_fusion.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/common_optimizations/leaky_relu_fusion.cpp rename to src/common/transformations/src/transformations/common_optimizations/leaky_relu_fusion.cpp diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/lin_op_sequence_fusion.cpp b/src/common/transformations/src/transformations/common_optimizations/lin_op_sequence_fusion.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/common_optimizations/lin_op_sequence_fusion.cpp rename to src/common/transformations/src/transformations/common_optimizations/lin_op_sequence_fusion.cpp diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/mark_precision_sensitive_subgraphs.cpp b/src/common/transformations/src/transformations/common_optimizations/mark_precision_sensitive_subgraphs.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/common_optimizations/mark_precision_sensitive_subgraphs.cpp rename to src/common/transformations/src/transformations/common_optimizations/mark_precision_sensitive_subgraphs.cpp diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/mish_fusion.cpp b/src/common/transformations/src/transformations/common_optimizations/mish_fusion.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/common_optimizations/mish_fusion.cpp rename to src/common/transformations/src/transformations/common_optimizations/mish_fusion.cpp diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/moc_transformations.cpp b/src/common/transformations/src/transformations/common_optimizations/moc_transformations.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/common_optimizations/moc_transformations.cpp rename to src/common/transformations/src/transformations/common_optimizations/moc_transformations.cpp diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/mul_conv_fusion.cpp b/src/common/transformations/src/transformations/common_optimizations/mul_conv_fusion.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/common_optimizations/mul_conv_fusion.cpp rename to src/common/transformations/src/transformations/common_optimizations/mul_conv_fusion.cpp diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/mul_fake_quantize_fusion.cpp b/src/common/transformations/src/transformations/common_optimizations/mul_fake_quantize_fusion.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/common_optimizations/mul_fake_quantize_fusion.cpp rename to src/common/transformations/src/transformations/common_optimizations/mul_fake_quantize_fusion.cpp diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/mvn_fusion.cpp b/src/common/transformations/src/transformations/common_optimizations/mvn_fusion.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/common_optimizations/mvn_fusion.cpp rename to src/common/transformations/src/transformations/common_optimizations/mvn_fusion.cpp diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/nop_elimination.cpp b/src/common/transformations/src/transformations/common_optimizations/nop_elimination.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/common_optimizations/nop_elimination.cpp rename to src/common/transformations/src/transformations/common_optimizations/nop_elimination.cpp diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/normalize_l2_fusion.cpp b/src/common/transformations/src/transformations/common_optimizations/normalize_l2_fusion.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/common_optimizations/normalize_l2_fusion.cpp rename to src/common/transformations/src/transformations/common_optimizations/normalize_l2_fusion.cpp diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/optimize_strided_slice.cpp b/src/common/transformations/src/transformations/common_optimizations/optimize_strided_slice.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/common_optimizations/optimize_strided_slice.cpp rename to src/common/transformations/src/transformations/common_optimizations/optimize_strided_slice.cpp diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/pad_fusion.cpp b/src/common/transformations/src/transformations/common_optimizations/pad_fusion.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/common_optimizations/pad_fusion.cpp rename to src/common/transformations/src/transformations/common_optimizations/pad_fusion.cpp diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/pull_transpose_through_fq.cpp b/src/common/transformations/src/transformations/common_optimizations/pull_transpose_through_fq.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/common_optimizations/pull_transpose_through_fq.cpp rename to src/common/transformations/src/transformations/common_optimizations/pull_transpose_through_fq.cpp diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/random_uniform_fusion.cpp b/src/common/transformations/src/transformations/common_optimizations/random_uniform_fusion.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/common_optimizations/random_uniform_fusion.cpp rename to src/common/transformations/src/transformations/common_optimizations/random_uniform_fusion.cpp diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/relu_fake_quantize_fusion.cpp b/src/common/transformations/src/transformations/common_optimizations/relu_fake_quantize_fusion.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/common_optimizations/relu_fake_quantize_fusion.cpp rename to src/common/transformations/src/transformations/common_optimizations/relu_fake_quantize_fusion.cpp diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/remove_filtering_boxes_by_size.cpp b/src/common/transformations/src/transformations/common_optimizations/remove_filtering_boxes_by_size.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/common_optimizations/remove_filtering_boxes_by_size.cpp rename to src/common/transformations/src/transformations/common_optimizations/remove_filtering_boxes_by_size.cpp diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/reshape_sequence_fusion.cpp b/src/common/transformations/src/transformations/common_optimizations/reshape_sequence_fusion.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/common_optimizations/reshape_sequence_fusion.cpp rename to src/common/transformations/src/transformations/common_optimizations/reshape_sequence_fusion.cpp diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/shuffle_channels_fusion.cpp b/src/common/transformations/src/transformations/common_optimizations/shuffle_channels_fusion.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/common_optimizations/shuffle_channels_fusion.cpp rename to src/common/transformations/src/transformations/common_optimizations/shuffle_channels_fusion.cpp diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/simplify_shape_of_sub_graph.cpp b/src/common/transformations/src/transformations/common_optimizations/simplify_shape_of_sub_graph.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/common_optimizations/simplify_shape_of_sub_graph.cpp rename to src/common/transformations/src/transformations/common_optimizations/simplify_shape_of_sub_graph.cpp diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/softmax_fusion.cpp b/src/common/transformations/src/transformations/common_optimizations/softmax_fusion.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/common_optimizations/softmax_fusion.cpp rename to src/common/transformations/src/transformations/common_optimizations/softmax_fusion.cpp diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/softplus_fusion.cpp b/src/common/transformations/src/transformations/common_optimizations/softplus_fusion.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/common_optimizations/softplus_fusion.cpp rename to src/common/transformations/src/transformations/common_optimizations/softplus_fusion.cpp diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/softplus_to_mish_fusion.cpp b/src/common/transformations/src/transformations/common_optimizations/softplus_to_mish_fusion.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/common_optimizations/softplus_to_mish_fusion.cpp rename to src/common/transformations/src/transformations/common_optimizations/softplus_to_mish_fusion.cpp diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/space_to_batch_fusion.cpp b/src/common/transformations/src/transformations/common_optimizations/space_to_batch_fusion.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/common_optimizations/space_to_batch_fusion.cpp rename to src/common/transformations/src/transformations/common_optimizations/space_to_batch_fusion.cpp diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/split_concat_pair_to_interpolate_fusion.cpp b/src/common/transformations/src/transformations/common_optimizations/split_concat_pair_to_interpolate_fusion.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/common_optimizations/split_concat_pair_to_interpolate_fusion.cpp rename to src/common/transformations/src/transformations/common_optimizations/split_concat_pair_to_interpolate_fusion.cpp diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/split_squeeze_concat_fusion.cpp b/src/common/transformations/src/transformations/common_optimizations/split_squeeze_concat_fusion.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/common_optimizations/split_squeeze_concat_fusion.cpp rename to src/common/transformations/src/transformations/common_optimizations/split_squeeze_concat_fusion.cpp diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/strides_optimization.cpp b/src/common/transformations/src/transformations/common_optimizations/strides_optimization.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/common_optimizations/strides_optimization.cpp rename to src/common/transformations/src/transformations/common_optimizations/strides_optimization.cpp diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/subtract_fusion.cpp b/src/common/transformations/src/transformations/common_optimizations/subtract_fusion.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/common_optimizations/subtract_fusion.cpp rename to src/common/transformations/src/transformations/common_optimizations/subtract_fusion.cpp diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/swish_fusion.cpp b/src/common/transformations/src/transformations/common_optimizations/swish_fusion.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/common_optimizations/swish_fusion.cpp rename to src/common/transformations/src/transformations/common_optimizations/swish_fusion.cpp diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/transpose_sinking.cpp b/src/common/transformations/src/transformations/common_optimizations/transpose_sinking.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/common_optimizations/transpose_sinking.cpp rename to src/common/transformations/src/transformations/common_optimizations/transpose_sinking.cpp diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/transpose_to_reshape.cpp b/src/common/transformations/src/transformations/common_optimizations/transpose_to_reshape.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/common_optimizations/transpose_to_reshape.cpp rename to src/common/transformations/src/transformations/common_optimizations/transpose_to_reshape.cpp diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/weights_dequantize_to_fake_quantize.cpp b/src/common/transformations/src/transformations/common_optimizations/weights_dequantize_to_fake_quantize.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/common_optimizations/weights_dequantize_to_fake_quantize.cpp rename to src/common/transformations/src/transformations/common_optimizations/weights_dequantize_to_fake_quantize.cpp diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/wrap_interpolate_into_transposes.cpp b/src/common/transformations/src/transformations/common_optimizations/wrap_interpolate_into_transposes.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/common_optimizations/wrap_interpolate_into_transposes.cpp rename to src/common/transformations/src/transformations/common_optimizations/wrap_interpolate_into_transposes.cpp diff --git a/inference-engine/src/transformations/src/transformations/control_flow/unroll_if.cpp b/src/common/transformations/src/transformations/control_flow/unroll_if.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/control_flow/unroll_if.cpp rename to src/common/transformations/src/transformations/control_flow/unroll_if.cpp diff --git a/inference-engine/src/transformations/src/transformations/control_flow/unroll_tensor_iterator.cpp b/src/common/transformations/src/transformations/control_flow/unroll_tensor_iterator.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/control_flow/unroll_tensor_iterator.cpp rename to src/common/transformations/src/transformations/control_flow/unroll_tensor_iterator.cpp diff --git a/inference-engine/src/transformations/src/transformations/disable_decompression_convert_constant_folding.cpp b/src/common/transformations/src/transformations/disable_decompression_convert_constant_folding.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/disable_decompression_convert_constant_folding.cpp rename to src/common/transformations/src/transformations/disable_decompression_convert_constant_folding.cpp diff --git a/inference-engine/src/transformations/src/transformations/low_precision/disable_convert_constant_folding_on_const_path.cpp b/src/common/transformations/src/transformations/low_precision/disable_convert_constant_folding_on_const_path.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/low_precision/disable_convert_constant_folding_on_const_path.cpp rename to src/common/transformations/src/transformations/low_precision/disable_convert_constant_folding_on_const_path.cpp diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/batch_norm_decomposition.cpp b/src/common/transformations/src/transformations/op_conversions/batch_norm_decomposition.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/op_conversions/batch_norm_decomposition.cpp rename to src/common/transformations/src/transformations/op_conversions/batch_norm_decomposition.cpp diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/bidirectional_sequences_decomposition.cpp b/src/common/transformations/src/transformations/op_conversions/bidirectional_sequences_decomposition.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/op_conversions/bidirectional_sequences_decomposition.cpp rename to src/common/transformations/src/transformations/op_conversions/bidirectional_sequences_decomposition.cpp diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_batch_to_space.cpp b/src/common/transformations/src/transformations/op_conversions/convert_batch_to_space.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/op_conversions/convert_batch_to_space.cpp rename to src/common/transformations/src/transformations/op_conversions/convert_batch_to_space.cpp diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_broadcast3.cpp b/src/common/transformations/src/transformations/op_conversions/convert_broadcast3.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/op_conversions/convert_broadcast3.cpp rename to src/common/transformations/src/transformations/op_conversions/convert_broadcast3.cpp diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_broadcast_to_tiles.cpp b/src/common/transformations/src/transformations/op_conversions/convert_broadcast_to_tiles.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/op_conversions/convert_broadcast_to_tiles.cpp rename to src/common/transformations/src/transformations/op_conversions/convert_broadcast_to_tiles.cpp diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_convolutions.cpp b/src/common/transformations/src/transformations/op_conversions/convert_convolutions.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/op_conversions/convert_convolutions.cpp rename to src/common/transformations/src/transformations/op_conversions/convert_convolutions.cpp diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_deformable_conv_v8_to_v1.cpp b/src/common/transformations/src/transformations/op_conversions/convert_deformable_conv_v8_to_v1.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/op_conversions/convert_deformable_conv_v8_to_v1.cpp rename to src/common/transformations/src/transformations/op_conversions/convert_deformable_conv_v8_to_v1.cpp diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_depth_to_space.cpp b/src/common/transformations/src/transformations/op_conversions/convert_depth_to_space.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/op_conversions/convert_depth_to_space.cpp rename to src/common/transformations/src/transformations/op_conversions/convert_depth_to_space.cpp diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_divide.cpp b/src/common/transformations/src/transformations/op_conversions/convert_divide.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/op_conversions/convert_divide.cpp rename to src/common/transformations/src/transformations/op_conversions/convert_divide.cpp diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_gather_0d.cpp b/src/common/transformations/src/transformations/op_conversions/convert_gather_0d.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/op_conversions/convert_gather_0d.cpp rename to src/common/transformations/src/transformations/op_conversions/convert_gather_0d.cpp diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_gather_downgrade.cpp b/src/common/transformations/src/transformations/op_conversions/convert_gather_downgrade.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/op_conversions/convert_gather_downgrade.cpp rename to src/common/transformations/src/transformations/op_conversions/convert_gather_downgrade.cpp diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_gather_upgrade.cpp b/src/common/transformations/src/transformations/op_conversions/convert_gather_upgrade.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/op_conversions/convert_gather_upgrade.cpp rename to src/common/transformations/src/transformations/op_conversions/convert_gather_upgrade.cpp diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_gelu.cpp b/src/common/transformations/src/transformations/op_conversions/convert_gelu.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/op_conversions/convert_gelu.cpp rename to src/common/transformations/src/transformations/op_conversions/convert_gelu.cpp diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_interpolate1_to_interpolate4.cpp b/src/common/transformations/src/transformations/op_conversions/convert_interpolate1_to_interpolate4.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/op_conversions/convert_interpolate1_to_interpolate4.cpp rename to src/common/transformations/src/transformations/op_conversions/convert_interpolate1_to_interpolate4.cpp diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_matrix_nms_to_matrix_nms_ie.cpp b/src/common/transformations/src/transformations/op_conversions/convert_matrix_nms_to_matrix_nms_ie.cpp similarity index 83% rename from inference-engine/src/transformations/src/transformations/op_conversions/convert_matrix_nms_to_matrix_nms_ie.cpp rename to src/common/transformations/src/transformations/op_conversions/convert_matrix_nms_to_matrix_nms_ie.cpp index 34163fc4860..d52a290a957 100644 --- a/inference-engine/src/transformations/src/transformations/op_conversions/convert_matrix_nms_to_matrix_nms_ie.cpp +++ b/src/common/transformations/src/transformations/op_conversions/convert_matrix_nms_to_matrix_nms_ie.cpp @@ -18,13 +18,18 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertMatrixNmsToMatrixNmsIE, "ConvertMatrixNmsToMatrixNmsIE", 0); -ngraph::pass::ConvertMatrixNmsToMatrixNmsIE::ConvertMatrixNmsToMatrixNmsIE() { +ngraph::pass::ConvertMatrixNmsToMatrixNmsIE::ConvertMatrixNmsToMatrixNmsIE(bool force_i32_output_type) { MATCHER_SCOPE(ConvertMatrixNmsToMatrixNmsIE); auto nms = ngraph::pattern::wrap_type(); - ngraph::matcher_pass_callback callback = [](pattern::Matcher &m) { + ngraph::matcher_pass_callback callback = [=](pattern::Matcher &m) { auto nms = std::dynamic_pointer_cast(m.get_match_root()); - if (!nms) { + if (!nms || transformation_callback(nms)) { + return false; + } + + // if input shape is dynamic force the output shape must be dynamic too + if (nms->get_input_partial_shape(0).is_dynamic() || nms->get_input_partial_shape(1).is_dynamic()) { return false; } @@ -32,7 +37,7 @@ ngraph::pass::ConvertMatrixNmsToMatrixNmsIE::ConvertMatrixNmsToMatrixNmsIE() { // vector of new nGraph operations NodeVector new_ops; auto attrs = nms->get_attrs(); - attrs.output_type = element::i32; + attrs.output_type = force_i32_output_type ? element::i32 : nms->get_output_type(); auto nms_new = std::make_shared>( new_args.at(0), new_args.at(1), diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_maxpool_downgrade.cpp b/src/common/transformations/src/transformations/op_conversions/convert_maxpool_downgrade.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/op_conversions/convert_maxpool_downgrade.cpp rename to src/common/transformations/src/transformations/op_conversions/convert_maxpool_downgrade.cpp diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_minimum_to_power_and_max.cpp b/src/common/transformations/src/transformations/op_conversions/convert_minimum_to_power_and_max.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/op_conversions/convert_minimum_to_power_and_max.cpp rename to src/common/transformations/src/transformations/op_conversions/convert_minimum_to_power_and_max.cpp diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_mod.cpp b/src/common/transformations/src/transformations/op_conversions/convert_mod.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/op_conversions/convert_mod.cpp rename to src/common/transformations/src/transformations/op_conversions/convert_mod.cpp diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_multiclass_nms_to_multiclass_nms_ie.cpp b/src/common/transformations/src/transformations/op_conversions/convert_multiclass_nms_to_multiclass_nms_ie.cpp similarity index 83% rename from inference-engine/src/transformations/src/transformations/op_conversions/convert_multiclass_nms_to_multiclass_nms_ie.cpp rename to src/common/transformations/src/transformations/op_conversions/convert_multiclass_nms_to_multiclass_nms_ie.cpp index 1f236610e53..2c09e289337 100644 --- a/inference-engine/src/transformations/src/transformations/op_conversions/convert_multiclass_nms_to_multiclass_nms_ie.cpp +++ b/src/common/transformations/src/transformations/op_conversions/convert_multiclass_nms_to_multiclass_nms_ie.cpp @@ -18,13 +18,18 @@ NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertMulticlassNmsToMulticlassNmsIE, "ConvertMulticlassNmsToMulticlassNmsIE", 0); -ngraph::pass::ConvertMulticlassNmsToMulticlassNmsIE::ConvertMulticlassNmsToMulticlassNmsIE() { +ngraph::pass::ConvertMulticlassNmsToMulticlassNmsIE::ConvertMulticlassNmsToMulticlassNmsIE(bool force_i32_output_type) { MATCHER_SCOPE(ConvertMulticlassNmsToMulticlassNmsIE); auto nms = ngraph::pattern::wrap_type(); - ngraph::matcher_pass_callback callback = [](pattern::Matcher &m) { + ngraph::matcher_pass_callback callback = [=](pattern::Matcher &m) { auto nms = std::dynamic_pointer_cast(m.get_match_root()); - if (!nms) { + if (!nms || transformation_callback(nms)) { + return false; + } + + // if input shape is dynamic force the output shape must be dynamic too + if (nms->get_input_partial_shape(0).is_dynamic() || nms->get_input_partial_shape(1).is_dynamic()) { return false; } @@ -32,7 +37,7 @@ ngraph::pass::ConvertMulticlassNmsToMulticlassNmsIE::ConvertMulticlassNmsToMulti // vector of new nGraph operations NodeVector new_ops; auto attrs = nms->get_attrs(); - attrs.output_type = element::i32; + attrs.output_type = force_i32_output_type ? element::i32 : nms->get_output_type(); auto nms_new = std::make_shared>( new_args.at(0), diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_mvn1_to_mvn6.cpp b/src/common/transformations/src/transformations/op_conversions/convert_mvn1_to_mvn6.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/op_conversions/convert_mvn1_to_mvn6.cpp rename to src/common/transformations/src/transformations/op_conversions/convert_mvn1_to_mvn6.cpp diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_negative.cpp b/src/common/transformations/src/transformations/op_conversions/convert_negative.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/op_conversions/convert_negative.cpp rename to src/common/transformations/src/transformations/op_conversions/convert_negative.cpp diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_nms_to_nms_ie_internal.cpp b/src/common/transformations/src/transformations/op_conversions/convert_nms_to_nms_ie_internal.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/op_conversions/convert_nms_to_nms_ie_internal.cpp rename to src/common/transformations/src/transformations/op_conversions/convert_nms_to_nms_ie_internal.cpp diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_pad_to_group_conv.cpp b/src/common/transformations/src/transformations/op_conversions/convert_pad_to_group_conv.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/op_conversions/convert_pad_to_group_conv.cpp rename to src/common/transformations/src/transformations/op_conversions/convert_pad_to_group_conv.cpp diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_previous_nms_to_nms_5.cpp b/src/common/transformations/src/transformations/op_conversions/convert_previous_nms_to_nms_5.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/op_conversions/convert_previous_nms_to_nms_5.cpp rename to src/common/transformations/src/transformations/op_conversions/convert_previous_nms_to_nms_5.cpp diff --git a/src/common/transformations/src/transformations/op_conversions/convert_prior_box_v8_to_v0.cpp b/src/common/transformations/src/transformations/op_conversions/convert_prior_box_v8_to_v0.cpp new file mode 100644 index 00000000000..fb6b94ccd0f --- /dev/null +++ b/src/common/transformations/src/transformations/op_conversions/convert_prior_box_v8_to_v0.cpp @@ -0,0 +1,54 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "transformations/op_conversions/convert_prior_box_v8_to_v0.hpp" + +#include +#include +#include +#include + +#include "itt.hpp" + +NGRAPH_RTTI_DEFINITION(ngraph::pass::ConvertPriorBox8To0, "ConvertPriorBox8To0", 0); + +ngraph::pass::ConvertPriorBox8To0::ConvertPriorBox8To0() { + MATCHER_SCOPE(ConvertPriorBox8To0); + + auto prior_box_v8 = pattern::wrap_type(); + + ngraph::matcher_pass_callback callback = [=](pattern::Matcher& m) { + auto prior_box_v8_node = std::dynamic_pointer_cast(m.get_match_root()); + if (!prior_box_v8_node) + return false; + + ngraph::opset8::PriorBox::Attributes attrs_v8 = prior_box_v8_node->get_attrs(); + if (!attrs_v8.min_max_aspect_ratios_order) + return false; + + ngraph::opset1::PriorBox::Attributes attrs_v0; + attrs_v0.min_size = attrs_v8.min_size; + attrs_v0.max_size = attrs_v8.max_size; + attrs_v0.aspect_ratio = attrs_v8.aspect_ratio; + attrs_v0.density = attrs_v8.density; + attrs_v0.fixed_ratio = attrs_v8.fixed_ratio; + attrs_v0.fixed_size = attrs_v8.fixed_size; + attrs_v0.clip = attrs_v8.clip; + attrs_v0.flip = attrs_v8.flip; + attrs_v0.step = attrs_v8.step; + attrs_v0.offset = attrs_v8.offset; + attrs_v0.variance = attrs_v8.variance; + attrs_v0.scale_all_sizes = attrs_v8.scale_all_sizes; + + auto prior_box_v0 = std::make_shared(prior_box_v8_node->input_value(0), prior_box_v8_node->input_value(1), attrs_v0); + prior_box_v0->set_friendly_name(prior_box_v8_node->get_friendly_name()); + ngraph::copy_runtime_info(prior_box_v8_node, prior_box_v0); + ngraph::replace_node(prior_box_v8_node, prior_box_v0); + + return true; + }; + + auto m = std::make_shared(prior_box_v8, matcher_name); + register_matcher(m, callback); +} diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_reduce_to_pooling.cpp b/src/common/transformations/src/transformations/op_conversions/convert_reduce_to_pooling.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/op_conversions/convert_reduce_to_pooling.cpp rename to src/common/transformations/src/transformations/op_conversions/convert_reduce_to_pooling.cpp diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_scatter_elements_to_scatter.cpp b/src/common/transformations/src/transformations/op_conversions/convert_scatter_elements_to_scatter.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/op_conversions/convert_scatter_elements_to_scatter.cpp rename to src/common/transformations/src/transformations/op_conversions/convert_scatter_elements_to_scatter.cpp diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_sequences_to_tensor_iterator.cpp b/src/common/transformations/src/transformations/op_conversions/convert_sequences_to_tensor_iterator.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/op_conversions/convert_sequences_to_tensor_iterator.cpp rename to src/common/transformations/src/transformations/op_conversions/convert_sequences_to_tensor_iterator.cpp diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_shapeof3.cpp b/src/common/transformations/src/transformations/op_conversions/convert_shapeof3.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/op_conversions/convert_shapeof3.cpp rename to src/common/transformations/src/transformations/op_conversions/convert_shapeof3.cpp diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_shuffle_channels3.cpp b/src/common/transformations/src/transformations/op_conversions/convert_shuffle_channels3.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/op_conversions/convert_shuffle_channels3.cpp rename to src/common/transformations/src/transformations/op_conversions/convert_shuffle_channels3.cpp diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_slice_to_strided_slice.cpp b/src/common/transformations/src/transformations/op_conversions/convert_slice_to_strided_slice.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/op_conversions/convert_slice_to_strided_slice.cpp rename to src/common/transformations/src/transformations/op_conversions/convert_slice_to_strided_slice.cpp diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_space_to_batch.cpp b/src/common/transformations/src/transformations/op_conversions/convert_space_to_batch.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/op_conversions/convert_space_to_batch.cpp rename to src/common/transformations/src/transformations/op_conversions/convert_space_to_batch.cpp diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_space_to_depth.cpp b/src/common/transformations/src/transformations/op_conversions/convert_space_to_depth.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/op_conversions/convert_space_to_depth.cpp rename to src/common/transformations/src/transformations/op_conversions/convert_space_to_depth.cpp diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_subtract.cpp b/src/common/transformations/src/transformations/op_conversions/convert_subtract.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/op_conversions/convert_subtract.cpp rename to src/common/transformations/src/transformations/op_conversions/convert_subtract.cpp diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_ti_to_sequences.cpp b/src/common/transformations/src/transformations/op_conversions/convert_ti_to_sequences.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/op_conversions/convert_ti_to_sequences.cpp rename to src/common/transformations/src/transformations/op_conversions/convert_ti_to_sequences.cpp diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/convert_topk3.cpp b/src/common/transformations/src/transformations/op_conversions/convert_topk3.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/op_conversions/convert_topk3.cpp rename to src/common/transformations/src/transformations/op_conversions/convert_topk3.cpp diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/einsum_decomposition.cpp b/src/common/transformations/src/transformations/op_conversions/einsum_decomposition.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/op_conversions/einsum_decomposition.cpp rename to src/common/transformations/src/transformations/op_conversions/einsum_decomposition.cpp diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/fq_decomposition.cpp b/src/common/transformations/src/transformations/op_conversions/fq_decomposition.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/op_conversions/fq_decomposition.cpp rename to src/common/transformations/src/transformations/op_conversions/fq_decomposition.cpp diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/gather_normalize_negative_indices.cpp b/src/common/transformations/src/transformations/op_conversions/gather_normalize_negative_indices.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/op_conversions/gather_normalize_negative_indices.cpp rename to src/common/transformations/src/transformations/op_conversions/gather_normalize_negative_indices.cpp diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/gelu7_downgrade.cpp b/src/common/transformations/src/transformations/op_conversions/gelu7_downgrade.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/op_conversions/gelu7_downgrade.cpp rename to src/common/transformations/src/transformations/op_conversions/gelu7_downgrade.cpp diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/gru_cell_decomposition.cpp b/src/common/transformations/src/transformations/op_conversions/gru_cell_decomposition.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/op_conversions/gru_cell_decomposition.cpp rename to src/common/transformations/src/transformations/op_conversions/gru_cell_decomposition.cpp diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/hsigmoid_decomposition.cpp b/src/common/transformations/src/transformations/op_conversions/hsigmoid_decomposition.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/op_conversions/hsigmoid_decomposition.cpp rename to src/common/transformations/src/transformations/op_conversions/hsigmoid_decomposition.cpp diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/hswish_decomposition.cpp b/src/common/transformations/src/transformations/op_conversions/hswish_decomposition.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/op_conversions/hswish_decomposition.cpp rename to src/common/transformations/src/transformations/op_conversions/hswish_decomposition.cpp diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/log_softmax_decomposition.cpp b/src/common/transformations/src/transformations/op_conversions/log_softmax_decomposition.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/op_conversions/log_softmax_decomposition.cpp rename to src/common/transformations/src/transformations/op_conversions/log_softmax_decomposition.cpp diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/lstm_cell_decomposition.cpp b/src/common/transformations/src/transformations/op_conversions/lstm_cell_decomposition.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/op_conversions/lstm_cell_decomposition.cpp rename to src/common/transformations/src/transformations/op_conversions/lstm_cell_decomposition.cpp diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/mvn6_decomposition.cpp b/src/common/transformations/src/transformations/op_conversions/mvn6_decomposition.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/op_conversions/mvn6_decomposition.cpp rename to src/common/transformations/src/transformations/op_conversions/mvn6_decomposition.cpp diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/normalize_l2_decomposition.cpp b/src/common/transformations/src/transformations/op_conversions/normalize_l2_decomposition.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/op_conversions/normalize_l2_decomposition.cpp rename to src/common/transformations/src/transformations/op_conversions/normalize_l2_decomposition.cpp diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/reduce_l1_decomposition.cpp b/src/common/transformations/src/transformations/op_conversions/reduce_l1_decomposition.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/op_conversions/reduce_l1_decomposition.cpp rename to src/common/transformations/src/transformations/op_conversions/reduce_l1_decomposition.cpp diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/reduce_l2_decomposition.cpp b/src/common/transformations/src/transformations/op_conversions/reduce_l2_decomposition.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/op_conversions/reduce_l2_decomposition.cpp rename to src/common/transformations/src/transformations/op_conversions/reduce_l2_decomposition.cpp diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/rnn_cell_decomposition.cpp b/src/common/transformations/src/transformations/op_conversions/rnn_cell_decomposition.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/op_conversions/rnn_cell_decomposition.cpp rename to src/common/transformations/src/transformations/op_conversions/rnn_cell_decomposition.cpp diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/simplify_ctc_greedy_decoder_seq_len.cpp b/src/common/transformations/src/transformations/op_conversions/simplify_ctc_greedy_decoder_seq_len.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/op_conversions/simplify_ctc_greedy_decoder_seq_len.cpp rename to src/common/transformations/src/transformations/op_conversions/simplify_ctc_greedy_decoder_seq_len.cpp diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/softmax_decomposition.cpp b/src/common/transformations/src/transformations/op_conversions/softmax_decomposition.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/op_conversions/softmax_decomposition.cpp rename to src/common/transformations/src/transformations/op_conversions/softmax_decomposition.cpp diff --git a/inference-engine/src/transformations/src/transformations/op_conversions/softplus_decomposition.cpp b/src/common/transformations/src/transformations/op_conversions/softplus_decomposition.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/op_conversions/softplus_decomposition.cpp rename to src/common/transformations/src/transformations/op_conversions/softplus_decomposition.cpp diff --git a/inference-engine/src/transformations/src/transformations/opset_conversions/convert_opset2_to_opset1.cpp b/src/common/transformations/src/transformations/opset_conversions/convert_opset2_to_opset1.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/opset_conversions/convert_opset2_to_opset1.cpp rename to src/common/transformations/src/transformations/opset_conversions/convert_opset2_to_opset1.cpp diff --git a/inference-engine/src/transformations/src/transformations/opset_conversions/convert_opset3_to_opset2.cpp b/src/common/transformations/src/transformations/opset_conversions/convert_opset3_to_opset2.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/opset_conversions/convert_opset3_to_opset2.cpp rename to src/common/transformations/src/transformations/opset_conversions/convert_opset3_to_opset2.cpp diff --git a/inference-engine/src/transformations/src/transformations/rt_info/attributes.cpp b/src/common/transformations/src/transformations/rt_info/attributes.cpp similarity index 72% rename from inference-engine/src/transformations/src/transformations/rt_info/attributes.cpp rename to src/common/transformations/src/transformations/rt_info/attributes.cpp index c9201466bcd..641fc08d2be 100644 --- a/inference-engine/src/transformations/src/transformations/rt_info/attributes.cpp +++ b/src/common/transformations/src/transformations/rt_info/attributes.cpp @@ -18,8 +18,13 @@ ov::pass::Attributes::Attributes() { register_factory(); } -ov::Variant* ov::pass::Attributes::create_by_type_info(const ov::DiscreteTypeInfo& type_info) { - return m_factory_registry.create(type_info); +std::shared_ptr ov::pass::Attributes::create_by_type_info(const ov::DiscreteTypeInfo& type_info) { + auto it_type = m_factory_registry.find(type_info); + if (it_type != m_factory_registry.end()) { + return it_type->second(); + } else { + return {}; + } } ov::pass::Attributes::~Attributes() = default; diff --git a/inference-engine/src/transformations/src/transformations/rt_info/decompression.cpp b/src/common/transformations/src/transformations/rt_info/decompression.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/rt_info/decompression.cpp rename to src/common/transformations/src/transformations/rt_info/decompression.cpp diff --git a/inference-engine/src/transformations/src/transformations/rt_info/disable_fp16_compression.cpp b/src/common/transformations/src/transformations/rt_info/disable_fp16_compression.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/rt_info/disable_fp16_compression.cpp rename to src/common/transformations/src/transformations/rt_info/disable_fp16_compression.cpp diff --git a/inference-engine/src/transformations/src/transformations/rt_info/nms_selected_indices.cpp b/src/common/transformations/src/transformations/rt_info/nms_selected_indices.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/rt_info/nms_selected_indices.cpp rename to src/common/transformations/src/transformations/rt_info/nms_selected_indices.cpp diff --git a/inference-engine/src/transformations/src/transformations/rt_info/old_api_map_element_type_attribute.cpp b/src/common/transformations/src/transformations/rt_info/old_api_map_element_type_attribute.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/rt_info/old_api_map_element_type_attribute.cpp rename to src/common/transformations/src/transformations/rt_info/old_api_map_element_type_attribute.cpp diff --git a/inference-engine/src/transformations/src/transformations/rt_info/old_api_map_order_attribute.cpp b/src/common/transformations/src/transformations/rt_info/old_api_map_order_attribute.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/rt_info/old_api_map_order_attribute.cpp rename to src/common/transformations/src/transformations/rt_info/old_api_map_order_attribute.cpp diff --git a/inference-engine/src/transformations/src/transformations/rt_info/strides_property.cpp b/src/common/transformations/src/transformations/rt_info/strides_property.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/rt_info/strides_property.cpp rename to src/common/transformations/src/transformations/rt_info/strides_property.cpp diff --git a/inference-engine/src/transformations/src/transformations/utils/utils.cpp b/src/common/transformations/src/transformations/utils/utils.cpp similarity index 100% rename from inference-engine/src/transformations/src/transformations/utils/utils.cpp rename to src/common/transformations/src/transformations/utils/utils.cpp diff --git a/ngraph/.clang-format b/src/common/util/.clang-format similarity index 100% rename from ngraph/.clang-format rename to src/common/util/.clang-format diff --git a/openvino/util/CMakeLists.txt b/src/common/util/CMakeLists.txt similarity index 100% rename from openvino/util/CMakeLists.txt rename to src/common/util/CMakeLists.txt diff --git a/openvino/util/include/openvino/util/common_util.hpp b/src/common/util/include/openvino/util/common_util.hpp similarity index 100% rename from openvino/util/include/openvino/util/common_util.hpp rename to src/common/util/include/openvino/util/common_util.hpp diff --git a/openvino/util/include/openvino/util/env_util.hpp b/src/common/util/include/openvino/util/env_util.hpp similarity index 100% rename from openvino/util/include/openvino/util/env_util.hpp rename to src/common/util/include/openvino/util/env_util.hpp diff --git a/openvino/util/include/openvino/util/file_util.hpp b/src/common/util/include/openvino/util/file_util.hpp similarity index 100% rename from openvino/util/include/openvino/util/file_util.hpp rename to src/common/util/include/openvino/util/file_util.hpp diff --git a/openvino/util/include/openvino/util/log.hpp b/src/common/util/include/openvino/util/log.hpp similarity index 100% rename from openvino/util/include/openvino/util/log.hpp rename to src/common/util/include/openvino/util/log.hpp diff --git a/src/common/util/include/openvino/util/pp.hpp b/src/common/util/include/openvino/util/pp.hpp new file mode 100644 index 00000000000..935485a8e2d --- /dev/null +++ b/src/common/util/include/openvino/util/pp.hpp @@ -0,0 +1,50 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +/** + * @brief Set of macro used by openvino + * @file openvino/util/pp.hpp + */ + +#pragma once + +// Macros for string conversion +#define OV_PP_TOSTRING(...) OV_PP_TOSTRING_(__VA_ARGS__) +#define OV_PP_TOSTRING_(...) #__VA_ARGS__ + +#define OV_PP_EXPAND(X) X + +#define OV_PP_NARG(...) OV_PP_EXPAND(OV_PP_NARG_(__VA_ARGS__, OV_PP_RSEQ_N())) +#define OV_PP_NARG_(...) OV_PP_EXPAND(OV_PP_ARG_N(__VA_ARGS__)) +#define OV_PP_ARG_N(_0, _1, _2, _3, _4, N, ...) N +#define OV_PP_RSEQ_N() 0, 4, 3, 2, 1, 0 +#define OV_PP_NO_ARGS(NAME) , , , , + +// Macros for names concatenation +#define OV_PP_CAT_(x, y) x##y +#define OV_PP_CAT(x, y) OV_PP_CAT_(x, y) +#define OV_PP_CAT3_(x, y, z) x##y##z +#define OV_PP_CAT3(x, y, z) OV_PP_CAT3_(x, y, z) +#define OV_PP_CAT4_(x, y, z, w) x##y##z##w +#define OV_PP_CAT4(x, y, z, w) OV_PP_CAT4_(x, y, z, w) + +#define OV_PP_OVERLOAD(NAME, ...) \ + OV_PP_EXPAND(OV_PP_CAT3(NAME, _, OV_PP_EXPAND(OV_PP_NARG(OV_PP_NO_ARGS __VA_ARGS__(NAME))))(__VA_ARGS__)) + +// Placeholder for first macro argument +#define OV_PP_ARG_PLACEHOLDER_1 0, + +// This macro returns second argument, first argument is ignored +#define OV_PP_SECOND_ARG(...) OV_PP_EXPAND(OV_PP_SECOND_ARG_(__VA_ARGS__, 0)) +#define OV_PP_SECOND_ARG_(...) OV_PP_EXPAND(OV_PP_SECOND_ARG_GET(__VA_ARGS__)) +#define OV_PP_SECOND_ARG_GET(ignored, val, ...) val + +// Return macro argument value +#define OV_PP_IS_ENABLED(x) OV_PP_IS_ENABLED1(x) + +// Generate junk macro or {0, } sequence if val is 1 +#define OV_PP_IS_ENABLED1(val) OV_PP_IS_ENABLED2(OV_PP_CAT(OV_PP_ARG_PLACEHOLDER_, val)) + +// Return second argument from possible sequences {1, 0}, {0, 1, 0} +#define OV_PP_IS_ENABLED2(arg1_or_junk) OV_PP_SECOND_ARG(arg1_or_junk 1, 0) diff --git a/openvino/util/include/openvino/util/shared_object.hpp b/src/common/util/include/openvino/util/shared_object.hpp similarity index 100% rename from openvino/util/include/openvino/util/shared_object.hpp rename to src/common/util/include/openvino/util/shared_object.hpp diff --git a/openvino/util/include/openvino/util/util.hpp b/src/common/util/include/openvino/util/util.hpp similarity index 100% rename from openvino/util/include/openvino/util/util.hpp rename to src/common/util/include/openvino/util/util.hpp diff --git a/openvino/util/src/common_util.cpp b/src/common/util/src/common_util.cpp similarity index 100% rename from openvino/util/src/common_util.cpp rename to src/common/util/src/common_util.cpp diff --git a/openvino/util/src/env_util.cpp b/src/common/util/src/env_util.cpp similarity index 100% rename from openvino/util/src/env_util.cpp rename to src/common/util/src/env_util.cpp diff --git a/openvino/util/src/file_util.cpp b/src/common/util/src/file_util.cpp similarity index 100% rename from openvino/util/src/file_util.cpp rename to src/common/util/src/file_util.cpp diff --git a/openvino/util/src/log.cpp b/src/common/util/src/log.cpp similarity index 100% rename from openvino/util/src/log.cpp rename to src/common/util/src/log.cpp diff --git a/openvino/util/src/os/lin/lin_shared_object_loader.cpp b/src/common/util/src/os/lin/lin_shared_object_loader.cpp similarity index 100% rename from openvino/util/src/os/lin/lin_shared_object_loader.cpp rename to src/common/util/src/os/lin/lin_shared_object_loader.cpp diff --git a/openvino/util/src/os/win/win_shared_object_loader.cpp b/src/common/util/src/os/win/win_shared_object_loader.cpp similarity index 100% rename from openvino/util/src/os/win/win_shared_object_loader.cpp rename to src/common/util/src/os/win/win_shared_object_loader.cpp diff --git a/ngraph/core/CMakeLists.txt b/src/core/CMakeLists.txt similarity index 94% rename from ngraph/core/CMakeLists.txt rename to src/core/CMakeLists.txt index 3d566271bbe..e28b939a82d 100644 --- a/ngraph/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -4,6 +4,8 @@ add_definitions(-DIN_NGRAPH_LIBRARY) +set(NGRAPH_INCLUDE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/include) + if(CMAKE_COMPILER_IS_GNUCXX) ie_add_compiler_flags(-Wmissing-declarations) endif() @@ -134,14 +136,14 @@ install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ PATTERN "*.h") configure_package_config_file(${OpenVINO_SOURCE_DIR}/cmake/templates/ngraphConfig.cmake.in - ${ngraph_BINARY_DIR}/ngraphConfig.cmake + ${CMAKE_CURRENT_BINARY_DIR}/ngraphConfig.cmake INSTALL_DESTINATION cmake) -write_basic_package_version_file(${ngraph_BINARY_DIR}/ngraphConfigVersion.cmake +write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/ngraphConfigVersion.cmake VERSION ${IE_VERSION_MAJOR}.${IE_VERSION_MINOR}.${IE_VERSION_PATCH} COMPATIBILITY SameMajorVersion) -install(FILES ${ngraph_BINARY_DIR}/ngraphConfig.cmake - ${ngraph_BINARY_DIR}/ngraphConfigVersion.cmake +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ngraphConfig.cmake + ${CMAKE_CURRENT_BINARY_DIR}/ngraphConfigVersion.cmake DESTINATION "runtime/cmake" COMPONENT ngraph_dev) diff --git a/ngraph/core/builder/CMakeLists.txt b/src/core/builder/CMakeLists.txt similarity index 100% rename from ngraph/core/builder/CMakeLists.txt rename to src/core/builder/CMakeLists.txt diff --git a/ngraph/core/builder/include/ngraph/builder/autobroadcast.hpp b/src/core/builder/include/ngraph/builder/autobroadcast.hpp similarity index 100% rename from ngraph/core/builder/include/ngraph/builder/autobroadcast.hpp rename to src/core/builder/include/ngraph/builder/autobroadcast.hpp diff --git a/ngraph/core/builder/include/ngraph/builder/make_constant.hpp b/src/core/builder/include/ngraph/builder/make_constant.hpp similarity index 100% rename from ngraph/core/builder/include/ngraph/builder/make_constant.hpp rename to src/core/builder/include/ngraph/builder/make_constant.hpp diff --git a/ngraph/core/builder/include/ngraph/builder/norm.hpp b/src/core/builder/include/ngraph/builder/norm.hpp similarity index 100% rename from ngraph/core/builder/include/ngraph/builder/norm.hpp rename to src/core/builder/include/ngraph/builder/norm.hpp diff --git a/ngraph/core/builder/include/ngraph/builder/reduce_ops.hpp b/src/core/builder/include/ngraph/builder/reduce_ops.hpp similarity index 100% rename from ngraph/core/builder/include/ngraph/builder/reduce_ops.hpp rename to src/core/builder/include/ngraph/builder/reduce_ops.hpp diff --git a/ngraph/core/builder/include/ngraph/builder/reshape.hpp b/src/core/builder/include/ngraph/builder/reshape.hpp similarity index 100% rename from ngraph/core/builder/include/ngraph/builder/reshape.hpp rename to src/core/builder/include/ngraph/builder/reshape.hpp diff --git a/ngraph/core/builder/include/ngraph/builder/split.hpp b/src/core/builder/include/ngraph/builder/split.hpp similarity index 100% rename from ngraph/core/builder/include/ngraph/builder/split.hpp rename to src/core/builder/include/ngraph/builder/split.hpp diff --git a/ngraph/core/builder/src/builder/autobroadcast.cpp b/src/core/builder/src/builder/autobroadcast.cpp similarity index 100% rename from ngraph/core/builder/src/builder/autobroadcast.cpp rename to src/core/builder/src/builder/autobroadcast.cpp diff --git a/ngraph/core/builder/src/builder/make_constant.cpp b/src/core/builder/src/builder/make_constant.cpp similarity index 100% rename from ngraph/core/builder/src/builder/make_constant.cpp rename to src/core/builder/src/builder/make_constant.cpp diff --git a/ngraph/core/builder/src/builder/norm.cpp b/src/core/builder/src/builder/norm.cpp similarity index 100% rename from ngraph/core/builder/src/builder/norm.cpp rename to src/core/builder/src/builder/norm.cpp diff --git a/ngraph/core/builder/src/builder/reduce_ops.cpp b/src/core/builder/src/builder/reduce_ops.cpp similarity index 100% rename from ngraph/core/builder/src/builder/reduce_ops.cpp rename to src/core/builder/src/builder/reduce_ops.cpp diff --git a/ngraph/core/builder/src/builder/reshape.cpp b/src/core/builder/src/builder/reshape.cpp similarity index 100% rename from ngraph/core/builder/src/builder/reshape.cpp rename to src/core/builder/src/builder/reshape.cpp diff --git a/ngraph/core/builder/src/builder/split.cpp b/src/core/builder/src/builder/split.cpp similarity index 100% rename from ngraph/core/builder/src/builder/split.cpp rename to src/core/builder/src/builder/split.cpp diff --git a/ngraph/core/builder/src/precomp.hpp b/src/core/builder/src/precomp.hpp similarity index 100% rename from ngraph/core/builder/src/precomp.hpp rename to src/core/builder/src/precomp.hpp diff --git a/ngraph/core/include/ngraph/attribute_adapter.hpp b/src/core/include/ngraph/attribute_adapter.hpp similarity index 100% rename from ngraph/core/include/ngraph/attribute_adapter.hpp rename to src/core/include/ngraph/attribute_adapter.hpp diff --git a/ngraph/core/include/ngraph/attribute_visitor.hpp b/src/core/include/ngraph/attribute_visitor.hpp similarity index 100% rename from ngraph/core/include/ngraph/attribute_visitor.hpp rename to src/core/include/ngraph/attribute_visitor.hpp diff --git a/ngraph/core/include/ngraph/axis_set.hpp b/src/core/include/ngraph/axis_set.hpp similarity index 100% rename from ngraph/core/include/ngraph/axis_set.hpp rename to src/core/include/ngraph/axis_set.hpp diff --git a/ngraph/core/include/ngraph/axis_vector.hpp b/src/core/include/ngraph/axis_vector.hpp similarity index 100% rename from ngraph/core/include/ngraph/axis_vector.hpp rename to src/core/include/ngraph/axis_vector.hpp diff --git a/ngraph/core/include/ngraph/check.hpp b/src/core/include/ngraph/check.hpp similarity index 100% rename from ngraph/core/include/ngraph/check.hpp rename to src/core/include/ngraph/check.hpp diff --git a/ngraph/core/include/ngraph/compatibility.hpp b/src/core/include/ngraph/compatibility.hpp similarity index 100% rename from ngraph/core/include/ngraph/compatibility.hpp rename to src/core/include/ngraph/compatibility.hpp diff --git a/ngraph/core/include/ngraph/coordinate.hpp b/src/core/include/ngraph/coordinate.hpp similarity index 100% rename from ngraph/core/include/ngraph/coordinate.hpp rename to src/core/include/ngraph/coordinate.hpp diff --git a/ngraph/core/include/ngraph/coordinate_diff.hpp b/src/core/include/ngraph/coordinate_diff.hpp similarity index 100% rename from ngraph/core/include/ngraph/coordinate_diff.hpp rename to src/core/include/ngraph/coordinate_diff.hpp diff --git a/ngraph/core/include/ngraph/deprecated.hpp b/src/core/include/ngraph/deprecated.hpp similarity index 100% rename from ngraph/core/include/ngraph/deprecated.hpp rename to src/core/include/ngraph/deprecated.hpp diff --git a/ngraph/core/include/ngraph/descriptor/input.hpp b/src/core/include/ngraph/descriptor/input.hpp similarity index 100% rename from ngraph/core/include/ngraph/descriptor/input.hpp rename to src/core/include/ngraph/descriptor/input.hpp diff --git a/ngraph/core/include/ngraph/descriptor/output.hpp b/src/core/include/ngraph/descriptor/output.hpp similarity index 100% rename from ngraph/core/include/ngraph/descriptor/output.hpp rename to src/core/include/ngraph/descriptor/output.hpp diff --git a/ngraph/core/include/ngraph/descriptor/tensor.hpp b/src/core/include/ngraph/descriptor/tensor.hpp similarity index 100% rename from ngraph/core/include/ngraph/descriptor/tensor.hpp rename to src/core/include/ngraph/descriptor/tensor.hpp diff --git a/ngraph/core/include/ngraph/dimension.hpp b/src/core/include/ngraph/dimension.hpp similarity index 100% rename from ngraph/core/include/ngraph/dimension.hpp rename to src/core/include/ngraph/dimension.hpp diff --git a/ngraph/core/include/ngraph/distributed.hpp b/src/core/include/ngraph/distributed.hpp similarity index 100% rename from ngraph/core/include/ngraph/distributed.hpp rename to src/core/include/ngraph/distributed.hpp diff --git a/ngraph/core/include/ngraph/enum_names.hpp b/src/core/include/ngraph/enum_names.hpp similarity index 100% rename from ngraph/core/include/ngraph/enum_names.hpp rename to src/core/include/ngraph/enum_names.hpp diff --git a/ngraph/core/include/ngraph/env_util.hpp b/src/core/include/ngraph/env_util.hpp similarity index 100% rename from ngraph/core/include/ngraph/env_util.hpp rename to src/core/include/ngraph/env_util.hpp diff --git a/ngraph/core/include/ngraph/evaluator.hpp b/src/core/include/ngraph/evaluator.hpp similarity index 100% rename from ngraph/core/include/ngraph/evaluator.hpp rename to src/core/include/ngraph/evaluator.hpp diff --git a/ngraph/core/include/ngraph/except.hpp b/src/core/include/ngraph/except.hpp similarity index 100% rename from ngraph/core/include/ngraph/except.hpp rename to src/core/include/ngraph/except.hpp diff --git a/ngraph/core/include/ngraph/factory.hpp b/src/core/include/ngraph/factory.hpp similarity index 100% rename from ngraph/core/include/ngraph/factory.hpp rename to src/core/include/ngraph/factory.hpp diff --git a/ngraph/core/include/ngraph/factory_adapter.hpp b/src/core/include/ngraph/factory_adapter.hpp similarity index 100% rename from ngraph/core/include/ngraph/factory_adapter.hpp rename to src/core/include/ngraph/factory_adapter.hpp diff --git a/ngraph/core/include/ngraph/file_util.hpp b/src/core/include/ngraph/file_util.hpp similarity index 100% rename from ngraph/core/include/ngraph/file_util.hpp rename to src/core/include/ngraph/file_util.hpp diff --git a/ngraph/core/include/ngraph/function.hpp b/src/core/include/ngraph/function.hpp similarity index 100% rename from ngraph/core/include/ngraph/function.hpp rename to src/core/include/ngraph/function.hpp diff --git a/ngraph/core/include/ngraph/graph_util.hpp b/src/core/include/ngraph/graph_util.hpp similarity index 100% rename from ngraph/core/include/ngraph/graph_util.hpp rename to src/core/include/ngraph/graph_util.hpp diff --git a/ngraph/core/include/ngraph/interval.hpp b/src/core/include/ngraph/interval.hpp similarity index 100% rename from ngraph/core/include/ngraph/interval.hpp rename to src/core/include/ngraph/interval.hpp diff --git a/ngraph/core/include/ngraph/log.hpp b/src/core/include/ngraph/log.hpp similarity index 100% rename from ngraph/core/include/ngraph/log.hpp rename to src/core/include/ngraph/log.hpp diff --git a/ngraph/core/include/ngraph/ngraph.hpp b/src/core/include/ngraph/ngraph.hpp similarity index 100% rename from ngraph/core/include/ngraph/ngraph.hpp rename to src/core/include/ngraph/ngraph.hpp diff --git a/ngraph/core/include/ngraph/ngraph_visibility.hpp b/src/core/include/ngraph/ngraph_visibility.hpp similarity index 100% rename from ngraph/core/include/ngraph/ngraph_visibility.hpp rename to src/core/include/ngraph/ngraph_visibility.hpp diff --git a/ngraph/core/include/ngraph/node.hpp b/src/core/include/ngraph/node.hpp similarity index 98% rename from ngraph/core/include/ngraph/node.hpp rename to src/core/include/ngraph/node.hpp index 631bb424a7b..f8ed87f5a55 100644 --- a/ngraph/core/include/ngraph/node.hpp +++ b/src/core/include/ngraph/node.hpp @@ -36,6 +36,7 @@ #include "ngraph/strides.hpp" #include "ngraph/type.hpp" #include "ngraph/variant.hpp" +#include "openvino/core/any.hpp" #include "openvino/core/node.hpp" namespace ov { @@ -63,7 +64,7 @@ using ov::op::v0::Result; } } // namespace op -using EvaluationContext = std::map>; +using EvaluationContext = ov::EvaluationContext; using ResultVector = std::vector>; const auto node_validation_failure_loc_string = ov::node_validation_failure_loc_string; diff --git a/ngraph/core/include/ngraph/node_input.hpp b/src/core/include/ngraph/node_input.hpp similarity index 100% rename from ngraph/core/include/ngraph/node_input.hpp rename to src/core/include/ngraph/node_input.hpp diff --git a/ngraph/core/include/ngraph/node_output.hpp b/src/core/include/ngraph/node_output.hpp similarity index 100% rename from ngraph/core/include/ngraph/node_output.hpp rename to src/core/include/ngraph/node_output.hpp diff --git a/ngraph/core/include/ngraph/op/abs.hpp b/src/core/include/ngraph/op/abs.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/abs.hpp rename to src/core/include/ngraph/op/abs.hpp diff --git a/ngraph/core/include/ngraph/op/acos.hpp b/src/core/include/ngraph/op/acos.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/acos.hpp rename to src/core/include/ngraph/op/acos.hpp diff --git a/ngraph/core/include/ngraph/op/acosh.hpp b/src/core/include/ngraph/op/acosh.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/acosh.hpp rename to src/core/include/ngraph/op/acosh.hpp diff --git a/ngraph/core/include/ngraph/op/adaptive_avg_pool.hpp b/src/core/include/ngraph/op/adaptive_avg_pool.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/adaptive_avg_pool.hpp rename to src/core/include/ngraph/op/adaptive_avg_pool.hpp diff --git a/ngraph/core/include/ngraph/op/adaptive_max_pool.hpp b/src/core/include/ngraph/op/adaptive_max_pool.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/adaptive_max_pool.hpp rename to src/core/include/ngraph/op/adaptive_max_pool.hpp diff --git a/ngraph/core/include/ngraph/op/add.hpp b/src/core/include/ngraph/op/add.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/add.hpp rename to src/core/include/ngraph/op/add.hpp diff --git a/ngraph/core/include/ngraph/op/and.hpp b/src/core/include/ngraph/op/and.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/and.hpp rename to src/core/include/ngraph/op/and.hpp diff --git a/ngraph/core/include/ngraph/op/asin.hpp b/src/core/include/ngraph/op/asin.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/asin.hpp rename to src/core/include/ngraph/op/asin.hpp diff --git a/ngraph/core/include/ngraph/op/asinh.hpp b/src/core/include/ngraph/op/asinh.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/asinh.hpp rename to src/core/include/ngraph/op/asinh.hpp diff --git a/ngraph/core/include/ngraph/op/assign.hpp b/src/core/include/ngraph/op/assign.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/assign.hpp rename to src/core/include/ngraph/op/assign.hpp diff --git a/ngraph/core/include/ngraph/op/atan.hpp b/src/core/include/ngraph/op/atan.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/atan.hpp rename to src/core/include/ngraph/op/atan.hpp diff --git a/ngraph/core/include/ngraph/op/atanh.hpp b/src/core/include/ngraph/op/atanh.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/atanh.hpp rename to src/core/include/ngraph/op/atanh.hpp diff --git a/ngraph/core/include/ngraph/op/avg_pool.hpp b/src/core/include/ngraph/op/avg_pool.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/avg_pool.hpp rename to src/core/include/ngraph/op/avg_pool.hpp diff --git a/ngraph/core/include/ngraph/op/batch_norm.hpp b/src/core/include/ngraph/op/batch_norm.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/batch_norm.hpp rename to src/core/include/ngraph/op/batch_norm.hpp diff --git a/ngraph/core/include/ngraph/op/batch_to_space.hpp b/src/core/include/ngraph/op/batch_to_space.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/batch_to_space.hpp rename to src/core/include/ngraph/op/batch_to_space.hpp diff --git a/ngraph/core/include/ngraph/op/binary_convolution.hpp b/src/core/include/ngraph/op/binary_convolution.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/binary_convolution.hpp rename to src/core/include/ngraph/op/binary_convolution.hpp diff --git a/ngraph/core/include/ngraph/op/broadcast.hpp b/src/core/include/ngraph/op/broadcast.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/broadcast.hpp rename to src/core/include/ngraph/op/broadcast.hpp diff --git a/ngraph/core/include/ngraph/op/bucketize.hpp b/src/core/include/ngraph/op/bucketize.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/bucketize.hpp rename to src/core/include/ngraph/op/bucketize.hpp diff --git a/ngraph/core/include/ngraph/op/ceiling.hpp b/src/core/include/ngraph/op/ceiling.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/ceiling.hpp rename to src/core/include/ngraph/op/ceiling.hpp diff --git a/ngraph/core/include/ngraph/op/clamp.hpp b/src/core/include/ngraph/op/clamp.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/clamp.hpp rename to src/core/include/ngraph/op/clamp.hpp diff --git a/ngraph/core/include/ngraph/op/concat.hpp b/src/core/include/ngraph/op/concat.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/concat.hpp rename to src/core/include/ngraph/op/concat.hpp diff --git a/ngraph/core/include/ngraph/op/constant.hpp b/src/core/include/ngraph/op/constant.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/constant.hpp rename to src/core/include/ngraph/op/constant.hpp diff --git a/ngraph/core/include/ngraph/op/convert.hpp b/src/core/include/ngraph/op/convert.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/convert.hpp rename to src/core/include/ngraph/op/convert.hpp diff --git a/ngraph/core/include/ngraph/op/convert_like.hpp b/src/core/include/ngraph/op/convert_like.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/convert_like.hpp rename to src/core/include/ngraph/op/convert_like.hpp diff --git a/ngraph/core/include/ngraph/op/convolution.hpp b/src/core/include/ngraph/op/convolution.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/convolution.hpp rename to src/core/include/ngraph/op/convolution.hpp diff --git a/ngraph/core/include/ngraph/op/cos.hpp b/src/core/include/ngraph/op/cos.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/cos.hpp rename to src/core/include/ngraph/op/cos.hpp diff --git a/ngraph/core/include/ngraph/op/cosh.hpp b/src/core/include/ngraph/op/cosh.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/cosh.hpp rename to src/core/include/ngraph/op/cosh.hpp diff --git a/ngraph/core/include/ngraph/op/ctc_greedy_decoder.hpp b/src/core/include/ngraph/op/ctc_greedy_decoder.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/ctc_greedy_decoder.hpp rename to src/core/include/ngraph/op/ctc_greedy_decoder.hpp diff --git a/ngraph/core/include/ngraph/op/ctc_greedy_decoder_seq_len.hpp b/src/core/include/ngraph/op/ctc_greedy_decoder_seq_len.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/ctc_greedy_decoder_seq_len.hpp rename to src/core/include/ngraph/op/ctc_greedy_decoder_seq_len.hpp diff --git a/ngraph/core/include/ngraph/op/ctc_loss.hpp b/src/core/include/ngraph/op/ctc_loss.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/ctc_loss.hpp rename to src/core/include/ngraph/op/ctc_loss.hpp diff --git a/ngraph/core/include/ngraph/op/cum_sum.hpp b/src/core/include/ngraph/op/cum_sum.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/cum_sum.hpp rename to src/core/include/ngraph/op/cum_sum.hpp diff --git a/ngraph/core/include/ngraph/op/deformable_convolution.hpp b/src/core/include/ngraph/op/deformable_convolution.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/deformable_convolution.hpp rename to src/core/include/ngraph/op/deformable_convolution.hpp diff --git a/ngraph/core/include/ngraph/op/deformable_psroi_pooling.hpp b/src/core/include/ngraph/op/deformable_psroi_pooling.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/deformable_psroi_pooling.hpp rename to src/core/include/ngraph/op/deformable_psroi_pooling.hpp diff --git a/ngraph/core/include/ngraph/op/depth_to_space.hpp b/src/core/include/ngraph/op/depth_to_space.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/depth_to_space.hpp rename to src/core/include/ngraph/op/depth_to_space.hpp diff --git a/ngraph/core/include/ngraph/op/detection_output.hpp b/src/core/include/ngraph/op/detection_output.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/detection_output.hpp rename to src/core/include/ngraph/op/detection_output.hpp diff --git a/ngraph/core/include/ngraph/op/dft.hpp b/src/core/include/ngraph/op/dft.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/dft.hpp rename to src/core/include/ngraph/op/dft.hpp diff --git a/ngraph/core/include/ngraph/op/divide.hpp b/src/core/include/ngraph/op/divide.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/divide.hpp rename to src/core/include/ngraph/op/divide.hpp diff --git a/ngraph/core/include/ngraph/op/einsum.hpp b/src/core/include/ngraph/op/einsum.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/einsum.hpp rename to src/core/include/ngraph/op/einsum.hpp diff --git a/ngraph/core/include/ngraph/op/elu.hpp b/src/core/include/ngraph/op/elu.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/elu.hpp rename to src/core/include/ngraph/op/elu.hpp diff --git a/ngraph/core/include/ngraph/op/embedding_segments_sum.hpp b/src/core/include/ngraph/op/embedding_segments_sum.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/embedding_segments_sum.hpp rename to src/core/include/ngraph/op/embedding_segments_sum.hpp diff --git a/ngraph/core/include/ngraph/op/embeddingbag_offsets_sum.hpp b/src/core/include/ngraph/op/embeddingbag_offsets_sum.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/embeddingbag_offsets_sum.hpp rename to src/core/include/ngraph/op/embeddingbag_offsets_sum.hpp diff --git a/ngraph/core/include/ngraph/op/embeddingbag_packedsum.hpp b/src/core/include/ngraph/op/embeddingbag_packedsum.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/embeddingbag_packedsum.hpp rename to src/core/include/ngraph/op/embeddingbag_packedsum.hpp diff --git a/ngraph/core/include/ngraph/op/equal.hpp b/src/core/include/ngraph/op/equal.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/equal.hpp rename to src/core/include/ngraph/op/equal.hpp diff --git a/ngraph/core/include/ngraph/op/erf.hpp b/src/core/include/ngraph/op/erf.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/erf.hpp rename to src/core/include/ngraph/op/erf.hpp diff --git a/ngraph/core/include/ngraph/op/exp.hpp b/src/core/include/ngraph/op/exp.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/exp.hpp rename to src/core/include/ngraph/op/exp.hpp diff --git a/ngraph/core/include/ngraph/op/experimental_detectron_detection_output.hpp b/src/core/include/ngraph/op/experimental_detectron_detection_output.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/experimental_detectron_detection_output.hpp rename to src/core/include/ngraph/op/experimental_detectron_detection_output.hpp diff --git a/ngraph/core/include/ngraph/op/experimental_detectron_generate_proposals.hpp b/src/core/include/ngraph/op/experimental_detectron_generate_proposals.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/experimental_detectron_generate_proposals.hpp rename to src/core/include/ngraph/op/experimental_detectron_generate_proposals.hpp diff --git a/ngraph/core/include/ngraph/op/experimental_detectron_prior_grid_generator.hpp b/src/core/include/ngraph/op/experimental_detectron_prior_grid_generator.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/experimental_detectron_prior_grid_generator.hpp rename to src/core/include/ngraph/op/experimental_detectron_prior_grid_generator.hpp diff --git a/ngraph/core/include/ngraph/op/experimental_detectron_roi_feature.hpp b/src/core/include/ngraph/op/experimental_detectron_roi_feature.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/experimental_detectron_roi_feature.hpp rename to src/core/include/ngraph/op/experimental_detectron_roi_feature.hpp diff --git a/ngraph/core/include/ngraph/op/experimental_detectron_topkrois.hpp b/src/core/include/ngraph/op/experimental_detectron_topkrois.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/experimental_detectron_topkrois.hpp rename to src/core/include/ngraph/op/experimental_detectron_topkrois.hpp diff --git a/ngraph/core/include/ngraph/op/extractimagepatches.hpp b/src/core/include/ngraph/op/extractimagepatches.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/extractimagepatches.hpp rename to src/core/include/ngraph/op/extractimagepatches.hpp diff --git a/ngraph/core/include/ngraph/op/fake_quantize.hpp b/src/core/include/ngraph/op/fake_quantize.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/fake_quantize.hpp rename to src/core/include/ngraph/op/fake_quantize.hpp diff --git a/ngraph/core/include/ngraph/op/floor.hpp b/src/core/include/ngraph/op/floor.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/floor.hpp rename to src/core/include/ngraph/op/floor.hpp diff --git a/ngraph/core/include/ngraph/op/floor_mod.hpp b/src/core/include/ngraph/op/floor_mod.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/floor_mod.hpp rename to src/core/include/ngraph/op/floor_mod.hpp diff --git a/ngraph/core/include/ngraph/op/gather.hpp b/src/core/include/ngraph/op/gather.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/gather.hpp rename to src/core/include/ngraph/op/gather.hpp diff --git a/ngraph/core/include/ngraph/op/gather_elements.hpp b/src/core/include/ngraph/op/gather_elements.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/gather_elements.hpp rename to src/core/include/ngraph/op/gather_elements.hpp diff --git a/ngraph/core/include/ngraph/op/gather_nd.hpp b/src/core/include/ngraph/op/gather_nd.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/gather_nd.hpp rename to src/core/include/ngraph/op/gather_nd.hpp diff --git a/ngraph/core/include/ngraph/op/gather_tree.hpp b/src/core/include/ngraph/op/gather_tree.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/gather_tree.hpp rename to src/core/include/ngraph/op/gather_tree.hpp diff --git a/ngraph/core/include/ngraph/op/gelu.hpp b/src/core/include/ngraph/op/gelu.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/gelu.hpp rename to src/core/include/ngraph/op/gelu.hpp diff --git a/ngraph/core/include/ngraph/op/greater.hpp b/src/core/include/ngraph/op/greater.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/greater.hpp rename to src/core/include/ngraph/op/greater.hpp diff --git a/ngraph/core/include/ngraph/op/greater_eq.hpp b/src/core/include/ngraph/op/greater_eq.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/greater_eq.hpp rename to src/core/include/ngraph/op/greater_eq.hpp diff --git a/ngraph/core/include/ngraph/op/grn.hpp b/src/core/include/ngraph/op/grn.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/grn.hpp rename to src/core/include/ngraph/op/grn.hpp diff --git a/ngraph/core/include/ngraph/op/group_conv.hpp b/src/core/include/ngraph/op/group_conv.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/group_conv.hpp rename to src/core/include/ngraph/op/group_conv.hpp diff --git a/ngraph/core/include/ngraph/op/gru_cell.hpp b/src/core/include/ngraph/op/gru_cell.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/gru_cell.hpp rename to src/core/include/ngraph/op/gru_cell.hpp diff --git a/ngraph/core/include/ngraph/op/gru_sequence.hpp b/src/core/include/ngraph/op/gru_sequence.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/gru_sequence.hpp rename to src/core/include/ngraph/op/gru_sequence.hpp diff --git a/ngraph/core/include/ngraph/op/hard_sigmoid.hpp b/src/core/include/ngraph/op/hard_sigmoid.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/hard_sigmoid.hpp rename to src/core/include/ngraph/op/hard_sigmoid.hpp diff --git a/ngraph/core/include/ngraph/op/hsigmoid.hpp b/src/core/include/ngraph/op/hsigmoid.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/hsigmoid.hpp rename to src/core/include/ngraph/op/hsigmoid.hpp diff --git a/ngraph/core/include/ngraph/op/hswish.hpp b/src/core/include/ngraph/op/hswish.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/hswish.hpp rename to src/core/include/ngraph/op/hswish.hpp diff --git a/ngraph/core/include/ngraph/op/i420_to_bgr.hpp b/src/core/include/ngraph/op/i420_to_bgr.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/i420_to_bgr.hpp rename to src/core/include/ngraph/op/i420_to_bgr.hpp diff --git a/ngraph/core/include/ngraph/op/i420_to_rgb.hpp b/src/core/include/ngraph/op/i420_to_rgb.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/i420_to_rgb.hpp rename to src/core/include/ngraph/op/i420_to_rgb.hpp diff --git a/ngraph/core/include/ngraph/op/idft.hpp b/src/core/include/ngraph/op/idft.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/idft.hpp rename to src/core/include/ngraph/op/idft.hpp diff --git a/ngraph/core/include/ngraph/op/if.hpp b/src/core/include/ngraph/op/if.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/if.hpp rename to src/core/include/ngraph/op/if.hpp diff --git a/ngraph/core/include/ngraph/op/interpolate.hpp b/src/core/include/ngraph/op/interpolate.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/interpolate.hpp rename to src/core/include/ngraph/op/interpolate.hpp diff --git a/ngraph/core/include/ngraph/op/less.hpp b/src/core/include/ngraph/op/less.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/less.hpp rename to src/core/include/ngraph/op/less.hpp diff --git a/ngraph/core/include/ngraph/op/less_eq.hpp b/src/core/include/ngraph/op/less_eq.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/less_eq.hpp rename to src/core/include/ngraph/op/less_eq.hpp diff --git a/ngraph/core/include/ngraph/op/log.hpp b/src/core/include/ngraph/op/log.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/log.hpp rename to src/core/include/ngraph/op/log.hpp diff --git a/ngraph/core/include/ngraph/op/log_softmax.hpp b/src/core/include/ngraph/op/log_softmax.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/log_softmax.hpp rename to src/core/include/ngraph/op/log_softmax.hpp diff --git a/ngraph/core/include/ngraph/op/loop.hpp b/src/core/include/ngraph/op/loop.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/loop.hpp rename to src/core/include/ngraph/op/loop.hpp diff --git a/ngraph/core/include/ngraph/op/lrn.hpp b/src/core/include/ngraph/op/lrn.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/lrn.hpp rename to src/core/include/ngraph/op/lrn.hpp diff --git a/ngraph/core/include/ngraph/op/lstm_cell.hpp b/src/core/include/ngraph/op/lstm_cell.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/lstm_cell.hpp rename to src/core/include/ngraph/op/lstm_cell.hpp diff --git a/ngraph/core/include/ngraph/op/lstm_sequence.hpp b/src/core/include/ngraph/op/lstm_sequence.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/lstm_sequence.hpp rename to src/core/include/ngraph/op/lstm_sequence.hpp diff --git a/ngraph/core/include/ngraph/op/matmul.hpp b/src/core/include/ngraph/op/matmul.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/matmul.hpp rename to src/core/include/ngraph/op/matmul.hpp diff --git a/ngraph/core/include/ngraph/op/matrix_nms.hpp b/src/core/include/ngraph/op/matrix_nms.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/matrix_nms.hpp rename to src/core/include/ngraph/op/matrix_nms.hpp diff --git a/ngraph/core/include/ngraph/op/max.hpp b/src/core/include/ngraph/op/max.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/max.hpp rename to src/core/include/ngraph/op/max.hpp diff --git a/ngraph/core/include/ngraph/op/max_pool.hpp b/src/core/include/ngraph/op/max_pool.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/max_pool.hpp rename to src/core/include/ngraph/op/max_pool.hpp diff --git a/ngraph/core/include/ngraph/op/maximum.hpp b/src/core/include/ngraph/op/maximum.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/maximum.hpp rename to src/core/include/ngraph/op/maximum.hpp diff --git a/ngraph/core/include/ngraph/op/min.hpp b/src/core/include/ngraph/op/min.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/min.hpp rename to src/core/include/ngraph/op/min.hpp diff --git a/ngraph/core/include/ngraph/op/minimum.hpp b/src/core/include/ngraph/op/minimum.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/minimum.hpp rename to src/core/include/ngraph/op/minimum.hpp diff --git a/ngraph/core/include/ngraph/op/mish.hpp b/src/core/include/ngraph/op/mish.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/mish.hpp rename to src/core/include/ngraph/op/mish.hpp diff --git a/ngraph/core/include/ngraph/op/mod.hpp b/src/core/include/ngraph/op/mod.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/mod.hpp rename to src/core/include/ngraph/op/mod.hpp diff --git a/ngraph/core/include/ngraph/op/multiclass_nms.hpp b/src/core/include/ngraph/op/multiclass_nms.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/multiclass_nms.hpp rename to src/core/include/ngraph/op/multiclass_nms.hpp diff --git a/ngraph/core/include/ngraph/op/multiply.hpp b/src/core/include/ngraph/op/multiply.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/multiply.hpp rename to src/core/include/ngraph/op/multiply.hpp diff --git a/ngraph/core/include/ngraph/op/mvn.hpp b/src/core/include/ngraph/op/mvn.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/mvn.hpp rename to src/core/include/ngraph/op/mvn.hpp diff --git a/ngraph/core/include/ngraph/op/negative.hpp b/src/core/include/ngraph/op/negative.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/negative.hpp rename to src/core/include/ngraph/op/negative.hpp diff --git a/ngraph/core/include/ngraph/op/non_max_suppression.hpp b/src/core/include/ngraph/op/non_max_suppression.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/non_max_suppression.hpp rename to src/core/include/ngraph/op/non_max_suppression.hpp diff --git a/ngraph/core/include/ngraph/op/non_zero.hpp b/src/core/include/ngraph/op/non_zero.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/non_zero.hpp rename to src/core/include/ngraph/op/non_zero.hpp diff --git a/ngraph/core/include/ngraph/op/normalize_l2.hpp b/src/core/include/ngraph/op/normalize_l2.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/normalize_l2.hpp rename to src/core/include/ngraph/op/normalize_l2.hpp diff --git a/ngraph/core/include/ngraph/op/not.hpp b/src/core/include/ngraph/op/not.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/not.hpp rename to src/core/include/ngraph/op/not.hpp diff --git a/ngraph/core/include/ngraph/op/not_equal.hpp b/src/core/include/ngraph/op/not_equal.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/not_equal.hpp rename to src/core/include/ngraph/op/not_equal.hpp diff --git a/ngraph/core/include/ngraph/op/nv12_to_bgr.hpp b/src/core/include/ngraph/op/nv12_to_bgr.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/nv12_to_bgr.hpp rename to src/core/include/ngraph/op/nv12_to_bgr.hpp diff --git a/ngraph/core/include/ngraph/op/nv12_to_rgb.hpp b/src/core/include/ngraph/op/nv12_to_rgb.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/nv12_to_rgb.hpp rename to src/core/include/ngraph/op/nv12_to_rgb.hpp diff --git a/ngraph/core/include/ngraph/op/one_hot.hpp b/src/core/include/ngraph/op/one_hot.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/one_hot.hpp rename to src/core/include/ngraph/op/one_hot.hpp diff --git a/ngraph/core/include/ngraph/op/op.hpp b/src/core/include/ngraph/op/op.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/op.hpp rename to src/core/include/ngraph/op/op.hpp diff --git a/ngraph/core/include/ngraph/op/or.hpp b/src/core/include/ngraph/op/or.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/or.hpp rename to src/core/include/ngraph/op/or.hpp diff --git a/ngraph/core/include/ngraph/op/pad.hpp b/src/core/include/ngraph/op/pad.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/pad.hpp rename to src/core/include/ngraph/op/pad.hpp diff --git a/ngraph/core/include/ngraph/op/parameter.hpp b/src/core/include/ngraph/op/parameter.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/parameter.hpp rename to src/core/include/ngraph/op/parameter.hpp diff --git a/ngraph/core/include/ngraph/op/power.hpp b/src/core/include/ngraph/op/power.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/power.hpp rename to src/core/include/ngraph/op/power.hpp diff --git a/ngraph/core/include/ngraph/op/prelu.hpp b/src/core/include/ngraph/op/prelu.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/prelu.hpp rename to src/core/include/ngraph/op/prelu.hpp diff --git a/ngraph/core/include/ngraph/op/prior_box.hpp b/src/core/include/ngraph/op/prior_box.hpp similarity index 86% rename from ngraph/core/include/ngraph/op/prior_box.hpp rename to src/core/include/ngraph/op/prior_box.hpp index 0f0b760ef3c..6f3fd9ced9e 100644 --- a/ngraph/core/include/ngraph/op/prior_box.hpp +++ b/src/core/include/ngraph/op/prior_box.hpp @@ -13,6 +13,9 @@ using PriorBoxAttrs = ov::op::v0::PriorBox::Attributes; namespace v0 { using ov::op::v0::PriorBox; } // namespace v0 +namespace v8 { +using ov::op::v8::PriorBox; +} // namespace v8 using v0::PriorBox; } // namespace op } // namespace ngraph diff --git a/ngraph/core/include/ngraph/op/prior_box_clustered.hpp b/src/core/include/ngraph/op/prior_box_clustered.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/prior_box_clustered.hpp rename to src/core/include/ngraph/op/prior_box_clustered.hpp diff --git a/ngraph/core/include/ngraph/op/proposal.hpp b/src/core/include/ngraph/op/proposal.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/proposal.hpp rename to src/core/include/ngraph/op/proposal.hpp diff --git a/ngraph/core/include/ngraph/op/psroi_pooling.hpp b/src/core/include/ngraph/op/psroi_pooling.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/psroi_pooling.hpp rename to src/core/include/ngraph/op/psroi_pooling.hpp diff --git a/ngraph/core/include/ngraph/op/random_uniform.hpp b/src/core/include/ngraph/op/random_uniform.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/random_uniform.hpp rename to src/core/include/ngraph/op/random_uniform.hpp diff --git a/ngraph/core/include/ngraph/op/range.hpp b/src/core/include/ngraph/op/range.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/range.hpp rename to src/core/include/ngraph/op/range.hpp diff --git a/ngraph/core/include/ngraph/op/read_value.hpp b/src/core/include/ngraph/op/read_value.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/read_value.hpp rename to src/core/include/ngraph/op/read_value.hpp diff --git a/ngraph/core/include/ngraph/op/reduce_l1.hpp b/src/core/include/ngraph/op/reduce_l1.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/reduce_l1.hpp rename to src/core/include/ngraph/op/reduce_l1.hpp diff --git a/ngraph/core/include/ngraph/op/reduce_l2.hpp b/src/core/include/ngraph/op/reduce_l2.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/reduce_l2.hpp rename to src/core/include/ngraph/op/reduce_l2.hpp diff --git a/ngraph/core/include/ngraph/op/reduce_logical_and.hpp b/src/core/include/ngraph/op/reduce_logical_and.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/reduce_logical_and.hpp rename to src/core/include/ngraph/op/reduce_logical_and.hpp diff --git a/ngraph/core/include/ngraph/op/reduce_logical_or.hpp b/src/core/include/ngraph/op/reduce_logical_or.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/reduce_logical_or.hpp rename to src/core/include/ngraph/op/reduce_logical_or.hpp diff --git a/ngraph/core/include/ngraph/op/reduce_mean.hpp b/src/core/include/ngraph/op/reduce_mean.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/reduce_mean.hpp rename to src/core/include/ngraph/op/reduce_mean.hpp diff --git a/ngraph/core/include/ngraph/op/reduce_prod.hpp b/src/core/include/ngraph/op/reduce_prod.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/reduce_prod.hpp rename to src/core/include/ngraph/op/reduce_prod.hpp diff --git a/ngraph/core/include/ngraph/op/reduce_sum.hpp b/src/core/include/ngraph/op/reduce_sum.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/reduce_sum.hpp rename to src/core/include/ngraph/op/reduce_sum.hpp diff --git a/ngraph/core/include/ngraph/op/region_yolo.hpp b/src/core/include/ngraph/op/region_yolo.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/region_yolo.hpp rename to src/core/include/ngraph/op/region_yolo.hpp diff --git a/ngraph/core/include/ngraph/op/relu.hpp b/src/core/include/ngraph/op/relu.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/relu.hpp rename to src/core/include/ngraph/op/relu.hpp diff --git a/ngraph/core/include/ngraph/op/reorg_yolo.hpp b/src/core/include/ngraph/op/reorg_yolo.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/reorg_yolo.hpp rename to src/core/include/ngraph/op/reorg_yolo.hpp diff --git a/ngraph/core/include/ngraph/op/reshape.hpp b/src/core/include/ngraph/op/reshape.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/reshape.hpp rename to src/core/include/ngraph/op/reshape.hpp diff --git a/ngraph/core/include/ngraph/op/result.hpp b/src/core/include/ngraph/op/result.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/result.hpp rename to src/core/include/ngraph/op/result.hpp diff --git a/ngraph/core/include/ngraph/op/reverse.hpp b/src/core/include/ngraph/op/reverse.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/reverse.hpp rename to src/core/include/ngraph/op/reverse.hpp diff --git a/ngraph/core/include/ngraph/op/reverse_sequence.hpp b/src/core/include/ngraph/op/reverse_sequence.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/reverse_sequence.hpp rename to src/core/include/ngraph/op/reverse_sequence.hpp diff --git a/ngraph/core/include/ngraph/op/rnn_cell.hpp b/src/core/include/ngraph/op/rnn_cell.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/rnn_cell.hpp rename to src/core/include/ngraph/op/rnn_cell.hpp diff --git a/ngraph/core/include/ngraph/op/rnn_sequence.hpp b/src/core/include/ngraph/op/rnn_sequence.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/rnn_sequence.hpp rename to src/core/include/ngraph/op/rnn_sequence.hpp diff --git a/ngraph/core/include/ngraph/op/roi_align.hpp b/src/core/include/ngraph/op/roi_align.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/roi_align.hpp rename to src/core/include/ngraph/op/roi_align.hpp diff --git a/ngraph/core/include/ngraph/op/roi_pooling.hpp b/src/core/include/ngraph/op/roi_pooling.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/roi_pooling.hpp rename to src/core/include/ngraph/op/roi_pooling.hpp diff --git a/ngraph/core/include/ngraph/op/roll.hpp b/src/core/include/ngraph/op/roll.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/roll.hpp rename to src/core/include/ngraph/op/roll.hpp diff --git a/ngraph/core/include/ngraph/op/round.hpp b/src/core/include/ngraph/op/round.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/round.hpp rename to src/core/include/ngraph/op/round.hpp diff --git a/ngraph/core/include/ngraph/op/scatter_elements_update.hpp b/src/core/include/ngraph/op/scatter_elements_update.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/scatter_elements_update.hpp rename to src/core/include/ngraph/op/scatter_elements_update.hpp diff --git a/ngraph/core/include/ngraph/op/scatter_nd_update.hpp b/src/core/include/ngraph/op/scatter_nd_update.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/scatter_nd_update.hpp rename to src/core/include/ngraph/op/scatter_nd_update.hpp diff --git a/ngraph/core/include/ngraph/op/scatter_update.hpp b/src/core/include/ngraph/op/scatter_update.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/scatter_update.hpp rename to src/core/include/ngraph/op/scatter_update.hpp diff --git a/ngraph/core/include/ngraph/op/select.hpp b/src/core/include/ngraph/op/select.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/select.hpp rename to src/core/include/ngraph/op/select.hpp diff --git a/ngraph/core/include/ngraph/op/selu.hpp b/src/core/include/ngraph/op/selu.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/selu.hpp rename to src/core/include/ngraph/op/selu.hpp diff --git a/ngraph/core/include/ngraph/op/shape_of.hpp b/src/core/include/ngraph/op/shape_of.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/shape_of.hpp rename to src/core/include/ngraph/op/shape_of.hpp diff --git a/ngraph/core/include/ngraph/op/shuffle_channels.hpp b/src/core/include/ngraph/op/shuffle_channels.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/shuffle_channels.hpp rename to src/core/include/ngraph/op/shuffle_channels.hpp diff --git a/ngraph/core/include/ngraph/op/sigmoid.hpp b/src/core/include/ngraph/op/sigmoid.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/sigmoid.hpp rename to src/core/include/ngraph/op/sigmoid.hpp diff --git a/ngraph/core/include/ngraph/op/sign.hpp b/src/core/include/ngraph/op/sign.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/sign.hpp rename to src/core/include/ngraph/op/sign.hpp diff --git a/ngraph/core/include/ngraph/op/sin.hpp b/src/core/include/ngraph/op/sin.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/sin.hpp rename to src/core/include/ngraph/op/sin.hpp diff --git a/ngraph/core/include/ngraph/op/sinh.hpp b/src/core/include/ngraph/op/sinh.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/sinh.hpp rename to src/core/include/ngraph/op/sinh.hpp diff --git a/ngraph/core/include/ngraph/op/sink.hpp b/src/core/include/ngraph/op/sink.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/sink.hpp rename to src/core/include/ngraph/op/sink.hpp diff --git a/ngraph/core/include/ngraph/op/slice.hpp b/src/core/include/ngraph/op/slice.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/slice.hpp rename to src/core/include/ngraph/op/slice.hpp diff --git a/ngraph/core/include/ngraph/op/softmax.hpp b/src/core/include/ngraph/op/softmax.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/softmax.hpp rename to src/core/include/ngraph/op/softmax.hpp diff --git a/ngraph/core/include/ngraph/op/softplus.hpp b/src/core/include/ngraph/op/softplus.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/softplus.hpp rename to src/core/include/ngraph/op/softplus.hpp diff --git a/ngraph/core/include/ngraph/op/space_to_batch.hpp b/src/core/include/ngraph/op/space_to_batch.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/space_to_batch.hpp rename to src/core/include/ngraph/op/space_to_batch.hpp diff --git a/ngraph/core/include/ngraph/op/space_to_depth.hpp b/src/core/include/ngraph/op/space_to_depth.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/space_to_depth.hpp rename to src/core/include/ngraph/op/space_to_depth.hpp diff --git a/ngraph/core/include/ngraph/op/split.hpp b/src/core/include/ngraph/op/split.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/split.hpp rename to src/core/include/ngraph/op/split.hpp diff --git a/ngraph/core/include/ngraph/op/sqrt.hpp b/src/core/include/ngraph/op/sqrt.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/sqrt.hpp rename to src/core/include/ngraph/op/sqrt.hpp diff --git a/ngraph/core/include/ngraph/op/squared_difference.hpp b/src/core/include/ngraph/op/squared_difference.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/squared_difference.hpp rename to src/core/include/ngraph/op/squared_difference.hpp diff --git a/ngraph/core/include/ngraph/op/squeeze.hpp b/src/core/include/ngraph/op/squeeze.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/squeeze.hpp rename to src/core/include/ngraph/op/squeeze.hpp diff --git a/ngraph/core/include/ngraph/op/strided_slice.hpp b/src/core/include/ngraph/op/strided_slice.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/strided_slice.hpp rename to src/core/include/ngraph/op/strided_slice.hpp diff --git a/ngraph/core/include/ngraph/op/subtract.hpp b/src/core/include/ngraph/op/subtract.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/subtract.hpp rename to src/core/include/ngraph/op/subtract.hpp diff --git a/ngraph/core/include/ngraph/op/swish.hpp b/src/core/include/ngraph/op/swish.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/swish.hpp rename to src/core/include/ngraph/op/swish.hpp diff --git a/ngraph/core/include/ngraph/op/tan.hpp b/src/core/include/ngraph/op/tan.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/tan.hpp rename to src/core/include/ngraph/op/tan.hpp diff --git a/ngraph/core/include/ngraph/op/tanh.hpp b/src/core/include/ngraph/op/tanh.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/tanh.hpp rename to src/core/include/ngraph/op/tanh.hpp diff --git a/ngraph/core/include/ngraph/op/tensor_iterator.hpp b/src/core/include/ngraph/op/tensor_iterator.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/tensor_iterator.hpp rename to src/core/include/ngraph/op/tensor_iterator.hpp diff --git a/ngraph/core/include/ngraph/op/tile.hpp b/src/core/include/ngraph/op/tile.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/tile.hpp rename to src/core/include/ngraph/op/tile.hpp diff --git a/ngraph/core/include/ngraph/op/topk.hpp b/src/core/include/ngraph/op/topk.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/topk.hpp rename to src/core/include/ngraph/op/topk.hpp diff --git a/ngraph/core/include/ngraph/op/transpose.hpp b/src/core/include/ngraph/op/transpose.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/transpose.hpp rename to src/core/include/ngraph/op/transpose.hpp diff --git a/ngraph/core/include/ngraph/op/unsqueeze.hpp b/src/core/include/ngraph/op/unsqueeze.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/unsqueeze.hpp rename to src/core/include/ngraph/op/unsqueeze.hpp diff --git a/ngraph/core/include/ngraph/op/util/activation_functions.hpp b/src/core/include/ngraph/op/util/activation_functions.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/util/activation_functions.hpp rename to src/core/include/ngraph/op/util/activation_functions.hpp diff --git a/ngraph/core/include/ngraph/op/util/arithmetic_reduction.hpp b/src/core/include/ngraph/op/util/arithmetic_reduction.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/util/arithmetic_reduction.hpp rename to src/core/include/ngraph/op/util/arithmetic_reduction.hpp diff --git a/ngraph/core/include/ngraph/op/util/arithmetic_reductions_keep_dims.hpp b/src/core/include/ngraph/op/util/arithmetic_reductions_keep_dims.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/util/arithmetic_reductions_keep_dims.hpp rename to src/core/include/ngraph/op/util/arithmetic_reductions_keep_dims.hpp diff --git a/ngraph/core/include/ngraph/op/util/attr_types.hpp b/src/core/include/ngraph/op/util/attr_types.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/util/attr_types.hpp rename to src/core/include/ngraph/op/util/attr_types.hpp diff --git a/ngraph/core/include/ngraph/op/util/binary_elementwise_arithmetic.hpp b/src/core/include/ngraph/op/util/binary_elementwise_arithmetic.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/util/binary_elementwise_arithmetic.hpp rename to src/core/include/ngraph/op/util/binary_elementwise_arithmetic.hpp diff --git a/ngraph/core/include/ngraph/op/util/binary_elementwise_comparison.hpp b/src/core/include/ngraph/op/util/binary_elementwise_comparison.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/util/binary_elementwise_comparison.hpp rename to src/core/include/ngraph/op/util/binary_elementwise_comparison.hpp diff --git a/ngraph/core/include/ngraph/op/util/binary_elementwise_logical.hpp b/src/core/include/ngraph/op/util/binary_elementwise_logical.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/util/binary_elementwise_logical.hpp rename to src/core/include/ngraph/op/util/binary_elementwise_logical.hpp diff --git a/ngraph/core/include/ngraph/op/util/broadcast_base.hpp b/src/core/include/ngraph/op/util/broadcast_base.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/util/broadcast_base.hpp rename to src/core/include/ngraph/op/util/broadcast_base.hpp diff --git a/ngraph/core/include/ngraph/op/util/deformable_convolution_base.hpp b/src/core/include/ngraph/op/util/deformable_convolution_base.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/util/deformable_convolution_base.hpp rename to src/core/include/ngraph/op/util/deformable_convolution_base.hpp diff --git a/ngraph/core/include/ngraph/op/util/elementwise_args.hpp b/src/core/include/ngraph/op/util/elementwise_args.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/util/elementwise_args.hpp rename to src/core/include/ngraph/op/util/elementwise_args.hpp diff --git a/ngraph/core/include/ngraph/op/util/embeddingbag_offsets_base.hpp b/src/core/include/ngraph/op/util/embeddingbag_offsets_base.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/util/embeddingbag_offsets_base.hpp rename to src/core/include/ngraph/op/util/embeddingbag_offsets_base.hpp diff --git a/ngraph/core/include/ngraph/op/util/embeddingbag_packed_base.hpp b/src/core/include/ngraph/op/util/embeddingbag_packed_base.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/util/embeddingbag_packed_base.hpp rename to src/core/include/ngraph/op/util/embeddingbag_packed_base.hpp diff --git a/ngraph/core/include/ngraph/op/util/eval_copy.hpp b/src/core/include/ngraph/op/util/eval_copy.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/util/eval_copy.hpp rename to src/core/include/ngraph/op/util/eval_copy.hpp diff --git a/ngraph/core/include/ngraph/op/util/evaluate_helpers.hpp b/src/core/include/ngraph/op/util/evaluate_helpers.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/util/evaluate_helpers.hpp rename to src/core/include/ngraph/op/util/evaluate_helpers.hpp diff --git a/ngraph/core/include/ngraph/op/util/fft_base.hpp b/src/core/include/ngraph/op/util/fft_base.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/util/fft_base.hpp rename to src/core/include/ngraph/op/util/fft_base.hpp diff --git a/ngraph/core/include/ngraph/op/util/framework_node.hpp b/src/core/include/ngraph/op/util/framework_node.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/util/framework_node.hpp rename to src/core/include/ngraph/op/util/framework_node.hpp diff --git a/ngraph/core/include/ngraph/op/util/gather_base.hpp b/src/core/include/ngraph/op/util/gather_base.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/util/gather_base.hpp rename to src/core/include/ngraph/op/util/gather_base.hpp diff --git a/ngraph/core/include/ngraph/op/util/gather_nd_base.hpp b/src/core/include/ngraph/op/util/gather_nd_base.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/util/gather_nd_base.hpp rename to src/core/include/ngraph/op/util/gather_nd_base.hpp diff --git a/ngraph/core/include/ngraph/op/util/index_reduction.hpp b/src/core/include/ngraph/op/util/index_reduction.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/util/index_reduction.hpp rename to src/core/include/ngraph/op/util/index_reduction.hpp diff --git a/ngraph/core/include/ngraph/op/util/logical_reduction.hpp b/src/core/include/ngraph/op/util/logical_reduction.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/util/logical_reduction.hpp rename to src/core/include/ngraph/op/util/logical_reduction.hpp diff --git a/ngraph/core/include/ngraph/op/util/logical_reduction_keep_dims.hpp b/src/core/include/ngraph/op/util/logical_reduction_keep_dims.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/util/logical_reduction_keep_dims.hpp rename to src/core/include/ngraph/op/util/logical_reduction_keep_dims.hpp diff --git a/ngraph/core/include/ngraph/op/util/max_pool_base.hpp b/src/core/include/ngraph/op/util/max_pool_base.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/util/max_pool_base.hpp rename to src/core/include/ngraph/op/util/max_pool_base.hpp diff --git a/ngraph/core/include/ngraph/op/util/multi_subgraph_base.hpp b/src/core/include/ngraph/op/util/multi_subgraph_base.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/util/multi_subgraph_base.hpp rename to src/core/include/ngraph/op/util/multi_subgraph_base.hpp diff --git a/ngraph/core/include/ngraph/op/util/nms_base.hpp b/src/core/include/ngraph/op/util/nms_base.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/util/nms_base.hpp rename to src/core/include/ngraph/op/util/nms_base.hpp diff --git a/ngraph/core/include/ngraph/op/util/op_annotations.hpp b/src/core/include/ngraph/op/util/op_annotations.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/util/op_annotations.hpp rename to src/core/include/ngraph/op/util/op_annotations.hpp diff --git a/ngraph/core/include/ngraph/op/util/op_types.hpp b/src/core/include/ngraph/op/util/op_types.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/util/op_types.hpp rename to src/core/include/ngraph/op/util/op_types.hpp diff --git a/ngraph/core/include/ngraph/op/util/recurrent_sequence.hpp b/src/core/include/ngraph/op/util/recurrent_sequence.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/util/recurrent_sequence.hpp rename to src/core/include/ngraph/op/util/recurrent_sequence.hpp diff --git a/ngraph/core/include/ngraph/op/util/reduction_base.hpp b/src/core/include/ngraph/op/util/reduction_base.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/util/reduction_base.hpp rename to src/core/include/ngraph/op/util/reduction_base.hpp diff --git a/ngraph/core/include/ngraph/op/util/rnn_cell_base.hpp b/src/core/include/ngraph/op/util/rnn_cell_base.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/util/rnn_cell_base.hpp rename to src/core/include/ngraph/op/util/rnn_cell_base.hpp diff --git a/ngraph/core/include/ngraph/op/util/scatter_base.hpp b/src/core/include/ngraph/op/util/scatter_base.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/util/scatter_base.hpp rename to src/core/include/ngraph/op/util/scatter_base.hpp diff --git a/ngraph/core/include/ngraph/op/util/scatter_nd_base.hpp b/src/core/include/ngraph/op/util/scatter_nd_base.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/util/scatter_nd_base.hpp rename to src/core/include/ngraph/op/util/scatter_nd_base.hpp diff --git a/ngraph/core/include/ngraph/op/util/slice_plan.hpp b/src/core/include/ngraph/op/util/slice_plan.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/util/slice_plan.hpp rename to src/core/include/ngraph/op/util/slice_plan.hpp diff --git a/ngraph/core/include/ngraph/op/util/sub_graph_base.hpp b/src/core/include/ngraph/op/util/sub_graph_base.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/util/sub_graph_base.hpp rename to src/core/include/ngraph/op/util/sub_graph_base.hpp diff --git a/ngraph/core/include/ngraph/op/util/unary_elementwise_arithmetic.hpp b/src/core/include/ngraph/op/util/unary_elementwise_arithmetic.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/util/unary_elementwise_arithmetic.hpp rename to src/core/include/ngraph/op/util/unary_elementwise_arithmetic.hpp diff --git a/ngraph/core/include/ngraph/op/util/variable.hpp b/src/core/include/ngraph/op/util/variable.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/util/variable.hpp rename to src/core/include/ngraph/op/util/variable.hpp diff --git a/ngraph/core/include/ngraph/op/util/variable_context.hpp b/src/core/include/ngraph/op/util/variable_context.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/util/variable_context.hpp rename to src/core/include/ngraph/op/util/variable_context.hpp diff --git a/ngraph/core/include/ngraph/op/util/variable_extension.hpp b/src/core/include/ngraph/op/util/variable_extension.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/util/variable_extension.hpp rename to src/core/include/ngraph/op/util/variable_extension.hpp diff --git a/ngraph/core/include/ngraph/op/util/variable_value.hpp b/src/core/include/ngraph/op/util/variable_value.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/util/variable_value.hpp rename to src/core/include/ngraph/op/util/variable_value.hpp diff --git a/ngraph/core/include/ngraph/op/variadic_split.hpp b/src/core/include/ngraph/op/variadic_split.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/variadic_split.hpp rename to src/core/include/ngraph/op/variadic_split.hpp diff --git a/ngraph/core/include/ngraph/op/xor.hpp b/src/core/include/ngraph/op/xor.hpp similarity index 100% rename from ngraph/core/include/ngraph/op/xor.hpp rename to src/core/include/ngraph/op/xor.hpp diff --git a/ngraph/core/include/ngraph/ops.hpp b/src/core/include/ngraph/ops.hpp similarity index 100% rename from ngraph/core/include/ngraph/ops.hpp rename to src/core/include/ngraph/ops.hpp diff --git a/ngraph/core/include/ngraph/opsets/opset.hpp b/src/core/include/ngraph/opsets/opset.hpp similarity index 100% rename from ngraph/core/include/ngraph/opsets/opset.hpp rename to src/core/include/ngraph/opsets/opset.hpp diff --git a/ngraph/core/include/ngraph/opsets/opset1.hpp b/src/core/include/ngraph/opsets/opset1.hpp similarity index 100% rename from ngraph/core/include/ngraph/opsets/opset1.hpp rename to src/core/include/ngraph/opsets/opset1.hpp diff --git a/ngraph/core/include/ngraph/opsets/opset1_tbl.hpp b/src/core/include/ngraph/opsets/opset1_tbl.hpp similarity index 100% rename from ngraph/core/include/ngraph/opsets/opset1_tbl.hpp rename to src/core/include/ngraph/opsets/opset1_tbl.hpp diff --git a/ngraph/core/include/ngraph/opsets/opset2.hpp b/src/core/include/ngraph/opsets/opset2.hpp similarity index 100% rename from ngraph/core/include/ngraph/opsets/opset2.hpp rename to src/core/include/ngraph/opsets/opset2.hpp diff --git a/ngraph/core/include/ngraph/opsets/opset2_tbl.hpp b/src/core/include/ngraph/opsets/opset2_tbl.hpp similarity index 100% rename from ngraph/core/include/ngraph/opsets/opset2_tbl.hpp rename to src/core/include/ngraph/opsets/opset2_tbl.hpp diff --git a/ngraph/core/include/ngraph/opsets/opset3.hpp b/src/core/include/ngraph/opsets/opset3.hpp similarity index 100% rename from ngraph/core/include/ngraph/opsets/opset3.hpp rename to src/core/include/ngraph/opsets/opset3.hpp diff --git a/ngraph/core/include/ngraph/opsets/opset3_tbl.hpp b/src/core/include/ngraph/opsets/opset3_tbl.hpp similarity index 100% rename from ngraph/core/include/ngraph/opsets/opset3_tbl.hpp rename to src/core/include/ngraph/opsets/opset3_tbl.hpp diff --git a/ngraph/core/include/ngraph/opsets/opset4.hpp b/src/core/include/ngraph/opsets/opset4.hpp similarity index 100% rename from ngraph/core/include/ngraph/opsets/opset4.hpp rename to src/core/include/ngraph/opsets/opset4.hpp diff --git a/ngraph/core/include/ngraph/opsets/opset4_tbl.hpp b/src/core/include/ngraph/opsets/opset4_tbl.hpp similarity index 100% rename from ngraph/core/include/ngraph/opsets/opset4_tbl.hpp rename to src/core/include/ngraph/opsets/opset4_tbl.hpp diff --git a/ngraph/core/include/ngraph/opsets/opset5.hpp b/src/core/include/ngraph/opsets/opset5.hpp similarity index 100% rename from ngraph/core/include/ngraph/opsets/opset5.hpp rename to src/core/include/ngraph/opsets/opset5.hpp diff --git a/ngraph/core/include/ngraph/opsets/opset5_tbl.hpp b/src/core/include/ngraph/opsets/opset5_tbl.hpp similarity index 100% rename from ngraph/core/include/ngraph/opsets/opset5_tbl.hpp rename to src/core/include/ngraph/opsets/opset5_tbl.hpp diff --git a/ngraph/core/include/ngraph/opsets/opset6.hpp b/src/core/include/ngraph/opsets/opset6.hpp similarity index 100% rename from ngraph/core/include/ngraph/opsets/opset6.hpp rename to src/core/include/ngraph/opsets/opset6.hpp diff --git a/ngraph/core/include/ngraph/opsets/opset6_tbl.hpp b/src/core/include/ngraph/opsets/opset6_tbl.hpp similarity index 100% rename from ngraph/core/include/ngraph/opsets/opset6_tbl.hpp rename to src/core/include/ngraph/opsets/opset6_tbl.hpp diff --git a/ngraph/core/include/ngraph/opsets/opset7.hpp b/src/core/include/ngraph/opsets/opset7.hpp similarity index 100% rename from ngraph/core/include/ngraph/opsets/opset7.hpp rename to src/core/include/ngraph/opsets/opset7.hpp diff --git a/ngraph/core/include/ngraph/opsets/opset7_tbl.hpp b/src/core/include/ngraph/opsets/opset7_tbl.hpp similarity index 100% rename from ngraph/core/include/ngraph/opsets/opset7_tbl.hpp rename to src/core/include/ngraph/opsets/opset7_tbl.hpp diff --git a/ngraph/core/include/ngraph/opsets/opset8.hpp b/src/core/include/ngraph/opsets/opset8.hpp similarity index 100% rename from ngraph/core/include/ngraph/opsets/opset8.hpp rename to src/core/include/ngraph/opsets/opset8.hpp diff --git a/ngraph/core/include/ngraph/opsets/opset8_tbl.hpp b/src/core/include/ngraph/opsets/opset8_tbl.hpp similarity index 100% rename from ngraph/core/include/ngraph/opsets/opset8_tbl.hpp rename to src/core/include/ngraph/opsets/opset8_tbl.hpp diff --git a/ngraph/core/include/ngraph/output_vector.hpp b/src/core/include/ngraph/output_vector.hpp similarity index 100% rename from ngraph/core/include/ngraph/output_vector.hpp rename to src/core/include/ngraph/output_vector.hpp diff --git a/ngraph/core/include/ngraph/partial_shape.hpp b/src/core/include/ngraph/partial_shape.hpp similarity index 100% rename from ngraph/core/include/ngraph/partial_shape.hpp rename to src/core/include/ngraph/partial_shape.hpp diff --git a/ngraph/core/include/ngraph/pass/constant_folding.hpp b/src/core/include/ngraph/pass/constant_folding.hpp similarity index 100% rename from ngraph/core/include/ngraph/pass/constant_folding.hpp rename to src/core/include/ngraph/pass/constant_folding.hpp diff --git a/ngraph/core/include/ngraph/pass/convert_fp32_to_fp16.hpp b/src/core/include/ngraph/pass/convert_fp32_to_fp16.hpp similarity index 100% rename from ngraph/core/include/ngraph/pass/convert_fp32_to_fp16.hpp rename to src/core/include/ngraph/pass/convert_fp32_to_fp16.hpp diff --git a/ngraph/core/include/ngraph/pass/graph_rewrite.hpp b/src/core/include/ngraph/pass/graph_rewrite.hpp similarity index 100% rename from ngraph/core/include/ngraph/pass/graph_rewrite.hpp rename to src/core/include/ngraph/pass/graph_rewrite.hpp diff --git a/ngraph/core/include/ngraph/pass/low_latency.hpp b/src/core/include/ngraph/pass/low_latency.hpp similarity index 100% rename from ngraph/core/include/ngraph/pass/low_latency.hpp rename to src/core/include/ngraph/pass/low_latency.hpp diff --git a/ngraph/core/include/ngraph/pass/manager.hpp b/src/core/include/ngraph/pass/manager.hpp similarity index 100% rename from ngraph/core/include/ngraph/pass/manager.hpp rename to src/core/include/ngraph/pass/manager.hpp diff --git a/ngraph/core/include/ngraph/pass/pass.hpp b/src/core/include/ngraph/pass/pass.hpp similarity index 100% rename from ngraph/core/include/ngraph/pass/pass.hpp rename to src/core/include/ngraph/pass/pass.hpp diff --git a/ngraph/core/include/ngraph/pass/pass_config.hpp b/src/core/include/ngraph/pass/pass_config.hpp similarity index 100% rename from ngraph/core/include/ngraph/pass/pass_config.hpp rename to src/core/include/ngraph/pass/pass_config.hpp diff --git a/ngraph/core/include/ngraph/pass/serialize.hpp b/src/core/include/ngraph/pass/serialize.hpp similarity index 100% rename from ngraph/core/include/ngraph/pass/serialize.hpp rename to src/core/include/ngraph/pass/serialize.hpp diff --git a/ngraph/core/include/ngraph/pass/validate.hpp b/src/core/include/ngraph/pass/validate.hpp similarity index 100% rename from ngraph/core/include/ngraph/pass/validate.hpp rename to src/core/include/ngraph/pass/validate.hpp diff --git a/ngraph/core/include/ngraph/pass/visualize_tree.hpp b/src/core/include/ngraph/pass/visualize_tree.hpp similarity index 100% rename from ngraph/core/include/ngraph/pass/visualize_tree.hpp rename to src/core/include/ngraph/pass/visualize_tree.hpp diff --git a/ngraph/core/include/ngraph/pattern/matcher.hpp b/src/core/include/ngraph/pattern/matcher.hpp similarity index 100% rename from ngraph/core/include/ngraph/pattern/matcher.hpp rename to src/core/include/ngraph/pattern/matcher.hpp diff --git a/ngraph/core/include/ngraph/pattern/op/any.hpp b/src/core/include/ngraph/pattern/op/any.hpp similarity index 100% rename from ngraph/core/include/ngraph/pattern/op/any.hpp rename to src/core/include/ngraph/pattern/op/any.hpp diff --git a/ngraph/core/include/ngraph/pattern/op/any_of.hpp b/src/core/include/ngraph/pattern/op/any_of.hpp similarity index 100% rename from ngraph/core/include/ngraph/pattern/op/any_of.hpp rename to src/core/include/ngraph/pattern/op/any_of.hpp diff --git a/ngraph/core/include/ngraph/pattern/op/any_output.hpp b/src/core/include/ngraph/pattern/op/any_output.hpp similarity index 100% rename from ngraph/core/include/ngraph/pattern/op/any_output.hpp rename to src/core/include/ngraph/pattern/op/any_output.hpp diff --git a/ngraph/core/include/ngraph/pattern/op/branch.hpp b/src/core/include/ngraph/pattern/op/branch.hpp similarity index 100% rename from ngraph/core/include/ngraph/pattern/op/branch.hpp rename to src/core/include/ngraph/pattern/op/branch.hpp diff --git a/ngraph/core/include/ngraph/pattern/op/capture.hpp b/src/core/include/ngraph/pattern/op/capture.hpp similarity index 100% rename from ngraph/core/include/ngraph/pattern/op/capture.hpp rename to src/core/include/ngraph/pattern/op/capture.hpp diff --git a/ngraph/core/include/ngraph/pattern/op/label.hpp b/src/core/include/ngraph/pattern/op/label.hpp similarity index 100% rename from ngraph/core/include/ngraph/pattern/op/label.hpp rename to src/core/include/ngraph/pattern/op/label.hpp diff --git a/ngraph/core/include/ngraph/pattern/op/or.hpp b/src/core/include/ngraph/pattern/op/or.hpp similarity index 100% rename from ngraph/core/include/ngraph/pattern/op/or.hpp rename to src/core/include/ngraph/pattern/op/or.hpp diff --git a/ngraph/core/include/ngraph/pattern/op/pattern.hpp b/src/core/include/ngraph/pattern/op/pattern.hpp similarity index 100% rename from ngraph/core/include/ngraph/pattern/op/pattern.hpp rename to src/core/include/ngraph/pattern/op/pattern.hpp diff --git a/ngraph/core/include/ngraph/pattern/op/skip.hpp b/src/core/include/ngraph/pattern/op/skip.hpp similarity index 100% rename from ngraph/core/include/ngraph/pattern/op/skip.hpp rename to src/core/include/ngraph/pattern/op/skip.hpp diff --git a/ngraph/core/include/ngraph/pattern/op/true.hpp b/src/core/include/ngraph/pattern/op/true.hpp similarity index 100% rename from ngraph/core/include/ngraph/pattern/op/true.hpp rename to src/core/include/ngraph/pattern/op/true.hpp diff --git a/ngraph/core/include/ngraph/pattern/op/wrap_type.hpp b/src/core/include/ngraph/pattern/op/wrap_type.hpp similarity index 100% rename from ngraph/core/include/ngraph/pattern/op/wrap_type.hpp rename to src/core/include/ngraph/pattern/op/wrap_type.hpp diff --git a/ngraph/core/include/ngraph/rank.hpp b/src/core/include/ngraph/rank.hpp similarity index 100% rename from ngraph/core/include/ngraph/rank.hpp rename to src/core/include/ngraph/rank.hpp diff --git a/ngraph/core/include/ngraph/rt_info.hpp b/src/core/include/ngraph/rt_info.hpp similarity index 100% rename from ngraph/core/include/ngraph/rt_info.hpp rename to src/core/include/ngraph/rt_info.hpp diff --git a/ngraph/core/include/ngraph/runtime/aligned_buffer.hpp b/src/core/include/ngraph/runtime/aligned_buffer.hpp similarity index 100% rename from ngraph/core/include/ngraph/runtime/aligned_buffer.hpp rename to src/core/include/ngraph/runtime/aligned_buffer.hpp diff --git a/ngraph/core/include/ngraph/runtime/host_tensor.hpp b/src/core/include/ngraph/runtime/host_tensor.hpp similarity index 100% rename from ngraph/core/include/ngraph/runtime/host_tensor.hpp rename to src/core/include/ngraph/runtime/host_tensor.hpp diff --git a/ngraph/core/include/ngraph/runtime/shared_buffer.hpp b/src/core/include/ngraph/runtime/shared_buffer.hpp similarity index 100% rename from ngraph/core/include/ngraph/runtime/shared_buffer.hpp rename to src/core/include/ngraph/runtime/shared_buffer.hpp diff --git a/ngraph/core/include/ngraph/runtime/tensor.hpp b/src/core/include/ngraph/runtime/tensor.hpp similarity index 100% rename from ngraph/core/include/ngraph/runtime/tensor.hpp rename to src/core/include/ngraph/runtime/tensor.hpp diff --git a/ngraph/core/include/ngraph/shape.hpp b/src/core/include/ngraph/shape.hpp similarity index 100% rename from ngraph/core/include/ngraph/shape.hpp rename to src/core/include/ngraph/shape.hpp diff --git a/ngraph/core/include/ngraph/shape_util.hpp b/src/core/include/ngraph/shape_util.hpp similarity index 100% rename from ngraph/core/include/ngraph/shape_util.hpp rename to src/core/include/ngraph/shape_util.hpp diff --git a/ngraph/core/include/ngraph/slice_plan.hpp b/src/core/include/ngraph/slice_plan.hpp similarity index 100% rename from ngraph/core/include/ngraph/slice_plan.hpp rename to src/core/include/ngraph/slice_plan.hpp diff --git a/ngraph/core/include/ngraph/specialize_function.hpp b/src/core/include/ngraph/specialize_function.hpp similarity index 100% rename from ngraph/core/include/ngraph/specialize_function.hpp rename to src/core/include/ngraph/specialize_function.hpp diff --git a/ngraph/core/include/ngraph/strides.hpp b/src/core/include/ngraph/strides.hpp similarity index 100% rename from ngraph/core/include/ngraph/strides.hpp rename to src/core/include/ngraph/strides.hpp diff --git a/ngraph/core/include/ngraph/type.hpp b/src/core/include/ngraph/type.hpp similarity index 100% rename from ngraph/core/include/ngraph/type.hpp rename to src/core/include/ngraph/type.hpp diff --git a/ngraph/core/include/ngraph/type/bfloat16.hpp b/src/core/include/ngraph/type/bfloat16.hpp similarity index 100% rename from ngraph/core/include/ngraph/type/bfloat16.hpp rename to src/core/include/ngraph/type/bfloat16.hpp diff --git a/ngraph/core/include/ngraph/type/element_type.hpp b/src/core/include/ngraph/type/element_type.hpp similarity index 100% rename from ngraph/core/include/ngraph/type/element_type.hpp rename to src/core/include/ngraph/type/element_type.hpp diff --git a/ngraph/core/include/ngraph/type/element_type_traits.hpp b/src/core/include/ngraph/type/element_type_traits.hpp similarity index 100% rename from ngraph/core/include/ngraph/type/element_type_traits.hpp rename to src/core/include/ngraph/type/element_type_traits.hpp diff --git a/ngraph/core/include/ngraph/type/float16.hpp b/src/core/include/ngraph/type/float16.hpp similarity index 100% rename from ngraph/core/include/ngraph/type/float16.hpp rename to src/core/include/ngraph/type/float16.hpp diff --git a/ngraph/core/include/ngraph/util.hpp b/src/core/include/ngraph/util.hpp similarity index 100% rename from ngraph/core/include/ngraph/util.hpp rename to src/core/include/ngraph/util.hpp diff --git a/ngraph/core/include/ngraph/validation_util.hpp b/src/core/include/ngraph/validation_util.hpp similarity index 100% rename from ngraph/core/include/ngraph/validation_util.hpp rename to src/core/include/ngraph/validation_util.hpp diff --git a/ngraph/core/include/ngraph/variant.hpp b/src/core/include/ngraph/variant.hpp similarity index 87% rename from ngraph/core/include/ngraph/variant.hpp rename to src/core/include/ngraph/variant.hpp index cf42b298296..a203a35d2df 100644 --- a/ngraph/core/include/ngraph/variant.hpp +++ b/src/core/include/ngraph/variant.hpp @@ -7,6 +7,7 @@ #include #include +#include "openvino/core/any.hpp" // used for ov::RTMap #include "openvino/core/variant.hpp" namespace ov { diff --git a/ngraph/core/include/ngraph/version.hpp b/src/core/include/ngraph/version.hpp similarity index 100% rename from ngraph/core/include/ngraph/version.hpp rename to src/core/include/ngraph/version.hpp diff --git a/ngraph/core/include/ngraph/visibility.hpp b/src/core/include/ngraph/visibility.hpp similarity index 100% rename from ngraph/core/include/ngraph/visibility.hpp rename to src/core/include/ngraph/visibility.hpp diff --git a/src/core/include/openvino/core/any.hpp b/src/core/include/openvino/core/any.hpp new file mode 100644 index 00000000000..db9ad76ee0c --- /dev/null +++ b/src/core/include/openvino/core/any.hpp @@ -0,0 +1,638 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +/** + * @brief A header file for the Any class + * @file openvino/runtime/any.hpp + */ +#pragma once + +#include +#include +#include +#include +#include +#include + +#include "openvino/core/attribute_visitor.hpp" +#include "openvino/core/except.hpp" +#include "openvino/core/variant.hpp" + +namespace InferenceEngine { +class InferencePlugin; +class ExecutableNetwork; +} // namespace InferenceEngine + +namespace ov { + +class Node; +class Variant; +class ParamMap; + +namespace runtime { +class ExecutableNetwork; +class RemoteContext; +class RemoteTensor; +class InferencePlugin; +} // namespace runtime + +/** + * @brief This class represents an object to work with different types + */ +class OPENVINO_API Any { + std::shared_ptr _so; + + template + using decay_t = typename std::decay::type; + + template + struct IsNullPointer : std::is_same::type> {}; + + template + struct Ostreamable { + template + static auto test(U*) -> decltype(std::declval() << std::declval(), std::true_type()) { + return {}; + } + template + static auto test(...) -> std::false_type { + return {}; + } + constexpr static const auto value = std::is_same(nullptr))>::value; + }; + + template + struct EqualityComparable { + static void* conv(bool); + template + static char test(decltype(conv(std::declval() == std::declval()))); + template + static long test(...); + constexpr static const bool value = sizeof(test(nullptr)) == sizeof(char); + }; + + template + struct EqualityComparable> { + static void* conv(bool); + template + static char test(decltype(conv(std::declval() == std::declval() && + std::declval() == + std::declval()))); + template + static long test(...); + constexpr static const bool value = sizeof(test>(nullptr)) == sizeof(char); + }; + + /** + * @brief Base API of erased type + */ + class OPENVINO_API Base : public std::enable_shared_from_this { + public: + void type_check(const std::type_info&) const; + + using Ptr = std::shared_ptr; + virtual const std::type_info& type_info() const = 0; + virtual const void* addressof() const = 0; + void* addressof() { + return const_cast(const_cast(this)->addressof()); + } + virtual Base::Ptr copy() const = 0; + virtual bool equal(const Base& rhs) const = 0; + virtual void print(std::ostream&) const = 0; + + virtual const DiscreteTypeInfo& get_type_info() const = 0; + virtual std::shared_ptr as_variant() const; + virtual bool is_copyable() const; + virtual Any init(const std::shared_ptr& node); + virtual Any merge(const std::vector>& nodes); + virtual std::string to_string(); + std::string to_string() const; + virtual bool visit_attributes(AttributeVisitor&); + bool visit_attributes(AttributeVisitor&) const; + + template + bool is() const { + return typeid(decay_t) == type_info(); + } + + template + T& as() & { + type_check(typeid(decay_t)); + return *static_cast*>(addressof()); + } + + template + const T& as() const& { + type_check(typeid(decay_t)); + return *static_cast*>(addressof()); + } + + protected: + ~Base() = default; + }; + + template + struct Impl; + template + struct Impl>::value>::type> + : public Base { + const DiscreteTypeInfo& get_type_info() const override { + return static_cast(variant.get())->get_type_info(); + } + std::shared_ptr as_variant() const override { + return std::dynamic_pointer_cast(variant); + } + bool is_copyable() const override { + return static_cast(variant.get())->is_copyable(); + } + Any init(const std::shared_ptr& node) override { + return static_cast(variant.get())->init(node); + } + Any merge(const std::vector>& nodes) override { + return static_cast(variant.get())->merge(nodes); + } + std::string to_string() override { + return static_cast(variant.get())->to_string(); + } + bool visit_attributes(AttributeVisitor& visitor) override { + return static_cast(variant.get())->visit_attributes(visitor); + } + + Impl(const T& variant_) : variant{variant_} {} + + const std::type_info& type_info() const override { + return typeid(T); + } + + const void* addressof() const override { + return std::addressof(variant); + } + + Base::Ptr copy() const override { + return std::make_shared>(this->variant); + } + + template + static typename std::enable_if::value, bool>::type equal_impl(const U& rhs, + const U& lhs) { + return rhs == lhs; + } + template + [[noreturn]] static typename std::enable_if::value, bool>::type equal_impl(const U&, + const U&) { + throw ov::Exception{"Could not compare types without equality operator"}; + } + + bool equal(const Base& rhs) const override { + if (rhs.is()) { + return equal_impl(this->variant, rhs.as()); + } + return false; + } + + void print(std::ostream& os) const override { + os << variant->to_string(); + } + + T variant; + }; + + template + struct Impl>::value>::type> + : public Base { + OPENVINO_RTTI(typeid(T).name()); + + template + Impl(Args&&... args) : value(std::forward(args)...) {} + + const std::type_info& type_info() const override { + return typeid(T); + } + + const void* addressof() const override { + return std::addressof(value); + } + + Base::Ptr copy() const override { + return std::make_shared>(this->value); + } + + template + static typename std::enable_if::value, bool>::type equal_impl(const U& rhs, + const U& lhs) { + return rhs == lhs; + } + template + [[noreturn]] static typename std::enable_if::value, bool>::type equal_impl(const U&, + const U&) { + throw ov::Exception{"Could not compare types without equality operator"}; + } + + bool equal(const Base& rhs) const override { + if (rhs.is()) { + return equal_impl(this->value, rhs.as()); + } + return false; + } + + template + static typename std::enable_if::value>::type print_impl(std::ostream& os, const U& value) { + os << value; + } + + template + static typename std::enable_if::value>::type print_impl(std::ostream&, const U&) {} + + void print(std::ostream& os) const override { + print_impl(os, value); + } + + T value; + }; + + friend class ::ov::Variant; + friend class ::ov::ParamMap; + friend class ::InferenceEngine::InferencePlugin; + friend class ::InferenceEngine::ExecutableNetwork; + friend class ::ov::runtime::ExecutableNetwork; + friend class ::ov::runtime::RemoteContext; + friend class ::ov::runtime::RemoteTensor; + friend class ::ov::runtime::InferencePlugin; + + Any(const std::shared_ptr& so, const Any& other); + + void impl_check() const; + + mutable Base::Ptr _variant_impl; + + Base::Ptr _impl; + +public: + /** + * @brief Default constructor + */ + Any() = default; + + /** + * @brief Constructor creates any with object + * + * @tparam T Any type + * @param value object + */ + template , Any>::value && !std::is_abstract>::value && + !std::is_convertible, Base::Ptr>::value, + bool>::type = true> + Any(T&& value) : _impl{std::make_shared>>(std::forward(value))} {} + + /** + * @brief Constructor creates string any from char * + * + * @param str char array + */ + Any(const char* str); + + /** + * @brief Empty constructor + * + */ + Any(const std::nullptr_t); + + /** + * @brief Inplace value construction function + * + * @tparam T Any type + * @tparam Args pack of paramter types passed to T constructor + * @param args pack of paramters passed to T constructor + */ + template + static Any make(Args&&... args) { + Any any; + any._impl = std::make_shared>>(std::forward(args)...); + return any; + } + + /** + * Checks that any contains a value + * @return false if any contains a value else false + */ + bool empty() const; + + /** + * @brief check the type of value in any + * @tparam T Type of value + * @return true if type of value is correct + */ + template + typename std::enable_if>::value, bool>::type is() const { + if (_impl != nullptr) { + return _impl->type_info() == typeid(decay_t); + } else { + return false; + } + } + + /** + * @brief check the type of value in any + * @tparam T Type of value + * @return true if type of value is correct + */ + template + typename std::enable_if>::value, bool>::type is() const { + if (_impl != nullptr) { + if (_impl->type_info() == typeid(decay_t)) { + return true; + } else { + auto variant = _impl->as_variant(); + if (variant == nullptr) { + return false; + } else { + return std::dynamic_pointer_cast(variant) != nullptr; + } + } + } else { + return false; + } + } + + /** + * Dynamic cast to specified type + * @tparam T type + * @return casted object + */ + template + typename std::enable_if>::value, T>::type&& as() && { + if (_impl == nullptr) { + _variant_impl = std::make_shared>>(T{}); + return _variant_impl->as(); + } else { + if (_impl->type_info() == typeid(decay_t)) { + return std::move(*static_cast*>(_impl->addressof())); + } else { + auto variant = _impl->as_variant(); + if (variant == nullptr) { + throw ov::Exception{std::string{"Any does not contains pointer to variant. It contains "} + + _impl->type_info().name()}; + } + auto vptr = std::dynamic_pointer_cast(variant); + if (vptr == nullptr && T::element_type::get_type_info_static() != variant->get_type_info() && + T::element_type::get_type_info_static() != Variant::get_type_info_static()) { + throw ov::Exception{std::string{"Could not cast Any variant to "} + typeid(T).name() + " from " + + _impl->type_info().name() + "; from " + + static_cast(variant->get_type_info()) + " to " + + static_cast(T::element_type::get_type_info_static())}; + } + vptr = std::static_pointer_cast(variant); + _variant_impl = std::make_shared>>(vptr); + return _variant_impl->as(); + } + } + } + + /** + * Dynamic cast to specified type + * @tparam T type + * @return casted object + */ + template + typename std::enable_if>::value, T>::type& as() & { + if (_impl == nullptr) { + _variant_impl = std::make_shared>>(T{}); + return _variant_impl->as(); + } else { + if (_impl->type_info() == typeid(decay_t)) { + return *static_cast*>(_impl->addressof()); + } else { + auto variant = _impl->as_variant(); + if (variant == nullptr) { + throw ov::Exception{std::string{"Any does not contains pointer to variant. It contains "} + + _impl->type_info().name()}; + } + auto vptr = std::dynamic_pointer_cast(variant); + if (vptr == nullptr && T::element_type::get_type_info_static() != variant->get_type_info() && + T::element_type::get_type_info_static() != Variant::get_type_info_static()) { + throw ov::Exception{std::string{"Could not cast Any variant to "} + typeid(T).name() + " from " + + _impl->type_info().name() + "; from " + + static_cast(variant->get_type_info()) + " to " + + static_cast(T::element_type::get_type_info_static())}; + } + vptr = std::static_pointer_cast(variant); + _variant_impl = std::make_shared>>(vptr); + return _variant_impl->as(); + } + } + } + + /** + * Dynamic cast to specified type + * @tparam T type + * @return casted object + */ + template + const typename std::enable_if>::value, T>::type& as() const& { + if (_impl == nullptr) { + _variant_impl = std::make_shared>>(T{}); + return _variant_impl->as(); + } else { + if (_impl->type_info() == typeid(decay_t)) { + return *static_cast*>(_impl->addressof()); + } else { + auto variant = _impl->as_variant(); + if (variant == nullptr) { + throw ov::Exception{std::string{"Any does not contains pointer to variant. It contains "} + + _impl->type_info().name()}; + } + auto vptr = std::dynamic_pointer_cast(variant); + if (vptr == nullptr && T::element_type::get_type_info_static() != variant->get_type_info() && + T::element_type::get_type_info_static() != Variant::get_type_info_static()) { + throw ov::Exception{std::string{"Could not cast Any variant to "} + typeid(T).name() + " from " + + _impl->type_info().name() + "; from " + + static_cast(variant->get_type_info()) + " to " + + static_cast(T::element_type::get_type_info_static())}; + } + vptr = std::static_pointer_cast(variant); + _variant_impl = std::make_shared>>(vptr); + return _variant_impl->as(); + } + } + } + + /** + * Dynamic cast to specified type + * @tparam T type + * @return casted object + */ + template + typename std::enable_if>::value, T>::type&& as() && { + impl_check(); + _impl->type_check(typeid(decay_t)); + return std::move(*static_cast*>(_impl->addressof())); + } + + /** + * Dynamic cast to specified type + * @tparam T type + * @return casted object + */ + template + typename std::enable_if>::value, T>::type& as() & { + impl_check(); + _impl->type_check(typeid(decay_t)); + return *static_cast*>(_impl->addressof()); + } + + /** + * Dynamic cast to specified type + * @tparam T type + * @return casted object + */ + template + const typename std::enable_if>::value, T>::type& as() const& { + impl_check(); + _impl->type_check(typeid(decay_t)); + return *static_cast*>(_impl->addressof()); + } + + /** + * @brief Converts to specified type + * @tparam T type + * @return casted object + */ + template + operator T&() & { + return as(); + } + + /** + * @brief Converts to specified type + * @tparam T type + * @return casted object + */ + template + operator const T&() const& { + return as(); + } + + /** + * @brief Converts to specified type + * @tparam T type + * @return casted object + */ + template + operator T&() const& { + return const_cast(this)->as(); + } + + /** + * @brief Converts to specified type + * @tparam T type + * @return casted object + */ + template + operator T &&() && { + return std::move(as()); + } + + /** + * @brief The comparison operator for the Any + * + * @param other object to compare + * @return true if objects are equal + */ + bool operator==(const Any& other) const; + + /** + * @brief The comparison operator for the Any + * + * @param other object to compare + * @return true if objects are equal + */ + bool operator==(const std::nullptr_t&) const; + + /** + * @brief The comparison operator for the Any + * + * @param other object to compare + * @return true if objects aren't equal + */ + bool operator!=(const Any& other) const; + + /** + * @brief Standard pointer operator + * @return underlined interface + */ + OPENVINO_DEPRECATED("Please use as() method") + Base* operator->(); + + /** + * @brief Standard pointer operator + * @return underlined interface + */ + OPENVINO_DEPRECATED("Please use as() method") + const Base* operator->() const; + + /** + * @brief Prints underlying object to the given output stream. + * Uses operator<< if it is defined, leaves stream unchanged otherwise. + * In case of empty any or nullptr stream immediately returns. + * + * @param stream Output stream object will be printed to. + */ + void print(std::ostream& stream) const; + + /** + * @brief Return pointer to underlined interface + * @return underlined interface + */ + OPENVINO_DEPRECATED("Please use as() method") + Base* get() { + impl_check(); + return _impl.get(); + } + + /** + * @brief Return pointer to underlined interface + * @return underlined interface + */ + OPENVINO_DEPRECATED("Please use as() method") + const Base* get() const { + impl_check(); + return _impl.get(); + } +}; + +namespace util { +template <> +struct AsTypePtr { + template + static std::shared_ptr call(const Any& any) { + if (any.is>()) { + return any.as>(); + } else { + return {}; + } + } +}; +} // namespace util + +using RTMap = std::map; + +} // namespace ov + +namespace std { +template +std::shared_ptr dynamic_pointer_cast(const ::ov::Any& any) { + if (any.is>()) { + return any.as>(); + } else { + return {}; + } +} + +template +std::shared_ptr static_pointer_cast(const ::ov::Any& any) { + return any.as>(); +} + +} // namespace std diff --git a/ngraph/core/include/openvino/core/attribute_adapter.hpp b/src/core/include/openvino/core/attribute_adapter.hpp similarity index 100% rename from ngraph/core/include/openvino/core/attribute_adapter.hpp rename to src/core/include/openvino/core/attribute_adapter.hpp diff --git a/ngraph/core/include/openvino/core/attribute_visitor.hpp b/src/core/include/openvino/core/attribute_visitor.hpp similarity index 100% rename from ngraph/core/include/openvino/core/attribute_visitor.hpp rename to src/core/include/openvino/core/attribute_visitor.hpp diff --git a/ngraph/core/include/openvino/core/axis_set.hpp b/src/core/include/openvino/core/axis_set.hpp similarity index 100% rename from ngraph/core/include/openvino/core/axis_set.hpp rename to src/core/include/openvino/core/axis_set.hpp diff --git a/ngraph/core/include/openvino/core/axis_vector.hpp b/src/core/include/openvino/core/axis_vector.hpp similarity index 100% rename from ngraph/core/include/openvino/core/axis_vector.hpp rename to src/core/include/openvino/core/axis_vector.hpp diff --git a/ngraph/core/include/openvino/core/coordinate.hpp b/src/core/include/openvino/core/coordinate.hpp similarity index 100% rename from ngraph/core/include/openvino/core/coordinate.hpp rename to src/core/include/openvino/core/coordinate.hpp diff --git a/ngraph/core/include/openvino/core/coordinate_diff.hpp b/src/core/include/openvino/core/coordinate_diff.hpp similarity index 100% rename from ngraph/core/include/openvino/core/coordinate_diff.hpp rename to src/core/include/openvino/core/coordinate_diff.hpp diff --git a/ngraph/core/include/openvino/core/core.hpp b/src/core/include/openvino/core/core.hpp similarity index 100% rename from ngraph/core/include/openvino/core/core.hpp rename to src/core/include/openvino/core/core.hpp diff --git a/ngraph/core/include/openvino/core/core_visibility.hpp b/src/core/include/openvino/core/core_visibility.hpp similarity index 100% rename from ngraph/core/include/openvino/core/core_visibility.hpp rename to src/core/include/openvino/core/core_visibility.hpp diff --git a/ngraph/core/include/openvino/core/deprecated.hpp b/src/core/include/openvino/core/deprecated.hpp similarity index 100% rename from ngraph/core/include/openvino/core/deprecated.hpp rename to src/core/include/openvino/core/deprecated.hpp diff --git a/ngraph/core/include/openvino/core/descriptor/input.hpp b/src/core/include/openvino/core/descriptor/input.hpp similarity index 100% rename from ngraph/core/include/openvino/core/descriptor/input.hpp rename to src/core/include/openvino/core/descriptor/input.hpp diff --git a/ngraph/core/include/openvino/core/descriptor/output.hpp b/src/core/include/openvino/core/descriptor/output.hpp similarity index 100% rename from ngraph/core/include/openvino/core/descriptor/output.hpp rename to src/core/include/openvino/core/descriptor/output.hpp diff --git a/ngraph/core/include/openvino/core/descriptor/tensor.hpp b/src/core/include/openvino/core/descriptor/tensor.hpp similarity index 98% rename from ngraph/core/include/openvino/core/descriptor/tensor.hpp rename to src/core/include/openvino/core/descriptor/tensor.hpp index 0f9f7f970c8..10d3fa00da1 100644 --- a/ngraph/core/include/openvino/core/descriptor/tensor.hpp +++ b/src/core/include/openvino/core/descriptor/tensor.hpp @@ -11,6 +11,7 @@ #include #include +#include "openvino/core/any.hpp" #include "openvino/core/core_visibility.hpp" #include "openvino/core/partial_shape.hpp" #include "openvino/core/shape.hpp" @@ -105,7 +106,6 @@ protected: // It was decided to move m_shape and m_partial_shape synchronization point there and // to keep methods signature backward compatible. mutable std::mutex m_mutex; - mutable std::atomic_bool m_shape_changed; mutable Shape m_shape; // TODO: end @@ -114,7 +114,8 @@ protected: std::string m_name; std::unordered_set m_names; - std::map> m_rt_info; + std::map m_rt_info; + mutable std::atomic_bool m_shape_changed; }; OPENVINO_API diff --git a/ngraph/core/include/openvino/core/dimension.hpp b/src/core/include/openvino/core/dimension.hpp similarity index 100% rename from ngraph/core/include/openvino/core/dimension.hpp rename to src/core/include/openvino/core/dimension.hpp diff --git a/ngraph/core/include/openvino/core/enum_mask.hpp b/src/core/include/openvino/core/enum_mask.hpp similarity index 100% rename from ngraph/core/include/openvino/core/enum_mask.hpp rename to src/core/include/openvino/core/enum_mask.hpp diff --git a/ngraph/core/include/openvino/core/enum_names.hpp b/src/core/include/openvino/core/enum_names.hpp similarity index 100% rename from ngraph/core/include/openvino/core/enum_names.hpp rename to src/core/include/openvino/core/enum_names.hpp diff --git a/ngraph/core/include/openvino/core/except.hpp b/src/core/include/openvino/core/except.hpp similarity index 100% rename from ngraph/core/include/openvino/core/except.hpp rename to src/core/include/openvino/core/except.hpp diff --git a/ngraph/core/include/openvino/core/extension.hpp b/src/core/include/openvino/core/extension.hpp similarity index 100% rename from ngraph/core/include/openvino/core/extension.hpp rename to src/core/include/openvino/core/extension.hpp diff --git a/ngraph/core/include/openvino/core/function.hpp b/src/core/include/openvino/core/function.hpp similarity index 95% rename from ngraph/core/include/openvino/core/function.hpp rename to src/core/include/openvino/core/function.hpp index e61621079f6..9fb61bbc853 100644 --- a/ngraph/core/include/openvino/core/function.hpp +++ b/src/core/include/openvino/core/function.hpp @@ -115,9 +115,9 @@ public: ov::Output input(size_t i) const; ov::Output input(const std::string& tensor_name) const; - void add_output(const std::string& tensor_name); - void add_output(const std::string& op_name, size_t output_idx); - void add_output(const ov::Output& port); + ov::Output add_output(const std::string& tensor_name); + ov::Output add_output(const std::string& op_name, size_t output_idx); + ov::Output add_output(const ov::Output& port); void reshape(const std::map& partial_shapes); void reshape(const std::map, ov::PartialShape>& partial_shapes); @@ -192,9 +192,16 @@ public: /// Index for parameter, or -1 int64_t get_parameter_index(const std::shared_ptr& parameter) const; - /// Index for value or result referencing it, or -1 + /// \brief Return the index of this function's Result represented by the "value" Output object. + /// This method returns -1 if an the passed output is not related to the Results of a function. + /// \param value Output containing Node int64_t get_result_index(const ov::Output& value) const; + /// \brief Return the index of this function's Result represented by the "value" Output object. + /// This method returns -1 if an the passed output is not related to the Results of a function. + /// \param value Output containing Node + int64_t get_result_index(const ov::Output& value) const; + /// \deprecated Use evaluate with ov::runtime::Tensor instead /// \brief Evaluate the function on inputs, putting results in outputs. /// \param output_tensors Tensors for the outputs to compute. One for each result diff --git a/ngraph/core/include/openvino/core/graph_util.hpp b/src/core/include/openvino/core/graph_util.hpp similarity index 100% rename from ngraph/core/include/openvino/core/graph_util.hpp rename to src/core/include/openvino/core/graph_util.hpp diff --git a/ngraph/core/include/openvino/core/interval.hpp b/src/core/include/openvino/core/interval.hpp similarity index 100% rename from ngraph/core/include/openvino/core/interval.hpp rename to src/core/include/openvino/core/interval.hpp diff --git a/ngraph/core/include/openvino/core/layout.hpp b/src/core/include/openvino/core/layout.hpp similarity index 100% rename from ngraph/core/include/openvino/core/layout.hpp rename to src/core/include/openvino/core/layout.hpp diff --git a/ngraph/core/include/openvino/core/node.hpp b/src/core/include/openvino/core/node.hpp similarity index 99% rename from ngraph/core/include/openvino/core/node.hpp rename to src/core/include/openvino/core/node.hpp index aa918ec3475..4abdd23b1ea 100644 --- a/ngraph/core/include/openvino/core/node.hpp +++ b/src/core/include/openvino/core/node.hpp @@ -77,7 +77,7 @@ class SharedRTInfo; /// EvaluationContext stores and manages a context (additional parameters, values and /// environment) for evaluating ov::Function. -using EvaluationContext = std::map>; +using EvaluationContext = ov::RTMap; OPENVINO_API std::string node_validation_failure_loc_string(const Node* node); @@ -405,7 +405,7 @@ public: /// True if this and node have one output with same element type and shape bool has_same_type(std::shared_ptr node) const; - using RTMap = std::map>; + using RTMap = std::map; RTMap& get_rt_info() { return m_rt_info; diff --git a/ngraph/core/include/openvino/core/node_input.hpp b/src/core/include/openvino/core/node_input.hpp similarity index 100% rename from ngraph/core/include/openvino/core/node_input.hpp rename to src/core/include/openvino/core/node_input.hpp diff --git a/ngraph/core/include/openvino/core/node_output.hpp b/src/core/include/openvino/core/node_output.hpp similarity index 100% rename from ngraph/core/include/openvino/core/node_output.hpp rename to src/core/include/openvino/core/node_output.hpp diff --git a/ngraph/core/include/openvino/core/node_vector.hpp b/src/core/include/openvino/core/node_vector.hpp similarity index 100% rename from ngraph/core/include/openvino/core/node_vector.hpp rename to src/core/include/openvino/core/node_vector.hpp diff --git a/ngraph/core/include/openvino/core/op_extension.hpp b/src/core/include/openvino/core/op_extension.hpp similarity index 100% rename from ngraph/core/include/openvino/core/op_extension.hpp rename to src/core/include/openvino/core/op_extension.hpp diff --git a/ngraph/core/include/openvino/core/partial_shape.hpp b/src/core/include/openvino/core/partial_shape.hpp similarity index 100% rename from ngraph/core/include/openvino/core/partial_shape.hpp rename to src/core/include/openvino/core/partial_shape.hpp diff --git a/ngraph/core/include/openvino/core/preprocess/color_format.hpp b/src/core/include/openvino/core/preprocess/color_format.hpp similarity index 100% rename from ngraph/core/include/openvino/core/preprocess/color_format.hpp rename to src/core/include/openvino/core/preprocess/color_format.hpp diff --git a/ngraph/core/include/openvino/core/preprocess/input_info.hpp b/src/core/include/openvino/core/preprocess/input_info.hpp similarity index 100% rename from ngraph/core/include/openvino/core/preprocess/input_info.hpp rename to src/core/include/openvino/core/preprocess/input_info.hpp diff --git a/ngraph/core/include/openvino/core/preprocess/input_network_info.hpp b/src/core/include/openvino/core/preprocess/input_network_info.hpp similarity index 100% rename from ngraph/core/include/openvino/core/preprocess/input_network_info.hpp rename to src/core/include/openvino/core/preprocess/input_network_info.hpp diff --git a/ngraph/core/include/openvino/core/preprocess/input_tensor_info.hpp b/src/core/include/openvino/core/preprocess/input_tensor_info.hpp similarity index 100% rename from ngraph/core/include/openvino/core/preprocess/input_tensor_info.hpp rename to src/core/include/openvino/core/preprocess/input_tensor_info.hpp diff --git a/ngraph/core/include/openvino/core/preprocess/output_info.hpp b/src/core/include/openvino/core/preprocess/output_info.hpp similarity index 100% rename from ngraph/core/include/openvino/core/preprocess/output_info.hpp rename to src/core/include/openvino/core/preprocess/output_info.hpp diff --git a/ngraph/core/include/openvino/core/preprocess/output_network_info.hpp b/src/core/include/openvino/core/preprocess/output_network_info.hpp similarity index 100% rename from ngraph/core/include/openvino/core/preprocess/output_network_info.hpp rename to src/core/include/openvino/core/preprocess/output_network_info.hpp diff --git a/ngraph/core/include/openvino/core/preprocess/output_tensor_info.hpp b/src/core/include/openvino/core/preprocess/output_tensor_info.hpp similarity index 100% rename from ngraph/core/include/openvino/core/preprocess/output_tensor_info.hpp rename to src/core/include/openvino/core/preprocess/output_tensor_info.hpp diff --git a/ngraph/core/include/openvino/core/preprocess/postprocess_steps.hpp b/src/core/include/openvino/core/preprocess/postprocess_steps.hpp similarity index 100% rename from ngraph/core/include/openvino/core/preprocess/postprocess_steps.hpp rename to src/core/include/openvino/core/preprocess/postprocess_steps.hpp diff --git a/ngraph/core/include/openvino/core/preprocess/pre_post_process.hpp b/src/core/include/openvino/core/preprocess/pre_post_process.hpp similarity index 100% rename from ngraph/core/include/openvino/core/preprocess/pre_post_process.hpp rename to src/core/include/openvino/core/preprocess/pre_post_process.hpp diff --git a/ngraph/core/include/openvino/core/preprocess/preprocess_steps.hpp b/src/core/include/openvino/core/preprocess/preprocess_steps.hpp similarity index 100% rename from ngraph/core/include/openvino/core/preprocess/preprocess_steps.hpp rename to src/core/include/openvino/core/preprocess/preprocess_steps.hpp diff --git a/ngraph/core/include/openvino/core/preprocess/resize_algorithm.hpp b/src/core/include/openvino/core/preprocess/resize_algorithm.hpp similarity index 100% rename from ngraph/core/include/openvino/core/preprocess/resize_algorithm.hpp rename to src/core/include/openvino/core/preprocess/resize_algorithm.hpp diff --git a/ngraph/core/include/openvino/core/rank.hpp b/src/core/include/openvino/core/rank.hpp similarity index 100% rename from ngraph/core/include/openvino/core/rank.hpp rename to src/core/include/openvino/core/rank.hpp diff --git a/ngraph/core/include/openvino/core/rtti.hpp b/src/core/include/openvino/core/rtti.hpp similarity index 100% rename from ngraph/core/include/openvino/core/rtti.hpp rename to src/core/include/openvino/core/rtti.hpp diff --git a/ngraph/core/include/openvino/core/shape.hpp b/src/core/include/openvino/core/shape.hpp similarity index 100% rename from ngraph/core/include/openvino/core/shape.hpp rename to src/core/include/openvino/core/shape.hpp diff --git a/ngraph/core/include/openvino/core/strides.hpp b/src/core/include/openvino/core/strides.hpp similarity index 100% rename from ngraph/core/include/openvino/core/strides.hpp rename to src/core/include/openvino/core/strides.hpp diff --git a/ngraph/core/include/openvino/core/type.hpp b/src/core/include/openvino/core/type.hpp similarity index 85% rename from ngraph/core/include/openvino/core/type.hpp rename to src/core/include/openvino/core/type.hpp index 08eb5c24070..6b89f4c5f03 100644 --- a/ngraph/core/include/openvino/core/type.hpp +++ b/src/core/include/openvino/core/type.hpp @@ -87,7 +87,6 @@ typename std::enable_if< is_type(Value value) { return value->get_type_info().is_castable(Type::type_info); } -OPENVINO_SUPPRESS_DEPRECATED_END template typename std::enable_if< @@ -98,6 +97,7 @@ typename std::enable_if< is_type(Value value) { return value->get_type_info().is_castable(Type::get_type_info_static()); } +OPENVINO_SUPPRESS_DEPRECATED_END /// Casts a Value* to a Type* if it is of type Type, nullptr otherwise template @@ -107,14 +107,25 @@ as_type(Value value) { return ov::is_type(value) ? static_cast(value) : nullptr; } +namespace util { +template +struct AsTypePtr; /// Casts a std::shared_ptr to a std::shared_ptr if it is of type /// Type, nullptr otherwise -template -typename std::enable_if< - std::is_convertible(std::declval())), std::shared_ptr>::value, - std::shared_ptr>::type -as_type_ptr(Value value) { - return ov::is_type(value) ? std::static_pointer_cast(value) : std::shared_ptr(); +template +struct AsTypePtr> { + template + static std::shared_ptr call(const std::shared_ptr& value) { + return ov::is_type(value) ? std::static_pointer_cast(value) : std::shared_ptr(); + } +}; +} // namespace util + +/// Casts a std::shared_ptr to a std::shared_ptr if it is of type +/// Type, nullptr otherwise +template +auto as_type_ptr(const U& value) -> decltype(::ov::util::AsTypePtr::template call(value)) { + return ::ov::util::AsTypePtr::template call(value); } } // namespace ov diff --git a/ngraph/core/include/openvino/core/type/bfloat16.hpp b/src/core/include/openvino/core/type/bfloat16.hpp similarity index 100% rename from ngraph/core/include/openvino/core/type/bfloat16.hpp rename to src/core/include/openvino/core/type/bfloat16.hpp diff --git a/ngraph/core/include/openvino/core/type/element_type.hpp b/src/core/include/openvino/core/type/element_type.hpp similarity index 100% rename from ngraph/core/include/openvino/core/type/element_type.hpp rename to src/core/include/openvino/core/type/element_type.hpp diff --git a/ngraph/core/include/openvino/core/type/element_type_traits.hpp b/src/core/include/openvino/core/type/element_type_traits.hpp similarity index 100% rename from ngraph/core/include/openvino/core/type/element_type_traits.hpp rename to src/core/include/openvino/core/type/element_type_traits.hpp diff --git a/ngraph/core/include/openvino/core/type/float16.hpp b/src/core/include/openvino/core/type/float16.hpp similarity index 100% rename from ngraph/core/include/openvino/core/type/float16.hpp rename to src/core/include/openvino/core/type/float16.hpp diff --git a/ngraph/core/include/openvino/core/validation_util.hpp b/src/core/include/openvino/core/validation_util.hpp similarity index 100% rename from ngraph/core/include/openvino/core/validation_util.hpp rename to src/core/include/openvino/core/validation_util.hpp diff --git a/ngraph/core/include/openvino/core/variant.hpp b/src/core/include/openvino/core/variant.hpp similarity index 85% rename from ngraph/core/include/openvino/core/variant.hpp rename to src/core/include/openvino/core/variant.hpp index 5802fe14f9f..015fb744bf1 100644 --- a/ngraph/core/include/openvino/core/variant.hpp +++ b/src/core/include/openvino/core/variant.hpp @@ -15,16 +15,22 @@ namespace ov { class Node; class AttributeVisitor; +class Any; using VariantTypeInfo = DiscreteTypeInfo; class OPENVINO_API Variant { public: + static const ::ov::DiscreteTypeInfo& get_type_info_static() { + static const ::ov::DiscreteTypeInfo type_info{"Variant", 0}; + return type_info; + } virtual ~Variant(); - virtual const VariantTypeInfo& get_type_info() const = 0; - + virtual const VariantTypeInfo& get_type_info() const { + return get_type_info_static(); + } virtual bool is_copyable() const; - virtual std::shared_ptr init(const std::shared_ptr& node); - virtual std::shared_ptr merge(const ov::NodeVector& nodes); + virtual Any init(const std::shared_ptr& node); + virtual Any merge(const ov::NodeVector& nodes); virtual std::string to_string() { return ""; } @@ -38,6 +44,7 @@ public: template class VariantImpl : public Variant { public: + OPENVINO_RTTI(typeid(VT).name(), "0"); using value_type = VT; VariantImpl() = default; @@ -103,7 +110,5 @@ inline std::shared_ptr make_variant(const wchar_t (&s)[N]) { return std::dynamic_pointer_cast>(std::make_shared>(s)); } #endif - -using RTMap = std::map>; using VariantVector = std::vector>; } // namespace ov diff --git a/ngraph/core/include/openvino/core/version.hpp b/src/core/include/openvino/core/version.hpp similarity index 100% rename from ngraph/core/include/openvino/core/version.hpp rename to src/core/include/openvino/core/version.hpp diff --git a/ngraph/core/include/openvino/core/visibility.hpp b/src/core/include/openvino/core/visibility.hpp similarity index 100% rename from ngraph/core/include/openvino/core/visibility.hpp rename to src/core/include/openvino/core/visibility.hpp diff --git a/ngraph/core/include/openvino/op/abs.hpp b/src/core/include/openvino/op/abs.hpp similarity index 100% rename from ngraph/core/include/openvino/op/abs.hpp rename to src/core/include/openvino/op/abs.hpp diff --git a/ngraph/core/include/openvino/op/acos.hpp b/src/core/include/openvino/op/acos.hpp similarity index 100% rename from ngraph/core/include/openvino/op/acos.hpp rename to src/core/include/openvino/op/acos.hpp diff --git a/ngraph/core/include/openvino/op/acosh.hpp b/src/core/include/openvino/op/acosh.hpp similarity index 100% rename from ngraph/core/include/openvino/op/acosh.hpp rename to src/core/include/openvino/op/acosh.hpp diff --git a/ngraph/core/include/openvino/op/adaptive_avg_pool.hpp b/src/core/include/openvino/op/adaptive_avg_pool.hpp similarity index 100% rename from ngraph/core/include/openvino/op/adaptive_avg_pool.hpp rename to src/core/include/openvino/op/adaptive_avg_pool.hpp diff --git a/ngraph/core/include/openvino/op/adaptive_max_pool.hpp b/src/core/include/openvino/op/adaptive_max_pool.hpp similarity index 100% rename from ngraph/core/include/openvino/op/adaptive_max_pool.hpp rename to src/core/include/openvino/op/adaptive_max_pool.hpp diff --git a/ngraph/core/include/openvino/op/add.hpp b/src/core/include/openvino/op/add.hpp similarity index 100% rename from ngraph/core/include/openvino/op/add.hpp rename to src/core/include/openvino/op/add.hpp diff --git a/ngraph/core/include/openvino/op/asin.hpp b/src/core/include/openvino/op/asin.hpp similarity index 100% rename from ngraph/core/include/openvino/op/asin.hpp rename to src/core/include/openvino/op/asin.hpp diff --git a/ngraph/core/include/openvino/op/asinh.hpp b/src/core/include/openvino/op/asinh.hpp similarity index 100% rename from ngraph/core/include/openvino/op/asinh.hpp rename to src/core/include/openvino/op/asinh.hpp diff --git a/ngraph/core/include/openvino/op/assign.hpp b/src/core/include/openvino/op/assign.hpp similarity index 100% rename from ngraph/core/include/openvino/op/assign.hpp rename to src/core/include/openvino/op/assign.hpp diff --git a/ngraph/core/include/openvino/op/atan.hpp b/src/core/include/openvino/op/atan.hpp similarity index 100% rename from ngraph/core/include/openvino/op/atan.hpp rename to src/core/include/openvino/op/atan.hpp diff --git a/ngraph/core/include/openvino/op/atanh.hpp b/src/core/include/openvino/op/atanh.hpp similarity index 100% rename from ngraph/core/include/openvino/op/atanh.hpp rename to src/core/include/openvino/op/atanh.hpp diff --git a/ngraph/core/include/openvino/op/avg_pool.hpp b/src/core/include/openvino/op/avg_pool.hpp similarity index 100% rename from ngraph/core/include/openvino/op/avg_pool.hpp rename to src/core/include/openvino/op/avg_pool.hpp diff --git a/ngraph/core/include/openvino/op/batch_norm.hpp b/src/core/include/openvino/op/batch_norm.hpp similarity index 100% rename from ngraph/core/include/openvino/op/batch_norm.hpp rename to src/core/include/openvino/op/batch_norm.hpp diff --git a/ngraph/core/include/openvino/op/batch_to_space.hpp b/src/core/include/openvino/op/batch_to_space.hpp similarity index 100% rename from ngraph/core/include/openvino/op/batch_to_space.hpp rename to src/core/include/openvino/op/batch_to_space.hpp diff --git a/ngraph/core/include/openvino/op/binary_convolution.hpp b/src/core/include/openvino/op/binary_convolution.hpp similarity index 100% rename from ngraph/core/include/openvino/op/binary_convolution.hpp rename to src/core/include/openvino/op/binary_convolution.hpp diff --git a/ngraph/core/include/openvino/op/broadcast.hpp b/src/core/include/openvino/op/broadcast.hpp similarity index 100% rename from ngraph/core/include/openvino/op/broadcast.hpp rename to src/core/include/openvino/op/broadcast.hpp diff --git a/ngraph/core/include/openvino/op/bucketize.hpp b/src/core/include/openvino/op/bucketize.hpp similarity index 100% rename from ngraph/core/include/openvino/op/bucketize.hpp rename to src/core/include/openvino/op/bucketize.hpp diff --git a/ngraph/core/include/openvino/op/ceiling.hpp b/src/core/include/openvino/op/ceiling.hpp similarity index 100% rename from ngraph/core/include/openvino/op/ceiling.hpp rename to src/core/include/openvino/op/ceiling.hpp diff --git a/ngraph/core/include/openvino/op/clamp.hpp b/src/core/include/openvino/op/clamp.hpp similarity index 100% rename from ngraph/core/include/openvino/op/clamp.hpp rename to src/core/include/openvino/op/clamp.hpp diff --git a/ngraph/core/include/openvino/op/concat.hpp b/src/core/include/openvino/op/concat.hpp similarity index 100% rename from ngraph/core/include/openvino/op/concat.hpp rename to src/core/include/openvino/op/concat.hpp diff --git a/ngraph/core/include/openvino/op/constant.hpp b/src/core/include/openvino/op/constant.hpp similarity index 100% rename from ngraph/core/include/openvino/op/constant.hpp rename to src/core/include/openvino/op/constant.hpp diff --git a/ngraph/core/include/openvino/op/convert.hpp b/src/core/include/openvino/op/convert.hpp similarity index 100% rename from ngraph/core/include/openvino/op/convert.hpp rename to src/core/include/openvino/op/convert.hpp diff --git a/ngraph/core/include/openvino/op/convert_like.hpp b/src/core/include/openvino/op/convert_like.hpp similarity index 100% rename from ngraph/core/include/openvino/op/convert_like.hpp rename to src/core/include/openvino/op/convert_like.hpp diff --git a/ngraph/core/include/openvino/op/convolution.hpp b/src/core/include/openvino/op/convolution.hpp similarity index 100% rename from ngraph/core/include/openvino/op/convolution.hpp rename to src/core/include/openvino/op/convolution.hpp diff --git a/ngraph/core/include/openvino/op/cos.hpp b/src/core/include/openvino/op/cos.hpp similarity index 100% rename from ngraph/core/include/openvino/op/cos.hpp rename to src/core/include/openvino/op/cos.hpp diff --git a/ngraph/core/include/openvino/op/cosh.hpp b/src/core/include/openvino/op/cosh.hpp similarity index 100% rename from ngraph/core/include/openvino/op/cosh.hpp rename to src/core/include/openvino/op/cosh.hpp diff --git a/ngraph/core/include/openvino/op/ctc_greedy_decoder.hpp b/src/core/include/openvino/op/ctc_greedy_decoder.hpp similarity index 100% rename from ngraph/core/include/openvino/op/ctc_greedy_decoder.hpp rename to src/core/include/openvino/op/ctc_greedy_decoder.hpp diff --git a/ngraph/core/include/openvino/op/ctc_greedy_decoder_seq_len.hpp b/src/core/include/openvino/op/ctc_greedy_decoder_seq_len.hpp similarity index 100% rename from ngraph/core/include/openvino/op/ctc_greedy_decoder_seq_len.hpp rename to src/core/include/openvino/op/ctc_greedy_decoder_seq_len.hpp diff --git a/ngraph/core/include/openvino/op/ctc_loss.hpp b/src/core/include/openvino/op/ctc_loss.hpp similarity index 100% rename from ngraph/core/include/openvino/op/ctc_loss.hpp rename to src/core/include/openvino/op/ctc_loss.hpp diff --git a/ngraph/core/include/openvino/op/cum_sum.hpp b/src/core/include/openvino/op/cum_sum.hpp similarity index 100% rename from ngraph/core/include/openvino/op/cum_sum.hpp rename to src/core/include/openvino/op/cum_sum.hpp diff --git a/ngraph/core/include/openvino/op/deformable_convolution.hpp b/src/core/include/openvino/op/deformable_convolution.hpp similarity index 100% rename from ngraph/core/include/openvino/op/deformable_convolution.hpp rename to src/core/include/openvino/op/deformable_convolution.hpp diff --git a/ngraph/core/include/openvino/op/deformable_psroi_pooling.hpp b/src/core/include/openvino/op/deformable_psroi_pooling.hpp similarity index 100% rename from ngraph/core/include/openvino/op/deformable_psroi_pooling.hpp rename to src/core/include/openvino/op/deformable_psroi_pooling.hpp diff --git a/ngraph/core/include/openvino/op/depth_to_space.hpp b/src/core/include/openvino/op/depth_to_space.hpp similarity index 100% rename from ngraph/core/include/openvino/op/depth_to_space.hpp rename to src/core/include/openvino/op/depth_to_space.hpp diff --git a/ngraph/core/include/openvino/op/detection_output.hpp b/src/core/include/openvino/op/detection_output.hpp similarity index 100% rename from ngraph/core/include/openvino/op/detection_output.hpp rename to src/core/include/openvino/op/detection_output.hpp diff --git a/ngraph/core/include/openvino/op/dft.hpp b/src/core/include/openvino/op/dft.hpp similarity index 100% rename from ngraph/core/include/openvino/op/dft.hpp rename to src/core/include/openvino/op/dft.hpp diff --git a/ngraph/core/include/openvino/op/divide.hpp b/src/core/include/openvino/op/divide.hpp similarity index 100% rename from ngraph/core/include/openvino/op/divide.hpp rename to src/core/include/openvino/op/divide.hpp diff --git a/ngraph/core/include/openvino/op/einsum.hpp b/src/core/include/openvino/op/einsum.hpp similarity index 100% rename from ngraph/core/include/openvino/op/einsum.hpp rename to src/core/include/openvino/op/einsum.hpp diff --git a/ngraph/core/include/openvino/op/elu.hpp b/src/core/include/openvino/op/elu.hpp similarity index 100% rename from ngraph/core/include/openvino/op/elu.hpp rename to src/core/include/openvino/op/elu.hpp diff --git a/ngraph/core/include/openvino/op/embedding_segments_sum.hpp b/src/core/include/openvino/op/embedding_segments_sum.hpp similarity index 100% rename from ngraph/core/include/openvino/op/embedding_segments_sum.hpp rename to src/core/include/openvino/op/embedding_segments_sum.hpp diff --git a/ngraph/core/include/openvino/op/embeddingbag_offsets_sum.hpp b/src/core/include/openvino/op/embeddingbag_offsets_sum.hpp similarity index 100% rename from ngraph/core/include/openvino/op/embeddingbag_offsets_sum.hpp rename to src/core/include/openvino/op/embeddingbag_offsets_sum.hpp diff --git a/ngraph/core/include/openvino/op/embeddingbag_packedsum.hpp b/src/core/include/openvino/op/embeddingbag_packedsum.hpp similarity index 100% rename from ngraph/core/include/openvino/op/embeddingbag_packedsum.hpp rename to src/core/include/openvino/op/embeddingbag_packedsum.hpp diff --git a/ngraph/core/include/openvino/op/equal.hpp b/src/core/include/openvino/op/equal.hpp similarity index 100% rename from ngraph/core/include/openvino/op/equal.hpp rename to src/core/include/openvino/op/equal.hpp diff --git a/ngraph/core/include/openvino/op/erf.hpp b/src/core/include/openvino/op/erf.hpp similarity index 100% rename from ngraph/core/include/openvino/op/erf.hpp rename to src/core/include/openvino/op/erf.hpp diff --git a/ngraph/core/include/openvino/op/exp.hpp b/src/core/include/openvino/op/exp.hpp similarity index 100% rename from ngraph/core/include/openvino/op/exp.hpp rename to src/core/include/openvino/op/exp.hpp diff --git a/ngraph/core/include/openvino/op/experimental_detectron_detection_output.hpp b/src/core/include/openvino/op/experimental_detectron_detection_output.hpp similarity index 100% rename from ngraph/core/include/openvino/op/experimental_detectron_detection_output.hpp rename to src/core/include/openvino/op/experimental_detectron_detection_output.hpp diff --git a/ngraph/core/include/openvino/op/experimental_detectron_generate_proposals.hpp b/src/core/include/openvino/op/experimental_detectron_generate_proposals.hpp similarity index 100% rename from ngraph/core/include/openvino/op/experimental_detectron_generate_proposals.hpp rename to src/core/include/openvino/op/experimental_detectron_generate_proposals.hpp diff --git a/ngraph/core/include/openvino/op/experimental_detectron_prior_grid_generator.hpp b/src/core/include/openvino/op/experimental_detectron_prior_grid_generator.hpp similarity index 100% rename from ngraph/core/include/openvino/op/experimental_detectron_prior_grid_generator.hpp rename to src/core/include/openvino/op/experimental_detectron_prior_grid_generator.hpp diff --git a/ngraph/core/include/openvino/op/experimental_detectron_roi_feature.hpp b/src/core/include/openvino/op/experimental_detectron_roi_feature.hpp similarity index 100% rename from ngraph/core/include/openvino/op/experimental_detectron_roi_feature.hpp rename to src/core/include/openvino/op/experimental_detectron_roi_feature.hpp diff --git a/ngraph/core/include/openvino/op/experimental_detectron_topkrois.hpp b/src/core/include/openvino/op/experimental_detectron_topkrois.hpp similarity index 100% rename from ngraph/core/include/openvino/op/experimental_detectron_topkrois.hpp rename to src/core/include/openvino/op/experimental_detectron_topkrois.hpp diff --git a/ngraph/core/include/openvino/op/extractimagepatches.hpp b/src/core/include/openvino/op/extractimagepatches.hpp similarity index 100% rename from ngraph/core/include/openvino/op/extractimagepatches.hpp rename to src/core/include/openvino/op/extractimagepatches.hpp diff --git a/ngraph/core/include/openvino/op/fake_quantize.hpp b/src/core/include/openvino/op/fake_quantize.hpp similarity index 100% rename from ngraph/core/include/openvino/op/fake_quantize.hpp rename to src/core/include/openvino/op/fake_quantize.hpp diff --git a/ngraph/core/include/openvino/op/floor.hpp b/src/core/include/openvino/op/floor.hpp similarity index 100% rename from ngraph/core/include/openvino/op/floor.hpp rename to src/core/include/openvino/op/floor.hpp diff --git a/ngraph/core/include/openvino/op/floor_mod.hpp b/src/core/include/openvino/op/floor_mod.hpp similarity index 100% rename from ngraph/core/include/openvino/op/floor_mod.hpp rename to src/core/include/openvino/op/floor_mod.hpp diff --git a/ngraph/core/include/openvino/op/gather.hpp b/src/core/include/openvino/op/gather.hpp similarity index 100% rename from ngraph/core/include/openvino/op/gather.hpp rename to src/core/include/openvino/op/gather.hpp diff --git a/ngraph/core/include/openvino/op/gather_elements.hpp b/src/core/include/openvino/op/gather_elements.hpp similarity index 100% rename from ngraph/core/include/openvino/op/gather_elements.hpp rename to src/core/include/openvino/op/gather_elements.hpp diff --git a/ngraph/core/include/openvino/op/gather_nd.hpp b/src/core/include/openvino/op/gather_nd.hpp similarity index 100% rename from ngraph/core/include/openvino/op/gather_nd.hpp rename to src/core/include/openvino/op/gather_nd.hpp diff --git a/ngraph/core/include/openvino/op/gather_tree.hpp b/src/core/include/openvino/op/gather_tree.hpp similarity index 100% rename from ngraph/core/include/openvino/op/gather_tree.hpp rename to src/core/include/openvino/op/gather_tree.hpp diff --git a/ngraph/core/include/openvino/op/gelu.hpp b/src/core/include/openvino/op/gelu.hpp similarity index 100% rename from ngraph/core/include/openvino/op/gelu.hpp rename to src/core/include/openvino/op/gelu.hpp diff --git a/ngraph/core/include/openvino/op/greater.hpp b/src/core/include/openvino/op/greater.hpp similarity index 100% rename from ngraph/core/include/openvino/op/greater.hpp rename to src/core/include/openvino/op/greater.hpp diff --git a/ngraph/core/include/openvino/op/greater_eq.hpp b/src/core/include/openvino/op/greater_eq.hpp similarity index 100% rename from ngraph/core/include/openvino/op/greater_eq.hpp rename to src/core/include/openvino/op/greater_eq.hpp diff --git a/ngraph/core/include/openvino/op/grn.hpp b/src/core/include/openvino/op/grn.hpp similarity index 100% rename from ngraph/core/include/openvino/op/grn.hpp rename to src/core/include/openvino/op/grn.hpp diff --git a/ngraph/core/include/openvino/op/group_conv.hpp b/src/core/include/openvino/op/group_conv.hpp similarity index 100% rename from ngraph/core/include/openvino/op/group_conv.hpp rename to src/core/include/openvino/op/group_conv.hpp diff --git a/ngraph/core/include/openvino/op/gru_cell.hpp b/src/core/include/openvino/op/gru_cell.hpp similarity index 100% rename from ngraph/core/include/openvino/op/gru_cell.hpp rename to src/core/include/openvino/op/gru_cell.hpp diff --git a/ngraph/core/include/openvino/op/gru_sequence.hpp b/src/core/include/openvino/op/gru_sequence.hpp similarity index 100% rename from ngraph/core/include/openvino/op/gru_sequence.hpp rename to src/core/include/openvino/op/gru_sequence.hpp diff --git a/ngraph/core/include/openvino/op/hard_sigmoid.hpp b/src/core/include/openvino/op/hard_sigmoid.hpp similarity index 100% rename from ngraph/core/include/openvino/op/hard_sigmoid.hpp rename to src/core/include/openvino/op/hard_sigmoid.hpp diff --git a/ngraph/core/include/openvino/op/hsigmoid.hpp b/src/core/include/openvino/op/hsigmoid.hpp similarity index 100% rename from ngraph/core/include/openvino/op/hsigmoid.hpp rename to src/core/include/openvino/op/hsigmoid.hpp diff --git a/ngraph/core/include/openvino/op/hswish.hpp b/src/core/include/openvino/op/hswish.hpp similarity index 100% rename from ngraph/core/include/openvino/op/hswish.hpp rename to src/core/include/openvino/op/hswish.hpp diff --git a/ngraph/core/include/openvino/op/i420_to_bgr.hpp b/src/core/include/openvino/op/i420_to_bgr.hpp similarity index 100% rename from ngraph/core/include/openvino/op/i420_to_bgr.hpp rename to src/core/include/openvino/op/i420_to_bgr.hpp diff --git a/ngraph/core/include/openvino/op/i420_to_rgb.hpp b/src/core/include/openvino/op/i420_to_rgb.hpp similarity index 100% rename from ngraph/core/include/openvino/op/i420_to_rgb.hpp rename to src/core/include/openvino/op/i420_to_rgb.hpp diff --git a/ngraph/core/include/openvino/op/idft.hpp b/src/core/include/openvino/op/idft.hpp similarity index 100% rename from ngraph/core/include/openvino/op/idft.hpp rename to src/core/include/openvino/op/idft.hpp diff --git a/ngraph/core/include/openvino/op/if.hpp b/src/core/include/openvino/op/if.hpp similarity index 100% rename from ngraph/core/include/openvino/op/if.hpp rename to src/core/include/openvino/op/if.hpp diff --git a/ngraph/core/include/openvino/op/interpolate.hpp b/src/core/include/openvino/op/interpolate.hpp similarity index 100% rename from ngraph/core/include/openvino/op/interpolate.hpp rename to src/core/include/openvino/op/interpolate.hpp diff --git a/ngraph/core/include/openvino/op/less.hpp b/src/core/include/openvino/op/less.hpp similarity index 100% rename from ngraph/core/include/openvino/op/less.hpp rename to src/core/include/openvino/op/less.hpp diff --git a/ngraph/core/include/openvino/op/less_eq.hpp b/src/core/include/openvino/op/less_eq.hpp similarity index 100% rename from ngraph/core/include/openvino/op/less_eq.hpp rename to src/core/include/openvino/op/less_eq.hpp diff --git a/ngraph/core/include/openvino/op/log.hpp b/src/core/include/openvino/op/log.hpp similarity index 100% rename from ngraph/core/include/openvino/op/log.hpp rename to src/core/include/openvino/op/log.hpp diff --git a/ngraph/core/include/openvino/op/log_softmax.hpp b/src/core/include/openvino/op/log_softmax.hpp similarity index 100% rename from ngraph/core/include/openvino/op/log_softmax.hpp rename to src/core/include/openvino/op/log_softmax.hpp diff --git a/ngraph/core/include/openvino/op/logical_and.hpp b/src/core/include/openvino/op/logical_and.hpp similarity index 100% rename from ngraph/core/include/openvino/op/logical_and.hpp rename to src/core/include/openvino/op/logical_and.hpp diff --git a/ngraph/core/include/openvino/op/logical_not.hpp b/src/core/include/openvino/op/logical_not.hpp similarity index 100% rename from ngraph/core/include/openvino/op/logical_not.hpp rename to src/core/include/openvino/op/logical_not.hpp diff --git a/ngraph/core/include/openvino/op/logical_or.hpp b/src/core/include/openvino/op/logical_or.hpp similarity index 100% rename from ngraph/core/include/openvino/op/logical_or.hpp rename to src/core/include/openvino/op/logical_or.hpp diff --git a/ngraph/core/include/openvino/op/logical_xor.hpp b/src/core/include/openvino/op/logical_xor.hpp similarity index 100% rename from ngraph/core/include/openvino/op/logical_xor.hpp rename to src/core/include/openvino/op/logical_xor.hpp diff --git a/ngraph/core/include/openvino/op/loop.hpp b/src/core/include/openvino/op/loop.hpp similarity index 100% rename from ngraph/core/include/openvino/op/loop.hpp rename to src/core/include/openvino/op/loop.hpp diff --git a/ngraph/core/include/openvino/op/lrn.hpp b/src/core/include/openvino/op/lrn.hpp similarity index 100% rename from ngraph/core/include/openvino/op/lrn.hpp rename to src/core/include/openvino/op/lrn.hpp diff --git a/ngraph/core/include/openvino/op/lstm_cell.hpp b/src/core/include/openvino/op/lstm_cell.hpp similarity index 100% rename from ngraph/core/include/openvino/op/lstm_cell.hpp rename to src/core/include/openvino/op/lstm_cell.hpp diff --git a/ngraph/core/include/openvino/op/lstm_sequence.hpp b/src/core/include/openvino/op/lstm_sequence.hpp similarity index 100% rename from ngraph/core/include/openvino/op/lstm_sequence.hpp rename to src/core/include/openvino/op/lstm_sequence.hpp diff --git a/ngraph/core/include/openvino/op/matmul.hpp b/src/core/include/openvino/op/matmul.hpp similarity index 100% rename from ngraph/core/include/openvino/op/matmul.hpp rename to src/core/include/openvino/op/matmul.hpp diff --git a/ngraph/core/include/openvino/op/matrix_nms.hpp b/src/core/include/openvino/op/matrix_nms.hpp similarity index 74% rename from ngraph/core/include/openvino/op/matrix_nms.hpp rename to src/core/include/openvino/op/matrix_nms.hpp index 2567e36e6a2..907ecc6ec79 100644 --- a/ngraph/core/include/openvino/op/matrix_nms.hpp +++ b/src/core/include/openvino/op/matrix_nms.hpp @@ -45,6 +45,31 @@ public: float post_threshold = 0.0f; // specifies whether boxes are normalized or not bool normalized = true; + + Attributes() {} + + Attributes(op::v8::MatrixNms::SortResultType sort_result_type, + bool sort_result_across_batch, + ov::element::Type output_type, + float score_threshold, + int nms_top_k, + int keep_top_k, + int background_class, + op::v8::MatrixNms::DecayFunction decay_function, + float gaussian_sigma, + float post_threshold, + bool normalized) + : sort_result_type(sort_result_type), + sort_result_across_batch(sort_result_across_batch), + output_type(output_type), + score_threshold(score_threshold), + nms_top_k(nms_top_k), + keep_top_k(keep_top_k), + background_class(background_class), + decay_function(decay_function), + gaussian_sigma(gaussian_sigma), + post_threshold(post_threshold), + normalized(normalized) {} }; MatrixNms(); diff --git a/ngraph/core/include/openvino/op/max_pool.hpp b/src/core/include/openvino/op/max_pool.hpp similarity index 100% rename from ngraph/core/include/openvino/op/max_pool.hpp rename to src/core/include/openvino/op/max_pool.hpp diff --git a/ngraph/core/include/openvino/op/maximum.hpp b/src/core/include/openvino/op/maximum.hpp similarity index 100% rename from ngraph/core/include/openvino/op/maximum.hpp rename to src/core/include/openvino/op/maximum.hpp diff --git a/ngraph/core/include/openvino/op/minimum.hpp b/src/core/include/openvino/op/minimum.hpp similarity index 100% rename from ngraph/core/include/openvino/op/minimum.hpp rename to src/core/include/openvino/op/minimum.hpp diff --git a/ngraph/core/include/openvino/op/mish.hpp b/src/core/include/openvino/op/mish.hpp similarity index 100% rename from ngraph/core/include/openvino/op/mish.hpp rename to src/core/include/openvino/op/mish.hpp diff --git a/ngraph/core/include/openvino/op/mod.hpp b/src/core/include/openvino/op/mod.hpp similarity index 100% rename from ngraph/core/include/openvino/op/mod.hpp rename to src/core/include/openvino/op/mod.hpp diff --git a/ngraph/core/include/openvino/op/multiclass_nms.hpp b/src/core/include/openvino/op/multiclass_nms.hpp similarity index 100% rename from ngraph/core/include/openvino/op/multiclass_nms.hpp rename to src/core/include/openvino/op/multiclass_nms.hpp diff --git a/ngraph/core/include/openvino/op/multiply.hpp b/src/core/include/openvino/op/multiply.hpp similarity index 100% rename from ngraph/core/include/openvino/op/multiply.hpp rename to src/core/include/openvino/op/multiply.hpp diff --git a/ngraph/core/include/openvino/op/mvn.hpp b/src/core/include/openvino/op/mvn.hpp similarity index 100% rename from ngraph/core/include/openvino/op/mvn.hpp rename to src/core/include/openvino/op/mvn.hpp diff --git a/ngraph/core/include/openvino/op/negative.hpp b/src/core/include/openvino/op/negative.hpp similarity index 100% rename from ngraph/core/include/openvino/op/negative.hpp rename to src/core/include/openvino/op/negative.hpp diff --git a/ngraph/core/include/openvino/op/non_max_suppression.hpp b/src/core/include/openvino/op/non_max_suppression.hpp similarity index 100% rename from ngraph/core/include/openvino/op/non_max_suppression.hpp rename to src/core/include/openvino/op/non_max_suppression.hpp diff --git a/ngraph/core/include/openvino/op/non_zero.hpp b/src/core/include/openvino/op/non_zero.hpp similarity index 100% rename from ngraph/core/include/openvino/op/non_zero.hpp rename to src/core/include/openvino/op/non_zero.hpp diff --git a/ngraph/core/include/openvino/op/normalize_l2.hpp b/src/core/include/openvino/op/normalize_l2.hpp similarity index 100% rename from ngraph/core/include/openvino/op/normalize_l2.hpp rename to src/core/include/openvino/op/normalize_l2.hpp diff --git a/ngraph/core/include/openvino/op/not_equal.hpp b/src/core/include/openvino/op/not_equal.hpp similarity index 100% rename from ngraph/core/include/openvino/op/not_equal.hpp rename to src/core/include/openvino/op/not_equal.hpp diff --git a/ngraph/core/include/openvino/op/nv12_to_bgr.hpp b/src/core/include/openvino/op/nv12_to_bgr.hpp similarity index 100% rename from ngraph/core/include/openvino/op/nv12_to_bgr.hpp rename to src/core/include/openvino/op/nv12_to_bgr.hpp diff --git a/ngraph/core/include/openvino/op/nv12_to_rgb.hpp b/src/core/include/openvino/op/nv12_to_rgb.hpp similarity index 100% rename from ngraph/core/include/openvino/op/nv12_to_rgb.hpp rename to src/core/include/openvino/op/nv12_to_rgb.hpp diff --git a/ngraph/core/include/openvino/op/one_hot.hpp b/src/core/include/openvino/op/one_hot.hpp similarity index 100% rename from ngraph/core/include/openvino/op/one_hot.hpp rename to src/core/include/openvino/op/one_hot.hpp diff --git a/ngraph/core/include/openvino/op/op.hpp b/src/core/include/openvino/op/op.hpp similarity index 100% rename from ngraph/core/include/openvino/op/op.hpp rename to src/core/include/openvino/op/op.hpp diff --git a/ngraph/core/include/openvino/op/ops.hpp b/src/core/include/openvino/op/ops.hpp similarity index 100% rename from ngraph/core/include/openvino/op/ops.hpp rename to src/core/include/openvino/op/ops.hpp diff --git a/ngraph/core/include/openvino/op/pad.hpp b/src/core/include/openvino/op/pad.hpp similarity index 100% rename from ngraph/core/include/openvino/op/pad.hpp rename to src/core/include/openvino/op/pad.hpp diff --git a/ngraph/core/include/openvino/op/parameter.hpp b/src/core/include/openvino/op/parameter.hpp similarity index 100% rename from ngraph/core/include/openvino/op/parameter.hpp rename to src/core/include/openvino/op/parameter.hpp diff --git a/ngraph/core/include/openvino/op/power.hpp b/src/core/include/openvino/op/power.hpp similarity index 100% rename from ngraph/core/include/openvino/op/power.hpp rename to src/core/include/openvino/op/power.hpp diff --git a/ngraph/core/include/openvino/op/prelu.hpp b/src/core/include/openvino/op/prelu.hpp similarity index 100% rename from ngraph/core/include/openvino/op/prelu.hpp rename to src/core/include/openvino/op/prelu.hpp diff --git a/src/core/include/openvino/op/prior_box.hpp b/src/core/include/openvino/op/prior_box.hpp new file mode 100644 index 00000000000..53d8b8c5b70 --- /dev/null +++ b/src/core/include/openvino/op/prior_box.hpp @@ -0,0 +1,131 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include "openvino/op/op.hpp" + +namespace ov { +namespace op { +namespace v0 { +/// \brief Layer which generates prior boxes of specified sizes +/// normalized to input image size +class OPENVINO_API PriorBox : public Op { +public: + OPENVINO_OP("PriorBox", "opset1"); + BWDCMP_RTTI_DECLARATION; + struct Attributes { + // min_size Desired min_size of prior boxes + // max_size Desired max_size of prior boxes + // aspect_ratio Aspect ratios of prior boxes + // clip Clip output to [0,1] + // flip Flip aspect ratios + // step Distance between prior box centers + // offset Box offset relative to top center of image + // variance Values to adjust prior boxes with + // scale_all_sizes Scale all sizes + std::vector min_size; + std::vector max_size; + std::vector aspect_ratio; + std::vector density; + std::vector fixed_ratio; + std::vector fixed_size; + bool clip = false; + bool flip = false; + float step = 0.0f; + float offset = 0.0f; + std::vector variance; + bool scale_all_sizes = true; + }; + + PriorBox() = default; + /// \brief Constructs a PriorBox operation + /// + /// \param layer_shape Shape of layer for which prior boxes are computed + /// \param image_shape Shape of image to which prior boxes are scaled + /// \param attrs PriorBox attributes + PriorBox(const Output& layer_shape, const Output& image_shape, const Attributes& attrs); + + void validate_and_infer_types() override; + std::shared_ptr clone_with_new_inputs(const OutputVector& new_args) const override; + + static int64_t number_of_priors(const Attributes& attrs); + + static std::vector normalized_aspect_ratio(const std::vector& aspect_ratio, bool flip); + const Attributes& get_attrs() const { + return m_attrs; + } + bool visit_attributes(AttributeVisitor& visitor) override; + OPENVINO_SUPPRESS_DEPRECATED_START + bool evaluate(const HostTensorVector& outputs, const HostTensorVector& inputs) const override; + OPENVINO_SUPPRESS_DEPRECATED_END + bool has_evaluate() const override; + +private: + Attributes m_attrs; +}; +} // namespace v0 + +namespace v8 { +/// \brief Layer which generates prior boxes of specified sizes +/// normalized to input image size +class OPENVINO_API PriorBox : public Op { +public: + OPENVINO_OP("PriorBox", "opset8"); + BWDCMP_RTTI_DECLARATION; + struct Attributes { + // min_size Desired min_size of prior boxes + // max_size Desired max_size of prior boxes + // aspect_ratio Aspect ratios of prior boxes + // clip Clip output to [0,1] + // flip Flip aspect ratios + // step Distance between prior box centers + // offset Box offset relative to top center of image + // variance Values to adjust prior boxes with + // scale_all_sizes Scale all sizes + // min_max_aspect_ratios_order Order of output prior box + std::vector min_size; + std::vector max_size; + std::vector aspect_ratio; + std::vector density; + std::vector fixed_ratio; + std::vector fixed_size; + bool clip = false; + bool flip = false; + float step = 0.0f; + float offset = 0.0f; + std::vector variance; + bool scale_all_sizes = true; + bool min_max_aspect_ratios_order = true; + }; + + PriorBox() = default; + /// \brief Constructs a PriorBox operation + /// + /// \param layer_shape Shape of layer for which prior boxes are computed + /// \param image_shape Shape of image to which prior boxes are scaled + /// \param attrs PriorBox attributes + PriorBox(const Output& layer_shape, const Output& image_shape, const Attributes& attrs); + + void validate_and_infer_types() override; + std::shared_ptr clone_with_new_inputs(const OutputVector& new_args) const override; + + static int64_t number_of_priors(const Attributes& attrs); + + static std::vector normalized_aspect_ratio(const std::vector& aspect_ratio, bool flip); + const Attributes& get_attrs() const { + return m_attrs; + } + bool visit_attributes(AttributeVisitor& visitor) override; + OPENVINO_SUPPRESS_DEPRECATED_START + bool evaluate(const HostTensorVector& outputs, const HostTensorVector& inputs) const override; + OPENVINO_SUPPRESS_DEPRECATED_END + bool has_evaluate() const override; + +private: + Attributes m_attrs; +}; +} // namespace v8 +} // namespace op +} // namespace ov diff --git a/ngraph/core/include/openvino/op/prior_box_clustered.hpp b/src/core/include/openvino/op/prior_box_clustered.hpp similarity index 100% rename from ngraph/core/include/openvino/op/prior_box_clustered.hpp rename to src/core/include/openvino/op/prior_box_clustered.hpp diff --git a/ngraph/core/include/openvino/op/proposal.hpp b/src/core/include/openvino/op/proposal.hpp similarity index 100% rename from ngraph/core/include/openvino/op/proposal.hpp rename to src/core/include/openvino/op/proposal.hpp diff --git a/ngraph/core/include/openvino/op/psroi_pooling.hpp b/src/core/include/openvino/op/psroi_pooling.hpp similarity index 100% rename from ngraph/core/include/openvino/op/psroi_pooling.hpp rename to src/core/include/openvino/op/psroi_pooling.hpp diff --git a/ngraph/core/include/openvino/op/random_uniform.hpp b/src/core/include/openvino/op/random_uniform.hpp similarity index 100% rename from ngraph/core/include/openvino/op/random_uniform.hpp rename to src/core/include/openvino/op/random_uniform.hpp diff --git a/ngraph/core/include/openvino/op/range.hpp b/src/core/include/openvino/op/range.hpp similarity index 100% rename from ngraph/core/include/openvino/op/range.hpp rename to src/core/include/openvino/op/range.hpp diff --git a/ngraph/core/include/openvino/op/read_value.hpp b/src/core/include/openvino/op/read_value.hpp similarity index 100% rename from ngraph/core/include/openvino/op/read_value.hpp rename to src/core/include/openvino/op/read_value.hpp diff --git a/ngraph/core/include/openvino/op/reduce_l1.hpp b/src/core/include/openvino/op/reduce_l1.hpp similarity index 100% rename from ngraph/core/include/openvino/op/reduce_l1.hpp rename to src/core/include/openvino/op/reduce_l1.hpp diff --git a/ngraph/core/include/openvino/op/reduce_l2.hpp b/src/core/include/openvino/op/reduce_l2.hpp similarity index 100% rename from ngraph/core/include/openvino/op/reduce_l2.hpp rename to src/core/include/openvino/op/reduce_l2.hpp diff --git a/ngraph/core/include/openvino/op/reduce_logical_and.hpp b/src/core/include/openvino/op/reduce_logical_and.hpp similarity index 100% rename from ngraph/core/include/openvino/op/reduce_logical_and.hpp rename to src/core/include/openvino/op/reduce_logical_and.hpp diff --git a/ngraph/core/include/openvino/op/reduce_logical_or.hpp b/src/core/include/openvino/op/reduce_logical_or.hpp similarity index 100% rename from ngraph/core/include/openvino/op/reduce_logical_or.hpp rename to src/core/include/openvino/op/reduce_logical_or.hpp diff --git a/ngraph/core/include/openvino/op/reduce_max.hpp b/src/core/include/openvino/op/reduce_max.hpp similarity index 100% rename from ngraph/core/include/openvino/op/reduce_max.hpp rename to src/core/include/openvino/op/reduce_max.hpp diff --git a/ngraph/core/include/openvino/op/reduce_mean.hpp b/src/core/include/openvino/op/reduce_mean.hpp similarity index 100% rename from ngraph/core/include/openvino/op/reduce_mean.hpp rename to src/core/include/openvino/op/reduce_mean.hpp diff --git a/ngraph/core/include/openvino/op/reduce_min.hpp b/src/core/include/openvino/op/reduce_min.hpp similarity index 100% rename from ngraph/core/include/openvino/op/reduce_min.hpp rename to src/core/include/openvino/op/reduce_min.hpp diff --git a/ngraph/core/include/openvino/op/reduce_prod.hpp b/src/core/include/openvino/op/reduce_prod.hpp similarity index 100% rename from ngraph/core/include/openvino/op/reduce_prod.hpp rename to src/core/include/openvino/op/reduce_prod.hpp diff --git a/ngraph/core/include/openvino/op/reduce_sum.hpp b/src/core/include/openvino/op/reduce_sum.hpp similarity index 100% rename from ngraph/core/include/openvino/op/reduce_sum.hpp rename to src/core/include/openvino/op/reduce_sum.hpp diff --git a/ngraph/core/include/openvino/op/region_yolo.hpp b/src/core/include/openvino/op/region_yolo.hpp similarity index 100% rename from ngraph/core/include/openvino/op/region_yolo.hpp rename to src/core/include/openvino/op/region_yolo.hpp diff --git a/ngraph/core/include/openvino/op/relu.hpp b/src/core/include/openvino/op/relu.hpp similarity index 100% rename from ngraph/core/include/openvino/op/relu.hpp rename to src/core/include/openvino/op/relu.hpp diff --git a/ngraph/core/include/openvino/op/reorg_yolo.hpp b/src/core/include/openvino/op/reorg_yolo.hpp similarity index 100% rename from ngraph/core/include/openvino/op/reorg_yolo.hpp rename to src/core/include/openvino/op/reorg_yolo.hpp diff --git a/ngraph/core/include/openvino/op/reshape.hpp b/src/core/include/openvino/op/reshape.hpp similarity index 100% rename from ngraph/core/include/openvino/op/reshape.hpp rename to src/core/include/openvino/op/reshape.hpp diff --git a/ngraph/core/include/openvino/op/result.hpp b/src/core/include/openvino/op/result.hpp similarity index 100% rename from ngraph/core/include/openvino/op/result.hpp rename to src/core/include/openvino/op/result.hpp diff --git a/ngraph/core/include/openvino/op/reverse.hpp b/src/core/include/openvino/op/reverse.hpp similarity index 100% rename from ngraph/core/include/openvino/op/reverse.hpp rename to src/core/include/openvino/op/reverse.hpp diff --git a/ngraph/core/include/openvino/op/reverse_sequence.hpp b/src/core/include/openvino/op/reverse_sequence.hpp similarity index 100% rename from ngraph/core/include/openvino/op/reverse_sequence.hpp rename to src/core/include/openvino/op/reverse_sequence.hpp diff --git a/ngraph/core/include/openvino/op/rnn_cell.hpp b/src/core/include/openvino/op/rnn_cell.hpp similarity index 100% rename from ngraph/core/include/openvino/op/rnn_cell.hpp rename to src/core/include/openvino/op/rnn_cell.hpp diff --git a/ngraph/core/include/openvino/op/rnn_sequence.hpp b/src/core/include/openvino/op/rnn_sequence.hpp similarity index 100% rename from ngraph/core/include/openvino/op/rnn_sequence.hpp rename to src/core/include/openvino/op/rnn_sequence.hpp diff --git a/ngraph/core/include/openvino/op/roi_align.hpp b/src/core/include/openvino/op/roi_align.hpp similarity index 100% rename from ngraph/core/include/openvino/op/roi_align.hpp rename to src/core/include/openvino/op/roi_align.hpp diff --git a/ngraph/core/include/openvino/op/roi_pooling.hpp b/src/core/include/openvino/op/roi_pooling.hpp similarity index 100% rename from ngraph/core/include/openvino/op/roi_pooling.hpp rename to src/core/include/openvino/op/roi_pooling.hpp diff --git a/ngraph/core/include/openvino/op/roll.hpp b/src/core/include/openvino/op/roll.hpp similarity index 100% rename from ngraph/core/include/openvino/op/roll.hpp rename to src/core/include/openvino/op/roll.hpp diff --git a/ngraph/core/include/openvino/op/round.hpp b/src/core/include/openvino/op/round.hpp similarity index 100% rename from ngraph/core/include/openvino/op/round.hpp rename to src/core/include/openvino/op/round.hpp diff --git a/ngraph/core/include/openvino/op/scatter_elements_update.hpp b/src/core/include/openvino/op/scatter_elements_update.hpp similarity index 100% rename from ngraph/core/include/openvino/op/scatter_elements_update.hpp rename to src/core/include/openvino/op/scatter_elements_update.hpp diff --git a/ngraph/core/include/openvino/op/scatter_nd_update.hpp b/src/core/include/openvino/op/scatter_nd_update.hpp similarity index 100% rename from ngraph/core/include/openvino/op/scatter_nd_update.hpp rename to src/core/include/openvino/op/scatter_nd_update.hpp diff --git a/ngraph/core/include/openvino/op/scatter_update.hpp b/src/core/include/openvino/op/scatter_update.hpp similarity index 100% rename from ngraph/core/include/openvino/op/scatter_update.hpp rename to src/core/include/openvino/op/scatter_update.hpp diff --git a/ngraph/core/include/openvino/op/select.hpp b/src/core/include/openvino/op/select.hpp similarity index 100% rename from ngraph/core/include/openvino/op/select.hpp rename to src/core/include/openvino/op/select.hpp diff --git a/ngraph/core/include/openvino/op/selu.hpp b/src/core/include/openvino/op/selu.hpp similarity index 100% rename from ngraph/core/include/openvino/op/selu.hpp rename to src/core/include/openvino/op/selu.hpp diff --git a/ngraph/core/include/openvino/op/shape_of.hpp b/src/core/include/openvino/op/shape_of.hpp similarity index 100% rename from ngraph/core/include/openvino/op/shape_of.hpp rename to src/core/include/openvino/op/shape_of.hpp diff --git a/ngraph/core/include/openvino/op/shuffle_channels.hpp b/src/core/include/openvino/op/shuffle_channels.hpp similarity index 100% rename from ngraph/core/include/openvino/op/shuffle_channels.hpp rename to src/core/include/openvino/op/shuffle_channels.hpp diff --git a/ngraph/core/include/openvino/op/sigmoid.hpp b/src/core/include/openvino/op/sigmoid.hpp similarity index 100% rename from ngraph/core/include/openvino/op/sigmoid.hpp rename to src/core/include/openvino/op/sigmoid.hpp diff --git a/ngraph/core/include/openvino/op/sign.hpp b/src/core/include/openvino/op/sign.hpp similarity index 100% rename from ngraph/core/include/openvino/op/sign.hpp rename to src/core/include/openvino/op/sign.hpp diff --git a/ngraph/core/include/openvino/op/sin.hpp b/src/core/include/openvino/op/sin.hpp similarity index 100% rename from ngraph/core/include/openvino/op/sin.hpp rename to src/core/include/openvino/op/sin.hpp diff --git a/ngraph/core/include/openvino/op/sinh.hpp b/src/core/include/openvino/op/sinh.hpp similarity index 100% rename from ngraph/core/include/openvino/op/sinh.hpp rename to src/core/include/openvino/op/sinh.hpp diff --git a/ngraph/core/include/openvino/op/sink.hpp b/src/core/include/openvino/op/sink.hpp similarity index 100% rename from ngraph/core/include/openvino/op/sink.hpp rename to src/core/include/openvino/op/sink.hpp diff --git a/ngraph/core/include/openvino/op/slice.hpp b/src/core/include/openvino/op/slice.hpp similarity index 100% rename from ngraph/core/include/openvino/op/slice.hpp rename to src/core/include/openvino/op/slice.hpp diff --git a/ngraph/core/include/openvino/op/softmax.hpp b/src/core/include/openvino/op/softmax.hpp similarity index 100% rename from ngraph/core/include/openvino/op/softmax.hpp rename to src/core/include/openvino/op/softmax.hpp diff --git a/ngraph/core/include/openvino/op/softplus.hpp b/src/core/include/openvino/op/softplus.hpp similarity index 100% rename from ngraph/core/include/openvino/op/softplus.hpp rename to src/core/include/openvino/op/softplus.hpp diff --git a/ngraph/core/include/openvino/op/space_to_batch.hpp b/src/core/include/openvino/op/space_to_batch.hpp similarity index 100% rename from ngraph/core/include/openvino/op/space_to_batch.hpp rename to src/core/include/openvino/op/space_to_batch.hpp diff --git a/ngraph/core/include/openvino/op/space_to_depth.hpp b/src/core/include/openvino/op/space_to_depth.hpp similarity index 100% rename from ngraph/core/include/openvino/op/space_to_depth.hpp rename to src/core/include/openvino/op/space_to_depth.hpp diff --git a/ngraph/core/include/openvino/op/split.hpp b/src/core/include/openvino/op/split.hpp similarity index 100% rename from ngraph/core/include/openvino/op/split.hpp rename to src/core/include/openvino/op/split.hpp diff --git a/ngraph/core/include/openvino/op/sqrt.hpp b/src/core/include/openvino/op/sqrt.hpp similarity index 100% rename from ngraph/core/include/openvino/op/sqrt.hpp rename to src/core/include/openvino/op/sqrt.hpp diff --git a/ngraph/core/include/openvino/op/squared_difference.hpp b/src/core/include/openvino/op/squared_difference.hpp similarity index 100% rename from ngraph/core/include/openvino/op/squared_difference.hpp rename to src/core/include/openvino/op/squared_difference.hpp diff --git a/ngraph/core/include/openvino/op/squeeze.hpp b/src/core/include/openvino/op/squeeze.hpp similarity index 100% rename from ngraph/core/include/openvino/op/squeeze.hpp rename to src/core/include/openvino/op/squeeze.hpp diff --git a/ngraph/core/include/openvino/op/strided_slice.hpp b/src/core/include/openvino/op/strided_slice.hpp similarity index 100% rename from ngraph/core/include/openvino/op/strided_slice.hpp rename to src/core/include/openvino/op/strided_slice.hpp diff --git a/ngraph/core/include/openvino/op/subtract.hpp b/src/core/include/openvino/op/subtract.hpp similarity index 100% rename from ngraph/core/include/openvino/op/subtract.hpp rename to src/core/include/openvino/op/subtract.hpp diff --git a/ngraph/core/include/openvino/op/swish.hpp b/src/core/include/openvino/op/swish.hpp similarity index 100% rename from ngraph/core/include/openvino/op/swish.hpp rename to src/core/include/openvino/op/swish.hpp diff --git a/ngraph/core/include/openvino/op/tan.hpp b/src/core/include/openvino/op/tan.hpp similarity index 100% rename from ngraph/core/include/openvino/op/tan.hpp rename to src/core/include/openvino/op/tan.hpp diff --git a/ngraph/core/include/openvino/op/tanh.hpp b/src/core/include/openvino/op/tanh.hpp similarity index 100% rename from ngraph/core/include/openvino/op/tanh.hpp rename to src/core/include/openvino/op/tanh.hpp diff --git a/ngraph/core/include/openvino/op/tensor_iterator.hpp b/src/core/include/openvino/op/tensor_iterator.hpp similarity index 100% rename from ngraph/core/include/openvino/op/tensor_iterator.hpp rename to src/core/include/openvino/op/tensor_iterator.hpp diff --git a/ngraph/core/include/openvino/op/tile.hpp b/src/core/include/openvino/op/tile.hpp similarity index 100% rename from ngraph/core/include/openvino/op/tile.hpp rename to src/core/include/openvino/op/tile.hpp diff --git a/ngraph/core/include/openvino/op/topk.hpp b/src/core/include/openvino/op/topk.hpp similarity index 100% rename from ngraph/core/include/openvino/op/topk.hpp rename to src/core/include/openvino/op/topk.hpp diff --git a/ngraph/core/include/openvino/op/transpose.hpp b/src/core/include/openvino/op/transpose.hpp similarity index 100% rename from ngraph/core/include/openvino/op/transpose.hpp rename to src/core/include/openvino/op/transpose.hpp diff --git a/ngraph/core/include/openvino/op/unsqueeze.hpp b/src/core/include/openvino/op/unsqueeze.hpp similarity index 100% rename from ngraph/core/include/openvino/op/unsqueeze.hpp rename to src/core/include/openvino/op/unsqueeze.hpp diff --git a/ngraph/core/include/openvino/op/util/activation_functions.hpp b/src/core/include/openvino/op/util/activation_functions.hpp similarity index 100% rename from ngraph/core/include/openvino/op/util/activation_functions.hpp rename to src/core/include/openvino/op/util/activation_functions.hpp diff --git a/ngraph/core/include/openvino/op/util/arithmetic_reduction.hpp b/src/core/include/openvino/op/util/arithmetic_reduction.hpp similarity index 100% rename from ngraph/core/include/openvino/op/util/arithmetic_reduction.hpp rename to src/core/include/openvino/op/util/arithmetic_reduction.hpp diff --git a/ngraph/core/include/openvino/op/util/arithmetic_reductions_keep_dims.hpp b/src/core/include/openvino/op/util/arithmetic_reductions_keep_dims.hpp similarity index 100% rename from ngraph/core/include/openvino/op/util/arithmetic_reductions_keep_dims.hpp rename to src/core/include/openvino/op/util/arithmetic_reductions_keep_dims.hpp diff --git a/ngraph/core/include/openvino/op/util/assign_base.hpp b/src/core/include/openvino/op/util/assign_base.hpp similarity index 100% rename from ngraph/core/include/openvino/op/util/assign_base.hpp rename to src/core/include/openvino/op/util/assign_base.hpp diff --git a/ngraph/core/include/openvino/op/util/attr_types.hpp b/src/core/include/openvino/op/util/attr_types.hpp similarity index 100% rename from ngraph/core/include/openvino/op/util/attr_types.hpp rename to src/core/include/openvino/op/util/attr_types.hpp diff --git a/ngraph/core/include/openvino/op/util/binary_elementwise_arithmetic.hpp b/src/core/include/openvino/op/util/binary_elementwise_arithmetic.hpp similarity index 100% rename from ngraph/core/include/openvino/op/util/binary_elementwise_arithmetic.hpp rename to src/core/include/openvino/op/util/binary_elementwise_arithmetic.hpp diff --git a/ngraph/core/include/openvino/op/util/binary_elementwise_comparison.hpp b/src/core/include/openvino/op/util/binary_elementwise_comparison.hpp similarity index 100% rename from ngraph/core/include/openvino/op/util/binary_elementwise_comparison.hpp rename to src/core/include/openvino/op/util/binary_elementwise_comparison.hpp diff --git a/ngraph/core/include/openvino/op/util/binary_elementwise_logical.hpp b/src/core/include/openvino/op/util/binary_elementwise_logical.hpp similarity index 100% rename from ngraph/core/include/openvino/op/util/binary_elementwise_logical.hpp rename to src/core/include/openvino/op/util/binary_elementwise_logical.hpp diff --git a/ngraph/core/include/openvino/op/util/broadcast_base.hpp b/src/core/include/openvino/op/util/broadcast_base.hpp similarity index 100% rename from ngraph/core/include/openvino/op/util/broadcast_base.hpp rename to src/core/include/openvino/op/util/broadcast_base.hpp diff --git a/ngraph/core/include/openvino/op/util/convert_color_i420_base.hpp b/src/core/include/openvino/op/util/convert_color_i420_base.hpp similarity index 100% rename from ngraph/core/include/openvino/op/util/convert_color_i420_base.hpp rename to src/core/include/openvino/op/util/convert_color_i420_base.hpp diff --git a/ngraph/core/include/openvino/op/util/convert_color_nv12_base.hpp b/src/core/include/openvino/op/util/convert_color_nv12_base.hpp similarity index 100% rename from ngraph/core/include/openvino/op/util/convert_color_nv12_base.hpp rename to src/core/include/openvino/op/util/convert_color_nv12_base.hpp diff --git a/ngraph/core/include/openvino/op/util/deformable_convolution_base.hpp b/src/core/include/openvino/op/util/deformable_convolution_base.hpp similarity index 100% rename from ngraph/core/include/openvino/op/util/deformable_convolution_base.hpp rename to src/core/include/openvino/op/util/deformable_convolution_base.hpp diff --git a/ngraph/core/include/openvino/op/util/elementwise_args.hpp b/src/core/include/openvino/op/util/elementwise_args.hpp similarity index 100% rename from ngraph/core/include/openvino/op/util/elementwise_args.hpp rename to src/core/include/openvino/op/util/elementwise_args.hpp diff --git a/ngraph/core/include/openvino/op/util/embeddingbag_offsets_base.hpp b/src/core/include/openvino/op/util/embeddingbag_offsets_base.hpp similarity index 100% rename from ngraph/core/include/openvino/op/util/embeddingbag_offsets_base.hpp rename to src/core/include/openvino/op/util/embeddingbag_offsets_base.hpp diff --git a/ngraph/core/include/openvino/op/util/embeddingbag_packed_base.hpp b/src/core/include/openvino/op/util/embeddingbag_packed_base.hpp similarity index 100% rename from ngraph/core/include/openvino/op/util/embeddingbag_packed_base.hpp rename to src/core/include/openvino/op/util/embeddingbag_packed_base.hpp diff --git a/ngraph/core/include/openvino/op/util/fft_base.hpp b/src/core/include/openvino/op/util/fft_base.hpp similarity index 100% rename from ngraph/core/include/openvino/op/util/fft_base.hpp rename to src/core/include/openvino/op/util/fft_base.hpp diff --git a/ngraph/core/include/openvino/op/util/framework_node.hpp b/src/core/include/openvino/op/util/framework_node.hpp similarity index 100% rename from ngraph/core/include/openvino/op/util/framework_node.hpp rename to src/core/include/openvino/op/util/framework_node.hpp diff --git a/ngraph/core/include/openvino/op/util/gather_base.hpp b/src/core/include/openvino/op/util/gather_base.hpp similarity index 100% rename from ngraph/core/include/openvino/op/util/gather_base.hpp rename to src/core/include/openvino/op/util/gather_base.hpp diff --git a/ngraph/core/include/openvino/op/util/gather_nd_base.hpp b/src/core/include/openvino/op/util/gather_nd_base.hpp similarity index 100% rename from ngraph/core/include/openvino/op/util/gather_nd_base.hpp rename to src/core/include/openvino/op/util/gather_nd_base.hpp diff --git a/ngraph/core/include/openvino/op/util/index_reduction.hpp b/src/core/include/openvino/op/util/index_reduction.hpp similarity index 100% rename from ngraph/core/include/openvino/op/util/index_reduction.hpp rename to src/core/include/openvino/op/util/index_reduction.hpp diff --git a/ngraph/core/include/openvino/op/util/logical_reduction.hpp b/src/core/include/openvino/op/util/logical_reduction.hpp similarity index 100% rename from ngraph/core/include/openvino/op/util/logical_reduction.hpp rename to src/core/include/openvino/op/util/logical_reduction.hpp diff --git a/ngraph/core/include/openvino/op/util/logical_reduction_keep_dims.hpp b/src/core/include/openvino/op/util/logical_reduction_keep_dims.hpp similarity index 100% rename from ngraph/core/include/openvino/op/util/logical_reduction_keep_dims.hpp rename to src/core/include/openvino/op/util/logical_reduction_keep_dims.hpp diff --git a/ngraph/core/include/openvino/op/util/max_pool_base.hpp b/src/core/include/openvino/op/util/max_pool_base.hpp similarity index 100% rename from ngraph/core/include/openvino/op/util/max_pool_base.hpp rename to src/core/include/openvino/op/util/max_pool_base.hpp diff --git a/ngraph/core/include/openvino/op/util/multi_subgraph_base.hpp b/src/core/include/openvino/op/util/multi_subgraph_base.hpp similarity index 100% rename from ngraph/core/include/openvino/op/util/multi_subgraph_base.hpp rename to src/core/include/openvino/op/util/multi_subgraph_base.hpp diff --git a/ngraph/core/include/openvino/op/util/nms_base.hpp b/src/core/include/openvino/op/util/nms_base.hpp similarity index 100% rename from ngraph/core/include/openvino/op/util/nms_base.hpp rename to src/core/include/openvino/op/util/nms_base.hpp diff --git a/ngraph/core/include/openvino/op/util/op_types.hpp b/src/core/include/openvino/op/util/op_types.hpp similarity index 100% rename from ngraph/core/include/openvino/op/util/op_types.hpp rename to src/core/include/openvino/op/util/op_types.hpp diff --git a/ngraph/core/include/openvino/op/util/precision_sensitive_attribute.hpp b/src/core/include/openvino/op/util/precision_sensitive_attribute.hpp similarity index 100% rename from ngraph/core/include/openvino/op/util/precision_sensitive_attribute.hpp rename to src/core/include/openvino/op/util/precision_sensitive_attribute.hpp diff --git a/ngraph/core/include/openvino/op/util/read_value_base.hpp b/src/core/include/openvino/op/util/read_value_base.hpp similarity index 100% rename from ngraph/core/include/openvino/op/util/read_value_base.hpp rename to src/core/include/openvino/op/util/read_value_base.hpp diff --git a/ngraph/core/include/openvino/op/util/reduction_base.hpp b/src/core/include/openvino/op/util/reduction_base.hpp similarity index 100% rename from ngraph/core/include/openvino/op/util/reduction_base.hpp rename to src/core/include/openvino/op/util/reduction_base.hpp diff --git a/ngraph/core/include/openvino/op/util/rnn_cell_base.hpp b/src/core/include/openvino/op/util/rnn_cell_base.hpp similarity index 100% rename from ngraph/core/include/openvino/op/util/rnn_cell_base.hpp rename to src/core/include/openvino/op/util/rnn_cell_base.hpp diff --git a/ngraph/core/include/openvino/op/util/scatter_base.hpp b/src/core/include/openvino/op/util/scatter_base.hpp similarity index 100% rename from ngraph/core/include/openvino/op/util/scatter_base.hpp rename to src/core/include/openvino/op/util/scatter_base.hpp diff --git a/ngraph/core/include/openvino/op/util/scatter_nd_base.hpp b/src/core/include/openvino/op/util/scatter_nd_base.hpp similarity index 100% rename from ngraph/core/include/openvino/op/util/scatter_nd_base.hpp rename to src/core/include/openvino/op/util/scatter_nd_base.hpp diff --git a/ngraph/core/include/openvino/op/util/sub_graph_base.hpp b/src/core/include/openvino/op/util/sub_graph_base.hpp similarity index 100% rename from ngraph/core/include/openvino/op/util/sub_graph_base.hpp rename to src/core/include/openvino/op/util/sub_graph_base.hpp diff --git a/ngraph/core/include/openvino/op/util/unary_elementwise_arithmetic.hpp b/src/core/include/openvino/op/util/unary_elementwise_arithmetic.hpp similarity index 100% rename from ngraph/core/include/openvino/op/util/unary_elementwise_arithmetic.hpp rename to src/core/include/openvino/op/util/unary_elementwise_arithmetic.hpp diff --git a/ngraph/core/include/openvino/op/util/variable.hpp b/src/core/include/openvino/op/util/variable.hpp similarity index 100% rename from ngraph/core/include/openvino/op/util/variable.hpp rename to src/core/include/openvino/op/util/variable.hpp diff --git a/ngraph/core/include/openvino/op/util/variable_context.hpp b/src/core/include/openvino/op/util/variable_context.hpp similarity index 100% rename from ngraph/core/include/openvino/op/util/variable_context.hpp rename to src/core/include/openvino/op/util/variable_context.hpp diff --git a/ngraph/core/include/openvino/op/util/variable_extension.hpp b/src/core/include/openvino/op/util/variable_extension.hpp similarity index 100% rename from ngraph/core/include/openvino/op/util/variable_extension.hpp rename to src/core/include/openvino/op/util/variable_extension.hpp diff --git a/ngraph/core/include/openvino/op/util/variable_value.hpp b/src/core/include/openvino/op/util/variable_value.hpp similarity index 100% rename from ngraph/core/include/openvino/op/util/variable_value.hpp rename to src/core/include/openvino/op/util/variable_value.hpp diff --git a/ngraph/core/include/openvino/op/variadic_split.hpp b/src/core/include/openvino/op/variadic_split.hpp similarity index 100% rename from ngraph/core/include/openvino/op/variadic_split.hpp rename to src/core/include/openvino/op/variadic_split.hpp diff --git a/ngraph/core/include/openvino/op/xor.hpp b/src/core/include/openvino/op/xor.hpp similarity index 100% rename from ngraph/core/include/openvino/op/xor.hpp rename to src/core/include/openvino/op/xor.hpp diff --git a/ngraph/core/include/openvino/opsets/opset.hpp b/src/core/include/openvino/opsets/opset.hpp similarity index 100% rename from ngraph/core/include/openvino/opsets/opset.hpp rename to src/core/include/openvino/opsets/opset.hpp diff --git a/ngraph/core/include/openvino/opsets/opset1.hpp b/src/core/include/openvino/opsets/opset1.hpp similarity index 100% rename from ngraph/core/include/openvino/opsets/opset1.hpp rename to src/core/include/openvino/opsets/opset1.hpp diff --git a/ngraph/core/include/openvino/opsets/opset1_tbl.hpp b/src/core/include/openvino/opsets/opset1_tbl.hpp similarity index 100% rename from ngraph/core/include/openvino/opsets/opset1_tbl.hpp rename to src/core/include/openvino/opsets/opset1_tbl.hpp diff --git a/ngraph/core/include/openvino/opsets/opset2.hpp b/src/core/include/openvino/opsets/opset2.hpp similarity index 100% rename from ngraph/core/include/openvino/opsets/opset2.hpp rename to src/core/include/openvino/opsets/opset2.hpp diff --git a/ngraph/core/include/openvino/opsets/opset2_tbl.hpp b/src/core/include/openvino/opsets/opset2_tbl.hpp similarity index 100% rename from ngraph/core/include/openvino/opsets/opset2_tbl.hpp rename to src/core/include/openvino/opsets/opset2_tbl.hpp diff --git a/ngraph/core/include/openvino/opsets/opset3.hpp b/src/core/include/openvino/opsets/opset3.hpp similarity index 100% rename from ngraph/core/include/openvino/opsets/opset3.hpp rename to src/core/include/openvino/opsets/opset3.hpp diff --git a/ngraph/core/include/openvino/opsets/opset3_tbl.hpp b/src/core/include/openvino/opsets/opset3_tbl.hpp similarity index 100% rename from ngraph/core/include/openvino/opsets/opset3_tbl.hpp rename to src/core/include/openvino/opsets/opset3_tbl.hpp diff --git a/ngraph/core/include/openvino/opsets/opset4.hpp b/src/core/include/openvino/opsets/opset4.hpp similarity index 100% rename from ngraph/core/include/openvino/opsets/opset4.hpp rename to src/core/include/openvino/opsets/opset4.hpp diff --git a/ngraph/core/include/openvino/opsets/opset4_tbl.hpp b/src/core/include/openvino/opsets/opset4_tbl.hpp similarity index 100% rename from ngraph/core/include/openvino/opsets/opset4_tbl.hpp rename to src/core/include/openvino/opsets/opset4_tbl.hpp diff --git a/ngraph/core/include/openvino/opsets/opset5.hpp b/src/core/include/openvino/opsets/opset5.hpp similarity index 100% rename from ngraph/core/include/openvino/opsets/opset5.hpp rename to src/core/include/openvino/opsets/opset5.hpp diff --git a/ngraph/core/include/openvino/opsets/opset5_tbl.hpp b/src/core/include/openvino/opsets/opset5_tbl.hpp similarity index 100% rename from ngraph/core/include/openvino/opsets/opset5_tbl.hpp rename to src/core/include/openvino/opsets/opset5_tbl.hpp diff --git a/ngraph/core/include/openvino/opsets/opset6.hpp b/src/core/include/openvino/opsets/opset6.hpp similarity index 100% rename from ngraph/core/include/openvino/opsets/opset6.hpp rename to src/core/include/openvino/opsets/opset6.hpp diff --git a/ngraph/core/include/openvino/opsets/opset6_tbl.hpp b/src/core/include/openvino/opsets/opset6_tbl.hpp similarity index 100% rename from ngraph/core/include/openvino/opsets/opset6_tbl.hpp rename to src/core/include/openvino/opsets/opset6_tbl.hpp diff --git a/ngraph/core/include/openvino/opsets/opset7.hpp b/src/core/include/openvino/opsets/opset7.hpp similarity index 100% rename from ngraph/core/include/openvino/opsets/opset7.hpp rename to src/core/include/openvino/opsets/opset7.hpp diff --git a/ngraph/core/include/openvino/opsets/opset7_tbl.hpp b/src/core/include/openvino/opsets/opset7_tbl.hpp similarity index 100% rename from ngraph/core/include/openvino/opsets/opset7_tbl.hpp rename to src/core/include/openvino/opsets/opset7_tbl.hpp diff --git a/ngraph/core/include/openvino/opsets/opset8.hpp b/src/core/include/openvino/opsets/opset8.hpp similarity index 100% rename from ngraph/core/include/openvino/opsets/opset8.hpp rename to src/core/include/openvino/opsets/opset8.hpp diff --git a/ngraph/core/include/openvino/opsets/opset8_tbl.hpp b/src/core/include/openvino/opsets/opset8_tbl.hpp similarity index 99% rename from ngraph/core/include/openvino/opsets/opset8_tbl.hpp rename to src/core/include/openvino/opsets/opset8_tbl.hpp index 14f9dbc8d46..a11dd507302 100644 --- a/ngraph/core/include/openvino/opsets/opset8_tbl.hpp +++ b/src/core/include/openvino/opsets/opset8_tbl.hpp @@ -71,7 +71,6 @@ _OPENVINO_OP_REG(PSROIPooling, ov::op::v0) _OPENVINO_OP_REG(Pad, ov::op::v1) _OPENVINO_OP_REG(Parameter, ov::op::v0) _OPENVINO_OP_REG(Power, ov::op::v1) -_OPENVINO_OP_REG(PriorBox, ov::op::v0) _OPENVINO_OP_REG(PriorBoxClustered, ov::op::v0) _OPENVINO_OP_REG(Proposal, ov::op::v4) _OPENVINO_OP_REG(Range, ov::op::v4) @@ -188,3 +187,4 @@ _OPENVINO_OP_REG(NV12toRGB, ov::op::v8) _OPENVINO_OP_REG(RandomUniform, ov::op::v8) _OPENVINO_OP_REG(Slice, ov::op::v8) _OPENVINO_OP_REG(If, ov::op::v8) +_OPENVINO_OP_REG(PriorBox, ov::op::v8) diff --git a/ngraph/core/include/openvino/pass/constant_folding.hpp b/src/core/include/openvino/pass/constant_folding.hpp similarity index 100% rename from ngraph/core/include/openvino/pass/constant_folding.hpp rename to src/core/include/openvino/pass/constant_folding.hpp diff --git a/ngraph/core/include/openvino/pass/convert_fp32_to_fp16.hpp b/src/core/include/openvino/pass/convert_fp32_to_fp16.hpp similarity index 100% rename from ngraph/core/include/openvino/pass/convert_fp32_to_fp16.hpp rename to src/core/include/openvino/pass/convert_fp32_to_fp16.hpp diff --git a/ngraph/core/include/openvino/pass/graph_rewrite.hpp b/src/core/include/openvino/pass/graph_rewrite.hpp similarity index 100% rename from ngraph/core/include/openvino/pass/graph_rewrite.hpp rename to src/core/include/openvino/pass/graph_rewrite.hpp diff --git a/ngraph/core/include/openvino/pass/low_latency.hpp b/src/core/include/openvino/pass/low_latency.hpp similarity index 100% rename from ngraph/core/include/openvino/pass/low_latency.hpp rename to src/core/include/openvino/pass/low_latency.hpp diff --git a/ngraph/core/include/openvino/pass/make_stateful.hpp b/src/core/include/openvino/pass/make_stateful.hpp similarity index 100% rename from ngraph/core/include/openvino/pass/make_stateful.hpp rename to src/core/include/openvino/pass/make_stateful.hpp diff --git a/ngraph/core/include/openvino/pass/manager.hpp b/src/core/include/openvino/pass/manager.hpp similarity index 100% rename from ngraph/core/include/openvino/pass/manager.hpp rename to src/core/include/openvino/pass/manager.hpp diff --git a/ngraph/core/include/openvino/pass/pass.hpp b/src/core/include/openvino/pass/pass.hpp similarity index 100% rename from ngraph/core/include/openvino/pass/pass.hpp rename to src/core/include/openvino/pass/pass.hpp diff --git a/ngraph/core/include/openvino/pass/pass_config.hpp b/src/core/include/openvino/pass/pass_config.hpp similarity index 100% rename from ngraph/core/include/openvino/pass/pass_config.hpp rename to src/core/include/openvino/pass/pass_config.hpp diff --git a/ngraph/core/include/openvino/pass/pattern/matcher.hpp b/src/core/include/openvino/pass/pattern/matcher.hpp similarity index 100% rename from ngraph/core/include/openvino/pass/pattern/matcher.hpp rename to src/core/include/openvino/pass/pattern/matcher.hpp diff --git a/ngraph/core/include/openvino/pass/pattern/op/any.hpp b/src/core/include/openvino/pass/pattern/op/any.hpp similarity index 100% rename from ngraph/core/include/openvino/pass/pattern/op/any.hpp rename to src/core/include/openvino/pass/pattern/op/any.hpp diff --git a/ngraph/core/include/openvino/pass/pattern/op/any_of.hpp b/src/core/include/openvino/pass/pattern/op/any_of.hpp similarity index 100% rename from ngraph/core/include/openvino/pass/pattern/op/any_of.hpp rename to src/core/include/openvino/pass/pattern/op/any_of.hpp diff --git a/ngraph/core/include/openvino/pass/pattern/op/any_output.hpp b/src/core/include/openvino/pass/pattern/op/any_output.hpp similarity index 100% rename from ngraph/core/include/openvino/pass/pattern/op/any_output.hpp rename to src/core/include/openvino/pass/pattern/op/any_output.hpp diff --git a/ngraph/core/include/openvino/pass/pattern/op/branch.hpp b/src/core/include/openvino/pass/pattern/op/branch.hpp similarity index 100% rename from ngraph/core/include/openvino/pass/pattern/op/branch.hpp rename to src/core/include/openvino/pass/pattern/op/branch.hpp diff --git a/ngraph/core/include/openvino/pass/pattern/op/capture.hpp b/src/core/include/openvino/pass/pattern/op/capture.hpp similarity index 100% rename from ngraph/core/include/openvino/pass/pattern/op/capture.hpp rename to src/core/include/openvino/pass/pattern/op/capture.hpp diff --git a/ngraph/core/include/openvino/pass/pattern/op/label.hpp b/src/core/include/openvino/pass/pattern/op/label.hpp similarity index 100% rename from ngraph/core/include/openvino/pass/pattern/op/label.hpp rename to src/core/include/openvino/pass/pattern/op/label.hpp diff --git a/ngraph/core/include/openvino/pass/pattern/op/or.hpp b/src/core/include/openvino/pass/pattern/op/or.hpp similarity index 100% rename from ngraph/core/include/openvino/pass/pattern/op/or.hpp rename to src/core/include/openvino/pass/pattern/op/or.hpp diff --git a/ngraph/core/include/openvino/pass/pattern/op/pattern.hpp b/src/core/include/openvino/pass/pattern/op/pattern.hpp similarity index 100% rename from ngraph/core/include/openvino/pass/pattern/op/pattern.hpp rename to src/core/include/openvino/pass/pattern/op/pattern.hpp diff --git a/ngraph/core/include/openvino/pass/pattern/op/skip.hpp b/src/core/include/openvino/pass/pattern/op/skip.hpp similarity index 100% rename from ngraph/core/include/openvino/pass/pattern/op/skip.hpp rename to src/core/include/openvino/pass/pattern/op/skip.hpp diff --git a/ngraph/core/include/openvino/pass/pattern/op/true.hpp b/src/core/include/openvino/pass/pattern/op/true.hpp similarity index 100% rename from ngraph/core/include/openvino/pass/pattern/op/true.hpp rename to src/core/include/openvino/pass/pattern/op/true.hpp diff --git a/ngraph/core/include/openvino/pass/pattern/op/wrap_type.hpp b/src/core/include/openvino/pass/pattern/op/wrap_type.hpp similarity index 100% rename from ngraph/core/include/openvino/pass/pattern/op/wrap_type.hpp rename to src/core/include/openvino/pass/pattern/op/wrap_type.hpp diff --git a/ngraph/core/include/openvino/pass/serialize.hpp b/src/core/include/openvino/pass/serialize.hpp similarity index 100% rename from ngraph/core/include/openvino/pass/serialize.hpp rename to src/core/include/openvino/pass/serialize.hpp diff --git a/ngraph/core/include/openvino/pass/validate.hpp b/src/core/include/openvino/pass/validate.hpp similarity index 100% rename from ngraph/core/include/openvino/pass/validate.hpp rename to src/core/include/openvino/pass/validate.hpp diff --git a/ngraph/core/include/openvino/pass/visualize_tree.hpp b/src/core/include/openvino/pass/visualize_tree.hpp similarity index 100% rename from ngraph/core/include/openvino/pass/visualize_tree.hpp rename to src/core/include/openvino/pass/visualize_tree.hpp diff --git a/ngraph/core/include/openvino/runtime/allocator.hpp b/src/core/include/openvino/runtime/allocator.hpp similarity index 100% rename from ngraph/core/include/openvino/runtime/allocator.hpp rename to src/core/include/openvino/runtime/allocator.hpp diff --git a/ngraph/core/include/openvino/runtime/tensor.hpp b/src/core/include/openvino/runtime/tensor.hpp similarity index 100% rename from ngraph/core/include/openvino/runtime/tensor.hpp rename to src/core/include/openvino/runtime/tensor.hpp diff --git a/ngraph/core/reference/CMakeLists.txt b/src/core/reference/CMakeLists.txt similarity index 100% rename from ngraph/core/reference/CMakeLists.txt rename to src/core/reference/CMakeLists.txt diff --git a/ngraph/core/reference/include/ngraph/coordinate_index.hpp b/src/core/reference/include/ngraph/coordinate_index.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/coordinate_index.hpp rename to src/core/reference/include/ngraph/coordinate_index.hpp diff --git a/ngraph/core/reference/include/ngraph/coordinate_range.hpp b/src/core/reference/include/ngraph/coordinate_range.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/coordinate_range.hpp rename to src/core/reference/include/ngraph/coordinate_range.hpp diff --git a/ngraph/core/reference/include/ngraph/coordinate_transform.hpp b/src/core/reference/include/ngraph/coordinate_transform.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/coordinate_transform.hpp rename to src/core/reference/include/ngraph/coordinate_transform.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/opt_kernel/reshape.hpp b/src/core/reference/include/ngraph/runtime/opt_kernel/reshape.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/opt_kernel/reshape.hpp rename to src/core/reference/include/ngraph/runtime/opt_kernel/reshape.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/abs.hpp b/src/core/reference/include/ngraph/runtime/reference/abs.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/abs.hpp rename to src/core/reference/include/ngraph/runtime/reference/abs.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/acos.hpp b/src/core/reference/include/ngraph/runtime/reference/acos.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/acos.hpp rename to src/core/reference/include/ngraph/runtime/reference/acos.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/acosh.hpp b/src/core/reference/include/ngraph/runtime/reference/acosh.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/acosh.hpp rename to src/core/reference/include/ngraph/runtime/reference/acosh.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/adaptive_avg_pool.hpp b/src/core/reference/include/ngraph/runtime/reference/adaptive_avg_pool.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/adaptive_avg_pool.hpp rename to src/core/reference/include/ngraph/runtime/reference/adaptive_avg_pool.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/adaptive_max_pool.hpp b/src/core/reference/include/ngraph/runtime/reference/adaptive_max_pool.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/adaptive_max_pool.hpp rename to src/core/reference/include/ngraph/runtime/reference/adaptive_max_pool.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/add.hpp b/src/core/reference/include/ngraph/runtime/reference/add.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/add.hpp rename to src/core/reference/include/ngraph/runtime/reference/add.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/and.hpp b/src/core/reference/include/ngraph/runtime/reference/and.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/and.hpp rename to src/core/reference/include/ngraph/runtime/reference/and.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/asin.hpp b/src/core/reference/include/ngraph/runtime/reference/asin.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/asin.hpp rename to src/core/reference/include/ngraph/runtime/reference/asin.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/asinh.hpp b/src/core/reference/include/ngraph/runtime/reference/asinh.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/asinh.hpp rename to src/core/reference/include/ngraph/runtime/reference/asinh.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/atan.hpp b/src/core/reference/include/ngraph/runtime/reference/atan.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/atan.hpp rename to src/core/reference/include/ngraph/runtime/reference/atan.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/atan2.hpp b/src/core/reference/include/ngraph/runtime/reference/atan2.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/atan2.hpp rename to src/core/reference/include/ngraph/runtime/reference/atan2.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/atanh.hpp b/src/core/reference/include/ngraph/runtime/reference/atanh.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/atanh.hpp rename to src/core/reference/include/ngraph/runtime/reference/atanh.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/autobroadcast_binop.hpp b/src/core/reference/include/ngraph/runtime/reference/autobroadcast_binop.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/autobroadcast_binop.hpp rename to src/core/reference/include/ngraph/runtime/reference/autobroadcast_binop.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/avg_pool.hpp b/src/core/reference/include/ngraph/runtime/reference/avg_pool.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/avg_pool.hpp rename to src/core/reference/include/ngraph/runtime/reference/avg_pool.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/batch_norm.hpp b/src/core/reference/include/ngraph/runtime/reference/batch_norm.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/batch_norm.hpp rename to src/core/reference/include/ngraph/runtime/reference/batch_norm.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/binary_convolution.hpp b/src/core/reference/include/ngraph/runtime/reference/binary_convolution.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/binary_convolution.hpp rename to src/core/reference/include/ngraph/runtime/reference/binary_convolution.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/broadcast.hpp b/src/core/reference/include/ngraph/runtime/reference/broadcast.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/broadcast.hpp rename to src/core/reference/include/ngraph/runtime/reference/broadcast.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/bucketize.hpp b/src/core/reference/include/ngraph/runtime/reference/bucketize.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/bucketize.hpp rename to src/core/reference/include/ngraph/runtime/reference/bucketize.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/ceiling.hpp b/src/core/reference/include/ngraph/runtime/reference/ceiling.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/ceiling.hpp rename to src/core/reference/include/ngraph/runtime/reference/ceiling.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/clamp.hpp b/src/core/reference/include/ngraph/runtime/reference/clamp.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/clamp.hpp rename to src/core/reference/include/ngraph/runtime/reference/clamp.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/concat.hpp b/src/core/reference/include/ngraph/runtime/reference/concat.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/concat.hpp rename to src/core/reference/include/ngraph/runtime/reference/concat.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/constant.hpp b/src/core/reference/include/ngraph/runtime/reference/constant.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/constant.hpp rename to src/core/reference/include/ngraph/runtime/reference/constant.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/convert.hpp b/src/core/reference/include/ngraph/runtime/reference/convert.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/convert.hpp rename to src/core/reference/include/ngraph/runtime/reference/convert.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/convert_color_nv12.hpp b/src/core/reference/include/ngraph/runtime/reference/convert_color_nv12.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/convert_color_nv12.hpp rename to src/core/reference/include/ngraph/runtime/reference/convert_color_nv12.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/convolution.hpp b/src/core/reference/include/ngraph/runtime/reference/convolution.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/convolution.hpp rename to src/core/reference/include/ngraph/runtime/reference/convolution.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/convolution_backprop_data.hpp b/src/core/reference/include/ngraph/runtime/reference/convolution_backprop_data.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/convolution_backprop_data.hpp rename to src/core/reference/include/ngraph/runtime/reference/convolution_backprop_data.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/copy.hpp b/src/core/reference/include/ngraph/runtime/reference/copy.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/copy.hpp rename to src/core/reference/include/ngraph/runtime/reference/copy.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/cos.hpp b/src/core/reference/include/ngraph/runtime/reference/cos.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/cos.hpp rename to src/core/reference/include/ngraph/runtime/reference/cos.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/cosh.hpp b/src/core/reference/include/ngraph/runtime/reference/cosh.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/cosh.hpp rename to src/core/reference/include/ngraph/runtime/reference/cosh.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/ctc_greedy_decoder.hpp b/src/core/reference/include/ngraph/runtime/reference/ctc_greedy_decoder.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/ctc_greedy_decoder.hpp rename to src/core/reference/include/ngraph/runtime/reference/ctc_greedy_decoder.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/ctc_greedy_decoder_seq_len.hpp b/src/core/reference/include/ngraph/runtime/reference/ctc_greedy_decoder_seq_len.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/ctc_greedy_decoder_seq_len.hpp rename to src/core/reference/include/ngraph/runtime/reference/ctc_greedy_decoder_seq_len.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/ctc_loss.hpp b/src/core/reference/include/ngraph/runtime/reference/ctc_loss.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/ctc_loss.hpp rename to src/core/reference/include/ngraph/runtime/reference/ctc_loss.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/cum_sum.hpp b/src/core/reference/include/ngraph/runtime/reference/cum_sum.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/cum_sum.hpp rename to src/core/reference/include/ngraph/runtime/reference/cum_sum.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/deformable_convolution.hpp b/src/core/reference/include/ngraph/runtime/reference/deformable_convolution.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/deformable_convolution.hpp rename to src/core/reference/include/ngraph/runtime/reference/deformable_convolution.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/deformable_psroi_pooling.hpp b/src/core/reference/include/ngraph/runtime/reference/deformable_psroi_pooling.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/deformable_psroi_pooling.hpp rename to src/core/reference/include/ngraph/runtime/reference/deformable_psroi_pooling.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/depth_to_space.hpp b/src/core/reference/include/ngraph/runtime/reference/depth_to_space.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/depth_to_space.hpp rename to src/core/reference/include/ngraph/runtime/reference/depth_to_space.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/detection_output.hpp b/src/core/reference/include/ngraph/runtime/reference/detection_output.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/detection_output.hpp rename to src/core/reference/include/ngraph/runtime/reference/detection_output.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/divide.hpp b/src/core/reference/include/ngraph/runtime/reference/divide.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/divide.hpp rename to src/core/reference/include/ngraph/runtime/reference/divide.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/einsum.hpp b/src/core/reference/include/ngraph/runtime/reference/einsum.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/einsum.hpp rename to src/core/reference/include/ngraph/runtime/reference/einsum.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/elu.hpp b/src/core/reference/include/ngraph/runtime/reference/elu.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/elu.hpp rename to src/core/reference/include/ngraph/runtime/reference/elu.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/embedding_bag_offsets_sum.hpp b/src/core/reference/include/ngraph/runtime/reference/embedding_bag_offsets_sum.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/embedding_bag_offsets_sum.hpp rename to src/core/reference/include/ngraph/runtime/reference/embedding_bag_offsets_sum.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/embedding_bag_packed_sum.hpp b/src/core/reference/include/ngraph/runtime/reference/embedding_bag_packed_sum.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/embedding_bag_packed_sum.hpp rename to src/core/reference/include/ngraph/runtime/reference/embedding_bag_packed_sum.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/embedding_segments_sum.hpp b/src/core/reference/include/ngraph/runtime/reference/embedding_segments_sum.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/embedding_segments_sum.hpp rename to src/core/reference/include/ngraph/runtime/reference/embedding_segments_sum.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/equal.hpp b/src/core/reference/include/ngraph/runtime/reference/equal.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/equal.hpp rename to src/core/reference/include/ngraph/runtime/reference/equal.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/erf.hpp b/src/core/reference/include/ngraph/runtime/reference/erf.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/erf.hpp rename to src/core/reference/include/ngraph/runtime/reference/erf.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/exp.hpp b/src/core/reference/include/ngraph/runtime/reference/exp.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/exp.hpp rename to src/core/reference/include/ngraph/runtime/reference/exp.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/experimental_detectron_detection_output.hpp b/src/core/reference/include/ngraph/runtime/reference/experimental_detectron_detection_output.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/experimental_detectron_detection_output.hpp rename to src/core/reference/include/ngraph/runtime/reference/experimental_detectron_detection_output.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/experimental_detectron_prior_grid_generator.hpp b/src/core/reference/include/ngraph/runtime/reference/experimental_detectron_prior_grid_generator.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/experimental_detectron_prior_grid_generator.hpp rename to src/core/reference/include/ngraph/runtime/reference/experimental_detectron_prior_grid_generator.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/experimental_detectron_proposal_single_image.hpp b/src/core/reference/include/ngraph/runtime/reference/experimental_detectron_proposal_single_image.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/experimental_detectron_proposal_single_image.hpp rename to src/core/reference/include/ngraph/runtime/reference/experimental_detectron_proposal_single_image.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/experimental_detectron_roi_feature_extractor.hpp b/src/core/reference/include/ngraph/runtime/reference/experimental_detectron_roi_feature_extractor.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/experimental_detectron_roi_feature_extractor.hpp rename to src/core/reference/include/ngraph/runtime/reference/experimental_detectron_roi_feature_extractor.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/experimental_detectron_topk_rois.hpp b/src/core/reference/include/ngraph/runtime/reference/experimental_detectron_topk_rois.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/experimental_detectron_topk_rois.hpp rename to src/core/reference/include/ngraph/runtime/reference/experimental_detectron_topk_rois.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/extract_image_patches.hpp b/src/core/reference/include/ngraph/runtime/reference/extract_image_patches.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/extract_image_patches.hpp rename to src/core/reference/include/ngraph/runtime/reference/extract_image_patches.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/fake_quantize.hpp b/src/core/reference/include/ngraph/runtime/reference/fake_quantize.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/fake_quantize.hpp rename to src/core/reference/include/ngraph/runtime/reference/fake_quantize.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/fft.hpp b/src/core/reference/include/ngraph/runtime/reference/fft.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/fft.hpp rename to src/core/reference/include/ngraph/runtime/reference/fft.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/floor.hpp b/src/core/reference/include/ngraph/runtime/reference/floor.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/floor.hpp rename to src/core/reference/include/ngraph/runtime/reference/floor.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/floor_mod.hpp b/src/core/reference/include/ngraph/runtime/reference/floor_mod.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/floor_mod.hpp rename to src/core/reference/include/ngraph/runtime/reference/floor_mod.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/function.hpp b/src/core/reference/include/ngraph/runtime/reference/function.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/function.hpp rename to src/core/reference/include/ngraph/runtime/reference/function.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/gather.hpp b/src/core/reference/include/ngraph/runtime/reference/gather.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/gather.hpp rename to src/core/reference/include/ngraph/runtime/reference/gather.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/gather_elements.hpp b/src/core/reference/include/ngraph/runtime/reference/gather_elements.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/gather_elements.hpp rename to src/core/reference/include/ngraph/runtime/reference/gather_elements.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/gather_nd.hpp b/src/core/reference/include/ngraph/runtime/reference/gather_nd.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/gather_nd.hpp rename to src/core/reference/include/ngraph/runtime/reference/gather_nd.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/gather_tree.hpp b/src/core/reference/include/ngraph/runtime/reference/gather_tree.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/gather_tree.hpp rename to src/core/reference/include/ngraph/runtime/reference/gather_tree.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/gelu.hpp b/src/core/reference/include/ngraph/runtime/reference/gelu.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/gelu.hpp rename to src/core/reference/include/ngraph/runtime/reference/gelu.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/greater.hpp b/src/core/reference/include/ngraph/runtime/reference/greater.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/greater.hpp rename to src/core/reference/include/ngraph/runtime/reference/greater.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/greater_eq.hpp b/src/core/reference/include/ngraph/runtime/reference/greater_eq.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/greater_eq.hpp rename to src/core/reference/include/ngraph/runtime/reference/greater_eq.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/grn.hpp b/src/core/reference/include/ngraph/runtime/reference/grn.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/grn.hpp rename to src/core/reference/include/ngraph/runtime/reference/grn.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/group_convolution.hpp b/src/core/reference/include/ngraph/runtime/reference/group_convolution.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/group_convolution.hpp rename to src/core/reference/include/ngraph/runtime/reference/group_convolution.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/group_convolution_backprop_data.hpp b/src/core/reference/include/ngraph/runtime/reference/group_convolution_backprop_data.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/group_convolution_backprop_data.hpp rename to src/core/reference/include/ngraph/runtime/reference/group_convolution_backprop_data.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/gru_cell.hpp b/src/core/reference/include/ngraph/runtime/reference/gru_cell.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/gru_cell.hpp rename to src/core/reference/include/ngraph/runtime/reference/gru_cell.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/hard_sigmoid.hpp b/src/core/reference/include/ngraph/runtime/reference/hard_sigmoid.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/hard_sigmoid.hpp rename to src/core/reference/include/ngraph/runtime/reference/hard_sigmoid.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/helpers.hpp b/src/core/reference/include/ngraph/runtime/reference/helpers.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/helpers.hpp rename to src/core/reference/include/ngraph/runtime/reference/helpers.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/hsigmoid.hpp b/src/core/reference/include/ngraph/runtime/reference/hsigmoid.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/hsigmoid.hpp rename to src/core/reference/include/ngraph/runtime/reference/hsigmoid.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/hswish.hpp b/src/core/reference/include/ngraph/runtime/reference/hswish.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/hswish.hpp rename to src/core/reference/include/ngraph/runtime/reference/hswish.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/if.hpp b/src/core/reference/include/ngraph/runtime/reference/if.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/if.hpp rename to src/core/reference/include/ngraph/runtime/reference/if.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/interpolate.hpp b/src/core/reference/include/ngraph/runtime/reference/interpolate.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/interpolate.hpp rename to src/core/reference/include/ngraph/runtime/reference/interpolate.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/less.hpp b/src/core/reference/include/ngraph/runtime/reference/less.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/less.hpp rename to src/core/reference/include/ngraph/runtime/reference/less.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/less_eq.hpp b/src/core/reference/include/ngraph/runtime/reference/less_eq.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/less_eq.hpp rename to src/core/reference/include/ngraph/runtime/reference/less_eq.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/log.hpp b/src/core/reference/include/ngraph/runtime/reference/log.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/log.hpp rename to src/core/reference/include/ngraph/runtime/reference/log.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/log_softmax.hpp b/src/core/reference/include/ngraph/runtime/reference/log_softmax.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/log_softmax.hpp rename to src/core/reference/include/ngraph/runtime/reference/log_softmax.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/logical_reduction.hpp b/src/core/reference/include/ngraph/runtime/reference/logical_reduction.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/logical_reduction.hpp rename to src/core/reference/include/ngraph/runtime/reference/logical_reduction.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/loop.hpp b/src/core/reference/include/ngraph/runtime/reference/loop.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/loop.hpp rename to src/core/reference/include/ngraph/runtime/reference/loop.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/lrn.hpp b/src/core/reference/include/ngraph/runtime/reference/lrn.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/lrn.hpp rename to src/core/reference/include/ngraph/runtime/reference/lrn.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/lstm_cell.hpp b/src/core/reference/include/ngraph/runtime/reference/lstm_cell.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/lstm_cell.hpp rename to src/core/reference/include/ngraph/runtime/reference/lstm_cell.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/matmul.hpp b/src/core/reference/include/ngraph/runtime/reference/matmul.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/matmul.hpp rename to src/core/reference/include/ngraph/runtime/reference/matmul.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/matrix_nms.hpp b/src/core/reference/include/ngraph/runtime/reference/matrix_nms.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/matrix_nms.hpp rename to src/core/reference/include/ngraph/runtime/reference/matrix_nms.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/max.hpp b/src/core/reference/include/ngraph/runtime/reference/max.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/max.hpp rename to src/core/reference/include/ngraph/runtime/reference/max.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/max_pool.hpp b/src/core/reference/include/ngraph/runtime/reference/max_pool.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/max_pool.hpp rename to src/core/reference/include/ngraph/runtime/reference/max_pool.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/maximum.hpp b/src/core/reference/include/ngraph/runtime/reference/maximum.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/maximum.hpp rename to src/core/reference/include/ngraph/runtime/reference/maximum.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/mean.hpp b/src/core/reference/include/ngraph/runtime/reference/mean.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/mean.hpp rename to src/core/reference/include/ngraph/runtime/reference/mean.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/min.hpp b/src/core/reference/include/ngraph/runtime/reference/min.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/min.hpp rename to src/core/reference/include/ngraph/runtime/reference/min.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/minimum.hpp b/src/core/reference/include/ngraph/runtime/reference/minimum.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/minimum.hpp rename to src/core/reference/include/ngraph/runtime/reference/minimum.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/mish.hpp b/src/core/reference/include/ngraph/runtime/reference/mish.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/mish.hpp rename to src/core/reference/include/ngraph/runtime/reference/mish.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/mod.hpp b/src/core/reference/include/ngraph/runtime/reference/mod.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/mod.hpp rename to src/core/reference/include/ngraph/runtime/reference/mod.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/multiclass_nms.hpp b/src/core/reference/include/ngraph/runtime/reference/multiclass_nms.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/multiclass_nms.hpp rename to src/core/reference/include/ngraph/runtime/reference/multiclass_nms.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/multiply.hpp b/src/core/reference/include/ngraph/runtime/reference/multiply.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/multiply.hpp rename to src/core/reference/include/ngraph/runtime/reference/multiply.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/mvn.hpp b/src/core/reference/include/ngraph/runtime/reference/mvn.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/mvn.hpp rename to src/core/reference/include/ngraph/runtime/reference/mvn.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/negate.hpp b/src/core/reference/include/ngraph/runtime/reference/negate.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/negate.hpp rename to src/core/reference/include/ngraph/runtime/reference/negate.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/non_max_suppression.hpp b/src/core/reference/include/ngraph/runtime/reference/non_max_suppression.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/non_max_suppression.hpp rename to src/core/reference/include/ngraph/runtime/reference/non_max_suppression.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/non_zero.hpp b/src/core/reference/include/ngraph/runtime/reference/non_zero.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/non_zero.hpp rename to src/core/reference/include/ngraph/runtime/reference/non_zero.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/normalize_l2.hpp b/src/core/reference/include/ngraph/runtime/reference/normalize_l2.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/normalize_l2.hpp rename to src/core/reference/include/ngraph/runtime/reference/normalize_l2.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/not.hpp b/src/core/reference/include/ngraph/runtime/reference/not.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/not.hpp rename to src/core/reference/include/ngraph/runtime/reference/not.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/not_equal.hpp b/src/core/reference/include/ngraph/runtime/reference/not_equal.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/not_equal.hpp rename to src/core/reference/include/ngraph/runtime/reference/not_equal.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/one_hot.hpp b/src/core/reference/include/ngraph/runtime/reference/one_hot.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/one_hot.hpp rename to src/core/reference/include/ngraph/runtime/reference/one_hot.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/or.hpp b/src/core/reference/include/ngraph/runtime/reference/or.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/or.hpp rename to src/core/reference/include/ngraph/runtime/reference/or.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/pad.hpp b/src/core/reference/include/ngraph/runtime/reference/pad.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/pad.hpp rename to src/core/reference/include/ngraph/runtime/reference/pad.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/power.hpp b/src/core/reference/include/ngraph/runtime/reference/power.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/power.hpp rename to src/core/reference/include/ngraph/runtime/reference/power.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/prelu.hpp b/src/core/reference/include/ngraph/runtime/reference/prelu.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/prelu.hpp rename to src/core/reference/include/ngraph/runtime/reference/prelu.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/prior_box.hpp b/src/core/reference/include/ngraph/runtime/reference/prior_box.hpp similarity index 77% rename from ngraph/core/reference/include/ngraph/runtime/reference/prior_box.hpp rename to src/core/reference/include/ngraph/runtime/reference/prior_box.hpp index 3ac49ef2f86..3b2dfc39524 100644 --- a/ngraph/core/reference/include/ngraph/runtime/reference/prior_box.hpp +++ b/src/core/reference/include/ngraph/runtime/reference/prior_box.hpp @@ -23,7 +23,11 @@ static inline float clip_less(float x, float threshold) { } template -void prior_box(const T* data, const T* img, float* dst_data, const Shape& out_shape, const op::PriorBoxAttrs& attrs) { +void prior_box(const T* data, + const T* img, + float* dst_data, + const Shape& out_shape, + const op::v8::PriorBox::Attributes& attrs) { const int64_t W = data[1]; const int64_t H = data[0]; const int64_t IW = img[1]; @@ -51,7 +55,7 @@ void prior_box(const T* data, const T* img, float* dst_data, const Shape& out_sh if (variance.empty()) variance.push_back(0.1f); - int64_t num_priors = op::PriorBox::number_of_priors(attrs); + int64_t num_priors = op::v8::PriorBox::number_of_priors(attrs); float step = attrs.step; auto min_size = attrs.min_size; @@ -162,21 +166,42 @@ void prior_box(const T* data, const T* img, float* dst_data, const Shape& out_sh box_height = min_size[ms_idx] * 0.5f; calculate_data(center_x, center_y, box_width, box_height, false); - if (attrs.max_size.size() > ms_idx) { - box_width = box_height = std::sqrt(min_size[ms_idx] * attrs.max_size[ms_idx]) * 0.5f; - calculate_data(center_x, center_y, box_width, box_height, false); - } + if (attrs.min_max_aspect_ratios_order) { + if (attrs.max_size.size() > ms_idx) { + box_width = box_height = std::sqrt(min_size[ms_idx] * attrs.max_size[ms_idx]) * 0.5f; + calculate_data(center_x, center_y, box_width, box_height, false); + } - if (attrs.scale_all_sizes || (!attrs.scale_all_sizes && (ms_idx == min_size.size() - 1))) { - size_t s_idx = attrs.scale_all_sizes ? ms_idx : 0; - for (float ar : aspect_ratios) { - if (std::fabs(ar - 1.0f) < 1e-6) { - continue; + if (attrs.scale_all_sizes || (!attrs.scale_all_sizes && (ms_idx == min_size.size() - 1))) { + size_t s_idx = attrs.scale_all_sizes ? ms_idx : 0; + for (float ar : aspect_ratios) { + if (std::fabs(ar - 1.0f) < 1e-6) { + continue; + } + + ar = std::sqrt(ar); + box_width = min_size[s_idx] * 0.5f * ar; + box_height = min_size[s_idx] * 0.5f / ar; + calculate_data(center_x, center_y, box_width, box_height, false); } + } + } else { + if (attrs.scale_all_sizes || (!attrs.scale_all_sizes && (ms_idx == min_size.size() - 1))) { + size_t s_idx = attrs.scale_all_sizes ? ms_idx : 0; + for (float ar : aspect_ratios) { + if (std::fabs(ar - 1.0f) < 1e-6) { + continue; + } - ar = std::sqrt(ar); - box_width = min_size[s_idx] * 0.5f * ar; - box_height = min_size[s_idx] * 0.5f / ar; + ar = std::sqrt(ar); + box_width = min_size[s_idx] * 0.5f * ar; + box_height = min_size[s_idx] * 0.5f / ar; + calculate_data(center_x, center_y, box_width, box_height, false); + } + } + + if (attrs.max_size.size() > ms_idx) { + box_width = box_height = std::sqrt(min_size[ms_idx] * attrs.max_size[ms_idx]) * 0.5f; calculate_data(center_x, center_y, box_width, box_height, false); } } diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/prior_box_clustered.hpp b/src/core/reference/include/ngraph/runtime/reference/prior_box_clustered.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/prior_box_clustered.hpp rename to src/core/reference/include/ngraph/runtime/reference/prior_box_clustered.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/product.hpp b/src/core/reference/include/ngraph/runtime/reference/product.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/product.hpp rename to src/core/reference/include/ngraph/runtime/reference/product.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/proposal.hpp b/src/core/reference/include/ngraph/runtime/reference/proposal.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/proposal.hpp rename to src/core/reference/include/ngraph/runtime/reference/proposal.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/psroi_pooling.hpp b/src/core/reference/include/ngraph/runtime/reference/psroi_pooling.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/psroi_pooling.hpp rename to src/core/reference/include/ngraph/runtime/reference/psroi_pooling.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/quantize.hpp b/src/core/reference/include/ngraph/runtime/reference/quantize.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/quantize.hpp rename to src/core/reference/include/ngraph/runtime/reference/quantize.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/random_uniform.hpp b/src/core/reference/include/ngraph/runtime/reference/random_uniform.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/random_uniform.hpp rename to src/core/reference/include/ngraph/runtime/reference/random_uniform.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/range.hpp b/src/core/reference/include/ngraph/runtime/reference/range.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/range.hpp rename to src/core/reference/include/ngraph/runtime/reference/range.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/reduce_l1.hpp b/src/core/reference/include/ngraph/runtime/reference/reduce_l1.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/reduce_l1.hpp rename to src/core/reference/include/ngraph/runtime/reference/reduce_l1.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/reduce_l2.hpp b/src/core/reference/include/ngraph/runtime/reference/reduce_l2.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/reduce_l2.hpp rename to src/core/reference/include/ngraph/runtime/reference/reduce_l2.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/region_yolo.hpp b/src/core/reference/include/ngraph/runtime/reference/region_yolo.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/region_yolo.hpp rename to src/core/reference/include/ngraph/runtime/reference/region_yolo.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/relu.hpp b/src/core/reference/include/ngraph/runtime/reference/relu.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/relu.hpp rename to src/core/reference/include/ngraph/runtime/reference/relu.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/reorg_yolo.hpp b/src/core/reference/include/ngraph/runtime/reference/reorg_yolo.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/reorg_yolo.hpp rename to src/core/reference/include/ngraph/runtime/reference/reorg_yolo.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/reshape.hpp b/src/core/reference/include/ngraph/runtime/reference/reshape.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/reshape.hpp rename to src/core/reference/include/ngraph/runtime/reference/reshape.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/result.hpp b/src/core/reference/include/ngraph/runtime/reference/result.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/result.hpp rename to src/core/reference/include/ngraph/runtime/reference/result.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/reverse.hpp b/src/core/reference/include/ngraph/runtime/reference/reverse.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/reverse.hpp rename to src/core/reference/include/ngraph/runtime/reference/reverse.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/reverse_sequence.hpp b/src/core/reference/include/ngraph/runtime/reference/reverse_sequence.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/reverse_sequence.hpp rename to src/core/reference/include/ngraph/runtime/reference/reverse_sequence.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/rnn_cell.hpp b/src/core/reference/include/ngraph/runtime/reference/rnn_cell.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/rnn_cell.hpp rename to src/core/reference/include/ngraph/runtime/reference/rnn_cell.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/roi_align.hpp b/src/core/reference/include/ngraph/runtime/reference/roi_align.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/roi_align.hpp rename to src/core/reference/include/ngraph/runtime/reference/roi_align.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/roi_pooling.hpp b/src/core/reference/include/ngraph/runtime/reference/roi_pooling.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/roi_pooling.hpp rename to src/core/reference/include/ngraph/runtime/reference/roi_pooling.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/roll.hpp b/src/core/reference/include/ngraph/runtime/reference/roll.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/roll.hpp rename to src/core/reference/include/ngraph/runtime/reference/roll.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/round.hpp b/src/core/reference/include/ngraph/runtime/reference/round.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/round.hpp rename to src/core/reference/include/ngraph/runtime/reference/round.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/scatter_elements_update.hpp b/src/core/reference/include/ngraph/runtime/reference/scatter_elements_update.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/scatter_elements_update.hpp rename to src/core/reference/include/ngraph/runtime/reference/scatter_elements_update.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/scatter_nd_update.hpp b/src/core/reference/include/ngraph/runtime/reference/scatter_nd_update.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/scatter_nd_update.hpp rename to src/core/reference/include/ngraph/runtime/reference/scatter_nd_update.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/scatter_update.hpp b/src/core/reference/include/ngraph/runtime/reference/scatter_update.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/scatter_update.hpp rename to src/core/reference/include/ngraph/runtime/reference/scatter_update.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/select.hpp b/src/core/reference/include/ngraph/runtime/reference/select.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/select.hpp rename to src/core/reference/include/ngraph/runtime/reference/select.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/selu.hpp b/src/core/reference/include/ngraph/runtime/reference/selu.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/selu.hpp rename to src/core/reference/include/ngraph/runtime/reference/selu.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/sequences.hpp b/src/core/reference/include/ngraph/runtime/reference/sequences.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/sequences.hpp rename to src/core/reference/include/ngraph/runtime/reference/sequences.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/shape_of.hpp b/src/core/reference/include/ngraph/runtime/reference/shape_of.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/shape_of.hpp rename to src/core/reference/include/ngraph/runtime/reference/shape_of.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/shuffle_channels.hpp b/src/core/reference/include/ngraph/runtime/reference/shuffle_channels.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/shuffle_channels.hpp rename to src/core/reference/include/ngraph/runtime/reference/shuffle_channels.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/sigmoid.hpp b/src/core/reference/include/ngraph/runtime/reference/sigmoid.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/sigmoid.hpp rename to src/core/reference/include/ngraph/runtime/reference/sigmoid.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/sign.hpp b/src/core/reference/include/ngraph/runtime/reference/sign.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/sign.hpp rename to src/core/reference/include/ngraph/runtime/reference/sign.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/sin.hpp b/src/core/reference/include/ngraph/runtime/reference/sin.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/sin.hpp rename to src/core/reference/include/ngraph/runtime/reference/sin.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/sinh.hpp b/src/core/reference/include/ngraph/runtime/reference/sinh.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/sinh.hpp rename to src/core/reference/include/ngraph/runtime/reference/sinh.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/slice.hpp b/src/core/reference/include/ngraph/runtime/reference/slice.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/slice.hpp rename to src/core/reference/include/ngraph/runtime/reference/slice.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/softmax.hpp b/src/core/reference/include/ngraph/runtime/reference/softmax.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/softmax.hpp rename to src/core/reference/include/ngraph/runtime/reference/softmax.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/softplus.hpp b/src/core/reference/include/ngraph/runtime/reference/softplus.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/softplus.hpp rename to src/core/reference/include/ngraph/runtime/reference/softplus.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/space_to_depth.hpp b/src/core/reference/include/ngraph/runtime/reference/space_to_depth.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/space_to_depth.hpp rename to src/core/reference/include/ngraph/runtime/reference/space_to_depth.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/split.hpp b/src/core/reference/include/ngraph/runtime/reference/split.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/split.hpp rename to src/core/reference/include/ngraph/runtime/reference/split.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/sqrt.hpp b/src/core/reference/include/ngraph/runtime/reference/sqrt.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/sqrt.hpp rename to src/core/reference/include/ngraph/runtime/reference/sqrt.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/squared_difference.hpp b/src/core/reference/include/ngraph/runtime/reference/squared_difference.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/squared_difference.hpp rename to src/core/reference/include/ngraph/runtime/reference/squared_difference.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/strided_slice.hpp b/src/core/reference/include/ngraph/runtime/reference/strided_slice.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/strided_slice.hpp rename to src/core/reference/include/ngraph/runtime/reference/strided_slice.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/subtract.hpp b/src/core/reference/include/ngraph/runtime/reference/subtract.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/subtract.hpp rename to src/core/reference/include/ngraph/runtime/reference/subtract.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/sum.hpp b/src/core/reference/include/ngraph/runtime/reference/sum.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/sum.hpp rename to src/core/reference/include/ngraph/runtime/reference/sum.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/swish.hpp b/src/core/reference/include/ngraph/runtime/reference/swish.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/swish.hpp rename to src/core/reference/include/ngraph/runtime/reference/swish.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/tan.hpp b/src/core/reference/include/ngraph/runtime/reference/tan.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/tan.hpp rename to src/core/reference/include/ngraph/runtime/reference/tan.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/tanh.hpp b/src/core/reference/include/ngraph/runtime/reference/tanh.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/tanh.hpp rename to src/core/reference/include/ngraph/runtime/reference/tanh.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/tensor_iterator.hpp b/src/core/reference/include/ngraph/runtime/reference/tensor_iterator.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/tensor_iterator.hpp rename to src/core/reference/include/ngraph/runtime/reference/tensor_iterator.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/tile.hpp b/src/core/reference/include/ngraph/runtime/reference/tile.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/tile.hpp rename to src/core/reference/include/ngraph/runtime/reference/tile.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/topk.hpp b/src/core/reference/include/ngraph/runtime/reference/topk.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/topk.hpp rename to src/core/reference/include/ngraph/runtime/reference/topk.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/transpose.hpp b/src/core/reference/include/ngraph/runtime/reference/transpose.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/transpose.hpp rename to src/core/reference/include/ngraph/runtime/reference/transpose.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/utils/nms_common.hpp b/src/core/reference/include/ngraph/runtime/reference/utils/nms_common.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/utils/nms_common.hpp rename to src/core/reference/include/ngraph/runtime/reference/utils/nms_common.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/utils/span.hpp b/src/core/reference/include/ngraph/runtime/reference/utils/span.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/utils/span.hpp rename to src/core/reference/include/ngraph/runtime/reference/utils/span.hpp diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/xor.hpp b/src/core/reference/include/ngraph/runtime/reference/xor.hpp similarity index 100% rename from ngraph/core/reference/include/ngraph/runtime/reference/xor.hpp rename to src/core/reference/include/ngraph/runtime/reference/xor.hpp diff --git a/ngraph/core/reference/src/coordinate_index.cpp b/src/core/reference/src/coordinate_index.cpp similarity index 100% rename from ngraph/core/reference/src/coordinate_index.cpp rename to src/core/reference/src/coordinate_index.cpp diff --git a/ngraph/core/reference/src/coordinate_range.cpp b/src/core/reference/src/coordinate_range.cpp similarity index 100% rename from ngraph/core/reference/src/coordinate_range.cpp rename to src/core/reference/src/coordinate_range.cpp diff --git a/ngraph/core/reference/src/coordinate_transform.cpp b/src/core/reference/src/coordinate_transform.cpp similarity index 100% rename from ngraph/core/reference/src/coordinate_transform.cpp rename to src/core/reference/src/coordinate_transform.cpp diff --git a/ngraph/core/reference/src/precomp.hpp b/src/core/reference/src/precomp.hpp similarity index 100% rename from ngraph/core/reference/src/precomp.hpp rename to src/core/reference/src/precomp.hpp diff --git a/ngraph/core/reference/src/runtime/opt_kernel/reshape.cpp b/src/core/reference/src/runtime/opt_kernel/reshape.cpp similarity index 100% rename from ngraph/core/reference/src/runtime/opt_kernel/reshape.cpp rename to src/core/reference/src/runtime/opt_kernel/reshape.cpp diff --git a/ngraph/core/reference/src/runtime/reference/broadcast.cpp b/src/core/reference/src/runtime/reference/broadcast.cpp similarity index 100% rename from ngraph/core/reference/src/runtime/reference/broadcast.cpp rename to src/core/reference/src/runtime/reference/broadcast.cpp diff --git a/ngraph/core/reference/src/runtime/reference/concat.cpp b/src/core/reference/src/runtime/reference/concat.cpp similarity index 100% rename from ngraph/core/reference/src/runtime/reference/concat.cpp rename to src/core/reference/src/runtime/reference/concat.cpp diff --git a/ngraph/core/reference/src/runtime/reference/convert.cpp b/src/core/reference/src/runtime/reference/convert.cpp similarity index 100% rename from ngraph/core/reference/src/runtime/reference/convert.cpp rename to src/core/reference/src/runtime/reference/convert.cpp diff --git a/ngraph/core/reference/src/runtime/reference/depth_to_space.cpp b/src/core/reference/src/runtime/reference/depth_to_space.cpp similarity index 100% rename from ngraph/core/reference/src/runtime/reference/depth_to_space.cpp rename to src/core/reference/src/runtime/reference/depth_to_space.cpp diff --git a/ngraph/core/reference/src/runtime/reference/einsum.cpp b/src/core/reference/src/runtime/reference/einsum.cpp similarity index 100% rename from ngraph/core/reference/src/runtime/reference/einsum.cpp rename to src/core/reference/src/runtime/reference/einsum.cpp diff --git a/ngraph/core/reference/src/runtime/reference/experimental_detectron_detection_output.cpp b/src/core/reference/src/runtime/reference/experimental_detectron_detection_output.cpp similarity index 100% rename from ngraph/core/reference/src/runtime/reference/experimental_detectron_detection_output.cpp rename to src/core/reference/src/runtime/reference/experimental_detectron_detection_output.cpp diff --git a/ngraph/core/reference/src/runtime/reference/experimental_detectron_proposal_single_image.cpp b/src/core/reference/src/runtime/reference/experimental_detectron_proposal_single_image.cpp similarity index 100% rename from ngraph/core/reference/src/runtime/reference/experimental_detectron_proposal_single_image.cpp rename to src/core/reference/src/runtime/reference/experimental_detectron_proposal_single_image.cpp diff --git a/ngraph/core/reference/src/runtime/reference/experimental_detectron_roi_feature_extractor.cpp b/src/core/reference/src/runtime/reference/experimental_detectron_roi_feature_extractor.cpp similarity index 100% rename from ngraph/core/reference/src/runtime/reference/experimental_detectron_roi_feature_extractor.cpp rename to src/core/reference/src/runtime/reference/experimental_detectron_roi_feature_extractor.cpp diff --git a/ngraph/core/reference/src/runtime/reference/fft.cpp b/src/core/reference/src/runtime/reference/fft.cpp similarity index 100% rename from ngraph/core/reference/src/runtime/reference/fft.cpp rename to src/core/reference/src/runtime/reference/fft.cpp diff --git a/ngraph/core/reference/src/runtime/reference/function.cpp b/src/core/reference/src/runtime/reference/function.cpp similarity index 100% rename from ngraph/core/reference/src/runtime/reference/function.cpp rename to src/core/reference/src/runtime/reference/function.cpp diff --git a/ngraph/core/reference/src/runtime/reference/gather_tree.cpp b/src/core/reference/src/runtime/reference/gather_tree.cpp similarity index 100% rename from ngraph/core/reference/src/runtime/reference/gather_tree.cpp rename to src/core/reference/src/runtime/reference/gather_tree.cpp diff --git a/ngraph/core/reference/src/runtime/reference/if.cpp b/src/core/reference/src/runtime/reference/if.cpp similarity index 100% rename from ngraph/core/reference/src/runtime/reference/if.cpp rename to src/core/reference/src/runtime/reference/if.cpp diff --git a/ngraph/core/reference/src/runtime/reference/interpolate.cpp b/src/core/reference/src/runtime/reference/interpolate.cpp similarity index 100% rename from ngraph/core/reference/src/runtime/reference/interpolate.cpp rename to src/core/reference/src/runtime/reference/interpolate.cpp diff --git a/ngraph/core/reference/src/runtime/reference/jit_generator.cpp b/src/core/reference/src/runtime/reference/jit_generator.cpp similarity index 100% rename from ngraph/core/reference/src/runtime/reference/jit_generator.cpp rename to src/core/reference/src/runtime/reference/jit_generator.cpp diff --git a/ngraph/core/reference/src/runtime/reference/jit_generator.hpp b/src/core/reference/src/runtime/reference/jit_generator.hpp similarity index 100% rename from ngraph/core/reference/src/runtime/reference/jit_generator.hpp rename to src/core/reference/src/runtime/reference/jit_generator.hpp diff --git a/ngraph/core/reference/src/runtime/reference/loop.cpp b/src/core/reference/src/runtime/reference/loop.cpp similarity index 100% rename from ngraph/core/reference/src/runtime/reference/loop.cpp rename to src/core/reference/src/runtime/reference/loop.cpp diff --git a/ngraph/core/reference/src/runtime/reference/matmul.cpp b/src/core/reference/src/runtime/reference/matmul.cpp similarity index 100% rename from ngraph/core/reference/src/runtime/reference/matmul.cpp rename to src/core/reference/src/runtime/reference/matmul.cpp diff --git a/ngraph/core/reference/src/runtime/reference/matrix_nms.cpp b/src/core/reference/src/runtime/reference/matrix_nms.cpp similarity index 100% rename from ngraph/core/reference/src/runtime/reference/matrix_nms.cpp rename to src/core/reference/src/runtime/reference/matrix_nms.cpp diff --git a/ngraph/core/reference/src/runtime/reference/multiclass_nms.cpp b/src/core/reference/src/runtime/reference/multiclass_nms.cpp similarity index 100% rename from ngraph/core/reference/src/runtime/reference/multiclass_nms.cpp rename to src/core/reference/src/runtime/reference/multiclass_nms.cpp diff --git a/ngraph/core/reference/src/runtime/reference/non_max_suppression.cpp b/src/core/reference/src/runtime/reference/non_max_suppression.cpp similarity index 100% rename from ngraph/core/reference/src/runtime/reference/non_max_suppression.cpp rename to src/core/reference/src/runtime/reference/non_max_suppression.cpp diff --git a/ngraph/core/reference/src/runtime/reference/pad.cpp b/src/core/reference/src/runtime/reference/pad.cpp similarity index 100% rename from ngraph/core/reference/src/runtime/reference/pad.cpp rename to src/core/reference/src/runtime/reference/pad.cpp diff --git a/ngraph/core/reference/src/runtime/reference/random_uniform.cpp b/src/core/reference/src/runtime/reference/random_uniform.cpp similarity index 100% rename from ngraph/core/reference/src/runtime/reference/random_uniform.cpp rename to src/core/reference/src/runtime/reference/random_uniform.cpp diff --git a/ngraph/core/reference/src/runtime/reference/reorg_yolo.cpp b/src/core/reference/src/runtime/reference/reorg_yolo.cpp similarity index 100% rename from ngraph/core/reference/src/runtime/reference/reorg_yolo.cpp rename to src/core/reference/src/runtime/reference/reorg_yolo.cpp diff --git a/ngraph/core/reference/src/runtime/reference/reshape.cpp b/src/core/reference/src/runtime/reference/reshape.cpp similarity index 100% rename from ngraph/core/reference/src/runtime/reference/reshape.cpp rename to src/core/reference/src/runtime/reference/reshape.cpp diff --git a/ngraph/core/reference/src/runtime/reference/reverse.cpp b/src/core/reference/src/runtime/reference/reverse.cpp similarity index 100% rename from ngraph/core/reference/src/runtime/reference/reverse.cpp rename to src/core/reference/src/runtime/reference/reverse.cpp diff --git a/ngraph/core/reference/src/runtime/reference/shuffle_channels.cpp b/src/core/reference/src/runtime/reference/shuffle_channels.cpp similarity index 100% rename from ngraph/core/reference/src/runtime/reference/shuffle_channels.cpp rename to src/core/reference/src/runtime/reference/shuffle_channels.cpp diff --git a/ngraph/core/reference/src/runtime/reference/slice.cpp b/src/core/reference/src/runtime/reference/slice.cpp similarity index 100% rename from ngraph/core/reference/src/runtime/reference/slice.cpp rename to src/core/reference/src/runtime/reference/slice.cpp diff --git a/ngraph/core/reference/src/runtime/reference/space_to_depth.cpp b/src/core/reference/src/runtime/reference/space_to_depth.cpp similarity index 100% rename from ngraph/core/reference/src/runtime/reference/space_to_depth.cpp rename to src/core/reference/src/runtime/reference/space_to_depth.cpp diff --git a/ngraph/core/reference/src/runtime/reference/split.cpp b/src/core/reference/src/runtime/reference/split.cpp similarity index 100% rename from ngraph/core/reference/src/runtime/reference/split.cpp rename to src/core/reference/src/runtime/reference/split.cpp diff --git a/ngraph/core/reference/src/runtime/reference/strided_slice.cpp b/src/core/reference/src/runtime/reference/strided_slice.cpp similarity index 100% rename from ngraph/core/reference/src/runtime/reference/strided_slice.cpp rename to src/core/reference/src/runtime/reference/strided_slice.cpp diff --git a/ngraph/core/reference/src/runtime/reference/tensor_iterator.cpp b/src/core/reference/src/runtime/reference/tensor_iterator.cpp similarity index 100% rename from ngraph/core/reference/src/runtime/reference/tensor_iterator.cpp rename to src/core/reference/src/runtime/reference/tensor_iterator.cpp diff --git a/ngraph/core/reference/src/runtime/reference/tile.cpp b/src/core/reference/src/runtime/reference/tile.cpp similarity index 100% rename from ngraph/core/reference/src/runtime/reference/tile.cpp rename to src/core/reference/src/runtime/reference/tile.cpp diff --git a/ngraph/core/reference/src/runtime/reference/transpose.cpp b/src/core/reference/src/runtime/reference/transpose.cpp similarity index 100% rename from ngraph/core/reference/src/runtime/reference/transpose.cpp rename to src/core/reference/src/runtime/reference/transpose.cpp diff --git a/ngraph/core/reference/src/runtime/reference/utils/nms_common.cpp b/src/core/reference/src/runtime/reference/utils/nms_common.cpp similarity index 100% rename from ngraph/core/reference/src/runtime/reference/utils/nms_common.cpp rename to src/core/reference/src/runtime/reference/utils/nms_common.cpp diff --git a/ngraph/core/shape_inference/CMakeLists.txt b/src/core/shape_inference/CMakeLists.txt similarity index 100% rename from ngraph/core/shape_inference/CMakeLists.txt rename to src/core/shape_inference/CMakeLists.txt diff --git a/ngraph/core/shape_inference/include/convolution_shape_inference.hpp b/src/core/shape_inference/include/convolution_shape_inference.hpp similarity index 100% rename from ngraph/core/shape_inference/include/convolution_shape_inference.hpp rename to src/core/shape_inference/include/convolution_shape_inference.hpp diff --git a/ngraph/core/shape_inference/include/experimental_detectron_detection_output_shape_inference.hpp b/src/core/shape_inference/include/experimental_detectron_detection_output_shape_inference.hpp similarity index 100% rename from ngraph/core/shape_inference/include/experimental_detectron_detection_output_shape_inference.hpp rename to src/core/shape_inference/include/experimental_detectron_detection_output_shape_inference.hpp diff --git a/ngraph/core/shape_inference/include/experimental_detectron_topkrois_shape_inference.hpp b/src/core/shape_inference/include/experimental_detectron_topkrois_shape_inference.hpp similarity index 100% rename from ngraph/core/shape_inference/include/experimental_detectron_topkrois_shape_inference.hpp rename to src/core/shape_inference/include/experimental_detectron_topkrois_shape_inference.hpp diff --git a/ngraph/core/shape_inference/include/reduce_shape_inference.hpp b/src/core/shape_inference/include/reduce_shape_inference.hpp similarity index 100% rename from ngraph/core/shape_inference/include/reduce_shape_inference.hpp rename to src/core/shape_inference/include/reduce_shape_inference.hpp diff --git a/ngraph/core/shape_inference/include/shape_nodes.hpp b/src/core/shape_inference/include/shape_nodes.hpp similarity index 100% rename from ngraph/core/shape_inference/include/shape_nodes.hpp rename to src/core/shape_inference/include/shape_nodes.hpp diff --git a/ngraph/core/shape_inference/include/utils.hpp b/src/core/shape_inference/include/utils.hpp similarity index 100% rename from ngraph/core/shape_inference/include/utils.hpp rename to src/core/shape_inference/include/utils.hpp diff --git a/ngraph/core/shape_inference/src/convolution_shape_inference.cpp b/src/core/shape_inference/src/convolution_shape_inference.cpp similarity index 100% rename from ngraph/core/shape_inference/src/convolution_shape_inference.cpp rename to src/core/shape_inference/src/convolution_shape_inference.cpp diff --git a/src/core/src/any.cpp b/src/core/src/any.cpp new file mode 100644 index 00000000000..2c28f292e04 --- /dev/null +++ b/src/core/src/any.cpp @@ -0,0 +1,88 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "openvino/core/any.hpp" + +namespace ov { + +void Any::Base::type_check(const std::type_info& type_info_) const { + OPENVINO_ASSERT(type_info() == type_info_, "Bad cast from: ", type_info().name(), " To type: ", type_info_.name()); +} + +std::shared_ptr Any::Base::as_variant() const { + return {}; +} + +bool Any::Base::is_copyable() const { + return true; +} +Any Any::Base::init(const std::shared_ptr&) { + return {}; +} +Any Any::Base::merge(const std::vector>&) { + return {}; +} +std::string Any::Base::to_string() { + std::stringstream strm; + print(strm); + return strm.str(); +} + +std::string Any::Base::to_string() const { + return const_cast(this)->to_string(); +} + +bool Any::Base::visit_attributes(AttributeVisitor&) { + return false; +} +bool Any::Base::visit_attributes(AttributeVisitor& visitor) const { + return const_cast(this)->visit_attributes(visitor); +} + +Any::Any(const std::shared_ptr& so, const Any& other) : _so{so}, _impl{other._impl} {} + +Any::Any(const char* str) : Any(std::string{str}) {} + +Any::Any(const std::nullptr_t) : Any() {} + +void Any::impl_check() const { + OPENVINO_ASSERT(_impl != nullptr, "Any was not initialized."); +} + +bool Any::empty() const { + return _impl == nullptr; +} + +void Any::print(std::ostream& ostream) const { + if (_impl != nullptr) { + _impl->print(ostream); + } +} + +bool Any::operator==(const Any& other) const { + if (_impl == nullptr && other._impl == nullptr) { + return false; + } + if (_impl == other._impl) { + return true; + } + return _impl->equal(*other._impl); +} + +bool Any::operator==(const std::nullptr_t&) const { + return _impl == nullptr; +} + +bool Any::operator!=(const Any& other) const { + return !operator==(other); +} + +Any::Base* Any::operator->() { + return _impl.get(); +} + +const Any::Base* Any::operator->() const { + return _impl.get(); +} +} // namespace ov diff --git a/ngraph/core/src/atomic_guard.hpp b/src/core/src/atomic_guard.hpp similarity index 100% rename from ngraph/core/src/atomic_guard.hpp rename to src/core/src/atomic_guard.hpp diff --git a/ngraph/core/src/attribute_adapter.cpp b/src/core/src/attribute_adapter.cpp similarity index 100% rename from ngraph/core/src/attribute_adapter.cpp rename to src/core/src/attribute_adapter.cpp diff --git a/ngraph/core/src/attribute_visitor.cpp b/src/core/src/attribute_visitor.cpp similarity index 100% rename from ngraph/core/src/attribute_visitor.cpp rename to src/core/src/attribute_visitor.cpp diff --git a/ngraph/core/src/axis_set.cpp b/src/core/src/axis_set.cpp similarity index 100% rename from ngraph/core/src/axis_set.cpp rename to src/core/src/axis_set.cpp diff --git a/ngraph/core/src/axis_vector.cpp b/src/core/src/axis_vector.cpp similarity index 100% rename from ngraph/core/src/axis_vector.cpp rename to src/core/src/axis_vector.cpp diff --git a/ngraph/core/src/check.cpp b/src/core/src/check.cpp similarity index 100% rename from ngraph/core/src/check.cpp rename to src/core/src/check.cpp diff --git a/ngraph/core/src/coordinate.cpp b/src/core/src/coordinate.cpp similarity index 100% rename from ngraph/core/src/coordinate.cpp rename to src/core/src/coordinate.cpp diff --git a/ngraph/core/src/coordinate_diff.cpp b/src/core/src/coordinate_diff.cpp similarity index 100% rename from ngraph/core/src/coordinate_diff.cpp rename to src/core/src/coordinate_diff.cpp diff --git a/ngraph/core/src/descriptor/input.cpp b/src/core/src/descriptor/input.cpp similarity index 100% rename from ngraph/core/src/descriptor/input.cpp rename to src/core/src/descriptor/input.cpp diff --git a/ngraph/core/src/descriptor/output.cpp b/src/core/src/descriptor/output.cpp similarity index 100% rename from ngraph/core/src/descriptor/output.cpp rename to src/core/src/descriptor/output.cpp diff --git a/ngraph/core/src/descriptor/tensor.cpp b/src/core/src/descriptor/tensor.cpp similarity index 100% rename from ngraph/core/src/descriptor/tensor.cpp rename to src/core/src/descriptor/tensor.cpp diff --git a/ngraph/core/src/dimension.cpp b/src/core/src/dimension.cpp similarity index 100% rename from ngraph/core/src/dimension.cpp rename to src/core/src/dimension.cpp diff --git a/ngraph/core/src/distributed.cpp b/src/core/src/distributed.cpp similarity index 91% rename from ngraph/core/src/distributed.cpp rename to src/core/src/distributed.cpp index 10f16f5c961..5c9c1cc3b36 100644 --- a/ngraph/core/src/distributed.cpp +++ b/src/core/src/distributed.cpp @@ -12,7 +12,7 @@ using namespace ngraph; namespace ov { template <> -EnumNames& EnumNames::get() { +NGRAPH_API EnumNames& EnumNames::get() { static auto enum_names = ov::EnumNames("reduction::Type", {{"SUM", ngraph::reduction::Type::SUM}, {"PROD", ngraph::reduction::Type::PROD}, diff --git a/ngraph/core/src/env_util.cpp b/src/core/src/env_util.cpp similarity index 100% rename from ngraph/core/src/env_util.cpp rename to src/core/src/env_util.cpp diff --git a/ngraph/core/src/extension.cpp b/src/core/src/extension.cpp similarity index 100% rename from ngraph/core/src/extension.cpp rename to src/core/src/extension.cpp diff --git a/ngraph/core/src/factory.cpp b/src/core/src/factory.cpp similarity index 100% rename from ngraph/core/src/factory.cpp rename to src/core/src/factory.cpp diff --git a/ngraph/core/src/file_util.cpp b/src/core/src/file_util.cpp similarity index 100% rename from ngraph/core/src/file_util.cpp rename to src/core/src/file_util.cpp diff --git a/ngraph/core/src/function.cpp b/src/core/src/function.cpp similarity index 97% rename from ngraph/core/src/function.cpp rename to src/core/src/function.cpp index 7fbeb39f07c..88b4355ea6c 100644 --- a/ngraph/core/src/function.cpp +++ b/src/core/src/function.cpp @@ -436,6 +436,10 @@ int64_t ov::Function::get_parameter_index(const std::shared_ptr& value) const { + return get_result_index(Output(value.get_node(), value.get_index())); +} + +int64_t ov::Function::get_result_index(const Output& value) const { int64_t pos = 0; if (is_type(value.get_node_shared_ptr())) { auto result = value.get_node_shared_ptr(); @@ -447,7 +451,9 @@ int64_t ov::Function::get_result_index(const Output& value) const { } } else { for (auto r : get_results()) { - if (r->input_value(0) == value) { + const auto& input_value = r->input_value(0); + const auto result_input = Output(input_value.get_node(), input_value.get_index()); + if (result_input == value) { return pos; } pos++; @@ -862,22 +868,21 @@ void ov::Function::reshape(const std::map, ov::PartialShape } } -void ov::Function::add_output(const std::string& tensor_name) { +ov::Output ov::Function::add_output(const std::string& tensor_name) { for (const auto& op : get_ops()) { if (ov::op::util::is_output(op)) continue; for (const auto& output : op->outputs()) { const auto& names = output.get_tensor().get_names(); if (names.find(tensor_name) != names.end()) { - add_output(output); - return; + return add_output(output); } } } throw ov::Exception("Tensor name " + tensor_name + " was not found."); } -void ov::Function::add_output(const std::string& op_name, size_t output_idx) { +ov::Output ov::Function::add_output(const std::string& op_name, size_t output_idx) { for (const auto& op : get_ops()) { if (op->get_friendly_name() == op_name) { OPENVINO_ASSERT(output_idx < op->get_output_size(), @@ -888,23 +893,23 @@ void ov::Function::add_output(const std::string& op_name, size_t output_idx) { " has only ", std::to_string(op->get_output_size()), " outputs."); - add_output(op->output(output_idx)); - return; + return add_output(op->output(output_idx)); } } throw ov::Exception("Port " + std::to_string(output_idx) + " for operation with name " + op_name + " was not found."); } -void ov::Function::add_output(const ov::Output& port) { +ov::Output ov::Function::add_output(const ov::Output& port) { if (ov::op::util::is_output(port.get_node())) - return; + return port; for (const auto& input : port.get_target_inputs()) { // Do not add result if port is already connected with result if (ov::op::util::is_output(input.get_node())) { - return; + return input.get_node()->output(0); } } auto result = std::make_shared(port); add_results({result}); + return result->output(0); } diff --git a/ngraph/core/src/graph_util.cpp b/src/core/src/graph_util.cpp similarity index 100% rename from ngraph/core/src/graph_util.cpp rename to src/core/src/graph_util.cpp diff --git a/ngraph/core/src/ie_legacy/blob_factory.cpp b/src/core/src/ie_legacy/blob_factory.cpp similarity index 100% rename from ngraph/core/src/ie_legacy/blob_factory.cpp rename to src/core/src/ie_legacy/blob_factory.cpp diff --git a/ngraph/core/src/ie_legacy/ie_blob_common.cpp b/src/core/src/ie_legacy/ie_blob_common.cpp similarity index 100% rename from ngraph/core/src/ie_legacy/ie_blob_common.cpp rename to src/core/src/ie_legacy/ie_blob_common.cpp diff --git a/ngraph/core/src/ie_legacy/ie_layouts.cpp b/src/core/src/ie_legacy/ie_layouts.cpp similarity index 100% rename from ngraph/core/src/ie_legacy/ie_layouts.cpp rename to src/core/src/ie_legacy/ie_layouts.cpp diff --git a/ngraph/core/src/ie_legacy/system_allocator.cpp b/src/core/src/ie_legacy/system_allocator.cpp similarity index 100% rename from ngraph/core/src/ie_legacy/system_allocator.cpp rename to src/core/src/ie_legacy/system_allocator.cpp diff --git a/ngraph/core/src/interval.cpp b/src/core/src/interval.cpp similarity index 100% rename from ngraph/core/src/interval.cpp rename to src/core/src/interval.cpp diff --git a/ngraph/core/src/itt.hpp b/src/core/src/itt.hpp similarity index 100% rename from ngraph/core/src/itt.hpp rename to src/core/src/itt.hpp diff --git a/ngraph/core/src/layout.cpp b/src/core/src/layout.cpp similarity index 100% rename from ngraph/core/src/layout.cpp rename to src/core/src/layout.cpp diff --git a/ngraph/core/src/log.cpp b/src/core/src/log.cpp similarity index 100% rename from ngraph/core/src/log.cpp rename to src/core/src/log.cpp diff --git a/ngraph/core/src/ngraph.cpp b/src/core/src/ngraph.cpp similarity index 100% rename from ngraph/core/src/ngraph.cpp rename to src/core/src/ngraph.cpp diff --git a/ngraph/core/src/node.cpp b/src/core/src/node.cpp similarity index 100% rename from ngraph/core/src/node.cpp rename to src/core/src/node.cpp diff --git a/ngraph/core/src/node_input.cpp b/src/core/src/node_input.cpp similarity index 100% rename from ngraph/core/src/node_input.cpp rename to src/core/src/node_input.cpp diff --git a/ngraph/core/src/node_output.cpp b/src/core/src/node_output.cpp similarity index 100% rename from ngraph/core/src/node_output.cpp rename to src/core/src/node_output.cpp diff --git a/ngraph/core/src/node_vector.cpp b/src/core/src/node_vector.cpp similarity index 100% rename from ngraph/core/src/node_vector.cpp rename to src/core/src/node_vector.cpp diff --git a/ngraph/core/src/op/abs.cpp b/src/core/src/op/abs.cpp similarity index 96% rename from ngraph/core/src/op/abs.cpp rename to src/core/src/op/abs.cpp index 159850b650e..61f180d9934 100644 --- a/ngraph/core/src/op/abs.cpp +++ b/src/core/src/op/abs.cpp @@ -36,7 +36,6 @@ bool evaluate_abs(const ngraph::HostTensorPtr& arg0, const ngraph::HostTensorPtr out->set_unary(arg0); switch (arg0->get_element_type()) { - NGRAPH_TYPE_CASE(evaluate_abs, boolean, arg0, out, count); NGRAPH_TYPE_CASE(evaluate_abs, i32, arg0, out, count); NGRAPH_TYPE_CASE(evaluate_abs, i64, arg0, out, count); NGRAPH_TYPE_CASE(evaluate_abs, u32, arg0, out, count); @@ -68,7 +67,6 @@ bool ov::op::v0::Abs::has_evaluate() const { case ngraph::element::f16: case ngraph::element::f32: case ngraph::element::bf16: - case ngraph::element::boolean: return true; default: break; diff --git a/ngraph/core/src/op/acos.cpp b/src/core/src/op/acos.cpp similarity index 100% rename from ngraph/core/src/op/acos.cpp rename to src/core/src/op/acos.cpp diff --git a/ngraph/core/src/op/acosh.cpp b/src/core/src/op/acosh.cpp similarity index 100% rename from ngraph/core/src/op/acosh.cpp rename to src/core/src/op/acosh.cpp diff --git a/ngraph/core/src/op/adaptive_avg_pool.cpp b/src/core/src/op/adaptive_avg_pool.cpp similarity index 100% rename from ngraph/core/src/op/adaptive_avg_pool.cpp rename to src/core/src/op/adaptive_avg_pool.cpp diff --git a/ngraph/core/src/op/adaptive_max_pool.cpp b/src/core/src/op/adaptive_max_pool.cpp similarity index 100% rename from ngraph/core/src/op/adaptive_max_pool.cpp rename to src/core/src/op/adaptive_max_pool.cpp diff --git a/ngraph/core/src/op/add.cpp b/src/core/src/op/add.cpp similarity index 100% rename from ngraph/core/src/op/add.cpp rename to src/core/src/op/add.cpp diff --git a/ngraph/core/src/op/asin.cpp b/src/core/src/op/asin.cpp similarity index 100% rename from ngraph/core/src/op/asin.cpp rename to src/core/src/op/asin.cpp diff --git a/ngraph/core/src/op/asinh.cpp b/src/core/src/op/asinh.cpp similarity index 100% rename from ngraph/core/src/op/asinh.cpp rename to src/core/src/op/asinh.cpp diff --git a/ngraph/core/src/op/assign.cpp b/src/core/src/op/assign.cpp similarity index 100% rename from ngraph/core/src/op/assign.cpp rename to src/core/src/op/assign.cpp diff --git a/ngraph/core/src/op/atan.cpp b/src/core/src/op/atan.cpp similarity index 100% rename from ngraph/core/src/op/atan.cpp rename to src/core/src/op/atan.cpp diff --git a/ngraph/core/src/op/atanh.cpp b/src/core/src/op/atanh.cpp similarity index 100% rename from ngraph/core/src/op/atanh.cpp rename to src/core/src/op/atanh.cpp diff --git a/ngraph/core/src/op/avg_pool.cpp b/src/core/src/op/avg_pool.cpp similarity index 100% rename from ngraph/core/src/op/avg_pool.cpp rename to src/core/src/op/avg_pool.cpp diff --git a/ngraph/core/src/op/batch_norm.cpp b/src/core/src/op/batch_norm.cpp similarity index 100% rename from ngraph/core/src/op/batch_norm.cpp rename to src/core/src/op/batch_norm.cpp diff --git a/ngraph/core/src/op/batch_to_space.cpp b/src/core/src/op/batch_to_space.cpp similarity index 100% rename from ngraph/core/src/op/batch_to_space.cpp rename to src/core/src/op/batch_to_space.cpp diff --git a/ngraph/core/src/op/binary_convolution.cpp b/src/core/src/op/binary_convolution.cpp similarity index 100% rename from ngraph/core/src/op/binary_convolution.cpp rename to src/core/src/op/binary_convolution.cpp diff --git a/ngraph/core/src/op/broadcast.cpp b/src/core/src/op/broadcast.cpp similarity index 100% rename from ngraph/core/src/op/broadcast.cpp rename to src/core/src/op/broadcast.cpp diff --git a/ngraph/core/src/op/bucketize.cpp b/src/core/src/op/bucketize.cpp similarity index 100% rename from ngraph/core/src/op/bucketize.cpp rename to src/core/src/op/bucketize.cpp diff --git a/ngraph/core/src/op/ceiling.cpp b/src/core/src/op/ceiling.cpp similarity index 96% rename from ngraph/core/src/op/ceiling.cpp rename to src/core/src/op/ceiling.cpp index 5a92ea19eae..c8bfccb07c3 100644 --- a/ngraph/core/src/op/ceiling.cpp +++ b/src/core/src/op/ceiling.cpp @@ -47,7 +47,6 @@ bool evaluate_ceiling(const HostTensorPtr& arg0, const HostTensorPtr& out, const out->set_unary(arg0); switch (arg0->get_element_type()) { - NGRAPH_COPY_TENSOR(evaluate_ceiling, boolean, arg0, out, count); NGRAPH_COPY_TENSOR(evaluate_ceiling, i8, arg0, out, count); NGRAPH_COPY_TENSOR(evaluate_ceiling, i16, arg0, out, count); NGRAPH_COPY_TENSOR(evaluate_ceiling, i32, arg0, out, count); @@ -75,7 +74,6 @@ bool op::Ceiling::evaluate(const HostTensorVector& outputs, const HostTensorVect bool op::Ceiling::has_evaluate() const { NGRAPH_OP_SCOPE(v0_Ceiling_has_evaluate); switch (get_input_element_type(0)) { - case ngraph::element::boolean: case ngraph::element::i8: case ngraph::element::i16: case ngraph::element::i32: diff --git a/ngraph/core/src/op/clamp.cpp b/src/core/src/op/clamp.cpp similarity index 100% rename from ngraph/core/src/op/clamp.cpp rename to src/core/src/op/clamp.cpp diff --git a/ngraph/core/src/op/concat.cpp b/src/core/src/op/concat.cpp similarity index 100% rename from ngraph/core/src/op/concat.cpp rename to src/core/src/op/concat.cpp diff --git a/ngraph/core/src/op/constant.cpp b/src/core/src/op/constant.cpp similarity index 100% rename from ngraph/core/src/op/constant.cpp rename to src/core/src/op/constant.cpp diff --git a/ngraph/core/src/op/convert.cpp b/src/core/src/op/convert.cpp similarity index 100% rename from ngraph/core/src/op/convert.cpp rename to src/core/src/op/convert.cpp diff --git a/ngraph/core/src/op/convert_like.cpp b/src/core/src/op/convert_like.cpp similarity index 100% rename from ngraph/core/src/op/convert_like.cpp rename to src/core/src/op/convert_like.cpp diff --git a/ngraph/core/src/op/convolution.cpp b/src/core/src/op/convolution.cpp similarity index 100% rename from ngraph/core/src/op/convolution.cpp rename to src/core/src/op/convolution.cpp diff --git a/ngraph/core/src/op/cos.cpp b/src/core/src/op/cos.cpp similarity index 100% rename from ngraph/core/src/op/cos.cpp rename to src/core/src/op/cos.cpp diff --git a/ngraph/core/src/op/cosh.cpp b/src/core/src/op/cosh.cpp similarity index 100% rename from ngraph/core/src/op/cosh.cpp rename to src/core/src/op/cosh.cpp diff --git a/ngraph/core/src/op/ctc_greedy_decoder.cpp b/src/core/src/op/ctc_greedy_decoder.cpp similarity index 100% rename from ngraph/core/src/op/ctc_greedy_decoder.cpp rename to src/core/src/op/ctc_greedy_decoder.cpp diff --git a/ngraph/core/src/op/ctc_greedy_decoder_seq_len.cpp b/src/core/src/op/ctc_greedy_decoder_seq_len.cpp similarity index 100% rename from ngraph/core/src/op/ctc_greedy_decoder_seq_len.cpp rename to src/core/src/op/ctc_greedy_decoder_seq_len.cpp diff --git a/ngraph/core/src/op/ctc_loss.cpp b/src/core/src/op/ctc_loss.cpp similarity index 100% rename from ngraph/core/src/op/ctc_loss.cpp rename to src/core/src/op/ctc_loss.cpp diff --git a/ngraph/core/src/op/cum_sum.cpp b/src/core/src/op/cum_sum.cpp similarity index 100% rename from ngraph/core/src/op/cum_sum.cpp rename to src/core/src/op/cum_sum.cpp diff --git a/ngraph/core/src/op/deformable_convolution.cpp b/src/core/src/op/deformable_convolution.cpp similarity index 100% rename from ngraph/core/src/op/deformable_convolution.cpp rename to src/core/src/op/deformable_convolution.cpp diff --git a/ngraph/core/src/op/deformable_psroi_pooling.cpp b/src/core/src/op/deformable_psroi_pooling.cpp similarity index 100% rename from ngraph/core/src/op/deformable_psroi_pooling.cpp rename to src/core/src/op/deformable_psroi_pooling.cpp diff --git a/ngraph/core/src/op/depth_to_space.cpp b/src/core/src/op/depth_to_space.cpp similarity index 100% rename from ngraph/core/src/op/depth_to_space.cpp rename to src/core/src/op/depth_to_space.cpp diff --git a/ngraph/core/src/op/detection_output.cpp b/src/core/src/op/detection_output.cpp similarity index 100% rename from ngraph/core/src/op/detection_output.cpp rename to src/core/src/op/detection_output.cpp diff --git a/ngraph/core/src/op/dft.cpp b/src/core/src/op/dft.cpp similarity index 100% rename from ngraph/core/src/op/dft.cpp rename to src/core/src/op/dft.cpp diff --git a/ngraph/core/src/op/divide.cpp b/src/core/src/op/divide.cpp similarity index 100% rename from ngraph/core/src/op/divide.cpp rename to src/core/src/op/divide.cpp diff --git a/ngraph/core/src/op/einsum.cpp b/src/core/src/op/einsum.cpp similarity index 100% rename from ngraph/core/src/op/einsum.cpp rename to src/core/src/op/einsum.cpp diff --git a/ngraph/core/src/op/elu.cpp b/src/core/src/op/elu.cpp similarity index 100% rename from ngraph/core/src/op/elu.cpp rename to src/core/src/op/elu.cpp diff --git a/ngraph/core/src/op/embedding_segments_sum.cpp b/src/core/src/op/embedding_segments_sum.cpp similarity index 100% rename from ngraph/core/src/op/embedding_segments_sum.cpp rename to src/core/src/op/embedding_segments_sum.cpp diff --git a/ngraph/core/src/op/embeddingbag_offsets_sum.cpp b/src/core/src/op/embeddingbag_offsets_sum.cpp similarity index 100% rename from ngraph/core/src/op/embeddingbag_offsets_sum.cpp rename to src/core/src/op/embeddingbag_offsets_sum.cpp diff --git a/ngraph/core/src/op/embeddingbag_packedsum.cpp b/src/core/src/op/embeddingbag_packedsum.cpp similarity index 100% rename from ngraph/core/src/op/embeddingbag_packedsum.cpp rename to src/core/src/op/embeddingbag_packedsum.cpp diff --git a/ngraph/core/src/op/equal.cpp b/src/core/src/op/equal.cpp similarity index 100% rename from ngraph/core/src/op/equal.cpp rename to src/core/src/op/equal.cpp diff --git a/ngraph/core/src/op/erf.cpp b/src/core/src/op/erf.cpp similarity index 100% rename from ngraph/core/src/op/erf.cpp rename to src/core/src/op/erf.cpp diff --git a/ngraph/core/src/op/exp.cpp b/src/core/src/op/exp.cpp similarity index 100% rename from ngraph/core/src/op/exp.cpp rename to src/core/src/op/exp.cpp diff --git a/ngraph/core/src/op/experimental_detectron_detection_output.cpp b/src/core/src/op/experimental_detectron_detection_output.cpp similarity index 100% rename from ngraph/core/src/op/experimental_detectron_detection_output.cpp rename to src/core/src/op/experimental_detectron_detection_output.cpp diff --git a/ngraph/core/src/op/experimental_detectron_generate_proposals.cpp b/src/core/src/op/experimental_detectron_generate_proposals.cpp similarity index 100% rename from ngraph/core/src/op/experimental_detectron_generate_proposals.cpp rename to src/core/src/op/experimental_detectron_generate_proposals.cpp diff --git a/ngraph/core/src/op/experimental_detectron_prior_grid_generator.cpp b/src/core/src/op/experimental_detectron_prior_grid_generator.cpp similarity index 100% rename from ngraph/core/src/op/experimental_detectron_prior_grid_generator.cpp rename to src/core/src/op/experimental_detectron_prior_grid_generator.cpp diff --git a/ngraph/core/src/op/experimental_detectron_roi_feature.cpp b/src/core/src/op/experimental_detectron_roi_feature.cpp similarity index 100% rename from ngraph/core/src/op/experimental_detectron_roi_feature.cpp rename to src/core/src/op/experimental_detectron_roi_feature.cpp diff --git a/ngraph/core/src/op/experimental_detectron_topkrois.cpp b/src/core/src/op/experimental_detectron_topkrois.cpp similarity index 100% rename from ngraph/core/src/op/experimental_detectron_topkrois.cpp rename to src/core/src/op/experimental_detectron_topkrois.cpp diff --git a/ngraph/core/src/op/extractimagepatches.cpp b/src/core/src/op/extractimagepatches.cpp similarity index 100% rename from ngraph/core/src/op/extractimagepatches.cpp rename to src/core/src/op/extractimagepatches.cpp diff --git a/ngraph/core/src/op/fake_quantize.cpp b/src/core/src/op/fake_quantize.cpp similarity index 100% rename from ngraph/core/src/op/fake_quantize.cpp rename to src/core/src/op/fake_quantize.cpp diff --git a/ngraph/core/src/op/floor.cpp b/src/core/src/op/floor.cpp similarity index 96% rename from ngraph/core/src/op/floor.cpp rename to src/core/src/op/floor.cpp index 14c75605558..c47153de03a 100644 --- a/ngraph/core/src/op/floor.cpp +++ b/src/core/src/op/floor.cpp @@ -52,7 +52,6 @@ bool evaluate_floor(const HostTensorPtr& arg0, const HostTensorPtr& out, const s out->set_unary(arg0); switch (arg0->get_element_type()) { - NGRAPH_COPY_TENSOR(evaluate_floor, boolean, arg0, out, count); NGRAPH_COPY_TENSOR(evaluate_floor, i8, arg0, out, count); NGRAPH_COPY_TENSOR(evaluate_floor, i16, arg0, out, count); NGRAPH_COPY_TENSOR(evaluate_floor, i32, arg0, out, count); @@ -80,7 +79,6 @@ bool op::Floor::evaluate(const HostTensorVector& outputs, const HostTensorVector bool op::Floor::has_evaluate() const { NGRAPH_OP_SCOPE(v0_Floor_has_evaluate); switch (get_input_element_type(0)) { - case ngraph::element::boolean: case ngraph::element::i8: case ngraph::element::i16: case ngraph::element::i32: diff --git a/ngraph/core/src/op/floor_mod.cpp b/src/core/src/op/floor_mod.cpp similarity index 100% rename from ngraph/core/src/op/floor_mod.cpp rename to src/core/src/op/floor_mod.cpp diff --git a/ngraph/core/src/op/gather.cpp b/src/core/src/op/gather.cpp similarity index 100% rename from ngraph/core/src/op/gather.cpp rename to src/core/src/op/gather.cpp diff --git a/ngraph/core/src/op/gather_elements.cpp b/src/core/src/op/gather_elements.cpp similarity index 100% rename from ngraph/core/src/op/gather_elements.cpp rename to src/core/src/op/gather_elements.cpp diff --git a/ngraph/core/src/op/gather_nd.cpp b/src/core/src/op/gather_nd.cpp similarity index 100% rename from ngraph/core/src/op/gather_nd.cpp rename to src/core/src/op/gather_nd.cpp diff --git a/ngraph/core/src/op/gather_tree.cpp b/src/core/src/op/gather_tree.cpp similarity index 100% rename from ngraph/core/src/op/gather_tree.cpp rename to src/core/src/op/gather_tree.cpp diff --git a/ngraph/core/src/op/gelu.cpp b/src/core/src/op/gelu.cpp similarity index 100% rename from ngraph/core/src/op/gelu.cpp rename to src/core/src/op/gelu.cpp diff --git a/ngraph/core/src/op/greater.cpp b/src/core/src/op/greater.cpp similarity index 100% rename from ngraph/core/src/op/greater.cpp rename to src/core/src/op/greater.cpp diff --git a/ngraph/core/src/op/greater_eq.cpp b/src/core/src/op/greater_eq.cpp similarity index 100% rename from ngraph/core/src/op/greater_eq.cpp rename to src/core/src/op/greater_eq.cpp diff --git a/ngraph/core/src/op/grn.cpp b/src/core/src/op/grn.cpp similarity index 100% rename from ngraph/core/src/op/grn.cpp rename to src/core/src/op/grn.cpp diff --git a/ngraph/core/src/op/group_conv.cpp b/src/core/src/op/group_conv.cpp similarity index 100% rename from ngraph/core/src/op/group_conv.cpp rename to src/core/src/op/group_conv.cpp diff --git a/ngraph/core/src/op/gru_cell.cpp b/src/core/src/op/gru_cell.cpp similarity index 100% rename from ngraph/core/src/op/gru_cell.cpp rename to src/core/src/op/gru_cell.cpp diff --git a/ngraph/core/src/op/gru_sequence.cpp b/src/core/src/op/gru_sequence.cpp similarity index 100% rename from ngraph/core/src/op/gru_sequence.cpp rename to src/core/src/op/gru_sequence.cpp diff --git a/ngraph/core/src/op/hard_sigmoid.cpp b/src/core/src/op/hard_sigmoid.cpp similarity index 100% rename from ngraph/core/src/op/hard_sigmoid.cpp rename to src/core/src/op/hard_sigmoid.cpp diff --git a/ngraph/core/src/op/hsigmoid.cpp b/src/core/src/op/hsigmoid.cpp similarity index 100% rename from ngraph/core/src/op/hsigmoid.cpp rename to src/core/src/op/hsigmoid.cpp diff --git a/ngraph/core/src/op/hswish.cpp b/src/core/src/op/hswish.cpp similarity index 100% rename from ngraph/core/src/op/hswish.cpp rename to src/core/src/op/hswish.cpp diff --git a/ngraph/core/src/op/i420_to_bgr.cpp b/src/core/src/op/i420_to_bgr.cpp similarity index 100% rename from ngraph/core/src/op/i420_to_bgr.cpp rename to src/core/src/op/i420_to_bgr.cpp diff --git a/ngraph/core/src/op/i420_to_rgb.cpp b/src/core/src/op/i420_to_rgb.cpp similarity index 100% rename from ngraph/core/src/op/i420_to_rgb.cpp rename to src/core/src/op/i420_to_rgb.cpp diff --git a/ngraph/core/src/op/idft.cpp b/src/core/src/op/idft.cpp similarity index 100% rename from ngraph/core/src/op/idft.cpp rename to src/core/src/op/idft.cpp diff --git a/ngraph/core/src/op/if.cpp b/src/core/src/op/if.cpp similarity index 100% rename from ngraph/core/src/op/if.cpp rename to src/core/src/op/if.cpp diff --git a/ngraph/core/src/op/interpolate.cpp b/src/core/src/op/interpolate.cpp similarity index 99% rename from ngraph/core/src/op/interpolate.cpp rename to src/core/src/op/interpolate.cpp index 2aed5f92af7..1dfe5f1b72a 100644 --- a/ngraph/core/src/op/interpolate.cpp +++ b/src/core/src/op/interpolate.cpp @@ -75,7 +75,7 @@ std::ostream& ov::operator<<(std::ostream& s, const op::v0::Interpolate::Interpo namespace ov { template <> -EnumNames& +NGRAPH_API EnumNames& EnumNames::get() { static auto enum_names = EnumNames( "op::v0::Interpolate::InterpolateMode", diff --git a/ngraph/core/src/op/less.cpp b/src/core/src/op/less.cpp similarity index 100% rename from ngraph/core/src/op/less.cpp rename to src/core/src/op/less.cpp diff --git a/ngraph/core/src/op/less_eq.cpp b/src/core/src/op/less_eq.cpp similarity index 100% rename from ngraph/core/src/op/less_eq.cpp rename to src/core/src/op/less_eq.cpp diff --git a/ngraph/core/src/op/log.cpp b/src/core/src/op/log.cpp similarity index 95% rename from ngraph/core/src/op/log.cpp rename to src/core/src/op/log.cpp index c1d7878ab8c..8d2173e96b9 100644 --- a/ngraph/core/src/op/log.cpp +++ b/src/core/src/op/log.cpp @@ -43,7 +43,6 @@ bool evaluate_log(const HostTensorPtr& arg0, const HostTensorPtr& out, const siz out->set_unary(arg0); switch (arg0->get_element_type()) { - NGRAPH_TYPE_CASE(evaluate_log, boolean, arg0, out, count); NGRAPH_TYPE_CASE(evaluate_log, i32, arg0, out, count); NGRAPH_TYPE_CASE(evaluate_log, i64, arg0, out, count); NGRAPH_TYPE_CASE(evaluate_log, u32, arg0, out, count); @@ -67,7 +66,6 @@ bool op::Log::evaluate(const HostTensorVector& outputs, const HostTensorVector& bool op::Log::has_evaluate() const { NGRAPH_OP_SCOPE(v0_Log_has_evaluate); switch (get_input_element_type(0)) { - case ngraph::element::boolean: case ngraph::element::i32: case ngraph::element::i64: case ngraph::element::u32: diff --git a/ngraph/core/src/op/log_softmax.cpp b/src/core/src/op/log_softmax.cpp similarity index 100% rename from ngraph/core/src/op/log_softmax.cpp rename to src/core/src/op/log_softmax.cpp diff --git a/ngraph/core/src/op/logical_and.cpp b/src/core/src/op/logical_and.cpp similarity index 100% rename from ngraph/core/src/op/logical_and.cpp rename to src/core/src/op/logical_and.cpp diff --git a/ngraph/core/src/op/logical_not.cpp b/src/core/src/op/logical_not.cpp similarity index 100% rename from ngraph/core/src/op/logical_not.cpp rename to src/core/src/op/logical_not.cpp diff --git a/ngraph/core/src/op/logical_or.cpp b/src/core/src/op/logical_or.cpp similarity index 100% rename from ngraph/core/src/op/logical_or.cpp rename to src/core/src/op/logical_or.cpp diff --git a/ngraph/core/src/op/loop.cpp b/src/core/src/op/loop.cpp similarity index 100% rename from ngraph/core/src/op/loop.cpp rename to src/core/src/op/loop.cpp diff --git a/ngraph/core/src/op/lrn.cpp b/src/core/src/op/lrn.cpp similarity index 100% rename from ngraph/core/src/op/lrn.cpp rename to src/core/src/op/lrn.cpp diff --git a/ngraph/core/src/op/lstm_cell.cpp b/src/core/src/op/lstm_cell.cpp similarity index 99% rename from ngraph/core/src/op/lstm_cell.cpp rename to src/core/src/op/lstm_cell.cpp index b62403adf02..22de84fb11e 100644 --- a/ngraph/core/src/op/lstm_cell.cpp +++ b/src/core/src/op/lstm_cell.cpp @@ -336,7 +336,7 @@ shared_ptr op::v0::LSTMCell::clone_with_new_inputs(const OutputVector& new namespace ov { template <> -EnumNames& EnumNames::get() { +NGRAPH_API EnumNames& EnumNames::get() { static auto enum_names = EnumNames("op::LSTMWeightsFormat", {{"fico", ngraph::op::LSTMWeightsFormat::FICO}, {"icof", ngraph::op::LSTMWeightsFormat::ICOF}, diff --git a/ngraph/core/src/op/lstm_sequence.cpp b/src/core/src/op/lstm_sequence.cpp similarity index 100% rename from ngraph/core/src/op/lstm_sequence.cpp rename to src/core/src/op/lstm_sequence.cpp diff --git a/ngraph/core/src/op/matmul.cpp b/src/core/src/op/matmul.cpp similarity index 100% rename from ngraph/core/src/op/matmul.cpp rename to src/core/src/op/matmul.cpp diff --git a/ngraph/core/src/op/matrix_nms.cpp b/src/core/src/op/matrix_nms.cpp similarity index 100% rename from ngraph/core/src/op/matrix_nms.cpp rename to src/core/src/op/matrix_nms.cpp diff --git a/ngraph/core/src/op/max_pool.cpp b/src/core/src/op/max_pool.cpp similarity index 100% rename from ngraph/core/src/op/max_pool.cpp rename to src/core/src/op/max_pool.cpp diff --git a/ngraph/core/src/op/maximum.cpp b/src/core/src/op/maximum.cpp similarity index 100% rename from ngraph/core/src/op/maximum.cpp rename to src/core/src/op/maximum.cpp diff --git a/ngraph/core/src/op/minimum.cpp b/src/core/src/op/minimum.cpp similarity index 100% rename from ngraph/core/src/op/minimum.cpp rename to src/core/src/op/minimum.cpp diff --git a/ngraph/core/src/op/mish.cpp b/src/core/src/op/mish.cpp similarity index 100% rename from ngraph/core/src/op/mish.cpp rename to src/core/src/op/mish.cpp diff --git a/ngraph/core/src/op/mod.cpp b/src/core/src/op/mod.cpp similarity index 100% rename from ngraph/core/src/op/mod.cpp rename to src/core/src/op/mod.cpp diff --git a/ngraph/core/src/op/multiclass_nms.cpp b/src/core/src/op/multiclass_nms.cpp similarity index 100% rename from ngraph/core/src/op/multiclass_nms.cpp rename to src/core/src/op/multiclass_nms.cpp diff --git a/ngraph/core/src/op/multiply.cpp b/src/core/src/op/multiply.cpp similarity index 92% rename from ngraph/core/src/op/multiply.cpp rename to src/core/src/op/multiply.cpp index a72a561e22e..0441ab3c9a9 100644 --- a/ngraph/core/src/op/multiply.cpp +++ b/src/core/src/op/multiply.cpp @@ -41,6 +41,9 @@ bool evaluate_multiply(const HostTensorPtr& arg0, NGRAPH_TYPE_CASE(evaluate_multiply, f16, arg0, arg1, out, broadcast_spec); NGRAPH_TYPE_CASE(evaluate_multiply, f32, arg0, arg1, out, broadcast_spec); NGRAPH_TYPE_CASE(evaluate_multiply, bf16, arg0, arg1, out, broadcast_spec); + NGRAPH_TYPE_CASE(evaluate_multiply, u8, arg0, arg1, out, broadcast_spec); + NGRAPH_TYPE_CASE(evaluate_multiply, i16, arg0, arg1, out, broadcast_spec); + NGRAPH_TYPE_CASE(evaluate_multiply, u16, arg0, arg1, out, broadcast_spec); default: rc = false; break; diff --git a/ngraph/core/src/op/mvn.cpp b/src/core/src/op/mvn.cpp similarity index 100% rename from ngraph/core/src/op/mvn.cpp rename to src/core/src/op/mvn.cpp diff --git a/ngraph/core/src/op/negative.cpp b/src/core/src/op/negative.cpp similarity index 100% rename from ngraph/core/src/op/negative.cpp rename to src/core/src/op/negative.cpp diff --git a/ngraph/core/src/op/non_max_suppression.cpp b/src/core/src/op/non_max_suppression.cpp similarity index 99% rename from ngraph/core/src/op/non_max_suppression.cpp rename to src/core/src/op/non_max_suppression.cpp index 8180b5a32e2..dec0ba4b136 100644 --- a/ngraph/core/src/op/non_max_suppression.cpp +++ b/src/core/src/op/non_max_suppression.cpp @@ -177,7 +177,7 @@ int64_t op::v1::NonMaxSuppression::max_boxes_output_from_input() const { namespace ov { template <> -EnumNames& +NGRAPH_API EnumNames& EnumNames::get() { static auto enum_names = EnumNames( "op::v1::NonMaxSuppression::BoxEncodingType", @@ -365,7 +365,7 @@ int64_t op::v3::NonMaxSuppression::max_boxes_output_from_input() const { namespace ov { template <> -EnumNames& +NGRAPH_API EnumNames& EnumNames::get() { static auto enum_names = EnumNames( "op::v3::NonMaxSuppression::BoxEncodingType", @@ -825,7 +825,7 @@ std::ostream& ov::operator<<(std::ostream& s, const op::v5::NonMaxSuppression::B namespace ov { template <> -EnumNames& +NGRAPH_API EnumNames& EnumNames::get() { static auto enum_names = EnumNames( "op::v5::NonMaxSuppression::BoxEncodingType", diff --git a/ngraph/core/src/op/non_zero.cpp b/src/core/src/op/non_zero.cpp similarity index 100% rename from ngraph/core/src/op/non_zero.cpp rename to src/core/src/op/non_zero.cpp diff --git a/ngraph/core/src/op/normalize_l2.cpp b/src/core/src/op/normalize_l2.cpp similarity index 100% rename from ngraph/core/src/op/normalize_l2.cpp rename to src/core/src/op/normalize_l2.cpp diff --git a/ngraph/core/src/op/not_equal.cpp b/src/core/src/op/not_equal.cpp similarity index 100% rename from ngraph/core/src/op/not_equal.cpp rename to src/core/src/op/not_equal.cpp diff --git a/ngraph/core/src/op/nv12_to_bgr.cpp b/src/core/src/op/nv12_to_bgr.cpp similarity index 100% rename from ngraph/core/src/op/nv12_to_bgr.cpp rename to src/core/src/op/nv12_to_bgr.cpp diff --git a/ngraph/core/src/op/nv12_to_rgb.cpp b/src/core/src/op/nv12_to_rgb.cpp similarity index 100% rename from ngraph/core/src/op/nv12_to_rgb.cpp rename to src/core/src/op/nv12_to_rgb.cpp diff --git a/ngraph/core/src/op/one_hot.cpp b/src/core/src/op/one_hot.cpp similarity index 100% rename from ngraph/core/src/op/one_hot.cpp rename to src/core/src/op/one_hot.cpp diff --git a/ngraph/core/src/op/op.cpp b/src/core/src/op/op.cpp similarity index 100% rename from ngraph/core/src/op/op.cpp rename to src/core/src/op/op.cpp diff --git a/ngraph/core/src/op/pad.cpp b/src/core/src/op/pad.cpp similarity index 100% rename from ngraph/core/src/op/pad.cpp rename to src/core/src/op/pad.cpp diff --git a/ngraph/core/src/op/parameter.cpp b/src/core/src/op/parameter.cpp similarity index 100% rename from ngraph/core/src/op/parameter.cpp rename to src/core/src/op/parameter.cpp diff --git a/ngraph/core/src/op/power.cpp b/src/core/src/op/power.cpp similarity index 100% rename from ngraph/core/src/op/power.cpp rename to src/core/src/op/power.cpp diff --git a/ngraph/core/src/op/prelu.cpp b/src/core/src/op/prelu.cpp similarity index 100% rename from ngraph/core/src/op/prelu.cpp rename to src/core/src/op/prelu.cpp diff --git a/src/core/src/op/prior_box.cpp b/src/core/src/op/prior_box.cpp new file mode 100644 index 00000000000..41efcd9739d --- /dev/null +++ b/src/core/src/op/prior_box.cpp @@ -0,0 +1,386 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "ngraph/op/prior_box.hpp" + +#include + +#include "itt.hpp" +#include "ngraph/op/constant.hpp" +#include "ngraph/runtime/host_tensor.hpp" +#include "ngraph/runtime/reference/prior_box.hpp" +#include "openvino/runtime/tensor.hpp" + +using namespace std; +using namespace ngraph; + +BWDCMP_RTTI_DEFINITION(op::v0::PriorBox); + +op::v0::PriorBox::PriorBox(const Output& layer_shape, + const Output& image_shape, + const PriorBox::Attributes& attrs) + : Op({layer_shape, image_shape}), + m_attrs(attrs) { + constructor_validate_and_infer_types(); +} + +void op::v0::PriorBox::validate_and_infer_types() { + NGRAPH_OP_SCOPE(v0_PriorBox_validate_and_infer_types); + // shape node should have integer data type. For now we only allow i64 + auto layer_shape_et = get_input_element_type(0); + NODE_VALIDATION_CHECK(this, + layer_shape_et.is_integral_number(), + "layer shape input must be an integral number, but is: ", + layer_shape_et); + + auto image_shape_et = get_input_element_type(1); + NODE_VALIDATION_CHECK(this, + image_shape_et.is_integral_number(), + "image shape input must be an integral number, but is: ", + image_shape_et); + + auto layer_shape_rank = get_input_partial_shape(0).rank(); + auto image_shape_rank = get_input_partial_shape(1).rank(); + NODE_VALIDATION_CHECK(this, + layer_shape_rank.compatible(image_shape_rank), + "layer shape input rank ", + layer_shape_rank, + " must match image shape input rank ", + image_shape_rank); + + set_input_is_relevant_to_shape(0); + + if (auto const_shape = get_constant_from_source(input_value(0))) { + NODE_VALIDATION_CHECK(this, + shape_size(const_shape->get_shape()) == 2, + "Layer shape must have rank 2", + const_shape->get_shape()); + + auto layer_shape = const_shape->get_shape_val(); + + set_output_type( + 0, + element::f32, + ov::Shape{2, 4 * layer_shape[0] * layer_shape[1] * static_cast(number_of_priors(m_attrs))}); + } else { + set_output_type(0, element::f32, ov::PartialShape{2, Dimension::dynamic()}); + } +} + +shared_ptr op::v0::PriorBox::clone_with_new_inputs(const OutputVector& new_args) const { + NGRAPH_OP_SCOPE(v0_PriorBox_clone_with_new_inputs); + check_new_args_count(this, new_args); + return make_shared(new_args.at(0), new_args.at(1), m_attrs); +} + +int64_t op::v0::PriorBox::number_of_priors(const PriorBox::Attributes& attrs) { + // Starting with 0 number of prior and then various conditions on attributes will contribute + // real number of prior boxes as PriorBox is a fat thing with several modes of + // operation that will be checked in order in the next statements. + int64_t num_priors = 0; + + // Total number of boxes around each point; depends on whether flipped boxes are included + // plus one box 1x1. + int64_t total_aspect_ratios = normalized_aspect_ratio(attrs.aspect_ratio, attrs.flip).size(); + + if (attrs.scale_all_sizes) + num_priors = total_aspect_ratios * attrs.min_size.size() + attrs.max_size.size(); + else + num_priors = total_aspect_ratios + attrs.min_size.size() - 1; + + if (!attrs.fixed_size.empty()) + num_priors = total_aspect_ratios * attrs.fixed_size.size(); + + for (auto density : attrs.density) { + auto rounded_density = static_cast(density); + auto density_2d = (rounded_density * rounded_density - 1); + if (!attrs.fixed_ratio.empty()) + num_priors += attrs.fixed_ratio.size() * density_2d; + else + num_priors += total_aspect_ratios * density_2d; + } + return num_priors; +} + +std::vector op::v0::PriorBox::normalized_aspect_ratio(const std::vector& aspect_ratio, bool flip) { + std::set unique_ratios; + for (auto ratio : aspect_ratio) { + unique_ratios.insert(std::round(ratio * 1e6) / 1e6); + if (flip) + unique_ratios.insert(std::round(1 / ratio * 1e6) / 1e6); + } + unique_ratios.insert(1); + return std::vector(unique_ratios.begin(), unique_ratios.end()); +} + +bool op::v0::PriorBox::visit_attributes(AttributeVisitor& visitor) { + NGRAPH_OP_SCOPE(v0_PriorBox_visit_attributes); + visitor.on_attribute("min_size", m_attrs.min_size); + visitor.on_attribute("max_size", m_attrs.max_size); + visitor.on_attribute("aspect_ratio", m_attrs.aspect_ratio); + visitor.on_attribute("density", m_attrs.density); + visitor.on_attribute("fixed_ratio", m_attrs.fixed_ratio); + visitor.on_attribute("fixed_size", m_attrs.fixed_size); + visitor.on_attribute("clip", m_attrs.clip); + visitor.on_attribute("flip", m_attrs.flip); + visitor.on_attribute("step", m_attrs.step); + visitor.on_attribute("offset", m_attrs.offset); + visitor.on_attribute("variance", m_attrs.variance); + visitor.on_attribute("scale_all_sizes", m_attrs.scale_all_sizes); + return true; +} + +namespace prior_box { +namespace { +template +bool evaluate(const HostTensorPtr& arg0, + const HostTensorPtr& arg1, + const HostTensorPtr& out, + op::v0::PriorBox::Attributes attrs) { + op::v8::PriorBox::Attributes attrs_v8; + attrs_v8.min_size = attrs.min_size; + attrs_v8.max_size = attrs.max_size; + attrs_v8.aspect_ratio = attrs.aspect_ratio; + attrs_v8.density = attrs.density; + attrs_v8.fixed_ratio = attrs.fixed_ratio; + attrs_v8.fixed_size = attrs.fixed_size; + attrs_v8.clip = attrs.clip; + attrs_v8.flip = attrs.flip; + attrs_v8.step = attrs.step; + attrs_v8.offset = attrs.offset; + attrs_v8.variance = attrs.variance; + attrs_v8.scale_all_sizes = attrs.scale_all_sizes; + runtime::reference::prior_box(arg0->get_data_ptr(), + arg1->get_data_ptr(), + out->get_data_ptr(), + out->get_shape(), + attrs_v8); + return true; +} + +bool evaluate_prior_box(const HostTensorPtr& arg0, + const HostTensorPtr& arg1, + const HostTensorPtr& out, + const op::v0::PriorBox::Attributes& attrs) { + bool rc = true; + switch (arg0->get_element_type()) { + NGRAPH_TYPE_CASE(evaluate_prior_box, i8, arg0, arg1, out, attrs); + NGRAPH_TYPE_CASE(evaluate_prior_box, i16, arg0, arg1, out, attrs); + NGRAPH_TYPE_CASE(evaluate_prior_box, i32, arg0, arg1, out, attrs); + NGRAPH_TYPE_CASE(evaluate_prior_box, i64, arg0, arg1, out, attrs); + NGRAPH_TYPE_CASE(evaluate_prior_box, u8, arg0, arg1, out, attrs); + NGRAPH_TYPE_CASE(evaluate_prior_box, u16, arg0, arg1, out, attrs); + NGRAPH_TYPE_CASE(evaluate_prior_box, u32, arg0, arg1, out, attrs); + NGRAPH_TYPE_CASE(evaluate_prior_box, u64, arg0, arg1, out, attrs); + default: + rc = false; + break; + } + return rc; +} +} // namespace +} // namespace prior_box + +bool op::v0::PriorBox::evaluate(const HostTensorVector& outputs, const HostTensorVector& inputs) const { + NGRAPH_OP_SCOPE(v0_PriorBox_evaluate); + return prior_box::evaluate_prior_box(inputs[0], inputs[1], outputs[0], get_attrs()); +} + +bool op::v0::PriorBox::has_evaluate() const { + NGRAPH_OP_SCOPE(v0_PriorBox_has_evaluate); + switch (get_input_element_type(0)) { + case ngraph::element::i8: + case ngraph::element::i16: + case ngraph::element::i32: + case ngraph::element::i64: + case ngraph::element::u8: + case ngraph::element::u16: + case ngraph::element::u32: + case ngraph::element::u64: + return true; + default: + break; + } + return false; +} + +// ------------------------------ V8 ------------------------------ + +BWDCMP_RTTI_DEFINITION(op::v8::PriorBox); + +op::v8::PriorBox::PriorBox(const Output& layer_shape, + const Output& image_shape, + const PriorBox::Attributes& attrs) + : Op({layer_shape, image_shape}), + m_attrs(attrs) { + constructor_validate_and_infer_types(); +} + +void op::v8::PriorBox::validate_and_infer_types() { + NGRAPH_OP_SCOPE(v8_PriorBox_validate_and_infer_types); + // shape node should have integer data type. For now we only allow i64 + auto layer_shape_et = get_input_element_type(0); + NODE_VALIDATION_CHECK(this, + layer_shape_et.is_integral_number(), + "layer shape input must be an integral number, but is: ", + layer_shape_et); + + auto image_shape_et = get_input_element_type(1); + NODE_VALIDATION_CHECK(this, + image_shape_et.is_integral_number(), + "image shape input must be an integral number, but is: ", + image_shape_et); + + auto layer_shape_rank = get_input_partial_shape(0).rank(); + auto image_shape_rank = get_input_partial_shape(1).rank(); + NODE_VALIDATION_CHECK(this, + layer_shape_rank.compatible(image_shape_rank), + "layer shape input rank ", + layer_shape_rank, + " must match image shape input rank ", + image_shape_rank); + + set_input_is_relevant_to_shape(0); + + if (auto const_shape = get_constant_from_source(input_value(0))) { + NODE_VALIDATION_CHECK(this, + shape_size(const_shape->get_shape()) == 2, + "Layer shape must have rank 2", + const_shape->get_shape()); + + auto layer_shape = const_shape->get_shape_val(); + + set_output_type( + 0, + element::f32, + ov::Shape{2, 4 * layer_shape[0] * layer_shape[1] * static_cast(number_of_priors(m_attrs))}); + } else { + set_output_type(0, element::f32, ov::PartialShape{2, Dimension::dynamic()}); + } +} + +shared_ptr op::v8::PriorBox::clone_with_new_inputs(const OutputVector& new_args) const { + NGRAPH_OP_SCOPE(v8_PriorBox_clone_with_new_inputs); + check_new_args_count(this, new_args); + return make_shared(new_args.at(0), new_args.at(1), m_attrs); +} + +int64_t op::v8::PriorBox::number_of_priors(const PriorBox::Attributes& attrs) { + // Starting with 0 number of prior and then various conditions on attributes will contribute + // real number of prior boxes as PriorBox is a fat thing with several modes of + // operation that will be checked in order in the next statements. + int64_t num_priors = 0; + + // Total number of boxes around each point; depends on whether flipped boxes are included + // plus one box 1x1. + int64_t total_aspect_ratios = normalized_aspect_ratio(attrs.aspect_ratio, attrs.flip).size(); + + if (attrs.scale_all_sizes) + num_priors = total_aspect_ratios * attrs.min_size.size() + attrs.max_size.size(); + else + num_priors = total_aspect_ratios + attrs.min_size.size() - 1; + + if (!attrs.fixed_size.empty()) + num_priors = total_aspect_ratios * attrs.fixed_size.size(); + + for (auto density : attrs.density) { + auto rounded_density = static_cast(density); + auto density_2d = (rounded_density * rounded_density - 1); + if (!attrs.fixed_ratio.empty()) + num_priors += attrs.fixed_ratio.size() * density_2d; + else + num_priors += total_aspect_ratios * density_2d; + } + return num_priors; +} + +std::vector op::v8::PriorBox::normalized_aspect_ratio(const std::vector& aspect_ratio, bool flip) { + std::set unique_ratios; + for (auto ratio : aspect_ratio) { + unique_ratios.insert(std::round(ratio * 1e6) / 1e6); + if (flip) + unique_ratios.insert(std::round(1 / ratio * 1e6) / 1e6); + } + unique_ratios.insert(1); + return std::vector(unique_ratios.begin(), unique_ratios.end()); +} + +bool op::v8::PriorBox::visit_attributes(AttributeVisitor& visitor) { + NGRAPH_OP_SCOPE(v8_PriorBox_visit_attributes); + visitor.on_attribute("min_size", m_attrs.min_size); + visitor.on_attribute("max_size", m_attrs.max_size); + visitor.on_attribute("aspect_ratio", m_attrs.aspect_ratio); + visitor.on_attribute("density", m_attrs.density); + visitor.on_attribute("fixed_ratio", m_attrs.fixed_ratio); + visitor.on_attribute("fixed_size", m_attrs.fixed_size); + visitor.on_attribute("clip", m_attrs.clip); + visitor.on_attribute("flip", m_attrs.flip); + visitor.on_attribute("step", m_attrs.step); + visitor.on_attribute("offset", m_attrs.offset); + visitor.on_attribute("variance", m_attrs.variance); + visitor.on_attribute("scale_all_sizes", m_attrs.scale_all_sizes); + visitor.on_attribute("min_max_aspect_ratios_order", m_attrs.min_max_aspect_ratios_order); + return true; +} + +namespace prior_box_v8 { +namespace { +template +bool evaluate(const HostTensorPtr& arg0, + const HostTensorPtr& arg1, + const HostTensorPtr& out, + op::v8::PriorBox::Attributes attrs) { + runtime::reference::prior_box(arg0->get_data_ptr(), + arg1->get_data_ptr(), + out->get_data_ptr(), + out->get_shape(), + attrs); + return true; +} + +bool evaluate_prior_box(const HostTensorPtr& arg0, + const HostTensorPtr& arg1, + const HostTensorPtr& out, + const op::v8::PriorBox::Attributes& attrs) { + bool rc = true; + switch (arg0->get_element_type()) { + NGRAPH_TYPE_CASE(evaluate_prior_box, i8, arg0, arg1, out, attrs); + NGRAPH_TYPE_CASE(evaluate_prior_box, i16, arg0, arg1, out, attrs); + NGRAPH_TYPE_CASE(evaluate_prior_box, i32, arg0, arg1, out, attrs); + NGRAPH_TYPE_CASE(evaluate_prior_box, i64, arg0, arg1, out, attrs); + NGRAPH_TYPE_CASE(evaluate_prior_box, u8, arg0, arg1, out, attrs); + NGRAPH_TYPE_CASE(evaluate_prior_box, u16, arg0, arg1, out, attrs); + NGRAPH_TYPE_CASE(evaluate_prior_box, u32, arg0, arg1, out, attrs); + NGRAPH_TYPE_CASE(evaluate_prior_box, u64, arg0, arg1, out, attrs); + default: + rc = false; + break; + } + return rc; +} +} // namespace +} // namespace prior_box_v8 + +bool op::v8::PriorBox::evaluate(const HostTensorVector& outputs, const HostTensorVector& inputs) const { + NGRAPH_OP_SCOPE(v8_PriorBox_evaluate); + return prior_box_v8::evaluate_prior_box(inputs[0], inputs[1], outputs[0], get_attrs()); +} + +bool op::v8::PriorBox::has_evaluate() const { + NGRAPH_OP_SCOPE(v8_PriorBox_has_evaluate); + switch (get_input_element_type(0)) { + case ngraph::element::i8: + case ngraph::element::i16: + case ngraph::element::i32: + case ngraph::element::i64: + case ngraph::element::u8: + case ngraph::element::u16: + case ngraph::element::u32: + case ngraph::element::u64: + return true; + default: + break; + } + return false; +} diff --git a/ngraph/core/src/op/prior_box_clustered.cpp b/src/core/src/op/prior_box_clustered.cpp similarity index 100% rename from ngraph/core/src/op/prior_box_clustered.cpp rename to src/core/src/op/prior_box_clustered.cpp diff --git a/ngraph/core/src/op/proposal.cpp b/src/core/src/op/proposal.cpp similarity index 100% rename from ngraph/core/src/op/proposal.cpp rename to src/core/src/op/proposal.cpp diff --git a/ngraph/core/src/op/psroi_pooling.cpp b/src/core/src/op/psroi_pooling.cpp similarity index 100% rename from ngraph/core/src/op/psroi_pooling.cpp rename to src/core/src/op/psroi_pooling.cpp diff --git a/ngraph/core/src/op/random_uniform.cpp b/src/core/src/op/random_uniform.cpp similarity index 100% rename from ngraph/core/src/op/random_uniform.cpp rename to src/core/src/op/random_uniform.cpp diff --git a/ngraph/core/src/op/range.cpp b/src/core/src/op/range.cpp similarity index 100% rename from ngraph/core/src/op/range.cpp rename to src/core/src/op/range.cpp diff --git a/ngraph/core/src/op/read_value.cpp b/src/core/src/op/read_value.cpp similarity index 100% rename from ngraph/core/src/op/read_value.cpp rename to src/core/src/op/read_value.cpp diff --git a/ngraph/core/src/op/reduce_l1.cpp b/src/core/src/op/reduce_l1.cpp similarity index 100% rename from ngraph/core/src/op/reduce_l1.cpp rename to src/core/src/op/reduce_l1.cpp diff --git a/ngraph/core/src/op/reduce_l2.cpp b/src/core/src/op/reduce_l2.cpp similarity index 100% rename from ngraph/core/src/op/reduce_l2.cpp rename to src/core/src/op/reduce_l2.cpp diff --git a/ngraph/core/src/op/reduce_logical_and.cpp b/src/core/src/op/reduce_logical_and.cpp similarity index 100% rename from ngraph/core/src/op/reduce_logical_and.cpp rename to src/core/src/op/reduce_logical_and.cpp diff --git a/ngraph/core/src/op/reduce_logical_or.cpp b/src/core/src/op/reduce_logical_or.cpp similarity index 100% rename from ngraph/core/src/op/reduce_logical_or.cpp rename to src/core/src/op/reduce_logical_or.cpp diff --git a/ngraph/core/src/op/reduce_max.cpp b/src/core/src/op/reduce_max.cpp similarity index 100% rename from ngraph/core/src/op/reduce_max.cpp rename to src/core/src/op/reduce_max.cpp diff --git a/ngraph/core/src/op/reduce_mean.cpp b/src/core/src/op/reduce_mean.cpp similarity index 100% rename from ngraph/core/src/op/reduce_mean.cpp rename to src/core/src/op/reduce_mean.cpp diff --git a/ngraph/core/src/op/reduce_min.cpp b/src/core/src/op/reduce_min.cpp similarity index 100% rename from ngraph/core/src/op/reduce_min.cpp rename to src/core/src/op/reduce_min.cpp diff --git a/ngraph/core/src/op/reduce_prod.cpp b/src/core/src/op/reduce_prod.cpp similarity index 100% rename from ngraph/core/src/op/reduce_prod.cpp rename to src/core/src/op/reduce_prod.cpp diff --git a/ngraph/core/src/op/reduce_sum.cpp b/src/core/src/op/reduce_sum.cpp similarity index 100% rename from ngraph/core/src/op/reduce_sum.cpp rename to src/core/src/op/reduce_sum.cpp diff --git a/ngraph/core/src/op/region_yolo.cpp b/src/core/src/op/region_yolo.cpp similarity index 100% rename from ngraph/core/src/op/region_yolo.cpp rename to src/core/src/op/region_yolo.cpp diff --git a/ngraph/core/src/op/relu.cpp b/src/core/src/op/relu.cpp similarity index 96% rename from ngraph/core/src/op/relu.cpp rename to src/core/src/op/relu.cpp index 097a4713cca..0aefc0b8a21 100644 --- a/ngraph/core/src/op/relu.cpp +++ b/src/core/src/op/relu.cpp @@ -41,7 +41,6 @@ bool evaluate_relu(const HostTensorPtr& arg0, const HostTensorPtr& out) { out->set_unary(arg0); switch (arg0->get_element_type()) { - NGRAPH_TYPE_CASE(evaluate_relu, boolean, arg0, out, count); NGRAPH_TYPE_CASE(evaluate_relu, i32, arg0, out, count); NGRAPH_TYPE_CASE(evaluate_relu, i64, arg0, out, count); NGRAPH_TYPE_CASE(evaluate_relu, u32, arg0, out, count); @@ -66,7 +65,6 @@ bool op::Relu::evaluate(const HostTensorVector& outputs, const HostTensorVector& bool op::Relu::has_evaluate() const { NGRAPH_OP_SCOPE(v0_Relu_has_evaluate); switch (get_input_element_type(0)) { - case ngraph::element::boolean: case ngraph::element::i32: case ngraph::element::i64: case ngraph::element::u32: diff --git a/ngraph/core/src/op/reorg_yolo.cpp b/src/core/src/op/reorg_yolo.cpp similarity index 94% rename from ngraph/core/src/op/reorg_yolo.cpp rename to src/core/src/op/reorg_yolo.cpp index 68788d72ded..56739f3820f 100644 --- a/ngraph/core/src/op/reorg_yolo.cpp +++ b/src/core/src/op/reorg_yolo.cpp @@ -50,7 +50,8 @@ void op::ReorgYolo::validate_and_infer_types() { } set_output_type(0, input_et, output_shape); } else { - set_output_type(0, input_et, ov::PartialShape::dynamic()); + auto input_shape = get_input_partial_shape(0); + set_output_type(0, input_et, ov::PartialShape::dynamic(input_shape.rank())); } } diff --git a/ngraph/core/src/op/reshape.cpp b/src/core/src/op/reshape.cpp similarity index 100% rename from ngraph/core/src/op/reshape.cpp rename to src/core/src/op/reshape.cpp diff --git a/ngraph/core/src/op/result.cpp b/src/core/src/op/result.cpp similarity index 100% rename from ngraph/core/src/op/result.cpp rename to src/core/src/op/result.cpp diff --git a/ngraph/core/src/op/reverse.cpp b/src/core/src/op/reverse.cpp similarity index 98% rename from ngraph/core/src/op/reverse.cpp rename to src/core/src/op/reverse.cpp index ef4a97a571b..b3778e4c049 100644 --- a/ngraph/core/src/op/reverse.cpp +++ b/src/core/src/op/reverse.cpp @@ -203,7 +203,7 @@ std::ostream& ov::operator<<(std::ostream& s, const op::v1::Reverse::Mode& type) namespace ov { template <> -EnumNames& EnumNames::get() { +NGRAPH_API EnumNames& EnumNames::get() { static auto enum_names = EnumNames( "op::v1::Reverse::Mode", {{"index", ngraph::op::v1::Reverse::Mode::INDEX}, {"mask", ngraph::op::v1::Reverse::Mode::MASK}}); diff --git a/ngraph/core/src/op/reverse_sequence.cpp b/src/core/src/op/reverse_sequence.cpp similarity index 100% rename from ngraph/core/src/op/reverse_sequence.cpp rename to src/core/src/op/reverse_sequence.cpp diff --git a/ngraph/core/src/op/rnn_cell.cpp b/src/core/src/op/rnn_cell.cpp similarity index 100% rename from ngraph/core/src/op/rnn_cell.cpp rename to src/core/src/op/rnn_cell.cpp diff --git a/ngraph/core/src/op/rnn_sequence.cpp b/src/core/src/op/rnn_sequence.cpp similarity index 100% rename from ngraph/core/src/op/rnn_sequence.cpp rename to src/core/src/op/rnn_sequence.cpp diff --git a/ngraph/core/src/op/roi_align.cpp b/src/core/src/op/roi_align.cpp similarity index 100% rename from ngraph/core/src/op/roi_align.cpp rename to src/core/src/op/roi_align.cpp diff --git a/ngraph/core/src/op/roi_pooling.cpp b/src/core/src/op/roi_pooling.cpp similarity index 100% rename from ngraph/core/src/op/roi_pooling.cpp rename to src/core/src/op/roi_pooling.cpp diff --git a/ngraph/core/src/op/roll.cpp b/src/core/src/op/roll.cpp similarity index 100% rename from ngraph/core/src/op/roll.cpp rename to src/core/src/op/roll.cpp diff --git a/ngraph/core/src/op/round.cpp b/src/core/src/op/round.cpp similarity index 97% rename from ngraph/core/src/op/round.cpp rename to src/core/src/op/round.cpp index bc15db2efef..4dbe2e97d08 100644 --- a/ngraph/core/src/op/round.cpp +++ b/src/core/src/op/round.cpp @@ -121,7 +121,7 @@ std::ostream& ov::operator<<(std::ostream& s, const op::v5::Round::RoundMode& ty namespace ov { template <> -EnumNames& EnumNames::get() { +NGRAPH_API EnumNames& EnumNames::get() { static auto enum_names = EnumNames( "op::v5::Round::RoundMode", {{"half_to_even", ngraph::op::v5::Round::RoundMode::HALF_TO_EVEN}, diff --git a/ngraph/core/src/op/scatter_elements_update.cpp b/src/core/src/op/scatter_elements_update.cpp similarity index 100% rename from ngraph/core/src/op/scatter_elements_update.cpp rename to src/core/src/op/scatter_elements_update.cpp diff --git a/ngraph/core/src/op/scatter_nd_update.cpp b/src/core/src/op/scatter_nd_update.cpp similarity index 100% rename from ngraph/core/src/op/scatter_nd_update.cpp rename to src/core/src/op/scatter_nd_update.cpp diff --git a/ngraph/core/src/op/scatter_update.cpp b/src/core/src/op/scatter_update.cpp similarity index 100% rename from ngraph/core/src/op/scatter_update.cpp rename to src/core/src/op/scatter_update.cpp diff --git a/ngraph/core/src/op/select.cpp b/src/core/src/op/select.cpp similarity index 100% rename from ngraph/core/src/op/select.cpp rename to src/core/src/op/select.cpp diff --git a/ngraph/core/src/op/selu.cpp b/src/core/src/op/selu.cpp similarity index 100% rename from ngraph/core/src/op/selu.cpp rename to src/core/src/op/selu.cpp diff --git a/ngraph/core/src/op/shape_of.cpp b/src/core/src/op/shape_of.cpp similarity index 100% rename from ngraph/core/src/op/shape_of.cpp rename to src/core/src/op/shape_of.cpp diff --git a/ngraph/core/src/op/shuffle_channels.cpp b/src/core/src/op/shuffle_channels.cpp similarity index 100% rename from ngraph/core/src/op/shuffle_channels.cpp rename to src/core/src/op/shuffle_channels.cpp diff --git a/ngraph/core/src/op/sigmoid.cpp b/src/core/src/op/sigmoid.cpp similarity index 100% rename from ngraph/core/src/op/sigmoid.cpp rename to src/core/src/op/sigmoid.cpp diff --git a/ngraph/core/src/op/sign.cpp b/src/core/src/op/sign.cpp similarity index 98% rename from ngraph/core/src/op/sign.cpp rename to src/core/src/op/sign.cpp index 7ac52000eed..1a4a322b65d 100644 --- a/ngraph/core/src/op/sign.cpp +++ b/src/core/src/op/sign.cpp @@ -67,7 +67,6 @@ bool op::Sign::evaluate(const HostTensorVector& outputs, const HostTensorVector& bool op::Sign::has_evaluate() const { NGRAPH_OP_SCOPE(v0_Sign_has_evaluate); switch (get_input_element_type(0)) { - case ngraph::element::boolean: case ngraph::element::i32: case ngraph::element::i64: case ngraph::element::u32: diff --git a/ngraph/core/src/op/sin.cpp b/src/core/src/op/sin.cpp similarity index 100% rename from ngraph/core/src/op/sin.cpp rename to src/core/src/op/sin.cpp diff --git a/ngraph/core/src/op/sinh.cpp b/src/core/src/op/sinh.cpp similarity index 100% rename from ngraph/core/src/op/sinh.cpp rename to src/core/src/op/sinh.cpp diff --git a/ngraph/core/src/op/sink.cpp b/src/core/src/op/sink.cpp similarity index 100% rename from ngraph/core/src/op/sink.cpp rename to src/core/src/op/sink.cpp diff --git a/ngraph/core/src/op/slice.cpp b/src/core/src/op/slice.cpp similarity index 100% rename from ngraph/core/src/op/slice.cpp rename to src/core/src/op/slice.cpp diff --git a/ngraph/core/src/op/softmax.cpp b/src/core/src/op/softmax.cpp similarity index 100% rename from ngraph/core/src/op/softmax.cpp rename to src/core/src/op/softmax.cpp diff --git a/ngraph/core/src/op/softplus.cpp b/src/core/src/op/softplus.cpp similarity index 100% rename from ngraph/core/src/op/softplus.cpp rename to src/core/src/op/softplus.cpp diff --git a/ngraph/core/src/op/space_to_batch.cpp b/src/core/src/op/space_to_batch.cpp similarity index 100% rename from ngraph/core/src/op/space_to_batch.cpp rename to src/core/src/op/space_to_batch.cpp diff --git a/ngraph/core/src/op/space_to_depth.cpp b/src/core/src/op/space_to_depth.cpp similarity index 100% rename from ngraph/core/src/op/space_to_depth.cpp rename to src/core/src/op/space_to_depth.cpp diff --git a/ngraph/core/src/op/split.cpp b/src/core/src/op/split.cpp similarity index 100% rename from ngraph/core/src/op/split.cpp rename to src/core/src/op/split.cpp diff --git a/ngraph/core/src/op/sqrt.cpp b/src/core/src/op/sqrt.cpp similarity index 100% rename from ngraph/core/src/op/sqrt.cpp rename to src/core/src/op/sqrt.cpp diff --git a/ngraph/core/src/op/squared_difference.cpp b/src/core/src/op/squared_difference.cpp similarity index 100% rename from ngraph/core/src/op/squared_difference.cpp rename to src/core/src/op/squared_difference.cpp diff --git a/ngraph/core/src/op/squeeze.cpp b/src/core/src/op/squeeze.cpp similarity index 100% rename from ngraph/core/src/op/squeeze.cpp rename to src/core/src/op/squeeze.cpp diff --git a/ngraph/core/src/op/strided_slice.cpp b/src/core/src/op/strided_slice.cpp similarity index 100% rename from ngraph/core/src/op/strided_slice.cpp rename to src/core/src/op/strided_slice.cpp diff --git a/ngraph/core/src/op/subtract.cpp b/src/core/src/op/subtract.cpp similarity index 100% rename from ngraph/core/src/op/subtract.cpp rename to src/core/src/op/subtract.cpp diff --git a/ngraph/core/src/op/swish.cpp b/src/core/src/op/swish.cpp similarity index 100% rename from ngraph/core/src/op/swish.cpp rename to src/core/src/op/swish.cpp diff --git a/ngraph/core/src/op/tan.cpp b/src/core/src/op/tan.cpp similarity index 100% rename from ngraph/core/src/op/tan.cpp rename to src/core/src/op/tan.cpp diff --git a/ngraph/core/src/op/tanh.cpp b/src/core/src/op/tanh.cpp similarity index 100% rename from ngraph/core/src/op/tanh.cpp rename to src/core/src/op/tanh.cpp diff --git a/ngraph/core/src/op/tensor_iterator.cpp b/src/core/src/op/tensor_iterator.cpp similarity index 100% rename from ngraph/core/src/op/tensor_iterator.cpp rename to src/core/src/op/tensor_iterator.cpp diff --git a/ngraph/core/src/op/tile.cpp b/src/core/src/op/tile.cpp similarity index 90% rename from ngraph/core/src/op/tile.cpp rename to src/core/src/op/tile.cpp index 1f6d95fd650..138f4be1f9b 100644 --- a/ngraph/core/src/op/tile.cpp +++ b/src/core/src/op/tile.cpp @@ -58,7 +58,15 @@ void op::v0::Tile::validate_and_infer_types() { output_shape[i] = data_shape[i] * repeats_value[i]; set_output_type(0, arg_et, output_shape); } else { - set_output_type(0, arg_et, ov::PartialShape::dynamic()); + Rank outRank = Rank::dynamic(); + if (arg_shape.rank().is_static() && repeats_shape.is_static()) { + std::vector data_shape(arg_shape); + auto data_rank = data_shape.size(); + auto repeats_rank = repeats_value.size(); + auto output_rank = std::max(data_rank, repeats_rank); + outRank = Rank(output_rank); + } + set_output_type(0, arg_et, ov::PartialShape::dynamic(outRank)); } set_input_is_relevant_to_shape(0); diff --git a/ngraph/core/src/op/topk.cpp b/src/core/src/op/topk.cpp similarity index 100% rename from ngraph/core/src/op/topk.cpp rename to src/core/src/op/topk.cpp diff --git a/ngraph/core/src/op/transpose.cpp b/src/core/src/op/transpose.cpp similarity index 100% rename from ngraph/core/src/op/transpose.cpp rename to src/core/src/op/transpose.cpp diff --git a/ngraph/core/src/op/type_relaxed.cpp b/src/core/src/op/type_relaxed.cpp similarity index 100% rename from ngraph/core/src/op/type_relaxed.cpp rename to src/core/src/op/type_relaxed.cpp diff --git a/ngraph/core/src/op/unsqueeze.cpp b/src/core/src/op/unsqueeze.cpp similarity index 100% rename from ngraph/core/src/op/unsqueeze.cpp rename to src/core/src/op/unsqueeze.cpp diff --git a/ngraph/core/src/op/util/activation_functions.cpp b/src/core/src/op/util/activation_functions.cpp similarity index 100% rename from ngraph/core/src/op/util/activation_functions.cpp rename to src/core/src/op/util/activation_functions.cpp diff --git a/ngraph/core/src/op/util/arithmetic_reduction.cpp b/src/core/src/op/util/arithmetic_reduction.cpp similarity index 100% rename from ngraph/core/src/op/util/arithmetic_reduction.cpp rename to src/core/src/op/util/arithmetic_reduction.cpp diff --git a/ngraph/core/src/op/util/arithmetic_reductions_keep_dims.cpp b/src/core/src/op/util/arithmetic_reductions_keep_dims.cpp similarity index 100% rename from ngraph/core/src/op/util/arithmetic_reductions_keep_dims.cpp rename to src/core/src/op/util/arithmetic_reductions_keep_dims.cpp diff --git a/ngraph/core/src/op/util/assign_base.cpp b/src/core/src/op/util/assign_base.cpp similarity index 100% rename from ngraph/core/src/op/util/assign_base.cpp rename to src/core/src/op/util/assign_base.cpp diff --git a/ngraph/core/src/op/util/attr_types.cpp b/src/core/src/op/util/attr_types.cpp similarity index 100% rename from ngraph/core/src/op/util/attr_types.cpp rename to src/core/src/op/util/attr_types.cpp diff --git a/ngraph/core/src/op/util/binary_elementwise_arithmetic.cpp b/src/core/src/op/util/binary_elementwise_arithmetic.cpp similarity index 100% rename from ngraph/core/src/op/util/binary_elementwise_arithmetic.cpp rename to src/core/src/op/util/binary_elementwise_arithmetic.cpp diff --git a/ngraph/core/src/op/util/binary_elementwise_comparison.cpp b/src/core/src/op/util/binary_elementwise_comparison.cpp similarity index 100% rename from ngraph/core/src/op/util/binary_elementwise_comparison.cpp rename to src/core/src/op/util/binary_elementwise_comparison.cpp diff --git a/ngraph/core/src/op/util/binary_elementwise_logical.cpp b/src/core/src/op/util/binary_elementwise_logical.cpp similarity index 100% rename from ngraph/core/src/op/util/binary_elementwise_logical.cpp rename to src/core/src/op/util/binary_elementwise_logical.cpp diff --git a/ngraph/core/src/op/util/broadcast_base.cpp b/src/core/src/op/util/broadcast_base.cpp similarity index 100% rename from ngraph/core/src/op/util/broadcast_base.cpp rename to src/core/src/op/util/broadcast_base.cpp diff --git a/ngraph/core/src/op/util/convert_color_i420_base.cpp b/src/core/src/op/util/convert_color_i420_base.cpp similarity index 100% rename from ngraph/core/src/op/util/convert_color_i420_base.cpp rename to src/core/src/op/util/convert_color_i420_base.cpp diff --git a/ngraph/core/src/op/util/convert_color_nv12_base.cpp b/src/core/src/op/util/convert_color_nv12_base.cpp similarity index 100% rename from ngraph/core/src/op/util/convert_color_nv12_base.cpp rename to src/core/src/op/util/convert_color_nv12_base.cpp diff --git a/ngraph/core/src/op/util/deformable_convolution_base.cpp b/src/core/src/op/util/deformable_convolution_base.cpp similarity index 100% rename from ngraph/core/src/op/util/deformable_convolution_base.cpp rename to src/core/src/op/util/deformable_convolution_base.cpp diff --git a/ngraph/core/src/op/util/elementwise_args.cpp b/src/core/src/op/util/elementwise_args.cpp similarity index 100% rename from ngraph/core/src/op/util/elementwise_args.cpp rename to src/core/src/op/util/elementwise_args.cpp diff --git a/ngraph/core/src/op/util/embeddingbag_offsets_base.cpp b/src/core/src/op/util/embeddingbag_offsets_base.cpp similarity index 100% rename from ngraph/core/src/op/util/embeddingbag_offsets_base.cpp rename to src/core/src/op/util/embeddingbag_offsets_base.cpp diff --git a/ngraph/core/src/op/util/embeddingbag_packed_base.cpp b/src/core/src/op/util/embeddingbag_packed_base.cpp similarity index 100% rename from ngraph/core/src/op/util/embeddingbag_packed_base.cpp rename to src/core/src/op/util/embeddingbag_packed_base.cpp diff --git a/ngraph/core/src/op/util/evaluate_helpers.cpp b/src/core/src/op/util/evaluate_helpers.cpp similarity index 100% rename from ngraph/core/src/op/util/evaluate_helpers.cpp rename to src/core/src/op/util/evaluate_helpers.cpp diff --git a/ngraph/core/src/op/util/evaluation_context.cpp b/src/core/src/op/util/evaluation_context.cpp similarity index 100% rename from ngraph/core/src/op/util/evaluation_context.cpp rename to src/core/src/op/util/evaluation_context.cpp diff --git a/ngraph/core/src/op/util/fft_base.cpp b/src/core/src/op/util/fft_base.cpp similarity index 100% rename from ngraph/core/src/op/util/fft_base.cpp rename to src/core/src/op/util/fft_base.cpp diff --git a/ngraph/core/src/op/util/framework_node.cpp b/src/core/src/op/util/framework_node.cpp similarity index 100% rename from ngraph/core/src/op/util/framework_node.cpp rename to src/core/src/op/util/framework_node.cpp diff --git a/ngraph/core/src/op/util/gather_base.cpp b/src/core/src/op/util/gather_base.cpp similarity index 100% rename from ngraph/core/src/op/util/gather_base.cpp rename to src/core/src/op/util/gather_base.cpp diff --git a/ngraph/core/src/op/util/gather_nd_base.cpp b/src/core/src/op/util/gather_nd_base.cpp similarity index 100% rename from ngraph/core/src/op/util/gather_nd_base.cpp rename to src/core/src/op/util/gather_nd_base.cpp diff --git a/ngraph/core/src/op/util/index_reduction.cpp b/src/core/src/op/util/index_reduction.cpp similarity index 100% rename from ngraph/core/src/op/util/index_reduction.cpp rename to src/core/src/op/util/index_reduction.cpp diff --git a/ngraph/core/src/op/util/logical_reduction.cpp b/src/core/src/op/util/logical_reduction.cpp similarity index 100% rename from ngraph/core/src/op/util/logical_reduction.cpp rename to src/core/src/op/util/logical_reduction.cpp diff --git a/ngraph/core/src/op/util/logical_reduction_keep_dims.cpp b/src/core/src/op/util/logical_reduction_keep_dims.cpp similarity index 100% rename from ngraph/core/src/op/util/logical_reduction_keep_dims.cpp rename to src/core/src/op/util/logical_reduction_keep_dims.cpp diff --git a/ngraph/core/src/op/util/max_pool_base.cpp b/src/core/src/op/util/max_pool_base.cpp similarity index 100% rename from ngraph/core/src/op/util/max_pool_base.cpp rename to src/core/src/op/util/max_pool_base.cpp diff --git a/ngraph/core/src/op/util/multi_subgraph_base.cpp b/src/core/src/op/util/multi_subgraph_base.cpp similarity index 100% rename from ngraph/core/src/op/util/multi_subgraph_base.cpp rename to src/core/src/op/util/multi_subgraph_base.cpp diff --git a/ngraph/core/src/op/util/nms_base.cpp b/src/core/src/op/util/nms_base.cpp similarity index 100% rename from ngraph/core/src/op/util/nms_base.cpp rename to src/core/src/op/util/nms_base.cpp diff --git a/ngraph/core/src/op/util/op_types.cpp b/src/core/src/op/util/op_types.cpp similarity index 100% rename from ngraph/core/src/op/util/op_types.cpp rename to src/core/src/op/util/op_types.cpp diff --git a/ngraph/core/src/op/util/precision_sensitive_attribute.cpp b/src/core/src/op/util/precision_sensitive_attribute.cpp similarity index 100% rename from ngraph/core/src/op/util/precision_sensitive_attribute.cpp rename to src/core/src/op/util/precision_sensitive_attribute.cpp diff --git a/ngraph/core/src/op/util/read_value_base.cpp b/src/core/src/op/util/read_value_base.cpp similarity index 100% rename from ngraph/core/src/op/util/read_value_base.cpp rename to src/core/src/op/util/read_value_base.cpp diff --git a/ngraph/core/src/op/util/recurrent_sequence.cpp b/src/core/src/op/util/recurrent_sequence.cpp similarity index 100% rename from ngraph/core/src/op/util/recurrent_sequence.cpp rename to src/core/src/op/util/recurrent_sequence.cpp diff --git a/ngraph/core/src/op/util/reduction_base.cpp b/src/core/src/op/util/reduction_base.cpp similarity index 100% rename from ngraph/core/src/op/util/reduction_base.cpp rename to src/core/src/op/util/reduction_base.cpp diff --git a/ngraph/core/src/op/util/rnn_cell_base.cpp b/src/core/src/op/util/rnn_cell_base.cpp similarity index 100% rename from ngraph/core/src/op/util/rnn_cell_base.cpp rename to src/core/src/op/util/rnn_cell_base.cpp diff --git a/ngraph/core/src/op/util/scatter_base.cpp b/src/core/src/op/util/scatter_base.cpp similarity index 100% rename from ngraph/core/src/op/util/scatter_base.cpp rename to src/core/src/op/util/scatter_base.cpp diff --git a/ngraph/core/src/op/util/scatter_nd_base.cpp b/src/core/src/op/util/scatter_nd_base.cpp similarity index 100% rename from ngraph/core/src/op/util/scatter_nd_base.cpp rename to src/core/src/op/util/scatter_nd_base.cpp diff --git a/ngraph/core/src/op/util/slice_plan.cpp b/src/core/src/op/util/slice_plan.cpp similarity index 100% rename from ngraph/core/src/op/util/slice_plan.cpp rename to src/core/src/op/util/slice_plan.cpp diff --git a/ngraph/core/src/op/util/sub_graph_base.cpp b/src/core/src/op/util/sub_graph_base.cpp similarity index 100% rename from ngraph/core/src/op/util/sub_graph_base.cpp rename to src/core/src/op/util/sub_graph_base.cpp diff --git a/ngraph/core/src/op/util/unary_elementwise_arithmetic.cpp b/src/core/src/op/util/unary_elementwise_arithmetic.cpp similarity index 100% rename from ngraph/core/src/op/util/unary_elementwise_arithmetic.cpp rename to src/core/src/op/util/unary_elementwise_arithmetic.cpp diff --git a/ngraph/core/src/op/util/variable.cpp b/src/core/src/op/util/variable.cpp similarity index 100% rename from ngraph/core/src/op/util/variable.cpp rename to src/core/src/op/util/variable.cpp diff --git a/ngraph/core/src/op/variadic_split.cpp b/src/core/src/op/variadic_split.cpp similarity index 100% rename from ngraph/core/src/op/variadic_split.cpp rename to src/core/src/op/variadic_split.cpp diff --git a/ngraph/core/src/op/xor.cpp b/src/core/src/op/xor.cpp similarity index 100% rename from ngraph/core/src/op/xor.cpp rename to src/core/src/op/xor.cpp diff --git a/ngraph/core/src/opsets/opset.cpp b/src/core/src/opsets/opset.cpp similarity index 100% rename from ngraph/core/src/opsets/opset.cpp rename to src/core/src/opsets/opset.cpp diff --git a/ngraph/core/src/partial_shape.cpp b/src/core/src/partial_shape.cpp similarity index 100% rename from ngraph/core/src/partial_shape.cpp rename to src/core/src/partial_shape.cpp diff --git a/ngraph/core/src/pass/constant_folding.cpp b/src/core/src/pass/constant_folding.cpp similarity index 100% rename from ngraph/core/src/pass/constant_folding.cpp rename to src/core/src/pass/constant_folding.cpp diff --git a/ngraph/core/src/pass/convert_fp32_to_fp16.cpp b/src/core/src/pass/convert_fp32_to_fp16.cpp similarity index 100% rename from ngraph/core/src/pass/convert_fp32_to_fp16.cpp rename to src/core/src/pass/convert_fp32_to_fp16.cpp diff --git a/ngraph/core/src/pass/convert_precision.cpp b/src/core/src/pass/convert_precision.cpp similarity index 96% rename from ngraph/core/src/pass/convert_precision.cpp rename to src/core/src/pass/convert_precision.cpp index b11ee9fe029..da987a2c9b1 100644 --- a/ngraph/core/src/pass/convert_precision.cpp +++ b/src/core/src/pass/convert_precision.cpp @@ -30,6 +30,8 @@ bool fuse_type_to_convert(const std::shared_ptr& node, ngraph::ele bool fuse_type_to_nms3(const std::shared_ptr& node, ngraph::element::Type to, size_t idx); bool fuse_type_to_nms4(const std::shared_ptr& node, ngraph::element::Type to, size_t idx); bool fuse_type_to_nms5(const std::shared_ptr& node, ngraph::element::Type to, size_t idx); +bool fuse_type_to_matrix_nms(const std::shared_ptr& node, ngraph::element::Type to, size_t idx); +bool fuse_type_to_multiclass_nms(const std::shared_ptr& node, ngraph::element::Type to, size_t idx); bool fuse_type_to_topk(const std::shared_ptr& node, ngraph::element::Type to, size_t idx); bool fuse_type_to_maxpool(const std::shared_ptr& node, ngraph::element::Type to, size_t idx); bool fuse_type_to_nonzero(const std::shared_ptr& node, ngraph::element::Type to, size_t idx); @@ -253,6 +255,8 @@ bool ngraph::pass::ConvertPrecision::run_on_function(std::shared_ptr& node, ngraph::elemen return true; } +bool fuse_type_to_matrix_nms(const std::shared_ptr& node, ngraph::element::Type to, size_t idx) { + auto nms = ov::as_type_ptr(node); + if (!nms) { + return false; + } + + if ((idx == 1 || idx == 2) && (to == element::i32 || to == element::i64)) { + nms->set_output_type(to); + return true; + } + + return false; +} + +bool fuse_type_to_multiclass_nms(const std::shared_ptr& node, ngraph::element::Type to, size_t idx) { + auto nms = ov::as_type_ptr(node); + if (!nms) { + return false; + } + + if ((idx == 1 || idx == 2) && (to == element::i32 || to == element::i64)) { + nms->set_output_type(to); + return true; + } + + return false; +} + bool fuse_type_to_topk(const std::shared_ptr& node, ngraph::element::Type to, size_t idx) { if (auto topk = ov::as_type_ptr(node)) { if (idx == 1 && (to == element::i32 || to == element::i64)) { diff --git a/ngraph/core/src/pass/graph_rewrite.cpp b/src/core/src/pass/graph_rewrite.cpp similarity index 100% rename from ngraph/core/src/pass/graph_rewrite.cpp rename to src/core/src/pass/graph_rewrite.cpp diff --git a/ngraph/core/src/pass/init_node_info.cpp b/src/core/src/pass/init_node_info.cpp similarity index 96% rename from ngraph/core/src/pass/init_node_info.cpp rename to src/core/src/pass/init_node_info.cpp index 89fcb9cf52e..a40837fbd6d 100644 --- a/ngraph/core/src/pass/init_node_info.cpp +++ b/src/core/src/pass/init_node_info.cpp @@ -41,7 +41,8 @@ bool ngraph::pass::InitNodeInfo::run_on_function(std::shared_ptrget_type_info())) continue; - if (auto init_attr = attr->init(node)) { + auto init_attr = attr->init(node); + if (!init_attr.empty()) { rtInfo[attr->get_type_info()] = init_attr; } } diff --git a/ngraph/core/src/pass/low_latency.cpp b/src/core/src/pass/low_latency.cpp similarity index 100% rename from ngraph/core/src/pass/low_latency.cpp rename to src/core/src/pass/low_latency.cpp diff --git a/ngraph/core/src/pass/make_stateful.cpp b/src/core/src/pass/make_stateful.cpp similarity index 100% rename from ngraph/core/src/pass/make_stateful.cpp rename to src/core/src/pass/make_stateful.cpp diff --git a/ngraph/core/src/pass/manager.cpp b/src/core/src/pass/manager.cpp similarity index 100% rename from ngraph/core/src/pass/manager.cpp rename to src/core/src/pass/manager.cpp diff --git a/ngraph/core/src/pass/pass.cpp b/src/core/src/pass/pass.cpp similarity index 100% rename from ngraph/core/src/pass/pass.cpp rename to src/core/src/pass/pass.cpp diff --git a/ngraph/core/src/pass/pass_config.cpp b/src/core/src/pass/pass_config.cpp similarity index 100% rename from ngraph/core/src/pass/pass_config.cpp rename to src/core/src/pass/pass_config.cpp diff --git a/ngraph/core/src/pass/perf_counters.cpp b/src/core/src/pass/perf_counters.cpp similarity index 100% rename from ngraph/core/src/pass/perf_counters.cpp rename to src/core/src/pass/perf_counters.cpp diff --git a/ngraph/core/src/pass/perf_counters.hpp b/src/core/src/pass/perf_counters.hpp similarity index 100% rename from ngraph/core/src/pass/perf_counters.hpp rename to src/core/src/pass/perf_counters.hpp diff --git a/ngraph/core/src/pass/rt_info/fused_names_attribute.cpp b/src/core/src/pass/rt_info/fused_names_attribute.cpp similarity index 92% rename from ngraph/core/src/pass/rt_info/fused_names_attribute.cpp rename to src/core/src/pass/rt_info/fused_names_attribute.cpp index e3315e9d817..8a25cec593f 100644 --- a/ngraph/core/src/pass/rt_info/fused_names_attribute.cpp +++ b/src/core/src/pass/rt_info/fused_names_attribute.cpp @@ -63,7 +63,7 @@ std::vector ngraph::getFusedNamesVector(const std::shared_ptr; -std::shared_ptr VariantWrapper::merge(const ngraph::NodeVector& nodes) { +Any VariantWrapper::merge(const ngraph::NodeVector& nodes) { FusedNames mergedNames; for (auto& node : nodes) { const auto& rtInfo = node->get_rt_info(); @@ -79,11 +79,11 @@ std::shared_ptr VariantWrapper::merge(const ngraph: return std::make_shared>(mergedNames); } -std::shared_ptr VariantWrapper::init(const std::shared_ptr& node) { +Any VariantWrapper::init(const std::shared_ptr& node) { return std::make_shared>(FusedNames(node->get_friendly_name())); } bool VariantWrapper::visit_attributes(AttributeVisitor& visitor) { visitor.on_attribute("value", m_value.fused_names); return true; -} \ No newline at end of file +} diff --git a/ngraph/core/src/pass/rt_info/primitives_priority_attribute.cpp b/src/core/src/pass/rt_info/primitives_priority_attribute.cpp similarity index 91% rename from ngraph/core/src/pass/rt_info/primitives_priority_attribute.cpp rename to src/core/src/pass/rt_info/primitives_priority_attribute.cpp index 9936336d98c..036580253cc 100644 --- a/ngraph/core/src/pass/rt_info/primitives_priority_attribute.cpp +++ b/src/core/src/pass/rt_info/primitives_priority_attribute.cpp @@ -27,7 +27,7 @@ std::string ov::getPrimitivesPriority(const std::shared_ptr& node) return ov::as_type_ptr(attr)->get(); } -std::shared_ptr PrimitivesPriority::merge(const ngraph::NodeVector& nodes) { +Any PrimitivesPriority::merge(const ngraph::NodeVector& nodes) { auto isConvolutionBased = [](const std::shared_ptr& node) -> bool { if (std::dynamic_pointer_cast(node) || std::dynamic_pointer_cast(node) || @@ -59,7 +59,7 @@ std::shared_ptr PrimitivesPriority::merge(const ngraph::NodeVec return std::make_shared(final_primitives_priority); } -std::shared_ptr PrimitivesPriority::init(const std::shared_ptr& node) { +Any PrimitivesPriority::init(const std::shared_ptr& node) { throw ngraph_error(std::string(get_type_info()) + " has no default initialization."); } diff --git a/ngraph/core/src/pass/serialize.cpp b/src/core/src/pass/serialize.cpp similarity index 99% rename from ngraph/core/src/pass/serialize.cpp rename to src/core/src/pass/serialize.cpp index 08becb27c50..b1dc8049364 100644 --- a/ngraph/core/src/pass/serialize.cpp +++ b/src/core/src/pass/serialize.cpp @@ -885,6 +885,7 @@ void ngfunction_2_ir(pugi::xml_node& netXml, bool has_attrs = false; for (const auto& item : attributes) { auto attribute_node = rt_node.append_child("attribute"); + OPENVINO_SUPPRESS_DEPRECATED_START attribute_node.append_attribute("name").set_value(item.second->get_type_info().name); attribute_node.append_attribute("version").set_value( item.second->get_type_info().get_version().c_str()); @@ -894,6 +895,7 @@ void ngfunction_2_ir(pugi::xml_node& netXml, } else { has_attrs = true; } + OPENVINO_SUPPRESS_DEPRECATED_END } if (!has_attrs) { node.remove_child(rt_node); diff --git a/ngraph/core/src/pass/smart_reshape/matmul_sr.cpp b/src/core/src/pass/smart_reshape/matmul_sr.cpp similarity index 100% rename from ngraph/core/src/pass/smart_reshape/matmul_sr.cpp rename to src/core/src/pass/smart_reshape/matmul_sr.cpp diff --git a/ngraph/core/src/pass/smart_reshape/mimic_set_batch_size.cpp b/src/core/src/pass/smart_reshape/mimic_set_batch_size.cpp similarity index 100% rename from ngraph/core/src/pass/smart_reshape/mimic_set_batch_size.cpp rename to src/core/src/pass/smart_reshape/mimic_set_batch_size.cpp diff --git a/ngraph/core/src/pass/smart_reshape/proposal_scales_stridedslice.cpp b/src/core/src/pass/smart_reshape/proposal_scales_stridedslice.cpp similarity index 100% rename from ngraph/core/src/pass/smart_reshape/proposal_scales_stridedslice.cpp rename to src/core/src/pass/smart_reshape/proposal_scales_stridedslice.cpp diff --git a/ngraph/core/src/pass/smart_reshape/reshape_to_1D.cpp b/src/core/src/pass/smart_reshape/reshape_to_1D.cpp similarity index 100% rename from ngraph/core/src/pass/smart_reshape/reshape_to_1D.cpp rename to src/core/src/pass/smart_reshape/reshape_to_1D.cpp diff --git a/ngraph/core/src/pass/smart_reshape/set_batch_size.cpp b/src/core/src/pass/smart_reshape/set_batch_size.cpp similarity index 100% rename from ngraph/core/src/pass/smart_reshape/set_batch_size.cpp rename to src/core/src/pass/smart_reshape/set_batch_size.cpp diff --git a/ngraph/core/src/pass/smart_reshape/smart_reshape.cpp b/src/core/src/pass/smart_reshape/smart_reshape.cpp similarity index 100% rename from ngraph/core/src/pass/smart_reshape/smart_reshape.cpp rename to src/core/src/pass/smart_reshape/smart_reshape.cpp diff --git a/ngraph/core/src/pass/smart_reshape/strided_slice_squeeze.cpp b/src/core/src/pass/smart_reshape/strided_slice_squeeze.cpp similarity index 100% rename from ngraph/core/src/pass/smart_reshape/strided_slice_squeeze.cpp rename to src/core/src/pass/smart_reshape/strided_slice_squeeze.cpp diff --git a/ngraph/core/src/pass/validate.cpp b/src/core/src/pass/validate.cpp similarity index 100% rename from ngraph/core/src/pass/validate.cpp rename to src/core/src/pass/validate.cpp diff --git a/ngraph/core/src/pass/visualize_tree.cpp b/src/core/src/pass/visualize_tree.cpp similarity index 99% rename from ngraph/core/src/pass/visualize_tree.cpp rename to src/core/src/pass/visualize_tree.cpp index 8361c064aef..7f69d491055 100644 --- a/ngraph/core/src/pass/visualize_tree.cpp +++ b/src/core/src/pass/visualize_tree.cpp @@ -155,13 +155,15 @@ static std::string label_edge(const std::shared_ptr& /* src */, return ss.str(); } -static std::string get_attribute_values(const std::map>& attributes, +static std::string get_attribute_values(const std::map& attributes, const std::string& delimiter = ", ") { stringstream ss; bool first = true; for (const auto& item : attributes) { ss << (first ? " " : delimiter) << item.first; + OPENVINO_SUPPRESS_DEPRECATED_START const auto attributeValue = item.second == nullptr ? "[EMPTY]" : item.second->to_string(); + OPENVINO_SUPPRESS_DEPRECATED_END if (!attributeValue.empty()) ss << "{" << attributeValue << "}"; diff --git a/ngraph/core/src/pattern/matcher.cpp b/src/core/src/pattern/matcher.cpp similarity index 100% rename from ngraph/core/src/pattern/matcher.cpp rename to src/core/src/pattern/matcher.cpp diff --git a/ngraph/core/src/pattern/op/any.cpp b/src/core/src/pattern/op/any.cpp similarity index 100% rename from ngraph/core/src/pattern/op/any.cpp rename to src/core/src/pattern/op/any.cpp diff --git a/ngraph/core/src/pattern/op/any_of.cpp b/src/core/src/pattern/op/any_of.cpp similarity index 100% rename from ngraph/core/src/pattern/op/any_of.cpp rename to src/core/src/pattern/op/any_of.cpp diff --git a/ngraph/core/src/pattern/op/any_output.cpp b/src/core/src/pattern/op/any_output.cpp similarity index 100% rename from ngraph/core/src/pattern/op/any_output.cpp rename to src/core/src/pattern/op/any_output.cpp diff --git a/ngraph/core/src/pattern/op/branch.cpp b/src/core/src/pattern/op/branch.cpp similarity index 100% rename from ngraph/core/src/pattern/op/branch.cpp rename to src/core/src/pattern/op/branch.cpp diff --git a/ngraph/core/src/pattern/op/capture.cpp b/src/core/src/pattern/op/capture.cpp similarity index 100% rename from ngraph/core/src/pattern/op/capture.cpp rename to src/core/src/pattern/op/capture.cpp diff --git a/ngraph/core/src/pattern/op/label.cpp b/src/core/src/pattern/op/label.cpp similarity index 100% rename from ngraph/core/src/pattern/op/label.cpp rename to src/core/src/pattern/op/label.cpp diff --git a/ngraph/core/src/pattern/op/or.cpp b/src/core/src/pattern/op/or.cpp similarity index 100% rename from ngraph/core/src/pattern/op/or.cpp rename to src/core/src/pattern/op/or.cpp diff --git a/ngraph/core/src/pattern/op/pattern.cpp b/src/core/src/pattern/op/pattern.cpp similarity index 100% rename from ngraph/core/src/pattern/op/pattern.cpp rename to src/core/src/pattern/op/pattern.cpp diff --git a/ngraph/core/src/pattern/op/skip.cpp b/src/core/src/pattern/op/skip.cpp similarity index 100% rename from ngraph/core/src/pattern/op/skip.cpp rename to src/core/src/pattern/op/skip.cpp diff --git a/ngraph/core/src/pattern/op/true.cpp b/src/core/src/pattern/op/true.cpp similarity index 100% rename from ngraph/core/src/pattern/op/true.cpp rename to src/core/src/pattern/op/true.cpp diff --git a/ngraph/core/src/pattern/op/wrap_type.cpp b/src/core/src/pattern/op/wrap_type.cpp similarity index 100% rename from ngraph/core/src/pattern/op/wrap_type.cpp rename to src/core/src/pattern/op/wrap_type.cpp diff --git a/ngraph/core/src/precomp.hpp b/src/core/src/precomp.hpp similarity index 100% rename from ngraph/core/src/precomp.hpp rename to src/core/src/precomp.hpp diff --git a/ngraph/core/src/preprocess/color_utils.cpp b/src/core/src/preprocess/color_utils.cpp similarity index 100% rename from ngraph/core/src/preprocess/color_utils.cpp rename to src/core/src/preprocess/color_utils.cpp diff --git a/ngraph/core/src/preprocess/color_utils.hpp b/src/core/src/preprocess/color_utils.hpp similarity index 100% rename from ngraph/core/src/preprocess/color_utils.hpp rename to src/core/src/preprocess/color_utils.hpp diff --git a/ngraph/core/src/preprocess/function_guard.hpp b/src/core/src/preprocess/function_guard.hpp similarity index 100% rename from ngraph/core/src/preprocess/function_guard.hpp rename to src/core/src/preprocess/function_guard.hpp diff --git a/ngraph/core/src/preprocess/pre_post_process.cpp b/src/core/src/preprocess/pre_post_process.cpp similarity index 100% rename from ngraph/core/src/preprocess/pre_post_process.cpp rename to src/core/src/preprocess/pre_post_process.cpp diff --git a/ngraph/core/src/preprocess/preprocess_steps_impl.cpp b/src/core/src/preprocess/preprocess_steps_impl.cpp similarity index 99% rename from ngraph/core/src/preprocess/preprocess_steps_impl.cpp rename to src/core/src/preprocess/preprocess_steps_impl.cpp index 4763053a268..f970c61f2a8 100644 --- a/ngraph/core/src/preprocess/preprocess_steps_impl.cpp +++ b/src/core/src/preprocess/preprocess_steps_impl.cpp @@ -385,7 +385,7 @@ void PostStepsList::add_convert_impl(const element::Type& type) { if (t == element::Type{}) { t = ctxt.target_element_type(); } - if (t == node.get_node()->get_element_type()) { + if (t == node.get_element_type()) { return std::make_tuple(node, false); } OPENVINO_ASSERT( diff --git a/ngraph/core/src/preprocess/preprocess_steps_impl.hpp b/src/core/src/preprocess/preprocess_steps_impl.hpp similarity index 100% rename from ngraph/core/src/preprocess/preprocess_steps_impl.hpp rename to src/core/src/preprocess/preprocess_steps_impl.hpp diff --git a/ngraph/core/src/rt_info.cpp b/src/core/src/rt_info.cpp similarity index 84% rename from ngraph/core/src/rt_info.cpp rename to src/core/src/rt_info.cpp index b07b2000057..eaed0197af7 100644 --- a/ngraph/core/src/rt_info.cpp +++ b/src/core/src/rt_info.cpp @@ -10,7 +10,8 @@ namespace { ngraph::Node::RTMap mergeRuntimeInfo(const ngraph::NodeVector& nodes) { - std::unordered_map>> attrs; + std::unordered_map> attrs; + OPENVINO_SUPPRESS_DEPRECATED_START for (const auto& node : nodes) { for (const auto& item : node->get_rt_info()) { if (item.second->is_copyable() && item.first != "opset") { @@ -24,10 +25,14 @@ ngraph::Node::RTMap mergeRuntimeInfo(const ngraph::NodeVector& nodes) { auto attr = *item.second.begin(); if (item.second.size() == 1) { merged_attrs[item.first] = attr; - } else if (auto merge_attr = attr->merge(nodes)) { - merged_attrs[item.first] = merge_attr; + } else { + auto merge_attr = attr->merge(nodes); + if (!merge_attr.empty()) { + merged_attrs[item.first] = merge_attr; + } } } + OPENVINO_SUPPRESS_DEPRECATED_END return merged_attrs; } @@ -56,9 +61,11 @@ void ngraph::copy_runtime_info(std::shared_ptr from, std::shared_p attrs.clear(); for (const auto& item : from->get_rt_info()) { + OPENVINO_SUPPRESS_DEPRECATED_START if (item.second->is_copyable() && item.first != "opset") { attrs[item.first] = item.second; } + OPENVINO_SUPPRESS_DEPRECATED_END } if (opset) { diff --git a/ngraph/core/src/runtime/aligned_buffer.cpp b/src/core/src/runtime/aligned_buffer.cpp similarity index 100% rename from ngraph/core/src/runtime/aligned_buffer.cpp rename to src/core/src/runtime/aligned_buffer.cpp diff --git a/ngraph/core/src/runtime/allocator.cpp b/src/core/src/runtime/allocator.cpp similarity index 100% rename from ngraph/core/src/runtime/allocator.cpp rename to src/core/src/runtime/allocator.cpp diff --git a/ngraph/core/src/runtime/blob_allocator.hpp b/src/core/src/runtime/blob_allocator.hpp similarity index 100% rename from ngraph/core/src/runtime/blob_allocator.hpp rename to src/core/src/runtime/blob_allocator.hpp diff --git a/ngraph/core/src/runtime/host_tensor.cpp b/src/core/src/runtime/host_tensor.cpp similarity index 100% rename from ngraph/core/src/runtime/host_tensor.cpp rename to src/core/src/runtime/host_tensor.cpp diff --git a/ngraph/core/src/runtime/ov_tensor.cpp b/src/core/src/runtime/ov_tensor.cpp similarity index 100% rename from ngraph/core/src/runtime/ov_tensor.cpp rename to src/core/src/runtime/ov_tensor.cpp diff --git a/ngraph/core/src/runtime/tensor.cpp b/src/core/src/runtime/tensor.cpp similarity index 100% rename from ngraph/core/src/runtime/tensor.cpp rename to src/core/src/runtime/tensor.cpp diff --git a/ngraph/core/src/shape.cpp b/src/core/src/shape.cpp similarity index 100% rename from ngraph/core/src/shape.cpp rename to src/core/src/shape.cpp diff --git a/ngraph/core/src/shape_util.cpp b/src/core/src/shape_util.cpp similarity index 100% rename from ngraph/core/src/shape_util.cpp rename to src/core/src/shape_util.cpp diff --git a/ngraph/core/src/shared_node_info.hpp b/src/core/src/shared_node_info.hpp similarity index 100% rename from ngraph/core/src/shared_node_info.hpp rename to src/core/src/shared_node_info.hpp diff --git a/ngraph/core/src/so_extension.cpp b/src/core/src/so_extension.cpp similarity index 100% rename from ngraph/core/src/so_extension.cpp rename to src/core/src/so_extension.cpp diff --git a/ngraph/core/src/so_extension.hpp b/src/core/src/so_extension.hpp similarity index 100% rename from ngraph/core/src/so_extension.hpp rename to src/core/src/so_extension.hpp diff --git a/ngraph/core/src/specialize_function.cpp b/src/core/src/specialize_function.cpp similarity index 100% rename from ngraph/core/src/specialize_function.cpp rename to src/core/src/specialize_function.cpp diff --git a/ngraph/core/src/strides.cpp b/src/core/src/strides.cpp similarity index 100% rename from ngraph/core/src/strides.cpp rename to src/core/src/strides.cpp diff --git a/ngraph/core/src/tensor_name_util.hpp b/src/core/src/tensor_name_util.hpp similarity index 100% rename from ngraph/core/src/tensor_name_util.hpp rename to src/core/src/tensor_name_util.hpp diff --git a/ngraph/core/src/type.cpp b/src/core/src/type.cpp similarity index 100% rename from ngraph/core/src/type.cpp rename to src/core/src/type.cpp diff --git a/ngraph/core/src/type/bfloat16.cpp b/src/core/src/type/bfloat16.cpp similarity index 100% rename from ngraph/core/src/type/bfloat16.cpp rename to src/core/src/type/bfloat16.cpp diff --git a/ngraph/core/src/type/element_type.cpp b/src/core/src/type/element_type.cpp similarity index 100% rename from ngraph/core/src/type/element_type.cpp rename to src/core/src/type/element_type.cpp diff --git a/ngraph/core/src/type/float16.cpp b/src/core/src/type/float16.cpp similarity index 100% rename from ngraph/core/src/type/float16.cpp rename to src/core/src/type/float16.cpp diff --git a/ngraph/core/src/util.cpp b/src/core/src/util.cpp similarity index 100% rename from ngraph/core/src/util.cpp rename to src/core/src/util.cpp diff --git a/ngraph/core/src/validation_util.cpp b/src/core/src/validation_util.cpp similarity index 100% rename from ngraph/core/src/validation_util.cpp rename to src/core/src/validation_util.cpp diff --git a/ngraph/core/src/variant.cpp b/src/core/src/variant.cpp similarity index 67% rename from ngraph/core/src/variant.cpp rename to src/core/src/variant.cpp index 9988b24cc7b..4e3c73bfcf4 100644 --- a/ngraph/core/src/variant.cpp +++ b/src/core/src/variant.cpp @@ -5,18 +5,19 @@ #include "ngraph/variant.hpp" #include "ngraph/node.hpp" +#include "openvino/core/any.hpp" #include "openvino/core/attribute_visitor.hpp" using namespace ngraph; Variant::~Variant() = default; -std::shared_ptr Variant::init(const std::shared_ptr& node) { - return nullptr; +ov::Any Variant::init(const std::shared_ptr& node) { + return {}; } -std::shared_ptr Variant::merge(const ngraph::NodeVector& nodes) { - return nullptr; +ov::Any Variant::merge(const ngraph::NodeVector& nodes) { + return {}; } bool Variant::is_copyable() const { diff --git a/ngraph/core/src/version.cpp b/src/core/src/version.cpp similarity index 100% rename from ngraph/core/src/version.cpp rename to src/core/src/version.cpp diff --git a/ngraph/test/CMakeLists.txt b/src/core/tests/CMakeLists.txt similarity index 98% rename from ngraph/test/CMakeLists.txt rename to src/core/tests/CMakeLists.txt index 7422efa5078..8510fd51abc 100644 --- a/ngraph/test/CMakeLists.txt +++ b/src/core/tests/CMakeLists.txt @@ -7,13 +7,13 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-ld=gold") endif() -add_definitions(-DSERIALIZED_ZOO=\"${TEST_MODEL_ZOO}/ngraph/models\") +add_definitions(-DSERIALIZED_ZOO=\"${TEST_MODEL_ZOO}/core/models\") set(NGRAPH_ONNX_NAMESPACE ngraph_onnx) add_subdirectory(runtime) if(ENABLE_TESTS) - add_definitions("-DTEST_FILES=\"${TEST_MODEL_ZOO}/ngraph/files\"") + add_definitions("-DTEST_FILES=\"${TEST_MODEL_ZOO}/core/files\"") add_subdirectory(util) add_subdirectory(engines_util) if (NGRAPH_ONNX_FRONTEND_ENABLE) @@ -94,6 +94,7 @@ set(SRC opset1.cpp ov_default_allocator_test.cpp ov_tensor_test.cpp + any.cpp partial_shape.cpp pass_config.cpp pass_manager.cpp @@ -435,7 +436,7 @@ set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/threading.cpp # Add include path to so_extension.hpp set_property(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/extension.cpp - APPEND PROPERTY INCLUDE_DIRECTORIES "${OpenVINO_SOURCE_DIR}/ngraph/core/src/") + APPEND PROPERTY INCLUDE_DIRECTORIES "${OpenVINO_SOURCE_DIR}/src/core/src/") if(SUGGEST_OVERRIDE_SUPPORTED) set_source_files_properties(ov_tensor_test.cpp @@ -491,12 +492,9 @@ set(MULTI_TEST_SRC backend/experimental_detectron_prior_grid.in.cpp backend/function_name.in.cpp backend/interpolate.in.cpp - backend/matrix_nms.in.cpp - backend/multiclass_nms.in.cpp backend/multiple_backends.in.cpp backend/multiple_result.in.cpp backend/node_name.in.cpp - backend/non_max_suppression.in.cpp backend/region_yolo.in.cpp backend/sqrt.in.cpp backend/unhandled_op.in.cpp diff --git a/ngraph/test/aligned_buffer.cpp b/src/core/tests/aligned_buffer.cpp similarity index 100% rename from ngraph/test/aligned_buffer.cpp rename to src/core/tests/aligned_buffer.cpp diff --git a/ngraph/test/all_close_f.cpp b/src/core/tests/all_close_f.cpp similarity index 100% rename from ngraph/test/all_close_f.cpp rename to src/core/tests/all_close_f.cpp diff --git a/src/core/tests/any.cpp b/src/core/tests/any.cpp new file mode 100644 index 00000000000..47428262111 --- /dev/null +++ b/src/core/tests/any.cpp @@ -0,0 +1,446 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "openvino/core/any.hpp" + +#include + +#include "gtest/gtest.h" +#include "openvino/core/variant.hpp" + +using namespace ov; + +class DestructorTest { +public: + DestructorTest() { + constructorCount++; + } + + DestructorTest(const DestructorTest& c) { + constructorCount++; + } + + DestructorTest(const DestructorTest&& c) { + constructorCount++; + } + + ~DestructorTest() { + destructorCount++; + } + + static size_t destructorCount; + static size_t constructorCount; +}; +size_t DestructorTest::destructorCount = 0; +size_t DestructorTest::constructorCount = 0; + +class AnyTests : public ::testing::Test { +public: + void SetUp() override { + DestructorTest::destructorCount = 0; + DestructorTest::constructorCount = 0; + } +}; + +TEST_F(AnyTests, parameter_std_string) { + auto parameter = Any{"My string"}; + ASSERT_TRUE(parameter.is()); + EXPECT_EQ(parameter.as(), "My string"); +} + +TEST_F(AnyTests, parameter_int64_t) { + auto parameter = Any{int64_t(27)}; + ASSERT_TRUE(parameter.is()); + EXPECT_FALSE(parameter.is()); + EXPECT_EQ(parameter.as(), 27); +} + +struct Ship { + Ship(const std::string& name_, const int16_t x_, const int16_t y_) : name{name_}, x{x_}, y{y_} {} + std::string name; + int16_t x; + int16_t y; +}; + +TEST_F(AnyTests, parameter_ship) { + { + auto parameter = Any{Ship{"Lollipop", 3, 4}}; + ASSERT_TRUE(parameter.is()); + Ship& ship = parameter.as(); + EXPECT_EQ(ship.name, "Lollipop"); + EXPECT_EQ(ship.x, 3); + EXPECT_EQ(ship.y, 4); + } + { + auto parameter = Any::make("Lollipop", int16_t(3), int16_t(4)); + ASSERT_TRUE(parameter.is()); + Ship& ship = parameter.as(); + EXPECT_EQ(ship.name, "Lollipop"); + EXPECT_EQ(ship.x, 3); + EXPECT_EQ(ship.y, 4); + } + { + auto parameter = Any::make("Lollipop", int16_t(3), int16_t(4)); + ASSERT_TRUE(parameter.is()); + Ship ship = parameter; + EXPECT_EQ(ship.name, "Lollipop"); + EXPECT_EQ(ship.x, 3); + EXPECT_EQ(ship.y, 4); + } +} + +TEST_F(AnyTests, AnyAsInt) { + Any p = 4; + ASSERT_TRUE(p.is()); + int test = p; + ASSERT_EQ(4, test); +} + +TEST_F(AnyTests, AnyAsUInt) { + Any p = uint32_t(4); + ASSERT_TRUE(p.is()); + ASSERT_TRUE(p.is()); + uint32_t test = p; + ASSERT_EQ(4, test); +} + +TEST_F(AnyTests, AnyAsString) { + std::string ref = "test"; + Any p = ref; + std::string test = p; + ASSERT_TRUE(p.is()); + ASSERT_EQ(ref, test); +} + +TEST_F(AnyTests, AnyAsStringInLine) { + Any p = "test"; + std::string test = p; + ASSERT_TRUE(p.is()); + ASSERT_EQ("test", test); +} + +TEST_F(AnyTests, IntAnyAsString) { + Any p = 4; + ASSERT_TRUE(p.is()); + ASSERT_FALSE(p.is()); + ASSERT_THROW(std::string test = p, ov::Exception); + ASSERT_THROW(std::string test = p.as(), ov::Exception); +} + +TEST_F(AnyTests, StringAnyAsInt) { + Any p = "4"; + ASSERT_FALSE(p.is()); + ASSERT_TRUE(p.is()); + ASSERT_THROW((void)static_cast(p), ov::Exception); + ASSERT_THROW((void)p.as(), ov::Exception); +} + +TEST_F(AnyTests, AnyAsInts) { + std::vector ref = {1, 2, 3, 4, 5}; + Any p = ref; + ASSERT_TRUE(p.is>()); + std::vector test = p; + ASSERT_EQ(ref.size(), test.size()); + for (size_t i = 0; i < ref.size(); i++) { + ASSERT_EQ(ref[i], test[i]); + } +} + +TEST_F(AnyTests, AnyAsMapOfAnys) { + std::map refMap; + refMap["testParamInt"] = 4; + refMap["testParamString"] = "test"; + Any p = refMap; + bool isMap = p.is>(); + ASSERT_TRUE(isMap); + std::map testMap = p; + + ASSERT_NE(testMap.find("testParamInt"), testMap.end()); + ASSERT_NE(testMap.find("testParamString"), testMap.end()); + + int testInt = testMap["testParamInt"]; + std::string testString = testMap["testParamString"]; + + ASSERT_EQ(refMap["testParamInt"].as(), testInt); + ASSERT_EQ(refMap["testParamString"].as(), testString); +} + +TEST_F(AnyTests, AnyNotEmpty) { + Any p = 4; + ASSERT_FALSE(p.empty()); +} + +TEST_F(AnyTests, AnyEmpty) { + Any p; + ASSERT_TRUE(p.empty()); +} + +TEST_F(AnyTests, AnyClear) { + Any p = 4; + ASSERT_FALSE(p.empty()); + p = {}; + ASSERT_TRUE(p.empty()); +} + +TEST_F(AnyTests, AnysNotEqualByType) { + Any p1 = 4; + Any p2 = "string"; + ASSERT_TRUE(p1 != p2); + ASSERT_FALSE(p1 == p2); +} + +TEST_F(AnyTests, AnysNotEqualByValue) { + Any p1 = 4; + Any p2 = 5; + ASSERT_TRUE(p1 != p2); + ASSERT_FALSE(p1 == p2); +} + +TEST_F(AnyTests, AnysEqual) { + Any p1 = 4; + Any p2 = 4; + ASSERT_TRUE(p1 == p2); + ASSERT_FALSE(p1 != p2); +} + +TEST_F(AnyTests, AnysStringEqual) { + std::string s1 = "abc"; + std::string s2 = std::string("a") + "bc"; + Any p1 = s1; + Any p2 = s2; + ASSERT_TRUE(s1 == s2); + ASSERT_TRUE(p1 == p2); + ASSERT_FALSE(p1 != p2); +} + +TEST_F(AnyTests, MapOfAnysEqual) { + std::map map0; + map0["testParamInt"] = 4; + map0["testParamString"] = "test"; + const auto map1 = map0; + + Any p0 = map0; + Any p1 = map1; + ASSERT_TRUE(p0 == p1); + ASSERT_FALSE(p0 != p1); +} + +TEST_F(AnyTests, CompareAnysWithoutEqualOperator) { + class TestClass { + public: + TestClass(int test, int* testPtr) : test(test), testPtr(testPtr) {} + + private: + int test; + int* testPtr; + }; + + TestClass a(2, reinterpret_cast(0x234)); + TestClass b(2, reinterpret_cast(0x234)); + TestClass c(3, reinterpret_cast(0x234)); + Any parA = a; + Any parB = b; + Any parC = c; + + ASSERT_THROW((void)(parA == parB), ov::Exception); + ASSERT_THROW((void)(parA != parB), ov::Exception); + ASSERT_THROW((void)(parA == parC), ov::Exception); + ASSERT_THROW((void)(parA != parC), ov::Exception); +} + +TEST_F(AnyTests, AnyRemovedRealObject) { + ASSERT_EQ(0, DestructorTest::constructorCount); + ASSERT_EQ(0, DestructorTest::destructorCount); + { + DestructorTest t; + Any p1 = t; + } + ASSERT_EQ(2, DestructorTest::constructorCount); + ASSERT_EQ(2, DestructorTest::destructorCount); +} + +TEST_F(AnyTests, AnyRemovedRealObjectWithDuplication) { + ASSERT_EQ(0, DestructorTest::constructorCount); + ASSERT_EQ(0, DestructorTest::destructorCount); + { + DestructorTest t; + Any p = t; + ASSERT_EQ(0, DestructorTest::destructorCount); + p = t; + ASSERT_EQ(1, DestructorTest::destructorCount); + } + ASSERT_EQ(3, DestructorTest::constructorCount); + ASSERT_EQ(3, DestructorTest::destructorCount); +} + +TEST_F(AnyTests, AnyRemovedRealObjectPointerWithDuplication) { + ASSERT_EQ(0, DestructorTest::constructorCount); + ASSERT_EQ(0, DestructorTest::destructorCount); + { + auto* t = new DestructorTest(); + Any p = t; + ASSERT_EQ(1, DestructorTest::constructorCount); + ASSERT_EQ(0, DestructorTest::destructorCount); + p = t; + ASSERT_TRUE(p.is()); + DestructorTest* t2 = p; + ASSERT_EQ(0, DestructorTest::destructorCount); + delete t; + auto* t3 = p.as(); + ASSERT_EQ(t2, t3); + } + ASSERT_EQ(1, DestructorTest::constructorCount); + ASSERT_EQ(1, DestructorTest::destructorCount); +} + +void PrintTo(const Any& object, std::ostream* stream) { + if (object.empty() || !stream) { + return; + } + object.print(*stream); +} + +TEST_F(AnyTests, PrintToEmptyAnyDoesNothing) { + Any p; + std::stringstream stream; + ASSERT_NO_THROW(p.print(stream)); + ASSERT_EQ(stream.str(), std::string{}); +} + +TEST_F(AnyTests, PrintToIntAny) { + int value = -5; + Any p = value; + std::stringstream stream; + ASSERT_NO_THROW(p.print(stream)); + ASSERT_EQ(stream.str(), std::to_string(value)); +} + +TEST_F(AnyTests, PrintToUIntAny) { + unsigned int value = 5; + Any p = value; + std::stringstream stream; + ASSERT_NO_THROW(p.print(stream)); + ASSERT_EQ(stream.str(), std::to_string(value)); +} + +TEST_F(AnyTests, PrintToSize_tAny) { + std::size_t value = 5; + Any p = value; + std::stringstream stream; + ASSERT_NO_THROW(p.print(stream)); + ASSERT_EQ(stream.str(), std::to_string(value)); +} + +TEST_F(AnyTests, PrintToFloatAny) { + Any p = 5.5f; + std::stringstream stream; + ASSERT_NO_THROW(p.print(stream)); + ASSERT_EQ(stream.str(), std::string{"5.5"}); +} + +TEST_F(AnyTests, PrintToStringAny) { + std::string value = "some text"; + Any p = value; + std::stringstream stream; + ASSERT_NO_THROW(p.print(stream)); + ASSERT_EQ(stream.str(), value); +} + +TEST_F(AnyTests, PrintToVectorOfIntsAnyDoesNothing) { + Any p = std::vector{-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5}; + std::stringstream stream; + ASSERT_NO_THROW(p.print(stream)); + ASSERT_EQ(stream.str(), std::string{}); +} + +TEST_F(AnyTests, PrintToVectorOfUIntsAnyDoesNothing) { + Any p = std::vector{0, 1, 2, 3, 4, 5}; + std::stringstream stream; + ASSERT_NO_THROW(p.print(stream)); + ASSERT_EQ(stream.str(), std::string{}); +} + +TEST_F(AnyTests, PrintToVectorOfSize_tAnyDoesNothing) { + Any p = std::vector{0, 1, 2, 3, 4, 5}; + std::stringstream stream; + ASSERT_NO_THROW(p.print(stream)); + ASSERT_EQ(stream.str(), std::string{}); +} + +TEST_F(AnyTests, PrintToVectorOfFloatsAnyDoesNothing) { + Any p = std::vector{0.0f, 1.1f, 2.2f, 3.3f, 4.4f, 5.5f}; + std::stringstream stream; + ASSERT_NO_THROW(p.print(stream)); + ASSERT_EQ(stream.str(), std::string{}); +} + +TEST_F(AnyTests, PrintToVectorOfStringsAnyDoesNothing) { + Any p = std::vector{"zero", "one", "two", "three", "four", "five"}; + std::stringstream stream; + ASSERT_NO_THROW(p.print(stream)); + ASSERT_EQ(stream.str(), std::string{}); +} + +TEST_F(AnyTests, PrintToMapOfAnysDoesNothing) { + std::map refMap; + refMap["testParamInt"] = 4; + refMap["testParamString"] = "test"; + Any p = refMap; + std::stringstream stream; + ASSERT_NO_THROW(p.print(stream)); + ASSERT_EQ(stream.str(), std::string{}); +} + +TEST_F(AnyTests, constructFromVariantImpl) { + auto parameter = Any{4}; + auto get_impl = [&] { + return std::make_shared>(); + }; + auto other_parameter = Any{get_impl()}; +} + +TEST_F(AnyTests, dynamicPointerCastToVariant) { + Any p = std::make_shared>("42"); + auto str_variant = std::dynamic_pointer_cast>(p); + ASSERT_EQ("42", str_variant->get()); +} + +TEST_F(AnyTests, asTypePtrToVariant) { + Any p = std::make_shared>("42"); + auto str_variant = ov::as_type_ptr>(p); + ASSERT_EQ("42", str_variant->get()); +} + +TEST_F(AnyTests, castToVariant) { + { + Any p = std::make_shared>("42"); + std::shared_ptr> str_variant = p; + ASSERT_EQ("42", str_variant->get()); + } + { + Any p = std::make_shared>("42"); + auto f = [](const std::shared_ptr>& str_variant) { + ASSERT_NE(nullptr, str_variant); + ASSERT_EQ("42", str_variant->get()); + }; + f(p); + } + { + Any p = std::make_shared>("42"); + auto f = [](std::shared_ptr>& str_variant) { + ASSERT_NE(nullptr, str_variant); + ASSERT_EQ("42", str_variant->get()); + }; + f(p); + } + { + std::shared_ptr v = std::make_shared>("42"); + Any p = v; + auto f = [](std::shared_ptr>& str_variant) { + ASSERT_NE(nullptr, str_variant); + ASSERT_EQ("42", str_variant->get()); + }; + f(p); + } +} diff --git a/ngraph/test/backend/abc.in.cpp b/src/core/tests/backend/abc.in.cpp similarity index 100% rename from ngraph/test/backend/abc.in.cpp rename to src/core/tests/backend/abc.in.cpp diff --git a/ngraph/test/backend/aliased_output.in.cpp b/src/core/tests/backend/aliased_output.in.cpp similarity index 100% rename from ngraph/test/backend/aliased_output.in.cpp rename to src/core/tests/backend/aliased_output.in.cpp diff --git a/ngraph/test/backend/api.in.cpp b/src/core/tests/backend/api.in.cpp similarity index 100% rename from ngraph/test/backend/api.in.cpp rename to src/core/tests/backend/api.in.cpp diff --git a/ngraph/test/backend/auto_broadcast.in.cpp b/src/core/tests/backend/auto_broadcast.in.cpp similarity index 100% rename from ngraph/test/backend/auto_broadcast.in.cpp rename to src/core/tests/backend/auto_broadcast.in.cpp diff --git a/ngraph/test/backend/builder_reduce_ops_opset1.in.cpp b/src/core/tests/backend/builder_reduce_ops_opset1.in.cpp similarity index 100% rename from ngraph/test/backend/builder_reduce_ops_opset1.in.cpp rename to src/core/tests/backend/builder_reduce_ops_opset1.in.cpp diff --git a/ngraph/test/backend/dyn_reshape.in.cpp b/src/core/tests/backend/dyn_reshape.in.cpp similarity index 100% rename from ngraph/test/backend/dyn_reshape.in.cpp rename to src/core/tests/backend/dyn_reshape.in.cpp diff --git a/ngraph/test/backend/dynamic.in.cpp b/src/core/tests/backend/dynamic.in.cpp similarity index 100% rename from ngraph/test/backend/dynamic.in.cpp rename to src/core/tests/backend/dynamic.in.cpp diff --git a/ngraph/test/backend/experimental_detectron_prior_grid.in.cpp b/src/core/tests/backend/experimental_detectron_prior_grid.in.cpp similarity index 100% rename from ngraph/test/backend/experimental_detectron_prior_grid.in.cpp rename to src/core/tests/backend/experimental_detectron_prior_grid.in.cpp diff --git a/ngraph/test/backend/function_name.in.cpp b/src/core/tests/backend/function_name.in.cpp similarity index 100% rename from ngraph/test/backend/function_name.in.cpp rename to src/core/tests/backend/function_name.in.cpp diff --git a/ngraph/test/backend/interpolate.in.cpp b/src/core/tests/backend/interpolate.in.cpp similarity index 100% rename from ngraph/test/backend/interpolate.in.cpp rename to src/core/tests/backend/interpolate.in.cpp diff --git a/ngraph/test/backend/layer_norm.in.cpp b/src/core/tests/backend/layer_norm.in.cpp similarity index 100% rename from ngraph/test/backend/layer_norm.in.cpp rename to src/core/tests/backend/layer_norm.in.cpp diff --git a/ngraph/test/backend/multiple_backends.in.cpp b/src/core/tests/backend/multiple_backends.in.cpp similarity index 100% rename from ngraph/test/backend/multiple_backends.in.cpp rename to src/core/tests/backend/multiple_backends.in.cpp diff --git a/ngraph/test/backend/multiple_result.in.cpp b/src/core/tests/backend/multiple_result.in.cpp similarity index 100% rename from ngraph/test/backend/multiple_result.in.cpp rename to src/core/tests/backend/multiple_result.in.cpp diff --git a/ngraph/test/backend/node_name.in.cpp b/src/core/tests/backend/node_name.in.cpp similarity index 100% rename from ngraph/test/backend/node_name.in.cpp rename to src/core/tests/backend/node_name.in.cpp diff --git a/ngraph/test/backend/partial_slice.in.cpp b/src/core/tests/backend/partial_slice.in.cpp similarity index 100% rename from ngraph/test/backend/partial_slice.in.cpp rename to src/core/tests/backend/partial_slice.in.cpp diff --git a/ngraph/test/backend/quantize_dequantize.in.cpp b/src/core/tests/backend/quantize_dequantize.in.cpp similarity index 100% rename from ngraph/test/backend/quantize_dequantize.in.cpp rename to src/core/tests/backend/quantize_dequantize.in.cpp diff --git a/ngraph/test/backend/region_yolo.in.cpp b/src/core/tests/backend/region_yolo.in.cpp similarity index 100% rename from ngraph/test/backend/region_yolo.in.cpp rename to src/core/tests/backend/region_yolo.in.cpp diff --git a/ngraph/test/backend/slice.in.cpp b/src/core/tests/backend/slice.in.cpp similarity index 100% rename from ngraph/test/backend/slice.in.cpp rename to src/core/tests/backend/slice.in.cpp diff --git a/ngraph/test/backend/sqrt.in.cpp b/src/core/tests/backend/sqrt.in.cpp similarity index 100% rename from ngraph/test/backend/sqrt.in.cpp rename to src/core/tests/backend/sqrt.in.cpp diff --git a/ngraph/test/backend/unhandled_op.in.cpp b/src/core/tests/backend/unhandled_op.in.cpp similarity index 100% rename from ngraph/test/backend/unhandled_op.in.cpp rename to src/core/tests/backend/unhandled_op.in.cpp diff --git a/ngraph/test/backend/validate_call.in.cpp b/src/core/tests/backend/validate_call.in.cpp similarity index 100% rename from ngraph/test/backend/validate_call.in.cpp rename to src/core/tests/backend/validate_call.in.cpp diff --git a/ngraph/test/backend/zero_sized.in.cpp b/src/core/tests/backend/zero_sized.in.cpp similarity index 100% rename from ngraph/test/backend/zero_sized.in.cpp rename to src/core/tests/backend/zero_sized.in.cpp diff --git a/ngraph/test/backend_api.cpp b/src/core/tests/backend_api.cpp similarity index 100% rename from ngraph/test/backend_api.cpp rename to src/core/tests/backend_api.cpp diff --git a/ngraph/test/backend_debug_api.cpp b/src/core/tests/backend_debug_api.cpp similarity index 100% rename from ngraph/test/backend_debug_api.cpp rename to src/core/tests/backend_debug_api.cpp diff --git a/ngraph/test/bfloat16.cpp b/src/core/tests/bfloat16.cpp similarity index 100% rename from ngraph/test/bfloat16.cpp rename to src/core/tests/bfloat16.cpp diff --git a/ngraph/test/build_graph.cpp b/src/core/tests/build_graph.cpp similarity index 100% rename from ngraph/test/build_graph.cpp rename to src/core/tests/build_graph.cpp diff --git a/ngraph/test/builder.cpp b/src/core/tests/builder.cpp similarity index 100% rename from ngraph/test/builder.cpp rename to src/core/tests/builder.cpp diff --git a/ngraph/test/builder_autobroadcast.cpp b/src/core/tests/builder_autobroadcast.cpp similarity index 100% rename from ngraph/test/builder_autobroadcast.cpp rename to src/core/tests/builder_autobroadcast.cpp diff --git a/ngraph/test/check.cpp b/src/core/tests/check.cpp similarity index 100% rename from ngraph/test/check.cpp rename to src/core/tests/check.cpp diff --git a/ngraph/test/conditional_compilation/ngraph_cc_collect.cpp b/src/core/tests/conditional_compilation/ngraph_cc_collect.cpp similarity index 96% rename from ngraph/test/conditional_compilation/ngraph_cc_collect.cpp rename to src/core/tests/conditional_compilation/ngraph_cc_collect.cpp index 833ce4b51f8..80d721cc374 100644 --- a/ngraph/test/conditional_compilation/ngraph_cc_collect.cpp +++ b/src/core/tests/conditional_compilation/ngraph_cc_collect.cpp @@ -16,7 +16,7 @@ #define SELECTIVE_BUILD_ANALYZER -#include "../core/src/itt.hpp" +#include "../src/itt.hpp" using namespace std; diff --git a/ngraph/test/conditional_compilation/ngraph_cc_off.cpp b/src/core/tests/conditional_compilation/ngraph_cc_off.cpp similarity index 96% rename from ngraph/test/conditional_compilation/ngraph_cc_off.cpp rename to src/core/tests/conditional_compilation/ngraph_cc_off.cpp index 51a2849f412..00d7dcaa972 100644 --- a/ngraph/test/conditional_compilation/ngraph_cc_off.cpp +++ b/src/core/tests/conditional_compilation/ngraph_cc_off.cpp @@ -14,7 +14,7 @@ # undef SELECTIVE_BUILD #endif -#include "../core/src/itt.hpp" +#include "../src/itt.hpp" using namespace std; diff --git a/ngraph/test/conditional_compilation/ngraph_cc_on.cpp b/src/core/tests/conditional_compilation/ngraph_cc_on.cpp similarity index 96% rename from ngraph/test/conditional_compilation/ngraph_cc_on.cpp rename to src/core/tests/conditional_compilation/ngraph_cc_on.cpp index 462b9e28c2c..03259b4b4f8 100644 --- a/ngraph/test/conditional_compilation/ngraph_cc_on.cpp +++ b/src/core/tests/conditional_compilation/ngraph_cc_on.cpp @@ -16,7 +16,7 @@ #define SELECTIVE_BUILD -#include "../core/src/itt.hpp" +#include "../src/itt.hpp" using namespace std; diff --git a/ngraph/test/constant.cpp b/src/core/tests/constant.cpp similarity index 100% rename from ngraph/test/constant.cpp rename to src/core/tests/constant.cpp diff --git a/ngraph/test/constant_folding.cpp b/src/core/tests/constant_folding.cpp similarity index 100% rename from ngraph/test/constant_folding.cpp rename to src/core/tests/constant_folding.cpp diff --git a/ngraph/test/control_dependencies.cpp b/src/core/tests/control_dependencies.cpp similarity index 100% rename from ngraph/test/control_dependencies.cpp rename to src/core/tests/control_dependencies.cpp diff --git a/ngraph/test/convert_u1_to_string.cpp b/src/core/tests/convert_u1_to_string.cpp similarity index 100% rename from ngraph/test/convert_u1_to_string.cpp rename to src/core/tests/convert_u1_to_string.cpp diff --git a/ngraph/test/coordinate.cpp b/src/core/tests/coordinate.cpp similarity index 100% rename from ngraph/test/coordinate.cpp rename to src/core/tests/coordinate.cpp diff --git a/ngraph/test/coordinate_range.cpp b/src/core/tests/coordinate_range.cpp similarity index 100% rename from ngraph/test/coordinate_range.cpp rename to src/core/tests/coordinate_range.cpp diff --git a/ngraph/test/copy.cpp b/src/core/tests/copy.cpp similarity index 100% rename from ngraph/test/copy.cpp rename to src/core/tests/copy.cpp diff --git a/ngraph/test/element_type.cpp b/src/core/tests/element_type.cpp similarity index 100% rename from ngraph/test/element_type.cpp rename to src/core/tests/element_type.cpp diff --git a/ngraph/test/engines_util/CMakeLists.txt b/src/core/tests/engines_util/CMakeLists.txt similarity index 100% rename from ngraph/test/engines_util/CMakeLists.txt rename to src/core/tests/engines_util/CMakeLists.txt diff --git a/ngraph/test/engines_util/engine_factory.hpp b/src/core/tests/engines_util/engine_factory.hpp similarity index 100% rename from ngraph/test/engines_util/engine_factory.hpp rename to src/core/tests/engines_util/engine_factory.hpp diff --git a/ngraph/test/engines_util/engine_traits.hpp b/src/core/tests/engines_util/engine_traits.hpp similarity index 100% rename from ngraph/test/engines_util/engine_traits.hpp rename to src/core/tests/engines_util/engine_traits.hpp diff --git a/ngraph/test/engines_util/execute_tools.cpp b/src/core/tests/engines_util/execute_tools.cpp similarity index 100% rename from ngraph/test/engines_util/execute_tools.cpp rename to src/core/tests/engines_util/execute_tools.cpp diff --git a/ngraph/test/engines_util/execute_tools.hpp b/src/core/tests/engines_util/execute_tools.hpp similarity index 100% rename from ngraph/test/engines_util/execute_tools.hpp rename to src/core/tests/engines_util/execute_tools.hpp diff --git a/ngraph/test/engines_util/ie_engines.cpp b/src/core/tests/engines_util/ie_engines.cpp similarity index 100% rename from ngraph/test/engines_util/ie_engines.cpp rename to src/core/tests/engines_util/ie_engines.cpp diff --git a/ngraph/test/engines_util/ie_engines.hpp b/src/core/tests/engines_util/ie_engines.hpp similarity index 100% rename from ngraph/test/engines_util/ie_engines.hpp rename to src/core/tests/engines_util/ie_engines.hpp diff --git a/ngraph/test/engines_util/interpreter_engine.cpp b/src/core/tests/engines_util/interpreter_engine.cpp similarity index 100% rename from ngraph/test/engines_util/interpreter_engine.cpp rename to src/core/tests/engines_util/interpreter_engine.cpp diff --git a/ngraph/test/engines_util/interpreter_engine.hpp b/src/core/tests/engines_util/interpreter_engine.hpp similarity index 100% rename from ngraph/test/engines_util/interpreter_engine.hpp rename to src/core/tests/engines_util/interpreter_engine.hpp diff --git a/ngraph/test/engines_util/random.hpp b/src/core/tests/engines_util/random.hpp similarity index 100% rename from ngraph/test/engines_util/random.hpp rename to src/core/tests/engines_util/random.hpp diff --git a/ngraph/test/engines_util/shared_utils.cpp b/src/core/tests/engines_util/shared_utils.cpp similarity index 100% rename from ngraph/test/engines_util/shared_utils.cpp rename to src/core/tests/engines_util/shared_utils.cpp diff --git a/ngraph/test/engines_util/shared_utils.hpp b/src/core/tests/engines_util/shared_utils.hpp similarity index 100% rename from ngraph/test/engines_util/shared_utils.hpp rename to src/core/tests/engines_util/shared_utils.hpp diff --git a/ngraph/test/engines_util/test_case.cpp b/src/core/tests/engines_util/test_case.cpp similarity index 100% rename from ngraph/test/engines_util/test_case.cpp rename to src/core/tests/engines_util/test_case.cpp diff --git a/ngraph/test/engines_util/test_case.hpp b/src/core/tests/engines_util/test_case.hpp similarity index 100% rename from ngraph/test/engines_util/test_case.hpp rename to src/core/tests/engines_util/test_case.hpp diff --git a/ngraph/test/engines_util/test_case_engine.hpp b/src/core/tests/engines_util/test_case_engine.hpp similarity index 100% rename from ngraph/test/engines_util/test_case_engine.hpp rename to src/core/tests/engines_util/test_case_engine.hpp diff --git a/ngraph/test/engines_util/test_engines.hpp b/src/core/tests/engines_util/test_engines.hpp similarity index 100% rename from ngraph/test/engines_util/test_engines.hpp rename to src/core/tests/engines_util/test_engines.hpp diff --git a/ngraph/test/eval.cpp b/src/core/tests/eval.cpp similarity index 100% rename from ngraph/test/eval.cpp rename to src/core/tests/eval.cpp diff --git a/ngraph/test/extension.cpp b/src/core/tests/extension.cpp similarity index 100% rename from ngraph/test/extension.cpp rename to src/core/tests/extension.cpp diff --git a/ngraph/test/file_util.cpp b/src/core/tests/file_util.cpp similarity index 100% rename from ngraph/test/file_util.cpp rename to src/core/tests/file_util.cpp diff --git a/ngraph/test/files/onnx/convtranspose_output_shape/w.bin b/src/core/tests/files/onnx/convtranspose_output_shape/w.bin similarity index 100% rename from ngraph/test/files/onnx/convtranspose_output_shape/w.bin rename to src/core/tests/files/onnx/convtranspose_output_shape/w.bin diff --git a/ngraph/test/files/onnx/convtranspose_output_shape/x.bin b/src/core/tests/files/onnx/convtranspose_output_shape/x.bin similarity index 100% rename from ngraph/test/files/onnx/convtranspose_output_shape/x.bin rename to src/core/tests/files/onnx/convtranspose_output_shape/x.bin diff --git a/ngraph/test/files/onnx/convtranspose_output_shape/y.bin b/src/core/tests/files/onnx/convtranspose_output_shape/y.bin similarity index 100% rename from ngraph/test/files/onnx/convtranspose_output_shape/y.bin rename to src/core/tests/files/onnx/convtranspose_output_shape/y.bin diff --git a/ngraph/test/files/onnx/qlinearconv2d/x.bin b/src/core/tests/files/onnx/qlinearconv2d/x.bin similarity index 100% rename from ngraph/test/files/onnx/qlinearconv2d/x.bin rename to src/core/tests/files/onnx/qlinearconv2d/x.bin diff --git a/ngraph/test/files/onnx/qlinearconv2d/y.bin b/src/core/tests/files/onnx/qlinearconv2d/y.bin similarity index 100% rename from ngraph/test/files/onnx/qlinearconv2d/y.bin rename to src/core/tests/files/onnx/qlinearconv2d/y.bin diff --git a/ngraph/test/files/region_in_yolov2_caffe.data b/src/core/tests/files/region_in_yolov2_caffe.data similarity index 100% rename from ngraph/test/files/region_in_yolov2_caffe.data rename to src/core/tests/files/region_in_yolov2_caffe.data diff --git a/ngraph/test/files/region_in_yolov3_mxnet.data b/src/core/tests/files/region_in_yolov3_mxnet.data similarity index 100% rename from ngraph/test/files/region_in_yolov3_mxnet.data rename to src/core/tests/files/region_in_yolov3_mxnet.data diff --git a/ngraph/test/files/region_out_yolov2_caffe.data b/src/core/tests/files/region_out_yolov2_caffe.data similarity index 100% rename from ngraph/test/files/region_out_yolov2_caffe.data rename to src/core/tests/files/region_out_yolov2_caffe.data diff --git a/ngraph/test/files/region_out_yolov3_mxnet.data b/src/core/tests/files/region_out_yolov3_mxnet.data similarity index 100% rename from ngraph/test/files/region_out_yolov3_mxnet.data rename to src/core/tests/files/region_out_yolov3_mxnet.data diff --git a/ngraph/test/float16.cpp b/src/core/tests/float16.cpp similarity index 100% rename from ngraph/test/float16.cpp rename to src/core/tests/float16.cpp diff --git a/ngraph/test/framework_node.cpp b/src/core/tests/framework_node.cpp similarity index 100% rename from ngraph/test/framework_node.cpp rename to src/core/tests/framework_node.cpp diff --git a/ngraph/test/frontend/CMakeLists.txt b/src/core/tests/frontend/CMakeLists.txt similarity index 100% rename from ngraph/test/frontend/CMakeLists.txt rename to src/core/tests/frontend/CMakeLists.txt diff --git a/ngraph/test/frontend/frontend_manager.cpp b/src/core/tests/frontend/frontend_manager.cpp similarity index 100% rename from ngraph/test/frontend/frontend_manager.cpp rename to src/core/tests/frontend/frontend_manager.cpp diff --git a/ngraph/test/frontend/mock_frontend.cpp b/src/core/tests/frontend/mock_frontend.cpp similarity index 100% rename from ngraph/test/frontend/mock_frontend.cpp rename to src/core/tests/frontend/mock_frontend.cpp diff --git a/ngraph/test/frontend/onnx/CMakeLists.txt b/src/core/tests/frontend/onnx/CMakeLists.txt similarity index 92% rename from ngraph/test/frontend/onnx/CMakeLists.txt rename to src/core/tests/frontend/onnx/CMakeLists.txt index 1b28c00d837..6bbf19ea106 100644 --- a/ngraph/test/frontend/onnx/CMakeLists.txt +++ b/src/core/tests/frontend/onnx/CMakeLists.txt @@ -17,7 +17,7 @@ install(TARGETS ${TARGET_NAME} COMPONENT tests EXCLUDE_FROM_ALL) -set(TEST_ONNX_MODELS_DIRNAME ${TEST_MODEL_ZOO}/ngraph/models/onnx) +set(TEST_ONNX_MODELS_DIRNAME ${TEST_MODEL_ZOO}/src/core/models/onnx) target_compile_definitions(${TARGET_NAME} PRIVATE -D TEST_ONNX_MODELS_DIRNAME=\"${TEST_ONNX_MODELS_DIRNAME}/\") set(MANIFEST ${CMAKE_CURRENT_SOURCE_DIR}/unit_test.manifest) target_compile_definitions(${TARGET_NAME} PRIVATE -D MANIFEST=\"${MANIFEST}\") diff --git a/ngraph/test/frontend/onnx/load_from.cpp b/src/core/tests/frontend/onnx/load_from.cpp similarity index 100% rename from ngraph/test/frontend/onnx/load_from.cpp rename to src/core/tests/frontend/onnx/load_from.cpp diff --git a/ngraph/test/frontend/onnx/main.cpp b/src/core/tests/frontend/onnx/main.cpp similarity index 100% rename from ngraph/test/frontend/onnx/main.cpp rename to src/core/tests/frontend/onnx/main.cpp diff --git a/ngraph/test/frontend/onnx/onnx_utils.hpp b/src/core/tests/frontend/onnx/onnx_utils.hpp similarity index 100% rename from ngraph/test/frontend/onnx/onnx_utils.hpp rename to src/core/tests/frontend/onnx/onnx_utils.hpp diff --git a/ngraph/test/frontend/onnx/unit_test.manifest b/src/core/tests/frontend/onnx/unit_test.manifest similarity index 100% rename from ngraph/test/frontend/onnx/unit_test.manifest rename to src/core/tests/frontend/onnx/unit_test.manifest diff --git a/ngraph/test/frontend/paddlepaddle/CMakeLists.txt b/src/core/tests/frontend/paddlepaddle/CMakeLists.txt similarity index 100% rename from ngraph/test/frontend/paddlepaddle/CMakeLists.txt rename to src/core/tests/frontend/paddlepaddle/CMakeLists.txt diff --git a/ngraph/test/frontend/paddlepaddle/basic_api.cpp b/src/core/tests/frontend/paddlepaddle/basic_api.cpp similarity index 100% rename from ngraph/test/frontend/paddlepaddle/basic_api.cpp rename to src/core/tests/frontend/paddlepaddle/basic_api.cpp diff --git a/ngraph/test/frontend/paddlepaddle/convert_model.cpp b/src/core/tests/frontend/paddlepaddle/convert_model.cpp similarity index 100% rename from ngraph/test/frontend/paddlepaddle/convert_model.cpp rename to src/core/tests/frontend/paddlepaddle/convert_model.cpp diff --git a/ngraph/test/frontend/paddlepaddle/convert_unsupported.cpp b/src/core/tests/frontend/paddlepaddle/convert_unsupported.cpp similarity index 100% rename from ngraph/test/frontend/paddlepaddle/convert_unsupported.cpp rename to src/core/tests/frontend/paddlepaddle/convert_unsupported.cpp diff --git a/ngraph/test/frontend/paddlepaddle/cut_specific_model.cpp b/src/core/tests/frontend/paddlepaddle/cut_specific_model.cpp similarity index 100% rename from ngraph/test/frontend/paddlepaddle/cut_specific_model.cpp rename to src/core/tests/frontend/paddlepaddle/cut_specific_model.cpp diff --git a/ngraph/test/frontend/paddlepaddle/incorrect_cut_model.cpp b/src/core/tests/frontend/paddlepaddle/incorrect_cut_model.cpp similarity index 100% rename from ngraph/test/frontend/paddlepaddle/incorrect_cut_model.cpp rename to src/core/tests/frontend/paddlepaddle/incorrect_cut_model.cpp diff --git a/ngraph/test/frontend/paddlepaddle/load_from.cpp b/src/core/tests/frontend/paddlepaddle/load_from.cpp similarity index 100% rename from ngraph/test/frontend/paddlepaddle/load_from.cpp rename to src/core/tests/frontend/paddlepaddle/load_from.cpp diff --git a/ngraph/test/frontend/paddlepaddle/main.cpp b/src/core/tests/frontend/paddlepaddle/main.cpp similarity index 100% rename from ngraph/test/frontend/paddlepaddle/main.cpp rename to src/core/tests/frontend/paddlepaddle/main.cpp diff --git a/ngraph/test/frontend/paddlepaddle/op_fuzzy.cpp b/src/core/tests/frontend/paddlepaddle/op_fuzzy.cpp similarity index 99% rename from ngraph/test/frontend/paddlepaddle/op_fuzzy.cpp rename to src/core/tests/frontend/paddlepaddle/op_fuzzy.cpp index 0a01edccbc1..7b126c33864 100644 --- a/ngraph/test/frontend/paddlepaddle/op_fuzzy.cpp +++ b/src/core/tests/frontend/paddlepaddle/op_fuzzy.cpp @@ -207,6 +207,7 @@ static const std::vector models{std::string("argmax"), std::string("slice_reshape/slice_reshape.pdmodel"), std::string("softmax"), std::string("softmax_minus"), + std::string("softplus_default_params"), std::string("split_test1"), std::string("split_test2"), std::string("split_test3"), diff --git a/ngraph/test/frontend/paddlepaddle/paddle_utils.hpp b/src/core/tests/frontend/paddlepaddle/paddle_utils.hpp similarity index 100% rename from ngraph/test/frontend/paddlepaddle/paddle_utils.hpp rename to src/core/tests/frontend/paddlepaddle/paddle_utils.hpp diff --git a/ngraph/test/frontend/paddlepaddle/partial_shape.cpp b/src/core/tests/frontend/paddlepaddle/partial_shape.cpp similarity index 100% rename from ngraph/test/frontend/paddlepaddle/partial_shape.cpp rename to src/core/tests/frontend/paddlepaddle/partial_shape.cpp diff --git a/ngraph/test/frontend/paddlepaddle/places.cpp b/src/core/tests/frontend/paddlepaddle/places.cpp similarity index 100% rename from ngraph/test/frontend/paddlepaddle/places.cpp rename to src/core/tests/frontend/paddlepaddle/places.cpp diff --git a/ngraph/test/frontend/paddlepaddle/requirements_dev.txt b/src/core/tests/frontend/paddlepaddle/requirements_dev.txt similarity index 100% rename from ngraph/test/frontend/paddlepaddle/requirements_dev.txt rename to src/core/tests/frontend/paddlepaddle/requirements_dev.txt diff --git a/ngraph/test/frontend/paddlepaddle/set_element_type.cpp b/src/core/tests/frontend/paddlepaddle/set_element_type.cpp similarity index 100% rename from ngraph/test/frontend/paddlepaddle/set_element_type.cpp rename to src/core/tests/frontend/paddlepaddle/set_element_type.cpp diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_2in_2out.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_2in_2out.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_2in_2out.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_2in_2out.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_2in_2out_dynbatch.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_2in_2out_dynbatch.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_2in_2out_dynbatch.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_2in_2out_dynbatch.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_argmax.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_argmax.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_argmax.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_argmax.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_assign_value.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_assign_value.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_assign_value.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_assign_value.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_batch_norm.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_batch_norm.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_batch_norm.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_batch_norm.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_bmm.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_bmm.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_bmm.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_bmm.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_clip.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_clip.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_clip.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_clip.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_conv2d.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_conv2d.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_conv2d.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_conv2d.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_conv2d_combinations.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_conv2d_combinations.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_conv2d_combinations.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_conv2d_combinations.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_conv2d_relu.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_conv2d_relu.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_conv2d_relu.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_conv2d_relu.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_conv2d_s.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_conv2d_s.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_conv2d_s.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_conv2d_s.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_conv2d_transpose.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_conv2d_transpose.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_conv2d_transpose.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_conv2d_transpose.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_cumsum.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_cumsum.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_cumsum.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_cumsum.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_dropout.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_dropout.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_dropout.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_dropout.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_dynamic_pool2d.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_dynamic_pool2d.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_dynamic_pool2d.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_dynamic_pool2d.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_elementwise_ops.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_elementwise_ops.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_elementwise_ops.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_elementwise_ops.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_embedding.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_embedding.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_embedding.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_embedding.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_equal.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_equal.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_equal.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_equal.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_exp.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_exp.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_exp.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_exp.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_expand_v2.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_expand_v2.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_expand_v2.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_expand_v2.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_fill_any_like.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_fill_any_like.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_fill_any_like.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_fill_any_like.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_fill_constant.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_fill_constant.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_fill_constant.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_fill_constant.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_fill_constant_batch_size_like.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_fill_constant_batch_size_like.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_fill_constant_batch_size_like.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_fill_constant_batch_size_like.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_flatten_contiguous_range.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_flatten_contiguous_range.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_flatten_contiguous_range.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_flatten_contiguous_range.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_gelu.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_gelu.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_gelu.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_gelu.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_greater_equal.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_greater_equal.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_greater_equal.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_greater_equal.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_hard_sigmoid.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_hard_sigmoid.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_hard_sigmoid.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_hard_sigmoid.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_hard_swish.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_hard_swish.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_hard_swish.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_hard_swish.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_interpolate.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_interpolate.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_interpolate.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_interpolate.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_layer_norm.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_layer_norm.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_layer_norm.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_layer_norm.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_leaky_relu.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_leaky_relu.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_leaky_relu.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_leaky_relu.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_log.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_log.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_log.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_log.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_logical_not.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_logical_not.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_logical_not.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_logical_not.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_lower_version.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_lower_version.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_lower_version.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_lower_version.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_matmul_v2.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_matmul_v2.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_matmul_v2.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_matmul_v2.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_mul.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_mul.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_mul.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_mul.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_multi_tensor_split.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_multi_tensor_split.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_multi_tensor_split.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_multi_tensor_split.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_pad3d.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_pad3d.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_pad3d.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_pad3d.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_place_test_model.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_place_test_model.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_place_test_model.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_place_test_model.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_pool2d.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_pool2d.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_pool2d.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_pool2d.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_pow.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_pow.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_pow.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_pow.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_prior_box.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_prior_box.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_prior_box.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_prior_box.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_range.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_range.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_range.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_range.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_relu.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_relu.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_relu.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_relu.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_relu6.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_relu6.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_relu6.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_relu6.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_reshape.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_reshape.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_reshape.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_reshape.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_rnn_lstm.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_rnn_lstm.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_rnn_lstm.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_rnn_lstm.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_scale.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_scale.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_scale.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_scale.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_shape.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_shape.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_shape.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_shape.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_sigmoid.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_sigmoid.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_sigmoid.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_sigmoid.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_slice.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_slice.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_slice.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_slice.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_softmax.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_softmax.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_softmax.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_softmax.py diff --git a/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_softplus.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_softplus.py new file mode 100644 index 00000000000..f5d31f27fe3 --- /dev/null +++ b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_softplus.py @@ -0,0 +1,43 @@ +# +# softplus paddle model generator +# +import numpy as np +import sys +from save_model import saveModel + + +def softplus(name: str, x, beta, threshold): + import paddle as pdpd + pdpd.enable_static() + + node_x = pdpd.static.data(name='x', shape=x.shape, dtype='float32') + out = pdpd.nn.functional.softplus(x=node_x, beta=beta, threshold=threshold) + + cpu = pdpd.static.cpu_places(1) + exe = pdpd.static.Executor(cpu[0]) + # startup program will call initializer to initialize the parameters. + exe.run(pdpd.static.default_startup_program()) + + outs = exe.run( + feed={'x': x}, + fetch_list=[out]) + + saveModel(name, exe, feedkeys=['x'], fetchlist=[out], inputs=[x], outputs=[outs[0]], target_dir=sys.argv[1]) + + return outs[0] + + +def main(): + data = np.array( + [[[2.0, 3.0, 4.0, 5.0], + [3.0, 4.0, 5.0, 6.0], + [7.0, 8.0, 8.0, 9.0]], + [[1.0, 2.0, 3.0, 4.0], + [5.0, 6.0, 7.0, 8.0], + [6.0, 7.0, 8.0, 9.0]]] + ).astype(np.float32) + + softplus("softplus_default_params", data, beta=1, threshold=20) + +if __name__ == "__main__": + main() diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_split.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_split.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_split.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_split.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_squeeze.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_squeeze.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_squeeze.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_squeeze.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_stack.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_stack.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_stack.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_stack.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_tanh.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_tanh.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_tanh.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_tanh.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_unsqueeze.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_unsqueeze.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_unsqueeze.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_unsqueeze.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_unsupported_relu.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_unsupported_relu.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_unsupported_relu.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_unsupported_relu.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_yolo_box.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_yolo_box.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/generate_yolo_box.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_yolo_box.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/save_model.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/save_model.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_scripts/save_model.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/save_model.py diff --git a/ngraph/test/frontend/paddlepaddle/test_models/gen_wrapper.py b/src/core/tests/frontend/paddlepaddle/test_models/gen_wrapper.py similarity index 100% rename from ngraph/test/frontend/paddlepaddle/test_models/gen_wrapper.py rename to src/core/tests/frontend/paddlepaddle/test_models/gen_wrapper.py diff --git a/ngraph/test/frontend/paddlepaddle/throw_in_conversion.cpp b/src/core/tests/frontend/paddlepaddle/throw_in_conversion.cpp similarity index 100% rename from ngraph/test/frontend/paddlepaddle/throw_in_conversion.cpp rename to src/core/tests/frontend/paddlepaddle/throw_in_conversion.cpp diff --git a/ngraph/test/frontend/shared/CMakeLists.txt b/src/core/tests/frontend/shared/CMakeLists.txt similarity index 100% rename from ngraph/test/frontend/shared/CMakeLists.txt rename to src/core/tests/frontend/shared/CMakeLists.txt diff --git a/ngraph/test/frontend/shared/include/basic_api.hpp b/src/core/tests/frontend/shared/include/basic_api.hpp similarity index 100% rename from ngraph/test/frontend/shared/include/basic_api.hpp rename to src/core/tests/frontend/shared/include/basic_api.hpp diff --git a/ngraph/test/frontend/shared/include/convert_model.hpp b/src/core/tests/frontend/shared/include/convert_model.hpp similarity index 100% rename from ngraph/test/frontend/shared/include/convert_model.hpp rename to src/core/tests/frontend/shared/include/convert_model.hpp diff --git a/ngraph/test/frontend/shared/include/cut_specific_model.hpp b/src/core/tests/frontend/shared/include/cut_specific_model.hpp similarity index 100% rename from ngraph/test/frontend/shared/include/cut_specific_model.hpp rename to src/core/tests/frontend/shared/include/cut_specific_model.hpp diff --git a/ngraph/test/frontend/shared/include/load_from.hpp b/src/core/tests/frontend/shared/include/load_from.hpp similarity index 100% rename from ngraph/test/frontend/shared/include/load_from.hpp rename to src/core/tests/frontend/shared/include/load_from.hpp diff --git a/ngraph/test/frontend/shared/include/op_fuzzy.hpp b/src/core/tests/frontend/shared/include/op_fuzzy.hpp similarity index 100% rename from ngraph/test/frontend/shared/include/op_fuzzy.hpp rename to src/core/tests/frontend/shared/include/op_fuzzy.hpp diff --git a/ngraph/test/frontend/shared/include/partial_shape.hpp b/src/core/tests/frontend/shared/include/partial_shape.hpp similarity index 100% rename from ngraph/test/frontend/shared/include/partial_shape.hpp rename to src/core/tests/frontend/shared/include/partial_shape.hpp diff --git a/ngraph/test/frontend/shared/include/set_element_type.hpp b/src/core/tests/frontend/shared/include/set_element_type.hpp similarity index 100% rename from ngraph/test/frontend/shared/include/set_element_type.hpp rename to src/core/tests/frontend/shared/include/set_element_type.hpp diff --git a/ngraph/test/frontend/shared/include/utils.hpp b/src/core/tests/frontend/shared/include/utils.hpp similarity index 100% rename from ngraph/test/frontend/shared/include/utils.hpp rename to src/core/tests/frontend/shared/include/utils.hpp diff --git a/ngraph/test/frontend/shared/src/basic_api.cpp b/src/core/tests/frontend/shared/src/basic_api.cpp similarity index 100% rename from ngraph/test/frontend/shared/src/basic_api.cpp rename to src/core/tests/frontend/shared/src/basic_api.cpp diff --git a/ngraph/test/frontend/shared/src/convert_model.cpp b/src/core/tests/frontend/shared/src/convert_model.cpp similarity index 100% rename from ngraph/test/frontend/shared/src/convert_model.cpp rename to src/core/tests/frontend/shared/src/convert_model.cpp diff --git a/ngraph/test/frontend/shared/src/cut_specific_model.cpp b/src/core/tests/frontend/shared/src/cut_specific_model.cpp similarity index 100% rename from ngraph/test/frontend/shared/src/cut_specific_model.cpp rename to src/core/tests/frontend/shared/src/cut_specific_model.cpp diff --git a/ngraph/test/frontend/shared/src/load_from.cpp b/src/core/tests/frontend/shared/src/load_from.cpp similarity index 100% rename from ngraph/test/frontend/shared/src/load_from.cpp rename to src/core/tests/frontend/shared/src/load_from.cpp diff --git a/ngraph/test/frontend/shared/src/main.cpp b/src/core/tests/frontend/shared/src/main.cpp similarity index 100% rename from ngraph/test/frontend/shared/src/main.cpp rename to src/core/tests/frontend/shared/src/main.cpp diff --git a/ngraph/test/frontend/shared/src/op_fuzzy.cpp b/src/core/tests/frontend/shared/src/op_fuzzy.cpp similarity index 100% rename from ngraph/test/frontend/shared/src/op_fuzzy.cpp rename to src/core/tests/frontend/shared/src/op_fuzzy.cpp diff --git a/ngraph/test/frontend/shared/src/partial_shape.cpp b/src/core/tests/frontend/shared/src/partial_shape.cpp similarity index 100% rename from ngraph/test/frontend/shared/src/partial_shape.cpp rename to src/core/tests/frontend/shared/src/partial_shape.cpp diff --git a/ngraph/test/frontend/shared/src/set_element_type.cpp b/src/core/tests/frontend/shared/src/set_element_type.cpp similarity index 100% rename from ngraph/test/frontend/shared/src/set_element_type.cpp rename to src/core/tests/frontend/shared/src/set_element_type.cpp diff --git a/ngraph/test/frontend/tensorflow/CMakeLists.txt b/src/core/tests/frontend/tensorflow/CMakeLists.txt similarity index 100% rename from ngraph/test/frontend/tensorflow/CMakeLists.txt rename to src/core/tests/frontend/tensorflow/CMakeLists.txt diff --git a/ngraph/test/frontend/tensorflow/basic_api.cpp b/src/core/tests/frontend/tensorflow/basic_api.cpp similarity index 100% rename from ngraph/test/frontend/tensorflow/basic_api.cpp rename to src/core/tests/frontend/tensorflow/basic_api.cpp diff --git a/ngraph/test/frontend/tensorflow/convert_model.cpp b/src/core/tests/frontend/tensorflow/convert_model.cpp similarity index 100% rename from ngraph/test/frontend/tensorflow/convert_model.cpp rename to src/core/tests/frontend/tensorflow/convert_model.cpp diff --git a/ngraph/test/frontend/tensorflow/convert_unsupported.cpp b/src/core/tests/frontend/tensorflow/convert_unsupported.cpp similarity index 100% rename from ngraph/test/frontend/tensorflow/convert_unsupported.cpp rename to src/core/tests/frontend/tensorflow/convert_unsupported.cpp diff --git a/ngraph/test/frontend/tensorflow/main.cpp b/src/core/tests/frontend/tensorflow/main.cpp similarity index 100% rename from ngraph/test/frontend/tensorflow/main.cpp rename to src/core/tests/frontend/tensorflow/main.cpp diff --git a/ngraph/test/frontend/tensorflow/test_models/gen_scripts/generate_2in_2out.py b/src/core/tests/frontend/tensorflow/test_models/gen_scripts/generate_2in_2out.py similarity index 100% rename from ngraph/test/frontend/tensorflow/test_models/gen_scripts/generate_2in_2out.py rename to src/core/tests/frontend/tensorflow/test_models/gen_scripts/generate_2in_2out.py diff --git a/ngraph/test/frontend/tensorflow/test_models/gen_scripts/generate_unsupported_relu.py b/src/core/tests/frontend/tensorflow/test_models/gen_scripts/generate_unsupported_relu.py similarity index 100% rename from ngraph/test/frontend/tensorflow/test_models/gen_scripts/generate_unsupported_relu.py rename to src/core/tests/frontend/tensorflow/test_models/gen_scripts/generate_unsupported_relu.py diff --git a/ngraph/test/frontend/tensorflow/test_models/gen_wrapper.py b/src/core/tests/frontend/tensorflow/test_models/gen_wrapper.py similarity index 100% rename from ngraph/test/frontend/tensorflow/test_models/gen_wrapper.py rename to src/core/tests/frontend/tensorflow/test_models/gen_wrapper.py diff --git a/ngraph/test/frontend/tensorflow/tf_utils.hpp b/src/core/tests/frontend/tensorflow/tf_utils.hpp similarity index 100% rename from ngraph/test/frontend/tensorflow/tf_utils.hpp rename to src/core/tests/frontend/tensorflow/tf_utils.hpp diff --git a/ngraph/test/frontend/tensorflow/transpose_sinking.cpp b/src/core/tests/frontend/tensorflow/transpose_sinking.cpp similarity index 100% rename from ngraph/test/frontend/tensorflow/transpose_sinking.cpp rename to src/core/tests/frontend/tensorflow/transpose_sinking.cpp diff --git a/ngraph/test/function.cpp b/src/core/tests/function.cpp similarity index 99% rename from ngraph/test/function.cpp rename to src/core/tests/function.cpp index 213e027dba0..6d417359600 100644 --- a/ngraph/test/function.cpp +++ b/src/core/tests/function.cpp @@ -830,11 +830,14 @@ TEST(function, add_output_tensor_name) { EXPECT_EQ(f->get_results().size(), 1); - EXPECT_NO_THROW(f->add_output("relu_t1")); + ov::Output out1, out2; + EXPECT_NO_THROW(out1 = f->add_output("relu_t1")); EXPECT_EQ(f->get_results().size(), 2); - EXPECT_NO_THROW(f->add_output("relu_t1")); + EXPECT_NO_THROW(out2 = f->add_output("relu_t1")); EXPECT_EQ(f->get_results().size(), 2); EXPECT_EQ(f->get_results()[1]->input_value(0).get_node(), relu1.get()); + EXPECT_EQ(out1, out2); + EXPECT_EQ(out1.get_node(), f->get_results()[1].get()); } TEST(function, add_output_op_name) { @@ -880,7 +883,9 @@ TEST(function, add_output_port) { EXPECT_EQ(f->get_results().size(), 1); - EXPECT_NO_THROW(f->add_output(relu1->output(0))); + ov::Output out; + EXPECT_NO_THROW(out = f->add_output(relu1->output(0))); + EXPECT_EQ(out.get_node(), f->get_results()[1].get()); EXPECT_EQ(f->get_results().size(), 2); EXPECT_EQ(f->get_results()[1]->input_value(0).get_node(), relu1.get()); } @@ -966,8 +971,10 @@ TEST(function, add_output_port_to_result) { EXPECT_EQ(f->get_results().size(), 1); - EXPECT_NO_THROW(f->add_output(result->output(0))); + ov::Output out; + EXPECT_NO_THROW(out = f->add_output(result->output(0))); EXPECT_EQ(f->get_results().size(), 1); + EXPECT_EQ(out, result->output(0)); } namespace { diff --git a/ngraph/test/graph_rewrite.cpp b/src/core/tests/graph_rewrite.cpp similarity index 100% rename from ngraph/test/graph_rewrite.cpp rename to src/core/tests/graph_rewrite.cpp diff --git a/ngraph/test/header_standalone.in.cpp b/src/core/tests/header_standalone.in.cpp similarity index 100% rename from ngraph/test/header_standalone.in.cpp rename to src/core/tests/header_standalone.in.cpp diff --git a/ngraph/test/input_output_assign.cpp b/src/core/tests/input_output_assign.cpp similarity index 100% rename from ngraph/test/input_output_assign.cpp rename to src/core/tests/input_output_assign.cpp diff --git a/ngraph/test/int4.cpp b/src/core/tests/int4.cpp similarity index 100% rename from ngraph/test/int4.cpp rename to src/core/tests/int4.cpp diff --git a/ngraph/test/intervals.cpp b/src/core/tests/intervals.cpp similarity index 100% rename from ngraph/test/intervals.cpp rename to src/core/tests/intervals.cpp diff --git a/ngraph/test/layout.cpp b/src/core/tests/layout.cpp similarity index 100% rename from ngraph/test/layout.cpp rename to src/core/tests/layout.cpp diff --git a/ngraph/test/main.cpp b/src/core/tests/main.cpp similarity index 100% rename from ngraph/test/main.cpp rename to src/core/tests/main.cpp diff --git a/ngraph/test/matcher_pass.cpp b/src/core/tests/matcher_pass.cpp similarity index 100% rename from ngraph/test/matcher_pass.cpp rename to src/core/tests/matcher_pass.cpp diff --git a/ngraph/test/misc.cpp b/src/core/tests/misc.cpp similarity index 100% rename from ngraph/test/misc.cpp rename to src/core/tests/misc.cpp diff --git a/ngraph/test/misc.hpp b/src/core/tests/misc.hpp similarity index 100% rename from ngraph/test/misc.hpp rename to src/core/tests/misc.hpp diff --git a/ngraph/test/mkldnn.cpp b/src/core/tests/mkldnn.cpp similarity index 100% rename from ngraph/test/mkldnn.cpp rename to src/core/tests/mkldnn.cpp diff --git a/ngraph/test/models/ir/add_abc.bin b/src/core/tests/models/ir/add_abc.bin similarity index 100% rename from ngraph/test/models/ir/add_abc.bin rename to src/core/tests/models/ir/add_abc.bin diff --git a/ngraph/test/models/ir/add_abc.prototxt b/src/core/tests/models/ir/add_abc.prototxt similarity index 100% rename from ngraph/test/models/ir/add_abc.prototxt rename to src/core/tests/models/ir/add_abc.prototxt diff --git a/ngraph/test/models/ir/add_abc.xml b/src/core/tests/models/ir/add_abc.xml similarity index 100% rename from ngraph/test/models/ir/add_abc.xml rename to src/core/tests/models/ir/add_abc.xml diff --git a/ngraph/test/models/ir/add_abc_bin.xml b/src/core/tests/models/ir/add_abc_bin.xml similarity index 100% rename from ngraph/test/models/ir/add_abc_bin.xml rename to src/core/tests/models/ir/add_abc_bin.xml diff --git a/ngraph/test/models/ir/add_abc_f64.xml b/src/core/tests/models/ir/add_abc_f64.xml similarity index 100% rename from ngraph/test/models/ir/add_abc_f64.xml rename to src/core/tests/models/ir/add_abc_f64.xml diff --git a/ngraph/test/models/ir/add_abc_initializers.bin b/src/core/tests/models/ir/add_abc_initializers.bin similarity index 100% rename from ngraph/test/models/ir/add_abc_initializers.bin rename to src/core/tests/models/ir/add_abc_initializers.bin diff --git a/ngraph/test/models/ir/add_abc_initializers.prototxt b/src/core/tests/models/ir/add_abc_initializers.prototxt similarity index 100% rename from ngraph/test/models/ir/add_abc_initializers.prototxt rename to src/core/tests/models/ir/add_abc_initializers.prototxt diff --git a/ngraph/test/models/ir/add_abc_initializers.xml b/src/core/tests/models/ir/add_abc_initializers.xml similarity index 100% rename from ngraph/test/models/ir/add_abc_initializers.xml rename to src/core/tests/models/ir/add_abc_initializers.xml diff --git a/ngraph/test/models/ir/add_abc_initializers_f32_nan_const.bin b/src/core/tests/models/ir/add_abc_initializers_f32_nan_const.bin similarity index 100% rename from ngraph/test/models/ir/add_abc_initializers_f32_nan_const.bin rename to src/core/tests/models/ir/add_abc_initializers_f32_nan_const.bin diff --git a/ngraph/test/models/ir/add_abc_initializers_nan_const.bin b/src/core/tests/models/ir/add_abc_initializers_nan_const.bin similarity index 100% rename from ngraph/test/models/ir/add_abc_initializers_nan_const.bin rename to src/core/tests/models/ir/add_abc_initializers_nan_const.bin diff --git a/ngraph/test/models/ir/add_abc_initializers_nan_const.xml b/src/core/tests/models/ir/add_abc_initializers_nan_const.xml similarity index 100% rename from ngraph/test/models/ir/add_abc_initializers_nan_const.xml rename to src/core/tests/models/ir/add_abc_initializers_nan_const.xml diff --git a/ngraph/test/models/ir/add_abc_initializers_u1_const.bin b/src/core/tests/models/ir/add_abc_initializers_u1_const.bin similarity index 100% rename from ngraph/test/models/ir/add_abc_initializers_u1_const.bin rename to src/core/tests/models/ir/add_abc_initializers_u1_const.bin diff --git a/ngraph/test/models/ir/add_abc_initializers_u1_const.xml b/src/core/tests/models/ir/add_abc_initializers_u1_const.xml similarity index 100% rename from ngraph/test/models/ir/add_abc_initializers_u1_const.xml rename to src/core/tests/models/ir/add_abc_initializers_u1_const.xml diff --git a/ngraph/test/models/ir/addmul_abc.bin b/src/core/tests/models/ir/addmul_abc.bin similarity index 100% rename from ngraph/test/models/ir/addmul_abc.bin rename to src/core/tests/models/ir/addmul_abc.bin diff --git a/ngraph/test/models/ir/addmul_abc.prototxt b/src/core/tests/models/ir/addmul_abc.prototxt similarity index 100% rename from ngraph/test/models/ir/addmul_abc.prototxt rename to src/core/tests/models/ir/addmul_abc.prototxt diff --git a/ngraph/test/models/ir/addmul_abc.xml b/src/core/tests/models/ir/addmul_abc.xml similarity index 100% rename from ngraph/test/models/ir/addmul_abc.xml rename to src/core/tests/models/ir/addmul_abc.xml diff --git a/ngraph/test/models/ir/conv_with_rt_info.bin b/src/core/tests/models/ir/conv_with_rt_info.bin similarity index 100% rename from ngraph/test/models/ir/conv_with_rt_info.bin rename to src/core/tests/models/ir/conv_with_rt_info.bin diff --git a/ngraph/test/models/ir/conv_with_rt_info.xml b/src/core/tests/models/ir/conv_with_rt_info.xml similarity index 100% rename from ngraph/test/models/ir/conv_with_rt_info.xml rename to src/core/tests/models/ir/conv_with_rt_info.xml diff --git a/ngraph/test/models/ir/dynamic_input_shape.xml b/src/core/tests/models/ir/dynamic_input_shape.xml similarity index 100% rename from ngraph/test/models/ir/dynamic_input_shape.xml rename to src/core/tests/models/ir/dynamic_input_shape.xml diff --git a/ngraph/test/models/ir/experimental_detectron_detection_output.xml b/src/core/tests/models/ir/experimental_detectron_detection_output.xml similarity index 100% rename from ngraph/test/models/ir/experimental_detectron_detection_output.xml rename to src/core/tests/models/ir/experimental_detectron_detection_output.xml diff --git a/ngraph/test/models/ir/experimental_detectron_detection_output_opset6.xml b/src/core/tests/models/ir/experimental_detectron_detection_output_opset6.xml similarity index 100% rename from ngraph/test/models/ir/experimental_detectron_detection_output_opset6.xml rename to src/core/tests/models/ir/experimental_detectron_detection_output_opset6.xml diff --git a/ngraph/test/models/ir/experimental_detectron_roi_feature_extractor.xml b/src/core/tests/models/ir/experimental_detectron_roi_feature_extractor.xml similarity index 100% rename from ngraph/test/models/ir/experimental_detectron_roi_feature_extractor.xml rename to src/core/tests/models/ir/experimental_detectron_roi_feature_extractor.xml diff --git a/ngraph/test/models/ir/experimental_detectron_roi_feature_extractor_opset6.xml b/src/core/tests/models/ir/experimental_detectron_roi_feature_extractor_opset6.xml similarity index 100% rename from ngraph/test/models/ir/experimental_detectron_roi_feature_extractor_opset6.xml rename to src/core/tests/models/ir/experimental_detectron_roi_feature_extractor_opset6.xml diff --git a/ngraph/test/models/ir/if_body_without_parameters.bin b/src/core/tests/models/ir/if_body_without_parameters.bin similarity index 100% rename from ngraph/test/models/ir/if_body_without_parameters.bin rename to src/core/tests/models/ir/if_body_without_parameters.bin diff --git a/ngraph/test/models/ir/if_body_without_parameters.xml b/src/core/tests/models/ir/if_body_without_parameters.xml similarity index 100% rename from ngraph/test/models/ir/if_body_without_parameters.xml rename to src/core/tests/models/ir/if_body_without_parameters.xml diff --git a/ngraph/test/models/ir/if_diff_case.bin b/src/core/tests/models/ir/if_diff_case.bin similarity index 100% rename from ngraph/test/models/ir/if_diff_case.bin rename to src/core/tests/models/ir/if_diff_case.bin diff --git a/ngraph/test/models/ir/if_diff_case.xml b/src/core/tests/models/ir/if_diff_case.xml similarity index 100% rename from ngraph/test/models/ir/if_diff_case.xml rename to src/core/tests/models/ir/if_diff_case.xml diff --git a/ngraph/test/models/ir/loop_2d_add.bin b/src/core/tests/models/ir/loop_2d_add.bin similarity index 100% rename from ngraph/test/models/ir/loop_2d_add.bin rename to src/core/tests/models/ir/loop_2d_add.bin diff --git a/ngraph/test/models/ir/loop_2d_add.xml b/src/core/tests/models/ir/loop_2d_add.xml similarity index 100% rename from ngraph/test/models/ir/loop_2d_add.xml rename to src/core/tests/models/ir/loop_2d_add.xml diff --git a/ngraph/test/models/ir/nms5.bin b/src/core/tests/models/ir/nms5.bin similarity index 100% rename from ngraph/test/models/ir/nms5.bin rename to src/core/tests/models/ir/nms5.bin diff --git a/ngraph/test/models/ir/nms5.xml b/src/core/tests/models/ir/nms5.xml similarity index 100% rename from ngraph/test/models/ir/nms5.xml rename to src/core/tests/models/ir/nms5.xml diff --git a/ngraph/test/models/ir/nms5_dynamism.bin b/src/core/tests/models/ir/nms5_dynamism.bin similarity index 100% rename from ngraph/test/models/ir/nms5_dynamism.bin rename to src/core/tests/models/ir/nms5_dynamism.bin diff --git a/ngraph/test/models/ir/nms5_dynamism.xml b/src/core/tests/models/ir/nms5_dynamism.xml similarity index 100% rename from ngraph/test/models/ir/nms5_dynamism.xml rename to src/core/tests/models/ir/nms5_dynamism.xml diff --git a/ngraph/test/models/ir/pad_with_shape_of.bin b/src/core/tests/models/ir/pad_with_shape_of.bin similarity index 100% rename from ngraph/test/models/ir/pad_with_shape_of.bin rename to src/core/tests/models/ir/pad_with_shape_of.bin diff --git a/ngraph/test/models/ir/pad_with_shape_of.xml b/src/core/tests/models/ir/pad_with_shape_of.xml similarity index 100% rename from ngraph/test/models/ir/pad_with_shape_of.xml rename to src/core/tests/models/ir/pad_with_shape_of.xml diff --git a/ngraph/test/models/ir/shape_of.xml b/src/core/tests/models/ir/shape_of.xml similarity index 100% rename from ngraph/test/models/ir/shape_of.xml rename to src/core/tests/models/ir/shape_of.xml diff --git a/ngraph/test/models/ir/split_equal_parts_2d.bin b/src/core/tests/models/ir/split_equal_parts_2d.bin similarity index 100% rename from ngraph/test/models/ir/split_equal_parts_2d.bin rename to src/core/tests/models/ir/split_equal_parts_2d.bin diff --git a/ngraph/test/models/ir/split_equal_parts_2d.prototxt b/src/core/tests/models/ir/split_equal_parts_2d.prototxt similarity index 100% rename from ngraph/test/models/ir/split_equal_parts_2d.prototxt rename to src/core/tests/models/ir/split_equal_parts_2d.prototxt diff --git a/ngraph/test/models/ir/split_equal_parts_2d.xml b/src/core/tests/models/ir/split_equal_parts_2d.xml similarity index 100% rename from ngraph/test/models/ir/split_equal_parts_2d.xml rename to src/core/tests/models/ir/split_equal_parts_2d.xml diff --git a/ngraph/test/models/ir/weights/add_abc.bin b/src/core/tests/models/ir/weights/add_abc.bin similarity index 100% rename from ngraph/test/models/ir/weights/add_abc.bin rename to src/core/tests/models/ir/weights/add_abc.bin diff --git a/ngraph/test/models/onnx/acosh.prototxt b/src/core/tests/models/onnx/acosh.prototxt similarity index 100% rename from ngraph/test/models/onnx/acosh.prototxt rename to src/core/tests/models/onnx/acosh.prototxt diff --git a/ngraph/test/models/onnx/add_abc.prototxt b/src/core/tests/models/onnx/add_abc.prototxt similarity index 100% rename from ngraph/test/models/onnx/add_abc.prototxt rename to src/core/tests/models/onnx/add_abc.prototxt diff --git a/ngraph/test/models/onnx/add_abc_3d.prototxt b/src/core/tests/models/onnx/add_abc_3d.prototxt similarity index 100% rename from ngraph/test/models/onnx/add_abc_3d.prototxt rename to src/core/tests/models/onnx/add_abc_3d.prototxt diff --git a/ngraph/test/models/onnx/add_abc_initializers.prototxt b/src/core/tests/models/onnx/add_abc_initializers.prototxt similarity index 100% rename from ngraph/test/models/onnx/add_abc_initializers.prototxt rename to src/core/tests/models/onnx/add_abc_initializers.prototxt diff --git a/ngraph/test/models/onnx/add_bcast.prototxt b/src/core/tests/models/onnx/add_bcast.prototxt similarity index 100% rename from ngraph/test/models/onnx/add_bcast.prototxt rename to src/core/tests/models/onnx/add_bcast.prototxt diff --git a/ngraph/test/models/onnx/add_v6_broadcast_axes_1_2.prototxt b/src/core/tests/models/onnx/add_v6_broadcast_axes_1_2.prototxt similarity index 100% rename from ngraph/test/models/onnx/add_v6_broadcast_axes_1_2.prototxt rename to src/core/tests/models/onnx/add_v6_broadcast_axes_1_2.prototxt diff --git a/ngraph/test/models/onnx/add_v6_broadcast_axis_1.prototxt b/src/core/tests/models/onnx/add_v6_broadcast_axis_1.prototxt similarity index 100% rename from ngraph/test/models/onnx/add_v6_broadcast_axis_1.prototxt rename to src/core/tests/models/onnx/add_v6_broadcast_axis_1.prototxt diff --git a/ngraph/test/models/onnx/add_v6_broadcast_no_axis.prototxt b/src/core/tests/models/onnx/add_v6_broadcast_no_axis.prototxt similarity index 100% rename from ngraph/test/models/onnx/add_v6_broadcast_no_axis.prototxt rename to src/core/tests/models/onnx/add_v6_broadcast_no_axis.prototxt diff --git a/ngraph/test/models/onnx/add_v7.prototxt b/src/core/tests/models/onnx/add_v7.prototxt similarity index 100% rename from ngraph/test/models/onnx/add_v7.prototxt rename to src/core/tests/models/onnx/add_v7.prototxt diff --git a/ngraph/test/models/onnx/addmul_abc.prototxt b/src/core/tests/models/onnx/addmul_abc.prototxt similarity index 100% rename from ngraph/test/models/onnx/addmul_abc.prototxt rename to src/core/tests/models/onnx/addmul_abc.prototxt diff --git a/ngraph/test/models/onnx/affine.prototxt b/src/core/tests/models/onnx/affine.prototxt similarity index 100% rename from ngraph/test/models/onnx/affine.prototxt rename to src/core/tests/models/onnx/affine.prototxt diff --git a/ngraph/test/models/onnx/argmax_float.prototxt b/src/core/tests/models/onnx/argmax_float.prototxt similarity index 100% rename from ngraph/test/models/onnx/argmax_float.prototxt rename to src/core/tests/models/onnx/argmax_float.prototxt diff --git a/ngraph/test/models/onnx/argmax_int32.prototxt b/src/core/tests/models/onnx/argmax_int32.prototxt similarity index 100% rename from ngraph/test/models/onnx/argmax_int32.prototxt rename to src/core/tests/models/onnx/argmax_int32.prototxt diff --git a/ngraph/test/models/onnx/argmax_select_last_index.prototxt b/src/core/tests/models/onnx/argmax_select_last_index.prototxt similarity index 100% rename from ngraph/test/models/onnx/argmax_select_last_index.prototxt rename to src/core/tests/models/onnx/argmax_select_last_index.prototxt diff --git a/ngraph/test/models/onnx/argmin_float.prototxt b/src/core/tests/models/onnx/argmin_float.prototxt similarity index 100% rename from ngraph/test/models/onnx/argmin_float.prototxt rename to src/core/tests/models/onnx/argmin_float.prototxt diff --git a/ngraph/test/models/onnx/argmin_int32.prototxt b/src/core/tests/models/onnx/argmin_int32.prototxt similarity index 100% rename from ngraph/test/models/onnx/argmin_int32.prototxt rename to src/core/tests/models/onnx/argmin_int32.prototxt diff --git a/ngraph/test/models/onnx/argmin_no_keepdims.prototxt b/src/core/tests/models/onnx/argmin_no_keepdims.prototxt similarity index 100% rename from ngraph/test/models/onnx/argmin_no_keepdims.prototxt rename to src/core/tests/models/onnx/argmin_no_keepdims.prototxt diff --git a/ngraph/test/models/onnx/argmin_select_last_index.prototxt b/src/core/tests/models/onnx/argmin_select_last_index.prototxt similarity index 100% rename from ngraph/test/models/onnx/argmin_select_last_index.prototxt rename to src/core/tests/models/onnx/argmin_select_last_index.prototxt diff --git a/ngraph/test/models/onnx/asinh.prototxt b/src/core/tests/models/onnx/asinh.prototxt similarity index 100% rename from ngraph/test/models/onnx/asinh.prototxt rename to src/core/tests/models/onnx/asinh.prototxt diff --git a/ngraph/test/models/onnx/atanh.prototxt b/src/core/tests/models/onnx/atanh.prototxt similarity index 100% rename from ngraph/test/models/onnx/atanh.prototxt rename to src/core/tests/models/onnx/atanh.prototxt diff --git a/src/core/tests/models/onnx/aten_embedding_sum_many_outputs.prototxt b/src/core/tests/models/onnx/aten_embedding_sum_many_outputs.prototxt new file mode 100644 index 00000000000..c89bd70373e --- /dev/null +++ b/src/core/tests/models/onnx/aten_embedding_sum_many_outputs.prototxt @@ -0,0 +1,96 @@ +ir_version: 3 +producer_name: "onnx_import_test" +graph { + node { + input: "emb_tbl" + input: "indices" + input: "offsets" + output: "result_0" + output: "result_1" + output: "result_2" + output: "result_3" + op_type: "ATen" + attribute { + name: "mode" + i: 0 + type: INT + } + attribute { + name: "operator" + s: "embedding_bag" + type: STRING + } + attribute { + name: "scale_grad_by_freq" + i: 0 + type: INT + } + attribute { + name: "sparse" + i: 1 + type: INT + } + } + name: "test_aten_model" + input { + name: "emb_tbl" + type { + tensor_type { + elem_type: 1 + shape { + dim { + dim_value: 5 + } + dim { + dim_value: 2 + } + } + } + } + } + input { + name: "indices" + type { + tensor_type { + elem_type: 6 + shape { + dim { + dim_value: 4 + } + } + } + } + } + input { + name: "offsets" + type { + tensor_type { + elem_type: 6 + shape { + dim { + dim_value: 3 + } + } + } + } + } + output { + name: "result_0" + type { + tensor_type { + elem_type: 1 + shape { + dim { + dim_value: 3 + } + dim { + dim_value: 2 + } + } + } + } + } +} +opset_import { + version: 1 +} diff --git a/src/core/tests/models/onnx/aten_embedding_sum_offset_3in.prototxt b/src/core/tests/models/onnx/aten_embedding_sum_offset_3in.prototxt new file mode 100644 index 00000000000..be788ecde53 --- /dev/null +++ b/src/core/tests/models/onnx/aten_embedding_sum_offset_3in.prototxt @@ -0,0 +1,93 @@ +ir_version: 3 +producer_name: "onnx_import_test" +graph { + node { + input: "emb_tbl" + input: "indices" + input: "offsets" + output: "result_0" + op_type: "ATen" + attribute { + name: "mode" + i: 0 + type: INT + } + attribute { + name: "operator" + s: "embedding_bag" + type: STRING + } + attribute { + name: "scale_grad_by_freq" + i: 0 + type: INT + } + attribute { + name: "sparse" + i: 1 + type: INT + } + } + name: "test_aten_model" + input { + name: "emb_tbl" + type { + tensor_type { + elem_type: 1 + shape { + dim { + dim_value: 5 + } + dim { + dim_value: 2 + } + } + } + } + } + input { + name: "indices" + type { + tensor_type { + elem_type: 6 + shape { + dim { + dim_value: 4 + } + } + } + } + } + input { + name: "offsets" + type { + tensor_type { + elem_type: 6 + shape { + dim { + dim_value: 3 + } + } + } + } + } + output { + name: "result_0" + type { + tensor_type { + elem_type: 1 + shape { + dim { + dim_value: 3 + } + dim { + dim_value: 2 + } + } + } + } + } +} +opset_import { + version: 1 +} diff --git a/src/core/tests/models/onnx/aten_embedding_sum_offset_4in.prototxt b/src/core/tests/models/onnx/aten_embedding_sum_offset_4in.prototxt new file mode 100644 index 00000000000..5e2fe46532c --- /dev/null +++ b/src/core/tests/models/onnx/aten_embedding_sum_offset_4in.prototxt @@ -0,0 +1,107 @@ +ir_version: 3 +producer_name: "onnx_import_test" +graph { + node { + input: "emb_tbl" + input: "indices" + input: "offsets" + input: "per_sample_weights" + output: "result_0" + op_type: "ATen" + attribute { + name: "mode" + i: 0 + type: INT + } + attribute { + name: "operator" + s: "embedding_bag" + type: STRING + } + attribute { + name: "scale_grad_by_freq" + i: 0 + type: INT + } + attribute { + name: "sparse" + i: 1 + type: INT + } + } + name: "test_aten_model" + input { + name: "emb_tbl" + type { + tensor_type { + elem_type: 1 + shape { + dim { + dim_value: 5 + } + dim { + dim_value: 2 + } + } + } + } + } + input { + name: "indices" + type { + tensor_type { + elem_type: 6 + shape { + dim { + dim_value: 4 + } + } + } + } + } + input { + name: "offsets" + type { + tensor_type { + elem_type: 6 + shape { + dim { + dim_value: 3 + } + } + } + } + } + input { + name: "per_sample_weights" + type { + tensor_type { + elem_type: 1 + shape { + dim { + dim_value: 4 + } + } + } + } + } + output { + name: "result_0" + type { + tensor_type { + elem_type: 1 + shape { + dim { + dim_value: 3 + } + dim { + dim_value: 2 + } + } + } + } + } +} +opset_import { + version: 1 +} diff --git a/src/core/tests/models/onnx/aten_embedding_sum_packed_2in.prototxt b/src/core/tests/models/onnx/aten_embedding_sum_packed_2in.prototxt new file mode 100644 index 00000000000..72576cdcbe4 --- /dev/null +++ b/src/core/tests/models/onnx/aten_embedding_sum_packed_2in.prototxt @@ -0,0 +1,82 @@ +ir_version: 3 +producer_name: "onnx_import_test" +graph { + node { + input: "emb_tbl" + input: "indices" + output: "result_0" + op_type: "ATen" + attribute { + name: "mode" + i: 0 + type: INT + } + attribute { + name: "operator" + s: "embedding_bag" + type: STRING + } + attribute { + name: "scale_grad_by_freq" + i: 0 + type: INT + } + attribute { + name: "sparse" + i: 1 + type: INT + } + } + name: "test_aten_model" + input { + name: "emb_tbl" + type { + tensor_type { + elem_type: 1 + shape { + dim { + dim_value: 5 + } + dim { + dim_value: 2 + } + } + } + } + } + input { + name: "indices" + type { + tensor_type { + elem_type: 6 + shape { + dim { + dim_value: 3 + } + dim { + dim_value: 2 + } + } + } + } + } + output { + name: "result_0" + type { + tensor_type { + elem_type: 1 + shape { + dim { + dim_value: 3 + } + dim { + dim_value: 2 + } + } + } + } + } +} +opset_import { + version: 1 +} diff --git a/src/core/tests/models/onnx/aten_embedding_sum_packed_3in_offset_none.prototxt b/src/core/tests/models/onnx/aten_embedding_sum_packed_3in_offset_none.prototxt new file mode 100644 index 00000000000..6f25b45f6f2 --- /dev/null +++ b/src/core/tests/models/onnx/aten_embedding_sum_packed_3in_offset_none.prototxt @@ -0,0 +1,83 @@ +ir_version: 3 +producer_name: "onnx_import_test" +graph { + node { + input: "emb_tbl" + input: "indices" + input: "" + output: "result_0" + op_type: "ATen" + attribute { + name: "mode" + i: 0 + type: INT + } + attribute { + name: "operator" + s: "embedding_bag" + type: STRING + } + attribute { + name: "scale_grad_by_freq" + i: 0 + type: INT + } + attribute { + name: "sparse" + i: 1 + type: INT + } + } + name: "test_aten_model" + input { + name: "emb_tbl" + type { + tensor_type { + elem_type: 1 + shape { + dim { + dim_value: 5 + } + dim { + dim_value: 2 + } + } + } + } + } + input { + name: "indices" + type { + tensor_type { + elem_type: 6 + shape { + dim { + dim_value: 3 + } + dim { + dim_value: 2 + } + } + } + } + } + output { + name: "result_0" + type { + tensor_type { + elem_type: 1 + shape { + dim { + dim_value: 3 + } + dim { + dim_value: 2 + } + } + } + } + } +} +opset_import { + version: 1 +} diff --git a/src/core/tests/models/onnx/aten_embedding_sum_packed_4in_per_sample_weights.prototxt b/src/core/tests/models/onnx/aten_embedding_sum_packed_4in_per_sample_weights.prototxt new file mode 100644 index 00000000000..bc15c5b616d --- /dev/null +++ b/src/core/tests/models/onnx/aten_embedding_sum_packed_4in_per_sample_weights.prototxt @@ -0,0 +1,100 @@ +ir_version: 3 +producer_name: "onnx_import_test" +graph { + node { + input: "emb_tbl" + input: "indices" + input: "" + input: "per_sample_weights" + output: "result_0" + op_type: "ATen" + attribute { + name: "mode" + i: 0 + type: INT + } + attribute { + name: "operator" + s: "embedding_bag" + type: STRING + } + attribute { + name: "scale_grad_by_freq" + i: 0 + type: INT + } + attribute { + name: "sparse" + i: 1 + type: INT + } + } + name: "test_aten_model" + input { + name: "emb_tbl" + type { + tensor_type { + elem_type: 1 + shape { + dim { + dim_value: 5 + } + dim { + dim_value: 2 + } + } + } + } + } + input { + name: "indices" + type { + tensor_type { + elem_type: 6 + shape { + dim { + dim_value: 3 + } + dim { + dim_value: 2 + } + } + } + } + } + input { + name: "per_sample_weights" + type { + tensor_type { + elem_type: 1 + shape { + dim { + dim_value: 3 + } + dim { + dim_value: 2 + } + } + } + } + } + output { + name: "result_0" + type { + tensor_type { + elem_type: 1 + shape { + dim { + dim_value: 3 + } + dim { + dim_value: 2 + } + } + } + } + } +} +opset_import { + version: 1 +} diff --git a/src/core/tests/models/onnx/aten_embedding_sum_packed_4in_two_none.prototxt b/src/core/tests/models/onnx/aten_embedding_sum_packed_4in_two_none.prototxt new file mode 100644 index 00000000000..74f0576e90e --- /dev/null +++ b/src/core/tests/models/onnx/aten_embedding_sum_packed_4in_two_none.prototxt @@ -0,0 +1,84 @@ +ir_version: 3 +producer_name: "onnx_import_test" +graph { + node { + input: "emb_tbl" + input: "indices" + input: "" + input: "" + output: "result_0" + op_type: "ATen" + attribute { + name: "mode" + i: 0 + type: INT + } + attribute { + name: "operator" + s: "embedding_bag" + type: STRING + } + attribute { + name: "scale_grad_by_freq" + i: 0 + type: INT + } + attribute { + name: "sparse" + i: 1 + type: INT + } + } + name: "test_aten_model" + input { + name: "emb_tbl" + type { + tensor_type { + elem_type: 1 + shape { + dim { + dim_value: 5 + } + dim { + dim_value: 2 + } + } + } + } + } + input { + name: "indices" + type { + tensor_type { + elem_type: 6 + shape { + dim { + dim_value: 3 + } + dim { + dim_value: 2 + } + } + } + } + } + output { + name: "result_0" + type { + tensor_type { + elem_type: 1 + shape { + dim { + dim_value: 3 + } + dim { + dim_value: 2 + } + } + } + } + } +} +opset_import { + version: 1 +} diff --git a/src/core/tests/models/onnx/aten_unsupported_embedding_mode.prototxt b/src/core/tests/models/onnx/aten_unsupported_embedding_mode.prototxt new file mode 100644 index 00000000000..e83c561c2c6 --- /dev/null +++ b/src/core/tests/models/onnx/aten_unsupported_embedding_mode.prototxt @@ -0,0 +1,93 @@ +ir_version: 3 +producer_name: "onnx_import_test" +graph { + node { + input: "emb_tbl" + input: "indices" + input: "offsets" + output: "result_0" + op_type: "ATen" + attribute { + name: "mode" + i: 1 + type: INT + } + attribute { + name: "operator" + s: "embedding_bag" + type: STRING + } + attribute { + name: "scale_grad_by_freq" + i: 0 + type: INT + } + attribute { + name: "sparse" + i: 1 + type: INT + } + } + name: "test_aten_model" + input { + name: "emb_tbl" + type { + tensor_type { + elem_type: 1 + shape { + dim { + dim_value: 5 + } + dim { + dim_value: 2 + } + } + } + } + } + input { + name: "indices" + type { + tensor_type { + elem_type: 6 + shape { + dim { + dim_value: 4 + } + } + } + } + } + input { + name: "offsets" + type { + tensor_type { + elem_type: 6 + shape { + dim { + dim_value: 3 + } + } + } + } + } + output { + name: "result_0" + type { + tensor_type { + elem_type: 1 + shape { + dim { + dim_value: 3 + } + dim { + dim_value: 2 + } + } + } + } + } +} +opset_import { + version: 1 +} diff --git a/src/core/tests/models/onnx/aten_unsupported_operator.prototxt b/src/core/tests/models/onnx/aten_unsupported_operator.prototxt new file mode 100644 index 00000000000..95139fef850 --- /dev/null +++ b/src/core/tests/models/onnx/aten_unsupported_operator.prototxt @@ -0,0 +1,93 @@ +ir_version: 3 +producer_name: "onnx_import_test" +graph { + node { + input: "emb_tbl" + input: "indices" + input: "offsets" + output: "result_0" + op_type: "ATen" + attribute { + name: "mode" + i: 1 + type: INT + } + attribute { + name: "operator" + s: "test_unsupported_operator" + type: STRING + } + attribute { + name: "scale_grad_by_freq" + i: 0 + type: INT + } + attribute { + name: "sparse" + i: 1 + type: INT + } + } + name: "test_aten_model" + input { + name: "emb_tbl" + type { + tensor_type { + elem_type: 1 + shape { + dim { + dim_value: 5 + } + dim { + dim_value: 2 + } + } + } + } + } + input { + name: "indices" + type { + tensor_type { + elem_type: 6 + shape { + dim { + dim_value: 4 + } + } + } + } + } + input { + name: "offsets" + type { + tensor_type { + elem_type: 6 + shape { + dim { + dim_value: 3 + } + } + } + } + } + output { + name: "result_0" + type { + tensor_type { + elem_type: 1 + shape { + dim { + dim_value: 3 + } + dim { + dim_value: 2 + } + } + } + } + } +} +opset_import { + version: 1 +} diff --git a/ngraph/test/models/onnx/average_pool_2d.prototxt b/src/core/tests/models/onnx/average_pool_2d.prototxt similarity index 100% rename from ngraph/test/models/onnx/average_pool_2d.prototxt rename to src/core/tests/models/onnx/average_pool_2d.prototxt diff --git a/ngraph/test/models/onnx/average_pool_2d_pads.prototxt b/src/core/tests/models/onnx/average_pool_2d_pads.prototxt similarity index 100% rename from ngraph/test/models/onnx/average_pool_2d_pads.prototxt rename to src/core/tests/models/onnx/average_pool_2d_pads.prototxt diff --git a/ngraph/test/models/onnx/batchnorm_default.prototxt b/src/core/tests/models/onnx/batchnorm_default.prototxt similarity index 100% rename from ngraph/test/models/onnx/batchnorm_default.prototxt rename to src/core/tests/models/onnx/batchnorm_default.prototxt diff --git a/ngraph/test/models/onnx/bool_const_op.prototxt b/src/core/tests/models/onnx/bool_const_op.prototxt similarity index 100% rename from ngraph/test/models/onnx/bool_const_op.prototxt rename to src/core/tests/models/onnx/bool_const_op.prototxt diff --git a/ngraph/test/models/onnx/bool_init_and.prototxt b/src/core/tests/models/onnx/bool_init_and.prototxt similarity index 100% rename from ngraph/test/models/onnx/bool_init_and.prototxt rename to src/core/tests/models/onnx/bool_init_and.prototxt diff --git a/ngraph/test/models/onnx/bool_init_raw.prototxt b/src/core/tests/models/onnx/bool_init_raw.prototxt similarity index 100% rename from ngraph/test/models/onnx/bool_init_raw.prototxt rename to src/core/tests/models/onnx/bool_init_raw.prototxt diff --git a/ngraph/test/models/onnx/bool_input_or.prototxt b/src/core/tests/models/onnx/bool_input_or.prototxt similarity index 100% rename from ngraph/test/models/onnx/bool_input_or.prototxt rename to src/core/tests/models/onnx/bool_input_or.prototxt diff --git a/ngraph/test/models/onnx/clip_no_min_no_max.prototxt b/src/core/tests/models/onnx/clip_no_min_no_max.prototxt similarity index 100% rename from ngraph/test/models/onnx/clip_no_min_no_max.prototxt rename to src/core/tests/models/onnx/clip_no_min_no_max.prototxt diff --git a/ngraph/test/models/onnx/clip_no_min_no_max_int64.prototxt b/src/core/tests/models/onnx/clip_no_min_no_max_int64.prototxt similarity index 100% rename from ngraph/test/models/onnx/clip_no_min_no_max_int64.prototxt rename to src/core/tests/models/onnx/clip_no_min_no_max_int64.prototxt diff --git a/ngraph/test/models/onnx/clip_no_min_set_max.prototxt b/src/core/tests/models/onnx/clip_no_min_set_max.prototxt similarity index 100% rename from ngraph/test/models/onnx/clip_no_min_set_max.prototxt rename to src/core/tests/models/onnx/clip_no_min_set_max.prototxt diff --git a/ngraph/test/models/onnx/clip_no_min_set_max_int64.prototxt b/src/core/tests/models/onnx/clip_no_min_set_max_int64.prototxt similarity index 100% rename from ngraph/test/models/onnx/clip_no_min_set_max_int64.prototxt rename to src/core/tests/models/onnx/clip_no_min_set_max_int64.prototxt diff --git a/ngraph/test/models/onnx/clip_set_min_no_max.prototxt b/src/core/tests/models/onnx/clip_set_min_no_max.prototxt similarity index 100% rename from ngraph/test/models/onnx/clip_set_min_no_max.prototxt rename to src/core/tests/models/onnx/clip_set_min_no_max.prototxt diff --git a/ngraph/test/models/onnx/clip_set_min_no_max_initializers.prototxt b/src/core/tests/models/onnx/clip_set_min_no_max_initializers.prototxt similarity index 100% rename from ngraph/test/models/onnx/clip_set_min_no_max_initializers.prototxt rename to src/core/tests/models/onnx/clip_set_min_no_max_initializers.prototxt diff --git a/ngraph/test/models/onnx/clip_set_min_set_max.prototxt b/src/core/tests/models/onnx/clip_set_min_set_max.prototxt similarity index 100% rename from ngraph/test/models/onnx/clip_set_min_set_max.prototxt rename to src/core/tests/models/onnx/clip_set_min_set_max.prototxt diff --git a/ngraph/test/models/onnx/clip_set_min_set_max_initializers.prototxt b/src/core/tests/models/onnx/clip_set_min_set_max_initializers.prototxt similarity index 100% rename from ngraph/test/models/onnx/clip_set_min_set_max_initializers.prototxt rename to src/core/tests/models/onnx/clip_set_min_set_max_initializers.prototxt diff --git a/ngraph/test/models/onnx/com.microsoft/attention.prototxt b/src/core/tests/models/onnx/com.microsoft/attention.prototxt similarity index 100% rename from ngraph/test/models/onnx/com.microsoft/attention.prototxt rename to src/core/tests/models/onnx/com.microsoft/attention.prototxt diff --git a/ngraph/test/models/onnx/com.microsoft/attention_dynamic_shapes.prototxt b/src/core/tests/models/onnx/com.microsoft/attention_dynamic_shapes.prototxt similarity index 100% rename from ngraph/test/models/onnx/com.microsoft/attention_dynamic_shapes.prototxt rename to src/core/tests/models/onnx/com.microsoft/attention_dynamic_shapes.prototxt diff --git a/ngraph/test/models/onnx/com.microsoft/attention_extra_add.prototxt b/src/core/tests/models/onnx/com.microsoft/attention_extra_add.prototxt similarity index 100% rename from ngraph/test/models/onnx/com.microsoft/attention_extra_add.prototxt rename to src/core/tests/models/onnx/com.microsoft/attention_extra_add.prototxt diff --git a/ngraph/test/models/onnx/com.microsoft/attention_mask_index_1.prototxt b/src/core/tests/models/onnx/com.microsoft/attention_mask_index_1.prototxt similarity index 100% rename from ngraph/test/models/onnx/com.microsoft/attention_mask_index_1.prototxt rename to src/core/tests/models/onnx/com.microsoft/attention_mask_index_1.prototxt diff --git a/ngraph/test/models/onnx/com.microsoft/attention_mask_index_2.prototxt b/src/core/tests/models/onnx/com.microsoft/attention_mask_index_2.prototxt similarity index 100% rename from ngraph/test/models/onnx/com.microsoft/attention_mask_index_2.prototxt rename to src/core/tests/models/onnx/com.microsoft/attention_mask_index_2.prototxt diff --git a/ngraph/test/models/onnx/com.microsoft/attention_mask_index_3.prototxt b/src/core/tests/models/onnx/com.microsoft/attention_mask_index_3.prototxt similarity index 100% rename from ngraph/test/models/onnx/com.microsoft/attention_mask_index_3.prototxt rename to src/core/tests/models/onnx/com.microsoft/attention_mask_index_3.prototxt diff --git a/ngraph/test/models/onnx/com.microsoft/attention_mask_index_4.prototxt b/src/core/tests/models/onnx/com.microsoft/attention_mask_index_4.prototxt similarity index 100% rename from ngraph/test/models/onnx/com.microsoft/attention_mask_index_4.prototxt rename to src/core/tests/models/onnx/com.microsoft/attention_mask_index_4.prototxt diff --git a/ngraph/test/models/onnx/com.microsoft/attention_past.prototxt b/src/core/tests/models/onnx/com.microsoft/attention_past.prototxt similarity index 100% rename from ngraph/test/models/onnx/com.microsoft/attention_past.prototxt rename to src/core/tests/models/onnx/com.microsoft/attention_past.prototxt diff --git a/ngraph/test/models/onnx/com.microsoft/attention_qkv_hidden_sizes.prototxt b/src/core/tests/models/onnx/com.microsoft/attention_qkv_hidden_sizes.prototxt similarity index 100% rename from ngraph/test/models/onnx/com.microsoft/attention_qkv_hidden_sizes.prototxt rename to src/core/tests/models/onnx/com.microsoft/attention_qkv_hidden_sizes.prototxt diff --git a/ngraph/test/models/onnx/com.microsoft/attention_unidirectional.prototxt b/src/core/tests/models/onnx/com.microsoft/attention_unidirectional.prototxt similarity index 100% rename from ngraph/test/models/onnx/com.microsoft/attention_unidirectional.prototxt rename to src/core/tests/models/onnx/com.microsoft/attention_unidirectional.prototxt diff --git a/ngraph/test/models/onnx/com.microsoft/bias_gelu.prototxt b/src/core/tests/models/onnx/com.microsoft/bias_gelu.prototxt similarity index 100% rename from ngraph/test/models/onnx/com.microsoft/bias_gelu.prototxt rename to src/core/tests/models/onnx/com.microsoft/bias_gelu.prototxt diff --git a/ngraph/test/models/onnx/com.microsoft/embed_layer_normalization.prototxt b/src/core/tests/models/onnx/com.microsoft/embed_layer_normalization.prototxt similarity index 100% rename from ngraph/test/models/onnx/com.microsoft/embed_layer_normalization.prototxt rename to src/core/tests/models/onnx/com.microsoft/embed_layer_normalization.prototxt diff --git a/ngraph/test/models/onnx/com.microsoft/embed_layer_normalization_dynamic_shapes.prototxt b/src/core/tests/models/onnx/com.microsoft/embed_layer_normalization_dynamic_shapes.prototxt similarity index 100% rename from ngraph/test/models/onnx/com.microsoft/embed_layer_normalization_dynamic_shapes.prototxt rename to src/core/tests/models/onnx/com.microsoft/embed_layer_normalization_dynamic_shapes.prototxt diff --git a/ngraph/test/models/onnx/com.microsoft/embed_layer_normalization_with_segment_embedding.prototxt b/src/core/tests/models/onnx/com.microsoft/embed_layer_normalization_with_segment_embedding.prototxt similarity index 100% rename from ngraph/test/models/onnx/com.microsoft/embed_layer_normalization_with_segment_embedding.prototxt rename to src/core/tests/models/onnx/com.microsoft/embed_layer_normalization_with_segment_embedding.prototxt diff --git a/ngraph/test/models/onnx/com.microsoft/embed_layer_normalization_with_segment_embedding_and_mask.prototxt b/src/core/tests/models/onnx/com.microsoft/embed_layer_normalization_with_segment_embedding_and_mask.prototxt similarity index 100% rename from ngraph/test/models/onnx/com.microsoft/embed_layer_normalization_with_segment_embedding_and_mask.prototxt rename to src/core/tests/models/onnx/com.microsoft/embed_layer_normalization_with_segment_embedding_and_mask.prototxt diff --git a/ngraph/test/models/onnx/com.microsoft/skip_layer_normalization_dynamic_shapes.prototxt b/src/core/tests/models/onnx/com.microsoft/skip_layer_normalization_dynamic_shapes.prototxt similarity index 100% rename from ngraph/test/models/onnx/com.microsoft/skip_layer_normalization_dynamic_shapes.prototxt rename to src/core/tests/models/onnx/com.microsoft/skip_layer_normalization_dynamic_shapes.prototxt diff --git a/ngraph/test/models/onnx/com.microsoft/skip_layer_normalization_with_gamma.prototxt b/src/core/tests/models/onnx/com.microsoft/skip_layer_normalization_with_gamma.prototxt similarity index 100% rename from ngraph/test/models/onnx/com.microsoft/skip_layer_normalization_with_gamma.prototxt rename to src/core/tests/models/onnx/com.microsoft/skip_layer_normalization_with_gamma.prototxt diff --git a/ngraph/test/models/onnx/com.microsoft/skip_layer_normalization_with_gamma_beta.prototxt b/src/core/tests/models/onnx/com.microsoft/skip_layer_normalization_with_gamma_beta.prototxt similarity index 100% rename from ngraph/test/models/onnx/com.microsoft/skip_layer_normalization_with_gamma_beta.prototxt rename to src/core/tests/models/onnx/com.microsoft/skip_layer_normalization_with_gamma_beta.prototxt diff --git a/ngraph/test/models/onnx/com.microsoft/skip_layer_normalization_with_gamma_beta_bias.prototxt b/src/core/tests/models/onnx/com.microsoft/skip_layer_normalization_with_gamma_beta_bias.prototxt similarity index 100% rename from ngraph/test/models/onnx/com.microsoft/skip_layer_normalization_with_gamma_beta_bias.prototxt rename to src/core/tests/models/onnx/com.microsoft/skip_layer_normalization_with_gamma_beta_bias.prototxt diff --git a/ngraph/test/models/onnx/compress_0.prototxt b/src/core/tests/models/onnx/compress_0.prototxt similarity index 100% rename from ngraph/test/models/onnx/compress_0.prototxt rename to src/core/tests/models/onnx/compress_0.prototxt diff --git a/ngraph/test/models/onnx/compress_1.prototxt b/src/core/tests/models/onnx/compress_1.prototxt similarity index 100% rename from ngraph/test/models/onnx/compress_1.prototxt rename to src/core/tests/models/onnx/compress_1.prototxt diff --git a/ngraph/test/models/onnx/compress_default_axis.prototxt b/src/core/tests/models/onnx/compress_default_axis.prototxt similarity index 100% rename from ngraph/test/models/onnx/compress_default_axis.prototxt rename to src/core/tests/models/onnx/compress_default_axis.prototxt diff --git a/ngraph/test/models/onnx/compress_negative_axis.prototxt b/src/core/tests/models/onnx/compress_negative_axis.prototxt similarity index 100% rename from ngraph/test/models/onnx/compress_negative_axis.prototxt rename to src/core/tests/models/onnx/compress_negative_axis.prototxt diff --git a/ngraph/test/models/onnx/concat.prototxt b/src/core/tests/models/onnx/concat.prototxt similarity index 100% rename from ngraph/test/models/onnx/concat.prototxt rename to src/core/tests/models/onnx/concat.prototxt diff --git a/ngraph/test/models/onnx/concat_negative_axis.prototxt b/src/core/tests/models/onnx/concat_negative_axis.prototxt similarity index 100% rename from ngraph/test/models/onnx/concat_negative_axis.prototxt rename to src/core/tests/models/onnx/concat_negative_axis.prototxt diff --git a/ngraph/test/models/onnx/constant_bfloat_tensor.prototxt b/src/core/tests/models/onnx/constant_bfloat_tensor.prototxt similarity index 100% rename from ngraph/test/models/onnx/constant_bfloat_tensor.prototxt rename to src/core/tests/models/onnx/constant_bfloat_tensor.prototxt diff --git a/ngraph/test/models/onnx/constant_fill_extra_shape.prototxt b/src/core/tests/models/onnx/constant_fill_extra_shape.prototxt similarity index 100% rename from ngraph/test/models/onnx/constant_fill_extra_shape.prototxt rename to src/core/tests/models/onnx/constant_fill_extra_shape.prototxt diff --git a/ngraph/test/models/onnx/constant_fill_input_as_shape_default_value.prototxt b/src/core/tests/models/onnx/constant_fill_input_as_shape_default_value.prototxt similarity index 100% rename from ngraph/test/models/onnx/constant_fill_input_as_shape_default_value.prototxt rename to src/core/tests/models/onnx/constant_fill_input_as_shape_default_value.prototxt diff --git a/ngraph/test/models/onnx/constant_fill_input_as_shape_u8_type.prototxt b/src/core/tests/models/onnx/constant_fill_input_as_shape_u8_type.prototxt similarity index 100% rename from ngraph/test/models/onnx/constant_fill_input_as_shape_u8_type.prototxt rename to src/core/tests/models/onnx/constant_fill_input_as_shape_u8_type.prototxt diff --git a/ngraph/test/models/onnx/constant_fill_shape_attribute.prototxt b/src/core/tests/models/onnx/constant_fill_shape_attribute.prototxt similarity index 100% rename from ngraph/test/models/onnx/constant_fill_shape_attribute.prototxt rename to src/core/tests/models/onnx/constant_fill_shape_attribute.prototxt diff --git a/ngraph/test/models/onnx/constant_float_array.prototxt b/src/core/tests/models/onnx/constant_float_array.prototxt similarity index 100% rename from ngraph/test/models/onnx/constant_float_array.prototxt rename to src/core/tests/models/onnx/constant_float_array.prototxt diff --git a/ngraph/test/models/onnx/constant_float_scalar.prototxt b/src/core/tests/models/onnx/constant_float_scalar.prototxt similarity index 100% rename from ngraph/test/models/onnx/constant_float_scalar.prototxt rename to src/core/tests/models/onnx/constant_float_scalar.prototxt diff --git a/ngraph/test/models/onnx/constant_float_tensor.prototxt b/src/core/tests/models/onnx/constant_float_tensor.prototxt similarity index 100% rename from ngraph/test/models/onnx/constant_float_tensor.prototxt rename to src/core/tests/models/onnx/constant_float_tensor.prototxt diff --git a/ngraph/test/models/onnx/constant_integer_array.prototxt b/src/core/tests/models/onnx/constant_integer_array.prototxt similarity index 100% rename from ngraph/test/models/onnx/constant_integer_array.prototxt rename to src/core/tests/models/onnx/constant_integer_array.prototxt diff --git a/ngraph/test/models/onnx/constant_integer_scalar.prototxt b/src/core/tests/models/onnx/constant_integer_scalar.prototxt similarity index 100% rename from ngraph/test/models/onnx/constant_integer_scalar.prototxt rename to src/core/tests/models/onnx/constant_integer_scalar.prototxt diff --git a/ngraph/test/models/onnx/constant_sparse_tensor.prototxt b/src/core/tests/models/onnx/constant_sparse_tensor.prototxt similarity index 100% rename from ngraph/test/models/onnx/constant_sparse_tensor.prototxt rename to src/core/tests/models/onnx/constant_sparse_tensor.prototxt diff --git a/ngraph/test/models/onnx/constant_sparse_tensor_bfloat16_3x4.prototxt b/src/core/tests/models/onnx/constant_sparse_tensor_bfloat16_3x4.prototxt similarity index 100% rename from ngraph/test/models/onnx/constant_sparse_tensor_bfloat16_3x4.prototxt rename to src/core/tests/models/onnx/constant_sparse_tensor_bfloat16_3x4.prototxt diff --git a/ngraph/test/models/onnx/constant_sparse_tensor_boolean_3x4.prototxt b/src/core/tests/models/onnx/constant_sparse_tensor_boolean_3x4.prototxt similarity index 100% rename from ngraph/test/models/onnx/constant_sparse_tensor_boolean_3x4.prototxt rename to src/core/tests/models/onnx/constant_sparse_tensor_boolean_3x4.prototxt diff --git a/ngraph/test/models/onnx/constant_sparse_tensor_double_3x4.prototxt b/src/core/tests/models/onnx/constant_sparse_tensor_double_3x4.prototxt similarity index 100% rename from ngraph/test/models/onnx/constant_sparse_tensor_double_3x4.prototxt rename to src/core/tests/models/onnx/constant_sparse_tensor_double_3x4.prototxt diff --git a/ngraph/test/models/onnx/constant_sparse_tensor_float16_3x4.prototxt b/src/core/tests/models/onnx/constant_sparse_tensor_float16_3x4.prototxt similarity index 100% rename from ngraph/test/models/onnx/constant_sparse_tensor_float16_3x4.prototxt rename to src/core/tests/models/onnx/constant_sparse_tensor_float16_3x4.prototxt diff --git a/ngraph/test/models/onnx/constant_sparse_tensor_float_2x2x3x4.prototxt b/src/core/tests/models/onnx/constant_sparse_tensor_float_2x2x3x4.prototxt similarity index 100% rename from ngraph/test/models/onnx/constant_sparse_tensor_float_2x2x3x4.prototxt rename to src/core/tests/models/onnx/constant_sparse_tensor_float_2x2x3x4.prototxt diff --git a/ngraph/test/models/onnx/constant_sparse_tensor_float_2x3x4.prototxt b/src/core/tests/models/onnx/constant_sparse_tensor_float_2x3x4.prototxt similarity index 100% rename from ngraph/test/models/onnx/constant_sparse_tensor_float_2x3x4.prototxt rename to src/core/tests/models/onnx/constant_sparse_tensor_float_2x3x4.prototxt diff --git a/ngraph/test/models/onnx/constant_sparse_tensor_float_3x4.prototxt b/src/core/tests/models/onnx/constant_sparse_tensor_float_3x4.prototxt similarity index 100% rename from ngraph/test/models/onnx/constant_sparse_tensor_float_3x4.prototxt rename to src/core/tests/models/onnx/constant_sparse_tensor_float_3x4.prototxt diff --git a/ngraph/test/models/onnx/constant_sparse_tensor_float_3x4_linearized_indices.prototxt b/src/core/tests/models/onnx/constant_sparse_tensor_float_3x4_linearized_indices.prototxt similarity index 100% rename from ngraph/test/models/onnx/constant_sparse_tensor_float_3x4_linearized_indices.prototxt rename to src/core/tests/models/onnx/constant_sparse_tensor_float_3x4_linearized_indices.prototxt diff --git a/ngraph/test/models/onnx/constant_sparse_tensor_float_8x17.prototxt b/src/core/tests/models/onnx/constant_sparse_tensor_float_8x17.prototxt similarity index 100% rename from ngraph/test/models/onnx/constant_sparse_tensor_float_8x17.prototxt rename to src/core/tests/models/onnx/constant_sparse_tensor_float_8x17.prototxt diff --git a/ngraph/test/models/onnx/constant_sparse_tensor_int16_3x4.prototxt b/src/core/tests/models/onnx/constant_sparse_tensor_int16_3x4.prototxt similarity index 100% rename from ngraph/test/models/onnx/constant_sparse_tensor_int16_3x4.prototxt rename to src/core/tests/models/onnx/constant_sparse_tensor_int16_3x4.prototxt diff --git a/ngraph/test/models/onnx/constant_sparse_tensor_int32_3x4.prototxt b/src/core/tests/models/onnx/constant_sparse_tensor_int32_3x4.prototxt similarity index 100% rename from ngraph/test/models/onnx/constant_sparse_tensor_int32_3x4.prototxt rename to src/core/tests/models/onnx/constant_sparse_tensor_int32_3x4.prototxt diff --git a/ngraph/test/models/onnx/constant_sparse_tensor_int64_3x4.prototxt b/src/core/tests/models/onnx/constant_sparse_tensor_int64_3x4.prototxt similarity index 100% rename from ngraph/test/models/onnx/constant_sparse_tensor_int64_3x4.prototxt rename to src/core/tests/models/onnx/constant_sparse_tensor_int64_3x4.prototxt diff --git a/ngraph/test/models/onnx/constant_sparse_tensor_int8_3x4.prototxt b/src/core/tests/models/onnx/constant_sparse_tensor_int8_3x4.prototxt similarity index 100% rename from ngraph/test/models/onnx/constant_sparse_tensor_int8_3x4.prototxt rename to src/core/tests/models/onnx/constant_sparse_tensor_int8_3x4.prototxt diff --git a/ngraph/test/models/onnx/constant_sparse_tensor_uint16_3x4.prototxt b/src/core/tests/models/onnx/constant_sparse_tensor_uint16_3x4.prototxt similarity index 100% rename from ngraph/test/models/onnx/constant_sparse_tensor_uint16_3x4.prototxt rename to src/core/tests/models/onnx/constant_sparse_tensor_uint16_3x4.prototxt diff --git a/ngraph/test/models/onnx/constant_sparse_tensor_uint32_3x4.prototxt b/src/core/tests/models/onnx/constant_sparse_tensor_uint32_3x4.prototxt similarity index 100% rename from ngraph/test/models/onnx/constant_sparse_tensor_uint32_3x4.prototxt rename to src/core/tests/models/onnx/constant_sparse_tensor_uint32_3x4.prototxt diff --git a/ngraph/test/models/onnx/constant_sparse_tensor_uint64_3x4.prototxt b/src/core/tests/models/onnx/constant_sparse_tensor_uint64_3x4.prototxt similarity index 100% rename from ngraph/test/models/onnx/constant_sparse_tensor_uint64_3x4.prototxt rename to src/core/tests/models/onnx/constant_sparse_tensor_uint64_3x4.prototxt diff --git a/ngraph/test/models/onnx/constant_sparse_tensor_uint8_3x4.prototxt b/src/core/tests/models/onnx/constant_sparse_tensor_uint8_3x4.prototxt similarity index 100% rename from ngraph/test/models/onnx/constant_sparse_tensor_uint8_3x4.prototxt rename to src/core/tests/models/onnx/constant_sparse_tensor_uint8_3x4.prototxt diff --git a/ngraph/test/models/onnx/controlflow/if_branches_with_different_inputs.prototxt b/src/core/tests/models/onnx/controlflow/if_branches_with_different_inputs.prototxt similarity index 100% rename from ngraph/test/models/onnx/controlflow/if_branches_with_different_inputs.prototxt rename to src/core/tests/models/onnx/controlflow/if_branches_with_different_inputs.prototxt diff --git a/ngraph/test/models/onnx/controlflow/if_branches_with_multiple_outputs.prototxt b/src/core/tests/models/onnx/controlflow/if_branches_with_multiple_outputs.prototxt similarity index 100% rename from ngraph/test/models/onnx/controlflow/if_branches_with_multiple_outputs.prototxt rename to src/core/tests/models/onnx/controlflow/if_branches_with_multiple_outputs.prototxt diff --git a/ngraph/test/models/onnx/controlflow/if_branches_with_same_inputs.prototxt b/src/core/tests/models/onnx/controlflow/if_branches_with_same_inputs.prototxt similarity index 100% rename from ngraph/test/models/onnx/controlflow/if_branches_with_same_inputs.prototxt rename to src/core/tests/models/onnx/controlflow/if_branches_with_same_inputs.prototxt diff --git a/ngraph/test/models/onnx/controlflow/if_branches_without_inputs.prototxt b/src/core/tests/models/onnx/controlflow/if_branches_without_inputs.prototxt similarity index 100% rename from ngraph/test/models/onnx/controlflow/if_branches_without_inputs.prototxt rename to src/core/tests/models/onnx/controlflow/if_branches_without_inputs.prototxt diff --git a/ngraph/test/models/onnx/controlflow/if_dynamic_inputs.prototxt b/src/core/tests/models/onnx/controlflow/if_dynamic_inputs.prototxt similarity index 100% rename from ngraph/test/models/onnx/controlflow/if_dynamic_inputs.prototxt rename to src/core/tests/models/onnx/controlflow/if_dynamic_inputs.prototxt diff --git a/ngraph/test/models/onnx/controlflow/if_inside_if.prototxt b/src/core/tests/models/onnx/controlflow/if_inside_if.prototxt similarity index 100% rename from ngraph/test/models/onnx/controlflow/if_inside_if.prototxt rename to src/core/tests/models/onnx/controlflow/if_inside_if.prototxt diff --git a/ngraph/test/models/onnx/controlflow/if_inside_loop.prototxt b/src/core/tests/models/onnx/controlflow/if_inside_loop.prototxt similarity index 100% rename from ngraph/test/models/onnx/controlflow/if_inside_loop.prototxt rename to src/core/tests/models/onnx/controlflow/if_inside_loop.prototxt diff --git a/ngraph/test/models/onnx/controlflow/if_missing_else_branch.prototxt b/src/core/tests/models/onnx/controlflow/if_missing_else_branch.prototxt similarity index 100% rename from ngraph/test/models/onnx/controlflow/if_missing_else_branch.prototxt rename to src/core/tests/models/onnx/controlflow/if_missing_else_branch.prototxt diff --git a/ngraph/test/models/onnx/controlflow/if_missing_then_branch.prototxt b/src/core/tests/models/onnx/controlflow/if_missing_then_branch.prototxt similarity index 100% rename from ngraph/test/models/onnx/controlflow/if_missing_then_branch.prototxt rename to src/core/tests/models/onnx/controlflow/if_missing_then_branch.prototxt diff --git a/ngraph/test/models/onnx/controlflow/if_negative_mismatch_between_branches_output.prototxt b/src/core/tests/models/onnx/controlflow/if_negative_mismatch_between_branches_output.prototxt similarity index 100% rename from ngraph/test/models/onnx/controlflow/if_negative_mismatch_between_branches_output.prototxt rename to src/core/tests/models/onnx/controlflow/if_negative_mismatch_between_branches_output.prototxt diff --git a/ngraph/test/models/onnx/controlflow/loop_2d_add.prototxt b/src/core/tests/models/onnx/controlflow/loop_2d_add.prototxt similarity index 100% rename from ngraph/test/models/onnx/controlflow/loop_2d_add.prototxt rename to src/core/tests/models/onnx/controlflow/loop_2d_add.prototxt diff --git a/ngraph/test/models/onnx/controlflow/loop_2d_add_cond_and_trip_count_as_inputs.prototxt b/src/core/tests/models/onnx/controlflow/loop_2d_add_cond_and_trip_count_as_inputs.prototxt similarity index 100% rename from ngraph/test/models/onnx/controlflow/loop_2d_add_cond_and_trip_count_as_inputs.prototxt rename to src/core/tests/models/onnx/controlflow/loop_2d_add_cond_and_trip_count_as_inputs.prototxt diff --git a/ngraph/test/models/onnx/controlflow/loop_2d_add_cond_and_trip_count_as_inputs_static_shapes.prototxt b/src/core/tests/models/onnx/controlflow/loop_2d_add_cond_and_trip_count_as_inputs_static_shapes.prototxt similarity index 100% rename from ngraph/test/models/onnx/controlflow/loop_2d_add_cond_and_trip_count_as_inputs_static_shapes.prototxt rename to src/core/tests/models/onnx/controlflow/loop_2d_add_cond_and_trip_count_as_inputs_static_shapes.prototxt diff --git a/ngraph/test/models/onnx/controlflow/loop_2d_add_const_cond.prototxt b/src/core/tests/models/onnx/controlflow/loop_2d_add_const_cond.prototxt similarity index 100% rename from ngraph/test/models/onnx/controlflow/loop_2d_add_const_cond.prototxt rename to src/core/tests/models/onnx/controlflow/loop_2d_add_const_cond.prototxt diff --git a/ngraph/test/models/onnx/controlflow/loop_2d_add_const_no_identity_termination_cond.prototxt b/src/core/tests/models/onnx/controlflow/loop_2d_add_const_no_identity_termination_cond.prototxt similarity index 100% rename from ngraph/test/models/onnx/controlflow/loop_2d_add_const_no_identity_termination_cond.prototxt rename to src/core/tests/models/onnx/controlflow/loop_2d_add_const_no_identity_termination_cond.prototxt diff --git a/ngraph/test/models/onnx/controlflow/loop_2d_add_const_no_identity_termination_cond_static_shapes.prototxt b/src/core/tests/models/onnx/controlflow/loop_2d_add_const_no_identity_termination_cond_static_shapes.prototxt similarity index 100% rename from ngraph/test/models/onnx/controlflow/loop_2d_add_const_no_identity_termination_cond_static_shapes.prototxt rename to src/core/tests/models/onnx/controlflow/loop_2d_add_const_no_identity_termination_cond_static_shapes.prototxt diff --git a/ngraph/test/models/onnx/controlflow/loop_2d_add_incorrect_access_body_scope.prototxt b/src/core/tests/models/onnx/controlflow/loop_2d_add_incorrect_access_body_scope.prototxt similarity index 100% rename from ngraph/test/models/onnx/controlflow/loop_2d_add_incorrect_access_body_scope.prototxt rename to src/core/tests/models/onnx/controlflow/loop_2d_add_incorrect_access_body_scope.prototxt diff --git a/ngraph/test/models/onnx/controlflow/loop_2d_add_initializer_from_parent_scope.prototxt b/src/core/tests/models/onnx/controlflow/loop_2d_add_initializer_from_parent_scope.prototxt similarity index 100% rename from ngraph/test/models/onnx/controlflow/loop_2d_add_initializer_from_parent_scope.prototxt rename to src/core/tests/models/onnx/controlflow/loop_2d_add_initializer_from_parent_scope.prototxt diff --git a/ngraph/test/models/onnx/controlflow/loop_2d_add_input_from_parent_graph.prototxt b/src/core/tests/models/onnx/controlflow/loop_2d_add_input_from_parent_graph.prototxt similarity index 100% rename from ngraph/test/models/onnx/controlflow/loop_2d_add_input_from_parent_graph.prototxt rename to src/core/tests/models/onnx/controlflow/loop_2d_add_input_from_parent_graph.prototxt diff --git a/ngraph/test/models/onnx/controlflow/loop_2d_add_no_identity_termination_cond.prototxt b/src/core/tests/models/onnx/controlflow/loop_2d_add_no_identity_termination_cond.prototxt similarity index 100% rename from ngraph/test/models/onnx/controlflow/loop_2d_add_no_identity_termination_cond.prototxt rename to src/core/tests/models/onnx/controlflow/loop_2d_add_no_identity_termination_cond.prototxt diff --git a/ngraph/test/models/onnx/controlflow/loop_2d_add_no_identity_termination_cond_false.prototxt b/src/core/tests/models/onnx/controlflow/loop_2d_add_no_identity_termination_cond_false.prototxt similarity index 100% rename from ngraph/test/models/onnx/controlflow/loop_2d_add_no_identity_termination_cond_false.prototxt rename to src/core/tests/models/onnx/controlflow/loop_2d_add_no_identity_termination_cond_false.prototxt diff --git a/ngraph/test/models/onnx/controlflow/loop_2d_add_no_identity_termination_cond_static_shapes.prototxt b/src/core/tests/models/onnx/controlflow/loop_2d_add_no_identity_termination_cond_static_shapes.prototxt similarity index 100% rename from ngraph/test/models/onnx/controlflow/loop_2d_add_no_identity_termination_cond_static_shapes.prototxt rename to src/core/tests/models/onnx/controlflow/loop_2d_add_no_identity_termination_cond_static_shapes.prototxt diff --git a/ngraph/test/models/onnx/controlflow/loop_2d_add_node_from_parent_scope.prototxt b/src/core/tests/models/onnx/controlflow/loop_2d_add_node_from_parent_scope.prototxt similarity index 100% rename from ngraph/test/models/onnx/controlflow/loop_2d_add_node_from_parent_scope.prototxt rename to src/core/tests/models/onnx/controlflow/loop_2d_add_node_from_parent_scope.prototxt diff --git a/ngraph/test/models/onnx/controlflow/loop_2d_add_the_same_name.prototxt b/src/core/tests/models/onnx/controlflow/loop_2d_add_the_same_name.prototxt similarity index 100% rename from ngraph/test/models/onnx/controlflow/loop_2d_add_the_same_name.prototxt rename to src/core/tests/models/onnx/controlflow/loop_2d_add_the_same_name.prototxt diff --git a/ngraph/test/models/onnx/controlflow/loop_2d_add_trip_count_and_cond_skipped.prototxt b/src/core/tests/models/onnx/controlflow/loop_2d_add_trip_count_and_cond_skipped.prototxt similarity index 100% rename from ngraph/test/models/onnx/controlflow/loop_2d_add_trip_count_and_cond_skipped.prototxt rename to src/core/tests/models/onnx/controlflow/loop_2d_add_trip_count_and_cond_skipped.prototxt diff --git a/ngraph/test/models/onnx/controlflow/loop_2d_add_trip_count_dynamic.prototxt b/src/core/tests/models/onnx/controlflow/loop_2d_add_trip_count_dynamic.prototxt similarity index 100% rename from ngraph/test/models/onnx/controlflow/loop_2d_add_trip_count_dynamic.prototxt rename to src/core/tests/models/onnx/controlflow/loop_2d_add_trip_count_dynamic.prototxt diff --git a/ngraph/test/models/onnx/controlflow/loop_2d_add_trip_count_max_int.prototxt b/src/core/tests/models/onnx/controlflow/loop_2d_add_trip_count_max_int.prototxt similarity index 100% rename from ngraph/test/models/onnx/controlflow/loop_2d_add_trip_count_max_int.prototxt rename to src/core/tests/models/onnx/controlflow/loop_2d_add_trip_count_max_int.prototxt diff --git a/ngraph/test/models/onnx/controlflow/loop_2d_mul_opset1.prototxt b/src/core/tests/models/onnx/controlflow/loop_2d_mul_opset1.prototxt similarity index 100% rename from ngraph/test/models/onnx/controlflow/loop_2d_mul_opset1.prototxt rename to src/core/tests/models/onnx/controlflow/loop_2d_mul_opset1.prototxt diff --git a/ngraph/test/models/onnx/controlflow/loop_add_node_from_parent_scope_infer_types.prototxt b/src/core/tests/models/onnx/controlflow/loop_add_node_from_parent_scope_infer_types.prototxt similarity index 100% rename from ngraph/test/models/onnx/controlflow/loop_add_node_from_parent_scope_infer_types.prototxt rename to src/core/tests/models/onnx/controlflow/loop_add_node_from_parent_scope_infer_types.prototxt diff --git a/ngraph/test/models/onnx/controlflow/loop_add_node_from_parent_scope_used_in_parent_and_in_body.prototxt b/src/core/tests/models/onnx/controlflow/loop_add_node_from_parent_scope_used_in_parent_and_in_body.prototxt similarity index 100% rename from ngraph/test/models/onnx/controlflow/loop_add_node_from_parent_scope_used_in_parent_and_in_body.prototxt rename to src/core/tests/models/onnx/controlflow/loop_add_node_from_parent_scope_used_in_parent_and_in_body.prototxt diff --git a/ngraph/test/models/onnx/controlflow/loop_concat_values.prototxt b/src/core/tests/models/onnx/controlflow/loop_concat_values.prototxt similarity index 100% rename from ngraph/test/models/onnx/controlflow/loop_concat_values.prototxt rename to src/core/tests/models/onnx/controlflow/loop_concat_values.prototxt diff --git a/ngraph/test/models/onnx/controlflow/loop_infinite.prototxt b/src/core/tests/models/onnx/controlflow/loop_infinite.prototxt similarity index 100% rename from ngraph/test/models/onnx/controlflow/loop_infinite.prototxt rename to src/core/tests/models/onnx/controlflow/loop_infinite.prototxt diff --git a/ngraph/test/models/onnx/controlflow/loop_no_variadic_inputs_and_outputs.prototxt b/src/core/tests/models/onnx/controlflow/loop_no_variadic_inputs_and_outputs.prototxt similarity index 100% rename from ngraph/test/models/onnx/controlflow/loop_no_variadic_inputs_and_outputs.prototxt rename to src/core/tests/models/onnx/controlflow/loop_no_variadic_inputs_and_outputs.prototxt diff --git a/ngraph/test/models/onnx/controlflow/loop_pow.prototxt b/src/core/tests/models/onnx/controlflow/loop_pow.prototxt similarity index 100% rename from ngraph/test/models/onnx/controlflow/loop_pow.prototxt rename to src/core/tests/models/onnx/controlflow/loop_pow.prototxt diff --git a/ngraph/test/models/onnx/controlflow/loop_scalars_add.prototxt b/src/core/tests/models/onnx/controlflow/loop_scalars_add.prototxt similarity index 100% rename from ngraph/test/models/onnx/controlflow/loop_scalars_add.prototxt rename to src/core/tests/models/onnx/controlflow/loop_scalars_add.prototxt diff --git a/ngraph/test/models/onnx/controlflow/onnx_controlflow_loop_2d_infer_types.prototxt b/src/core/tests/models/onnx/controlflow/onnx_controlflow_loop_2d_infer_types.prototxt similarity index 100% rename from ngraph/test/models/onnx/controlflow/onnx_controlflow_loop_2d_infer_types.prototxt rename to src/core/tests/models/onnx/controlflow/onnx_controlflow_loop_2d_infer_types.prototxt diff --git a/ngraph/test/models/onnx/conv2d_dilation_assym_pads_strides.prototxt b/src/core/tests/models/onnx/conv2d_dilation_assym_pads_strides.prototxt similarity index 100% rename from ngraph/test/models/onnx/conv2d_dilation_assym_pads_strides.prototxt rename to src/core/tests/models/onnx/conv2d_dilation_assym_pads_strides.prototxt diff --git a/ngraph/test/models/onnx/conv3d_bias.prototxt b/src/core/tests/models/onnx/conv3d_bias.prototxt similarity index 100% rename from ngraph/test/models/onnx/conv3d_bias.prototxt rename to src/core/tests/models/onnx/conv3d_bias.prototxt diff --git a/ngraph/test/models/onnx/conv_fp16_W_as_int32.prototxt b/src/core/tests/models/onnx/conv_fp16_W_as_int32.prototxt similarity index 100% rename from ngraph/test/models/onnx/conv_fp16_W_as_int32.prototxt rename to src/core/tests/models/onnx/conv_fp16_W_as_int32.prototxt diff --git a/ngraph/test/models/onnx/conv_integer.prototxt b/src/core/tests/models/onnx/conv_integer.prototxt similarity index 100% rename from ngraph/test/models/onnx/conv_integer.prototxt rename to src/core/tests/models/onnx/conv_integer.prototxt diff --git a/ngraph/test/models/onnx/conv_integer_int8.prototxt b/src/core/tests/models/onnx/conv_integer_int8.prototxt similarity index 100% rename from ngraph/test/models/onnx/conv_integer_int8.prototxt rename to src/core/tests/models/onnx/conv_integer_int8.prototxt diff --git a/ngraph/test/models/onnx/conv_integer_no_zero_point.prototxt b/src/core/tests/models/onnx/conv_integer_no_zero_point.prototxt similarity index 100% rename from ngraph/test/models/onnx/conv_integer_no_zero_point.prototxt rename to src/core/tests/models/onnx/conv_integer_no_zero_point.prototxt diff --git a/ngraph/test/models/onnx/conv_integer_overload.prototxt b/src/core/tests/models/onnx/conv_integer_overload.prototxt similarity index 100% rename from ngraph/test/models/onnx/conv_integer_overload.prototxt rename to src/core/tests/models/onnx/conv_integer_overload.prototxt diff --git a/ngraph/test/models/onnx/conv_integer_vector_w_zero_point.prototxt b/src/core/tests/models/onnx/conv_integer_vector_w_zero_point.prototxt similarity index 100% rename from ngraph/test/models/onnx/conv_integer_vector_w_zero_point.prototxt rename to src/core/tests/models/onnx/conv_integer_vector_w_zero_point.prototxt diff --git a/ngraph/test/models/onnx/conv_transpose_w_groups.prototxt b/src/core/tests/models/onnx/conv_transpose_w_groups.prototxt similarity index 100% rename from ngraph/test/models/onnx/conv_transpose_w_groups.prototxt rename to src/core/tests/models/onnx/conv_transpose_w_groups.prototxt diff --git a/ngraph/test/models/onnx/conv_with_strides_and_asymmetric_padding.prototxt b/src/core/tests/models/onnx/conv_with_strides_and_asymmetric_padding.prototxt similarity index 100% rename from ngraph/test/models/onnx/conv_with_strides_and_asymmetric_padding.prototxt rename to src/core/tests/models/onnx/conv_with_strides_and_asymmetric_padding.prototxt diff --git a/ngraph/test/models/onnx/conv_with_strides_no_padding.prototxt b/src/core/tests/models/onnx/conv_with_strides_no_padding.prototxt similarity index 100% rename from ngraph/test/models/onnx/conv_with_strides_no_padding.prototxt rename to src/core/tests/models/onnx/conv_with_strides_no_padding.prototxt diff --git a/ngraph/test/models/onnx/conv_with_strides_padding.prototxt b/src/core/tests/models/onnx/conv_with_strides_padding.prototxt similarity index 100% rename from ngraph/test/models/onnx/conv_with_strides_padding.prototxt rename to src/core/tests/models/onnx/conv_with_strides_padding.prototxt diff --git a/ngraph/test/models/onnx/conv_with_strides_padding_bias.prototxt b/src/core/tests/models/onnx/conv_with_strides_padding_bias.prototxt similarity index 100% rename from ngraph/test/models/onnx/conv_with_strides_padding_bias.prototxt rename to src/core/tests/models/onnx/conv_with_strides_padding_bias.prototxt diff --git a/ngraph/test/models/onnx/convtranspose_dyn_data.prototxt b/src/core/tests/models/onnx/convtranspose_dyn_data.prototxt similarity index 100% rename from ngraph/test/models/onnx/convtranspose_dyn_data.prototxt rename to src/core/tests/models/onnx/convtranspose_dyn_data.prototxt diff --git a/ngraph/test/models/onnx/convtranspose_dyn_filters.prototxt b/src/core/tests/models/onnx/convtranspose_dyn_filters.prototxt similarity index 100% rename from ngraph/test/models/onnx/convtranspose_dyn_filters.prototxt rename to src/core/tests/models/onnx/convtranspose_dyn_filters.prototxt diff --git a/ngraph/test/models/onnx/convtranspose_groups_pads_bias.prototxt b/src/core/tests/models/onnx/convtranspose_groups_pads_bias.prototxt similarity index 100% rename from ngraph/test/models/onnx/convtranspose_groups_pads_bias.prototxt rename to src/core/tests/models/onnx/convtranspose_groups_pads_bias.prototxt diff --git a/ngraph/test/models/onnx/convtranspose_groups_w_pads.prototxt b/src/core/tests/models/onnx/convtranspose_groups_w_pads.prototxt similarity index 100% rename from ngraph/test/models/onnx/convtranspose_groups_w_pads.prototxt rename to src/core/tests/models/onnx/convtranspose_groups_w_pads.prototxt diff --git a/ngraph/test/models/onnx/convtranspose_output_shape.prototxt b/src/core/tests/models/onnx/convtranspose_output_shape.prototxt similarity index 100% rename from ngraph/test/models/onnx/convtranspose_output_shape.prototxt rename to src/core/tests/models/onnx/convtranspose_output_shape.prototxt diff --git a/ngraph/test/models/onnx/convtranspose_output_shape_auto_pads_same_lower.prototxt b/src/core/tests/models/onnx/convtranspose_output_shape_auto_pads_same_lower.prototxt similarity index 100% rename from ngraph/test/models/onnx/convtranspose_output_shape_auto_pads_same_lower.prototxt rename to src/core/tests/models/onnx/convtranspose_output_shape_auto_pads_same_lower.prototxt diff --git a/ngraph/test/models/onnx/convtranspose_output_shape_auto_pads_same_upper.prototxt b/src/core/tests/models/onnx/convtranspose_output_shape_auto_pads_same_upper.prototxt similarity index 100% rename from ngraph/test/models/onnx/convtranspose_output_shape_auto_pads_same_upper.prototxt rename to src/core/tests/models/onnx/convtranspose_output_shape_auto_pads_same_upper.prototxt diff --git a/ngraph/test/models/onnx/cosh.prototxt b/src/core/tests/models/onnx/cosh.prototxt similarity index 100% rename from ngraph/test/models/onnx/cosh.prototxt rename to src/core/tests/models/onnx/cosh.prototxt diff --git a/ngraph/test/models/onnx/crop.prototxt b/src/core/tests/models/onnx/crop.prototxt similarity index 100% rename from ngraph/test/models/onnx/crop.prototxt rename to src/core/tests/models/onnx/crop.prototxt diff --git a/ngraph/test/models/onnx/crop_with_scale.prototxt b/src/core/tests/models/onnx/crop_with_scale.prototxt similarity index 100% rename from ngraph/test/models/onnx/crop_with_scale.prototxt rename to src/core/tests/models/onnx/crop_with_scale.prototxt diff --git a/ngraph/test/models/onnx/cum_sum_1d.prototxt b/src/core/tests/models/onnx/cum_sum_1d.prototxt similarity index 100% rename from ngraph/test/models/onnx/cum_sum_1d.prototxt rename to src/core/tests/models/onnx/cum_sum_1d.prototxt diff --git a/ngraph/test/models/onnx/cum_sum_2d_axis_input.prototxt b/src/core/tests/models/onnx/cum_sum_2d_axis_input.prototxt similarity index 100% rename from ngraph/test/models/onnx/cum_sum_2d_axis_input.prototxt rename to src/core/tests/models/onnx/cum_sum_2d_axis_input.prototxt diff --git a/ngraph/test/models/onnx/cum_sum_2d_dynamic_axis_input.prototxt b/src/core/tests/models/onnx/cum_sum_2d_dynamic_axis_input.prototxt similarity index 100% rename from ngraph/test/models/onnx/cum_sum_2d_dynamic_axis_input.prototxt rename to src/core/tests/models/onnx/cum_sum_2d_dynamic_axis_input.prototxt diff --git a/ngraph/test/models/onnx/cum_sum_3d_exclusive_reverse.prototxt b/src/core/tests/models/onnx/cum_sum_3d_exclusive_reverse.prototxt similarity index 100% rename from ngraph/test/models/onnx/cum_sum_3d_exclusive_reverse.prototxt rename to src/core/tests/models/onnx/cum_sum_3d_exclusive_reverse.prototxt diff --git a/ngraph/test/models/onnx/custom_operator.prototxt b/src/core/tests/models/onnx/custom_operator.prototxt similarity index 100% rename from ngraph/test/models/onnx/custom_operator.prototxt rename to src/core/tests/models/onnx/custom_operator.prototxt diff --git a/ngraph/test/models/onnx/custom_operator_default_domain.prototxt b/src/core/tests/models/onnx/custom_operator_default_domain.prototxt similarity index 100% rename from ngraph/test/models/onnx/custom_operator_default_domain.prototxt rename to src/core/tests/models/onnx/custom_operator_default_domain.prototxt diff --git a/ngraph/test/models/onnx/dangling_parameter.prototxt b/src/core/tests/models/onnx/dangling_parameter.prototxt similarity index 100% rename from ngraph/test/models/onnx/dangling_parameter.prototxt rename to src/core/tests/models/onnx/dangling_parameter.prototxt diff --git a/ngraph/test/models/onnx/depth_to_space.prototxt b/src/core/tests/models/onnx/depth_to_space.prototxt similarity index 100% rename from ngraph/test/models/onnx/depth_to_space.prototxt rename to src/core/tests/models/onnx/depth_to_space.prototxt diff --git a/ngraph/test/models/onnx/depth_to_space_bad_blocksize.prototxt b/src/core/tests/models/onnx/depth_to_space_bad_blocksize.prototxt similarity index 100% rename from ngraph/test/models/onnx/depth_to_space_bad_blocksize.prototxt rename to src/core/tests/models/onnx/depth_to_space_bad_blocksize.prototxt diff --git a/ngraph/test/models/onnx/depth_to_space_bad_input_shape.prototxt b/src/core/tests/models/onnx/depth_to_space_bad_input_shape.prototxt similarity index 100% rename from ngraph/test/models/onnx/depth_to_space_bad_input_shape.prototxt rename to src/core/tests/models/onnx/depth_to_space_bad_input_shape.prototxt diff --git a/ngraph/test/models/onnx/depth_to_space_bad_mode.prototxt b/src/core/tests/models/onnx/depth_to_space_bad_mode.prototxt similarity index 100% rename from ngraph/test/models/onnx/depth_to_space_bad_mode.prototxt rename to src/core/tests/models/onnx/depth_to_space_bad_mode.prototxt diff --git a/ngraph/test/models/onnx/depth_to_space_crd.prototxt b/src/core/tests/models/onnx/depth_to_space_crd.prototxt similarity index 100% rename from ngraph/test/models/onnx/depth_to_space_crd.prototxt rename to src/core/tests/models/onnx/depth_to_space_crd.prototxt diff --git a/ngraph/test/models/onnx/depth_to_space_no_blocksize.prototxt b/src/core/tests/models/onnx/depth_to_space_no_blocksize.prototxt similarity index 100% rename from ngraph/test/models/onnx/depth_to_space_no_blocksize.prototxt rename to src/core/tests/models/onnx/depth_to_space_no_blocksize.prototxt diff --git a/ngraph/test/models/onnx/depth_to_space_v1.prototxt b/src/core/tests/models/onnx/depth_to_space_v1.prototxt similarity index 100% rename from ngraph/test/models/onnx/depth_to_space_v1.prototxt rename to src/core/tests/models/onnx/depth_to_space_v1.prototxt diff --git a/ngraph/test/models/onnx/dequant_lin.prototxt b/src/core/tests/models/onnx/dequant_lin.prototxt similarity index 100% rename from ngraph/test/models/onnx/dequant_lin.prototxt rename to src/core/tests/models/onnx/dequant_lin.prototxt diff --git a/ngraph/test/models/onnx/dequantize_linear_0.prototxt b/src/core/tests/models/onnx/dequantize_linear_0.prototxt similarity index 100% rename from ngraph/test/models/onnx/dequantize_linear_0.prototxt rename to src/core/tests/models/onnx/dequantize_linear_0.prototxt diff --git a/ngraph/test/models/onnx/dequantize_linear_1.prototxt b/src/core/tests/models/onnx/dequantize_linear_1.prototxt similarity index 100% rename from ngraph/test/models/onnx/dequantize_linear_1.prototxt rename to src/core/tests/models/onnx/dequantize_linear_1.prototxt diff --git a/ngraph/test/models/onnx/dequantize_linear_2.prototxt b/src/core/tests/models/onnx/dequantize_linear_2.prototxt similarity index 100% rename from ngraph/test/models/onnx/dequantize_linear_2.prototxt rename to src/core/tests/models/onnx/dequantize_linear_2.prototxt diff --git a/ngraph/test/models/onnx/dequantize_linear_3.prototxt b/src/core/tests/models/onnx/dequantize_linear_3.prototxt similarity index 100% rename from ngraph/test/models/onnx/dequantize_linear_3.prototxt rename to src/core/tests/models/onnx/dequantize_linear_3.prototxt diff --git a/ngraph/test/models/onnx/dequantize_linear_4.prototxt b/src/core/tests/models/onnx/dequantize_linear_4.prototxt similarity index 100% rename from ngraph/test/models/onnx/dequantize_linear_4.prototxt rename to src/core/tests/models/onnx/dequantize_linear_4.prototxt diff --git a/ngraph/test/models/onnx/dequantize_linear_5.prototxt b/src/core/tests/models/onnx/dequantize_linear_5.prototxt similarity index 100% rename from ngraph/test/models/onnx/dequantize_linear_5.prototxt rename to src/core/tests/models/onnx/dequantize_linear_5.prototxt diff --git a/ngraph/test/models/onnx/dequantize_linear_scalar_inputs.prototxt b/src/core/tests/models/onnx/dequantize_linear_scalar_inputs.prototxt similarity index 100% rename from ngraph/test/models/onnx/dequantize_linear_scalar_inputs.prototxt rename to src/core/tests/models/onnx/dequantize_linear_scalar_inputs.prototxt diff --git a/ngraph/test/models/onnx/dequantize_linear_scalar_scale.prototxt b/src/core/tests/models/onnx/dequantize_linear_scalar_scale.prototxt similarity index 100% rename from ngraph/test/models/onnx/dequantize_linear_scalar_scale.prototxt rename to src/core/tests/models/onnx/dequantize_linear_scalar_scale.prototxt diff --git a/ngraph/test/models/onnx/dequantize_linear_scalar_scale_and_zero_point.prototxt b/src/core/tests/models/onnx/dequantize_linear_scalar_scale_and_zero_point.prototxt similarity index 100% rename from ngraph/test/models/onnx/dequantize_linear_scalar_scale_and_zero_point.prototxt rename to src/core/tests/models/onnx/dequantize_linear_scalar_scale_and_zero_point.prototxt diff --git a/ngraph/test/models/onnx/dequantize_linear_scalar_zero_point.prototxt b/src/core/tests/models/onnx/dequantize_linear_scalar_zero_point.prototxt similarity index 100% rename from ngraph/test/models/onnx/dequantize_linear_scalar_zero_point.prototxt rename to src/core/tests/models/onnx/dequantize_linear_scalar_zero_point.prototxt diff --git a/ngraph/test/models/onnx/detection_output.prototxt b/src/core/tests/models/onnx/detection_output.prototxt similarity index 100% rename from ngraph/test/models/onnx/detection_output.prototxt rename to src/core/tests/models/onnx/detection_output.prototxt diff --git a/ngraph/test/models/onnx/div.prototxt b/src/core/tests/models/onnx/div.prototxt similarity index 100% rename from ngraph/test/models/onnx/div.prototxt rename to src/core/tests/models/onnx/div.prototxt diff --git a/ngraph/test/models/onnx/div_v6_broadcast_axes_1_2.prototxt b/src/core/tests/models/onnx/div_v6_broadcast_axes_1_2.prototxt similarity index 100% rename from ngraph/test/models/onnx/div_v6_broadcast_axes_1_2.prototxt rename to src/core/tests/models/onnx/div_v6_broadcast_axes_1_2.prototxt diff --git a/ngraph/test/models/onnx/div_v6_broadcast_axis_1.prototxt b/src/core/tests/models/onnx/div_v6_broadcast_axis_1.prototxt similarity index 100% rename from ngraph/test/models/onnx/div_v6_broadcast_axis_1.prototxt rename to src/core/tests/models/onnx/div_v6_broadcast_axis_1.prototxt diff --git a/ngraph/test/models/onnx/div_v6_broadcast_no_axis.prototxt b/src/core/tests/models/onnx/div_v6_broadcast_no_axis.prototxt similarity index 100% rename from ngraph/test/models/onnx/div_v6_broadcast_no_axis.prototxt rename to src/core/tests/models/onnx/div_v6_broadcast_no_axis.prototxt diff --git a/ngraph/test/models/onnx/div_v7.prototxt b/src/core/tests/models/onnx/div_v7.prototxt similarity index 100% rename from ngraph/test/models/onnx/div_v7.prototxt rename to src/core/tests/models/onnx/div_v7.prototxt diff --git a/ngraph/test/models/onnx/div_v7_broadcast.prototxt b/src/core/tests/models/onnx/div_v7_broadcast.prototxt similarity index 100% rename from ngraph/test/models/onnx/div_v7_broadcast.prototxt rename to src/core/tests/models/onnx/div_v7_broadcast.prototxt diff --git a/ngraph/test/models/onnx/dropout12_no_training_no_return_mask.prototxt b/src/core/tests/models/onnx/dropout12_no_training_no_return_mask.prototxt similarity index 100% rename from ngraph/test/models/onnx/dropout12_no_training_no_return_mask.prototxt rename to src/core/tests/models/onnx/dropout12_no_training_no_return_mask.prototxt diff --git a/ngraph/test/models/onnx/dropout12_no_training_return_mask.prototxt b/src/core/tests/models/onnx/dropout12_no_training_return_mask.prototxt similarity index 100% rename from ngraph/test/models/onnx/dropout12_no_training_return_mask.prototxt rename to src/core/tests/models/onnx/dropout12_no_training_return_mask.prototxt diff --git a/ngraph/test/models/onnx/dropout12_no_traning_no_const_rato.prototxt b/src/core/tests/models/onnx/dropout12_no_traning_no_const_rato.prototxt similarity index 100% rename from ngraph/test/models/onnx/dropout12_no_traning_no_const_rato.prototxt rename to src/core/tests/models/onnx/dropout12_no_traning_no_const_rato.prototxt diff --git a/ngraph/test/models/onnx/dropout12_not_const_training_mode.prototxt b/src/core/tests/models/onnx/dropout12_not_const_training_mode.prototxt similarity index 100% rename from ngraph/test/models/onnx/dropout12_not_const_training_mode.prototxt rename to src/core/tests/models/onnx/dropout12_not_const_training_mode.prototxt diff --git a/ngraph/test/models/onnx/dropout12_training_mode.prototxt b/src/core/tests/models/onnx/dropout12_training_mode.prototxt similarity index 100% rename from ngraph/test/models/onnx/dropout12_training_mode.prototxt rename to src/core/tests/models/onnx/dropout12_training_mode.prototxt diff --git a/ngraph/test/models/onnx/dropout1_no_training_no_return_mask.prototxt b/src/core/tests/models/onnx/dropout1_no_training_no_return_mask.prototxt similarity index 100% rename from ngraph/test/models/onnx/dropout1_no_training_no_return_mask.prototxt rename to src/core/tests/models/onnx/dropout1_no_training_no_return_mask.prototxt diff --git a/ngraph/test/models/onnx/dropout1_no_training_return_mask.prototxt b/src/core/tests/models/onnx/dropout1_no_training_return_mask.prototxt similarity index 100% rename from ngraph/test/models/onnx/dropout1_no_training_return_mask.prototxt rename to src/core/tests/models/onnx/dropout1_no_training_return_mask.prototxt diff --git a/ngraph/test/models/onnx/dropout7_no_return_mask.prototxt b/src/core/tests/models/onnx/dropout7_no_return_mask.prototxt similarity index 100% rename from ngraph/test/models/onnx/dropout7_no_return_mask.prototxt rename to src/core/tests/models/onnx/dropout7_no_return_mask.prototxt diff --git a/ngraph/test/models/onnx/dynamic_shapes/a_plus_b_dyn_rank.prototxt b/src/core/tests/models/onnx/dynamic_shapes/a_plus_b_dyn_rank.prototxt similarity index 100% rename from ngraph/test/models/onnx/dynamic_shapes/a_plus_b_dyn_rank.prototxt rename to src/core/tests/models/onnx/dynamic_shapes/a_plus_b_dyn_rank.prototxt diff --git a/ngraph/test/models/onnx/dynamic_shapes/ab_plus_c.prototxt b/src/core/tests/models/onnx/dynamic_shapes/ab_plus_c.prototxt similarity index 100% rename from ngraph/test/models/onnx/dynamic_shapes/ab_plus_c.prototxt rename to src/core/tests/models/onnx/dynamic_shapes/ab_plus_c.prototxt diff --git a/ngraph/test/models/onnx/dynamic_shapes/acosh_dyn_shape.prototxt b/src/core/tests/models/onnx/dynamic_shapes/acosh_dyn_shape.prototxt similarity index 100% rename from ngraph/test/models/onnx/dynamic_shapes/acosh_dyn_shape.prototxt rename to src/core/tests/models/onnx/dynamic_shapes/acosh_dyn_shape.prototxt diff --git a/ngraph/test/models/onnx/dynamic_shapes/argmax_dyn.prototxt b/src/core/tests/models/onnx/dynamic_shapes/argmax_dyn.prototxt similarity index 100% rename from ngraph/test/models/onnx/dynamic_shapes/argmax_dyn.prototxt rename to src/core/tests/models/onnx/dynamic_shapes/argmax_dyn.prototxt diff --git a/ngraph/test/models/onnx/dynamic_shapes/argmin_no_keep_dims_dyn.prototxt b/src/core/tests/models/onnx/dynamic_shapes/argmin_no_keep_dims_dyn.prototxt similarity index 100% rename from ngraph/test/models/onnx/dynamic_shapes/argmin_no_keep_dims_dyn.prototxt rename to src/core/tests/models/onnx/dynamic_shapes/argmin_no_keep_dims_dyn.prototxt diff --git a/ngraph/test/models/onnx/dynamic_shapes/asinh_dyn_shape.prototxt b/src/core/tests/models/onnx/dynamic_shapes/asinh_dyn_shape.prototxt similarity index 100% rename from ngraph/test/models/onnx/dynamic_shapes/asinh_dyn_shape.prototxt rename to src/core/tests/models/onnx/dynamic_shapes/asinh_dyn_shape.prototxt diff --git a/ngraph/test/models/onnx/dynamic_shapes/atanh_dyn_shape.prototxt b/src/core/tests/models/onnx/dynamic_shapes/atanh_dyn_shape.prototxt similarity index 100% rename from ngraph/test/models/onnx/dynamic_shapes/atanh_dyn_shape.prototxt rename to src/core/tests/models/onnx/dynamic_shapes/atanh_dyn_shape.prototxt diff --git a/ngraph/test/models/onnx/dynamic_shapes/average_pool_2d_dyn.prototxt b/src/core/tests/models/onnx/dynamic_shapes/average_pool_2d_dyn.prototxt similarity index 100% rename from ngraph/test/models/onnx/dynamic_shapes/average_pool_2d_dyn.prototxt rename to src/core/tests/models/onnx/dynamic_shapes/average_pool_2d_dyn.prototxt diff --git a/ngraph/test/models/onnx/dynamic_shapes/constant_of_shape_float_zeros.prototxt b/src/core/tests/models/onnx/dynamic_shapes/constant_of_shape_float_zeros.prototxt similarity index 100% rename from ngraph/test/models/onnx/dynamic_shapes/constant_of_shape_float_zeros.prototxt rename to src/core/tests/models/onnx/dynamic_shapes/constant_of_shape_float_zeros.prototxt diff --git a/ngraph/test/models/onnx/dynamic_shapes/constant_of_shape_int_ones.prototxt b/src/core/tests/models/onnx/dynamic_shapes/constant_of_shape_int_ones.prototxt similarity index 100% rename from ngraph/test/models/onnx/dynamic_shapes/constant_of_shape_int_ones.prototxt rename to src/core/tests/models/onnx/dynamic_shapes/constant_of_shape_int_ones.prototxt diff --git a/ngraph/test/models/onnx/dynamic_shapes/conv_with_dynamic_batch.prototxt b/src/core/tests/models/onnx/dynamic_shapes/conv_with_dynamic_batch.prototxt similarity index 100% rename from ngraph/test/models/onnx/dynamic_shapes/conv_with_dynamic_batch.prototxt rename to src/core/tests/models/onnx/dynamic_shapes/conv_with_dynamic_batch.prototxt diff --git a/ngraph/test/models/onnx/dynamic_shapes/conv_with_dynamic_bias.prototxt b/src/core/tests/models/onnx/dynamic_shapes/conv_with_dynamic_bias.prototxt similarity index 100% rename from ngraph/test/models/onnx/dynamic_shapes/conv_with_dynamic_bias.prototxt rename to src/core/tests/models/onnx/dynamic_shapes/conv_with_dynamic_bias.prototxt diff --git a/ngraph/test/models/onnx/dynamic_shapes/depth_to_space.prototxt b/src/core/tests/models/onnx/dynamic_shapes/depth_to_space.prototxt similarity index 100% rename from ngraph/test/models/onnx/dynamic_shapes/depth_to_space.prototxt rename to src/core/tests/models/onnx/dynamic_shapes/depth_to_space.prototxt diff --git a/ngraph/test/models/onnx/dynamic_shapes/expand_dyn.prototxt b/src/core/tests/models/onnx/dynamic_shapes/expand_dyn.prototxt similarity index 100% rename from ngraph/test/models/onnx/dynamic_shapes/expand_dyn.prototxt rename to src/core/tests/models/onnx/dynamic_shapes/expand_dyn.prototxt diff --git a/ngraph/test/models/onnx/dynamic_shapes/expand_uint16_dyn.prototxt b/src/core/tests/models/onnx/dynamic_shapes/expand_uint16_dyn.prototxt similarity index 100% rename from ngraph/test/models/onnx/dynamic_shapes/expand_uint16_dyn.prototxt rename to src/core/tests/models/onnx/dynamic_shapes/expand_uint16_dyn.prototxt diff --git a/ngraph/test/models/onnx/dynamic_shapes/eye_like_dyn_rank.prototxt b/src/core/tests/models/onnx/dynamic_shapes/eye_like_dyn_rank.prototxt similarity index 100% rename from ngraph/test/models/onnx/dynamic_shapes/eye_like_dyn_rank.prototxt rename to src/core/tests/models/onnx/dynamic_shapes/eye_like_dyn_rank.prototxt diff --git a/ngraph/test/models/onnx/dynamic_shapes/eye_like_dyn_shape.prototxt b/src/core/tests/models/onnx/dynamic_shapes/eye_like_dyn_shape.prototxt similarity index 100% rename from ngraph/test/models/onnx/dynamic_shapes/eye_like_dyn_shape.prototxt rename to src/core/tests/models/onnx/dynamic_shapes/eye_like_dyn_shape.prototxt diff --git a/ngraph/test/models/onnx/dynamic_shapes/flatten_dyn_shape_axis.prototxt b/src/core/tests/models/onnx/dynamic_shapes/flatten_dyn_shape_axis.prototxt similarity index 100% rename from ngraph/test/models/onnx/dynamic_shapes/flatten_dyn_shape_axis.prototxt rename to src/core/tests/models/onnx/dynamic_shapes/flatten_dyn_shape_axis.prototxt diff --git a/ngraph/test/models/onnx/dynamic_shapes/flatten_dyn_shape_axis0.prototxt b/src/core/tests/models/onnx/dynamic_shapes/flatten_dyn_shape_axis0.prototxt similarity index 100% rename from ngraph/test/models/onnx/dynamic_shapes/flatten_dyn_shape_axis0.prototxt rename to src/core/tests/models/onnx/dynamic_shapes/flatten_dyn_shape_axis0.prototxt diff --git a/ngraph/test/models/onnx/dynamic_shapes/flatten_dyn_shape_neg_axis.prototxt b/src/core/tests/models/onnx/dynamic_shapes/flatten_dyn_shape_neg_axis.prototxt similarity index 100% rename from ngraph/test/models/onnx/dynamic_shapes/flatten_dyn_shape_neg_axis.prototxt rename to src/core/tests/models/onnx/dynamic_shapes/flatten_dyn_shape_neg_axis.prototxt diff --git a/ngraph/test/models/onnx/dynamic_shapes/global_average_pool_dyn.prototxt b/src/core/tests/models/onnx/dynamic_shapes/global_average_pool_dyn.prototxt similarity index 100% rename from ngraph/test/models/onnx/dynamic_shapes/global_average_pool_dyn.prototxt rename to src/core/tests/models/onnx/dynamic_shapes/global_average_pool_dyn.prototxt diff --git a/ngraph/test/models/onnx/dynamic_shapes/global_max_pool_dyn.prototxt b/src/core/tests/models/onnx/dynamic_shapes/global_max_pool_dyn.prototxt similarity index 100% rename from ngraph/test/models/onnx/dynamic_shapes/global_max_pool_dyn.prototxt rename to src/core/tests/models/onnx/dynamic_shapes/global_max_pool_dyn.prototxt diff --git a/ngraph/test/models/onnx/dynamic_shapes/gru_defaults_fwd_const_dynamic.prototxt b/src/core/tests/models/onnx/dynamic_shapes/gru_defaults_fwd_const_dynamic.prototxt similarity index 100% rename from ngraph/test/models/onnx/dynamic_shapes/gru_defaults_fwd_const_dynamic.prototxt rename to src/core/tests/models/onnx/dynamic_shapes/gru_defaults_fwd_const_dynamic.prototxt diff --git a/ngraph/test/models/onnx/dynamic_shapes/instance_norm_dyn_shape.prototxt b/src/core/tests/models/onnx/dynamic_shapes/instance_norm_dyn_shape.prototxt similarity index 100% rename from ngraph/test/models/onnx/dynamic_shapes/instance_norm_dyn_shape.prototxt rename to src/core/tests/models/onnx/dynamic_shapes/instance_norm_dyn_shape.prototxt diff --git a/ngraph/test/models/onnx/dynamic_shapes/instance_norm_dyn_shape2.prototxt b/src/core/tests/models/onnx/dynamic_shapes/instance_norm_dyn_shape2.prototxt similarity index 100% rename from ngraph/test/models/onnx/dynamic_shapes/instance_norm_dyn_shape2.prototxt rename to src/core/tests/models/onnx/dynamic_shapes/instance_norm_dyn_shape2.prototxt diff --git a/ngraph/test/models/onnx/dynamic_shapes/lstm_dyn_batch_seq.prototxt b/src/core/tests/models/onnx/dynamic_shapes/lstm_dyn_batch_seq.prototxt similarity index 100% rename from ngraph/test/models/onnx/dynamic_shapes/lstm_dyn_batch_seq.prototxt rename to src/core/tests/models/onnx/dynamic_shapes/lstm_dyn_batch_seq.prototxt diff --git a/ngraph/test/models/onnx/dynamic_shapes/lstm_dyn_batch_seq_3_inputs.prototxt b/src/core/tests/models/onnx/dynamic_shapes/lstm_dyn_batch_seq_3_inputs.prototxt similarity index 100% rename from ngraph/test/models/onnx/dynamic_shapes/lstm_dyn_batch_seq_3_inputs.prototxt rename to src/core/tests/models/onnx/dynamic_shapes/lstm_dyn_batch_seq_3_inputs.prototxt diff --git a/ngraph/test/models/onnx/dynamic_shapes/max_pool_2d_dyn.prototxt b/src/core/tests/models/onnx/dynamic_shapes/max_pool_2d_dyn.prototxt similarity index 100% rename from ngraph/test/models/onnx/dynamic_shapes/max_pool_2d_dyn.prototxt rename to src/core/tests/models/onnx/dynamic_shapes/max_pool_2d_dyn.prototxt diff --git a/ngraph/test/models/onnx/dynamic_shapes/max_pool_dyn_rank_without_default_attrs.prototxt b/src/core/tests/models/onnx/dynamic_shapes/max_pool_dyn_rank_without_default_attrs.prototxt similarity index 100% rename from ngraph/test/models/onnx/dynamic_shapes/max_pool_dyn_rank_without_default_attrs.prototxt rename to src/core/tests/models/onnx/dynamic_shapes/max_pool_dyn_rank_without_default_attrs.prototxt diff --git a/ngraph/test/models/onnx/dynamic_shapes/max_pool_with_indices_output.prototxt b/src/core/tests/models/onnx/dynamic_shapes/max_pool_with_indices_output.prototxt similarity index 100% rename from ngraph/test/models/onnx/dynamic_shapes/max_pool_with_indices_output.prototxt rename to src/core/tests/models/onnx/dynamic_shapes/max_pool_with_indices_output.prototxt diff --git a/ngraph/test/models/onnx/dynamic_shapes/reduce_max_dynamic_input_rank_negative_axis.prototxt b/src/core/tests/models/onnx/dynamic_shapes/reduce_max_dynamic_input_rank_negative_axis.prototxt similarity index 100% rename from ngraph/test/models/onnx/dynamic_shapes/reduce_max_dynamic_input_rank_negative_axis.prototxt rename to src/core/tests/models/onnx/dynamic_shapes/reduce_max_dynamic_input_rank_negative_axis.prototxt diff --git a/ngraph/test/models/onnx/dynamic_shapes/rnn_defaults_fwd_const_dynamic.prototxt b/src/core/tests/models/onnx/dynamic_shapes/rnn_defaults_fwd_const_dynamic.prototxt similarity index 100% rename from ngraph/test/models/onnx/dynamic_shapes/rnn_defaults_fwd_const_dynamic.prototxt rename to src/core/tests/models/onnx/dynamic_shapes/rnn_defaults_fwd_const_dynamic.prototxt diff --git a/ngraph/test/models/onnx/dynamic_shapes/scalar_initializers.prototxt b/src/core/tests/models/onnx/dynamic_shapes/scalar_initializers.prototxt similarity index 100% rename from ngraph/test/models/onnx/dynamic_shapes/scalar_initializers.prototxt rename to src/core/tests/models/onnx/dynamic_shapes/scalar_initializers.prototxt diff --git a/ngraph/test/models/onnx/dynamic_shapes/size_op_dyn.prototxt b/src/core/tests/models/onnx/dynamic_shapes/size_op_dyn.prototxt similarity index 100% rename from ngraph/test/models/onnx/dynamic_shapes/size_op_dyn.prototxt rename to src/core/tests/models/onnx/dynamic_shapes/size_op_dyn.prototxt diff --git a/ngraph/test/models/onnx/dynamic_shapes/slice_2d_clamp_neg_ends_opset1.prototxt b/src/core/tests/models/onnx/dynamic_shapes/slice_2d_clamp_neg_ends_opset1.prototxt similarity index 100% rename from ngraph/test/models/onnx/dynamic_shapes/slice_2d_clamp_neg_ends_opset1.prototxt rename to src/core/tests/models/onnx/dynamic_shapes/slice_2d_clamp_neg_ends_opset1.prototxt diff --git a/ngraph/test/models/onnx/dynamic_shapes/slice_2d_default_steps_dyn_begin_end.prototxt b/src/core/tests/models/onnx/dynamic_shapes/slice_2d_default_steps_dyn_begin_end.prototxt similarity index 100% rename from ngraph/test/models/onnx/dynamic_shapes/slice_2d_default_steps_dyn_begin_end.prototxt rename to src/core/tests/models/onnx/dynamic_shapes/slice_2d_default_steps_dyn_begin_end.prototxt diff --git a/ngraph/test/models/onnx/dynamic_shapes/slice_2d_input.prototxt b/src/core/tests/models/onnx/dynamic_shapes/slice_2d_input.prototxt similarity index 100% rename from ngraph/test/models/onnx/dynamic_shapes/slice_2d_input.prototxt rename to src/core/tests/models/onnx/dynamic_shapes/slice_2d_input.prototxt diff --git a/ngraph/test/models/onnx/dynamic_shapes/slice_2d_input_opset1.prototxt b/src/core/tests/models/onnx/dynamic_shapes/slice_2d_input_opset1.prototxt similarity index 100% rename from ngraph/test/models/onnx/dynamic_shapes/slice_2d_input_opset1.prototxt rename to src/core/tests/models/onnx/dynamic_shapes/slice_2d_input_opset1.prototxt diff --git a/ngraph/test/models/onnx/dynamic_shapes/slice_2d_the_same_out_shape.prototxt b/src/core/tests/models/onnx/dynamic_shapes/slice_2d_the_same_out_shape.prototxt similarity index 100% rename from ngraph/test/models/onnx/dynamic_shapes/slice_2d_the_same_out_shape.prototxt rename to src/core/tests/models/onnx/dynamic_shapes/slice_2d_the_same_out_shape.prototxt diff --git a/ngraph/test/models/onnx/dynamic_shapes/slice_3d_input.prototxt b/src/core/tests/models/onnx/dynamic_shapes/slice_3d_input.prototxt similarity index 100% rename from ngraph/test/models/onnx/dynamic_shapes/slice_3d_input.prototxt rename to src/core/tests/models/onnx/dynamic_shapes/slice_3d_input.prototxt diff --git a/ngraph/test/models/onnx/dynamic_shapes/slice_3d_input_12_axes.prototxt b/src/core/tests/models/onnx/dynamic_shapes/slice_3d_input_12_axes.prototxt similarity index 100% rename from ngraph/test/models/onnx/dynamic_shapes/slice_3d_input_12_axes.prototxt rename to src/core/tests/models/onnx/dynamic_shapes/slice_3d_input_12_axes.prototxt diff --git a/ngraph/test/models/onnx/dynamic_shapes/slice_3d_input_20_axes.prototxt b/src/core/tests/models/onnx/dynamic_shapes/slice_3d_input_20_axes.prototxt similarity index 100% rename from ngraph/test/models/onnx/dynamic_shapes/slice_3d_input_20_axes.prototxt rename to src/core/tests/models/onnx/dynamic_shapes/slice_3d_input_20_axes.prototxt diff --git a/ngraph/test/models/onnx/dynamic_shapes/slice_3d_input_21_axes_ends_max_opset1.prototxt b/src/core/tests/models/onnx/dynamic_shapes/slice_3d_input_21_axes_ends_max_opset1.prototxt similarity index 100% rename from ngraph/test/models/onnx/dynamic_shapes/slice_3d_input_21_axes_ends_max_opset1.prototxt rename to src/core/tests/models/onnx/dynamic_shapes/slice_3d_input_21_axes_ends_max_opset1.prototxt diff --git a/ngraph/test/models/onnx/dynamic_shapes/slice_3d_input_neg_axes.prototxt b/src/core/tests/models/onnx/dynamic_shapes/slice_3d_input_neg_axes.prototxt similarity index 100% rename from ngraph/test/models/onnx/dynamic_shapes/slice_3d_input_neg_axes.prototxt rename to src/core/tests/models/onnx/dynamic_shapes/slice_3d_input_neg_axes.prototxt diff --git a/ngraph/test/models/onnx/dynamic_shapes/slice_4d_input_0231_axes_ends_max.prototxt b/src/core/tests/models/onnx/dynamic_shapes/slice_4d_input_0231_axes_ends_max.prototxt similarity index 100% rename from ngraph/test/models/onnx/dynamic_shapes/slice_4d_input_0231_axes_ends_max.prototxt rename to src/core/tests/models/onnx/dynamic_shapes/slice_4d_input_0231_axes_ends_max.prototxt diff --git a/ngraph/test/models/onnx/dynamic_shapes/slice_4d_input_2103_axes.prototxt b/src/core/tests/models/onnx/dynamic_shapes/slice_4d_input_2103_axes.prototxt similarity index 100% rename from ngraph/test/models/onnx/dynamic_shapes/slice_4d_input_2103_axes.prototxt rename to src/core/tests/models/onnx/dynamic_shapes/slice_4d_input_2103_axes.prototxt diff --git a/ngraph/test/models/onnx/dynamic_shapes/slice_4d_input_23_axes.prototxt b/src/core/tests/models/onnx/dynamic_shapes/slice_4d_input_23_axes.prototxt similarity index 100% rename from ngraph/test/models/onnx/dynamic_shapes/slice_4d_input_23_axes.prototxt rename to src/core/tests/models/onnx/dynamic_shapes/slice_4d_input_23_axes.prototxt diff --git a/ngraph/test/models/onnx/dynamic_shapes/slice_4d_input_23_axes_21_steps.prototxt b/src/core/tests/models/onnx/dynamic_shapes/slice_4d_input_23_axes_21_steps.prototxt similarity index 100% rename from ngraph/test/models/onnx/dynamic_shapes/slice_4d_input_23_axes_21_steps.prototxt rename to src/core/tests/models/onnx/dynamic_shapes/slice_4d_input_23_axes_21_steps.prototxt diff --git a/ngraph/test/models/onnx/dynamic_shapes/slice_default_axes.prototxt b/src/core/tests/models/onnx/dynamic_shapes/slice_default_axes.prototxt similarity index 100% rename from ngraph/test/models/onnx/dynamic_shapes/slice_default_axes.prototxt rename to src/core/tests/models/onnx/dynamic_shapes/slice_default_axes.prototxt diff --git a/ngraph/test/models/onnx/dynamic_shapes/slice_default_steps.prototxt b/src/core/tests/models/onnx/dynamic_shapes/slice_default_steps.prototxt similarity index 100% rename from ngraph/test/models/onnx/dynamic_shapes/slice_default_steps.prototxt rename to src/core/tests/models/onnx/dynamic_shapes/slice_default_steps.prototxt diff --git a/ngraph/test/models/onnx/dynamic_shapes/space_to_depth.prototxt b/src/core/tests/models/onnx/dynamic_shapes/space_to_depth.prototxt similarity index 100% rename from ngraph/test/models/onnx/dynamic_shapes/space_to_depth.prototxt rename to src/core/tests/models/onnx/dynamic_shapes/space_to_depth.prototxt diff --git a/ngraph/test/models/onnx/dynamic_shapes/transpose.prototxt b/src/core/tests/models/onnx/dynamic_shapes/transpose.prototxt similarity index 100% rename from ngraph/test/models/onnx/dynamic_shapes/transpose.prototxt rename to src/core/tests/models/onnx/dynamic_shapes/transpose.prototxt diff --git a/ngraph/test/models/onnx/einsum_sum.prototxt b/src/core/tests/models/onnx/einsum_sum.prototxt similarity index 100% rename from ngraph/test/models/onnx/einsum_sum.prototxt rename to src/core/tests/models/onnx/einsum_sum.prototxt diff --git a/ngraph/test/models/onnx/elu.prototxt b/src/core/tests/models/onnx/elu.prototxt similarity index 100% rename from ngraph/test/models/onnx/elu.prototxt rename to src/core/tests/models/onnx/elu.prototxt diff --git a/ngraph/test/models/onnx/empty_initializers_handling.prototxt b/src/core/tests/models/onnx/empty_initializers_handling.prototxt similarity index 100% rename from ngraph/test/models/onnx/empty_initializers_handling.prototxt rename to src/core/tests/models/onnx/empty_initializers_handling.prototxt diff --git a/ngraph/test/models/onnx/erf.prototxt b/src/core/tests/models/onnx/erf.prototxt similarity index 100% rename from ngraph/test/models/onnx/erf.prototxt rename to src/core/tests/models/onnx/erf.prototxt diff --git a/ngraph/test/models/onnx/erf_int32.prototxt b/src/core/tests/models/onnx/erf_int32.prototxt similarity index 100% rename from ngraph/test/models/onnx/erf_int32.prototxt rename to src/core/tests/models/onnx/erf_int32.prototxt diff --git a/ngraph/test/models/onnx/expand_static_shape.prototxt b/src/core/tests/models/onnx/expand_static_shape.prototxt similarity index 100% rename from ngraph/test/models/onnx/expand_static_shape.prototxt rename to src/core/tests/models/onnx/expand_static_shape.prototxt diff --git a/ngraph/test/models/onnx/external_data/external_data.prototxt b/src/core/tests/models/onnx/external_data/external_data.prototxt similarity index 100% rename from ngraph/test/models/onnx/external_data/external_data.prototxt rename to src/core/tests/models/onnx/external_data/external_data.prototxt diff --git a/ngraph/test/models/onnx/external_data/external_data_different_paths.prototxt b/src/core/tests/models/onnx/external_data/external_data_different_paths.prototxt similarity index 100% rename from ngraph/test/models/onnx/external_data/external_data_different_paths.prototxt rename to src/core/tests/models/onnx/external_data/external_data_different_paths.prototxt diff --git a/ngraph/test/models/onnx/external_data/external_data_file_not_found.prototxt b/src/core/tests/models/onnx/external_data/external_data_file_not_found.prototxt similarity index 100% rename from ngraph/test/models/onnx/external_data/external_data_file_not_found.prototxt rename to src/core/tests/models/onnx/external_data/external_data_file_not_found.prototxt diff --git a/ngraph/test/models/onnx/external_data/external_data_optional_fields.prototxt b/src/core/tests/models/onnx/external_data/external_data_optional_fields.prototxt similarity index 100% rename from ngraph/test/models/onnx/external_data/external_data_optional_fields.prototxt rename to src/core/tests/models/onnx/external_data/external_data_optional_fields.prototxt diff --git a/ngraph/test/models/onnx/external_data/external_data_sanitize_test.prototxt b/src/core/tests/models/onnx/external_data/external_data_sanitize_test.prototxt similarity index 100% rename from ngraph/test/models/onnx/external_data/external_data_sanitize_test.prototxt rename to src/core/tests/models/onnx/external_data/external_data_sanitize_test.prototxt diff --git a/ngraph/test/models/onnx/external_data/external_data_two_tensors_data_in_the_same_file.prototxt b/src/core/tests/models/onnx/external_data/external_data_two_tensors_data_in_the_same_file.prototxt similarity index 100% rename from ngraph/test/models/onnx/external_data/external_data_two_tensors_data_in_the_same_file.prototxt rename to src/core/tests/models/onnx/external_data/external_data_two_tensors_data_in_the_same_file.prototxt diff --git a/ngraph/test/models/onnx/external_data/inner_scope/external_data_file_in_up_dir.prototxt b/src/core/tests/models/onnx/external_data/inner_scope/external_data_file_in_up_dir.prototxt similarity index 100% rename from ngraph/test/models/onnx/external_data/inner_scope/external_data_file_in_up_dir.prototxt rename to src/core/tests/models/onnx/external_data/inner_scope/external_data_file_in_up_dir.prototxt diff --git a/ngraph/test/models/onnx/external_data/tensors_data/a/tensor_a.data b/src/core/tests/models/onnx/external_data/tensors_data/a/tensor_a.data similarity index 100% rename from ngraph/test/models/onnx/external_data/tensors_data/a/tensor_a.data rename to src/core/tests/models/onnx/external_data/tensors_data/a/tensor_a.data diff --git a/ngraph/test/models/onnx/external_data/tensors_data/b/tensor_b.data b/src/core/tests/models/onnx/external_data/tensors_data/b/tensor_b.data similarity index 100% rename from ngraph/test/models/onnx/external_data/tensors_data/b/tensor_b.data rename to src/core/tests/models/onnx/external_data/tensors_data/b/tensor_b.data diff --git a/ngraph/test/models/onnx/external_data/tensors_data/multiple_tensors.data b/src/core/tests/models/onnx/external_data/tensors_data/multiple_tensors.data similarity index 100% rename from ngraph/test/models/onnx/external_data/tensors_data/multiple_tensors.data rename to src/core/tests/models/onnx/external_data/tensors_data/multiple_tensors.data diff --git a/ngraph/test/models/onnx/external_data/tensors_data/tensor.data b/src/core/tests/models/onnx/external_data/tensors_data/tensor.data similarity index 100% rename from ngraph/test/models/onnx/external_data/tensors_data/tensor.data rename to src/core/tests/models/onnx/external_data/tensors_data/tensor.data diff --git a/ngraph/test/models/onnx/external_data/tensors_data/tensor_optional_fields.data b/src/core/tests/models/onnx/external_data/tensors_data/tensor_optional_fields.data similarity index 100% rename from ngraph/test/models/onnx/external_data/tensors_data/tensor_optional_fields.data rename to src/core/tests/models/onnx/external_data/tensors_data/tensor_optional_fields.data diff --git a/ngraph/test/models/onnx/eye_like.prototxt b/src/core/tests/models/onnx/eye_like.prototxt similarity index 100% rename from ngraph/test/models/onnx/eye_like.prototxt rename to src/core/tests/models/onnx/eye_like.prototxt diff --git a/ngraph/test/models/onnx/eye_like_wrong_shape.prototxt b/src/core/tests/models/onnx/eye_like_wrong_shape.prototxt similarity index 100% rename from ngraph/test/models/onnx/eye_like_wrong_shape.prototxt rename to src/core/tests/models/onnx/eye_like_wrong_shape.prototxt diff --git a/ngraph/test/models/onnx/flatten.prototxt b/src/core/tests/models/onnx/flatten.prototxt similarity index 100% rename from ngraph/test/models/onnx/flatten.prototxt rename to src/core/tests/models/onnx/flatten.prototxt diff --git a/ngraph/test/models/onnx/gatherND_float.prototxt b/src/core/tests/models/onnx/gatherND_float.prototxt similarity index 100% rename from ngraph/test/models/onnx/gatherND_float.prototxt rename to src/core/tests/models/onnx/gatherND_float.prototxt diff --git a/ngraph/test/models/onnx/gatherND_int32.prototxt b/src/core/tests/models/onnx/gatherND_int32.prototxt similarity index 100% rename from ngraph/test/models/onnx/gatherND_int32.prototxt rename to src/core/tests/models/onnx/gatherND_int32.prototxt diff --git a/ngraph/test/models/onnx/gather_elements_float_1D.prototxt b/src/core/tests/models/onnx/gather_elements_float_1D.prototxt similarity index 100% rename from ngraph/test/models/onnx/gather_elements_float_1D.prototxt rename to src/core/tests/models/onnx/gather_elements_float_1D.prototxt diff --git a/ngraph/test/models/onnx/gather_elements_float_3D_axis_2.prototxt b/src/core/tests/models/onnx/gather_elements_float_3D_axis_2.prototxt similarity index 100% rename from ngraph/test/models/onnx/gather_elements_float_3D_axis_2.prototxt rename to src/core/tests/models/onnx/gather_elements_float_3D_axis_2.prototxt diff --git a/ngraph/test/models/onnx/gather_elements_float_negative_axis.prototxt b/src/core/tests/models/onnx/gather_elements_float_negative_axis.prototxt similarity index 100% rename from ngraph/test/models/onnx/gather_elements_float_negative_axis.prototxt rename to src/core/tests/models/onnx/gather_elements_float_negative_axis.prototxt diff --git a/ngraph/test/models/onnx/gather_elements_int32_axis_0.prototxt b/src/core/tests/models/onnx/gather_elements_int32_axis_0.prototxt similarity index 100% rename from ngraph/test/models/onnx/gather_elements_int32_axis_0.prototxt rename to src/core/tests/models/onnx/gather_elements_int32_axis_0.prototxt diff --git a/ngraph/test/models/onnx/gather_elements_int8_axis_1.prototxt b/src/core/tests/models/onnx/gather_elements_int8_axis_1.prototxt similarity index 100% rename from ngraph/test/models/onnx/gather_elements_int8_axis_1.prototxt rename to src/core/tests/models/onnx/gather_elements_int8_axis_1.prototxt diff --git a/ngraph/test/models/onnx/gather_float_1D.prototxt b/src/core/tests/models/onnx/gather_float_1D.prototxt similarity index 100% rename from ngraph/test/models/onnx/gather_float_1D.prototxt rename to src/core/tests/models/onnx/gather_float_1D.prototxt diff --git a/ngraph/test/models/onnx/gather_float_2D_axis_1.prototxt b/src/core/tests/models/onnx/gather_float_2D_axis_1.prototxt similarity index 100% rename from ngraph/test/models/onnx/gather_float_2D_axis_1.prototxt rename to src/core/tests/models/onnx/gather_float_2D_axis_1.prototxt diff --git a/ngraph/test/models/onnx/gather_int32_3D_axis_1.prototxt b/src/core/tests/models/onnx/gather_int32_3D_axis_1.prototxt similarity index 100% rename from ngraph/test/models/onnx/gather_int32_3D_axis_1.prototxt rename to src/core/tests/models/onnx/gather_int32_3D_axis_1.prototxt diff --git a/ngraph/test/models/onnx/gather_int8_3D_axis_neg_1.prototxt b/src/core/tests/models/onnx/gather_int8_3D_axis_neg_1.prototxt similarity index 100% rename from ngraph/test/models/onnx/gather_int8_3D_axis_neg_1.prototxt rename to src/core/tests/models/onnx/gather_int8_3D_axis_neg_1.prototxt diff --git a/ngraph/test/models/onnx/gemm_abc.prototxt b/src/core/tests/models/onnx/gemm_abc.prototxt similarity index 100% rename from ngraph/test/models/onnx/gemm_abc.prototxt rename to src/core/tests/models/onnx/gemm_abc.prototxt diff --git a/ngraph/test/models/onnx/global_lp_pool_dynamic_hw.prototxt b/src/core/tests/models/onnx/global_lp_pool_dynamic_hw.prototxt similarity index 100% rename from ngraph/test/models/onnx/global_lp_pool_dynamic_hw.prototxt rename to src/core/tests/models/onnx/global_lp_pool_dynamic_hw.prototxt diff --git a/ngraph/test/models/onnx/global_lp_pool_p0.prototxt b/src/core/tests/models/onnx/global_lp_pool_p0.prototxt similarity index 100% rename from ngraph/test/models/onnx/global_lp_pool_p0.prototxt rename to src/core/tests/models/onnx/global_lp_pool_p0.prototxt diff --git a/ngraph/test/models/onnx/global_lp_pool_p1.prototxt b/src/core/tests/models/onnx/global_lp_pool_p1.prototxt similarity index 100% rename from ngraph/test/models/onnx/global_lp_pool_p1.prototxt rename to src/core/tests/models/onnx/global_lp_pool_p1.prototxt diff --git a/ngraph/test/models/onnx/global_lp_pool_p2.prototxt b/src/core/tests/models/onnx/global_lp_pool_p2.prototxt similarity index 100% rename from ngraph/test/models/onnx/global_lp_pool_p2.prototxt rename to src/core/tests/models/onnx/global_lp_pool_p2.prototxt diff --git a/ngraph/test/models/onnx/global_lp_pool_p3.prototxt b/src/core/tests/models/onnx/global_lp_pool_p3.prototxt similarity index 100% rename from ngraph/test/models/onnx/global_lp_pool_p3.prototxt rename to src/core/tests/models/onnx/global_lp_pool_p3.prototxt diff --git a/ngraph/test/models/onnx/group_norm.prototxt b/src/core/tests/models/onnx/group_norm.prototxt similarity index 100% rename from ngraph/test/models/onnx/group_norm.prototxt rename to src/core/tests/models/onnx/group_norm.prototxt diff --git a/ngraph/test/models/onnx/group_norm_5d.prototxt b/src/core/tests/models/onnx/group_norm_5d.prototxt similarity index 100% rename from ngraph/test/models/onnx/group_norm_5d.prototxt rename to src/core/tests/models/onnx/group_norm_5d.prototxt diff --git a/ngraph/test/models/onnx/gru_bidir_mixed_seq_len_const.prototxt b/src/core/tests/models/onnx/gru_bidir_mixed_seq_len_const.prototxt similarity index 100% rename from ngraph/test/models/onnx/gru_bidir_mixed_seq_len_const.prototxt rename to src/core/tests/models/onnx/gru_bidir_mixed_seq_len_const.prototxt diff --git a/ngraph/test/models/onnx/gru_bidirectional.prototxt b/src/core/tests/models/onnx/gru_bidirectional.prototxt similarity index 100% rename from ngraph/test/models/onnx/gru_bidirectional.prototxt rename to src/core/tests/models/onnx/gru_bidirectional.prototxt diff --git a/ngraph/test/models/onnx/gru_bidirectional_const.prototxt b/src/core/tests/models/onnx/gru_bidirectional_const.prototxt similarity index 100% rename from ngraph/test/models/onnx/gru_bidirectional_const.prototxt rename to src/core/tests/models/onnx/gru_bidirectional_const.prototxt diff --git a/ngraph/test/models/onnx/gru_defaults_fwd.prototxt b/src/core/tests/models/onnx/gru_defaults_fwd.prototxt similarity index 100% rename from ngraph/test/models/onnx/gru_defaults_fwd.prototxt rename to src/core/tests/models/onnx/gru_defaults_fwd.prototxt diff --git a/ngraph/test/models/onnx/gru_defaults_fwd_const.prototxt b/src/core/tests/models/onnx/gru_defaults_fwd_const.prototxt similarity index 100% rename from ngraph/test/models/onnx/gru_defaults_fwd_const.prototxt rename to src/core/tests/models/onnx/gru_defaults_fwd_const.prototxt diff --git a/ngraph/test/models/onnx/gru_fwd_activations_relu_hardsigmoid.prototxt b/src/core/tests/models/onnx/gru_fwd_activations_relu_hardsigmoid.prototxt similarity index 100% rename from ngraph/test/models/onnx/gru_fwd_activations_relu_hardsigmoid.prototxt rename to src/core/tests/models/onnx/gru_fwd_activations_relu_hardsigmoid.prototxt diff --git a/ngraph/test/models/onnx/gru_fwd_activations_relu_sigmoid_const.prototxt b/src/core/tests/models/onnx/gru_fwd_activations_relu_sigmoid_const.prototxt similarity index 100% rename from ngraph/test/models/onnx/gru_fwd_activations_relu_sigmoid_const.prototxt rename to src/core/tests/models/onnx/gru_fwd_activations_relu_sigmoid_const.prototxt diff --git a/ngraph/test/models/onnx/gru_fwd_bias_initial_h.prototxt b/src/core/tests/models/onnx/gru_fwd_bias_initial_h.prototxt similarity index 100% rename from ngraph/test/models/onnx/gru_fwd_bias_initial_h.prototxt rename to src/core/tests/models/onnx/gru_fwd_bias_initial_h.prototxt diff --git a/ngraph/test/models/onnx/gru_fwd_bias_initial_h_const.prototxt b/src/core/tests/models/onnx/gru_fwd_bias_initial_h_const.prototxt similarity index 100% rename from ngraph/test/models/onnx/gru_fwd_bias_initial_h_const.prototxt rename to src/core/tests/models/onnx/gru_fwd_bias_initial_h_const.prototxt diff --git a/ngraph/test/models/onnx/gru_fwd_linear_before_reset.prototxt b/src/core/tests/models/onnx/gru_fwd_linear_before_reset.prototxt similarity index 100% rename from ngraph/test/models/onnx/gru_fwd_linear_before_reset.prototxt rename to src/core/tests/models/onnx/gru_fwd_linear_before_reset.prototxt diff --git a/ngraph/test/models/onnx/gru_fwd_linear_before_reset_const.prototxt b/src/core/tests/models/onnx/gru_fwd_linear_before_reset_const.prototxt similarity index 100% rename from ngraph/test/models/onnx/gru_fwd_linear_before_reset_const.prototxt rename to src/core/tests/models/onnx/gru_fwd_linear_before_reset_const.prototxt diff --git a/ngraph/test/models/onnx/gru_fwd_mixed_seq_len.prototxt b/src/core/tests/models/onnx/gru_fwd_mixed_seq_len.prototxt similarity index 100% rename from ngraph/test/models/onnx/gru_fwd_mixed_seq_len.prototxt rename to src/core/tests/models/onnx/gru_fwd_mixed_seq_len.prototxt diff --git a/ngraph/test/models/onnx/gru_fwd_mixed_seq_len_const.prototxt b/src/core/tests/models/onnx/gru_fwd_mixed_seq_len_const.prototxt similarity index 100% rename from ngraph/test/models/onnx/gru_fwd_mixed_seq_len_const.prototxt rename to src/core/tests/models/onnx/gru_fwd_mixed_seq_len_const.prototxt diff --git a/ngraph/test/models/onnx/gru_rev_clip.prototxt b/src/core/tests/models/onnx/gru_rev_clip.prototxt similarity index 100% rename from ngraph/test/models/onnx/gru_rev_clip.prototxt rename to src/core/tests/models/onnx/gru_rev_clip.prototxt diff --git a/ngraph/test/models/onnx/gru_rev_clip_const.prototxt b/src/core/tests/models/onnx/gru_rev_clip_const.prototxt similarity index 100% rename from ngraph/test/models/onnx/gru_rev_clip_const.prototxt rename to src/core/tests/models/onnx/gru_rev_clip_const.prototxt diff --git a/ngraph/test/models/onnx/gru_reverse.prototxt b/src/core/tests/models/onnx/gru_reverse.prototxt similarity index 100% rename from ngraph/test/models/onnx/gru_reverse.prototxt rename to src/core/tests/models/onnx/gru_reverse.prototxt diff --git a/ngraph/test/models/onnx/gru_reverse_const.prototxt b/src/core/tests/models/onnx/gru_reverse_const.prototxt similarity index 100% rename from ngraph/test/models/onnx/gru_reverse_const.prototxt rename to src/core/tests/models/onnx/gru_reverse_const.prototxt diff --git a/ngraph/test/models/onnx/gru_reverse_mixed_seq_len_const.prototxt b/src/core/tests/models/onnx/gru_reverse_mixed_seq_len_const.prototxt similarity index 100% rename from ngraph/test/models/onnx/gru_reverse_mixed_seq_len_const.prototxt rename to src/core/tests/models/onnx/gru_reverse_mixed_seq_len_const.prototxt diff --git a/ngraph/test/models/onnx/hard_sigmoid.prototxt b/src/core/tests/models/onnx/hard_sigmoid.prototxt similarity index 100% rename from ngraph/test/models/onnx/hard_sigmoid.prototxt rename to src/core/tests/models/onnx/hard_sigmoid.prototxt diff --git a/ngraph/test/models/onnx/hardmax.prototxt b/src/core/tests/models/onnx/hardmax.prototxt similarity index 100% rename from ngraph/test/models/onnx/hardmax.prototxt rename to src/core/tests/models/onnx/hardmax.prototxt diff --git a/ngraph/test/models/onnx/image_scaler.prototxt b/src/core/tests/models/onnx/image_scaler.prototxt similarity index 100% rename from ngraph/test/models/onnx/image_scaler.prototxt rename to src/core/tests/models/onnx/image_scaler.prototxt diff --git a/ngraph/test/models/onnx/initializer_wo_input.prototxt b/src/core/tests/models/onnx/initializer_wo_input.prototxt similarity index 100% rename from ngraph/test/models/onnx/initializer_wo_input.prototxt rename to src/core/tests/models/onnx/initializer_wo_input.prototxt diff --git a/ngraph/test/models/onnx/instance_norm.prototxt b/src/core/tests/models/onnx/instance_norm.prototxt similarity index 100% rename from ngraph/test/models/onnx/instance_norm.prototxt rename to src/core/tests/models/onnx/instance_norm.prototxt diff --git a/ngraph/test/models/onnx/instance_norm_bad_scale_type.prototxt b/src/core/tests/models/onnx/instance_norm_bad_scale_type.prototxt similarity index 100% rename from ngraph/test/models/onnx/instance_norm_bad_scale_type.prototxt rename to src/core/tests/models/onnx/instance_norm_bad_scale_type.prototxt diff --git a/ngraph/test/models/onnx/instance_norm_dynamic.prototxt b/src/core/tests/models/onnx/instance_norm_dynamic.prototxt similarity index 100% rename from ngraph/test/models/onnx/instance_norm_dynamic.prototxt rename to src/core/tests/models/onnx/instance_norm_dynamic.prototxt diff --git a/ngraph/test/models/onnx/leaky_relu.prototxt b/src/core/tests/models/onnx/leaky_relu.prototxt similarity index 100% rename from ngraph/test/models/onnx/leaky_relu.prototxt rename to src/core/tests/models/onnx/leaky_relu.prototxt diff --git a/ngraph/test/models/onnx/logsoftmax13_1D.prototxt b/src/core/tests/models/onnx/logsoftmax13_1D.prototxt similarity index 100% rename from ngraph/test/models/onnx/logsoftmax13_1D.prototxt rename to src/core/tests/models/onnx/logsoftmax13_1D.prototxt diff --git a/ngraph/test/models/onnx/logsoftmax13_2D.prototxt b/src/core/tests/models/onnx/logsoftmax13_2D.prototxt similarity index 100% rename from ngraph/test/models/onnx/logsoftmax13_2D.prototxt rename to src/core/tests/models/onnx/logsoftmax13_2D.prototxt diff --git a/ngraph/test/models/onnx/logsoftmax_0D.prototxt b/src/core/tests/models/onnx/logsoftmax_0D.prototxt similarity index 100% rename from ngraph/test/models/onnx/logsoftmax_0D.prototxt rename to src/core/tests/models/onnx/logsoftmax_0D.prototxt diff --git a/ngraph/test/models/onnx/logsoftmax_1D.prototxt b/src/core/tests/models/onnx/logsoftmax_1D.prototxt similarity index 100% rename from ngraph/test/models/onnx/logsoftmax_1D.prototxt rename to src/core/tests/models/onnx/logsoftmax_1D.prototxt diff --git a/ngraph/test/models/onnx/lp_norm_default.prototxt b/src/core/tests/models/onnx/lp_norm_default.prototxt similarity index 100% rename from ngraph/test/models/onnx/lp_norm_default.prototxt rename to src/core/tests/models/onnx/lp_norm_default.prototxt diff --git a/ngraph/test/models/onnx/lp_norm_default_dynamic.prototxt b/src/core/tests/models/onnx/lp_norm_default_dynamic.prototxt similarity index 100% rename from ngraph/test/models/onnx/lp_norm_default_dynamic.prototxt rename to src/core/tests/models/onnx/lp_norm_default_dynamic.prototxt diff --git a/ngraph/test/models/onnx/lp_norm_p1.prototxt b/src/core/tests/models/onnx/lp_norm_p1.prototxt similarity index 100% rename from ngraph/test/models/onnx/lp_norm_p1.prototxt rename to src/core/tests/models/onnx/lp_norm_p1.prototxt diff --git a/ngraph/test/models/onnx/lp_norm_p2.prototxt b/src/core/tests/models/onnx/lp_norm_p2.prototxt similarity index 100% rename from ngraph/test/models/onnx/lp_norm_p2.prototxt rename to src/core/tests/models/onnx/lp_norm_p2.prototxt diff --git a/ngraph/test/models/onnx/lstm_bdir_short_input_seq.prototxt b/src/core/tests/models/onnx/lstm_bdir_short_input_seq.prototxt similarity index 100% rename from ngraph/test/models/onnx/lstm_bdir_short_input_seq.prototxt rename to src/core/tests/models/onnx/lstm_bdir_short_input_seq.prototxt diff --git a/ngraph/test/models/onnx/lstm_bidir_const.prototxt b/src/core/tests/models/onnx/lstm_bidir_const.prototxt similarity index 100% rename from ngraph/test/models/onnx/lstm_bidir_const.prototxt rename to src/core/tests/models/onnx/lstm_bidir_const.prototxt diff --git a/ngraph/test/models/onnx/lstm_bidir_mixed_seq_const.prototxt b/src/core/tests/models/onnx/lstm_bidir_mixed_seq_const.prototxt similarity index 100% rename from ngraph/test/models/onnx/lstm_bidir_mixed_seq_const.prototxt rename to src/core/tests/models/onnx/lstm_bidir_mixed_seq_const.prototxt diff --git a/ngraph/test/models/onnx/lstm_dynamic_batch_size_and_seq_len.prototxt b/src/core/tests/models/onnx/lstm_dynamic_batch_size_and_seq_len.prototxt similarity index 100% rename from ngraph/test/models/onnx/lstm_dynamic_batch_size_and_seq_len.prototxt rename to src/core/tests/models/onnx/lstm_dynamic_batch_size_and_seq_len.prototxt diff --git a/ngraph/test/models/onnx/lstm_fwd_clip_const.prototxt b/src/core/tests/models/onnx/lstm_fwd_clip_const.prototxt similarity index 100% rename from ngraph/test/models/onnx/lstm_fwd_clip_const.prototxt rename to src/core/tests/models/onnx/lstm_fwd_clip_const.prototxt diff --git a/ngraph/test/models/onnx/lstm_fwd_default_const.prototxt b/src/core/tests/models/onnx/lstm_fwd_default_const.prototxt similarity index 100% rename from ngraph/test/models/onnx/lstm_fwd_default_const.prototxt rename to src/core/tests/models/onnx/lstm_fwd_default_const.prototxt diff --git a/ngraph/test/models/onnx/lstm_fwd_hardsigmoid_activation.prototxt b/src/core/tests/models/onnx/lstm_fwd_hardsigmoid_activation.prototxt similarity index 100% rename from ngraph/test/models/onnx/lstm_fwd_hardsigmoid_activation.prototxt rename to src/core/tests/models/onnx/lstm_fwd_hardsigmoid_activation.prototxt diff --git a/ngraph/test/models/onnx/lstm_fwd_large_batch_no_clip.prototxt b/src/core/tests/models/onnx/lstm_fwd_large_batch_no_clip.prototxt similarity index 100% rename from ngraph/test/models/onnx/lstm_fwd_large_batch_no_clip.prototxt rename to src/core/tests/models/onnx/lstm_fwd_large_batch_no_clip.prototxt diff --git a/ngraph/test/models/onnx/lstm_fwd_mixed_seq.prototxt b/src/core/tests/models/onnx/lstm_fwd_mixed_seq.prototxt similarity index 100% rename from ngraph/test/models/onnx/lstm_fwd_mixed_seq.prototxt rename to src/core/tests/models/onnx/lstm_fwd_mixed_seq.prototxt diff --git a/ngraph/test/models/onnx/lstm_fwd_mixed_seq_const.prototxt b/src/core/tests/models/onnx/lstm_fwd_mixed_seq_const.prototxt similarity index 100% rename from ngraph/test/models/onnx/lstm_fwd_mixed_seq_const.prototxt rename to src/core/tests/models/onnx/lstm_fwd_mixed_seq_const.prototxt diff --git a/ngraph/test/models/onnx/lstm_fwd_with_clip_peepholes.prototxt b/src/core/tests/models/onnx/lstm_fwd_with_clip_peepholes.prototxt similarity index 100% rename from ngraph/test/models/onnx/lstm_fwd_with_clip_peepholes.prototxt rename to src/core/tests/models/onnx/lstm_fwd_with_clip_peepholes.prototxt diff --git a/ngraph/test/models/onnx/lstm_mixed_seq_reverse.prototxt b/src/core/tests/models/onnx/lstm_mixed_seq_reverse.prototxt similarity index 100% rename from ngraph/test/models/onnx/lstm_mixed_seq_reverse.prototxt rename to src/core/tests/models/onnx/lstm_mixed_seq_reverse.prototxt diff --git a/ngraph/test/models/onnx/lstm_reverse_const.prototxt b/src/core/tests/models/onnx/lstm_reverse_const.prototxt similarity index 100% rename from ngraph/test/models/onnx/lstm_reverse_const.prototxt rename to src/core/tests/models/onnx/lstm_reverse_const.prototxt diff --git a/ngraph/test/models/onnx/lstm_reverse_mixed_seq_const.prototxt b/src/core/tests/models/onnx/lstm_reverse_mixed_seq_const.prototxt similarity index 100% rename from ngraph/test/models/onnx/lstm_reverse_mixed_seq_const.prototxt rename to src/core/tests/models/onnx/lstm_reverse_mixed_seq_const.prototxt diff --git a/ngraph/test/models/onnx/matmul.prototxt b/src/core/tests/models/onnx/matmul.prototxt similarity index 100% rename from ngraph/test/models/onnx/matmul.prototxt rename to src/core/tests/models/onnx/matmul.prototxt diff --git a/ngraph/test/models/onnx/matmul_float.prototxt b/src/core/tests/models/onnx/matmul_float.prototxt similarity index 100% rename from ngraph/test/models/onnx/matmul_float.prototxt rename to src/core/tests/models/onnx/matmul_float.prototxt diff --git a/ngraph/test/models/onnx/matmul_integer.prototxt b/src/core/tests/models/onnx/matmul_integer.prototxt similarity index 100% rename from ngraph/test/models/onnx/matmul_integer.prototxt rename to src/core/tests/models/onnx/matmul_integer.prototxt diff --git a/ngraph/test/models/onnx/matmul_integer_2d_x_3d.prototxt b/src/core/tests/models/onnx/matmul_integer_2d_x_3d.prototxt similarity index 100% rename from ngraph/test/models/onnx/matmul_integer_2d_x_3d.prototxt rename to src/core/tests/models/onnx/matmul_integer_2d_x_3d.prototxt diff --git a/ngraph/test/models/onnx/matmul_integer_3d.prototxt b/src/core/tests/models/onnx/matmul_integer_3d.prototxt similarity index 100% rename from ngraph/test/models/onnx/matmul_integer_3d.prototxt rename to src/core/tests/models/onnx/matmul_integer_3d.prototxt diff --git a/ngraph/test/models/onnx/matmul_integer_3d_x_2d.prototxt b/src/core/tests/models/onnx/matmul_integer_3d_x_2d.prototxt similarity index 100% rename from ngraph/test/models/onnx/matmul_integer_3d_x_2d.prototxt rename to src/core/tests/models/onnx/matmul_integer_3d_x_2d.prototxt diff --git a/ngraph/test/models/onnx/matmul_integer_4d.prototxt b/src/core/tests/models/onnx/matmul_integer_4d.prototxt similarity index 100% rename from ngraph/test/models/onnx/matmul_integer_4d.prototxt rename to src/core/tests/models/onnx/matmul_integer_4d.prototxt diff --git a/ngraph/test/models/onnx/matmul_integer_4d_no_zero_point.prototxt b/src/core/tests/models/onnx/matmul_integer_4d_no_zero_point.prototxt similarity index 100% rename from ngraph/test/models/onnx/matmul_integer_4d_no_zero_point.prototxt rename to src/core/tests/models/onnx/matmul_integer_4d_no_zero_point.prototxt diff --git a/ngraph/test/models/onnx/matmul_integer_int8.prototxt b/src/core/tests/models/onnx/matmul_integer_int8.prototxt similarity index 100% rename from ngraph/test/models/onnx/matmul_integer_int8.prototxt rename to src/core/tests/models/onnx/matmul_integer_int8.prototxt diff --git a/ngraph/test/models/onnx/matmul_integer_matrix_zero_point.prototxt b/src/core/tests/models/onnx/matmul_integer_matrix_zero_point.prototxt similarity index 100% rename from ngraph/test/models/onnx/matmul_integer_matrix_zero_point.prototxt rename to src/core/tests/models/onnx/matmul_integer_matrix_zero_point.prototxt diff --git a/ngraph/test/models/onnx/matmul_integer_no_zero_point.prototxt b/src/core/tests/models/onnx/matmul_integer_no_zero_point.prototxt similarity index 100% rename from ngraph/test/models/onnx/matmul_integer_no_zero_point.prototxt rename to src/core/tests/models/onnx/matmul_integer_no_zero_point.prototxt diff --git a/ngraph/test/models/onnx/matmul_integer_vectorized_zero_point.prototxt b/src/core/tests/models/onnx/matmul_integer_vectorized_zero_point.prototxt similarity index 100% rename from ngraph/test/models/onnx/matmul_integer_vectorized_zero_point.prototxt rename to src/core/tests/models/onnx/matmul_integer_vectorized_zero_point.prototxt diff --git a/ngraph/test/models/onnx/matmul_vec_ten3d.prototxt b/src/core/tests/models/onnx/matmul_vec_ten3d.prototxt similarity index 100% rename from ngraph/test/models/onnx/matmul_vec_ten3d.prototxt rename to src/core/tests/models/onnx/matmul_vec_ten3d.prototxt diff --git a/ngraph/test/models/onnx/max.prototxt b/src/core/tests/models/onnx/max.prototxt similarity index 100% rename from ngraph/test/models/onnx/max.prototxt rename to src/core/tests/models/onnx/max.prototxt diff --git a/ngraph/test/models/onnx/max_opset1.prototxt b/src/core/tests/models/onnx/max_opset1.prototxt similarity index 100% rename from ngraph/test/models/onnx/max_opset1.prototxt rename to src/core/tests/models/onnx/max_opset1.prototxt diff --git a/ngraph/test/models/onnx/max_pool_2d_pads.prototxt b/src/core/tests/models/onnx/max_pool_2d_pads.prototxt similarity index 100% rename from ngraph/test/models/onnx/max_pool_2d_pads.prototxt rename to src/core/tests/models/onnx/max_pool_2d_pads.prototxt diff --git a/ngraph/test/models/onnx/max_pool_3d.prototxt b/src/core/tests/models/onnx/max_pool_3d.prototxt similarity index 100% rename from ngraph/test/models/onnx/max_pool_3d.prototxt rename to src/core/tests/models/onnx/max_pool_3d.prototxt diff --git a/ngraph/test/models/onnx/max_pool_4d_ceil_mode.prototxt b/src/core/tests/models/onnx/max_pool_4d_ceil_mode.prototxt similarity index 100% rename from ngraph/test/models/onnx/max_pool_4d_ceil_mode.prototxt rename to src/core/tests/models/onnx/max_pool_4d_ceil_mode.prototxt diff --git a/ngraph/test/models/onnx/max_pool_4d_ceil_strides.prototxt b/src/core/tests/models/onnx/max_pool_4d_ceil_strides.prototxt similarity index 100% rename from ngraph/test/models/onnx/max_pool_4d_ceil_strides.prototxt rename to src/core/tests/models/onnx/max_pool_4d_ceil_strides.prototxt diff --git a/ngraph/test/models/onnx/max_pool_4d_dilations.prototxt b/src/core/tests/models/onnx/max_pool_4d_dilations.prototxt similarity index 100% rename from ngraph/test/models/onnx/max_pool_4d_dilations.prototxt rename to src/core/tests/models/onnx/max_pool_4d_dilations.prototxt diff --git a/ngraph/test/models/onnx/max_pool_4d_strides.prototxt b/src/core/tests/models/onnx/max_pool_4d_strides.prototxt similarity index 100% rename from ngraph/test/models/onnx/max_pool_4d_strides.prototxt rename to src/core/tests/models/onnx/max_pool_4d_strides.prototxt diff --git a/ngraph/test/models/onnx/mean.prototxt b/src/core/tests/models/onnx/mean.prototxt similarity index 100% rename from ngraph/test/models/onnx/mean.prototxt rename to src/core/tests/models/onnx/mean.prototxt diff --git a/ngraph/test/models/onnx/mean_opset1.prototxt b/src/core/tests/models/onnx/mean_opset1.prototxt similarity index 100% rename from ngraph/test/models/onnx/mean_opset1.prototxt rename to src/core/tests/models/onnx/mean_opset1.prototxt diff --git a/ngraph/test/models/onnx/min_two_inputs.prototxt b/src/core/tests/models/onnx/min_two_inputs.prototxt similarity index 100% rename from ngraph/test/models/onnx/min_two_inputs.prototxt rename to src/core/tests/models/onnx/min_two_inputs.prototxt diff --git a/ngraph/test/models/onnx/min_two_inputs_opset1.prototxt b/src/core/tests/models/onnx/min_two_inputs_opset1.prototxt similarity index 100% rename from ngraph/test/models/onnx/min_two_inputs_opset1.prototxt rename to src/core/tests/models/onnx/min_two_inputs_opset1.prototxt diff --git a/ngraph/test/models/onnx/missing_input.prototxt b/src/core/tests/models/onnx/missing_input.prototxt similarity index 100% rename from ngraph/test/models/onnx/missing_input.prototxt rename to src/core/tests/models/onnx/missing_input.prototxt diff --git a/ngraph/test/models/onnx/missing_op_domain.prototxt b/src/core/tests/models/onnx/missing_op_domain.prototxt similarity index 100% rename from ngraph/test/models/onnx/missing_op_domain.prototxt rename to src/core/tests/models/onnx/missing_op_domain.prototxt diff --git a/ngraph/test/models/onnx/mod_incorrect_fmod.prototxt b/src/core/tests/models/onnx/mod_incorrect_fmod.prototxt similarity index 100% rename from ngraph/test/models/onnx/mod_incorrect_fmod.prototxt rename to src/core/tests/models/onnx/mod_incorrect_fmod.prototxt diff --git a/ngraph/test/models/onnx/mod_sign.prototxt b/src/core/tests/models/onnx/mod_sign.prototxt similarity index 100% rename from ngraph/test/models/onnx/mod_sign.prototxt rename to src/core/tests/models/onnx/mod_sign.prototxt diff --git a/ngraph/test/models/onnx/mod_sign_broadcast.prototxt b/src/core/tests/models/onnx/mod_sign_broadcast.prototxt similarity index 100% rename from ngraph/test/models/onnx/mod_sign_broadcast.prototxt rename to src/core/tests/models/onnx/mod_sign_broadcast.prototxt diff --git a/ngraph/test/models/onnx/mod_sign_f32.prototxt b/src/core/tests/models/onnx/mod_sign_f32.prototxt similarity index 100% rename from ngraph/test/models/onnx/mod_sign_f32.prototxt rename to src/core/tests/models/onnx/mod_sign_f32.prototxt diff --git a/ngraph/test/models/onnx/mod_sign_fmod.prototxt b/src/core/tests/models/onnx/mod_sign_fmod.prototxt similarity index 100% rename from ngraph/test/models/onnx/mod_sign_fmod.prototxt rename to src/core/tests/models/onnx/mod_sign_fmod.prototxt diff --git a/ngraph/test/models/onnx/mod_sign_fmod_broadcast.prototxt b/src/core/tests/models/onnx/mod_sign_fmod_broadcast.prototxt similarity index 100% rename from ngraph/test/models/onnx/mod_sign_fmod_broadcast.prototxt rename to src/core/tests/models/onnx/mod_sign_fmod_broadcast.prototxt diff --git a/ngraph/test/models/onnx/mod_sign_fmod_f32.prototxt b/src/core/tests/models/onnx/mod_sign_fmod_f32.prototxt similarity index 100% rename from ngraph/test/models/onnx/mod_sign_fmod_f32.prototxt rename to src/core/tests/models/onnx/mod_sign_fmod_f32.prototxt diff --git a/ngraph/test/models/onnx/mod_sign_i64.prototxt b/src/core/tests/models/onnx/mod_sign_i64.prototxt similarity index 100% rename from ngraph/test/models/onnx/mod_sign_i64.prototxt rename to src/core/tests/models/onnx/mod_sign_i64.prototxt diff --git a/ngraph/test/models/onnx/model_editor/add_1D.prototxt b/src/core/tests/models/onnx/model_editor/add_1D.prototxt similarity index 100% rename from ngraph/test/models/onnx/model_editor/add_1D.prototxt rename to src/core/tests/models/onnx/model_editor/add_1D.prototxt diff --git a/ngraph/test/models/onnx/model_editor/add_1D_invalid.prototxt b/src/core/tests/models/onnx/model_editor/add_1D_invalid.prototxt similarity index 100% rename from ngraph/test/models/onnx/model_editor/add_1D_invalid.prototxt rename to src/core/tests/models/onnx/model_editor/add_1D_invalid.prototxt diff --git a/ngraph/test/models/onnx/model_editor/add_1D_with_initializers.prototxt b/src/core/tests/models/onnx/model_editor/add_1D_with_initializers.prototxt similarity index 100% rename from ngraph/test/models/onnx/model_editor/add_1D_with_initializers.prototxt rename to src/core/tests/models/onnx/model_editor/add_1D_with_initializers.prototxt diff --git a/ngraph/test/models/onnx/model_editor/add_1D_with_initializers_only.prototxt b/src/core/tests/models/onnx/model_editor/add_1D_with_initializers_only.prototxt similarity index 100% rename from ngraph/test/models/onnx/model_editor/add_1D_with_initializers_only.prototxt rename to src/core/tests/models/onnx/model_editor/add_1D_with_initializers_only.prototxt diff --git a/ngraph/test/models/onnx/model_editor/add_ab.prototxt b/src/core/tests/models/onnx/model_editor/add_ab.prototxt similarity index 100% rename from ngraph/test/models/onnx/model_editor/add_ab.prototxt rename to src/core/tests/models/onnx/model_editor/add_ab.prototxt diff --git a/ngraph/test/models/onnx/model_editor/add_abc.prototxt b/src/core/tests/models/onnx/model_editor/add_abc.prototxt similarity index 100% rename from ngraph/test/models/onnx/model_editor/add_abc.prototxt rename to src/core/tests/models/onnx/model_editor/add_abc.prototxt diff --git a/ngraph/test/models/onnx/model_editor/elem_type_missing_in_input.prototxt b/src/core/tests/models/onnx/model_editor/elem_type_missing_in_input.prototxt similarity index 100% rename from ngraph/test/models/onnx/model_editor/elem_type_missing_in_input.prototxt rename to src/core/tests/models/onnx/model_editor/elem_type_missing_in_input.prototxt diff --git a/ngraph/test/models/onnx/model_editor/invalid_input_no_tensor_type.prototxt b/src/core/tests/models/onnx/model_editor/invalid_input_no_tensor_type.prototxt similarity index 100% rename from ngraph/test/models/onnx/model_editor/invalid_input_no_tensor_type.prototxt rename to src/core/tests/models/onnx/model_editor/invalid_input_no_tensor_type.prototxt diff --git a/ngraph/test/models/onnx/model_editor/invalid_input_no_type.prototxt b/src/core/tests/models/onnx/model_editor/invalid_input_no_type.prototxt similarity index 100% rename from ngraph/test/models/onnx/model_editor/invalid_input_no_type.prototxt rename to src/core/tests/models/onnx/model_editor/invalid_input_no_type.prototxt diff --git a/ngraph/test/models/onnx/model_editor/reference/subgraph__existing_inputs_and_outputs_based_extraction.prototxt b/src/core/tests/models/onnx/model_editor/reference/subgraph__existing_inputs_and_outputs_based_extraction.prototxt similarity index 100% rename from ngraph/test/models/onnx/model_editor/reference/subgraph__existing_inputs_and_outputs_based_extraction.prototxt rename to src/core/tests/models/onnx/model_editor/reference/subgraph__existing_inputs_and_outputs_based_extraction.prototxt diff --git a/ngraph/test/models/onnx/model_editor/reference/subgraph__initializer_to_input_replacement.prototxt b/src/core/tests/models/onnx/model_editor/reference/subgraph__initializer_to_input_replacement.prototxt similarity index 100% rename from ngraph/test/models/onnx/model_editor/reference/subgraph__initializer_to_input_replacement.prototxt rename to src/core/tests/models/onnx/model_editor/reference/subgraph__initializer_to_input_replacement.prototxt diff --git a/ngraph/test/models/onnx/model_editor/reference/subgraph__initializer_without_matching_input_tail_cut.prototxt b/src/core/tests/models/onnx/model_editor/reference/subgraph__initializer_without_matching_input_tail_cut.prototxt similarity index 100% rename from ngraph/test/models/onnx/model_editor/reference/subgraph__initializer_without_matching_input_tail_cut.prototxt rename to src/core/tests/models/onnx/model_editor/reference/subgraph__initializer_without_matching_input_tail_cut.prototxt diff --git a/ngraph/test/models/onnx/model_editor/reference/subgraph__input_edge_from_tensor_with_multiple_consumers.prototxt b/src/core/tests/models/onnx/model_editor/reference/subgraph__input_edge_from_tensor_with_multiple_consumers.prototxt similarity index 100% rename from ngraph/test/models/onnx/model_editor/reference/subgraph__input_edge_from_tensor_with_multiple_consumers.prototxt rename to src/core/tests/models/onnx/model_editor/reference/subgraph__input_edge_from_tensor_with_multiple_consumers.prototxt diff --git a/ngraph/test/models/onnx/model_editor/reference/subgraph__input_edge_from_tensor_with_multiple_consumers_2.prototxt b/src/core/tests/models/onnx/model_editor/reference/subgraph__input_edge_from_tensor_with_multiple_consumers_2.prototxt similarity index 100% rename from ngraph/test/models/onnx/model_editor/reference/subgraph__input_edge_from_tensor_with_multiple_consumers_2.prototxt rename to src/core/tests/models/onnx/model_editor/reference/subgraph__input_edge_from_tensor_with_multiple_consumers_2.prototxt diff --git a/ngraph/test/models/onnx/model_editor/reference/subgraph__input_edge_from_tensor_with_multiple_consumers_3.prototxt b/src/core/tests/models/onnx/model_editor/reference/subgraph__input_edge_from_tensor_with_multiple_consumers_3.prototxt similarity index 100% rename from ngraph/test/models/onnx/model_editor/reference/subgraph__input_edge_from_tensor_with_multiple_consumers_3.prototxt rename to src/core/tests/models/onnx/model_editor/reference/subgraph__input_edge_from_tensor_with_multiple_consumers_3.prototxt diff --git a/ngraph/test/models/onnx/model_editor/reference/subgraph__input_edge_from_tensor_with_multiple_consumers_4.prototxt b/src/core/tests/models/onnx/model_editor/reference/subgraph__input_edge_from_tensor_with_multiple_consumers_4.prototxt similarity index 100% rename from ngraph/test/models/onnx/model_editor/reference/subgraph__input_edge_from_tensor_with_multiple_consumers_4.prototxt rename to src/core/tests/models/onnx/model_editor/reference/subgraph__input_edge_from_tensor_with_multiple_consumers_4.prototxt diff --git a/ngraph/test/models/onnx/model_editor/reference/subgraph__input_edge_from_tensor_with_multiple_consumers_5.prototxt b/src/core/tests/models/onnx/model_editor/reference/subgraph__input_edge_from_tensor_with_multiple_consumers_5.prototxt similarity index 100% rename from ngraph/test/models/onnx/model_editor/reference/subgraph__input_edge_from_tensor_with_multiple_consumers_5.prototxt rename to src/core/tests/models/onnx/model_editor/reference/subgraph__input_edge_from_tensor_with_multiple_consumers_5.prototxt diff --git a/ngraph/test/models/onnx/model_editor/reference/subgraph__input_edge_from_tensor_with_multiple_consumers_custom_names.prototxt b/src/core/tests/models/onnx/model_editor/reference/subgraph__input_edge_from_tensor_with_multiple_consumers_custom_names.prototxt similarity index 100% rename from ngraph/test/models/onnx/model_editor/reference/subgraph__input_edge_from_tensor_with_multiple_consumers_custom_names.prototxt rename to src/core/tests/models/onnx/model_editor/reference/subgraph__input_edge_from_tensor_with_multiple_consumers_custom_names.prototxt diff --git a/ngraph/test/models/onnx/model_editor/reference/subgraph__linear_model_deeper_head_cut.prototxt b/src/core/tests/models/onnx/model_editor/reference/subgraph__linear_model_deeper_head_cut.prototxt similarity index 100% rename from ngraph/test/models/onnx/model_editor/reference/subgraph__linear_model_deeper_head_cut.prototxt rename to src/core/tests/models/onnx/model_editor/reference/subgraph__linear_model_deeper_head_cut.prototxt diff --git a/ngraph/test/models/onnx/model_editor/reference/subgraph__linear_model_deeper_tail_cut.prototxt b/src/core/tests/models/onnx/model_editor/reference/subgraph__linear_model_deeper_tail_cut.prototxt similarity index 100% rename from ngraph/test/models/onnx/model_editor/reference/subgraph__linear_model_deeper_tail_cut.prototxt rename to src/core/tests/models/onnx/model_editor/reference/subgraph__linear_model_deeper_tail_cut.prototxt diff --git a/ngraph/test/models/onnx/model_editor/reference/subgraph__linear_model_head_cut.prototxt b/src/core/tests/models/onnx/model_editor/reference/subgraph__linear_model_head_cut.prototxt similarity index 100% rename from ngraph/test/models/onnx/model_editor/reference/subgraph__linear_model_head_cut.prototxt rename to src/core/tests/models/onnx/model_editor/reference/subgraph__linear_model_head_cut.prototxt diff --git a/ngraph/test/models/onnx/model_editor/reference/subgraph__linear_model_tail_cut.prototxt b/src/core/tests/models/onnx/model_editor/reference/subgraph__linear_model_tail_cut.prototxt similarity index 100% rename from ngraph/test/models/onnx/model_editor/reference/subgraph__linear_model_tail_cut.prototxt rename to src/core/tests/models/onnx/model_editor/reference/subgraph__linear_model_tail_cut.prototxt diff --git a/ngraph/test/models/onnx/model_editor/reference/subgraph__linear_model_with_initializer_tail_cut.prototxt b/src/core/tests/models/onnx/model_editor/reference/subgraph__linear_model_with_initializer_tail_cut.prototxt similarity index 100% rename from ngraph/test/models/onnx/model_editor/reference/subgraph__linear_model_with_initializer_tail_cut.prototxt rename to src/core/tests/models/onnx/model_editor/reference/subgraph__linear_model_with_initializer_tail_cut.prototxt diff --git a/ngraph/test/models/onnx/model_editor/reference/subgraph__multiout_op_output_edge.prototxt b/src/core/tests/models/onnx/model_editor/reference/subgraph__multiout_op_output_edge.prototxt similarity index 100% rename from ngraph/test/models/onnx/model_editor/reference/subgraph__multiout_op_output_edge.prototxt rename to src/core/tests/models/onnx/model_editor/reference/subgraph__multiout_op_output_edge.prototxt diff --git a/ngraph/test/models/onnx/model_editor/reference/subgraph__multiple_consumers_of_graph_initializer.prototxt b/src/core/tests/models/onnx/model_editor/reference/subgraph__multiple_consumers_of_graph_initializer.prototxt similarity index 100% rename from ngraph/test/models/onnx/model_editor/reference/subgraph__multiple_consumers_of_graph_initializer.prototxt rename to src/core/tests/models/onnx/model_editor/reference/subgraph__multiple_consumers_of_graph_initializer.prototxt diff --git a/ngraph/test/models/onnx/model_editor/reference/subgraph__multiple_consumers_of_graph_initializer_relu2_and_init.prototxt b/src/core/tests/models/onnx/model_editor/reference/subgraph__multiple_consumers_of_graph_initializer_relu2_and_init.prototxt similarity index 100% rename from ngraph/test/models/onnx/model_editor/reference/subgraph__multiple_consumers_of_graph_initializer_relu2_and_init.prototxt rename to src/core/tests/models/onnx/model_editor/reference/subgraph__multiple_consumers_of_graph_initializer_relu2_and_init.prototxt diff --git a/ngraph/test/models/onnx/model_editor/reference/subgraph__multiple_consumers_of_graph_input_relu2.prototxt b/src/core/tests/models/onnx/model_editor/reference/subgraph__multiple_consumers_of_graph_input_relu2.prototxt similarity index 100% rename from ngraph/test/models/onnx/model_editor/reference/subgraph__multiple_consumers_of_graph_input_relu2.prototxt rename to src/core/tests/models/onnx/model_editor/reference/subgraph__multiple_consumers_of_graph_input_relu2.prototxt diff --git a/ngraph/test/models/onnx/model_editor/reference/subgraph__twice_input_edge_from_tensor_with_single_consumer.prototxt b/src/core/tests/models/onnx/model_editor/reference/subgraph__twice_input_edge_from_tensor_with_single_consumer.prototxt similarity index 100% rename from ngraph/test/models/onnx/model_editor/reference/subgraph__twice_input_edge_from_tensor_with_single_consumer.prototxt rename to src/core/tests/models/onnx/model_editor/reference/subgraph__twice_input_edge_from_tensor_with_single_consumer.prototxt diff --git a/ngraph/test/models/onnx/model_editor/reference/subgraph__use_edge_mapper_with_graph_cutter_custom_names.prototxt b/src/core/tests/models/onnx/model_editor/reference/subgraph__use_edge_mapper_with_graph_cutter_custom_names.prototxt similarity index 100% rename from ngraph/test/models/onnx/model_editor/reference/subgraph__use_edge_mapper_with_graph_cutter_custom_names.prototxt rename to src/core/tests/models/onnx/model_editor/reference/subgraph__use_edge_mapper_with_graph_cutter_custom_names.prototxt diff --git a/ngraph/test/models/onnx/model_editor/reference/unknown_input_value_info.prototxt b/src/core/tests/models/onnx/model_editor/reference/unknown_input_value_info.prototxt similarity index 100% rename from ngraph/test/models/onnx/model_editor/reference/unknown_input_value_info.prototxt rename to src/core/tests/models/onnx/model_editor/reference/unknown_input_value_info.prototxt diff --git a/ngraph/test/models/onnx/model_editor/shapes__add_two_inputs.prototxt b/src/core/tests/models/onnx/model_editor/shapes__add_two_inputs.prototxt similarity index 100% rename from ngraph/test/models/onnx/model_editor/shapes__add_two_inputs.prototxt rename to src/core/tests/models/onnx/model_editor/shapes__add_two_inputs.prototxt diff --git a/ngraph/test/models/onnx/model_editor/shapes__dynamic_rank_in_model.prototxt b/src/core/tests/models/onnx/model_editor/shapes__dynamic_rank_in_model.prototxt similarity index 100% rename from ngraph/test/models/onnx/model_editor/shapes__dynamic_rank_in_model.prototxt rename to src/core/tests/models/onnx/model_editor/shapes__dynamic_rank_in_model.prototxt diff --git a/ngraph/test/models/onnx/model_editor/subgraph__inception_head.prototxt b/src/core/tests/models/onnx/model_editor/subgraph__inception_head.prototxt similarity index 100% rename from ngraph/test/models/onnx/model_editor/subgraph__inception_head.prototxt rename to src/core/tests/models/onnx/model_editor/subgraph__inception_head.prototxt diff --git a/ngraph/test/models/onnx/model_editor/subgraph__inception_head_with_initializer.prototxt b/src/core/tests/models/onnx/model_editor/subgraph__inception_head_with_initializer.prototxt similarity index 100% rename from ngraph/test/models/onnx/model_editor/subgraph__inception_head_with_initializer.prototxt rename to src/core/tests/models/onnx/model_editor/subgraph__inception_head_with_initializer.prototxt diff --git a/ngraph/test/models/onnx/model_editor/subgraph__initializer_without_matching_input.prototxt b/src/core/tests/models/onnx/model_editor/subgraph__initializer_without_matching_input.prototxt similarity index 100% rename from ngraph/test/models/onnx/model_editor/subgraph__initializer_without_matching_input.prototxt rename to src/core/tests/models/onnx/model_editor/subgraph__initializer_without_matching_input.prototxt diff --git a/ngraph/test/models/onnx/model_editor/subgraph_extraction_tests.prototxt b/src/core/tests/models/onnx/model_editor/subgraph_extraction_tests.prototxt similarity index 100% rename from ngraph/test/models/onnx/model_editor/subgraph_extraction_tests.prototxt rename to src/core/tests/models/onnx/model_editor/subgraph_extraction_tests.prototxt diff --git a/ngraph/test/models/onnx/model_editor/subgraph_extraction_tests_2.prototxt b/src/core/tests/models/onnx/model_editor/subgraph_extraction_tests_2.prototxt similarity index 100% rename from ngraph/test/models/onnx/model_editor/subgraph_extraction_tests_2.prototxt rename to src/core/tests/models/onnx/model_editor/subgraph_extraction_tests_2.prototxt diff --git a/ngraph/test/models/onnx/model_editor/unknown_input_value_info.prototxt b/src/core/tests/models/onnx/model_editor/unknown_input_value_info.prototxt similarity index 100% rename from ngraph/test/models/onnx/model_editor/unknown_input_value_info.prototxt rename to src/core/tests/models/onnx/model_editor/unknown_input_value_info.prototxt diff --git a/ngraph/test/models/onnx/mul_v6.prototxt b/src/core/tests/models/onnx/mul_v6.prototxt similarity index 100% rename from ngraph/test/models/onnx/mul_v6.prototxt rename to src/core/tests/models/onnx/mul_v6.prototxt diff --git a/ngraph/test/models/onnx/mul_v6_broadcast_axes_1_2.prototxt b/src/core/tests/models/onnx/mul_v6_broadcast_axes_1_2.prototxt similarity index 100% rename from ngraph/test/models/onnx/mul_v6_broadcast_axes_1_2.prototxt rename to src/core/tests/models/onnx/mul_v6_broadcast_axes_1_2.prototxt diff --git a/ngraph/test/models/onnx/mul_v6_broadcast_axis_1.prototxt b/src/core/tests/models/onnx/mul_v6_broadcast_axis_1.prototxt similarity index 100% rename from ngraph/test/models/onnx/mul_v6_broadcast_axis_1.prototxt rename to src/core/tests/models/onnx/mul_v6_broadcast_axis_1.prototxt diff --git a/ngraph/test/models/onnx/mul_v6_broadcast_no_axis.prototxt b/src/core/tests/models/onnx/mul_v6_broadcast_no_axis.prototxt similarity index 100% rename from ngraph/test/models/onnx/mul_v6_broadcast_no_axis.prototxt rename to src/core/tests/models/onnx/mul_v6_broadcast_no_axis.prototxt diff --git a/ngraph/test/models/onnx/mul_v7.prototxt b/src/core/tests/models/onnx/mul_v7.prototxt similarity index 100% rename from ngraph/test/models/onnx/mul_v7.prototxt rename to src/core/tests/models/onnx/mul_v7.prototxt diff --git a/ngraph/test/models/onnx/mul_v7_broadcast.prototxt b/src/core/tests/models/onnx/mul_v7_broadcast.prototxt similarity index 100% rename from ngraph/test/models/onnx/mul_v7_broadcast.prototxt rename to src/core/tests/models/onnx/mul_v7_broadcast.prototxt diff --git a/ngraph/test/models/onnx/multiple_slices_last_layer.prototxt b/src/core/tests/models/onnx/multiple_slices_last_layer.prototxt similarity index 100% rename from ngraph/test/models/onnx/multiple_slices_last_layer.prototxt rename to src/core/tests/models/onnx/multiple_slices_last_layer.prototxt diff --git a/ngraph/test/models/onnx/mvn_v6.prototxt b/src/core/tests/models/onnx/mvn_v6.prototxt similarity index 100% rename from ngraph/test/models/onnx/mvn_v6.prototxt rename to src/core/tests/models/onnx/mvn_v6.prototxt diff --git a/ngraph/test/models/onnx/negativelog_likelihood_loss.prototxt b/src/core/tests/models/onnx/negativelog_likelihood_loss.prototxt similarity index 100% rename from ngraph/test/models/onnx/negativelog_likelihood_loss.prototxt rename to src/core/tests/models/onnx/negativelog_likelihood_loss.prototxt diff --git a/ngraph/test/models/onnx/non_zero_1d.prototxt b/src/core/tests/models/onnx/non_zero_1d.prototxt similarity index 100% rename from ngraph/test/models/onnx/non_zero_1d.prototxt rename to src/core/tests/models/onnx/non_zero_1d.prototxt diff --git a/ngraph/test/models/onnx/non_zero_1d_float.prototxt b/src/core/tests/models/onnx/non_zero_1d_float.prototxt similarity index 100% rename from ngraph/test/models/onnx/non_zero_1d_float.prototxt rename to src/core/tests/models/onnx/non_zero_1d_float.prototxt diff --git a/ngraph/test/models/onnx/non_zero_2d_bool.prototxt b/src/core/tests/models/onnx/non_zero_2d_bool.prototxt similarity index 100% rename from ngraph/test/models/onnx/non_zero_2d_bool.prototxt rename to src/core/tests/models/onnx/non_zero_2d_bool.prototxt diff --git a/ngraph/test/models/onnx/non_zero_3d.prototxt b/src/core/tests/models/onnx/non_zero_3d.prototxt similarity index 100% rename from ngraph/test/models/onnx/non_zero_3d.prototxt rename to src/core/tests/models/onnx/non_zero_3d.prototxt diff --git a/ngraph/test/models/onnx/non_zero_scalar.prototxt b/src/core/tests/models/onnx/non_zero_scalar.prototxt similarity index 100% rename from ngraph/test/models/onnx/non_zero_scalar.prototxt rename to src/core/tests/models/onnx/non_zero_scalar.prototxt diff --git a/ngraph/test/models/onnx/nonmaxsuppression_center_point_box_format.prototxt b/src/core/tests/models/onnx/nonmaxsuppression_center_point_box_format.prototxt similarity index 100% rename from ngraph/test/models/onnx/nonmaxsuppression_center_point_box_format.prototxt rename to src/core/tests/models/onnx/nonmaxsuppression_center_point_box_format.prototxt diff --git a/ngraph/test/models/onnx/nonmaxsuppression_single_box.prototxt b/src/core/tests/models/onnx/nonmaxsuppression_single_box.prototxt similarity index 100% rename from ngraph/test/models/onnx/nonmaxsuppression_single_box.prototxt rename to src/core/tests/models/onnx/nonmaxsuppression_single_box.prototxt diff --git a/ngraph/test/models/onnx/normalize.prototxt b/src/core/tests/models/onnx/normalize.prototxt similarity index 100% rename from ngraph/test/models/onnx/normalize.prototxt rename to src/core/tests/models/onnx/normalize.prototxt diff --git a/ngraph/test/models/onnx/one_hot_axis.prototxt b/src/core/tests/models/onnx/one_hot_axis.prototxt similarity index 100% rename from ngraph/test/models/onnx/one_hot_axis.prototxt rename to src/core/tests/models/onnx/one_hot_axis.prototxt diff --git a/ngraph/test/models/onnx/one_hot_no_axis.prototxt b/src/core/tests/models/onnx/one_hot_no_axis.prototxt similarity index 100% rename from ngraph/test/models/onnx/one_hot_no_axis.prototxt rename to src/core/tests/models/onnx/one_hot_no_axis.prototxt diff --git a/ngraph/test/models/onnx/onnx_prototxt_converter.py b/src/core/tests/models/onnx/onnx_prototxt_converter.py similarity index 100% rename from ngraph/test/models/onnx/onnx_prototxt_converter.py rename to src/core/tests/models/onnx/onnx_prototxt_converter.py diff --git a/ngraph/test/models/onnx/onnx_prototxt_converter_requirements.txt b/src/core/tests/models/onnx/onnx_prototxt_converter_requirements.txt similarity index 100% rename from ngraph/test/models/onnx/onnx_prototxt_converter_requirements.txt rename to src/core/tests/models/onnx/onnx_prototxt_converter_requirements.txt diff --git a/ngraph/test/models/onnx/org.openvinotoolkit/deformable_conv_2d.prototxt b/src/core/tests/models/onnx/org.openvinotoolkit/deformable_conv_2d.prototxt similarity index 100% rename from ngraph/test/models/onnx/org.openvinotoolkit/deformable_conv_2d.prototxt rename to src/core/tests/models/onnx/org.openvinotoolkit/deformable_conv_2d.prototxt diff --git a/ngraph/test/models/onnx/org.openvinotoolkit/experimental_detectron/detection_output.prototxt b/src/core/tests/models/onnx/org.openvinotoolkit/experimental_detectron/detection_output.prototxt similarity index 100% rename from ngraph/test/models/onnx/org.openvinotoolkit/experimental_detectron/detection_output.prototxt rename to src/core/tests/models/onnx/org.openvinotoolkit/experimental_detectron/detection_output.prototxt diff --git a/ngraph/test/models/onnx/org.openvinotoolkit/experimental_detectron/detection_output_most_attrs_default.prototxt b/src/core/tests/models/onnx/org.openvinotoolkit/experimental_detectron/detection_output_most_attrs_default.prototxt similarity index 100% rename from ngraph/test/models/onnx/org.openvinotoolkit/experimental_detectron/detection_output_most_attrs_default.prototxt rename to src/core/tests/models/onnx/org.openvinotoolkit/experimental_detectron/detection_output_most_attrs_default.prototxt diff --git a/ngraph/test/models/onnx/org.openvinotoolkit/experimental_detectron/generate_proposals_single_image.prototxt b/src/core/tests/models/onnx/org.openvinotoolkit/experimental_detectron/generate_proposals_single_image.prototxt similarity index 100% rename from ngraph/test/models/onnx/org.openvinotoolkit/experimental_detectron/generate_proposals_single_image.prototxt rename to src/core/tests/models/onnx/org.openvinotoolkit/experimental_detectron/generate_proposals_single_image.prototxt diff --git a/ngraph/test/models/onnx/org.openvinotoolkit/experimental_detectron/group_norm.prototxt b/src/core/tests/models/onnx/org.openvinotoolkit/experimental_detectron/group_norm.prototxt similarity index 100% rename from ngraph/test/models/onnx/org.openvinotoolkit/experimental_detectron/group_norm.prototxt rename to src/core/tests/models/onnx/org.openvinotoolkit/experimental_detectron/group_norm.prototxt diff --git a/ngraph/test/models/onnx/org.openvinotoolkit/experimental_detectron/prior_grid_generator.prototxt b/src/core/tests/models/onnx/org.openvinotoolkit/experimental_detectron/prior_grid_generator.prototxt similarity index 100% rename from ngraph/test/models/onnx/org.openvinotoolkit/experimental_detectron/prior_grid_generator.prototxt rename to src/core/tests/models/onnx/org.openvinotoolkit/experimental_detectron/prior_grid_generator.prototxt diff --git a/ngraph/test/models/onnx/org.openvinotoolkit/experimental_detectron/roi_feature_extractor.prototxt b/src/core/tests/models/onnx/org.openvinotoolkit/experimental_detectron/roi_feature_extractor.prototxt similarity index 100% rename from ngraph/test/models/onnx/org.openvinotoolkit/experimental_detectron/roi_feature_extractor.prototxt rename to src/core/tests/models/onnx/org.openvinotoolkit/experimental_detectron/roi_feature_extractor.prototxt diff --git a/ngraph/test/models/onnx/org.openvinotoolkit/experimental_detectron/topk_rios.prototxt b/src/core/tests/models/onnx/org.openvinotoolkit/experimental_detectron/topk_rios.prototxt similarity index 100% rename from ngraph/test/models/onnx/org.openvinotoolkit/experimental_detectron/topk_rios.prototxt rename to src/core/tests/models/onnx/org.openvinotoolkit/experimental_detectron/topk_rios.prototxt diff --git a/ngraph/test/models/onnx/override_op.prototxt b/src/core/tests/models/onnx/override_op.prototxt similarity index 100% rename from ngraph/test/models/onnx/override_op.prototxt rename to src/core/tests/models/onnx/override_op.prototxt diff --git a/ngraph/test/models/onnx/pad_constant.prototxt b/src/core/tests/models/onnx/pad_constant.prototxt similarity index 100% rename from ngraph/test/models/onnx/pad_constant.prototxt rename to src/core/tests/models/onnx/pad_constant.prototxt diff --git a/ngraph/test/models/onnx/pow_float32_float32.prototxt b/src/core/tests/models/onnx/pow_float32_float32.prototxt similarity index 100% rename from ngraph/test/models/onnx/pow_float32_float32.prototxt rename to src/core/tests/models/onnx/pow_float32_float32.prototxt diff --git a/ngraph/test/models/onnx/pow_float32_int32.prototxt b/src/core/tests/models/onnx/pow_float32_int32.prototxt similarity index 100% rename from ngraph/test/models/onnx/pow_float32_int32.prototxt rename to src/core/tests/models/onnx/pow_float32_int32.prototxt diff --git a/ngraph/test/models/onnx/pow_int32_float32.prototxt b/src/core/tests/models/onnx/pow_int32_float32.prototxt similarity index 100% rename from ngraph/test/models/onnx/pow_int32_float32.prototxt rename to src/core/tests/models/onnx/pow_int32_float32.prototxt diff --git a/ngraph/test/models/onnx/prelu.prototxt b/src/core/tests/models/onnx/prelu.prototxt similarity index 100% rename from ngraph/test/models/onnx/prelu.prototxt rename to src/core/tests/models/onnx/prelu.prototxt diff --git a/ngraph/test/models/onnx/prelu_1d.prototxt b/src/core/tests/models/onnx/prelu_1d.prototxt similarity index 100% rename from ngraph/test/models/onnx/prelu_1d.prototxt rename to src/core/tests/models/onnx/prelu_1d.prototxt diff --git a/ngraph/test/models/onnx/prelu_batch_nd.prototxt b/src/core/tests/models/onnx/prelu_batch_nd.prototxt similarity index 100% rename from ngraph/test/models/onnx/prelu_batch_nd.prototxt rename to src/core/tests/models/onnx/prelu_batch_nd.prototxt diff --git a/ngraph/test/models/onnx/prelu_c_1_1.prototxt b/src/core/tests/models/onnx/prelu_c_1_1.prototxt similarity index 100% rename from ngraph/test/models/onnx/prelu_c_1_1.prototxt rename to src/core/tests/models/onnx/prelu_c_1_1.prototxt diff --git a/ngraph/test/models/onnx/prior_box.prototxt b/src/core/tests/models/onnx/prior_box.prototxt similarity index 100% rename from ngraph/test/models/onnx/prior_box.prototxt rename to src/core/tests/models/onnx/prior_box.prototxt diff --git a/ngraph/test/models/onnx/priorbox_clustered.prototxt b/src/core/tests/models/onnx/priorbox_clustered.prototxt similarity index 100% rename from ngraph/test/models/onnx/priorbox_clustered.prototxt rename to src/core/tests/models/onnx/priorbox_clustered.prototxt diff --git a/ngraph/test/models/onnx/priorbox_clustered_first_input_bad_shape.prototxt b/src/core/tests/models/onnx/priorbox_clustered_first_input_bad_shape.prototxt similarity index 100% rename from ngraph/test/models/onnx/priorbox_clustered_first_input_bad_shape.prototxt rename to src/core/tests/models/onnx/priorbox_clustered_first_input_bad_shape.prototxt diff --git a/ngraph/test/models/onnx/priorbox_clustered_most_attrs_default.prototxt b/src/core/tests/models/onnx/priorbox_clustered_most_attrs_default.prototxt similarity index 100% rename from ngraph/test/models/onnx/priorbox_clustered_most_attrs_default.prototxt rename to src/core/tests/models/onnx/priorbox_clustered_most_attrs_default.prototxt diff --git a/ngraph/test/models/onnx/priorbox_clustered_second_input_bad_shape.prototxt b/src/core/tests/models/onnx/priorbox_clustered_second_input_bad_shape.prototxt similarity index 100% rename from ngraph/test/models/onnx/priorbox_clustered_second_input_bad_shape.prototxt rename to src/core/tests/models/onnx/priorbox_clustered_second_input_bad_shape.prototxt diff --git a/ngraph/test/models/onnx/provenance_input_tags.prototxt b/src/core/tests/models/onnx/provenance_input_tags.prototxt similarity index 100% rename from ngraph/test/models/onnx/provenance_input_tags.prototxt rename to src/core/tests/models/onnx/provenance_input_tags.prototxt diff --git a/ngraph/test/models/onnx/provenance_multiple_outputs_op.prototxt b/src/core/tests/models/onnx/provenance_multiple_outputs_op.prototxt similarity index 100% rename from ngraph/test/models/onnx/provenance_multiple_outputs_op.prototxt rename to src/core/tests/models/onnx/provenance_multiple_outputs_op.prototxt diff --git a/ngraph/test/models/onnx/provenance_node_name_and_outputs.prototxt b/src/core/tests/models/onnx/provenance_node_name_and_outputs.prototxt similarity index 100% rename from ngraph/test/models/onnx/provenance_node_name_and_outputs.prototxt rename to src/core/tests/models/onnx/provenance_node_name_and_outputs.prototxt diff --git a/ngraph/test/models/onnx/provenance_only_outputs.prototxt b/src/core/tests/models/onnx/provenance_only_outputs.prototxt similarity index 100% rename from ngraph/test/models/onnx/provenance_only_outputs.prototxt rename to src/core/tests/models/onnx/provenance_only_outputs.prototxt diff --git a/ngraph/test/models/onnx/provenance_tag_add.prototxt b/src/core/tests/models/onnx/provenance_tag_add.prototxt similarity index 100% rename from ngraph/test/models/onnx/provenance_tag_add.prototxt rename to src/core/tests/models/onnx/provenance_tag_add.prototxt diff --git a/ngraph/test/models/onnx/qlinear_conv_2d.prototxt b/src/core/tests/models/onnx/qlinear_conv_2d.prototxt similarity index 100% rename from ngraph/test/models/onnx/qlinear_conv_2d.prototxt rename to src/core/tests/models/onnx/qlinear_conv_2d.prototxt diff --git a/ngraph/test/models/onnx/qlinear_conv_3d.prototxt b/src/core/tests/models/onnx/qlinear_conv_3d.prototxt similarity index 100% rename from ngraph/test/models/onnx/qlinear_conv_3d.prototxt rename to src/core/tests/models/onnx/qlinear_conv_3d.prototxt diff --git a/ngraph/test/models/onnx/qlinear_matmul.prototxt b/src/core/tests/models/onnx/qlinear_matmul.prototxt similarity index 100% rename from ngraph/test/models/onnx/qlinear_matmul.prototxt rename to src/core/tests/models/onnx/qlinear_matmul.prototxt diff --git a/ngraph/test/models/onnx/qlinear_matmul_3d.prototxt b/src/core/tests/models/onnx/qlinear_matmul_3d.prototxt similarity index 100% rename from ngraph/test/models/onnx/qlinear_matmul_3d.prototxt rename to src/core/tests/models/onnx/qlinear_matmul_3d.prototxt diff --git a/ngraph/test/models/onnx/quant_conv_lin.prototxt b/src/core/tests/models/onnx/quant_conv_lin.prototxt similarity index 100% rename from ngraph/test/models/onnx/quant_conv_lin.prototxt rename to src/core/tests/models/onnx/quant_conv_lin.prototxt diff --git a/ngraph/test/models/onnx/quant_dequant_pattern.prototxt b/src/core/tests/models/onnx/quant_dequant_pattern.prototxt similarity index 100% rename from ngraph/test/models/onnx/quant_dequant_pattern.prototxt rename to src/core/tests/models/onnx/quant_dequant_pattern.prototxt diff --git a/ngraph/test/models/onnx/quant_dequant_pattern_axis.prototxt b/src/core/tests/models/onnx/quant_dequant_pattern_axis.prototxt similarity index 100% rename from ngraph/test/models/onnx/quant_dequant_pattern_axis.prototxt rename to src/core/tests/models/onnx/quant_dequant_pattern_axis.prototxt diff --git a/ngraph/test/models/onnx/quantization/dynamicquantizelinear.prototxt b/src/core/tests/models/onnx/quantization/dynamicquantizelinear.prototxt similarity index 100% rename from ngraph/test/models/onnx/quantization/dynamicquantizelinear.prototxt rename to src/core/tests/models/onnx/quantization/dynamicquantizelinear.prototxt diff --git a/ngraph/test/models/onnx/quantization/fake_quantize_const_inputs.prototxt b/src/core/tests/models/onnx/quantization/fake_quantize_const_inputs.prototxt similarity index 100% rename from ngraph/test/models/onnx/quantization/fake_quantize_const_inputs.prototxt rename to src/core/tests/models/onnx/quantization/fake_quantize_const_inputs.prototxt diff --git a/ngraph/test/models/onnx/quantization/fake_quantize_nonconst_inputs.prototxt b/src/core/tests/models/onnx/quantization/fake_quantize_nonconst_inputs.prototxt similarity index 100% rename from ngraph/test/models/onnx/quantization/fake_quantize_nonconst_inputs.prototxt rename to src/core/tests/models/onnx/quantization/fake_quantize_nonconst_inputs.prototxt diff --git a/ngraph/test/models/onnx/quantization/quant_conv_linear_onnx_example.prototxt b/src/core/tests/models/onnx/quantization/quant_conv_linear_onnx_example.prototxt similarity index 100% rename from ngraph/test/models/onnx/quantization/quant_conv_linear_onnx_example.prototxt rename to src/core/tests/models/onnx/quantization/quant_conv_linear_onnx_example.prototxt diff --git a/ngraph/test/models/onnx/quantize_linear.prototxt b/src/core/tests/models/onnx/quantize_linear.prototxt similarity index 100% rename from ngraph/test/models/onnx/quantize_linear.prototxt rename to src/core/tests/models/onnx/quantize_linear.prototxt diff --git a/ngraph/test/models/onnx/quantize_linear_axis_negative.prototxt b/src/core/tests/models/onnx/quantize_linear_axis_negative.prototxt similarity index 100% rename from ngraph/test/models/onnx/quantize_linear_axis_negative.prototxt rename to src/core/tests/models/onnx/quantize_linear_axis_negative.prototxt diff --git a/ngraph/test/models/onnx/quantize_linear_axis_zero.prototxt b/src/core/tests/models/onnx/quantize_linear_axis_zero.prototxt similarity index 100% rename from ngraph/test/models/onnx/quantize_linear_axis_zero.prototxt rename to src/core/tests/models/onnx/quantize_linear_axis_zero.prototxt diff --git a/ngraph/test/models/onnx/quantize_linear_const.prototxt b/src/core/tests/models/onnx/quantize_linear_const.prototxt similarity index 100% rename from ngraph/test/models/onnx/quantize_linear_const.prototxt rename to src/core/tests/models/onnx/quantize_linear_const.prototxt diff --git a/ngraph/test/models/onnx/quantize_linear_zero_point.prototxt b/src/core/tests/models/onnx/quantize_linear_zero_point.prototxt similarity index 100% rename from ngraph/test/models/onnx/quantize_linear_zero_point.prototxt rename to src/core/tests/models/onnx/quantize_linear_zero_point.prototxt diff --git a/ngraph/test/models/onnx/random_normal.prototxt b/src/core/tests/models/onnx/random_normal.prototxt similarity index 100% rename from ngraph/test/models/onnx/random_normal.prototxt rename to src/core/tests/models/onnx/random_normal.prototxt diff --git a/ngraph/test/models/onnx/random_normal_like.prototxt b/src/core/tests/models/onnx/random_normal_like.prototxt similarity index 100% rename from ngraph/test/models/onnx/random_normal_like.prototxt rename to src/core/tests/models/onnx/random_normal_like.prototxt diff --git a/ngraph/test/models/onnx/random_uniform.prototxt b/src/core/tests/models/onnx/random_uniform.prototxt similarity index 100% rename from ngraph/test/models/onnx/random_uniform.prototxt rename to src/core/tests/models/onnx/random_uniform.prototxt diff --git a/ngraph/test/models/onnx/random_uniform_like.prototxt b/src/core/tests/models/onnx/random_uniform_like.prototxt similarity index 100% rename from ngraph/test/models/onnx/random_uniform_like.prototxt rename to src/core/tests/models/onnx/random_uniform_like.prototxt diff --git a/ngraph/test/models/onnx/range.prototxt b/src/core/tests/models/onnx/range.prototxt similarity index 100% rename from ngraph/test/models/onnx/range.prototxt rename to src/core/tests/models/onnx/range.prototxt diff --git a/ngraph/test/models/onnx/reciprocal.prototxt b/src/core/tests/models/onnx/reciprocal.prototxt similarity index 100% rename from ngraph/test/models/onnx/reciprocal.prototxt rename to src/core/tests/models/onnx/reciprocal.prototxt diff --git a/ngraph/test/models/onnx/reduce_l1.prototxt b/src/core/tests/models/onnx/reduce_l1.prototxt similarity index 100% rename from ngraph/test/models/onnx/reduce_l1.prototxt rename to src/core/tests/models/onnx/reduce_l1.prototxt diff --git a/ngraph/test/models/onnx/reduce_l2.prototxt b/src/core/tests/models/onnx/reduce_l2.prototxt similarity index 100% rename from ngraph/test/models/onnx/reduce_l2.prototxt rename to src/core/tests/models/onnx/reduce_l2.prototxt diff --git a/ngraph/test/models/onnx/reduce_log_sum.prototxt b/src/core/tests/models/onnx/reduce_log_sum.prototxt similarity index 100% rename from ngraph/test/models/onnx/reduce_log_sum.prototxt rename to src/core/tests/models/onnx/reduce_log_sum.prototxt diff --git a/ngraph/test/models/onnx/reduce_log_sum_exp.prototxt b/src/core/tests/models/onnx/reduce_log_sum_exp.prototxt similarity index 100% rename from ngraph/test/models/onnx/reduce_log_sum_exp.prototxt rename to src/core/tests/models/onnx/reduce_log_sum_exp.prototxt diff --git a/ngraph/test/models/onnx/reduce_max.prototxt b/src/core/tests/models/onnx/reduce_max.prototxt similarity index 100% rename from ngraph/test/models/onnx/reduce_max.prototxt rename to src/core/tests/models/onnx/reduce_max.prototxt diff --git a/ngraph/test/models/onnx/reduce_max_invalid_axes.prototxt b/src/core/tests/models/onnx/reduce_max_invalid_axes.prototxt similarity index 100% rename from ngraph/test/models/onnx/reduce_max_invalid_axes.prototxt rename to src/core/tests/models/onnx/reduce_max_invalid_axes.prototxt diff --git a/ngraph/test/models/onnx/reduce_mean.prototxt b/src/core/tests/models/onnx/reduce_mean.prototxt similarity index 100% rename from ngraph/test/models/onnx/reduce_mean.prototxt rename to src/core/tests/models/onnx/reduce_mean.prototxt diff --git a/ngraph/test/models/onnx/reduce_min.prototxt b/src/core/tests/models/onnx/reduce_min.prototxt similarity index 100% rename from ngraph/test/models/onnx/reduce_min.prototxt rename to src/core/tests/models/onnx/reduce_min.prototxt diff --git a/ngraph/test/models/onnx/reduce_prod.prototxt b/src/core/tests/models/onnx/reduce_prod.prototxt similarity index 100% rename from ngraph/test/models/onnx/reduce_prod.prototxt rename to src/core/tests/models/onnx/reduce_prod.prototxt diff --git a/ngraph/test/models/onnx/reduce_sum.prototxt b/src/core/tests/models/onnx/reduce_sum.prototxt similarity index 100% rename from ngraph/test/models/onnx/reduce_sum.prototxt rename to src/core/tests/models/onnx/reduce_sum.prototxt diff --git a/ngraph/test/models/onnx/reduce_sum_13_axes_as_0_dim_input.prototxt b/src/core/tests/models/onnx/reduce_sum_13_axes_as_0_dim_input.prototxt similarity index 100% rename from ngraph/test/models/onnx/reduce_sum_13_axes_as_0_dim_input.prototxt rename to src/core/tests/models/onnx/reduce_sum_13_axes_as_0_dim_input.prototxt diff --git a/ngraph/test/models/onnx/reduce_sum_13_axes_as_constant.prototxt b/src/core/tests/models/onnx/reduce_sum_13_axes_as_constant.prototxt similarity index 100% rename from ngraph/test/models/onnx/reduce_sum_13_axes_as_constant.prototxt rename to src/core/tests/models/onnx/reduce_sum_13_axes_as_constant.prototxt diff --git a/ngraph/test/models/onnx/reduce_sum_13_axes_as_constant_keepdims_off.prototxt b/src/core/tests/models/onnx/reduce_sum_13_axes_as_constant_keepdims_off.prototxt similarity index 100% rename from ngraph/test/models/onnx/reduce_sum_13_axes_as_constant_keepdims_off.prototxt rename to src/core/tests/models/onnx/reduce_sum_13_axes_as_constant_keepdims_off.prototxt diff --git a/ngraph/test/models/onnx/reduce_sum_13_axes_as_constant_single_axis.prototxt b/src/core/tests/models/onnx/reduce_sum_13_axes_as_constant_single_axis.prototxt similarity index 100% rename from ngraph/test/models/onnx/reduce_sum_13_axes_as_constant_single_axis.prototxt rename to src/core/tests/models/onnx/reduce_sum_13_axes_as_constant_single_axis.prototxt diff --git a/ngraph/test/models/onnx/reduce_sum_13_axes_as_input.prototxt b/src/core/tests/models/onnx/reduce_sum_13_axes_as_input.prototxt similarity index 100% rename from ngraph/test/models/onnx/reduce_sum_13_axes_as_input.prototxt rename to src/core/tests/models/onnx/reduce_sum_13_axes_as_input.prototxt diff --git a/ngraph/test/models/onnx/reduce_sum_13_axes_empty.prototxt b/src/core/tests/models/onnx/reduce_sum_13_axes_empty.prototxt similarity index 100% rename from ngraph/test/models/onnx/reduce_sum_13_axes_empty.prototxt rename to src/core/tests/models/onnx/reduce_sum_13_axes_empty.prototxt diff --git a/ngraph/test/models/onnx/reduce_sum_13_axes_empty_dynamic_rank_input.prototxt b/src/core/tests/models/onnx/reduce_sum_13_axes_empty_dynamic_rank_input.prototxt similarity index 100% rename from ngraph/test/models/onnx/reduce_sum_13_axes_empty_dynamic_rank_input.prototxt rename to src/core/tests/models/onnx/reduce_sum_13_axes_empty_dynamic_rank_input.prototxt diff --git a/ngraph/test/models/onnx/reduce_sum_13_axes_empty_with_noop.prototxt b/src/core/tests/models/onnx/reduce_sum_13_axes_empty_with_noop.prototxt similarity index 100% rename from ngraph/test/models/onnx/reduce_sum_13_axes_empty_with_noop.prototxt rename to src/core/tests/models/onnx/reduce_sum_13_axes_empty_with_noop.prototxt diff --git a/ngraph/test/models/onnx/reduce_sum_13_axes_empty_without_noop.prototxt b/src/core/tests/models/onnx/reduce_sum_13_axes_empty_without_noop.prototxt similarity index 100% rename from ngraph/test/models/onnx/reduce_sum_13_axes_empty_without_noop.prototxt rename to src/core/tests/models/onnx/reduce_sum_13_axes_empty_without_noop.prototxt diff --git a/ngraph/test/models/onnx/reduce_sum_13_input_dynamic.prototxt b/src/core/tests/models/onnx/reduce_sum_13_input_dynamic.prototxt similarity index 100% rename from ngraph/test/models/onnx/reduce_sum_13_input_dynamic.prototxt rename to src/core/tests/models/onnx/reduce_sum_13_input_dynamic.prototxt diff --git a/ngraph/test/models/onnx/reduce_sum_dynamic_rank_input.prototxt b/src/core/tests/models/onnx/reduce_sum_dynamic_rank_input.prototxt similarity index 100% rename from ngraph/test/models/onnx/reduce_sum_dynamic_rank_input.prototxt rename to src/core/tests/models/onnx/reduce_sum_dynamic_rank_input.prototxt diff --git a/ngraph/test/models/onnx/reduce_sum_square.prototxt b/src/core/tests/models/onnx/reduce_sum_square.prototxt similarity index 100% rename from ngraph/test/models/onnx/reduce_sum_square.prototxt rename to src/core/tests/models/onnx/reduce_sum_square.prototxt diff --git a/ngraph/test/models/onnx/relu.prototxt b/src/core/tests/models/onnx/relu.prototxt similarity index 100% rename from ngraph/test/models/onnx/relu.prototxt rename to src/core/tests/models/onnx/relu.prototxt diff --git a/ngraph/test/models/onnx/reshape_extended_dims.prototxt b/src/core/tests/models/onnx/reshape_extended_dims.prototxt similarity index 100% rename from ngraph/test/models/onnx/reshape_extended_dims.prototxt rename to src/core/tests/models/onnx/reshape_extended_dims.prototxt diff --git a/ngraph/test/models/onnx/reshape_negative_dim.prototxt b/src/core/tests/models/onnx/reshape_negative_dim.prototxt similarity index 100% rename from ngraph/test/models/onnx/reshape_negative_dim.prototxt rename to src/core/tests/models/onnx/reshape_negative_dim.prototxt diff --git a/ngraph/test/models/onnx/reshape_negative_with_zero_dims.prototxt b/src/core/tests/models/onnx/reshape_negative_with_zero_dims.prototxt similarity index 100% rename from ngraph/test/models/onnx/reshape_negative_with_zero_dims.prototxt rename to src/core/tests/models/onnx/reshape_negative_with_zero_dims.prototxt diff --git a/ngraph/test/models/onnx/reshape_output_shape_as_input.prototxt b/src/core/tests/models/onnx/reshape_output_shape_as_input.prototxt similarity index 100% rename from ngraph/test/models/onnx/reshape_output_shape_as_input.prototxt rename to src/core/tests/models/onnx/reshape_output_shape_as_input.prototxt diff --git a/ngraph/test/models/onnx/reshape_reduced_dims.prototxt b/src/core/tests/models/onnx/reshape_reduced_dims.prototxt similarity index 100% rename from ngraph/test/models/onnx/reshape_reduced_dims.prototxt rename to src/core/tests/models/onnx/reshape_reduced_dims.prototxt diff --git a/ngraph/test/models/onnx/reshape_reordered_dims.prototxt b/src/core/tests/models/onnx/reshape_reordered_dims.prototxt similarity index 100% rename from ngraph/test/models/onnx/reshape_reordered_dims.prototxt rename to src/core/tests/models/onnx/reshape_reordered_dims.prototxt diff --git a/ngraph/test/models/onnx/reshape_single_dim.prototxt b/src/core/tests/models/onnx/reshape_single_dim.prototxt similarity index 100% rename from ngraph/test/models/onnx/reshape_single_dim.prototxt rename to src/core/tests/models/onnx/reshape_single_dim.prototxt diff --git a/ngraph/test/models/onnx/resize10_asymertic_dim_in_the_middle.prototxt b/src/core/tests/models/onnx/resize10_asymertic_dim_in_the_middle.prototxt similarity index 100% rename from ngraph/test/models/onnx/resize10_asymertic_dim_in_the_middle.prototxt rename to src/core/tests/models/onnx/resize10_asymertic_dim_in_the_middle.prototxt diff --git a/ngraph/test/models/onnx/resize10_asymertic_last_dim.prototxt b/src/core/tests/models/onnx/resize10_asymertic_last_dim.prototxt similarity index 100% rename from ngraph/test/models/onnx/resize10_asymertic_last_dim.prototxt rename to src/core/tests/models/onnx/resize10_asymertic_last_dim.prototxt diff --git a/ngraph/test/models/onnx/resize10_down_scales_const_linear.prototxt b/src/core/tests/models/onnx/resize10_down_scales_const_linear.prototxt similarity index 100% rename from ngraph/test/models/onnx/resize10_down_scales_const_linear.prototxt rename to src/core/tests/models/onnx/resize10_down_scales_const_linear.prototxt diff --git a/ngraph/test/models/onnx/resize10_down_scales_const_nearest.prototxt b/src/core/tests/models/onnx/resize10_down_scales_const_nearest.prototxt similarity index 100% rename from ngraph/test/models/onnx/resize10_down_scales_const_nearest.prototxt rename to src/core/tests/models/onnx/resize10_down_scales_const_nearest.prototxt diff --git a/ngraph/test/models/onnx/resize10_up_scales_const_linear.prototxt b/src/core/tests/models/onnx/resize10_up_scales_const_linear.prototxt similarity index 100% rename from ngraph/test/models/onnx/resize10_up_scales_const_linear.prototxt rename to src/core/tests/models/onnx/resize10_up_scales_const_linear.prototxt diff --git a/ngraph/test/models/onnx/resize10_up_scales_const_nearest.prototxt b/src/core/tests/models/onnx/resize10_up_scales_const_nearest.prototxt similarity index 100% rename from ngraph/test/models/onnx/resize10_up_scales_const_nearest.prototxt rename to src/core/tests/models/onnx/resize10_up_scales_const_nearest.prototxt diff --git a/ngraph/test/models/onnx/resize11_down_scales_linear_asymmetric.prototxt b/src/core/tests/models/onnx/resize11_down_scales_linear_asymmetric.prototxt similarity index 100% rename from ngraph/test/models/onnx/resize11_down_scales_linear_asymmetric.prototxt rename to src/core/tests/models/onnx/resize11_down_scales_linear_asymmetric.prototxt diff --git a/ngraph/test/models/onnx/resize11_down_sizes_cubic_half_pixel.prototxt b/src/core/tests/models/onnx/resize11_down_sizes_cubic_half_pixel.prototxt similarity index 100% rename from ngraph/test/models/onnx/resize11_down_sizes_cubic_half_pixel.prototxt rename to src/core/tests/models/onnx/resize11_down_sizes_cubic_half_pixel.prototxt diff --git a/ngraph/test/models/onnx/resize11_down_sizes_linear_pytorch_half_pixel.prototxt b/src/core/tests/models/onnx/resize11_down_sizes_linear_pytorch_half_pixel.prototxt similarity index 100% rename from ngraph/test/models/onnx/resize11_down_sizes_linear_pytorch_half_pixel.prototxt rename to src/core/tests/models/onnx/resize11_down_sizes_linear_pytorch_half_pixel.prototxt diff --git a/ngraph/test/models/onnx/resize11_down_sizes_tf_half_pixel.prototxt b/src/core/tests/models/onnx/resize11_down_sizes_tf_half_pixel.prototxt similarity index 100% rename from ngraph/test/models/onnx/resize11_down_sizes_tf_half_pixel.prototxt rename to src/core/tests/models/onnx/resize11_down_sizes_tf_half_pixel.prototxt diff --git a/ngraph/test/models/onnx/resize11_empty_constant_as_input.prototxt b/src/core/tests/models/onnx/resize11_empty_constant_as_input.prototxt similarity index 100% rename from ngraph/test/models/onnx/resize11_empty_constant_as_input.prototxt rename to src/core/tests/models/onnx/resize11_empty_constant_as_input.prototxt diff --git a/ngraph/test/models/onnx/resize11_scales_nearest_asymmetric_floor.prototxt b/src/core/tests/models/onnx/resize11_scales_nearest_asymmetric_floor.prototxt similarity index 100% rename from ngraph/test/models/onnx/resize11_scales_nearest_asymmetric_floor.prototxt rename to src/core/tests/models/onnx/resize11_scales_nearest_asymmetric_floor.prototxt diff --git a/ngraph/test/models/onnx/resize11_scales_nearest_asymmetric_floor_dynamic_scales.prototxt b/src/core/tests/models/onnx/resize11_scales_nearest_asymmetric_floor_dynamic_scales.prototxt similarity index 100% rename from ngraph/test/models/onnx/resize11_scales_nearest_asymmetric_floor_dynamic_scales.prototxt rename to src/core/tests/models/onnx/resize11_scales_nearest_asymmetric_floor_dynamic_scales.prototxt diff --git a/ngraph/test/models/onnx/resize11_sizes_nearest_asymmetric_floor.prototxt b/src/core/tests/models/onnx/resize11_sizes_nearest_asymmetric_floor.prototxt similarity index 100% rename from ngraph/test/models/onnx/resize11_sizes_nearest_asymmetric_floor.prototxt rename to src/core/tests/models/onnx/resize11_sizes_nearest_asymmetric_floor.prototxt diff --git a/ngraph/test/models/onnx/resize11_up_scales_cubic_align_corners.prototxt b/src/core/tests/models/onnx/resize11_up_scales_cubic_align_corners.prototxt similarity index 100% rename from ngraph/test/models/onnx/resize11_up_scales_cubic_align_corners.prototxt rename to src/core/tests/models/onnx/resize11_up_scales_cubic_align_corners.prototxt diff --git a/ngraph/test/models/onnx/resize11_up_scales_linear_asymmetric.prototxt b/src/core/tests/models/onnx/resize11_up_scales_linear_asymmetric.prototxt similarity index 100% rename from ngraph/test/models/onnx/resize11_up_scales_linear_asymmetric.prototxt rename to src/core/tests/models/onnx/resize11_up_scales_linear_asymmetric.prototxt diff --git a/ngraph/test/models/onnx/resize11_up_scales_tf_half_pixel.prototxt b/src/core/tests/models/onnx/resize11_up_scales_tf_half_pixel.prototxt similarity index 100% rename from ngraph/test/models/onnx/resize11_up_scales_tf_half_pixel.prototxt rename to src/core/tests/models/onnx/resize11_up_scales_tf_half_pixel.prototxt diff --git a/ngraph/test/models/onnx/resize11_up_sizes_all_attributes_default.prototxt b/src/core/tests/models/onnx/resize11_up_sizes_all_attributes_default.prototxt similarity index 100% rename from ngraph/test/models/onnx/resize11_up_sizes_all_attributes_default.prototxt rename to src/core/tests/models/onnx/resize11_up_sizes_all_attributes_default.prototxt diff --git a/ngraph/test/models/onnx/resize11_up_sizes_cubic_half_pixel.prototxt b/src/core/tests/models/onnx/resize11_up_sizes_cubic_half_pixel.prototxt similarity index 100% rename from ngraph/test/models/onnx/resize11_up_sizes_cubic_half_pixel.prototxt rename to src/core/tests/models/onnx/resize11_up_sizes_cubic_half_pixel.prototxt diff --git a/ngraph/test/models/onnx/resize11_up_sizes_cubic_half_pixel_dynamic_sizes.prototxt b/src/core/tests/models/onnx/resize11_up_sizes_cubic_half_pixel_dynamic_sizes.prototxt similarity index 100% rename from ngraph/test/models/onnx/resize11_up_sizes_cubic_half_pixel_dynamic_sizes.prototxt rename to src/core/tests/models/onnx/resize11_up_sizes_cubic_half_pixel_dynamic_sizes.prototxt diff --git a/ngraph/test/models/onnx/resize11_up_sizes_linear_asymmetric.prototxt b/src/core/tests/models/onnx/resize11_up_sizes_linear_asymmetric.prototxt similarity index 100% rename from ngraph/test/models/onnx/resize11_up_sizes_linear_asymmetric.prototxt rename to src/core/tests/models/onnx/resize11_up_sizes_linear_asymmetric.prototxt diff --git a/ngraph/test/models/onnx/resize11_up_sizes_nearest_ceil_half_pixel.prototxt b/src/core/tests/models/onnx/resize11_up_sizes_nearest_ceil_half_pixel.prototxt similarity index 100% rename from ngraph/test/models/onnx/resize11_up_sizes_nearest_ceil_half_pixel.prototxt rename to src/core/tests/models/onnx/resize11_up_sizes_nearest_ceil_half_pixel.prototxt diff --git a/ngraph/test/models/onnx/resize11_up_sizes_nearest_floor_align_corners.prototxt b/src/core/tests/models/onnx/resize11_up_sizes_nearest_floor_align_corners.prototxt similarity index 100% rename from ngraph/test/models/onnx/resize11_up_sizes_nearest_floor_align_corners.prototxt rename to src/core/tests/models/onnx/resize11_up_sizes_nearest_floor_align_corners.prototxt diff --git a/ngraph/test/models/onnx/resize11_up_sizes_nearest_prefer_ceil_asymmetric.prototxt b/src/core/tests/models/onnx/resize11_up_sizes_nearest_prefer_ceil_asymmetric.prototxt similarity index 100% rename from ngraph/test/models/onnx/resize11_up_sizes_nearest_prefer_ceil_asymmetric.prototxt rename to src/core/tests/models/onnx/resize11_up_sizes_nearest_prefer_ceil_asymmetric.prototxt diff --git a/ngraph/test/models/onnx/resize11_up_sizes_nearest_round_prefer_floor_half_pixel.prototxt b/src/core/tests/models/onnx/resize11_up_sizes_nearest_round_prefer_floor_half_pixel.prototxt similarity index 100% rename from ngraph/test/models/onnx/resize11_up_sizes_nearest_round_prefer_floor_half_pixel.prototxt rename to src/core/tests/models/onnx/resize11_up_sizes_nearest_round_prefer_floor_half_pixel.prototxt diff --git a/ngraph/test/models/onnx/reverse_sequence_incorrect_batch_axis.prototxt b/src/core/tests/models/onnx/reverse_sequence_incorrect_batch_axis.prototxt similarity index 100% rename from ngraph/test/models/onnx/reverse_sequence_incorrect_batch_axis.prototxt rename to src/core/tests/models/onnx/reverse_sequence_incorrect_batch_axis.prototxt diff --git a/ngraph/test/models/onnx/reverse_sequence_incorrect_time_axis.prototxt b/src/core/tests/models/onnx/reverse_sequence_incorrect_time_axis.prototxt similarity index 100% rename from ngraph/test/models/onnx/reverse_sequence_incorrect_time_axis.prototxt rename to src/core/tests/models/onnx/reverse_sequence_incorrect_time_axis.prototxt diff --git a/ngraph/test/models/onnx/reverse_sequence_time_0_batch_1.prototxt b/src/core/tests/models/onnx/reverse_sequence_time_0_batch_1.prototxt similarity index 100% rename from ngraph/test/models/onnx/reverse_sequence_time_0_batch_1.prototxt rename to src/core/tests/models/onnx/reverse_sequence_time_0_batch_1.prototxt diff --git a/ngraph/test/models/onnx/reverse_sequence_time_1_batch_0.prototxt b/src/core/tests/models/onnx/reverse_sequence_time_1_batch_0.prototxt similarity index 100% rename from ngraph/test/models/onnx/reverse_sequence_time_1_batch_0.prototxt rename to src/core/tests/models/onnx/reverse_sequence_time_1_batch_0.prototxt diff --git a/ngraph/test/models/onnx/reverse_sequence_time_and_batch_axis_equal.prototxt b/src/core/tests/models/onnx/reverse_sequence_time_and_batch_axis_equal.prototxt similarity index 100% rename from ngraph/test/models/onnx/reverse_sequence_time_and_batch_axis_equal.prototxt rename to src/core/tests/models/onnx/reverse_sequence_time_and_batch_axis_equal.prototxt diff --git a/ngraph/test/models/onnx/rnn_bidir_mixed_seq_len_const.prototxt b/src/core/tests/models/onnx/rnn_bidir_mixed_seq_len_const.prototxt similarity index 100% rename from ngraph/test/models/onnx/rnn_bidir_mixed_seq_len_const.prototxt rename to src/core/tests/models/onnx/rnn_bidir_mixed_seq_len_const.prototxt diff --git a/ngraph/test/models/onnx/rnn_bidirectional.prototxt b/src/core/tests/models/onnx/rnn_bidirectional.prototxt similarity index 100% rename from ngraph/test/models/onnx/rnn_bidirectional.prototxt rename to src/core/tests/models/onnx/rnn_bidirectional.prototxt diff --git a/ngraph/test/models/onnx/rnn_bidirectional_const.prototxt b/src/core/tests/models/onnx/rnn_bidirectional_const.prototxt similarity index 100% rename from ngraph/test/models/onnx/rnn_bidirectional_const.prototxt rename to src/core/tests/models/onnx/rnn_bidirectional_const.prototxt diff --git a/ngraph/test/models/onnx/rnn_defaults_fwd.prototxt b/src/core/tests/models/onnx/rnn_defaults_fwd.prototxt similarity index 100% rename from ngraph/test/models/onnx/rnn_defaults_fwd.prototxt rename to src/core/tests/models/onnx/rnn_defaults_fwd.prototxt diff --git a/ngraph/test/models/onnx/rnn_defaults_fwd_const.prototxt b/src/core/tests/models/onnx/rnn_defaults_fwd_const.prototxt similarity index 100% rename from ngraph/test/models/onnx/rnn_defaults_fwd_const.prototxt rename to src/core/tests/models/onnx/rnn_defaults_fwd_const.prototxt diff --git a/ngraph/test/models/onnx/rnn_fwd_activations.prototxt b/src/core/tests/models/onnx/rnn_fwd_activations.prototxt similarity index 100% rename from ngraph/test/models/onnx/rnn_fwd_activations.prototxt rename to src/core/tests/models/onnx/rnn_fwd_activations.prototxt diff --git a/ngraph/test/models/onnx/rnn_fwd_activations_const.prototxt b/src/core/tests/models/onnx/rnn_fwd_activations_const.prototxt similarity index 100% rename from ngraph/test/models/onnx/rnn_fwd_activations_const.prototxt rename to src/core/tests/models/onnx/rnn_fwd_activations_const.prototxt diff --git a/ngraph/test/models/onnx/rnn_fwd_bias_initial_h.prototxt b/src/core/tests/models/onnx/rnn_fwd_bias_initial_h.prototxt similarity index 100% rename from ngraph/test/models/onnx/rnn_fwd_bias_initial_h.prototxt rename to src/core/tests/models/onnx/rnn_fwd_bias_initial_h.prototxt diff --git a/ngraph/test/models/onnx/rnn_fwd_bias_initial_h_const.prototxt b/src/core/tests/models/onnx/rnn_fwd_bias_initial_h_const.prototxt similarity index 100% rename from ngraph/test/models/onnx/rnn_fwd_bias_initial_h_const.prototxt rename to src/core/tests/models/onnx/rnn_fwd_bias_initial_h_const.prototxt diff --git a/ngraph/test/models/onnx/rnn_fwd_mixed_seq_len.prototxt b/src/core/tests/models/onnx/rnn_fwd_mixed_seq_len.prototxt similarity index 100% rename from ngraph/test/models/onnx/rnn_fwd_mixed_seq_len.prototxt rename to src/core/tests/models/onnx/rnn_fwd_mixed_seq_len.prototxt diff --git a/ngraph/test/models/onnx/rnn_fwd_mixed_seq_len_const.prototxt b/src/core/tests/models/onnx/rnn_fwd_mixed_seq_len_const.prototxt similarity index 100% rename from ngraph/test/models/onnx/rnn_fwd_mixed_seq_len_const.prototxt rename to src/core/tests/models/onnx/rnn_fwd_mixed_seq_len_const.prototxt diff --git a/ngraph/test/models/onnx/rnn_rev_clip.prototxt b/src/core/tests/models/onnx/rnn_rev_clip.prototxt similarity index 100% rename from ngraph/test/models/onnx/rnn_rev_clip.prototxt rename to src/core/tests/models/onnx/rnn_rev_clip.prototxt diff --git a/ngraph/test/models/onnx/rnn_rev_clip_const.prototxt b/src/core/tests/models/onnx/rnn_rev_clip_const.prototxt similarity index 100% rename from ngraph/test/models/onnx/rnn_rev_clip_const.prototxt rename to src/core/tests/models/onnx/rnn_rev_clip_const.prototxt diff --git a/ngraph/test/models/onnx/rnn_reverse.prototxt b/src/core/tests/models/onnx/rnn_reverse.prototxt similarity index 100% rename from ngraph/test/models/onnx/rnn_reverse.prototxt rename to src/core/tests/models/onnx/rnn_reverse.prototxt diff --git a/ngraph/test/models/onnx/rnn_reverse_const.prototxt b/src/core/tests/models/onnx/rnn_reverse_const.prototxt similarity index 100% rename from ngraph/test/models/onnx/rnn_reverse_const.prototxt rename to src/core/tests/models/onnx/rnn_reverse_const.prototxt diff --git a/ngraph/test/models/onnx/rnn_reverse_mixed_seq_len_const.prototxt b/src/core/tests/models/onnx/rnn_reverse_mixed_seq_len_const.prototxt similarity index 100% rename from ngraph/test/models/onnx/rnn_reverse_mixed_seq_len_const.prototxt rename to src/core/tests/models/onnx/rnn_reverse_mixed_seq_len_const.prototxt diff --git a/ngraph/test/models/onnx/roi_align_f32.prototxt b/src/core/tests/models/onnx/roi_align_f32.prototxt similarity index 100% rename from ngraph/test/models/onnx/roi_align_f32.prototxt rename to src/core/tests/models/onnx/roi_align_f32.prototxt diff --git a/ngraph/test/models/onnx/round.prototxt b/src/core/tests/models/onnx/round.prototxt similarity index 100% rename from ngraph/test/models/onnx/round.prototxt rename to src/core/tests/models/onnx/round.prototxt diff --git a/ngraph/test/models/onnx/round_half_nearest_even.prototxt b/src/core/tests/models/onnx/round_half_nearest_even.prototxt similarity index 100% rename from ngraph/test/models/onnx/round_half_nearest_even.prototxt rename to src/core/tests/models/onnx/round_half_nearest_even.prototxt diff --git a/ngraph/test/models/onnx/scatter_elements_opset11.prototxt b/src/core/tests/models/onnx/scatter_elements_opset11.prototxt similarity index 100% rename from ngraph/test/models/onnx/scatter_elements_opset11.prototxt rename to src/core/tests/models/onnx/scatter_elements_opset11.prototxt diff --git a/ngraph/test/models/onnx/scatter_nd_const_i32_indices.prototxt b/src/core/tests/models/onnx/scatter_nd_const_i32_indices.prototxt similarity index 100% rename from ngraph/test/models/onnx/scatter_nd_const_i32_indices.prototxt rename to src/core/tests/models/onnx/scatter_nd_const_i32_indices.prototxt diff --git a/ngraph/test/models/onnx/scatter_nd_param_i64_indices.prototxt b/src/core/tests/models/onnx/scatter_nd_param_i64_indices.prototxt similarity index 100% rename from ngraph/test/models/onnx/scatter_nd_param_i64_indices.prototxt rename to src/core/tests/models/onnx/scatter_nd_param_i64_indices.prototxt diff --git a/ngraph/test/models/onnx/scatter_opset10.prototxt b/src/core/tests/models/onnx/scatter_opset10.prototxt similarity index 100% rename from ngraph/test/models/onnx/scatter_opset10.prototxt rename to src/core/tests/models/onnx/scatter_opset10.prototxt diff --git a/ngraph/test/models/onnx/selu.prototxt b/src/core/tests/models/onnx/selu.prototxt similarity index 100% rename from ngraph/test/models/onnx/selu.prototxt rename to src/core/tests/models/onnx/selu.prototxt diff --git a/ngraph/test/models/onnx/shape.prototxt b/src/core/tests/models/onnx/shape.prototxt similarity index 100% rename from ngraph/test/models/onnx/shape.prototxt rename to src/core/tests/models/onnx/shape.prototxt diff --git a/ngraph/test/models/onnx/shrink_float.prototxt b/src/core/tests/models/onnx/shrink_float.prototxt similarity index 100% rename from ngraph/test/models/onnx/shrink_float.prototxt rename to src/core/tests/models/onnx/shrink_float.prototxt diff --git a/ngraph/test/models/onnx/shrink_int.prototxt b/src/core/tests/models/onnx/shrink_int.prototxt similarity index 100% rename from ngraph/test/models/onnx/shrink_int.prototxt rename to src/core/tests/models/onnx/shrink_int.prototxt diff --git a/ngraph/test/models/onnx/sigmoid.prototxt b/src/core/tests/models/onnx/sigmoid.prototxt similarity index 100% rename from ngraph/test/models/onnx/sigmoid.prototxt rename to src/core/tests/models/onnx/sigmoid.prototxt diff --git a/ngraph/test/models/onnx/sign.prototxt b/src/core/tests/models/onnx/sign.prototxt similarity index 100% rename from ngraph/test/models/onnx/sign.prototxt rename to src/core/tests/models/onnx/sign.prototxt diff --git a/ngraph/test/models/onnx/sinh.prototxt b/src/core/tests/models/onnx/sinh.prototxt similarity index 100% rename from ngraph/test/models/onnx/sinh.prototxt rename to src/core/tests/models/onnx/sinh.prototxt diff --git a/ngraph/test/models/onnx/size_op_graph_end.prototxt b/src/core/tests/models/onnx/size_op_graph_end.prototxt similarity index 100% rename from ngraph/test/models/onnx/size_op_graph_end.prototxt rename to src/core/tests/models/onnx/size_op_graph_end.prototxt diff --git a/ngraph/test/models/onnx/size_op_graph_middle.prototxt b/src/core/tests/models/onnx/size_op_graph_middle.prototxt similarity index 100% rename from ngraph/test/models/onnx/size_op_graph_middle.prototxt rename to src/core/tests/models/onnx/size_op_graph_middle.prototxt diff --git a/ngraph/test/models/onnx/size_op_on_input_graph_middle.prototxt b/src/core/tests/models/onnx/size_op_on_input_graph_middle.prototxt similarity index 100% rename from ngraph/test/models/onnx/size_op_on_input_graph_middle.prototxt rename to src/core/tests/models/onnx/size_op_on_input_graph_middle.prototxt diff --git a/ngraph/test/models/onnx/size_op_single.prototxt b/src/core/tests/models/onnx/size_op_single.prototxt similarity index 100% rename from ngraph/test/models/onnx/size_op_single.prototxt rename to src/core/tests/models/onnx/size_op_single.prototxt diff --git a/ngraph/test/models/onnx/slice_const_axes_source.prototxt b/src/core/tests/models/onnx/slice_const_axes_source.prototxt similarity index 100% rename from ngraph/test/models/onnx/slice_const_axes_source.prototxt rename to src/core/tests/models/onnx/slice_const_axes_source.prototxt diff --git a/ngraph/test/models/onnx/softmax_0D.prototxt b/src/core/tests/models/onnx/softmax_0D.prototxt similarity index 100% rename from ngraph/test/models/onnx/softmax_0D.prototxt rename to src/core/tests/models/onnx/softmax_0D.prototxt diff --git a/ngraph/test/models/onnx/softmax_1D.prototxt b/src/core/tests/models/onnx/softmax_1D.prototxt similarity index 100% rename from ngraph/test/models/onnx/softmax_1D.prototxt rename to src/core/tests/models/onnx/softmax_1D.prototxt diff --git a/ngraph/test/models/onnx/softmax_axis_0.prototxt b/src/core/tests/models/onnx/softmax_axis_0.prototxt similarity index 100% rename from ngraph/test/models/onnx/softmax_axis_0.prototxt rename to src/core/tests/models/onnx/softmax_axis_0.prototxt diff --git a/ngraph/test/models/onnx/softmax_axis_1.prototxt b/src/core/tests/models/onnx/softmax_axis_1.prototxt similarity index 100% rename from ngraph/test/models/onnx/softmax_axis_1.prototxt rename to src/core/tests/models/onnx/softmax_axis_1.prototxt diff --git a/ngraph/test/models/onnx/softmax_axis_2.prototxt b/src/core/tests/models/onnx/softmax_axis_2.prototxt similarity index 100% rename from ngraph/test/models/onnx/softmax_axis_2.prototxt rename to src/core/tests/models/onnx/softmax_axis_2.prototxt diff --git a/ngraph/test/models/onnx/softmax_crossentropy_loss_mean.prototxt b/src/core/tests/models/onnx/softmax_crossentropy_loss_mean.prototxt similarity index 100% rename from ngraph/test/models/onnx/softmax_crossentropy_loss_mean.prototxt rename to src/core/tests/models/onnx/softmax_crossentropy_loss_mean.prototxt diff --git a/ngraph/test/models/onnx/softmax_invalid_axis_1D.prototxt b/src/core/tests/models/onnx/softmax_invalid_axis_1D.prototxt similarity index 100% rename from ngraph/test/models/onnx/softmax_invalid_axis_1D.prototxt rename to src/core/tests/models/onnx/softmax_invalid_axis_1D.prototxt diff --git a/ngraph/test/models/onnx/softmax_invalid_axis_3D.prototxt b/src/core/tests/models/onnx/softmax_invalid_axis_3D.prototxt similarity index 100% rename from ngraph/test/models/onnx/softmax_invalid_axis_3D.prototxt rename to src/core/tests/models/onnx/softmax_invalid_axis_3D.prototxt diff --git a/ngraph/test/models/onnx/softplus.prototxt b/src/core/tests/models/onnx/softplus.prototxt similarity index 100% rename from ngraph/test/models/onnx/softplus.prototxt rename to src/core/tests/models/onnx/softplus.prototxt diff --git a/ngraph/test/models/onnx/space_to_depth.prototxt b/src/core/tests/models/onnx/space_to_depth.prototxt similarity index 100% rename from ngraph/test/models/onnx/space_to_depth.prototxt rename to src/core/tests/models/onnx/space_to_depth.prototxt diff --git a/ngraph/test/models/onnx/space_to_depth_bad_blocksize.prototxt b/src/core/tests/models/onnx/space_to_depth_bad_blocksize.prototxt similarity index 100% rename from ngraph/test/models/onnx/space_to_depth_bad_blocksize.prototxt rename to src/core/tests/models/onnx/space_to_depth_bad_blocksize.prototxt diff --git a/ngraph/test/models/onnx/space_to_depth_invalid_input_shape.prototxt b/src/core/tests/models/onnx/space_to_depth_invalid_input_shape.prototxt similarity index 100% rename from ngraph/test/models/onnx/space_to_depth_invalid_input_shape.prototxt rename to src/core/tests/models/onnx/space_to_depth_invalid_input_shape.prototxt diff --git a/ngraph/test/models/onnx/space_to_depth_no_blocksize.prototxt b/src/core/tests/models/onnx/space_to_depth_no_blocksize.prototxt similarity index 100% rename from ngraph/test/models/onnx/space_to_depth_no_blocksize.prototxt rename to src/core/tests/models/onnx/space_to_depth_no_blocksize.prototxt diff --git a/ngraph/test/models/onnx/split_equal_parts_2d.prototxt b/src/core/tests/models/onnx/split_equal_parts_2d.prototxt similarity index 100% rename from ngraph/test/models/onnx/split_equal_parts_2d.prototxt rename to src/core/tests/models/onnx/split_equal_parts_2d.prototxt diff --git a/ngraph/test/models/onnx/split_equal_parts_default.prototxt b/src/core/tests/models/onnx/split_equal_parts_default.prototxt similarity index 100% rename from ngraph/test/models/onnx/split_equal_parts_default.prototxt rename to src/core/tests/models/onnx/split_equal_parts_default.prototxt diff --git a/ngraph/test/models/onnx/split_variable_parts_2d.prototxt b/src/core/tests/models/onnx/split_variable_parts_2d.prototxt similarity index 100% rename from ngraph/test/models/onnx/split_variable_parts_2d.prototxt rename to src/core/tests/models/onnx/split_variable_parts_2d.prototxt diff --git a/ngraph/test/models/onnx/squeeze.prototxt b/src/core/tests/models/onnx/squeeze.prototxt similarity index 100% rename from ngraph/test/models/onnx/squeeze.prototxt rename to src/core/tests/models/onnx/squeeze.prototxt diff --git a/ngraph/test/models/onnx/squeeze_opset13_no_axes.prototxt b/src/core/tests/models/onnx/squeeze_opset13_no_axes.prototxt similarity index 100% rename from ngraph/test/models/onnx/squeeze_opset13_no_axes.prototxt rename to src/core/tests/models/onnx/squeeze_opset13_no_axes.prototxt diff --git a/ngraph/test/models/onnx/sub.prototxt b/src/core/tests/models/onnx/sub.prototxt similarity index 100% rename from ngraph/test/models/onnx/sub.prototxt rename to src/core/tests/models/onnx/sub.prototxt diff --git a/ngraph/test/models/onnx/sub_v6_broadcast_axes_1_2.prototxt b/src/core/tests/models/onnx/sub_v6_broadcast_axes_1_2.prototxt similarity index 100% rename from ngraph/test/models/onnx/sub_v6_broadcast_axes_1_2.prototxt rename to src/core/tests/models/onnx/sub_v6_broadcast_axes_1_2.prototxt diff --git a/ngraph/test/models/onnx/sub_v6_broadcast_axis_1.prototxt b/src/core/tests/models/onnx/sub_v6_broadcast_axis_1.prototxt similarity index 100% rename from ngraph/test/models/onnx/sub_v6_broadcast_axis_1.prototxt rename to src/core/tests/models/onnx/sub_v6_broadcast_axis_1.prototxt diff --git a/ngraph/test/models/onnx/sub_v6_broadcast_no_axis.prototxt b/src/core/tests/models/onnx/sub_v6_broadcast_no_axis.prototxt similarity index 100% rename from ngraph/test/models/onnx/sub_v6_broadcast_no_axis.prototxt rename to src/core/tests/models/onnx/sub_v6_broadcast_no_axis.prototxt diff --git a/ngraph/test/models/onnx/sub_v7.prototxt b/src/core/tests/models/onnx/sub_v7.prototxt similarity index 100% rename from ngraph/test/models/onnx/sub_v7.prototxt rename to src/core/tests/models/onnx/sub_v7.prototxt diff --git a/ngraph/test/models/onnx/sub_v7_broadcast.prototxt b/src/core/tests/models/onnx/sub_v7_broadcast.prototxt similarity index 100% rename from ngraph/test/models/onnx/sub_v7_broadcast.prototxt rename to src/core/tests/models/onnx/sub_v7_broadcast.prototxt diff --git a/ngraph/test/models/onnx/sum.prototxt b/src/core/tests/models/onnx/sum.prototxt similarity index 100% rename from ngraph/test/models/onnx/sum.prototxt rename to src/core/tests/models/onnx/sum.prototxt diff --git a/ngraph/test/models/onnx/sum_one_input.prototxt b/src/core/tests/models/onnx/sum_one_input.prototxt similarity index 100% rename from ngraph/test/models/onnx/sum_one_input.prototxt rename to src/core/tests/models/onnx/sum_one_input.prototxt diff --git a/ngraph/test/models/onnx/sum_opset1.prototxt b/src/core/tests/models/onnx/sum_opset1.prototxt similarity index 100% rename from ngraph/test/models/onnx/sum_opset1.prototxt rename to src/core/tests/models/onnx/sum_opset1.prototxt diff --git a/ngraph/test/models/onnx/sum_opset8.prototxt b/src/core/tests/models/onnx/sum_opset8.prototxt similarity index 100% rename from ngraph/test/models/onnx/sum_opset8.prototxt rename to src/core/tests/models/onnx/sum_opset8.prototxt diff --git a/ngraph/test/models/onnx/swish_with_beta.prototxt b/src/core/tests/models/onnx/swish_with_beta.prototxt similarity index 100% rename from ngraph/test/models/onnx/swish_with_beta.prototxt rename to src/core/tests/models/onnx/swish_with_beta.prototxt diff --git a/ngraph/test/models/onnx/swish_without_beta.prototxt b/src/core/tests/models/onnx/swish_without_beta.prototxt similarity index 100% rename from ngraph/test/models/onnx/swish_without_beta.prototxt rename to src/core/tests/models/onnx/swish_without_beta.prototxt diff --git a/ngraph/test/models/onnx/tanh.prototxt b/src/core/tests/models/onnx/tanh.prototxt similarity index 100% rename from ngraph/test/models/onnx/tanh.prototxt rename to src/core/tests/models/onnx/tanh.prototxt diff --git a/ngraph/test/models/onnx/tensor_names.prototxt b/src/core/tests/models/onnx/tensor_names.prototxt similarity index 100% rename from ngraph/test/models/onnx/tensor_names.prototxt rename to src/core/tests/models/onnx/tensor_names.prototxt diff --git a/ngraph/test/models/onnx/test_clip_inbounds.prototxt b/src/core/tests/models/onnx/test_clip_inbounds.prototxt similarity index 100% rename from ngraph/test/models/onnx/test_clip_inbounds.prototxt rename to src/core/tests/models/onnx/test_clip_inbounds.prototxt diff --git a/ngraph/test/models/onnx/thresholded_relu.prototxt b/src/core/tests/models/onnx/thresholded_relu.prototxt similarity index 100% rename from ngraph/test/models/onnx/thresholded_relu.prototxt rename to src/core/tests/models/onnx/thresholded_relu.prototxt diff --git a/ngraph/test/models/onnx/tile.prototxt b/src/core/tests/models/onnx/tile.prototxt similarity index 100% rename from ngraph/test/models/onnx/tile.prototxt rename to src/core/tests/models/onnx/tile.prototxt diff --git a/ngraph/test/models/onnx/tile_static.prototxt b/src/core/tests/models/onnx/tile_static.prototxt similarity index 100% rename from ngraph/test/models/onnx/tile_static.prototxt rename to src/core/tests/models/onnx/tile_static.prototxt diff --git a/ngraph/test/models/onnx/top_k.prototxt b/src/core/tests/models/onnx/top_k.prototxt similarity index 100% rename from ngraph/test/models/onnx/top_k.prototxt rename to src/core/tests/models/onnx/top_k.prototxt diff --git a/ngraph/test/models/onnx/top_k_opset_10.prototxt b/src/core/tests/models/onnx/top_k_opset_10.prototxt similarity index 100% rename from ngraph/test/models/onnx/top_k_opset_10.prototxt rename to src/core/tests/models/onnx/top_k_opset_10.prototxt diff --git a/ngraph/test/models/onnx/top_k_opset_10_const_k.prototxt b/src/core/tests/models/onnx/top_k_opset_10_const_k.prototxt similarity index 100% rename from ngraph/test/models/onnx/top_k_opset_10_const_k.prototxt rename to src/core/tests/models/onnx/top_k_opset_10_const_k.prototxt diff --git a/ngraph/test/models/onnx/top_k_opset_11_const_k_smallest.prototxt b/src/core/tests/models/onnx/top_k_opset_11_const_k_smallest.prototxt similarity index 100% rename from ngraph/test/models/onnx/top_k_opset_11_const_k_smallest.prototxt rename to src/core/tests/models/onnx/top_k_opset_11_const_k_smallest.prototxt diff --git a/ngraph/test/models/onnx/top_k_opset_11_const_k_smallest_negative_axis.prototxt b/src/core/tests/models/onnx/top_k_opset_11_const_k_smallest_negative_axis.prototxt similarity index 100% rename from ngraph/test/models/onnx/top_k_opset_11_const_k_smallest_negative_axis.prototxt rename to src/core/tests/models/onnx/top_k_opset_11_const_k_smallest_negative_axis.prototxt diff --git a/ngraph/test/models/onnx/transformations/dynamic_quantize_linear.prototxt b/src/core/tests/models/onnx/transformations/dynamic_quantize_linear.prototxt similarity index 100% rename from ngraph/test/models/onnx/transformations/dynamic_quantize_linear.prototxt rename to src/core/tests/models/onnx/transformations/dynamic_quantize_linear.prototxt diff --git a/ngraph/test/models/onnx/transformations/greater_or_equal.prototxt b/src/core/tests/models/onnx/transformations/greater_or_equal.prototxt similarity index 100% rename from ngraph/test/models/onnx/transformations/greater_or_equal.prototxt rename to src/core/tests/models/onnx/transformations/greater_or_equal.prototxt diff --git a/ngraph/test/models/onnx/transformations/reference/dynamic_quantize_linear_expanded.prototxt b/src/core/tests/models/onnx/transformations/reference/dynamic_quantize_linear_expanded.prototxt similarity index 100% rename from ngraph/test/models/onnx/transformations/reference/dynamic_quantize_linear_expanded.prototxt rename to src/core/tests/models/onnx/transformations/reference/dynamic_quantize_linear_expanded.prototxt diff --git a/ngraph/test/models/onnx/transformations/reference/greater_or_equal_expanded.prototxt b/src/core/tests/models/onnx/transformations/reference/greater_or_equal_expanded.prototxt similarity index 100% rename from ngraph/test/models/onnx/transformations/reference/greater_or_equal_expanded.prototxt rename to src/core/tests/models/onnx/transformations/reference/greater_or_equal_expanded.prototxt diff --git a/ngraph/test/models/onnx/transformations/reference/softmax_crossentropy_consumed_expanded.prototxt b/src/core/tests/models/onnx/transformations/reference/softmax_crossentropy_consumed_expanded.prototxt similarity index 100% rename from ngraph/test/models/onnx/transformations/reference/softmax_crossentropy_consumed_expanded.prototxt rename to src/core/tests/models/onnx/transformations/reference/softmax_crossentropy_consumed_expanded.prototxt diff --git a/ngraph/test/models/onnx/transformations/softmax_crossentropy_consumed.prototxt b/src/core/tests/models/onnx/transformations/softmax_crossentropy_consumed.prototxt similarity index 100% rename from ngraph/test/models/onnx/transformations/softmax_crossentropy_consumed.prototxt rename to src/core/tests/models/onnx/transformations/softmax_crossentropy_consumed.prototxt diff --git a/ngraph/test/models/onnx/unknown_domain.prototxt b/src/core/tests/models/onnx/unknown_domain.prototxt similarity index 100% rename from ngraph/test/models/onnx/unknown_domain.prototxt rename to src/core/tests/models/onnx/unknown_domain.prototxt diff --git a/ngraph/test/models/onnx/unknown_domain_add.prototxt b/src/core/tests/models/onnx/unknown_domain_add.prototxt similarity index 100% rename from ngraph/test/models/onnx/unknown_domain_add.prototxt rename to src/core/tests/models/onnx/unknown_domain_add.prototxt diff --git a/ngraph/test/models/onnx/unsqueeze.prototxt b/src/core/tests/models/onnx/unsqueeze.prototxt similarity index 100% rename from ngraph/test/models/onnx/unsqueeze.prototxt rename to src/core/tests/models/onnx/unsqueeze.prototxt diff --git a/ngraph/test/models/onnx/unsqueeze_negative_axes.prototxt b/src/core/tests/models/onnx/unsqueeze_negative_axes.prototxt similarity index 100% rename from ngraph/test/models/onnx/unsqueeze_negative_axes.prototxt rename to src/core/tests/models/onnx/unsqueeze_negative_axes.prototxt diff --git a/ngraph/test/models/onnx/unsupported_op.prototxt b/src/core/tests/models/onnx/unsupported_op.prototxt similarity index 100% rename from ngraph/test/models/onnx/unsupported_op.prototxt rename to src/core/tests/models/onnx/unsupported_op.prototxt diff --git a/ngraph/test/models/onnx/upsample6_bilinear.prototxt b/src/core/tests/models/onnx/upsample6_bilinear.prototxt similarity index 100% rename from ngraph/test/models/onnx/upsample6_bilinear.prototxt rename to src/core/tests/models/onnx/upsample6_bilinear.prototxt diff --git a/ngraph/test/models/onnx/upsample6_dynamic.prototxt b/src/core/tests/models/onnx/upsample6_dynamic.prototxt similarity index 100% rename from ngraph/test/models/onnx/upsample6_dynamic.prototxt rename to src/core/tests/models/onnx/upsample6_dynamic.prototxt diff --git a/ngraph/test/models/onnx/upsample6_nearest.prototxt b/src/core/tests/models/onnx/upsample6_nearest.prototxt similarity index 100% rename from ngraph/test/models/onnx/upsample6_nearest.prototxt rename to src/core/tests/models/onnx/upsample6_nearest.prototxt diff --git a/ngraph/test/models/onnx/upsample8_linear.prototxt b/src/core/tests/models/onnx/upsample8_linear.prototxt similarity index 100% rename from ngraph/test/models/onnx/upsample8_linear.prototxt rename to src/core/tests/models/onnx/upsample8_linear.prototxt diff --git a/ngraph/test/models/onnx/upsample8_nearest.prototxt b/src/core/tests/models/onnx/upsample8_nearest.prototxt similarity index 100% rename from ngraph/test/models/onnx/upsample8_nearest.prototxt rename to src/core/tests/models/onnx/upsample8_nearest.prototxt diff --git a/ngraph/test/models/onnx/upsample9_scales_const_linear.prototxt b/src/core/tests/models/onnx/upsample9_scales_const_linear.prototxt similarity index 100% rename from ngraph/test/models/onnx/upsample9_scales_const_linear.prototxt rename to src/core/tests/models/onnx/upsample9_scales_const_linear.prototxt diff --git a/ngraph/test/models/onnx/upsample9_scales_const_nearest.prototxt b/src/core/tests/models/onnx/upsample9_scales_const_nearest.prototxt similarity index 100% rename from ngraph/test/models/onnx/upsample9_scales_const_nearest.prototxt rename to src/core/tests/models/onnx/upsample9_scales_const_nearest.prototxt diff --git a/ngraph/test/models/onnx/upsample9_scales_input_nearest.prototxt b/src/core/tests/models/onnx/upsample9_scales_input_nearest.prototxt similarity index 100% rename from ngraph/test/models/onnx/upsample9_scales_input_nearest.prototxt rename to src/core/tests/models/onnx/upsample9_scales_input_nearest.prototxt diff --git a/ngraph/test/models/onnx/where.prototxt b/src/core/tests/models/onnx/where.prototxt similarity index 100% rename from ngraph/test/models/onnx/where.prototxt rename to src/core/tests/models/onnx/where.prototxt diff --git a/ngraph/test/node_input_output.cpp b/src/core/tests/node_input_output.cpp similarity index 100% rename from ngraph/test/node_input_output.cpp rename to src/core/tests/node_input_output.cpp diff --git a/ngraph/test/onnx/onnx_editor.cpp b/src/core/tests/onnx/onnx_editor.cpp similarity index 100% rename from ngraph/test/onnx/onnx_editor.cpp rename to src/core/tests/onnx/onnx_editor.cpp diff --git a/ngraph/test/onnx/onnx_import.in.cpp b/src/core/tests/onnx/onnx_import.in.cpp similarity index 97% rename from ngraph/test/onnx/onnx_import.in.cpp rename to src/core/tests/onnx/onnx_import.in.cpp index 8775d91e54d..09c502f2708 100644 --- a/ngraph/test/onnx/onnx_import.in.cpp +++ b/src/core/tests/onnx/onnx_import.in.cpp @@ -4419,3 +4419,126 @@ NGRAPH_TEST(${BACKEND_NAME}, onnx_model_random_normal_like) { test_case.add_expected_output(Shape{2, 2}, {13.459274, 41.75028, -19.311913, 131.79282}); test_case.run(); } + +NGRAPH_TEST(${BACKEND_NAME}, onnx_aten_embedding_bag_packed_sum_2in) { + const auto function = + onnx_import::import_onnx_model(file_util::path_join(SERIALIZED_ZOO, "onnx/aten_embedding_sum_packed_2in.onnx")); + + auto test_case = test::TestCase(function); + test_case.add_input(Shape{5, 2}, {-0.2, -0.6, -0.1, -0.4, -1.9, -1.8, -1., 1.5, 0.8, -0.7}); + test_case.add_input(Shape{3, 2}, {0, 2, 1, 2, 3, 4}); // indices + + test_case.add_expected_output(Shape{3, 2}, {-2.1, -2.4, -2., -2.2, -0.19999999, 0.8}); + test_case.run(); +} + +NGRAPH_TEST(${BACKEND_NAME}, onnx_aten_embedding_bag_packed_sum_3in_offsets_none) { + const auto function = onnx_import::import_onnx_model( + file_util::path_join(SERIALIZED_ZOO, "onnx/aten_embedding_sum_packed_3in_offset_none.onnx")); + + auto test_case = test::TestCase(function); + test_case.add_input(Shape{5, 2}, {-0.2, -0.6, -0.1, -0.4, -1.9, -1.8, -1., 1.5, 0.8, -0.7}); + test_case.add_input(Shape{3, 2}, {0, 2, 1, 2, 3, 4}); // indices + + test_case.add_expected_output(Shape{3, 2}, {-2.1, -2.4, -2., -2.2, -0.19999999, 0.8}); + test_case.run(); +} + +NGRAPH_TEST(${BACKEND_NAME}, onnx_aten_embedding_bag_packed_sum_4in_per_sample_weights) { + const auto function = onnx_import::import_onnx_model( + file_util::path_join(SERIALIZED_ZOO, "onnx/aten_embedding_sum_packed_4in_per_sample_weights.onnx")); + + auto test_case = test::TestCase(function); + test_case.add_input(Shape{5, 2}, {-0.2, -0.6, -0.1, -0.4, -1.9, -1.8, -1., 1.5, 0.8, -0.7}); + test_case.add_input(Shape{3, 2}, {0, 2, 1, 2, 3, 4}); // indices + test_case.add_input(Shape{3, 2}, {0.5, 0.5, 0.5, 0.5, 0.5, 0.5}); // per_sample_weights + + test_case.add_expected_output(Shape{3, 2}, {-1.05, -1.2, -1., -1.1, -0.09999999, 0.4}); + test_case.run(); +} + +NGRAPH_TEST(${BACKEND_NAME}, onnx_aten_embedding_bag_packed_sum_4in_two_none) { + const auto function = onnx_import::import_onnx_model( + file_util::path_join(SERIALIZED_ZOO, "onnx/aten_embedding_sum_packed_4in_two_none.onnx")); + + auto test_case = test::TestCase(function); + test_case.add_input(Shape{5, 2}, {-0.2, -0.6, -0.1, -0.4, -1.9, -1.8, -1., 1.5, 0.8, -0.7}); + test_case.add_input(Shape{3, 2}, {0, 2, 1, 2, 3, 4}); // indices + + test_case.add_expected_output(Shape{3, 2}, {-2.1, -2.4, -2., -2.2, -0.19999999, 0.8}); + test_case.run(); +} + +NGRAPH_TEST(${BACKEND_NAME}, onnx_aten_embedding_bag_offsets_sum_3in) { + const auto function = + onnx_import::import_onnx_model(file_util::path_join(SERIALIZED_ZOO, "onnx/aten_embedding_sum_offset_3in.onnx")); + + auto test_case = test::TestCase(function); + test_case.add_input(Shape{5, 2}, {-0.2, -0.6, -0.1, -0.4, -1.9, -1.8, -1., 1.5, 0.8, -0.7}); + test_case.add_input(Shape{4}, {0, 2, 3, 4}); // indices + test_case.add_input(Shape{3}, {0, 2, 2}); // offsets + + test_case.add_expected_output(Shape{3, 2}, {-2.1, -2.4, 0, 0, -0.2, 0.8}); + test_case.run(); +} + +NGRAPH_TEST(${BACKEND_NAME}, onnx_aten_embedding_bag_offsets_sum_4in) { + const auto function = + onnx_import::import_onnx_model(file_util::path_join(SERIALIZED_ZOO, "onnx/aten_embedding_sum_offset_4in.onnx")); + + auto test_case = test::TestCase(function); + test_case.add_input(Shape{5, 2}, {-0.2, -0.6, -0.1, -0.4, -1.9, -1.8, -1., 1.5, 0.8, -0.7}); + test_case.add_input(Shape{4}, {0, 2, 3, 4}); // indices + test_case.add_input(Shape{3}, {0, 2, 2}); // offsets + test_case.add_input(Shape{4}, {0.5, 0.5, 0.5, 0.5}); // per_sample_weights + + test_case.add_expected_output(Shape{3, 2}, {-1.05, -1.2, 0., 0., -0.09999999, 0.4}); + test_case.run(); +} + +NGRAPH_TEST(${BACKEND_NAME}, onnx_aten_embedding_bag_many_node_outputs) { + const auto function = onnx_import::import_onnx_model( + file_util::path_join(SERIALIZED_ZOO, "onnx/aten_embedding_sum_many_outputs.onnx")); + + // 4 outputs in onnx Node (1 connected and 3 not connected) + EXPECT_EQ(function->outputs().size(), 1); + EXPECT_EQ(function->get_results().size(), 1); + + auto test_case = test::TestCase(function); + test_case.add_input(Shape{5, 2}, {-0.2, -0.6, -0.1, -0.4, -1.9, -1.8, -1., 1.5, 0.8, -0.7}); + test_case.add_input(Shape{4}, {0, 2, 3, 4}); // indices + test_case.add_input(Shape{3}, {0, 2, 2}); // offsets + + test_case.add_expected_output(Shape{3, 2}, {-2.1, -2.4, 0, 0, -0.2, 0.8}); + test_case.run(); +} + +NGRAPH_TEST(${BACKEND_NAME}, onnx_aten_unsupported_embedding_mode) { + try { + const auto function = onnx_import::import_onnx_model( + file_util::path_join(SERIALIZED_ZOO, "onnx/aten_unsupported_embedding_mode.onnx")); + FAIL() << "Expected exception was not thrown."; + } catch (const ngraph::ngraph_error& e) { + EXPECT_HAS_SUBSTRING( + e.what(), + std::string( + "Unsupported mode, only `0` (sum) is supported as ATen embedding_bag `mode` attribute. Got: 1")); + } catch (...) { + FAIL() << "Other exception than expected was thrown."; + } +} + +NGRAPH_TEST(${BACKEND_NAME}, onnx_aten_unsupported_operator) { + try { + const auto function = + onnx_import::import_onnx_model(file_util::path_join(SERIALIZED_ZOO, "onnx/aten_unsupported_operator.onnx")); + FAIL() << "Expected exception was not thrown."; + } catch (const ngraph::ngraph_error& e) { + EXPECT_HAS_SUBSTRING( + e.what(), + std::string( + "Only `embedding_bag` is supported as ATen `operator` attribute. Got: test_unsupported_operator")); + } catch (...) { + FAIL() << "Other exception than expected was thrown."; + } +} diff --git a/ngraph/test/onnx/onnx_import_com_microsoft.in.cpp b/src/core/tests/onnx/onnx_import_com_microsoft.in.cpp similarity index 100% rename from ngraph/test/onnx/onnx_import_com_microsoft.in.cpp rename to src/core/tests/onnx/onnx_import_com_microsoft.in.cpp diff --git a/ngraph/test/onnx/onnx_import_const_folding.in.cpp b/src/core/tests/onnx/onnx_import_const_folding.in.cpp similarity index 100% rename from ngraph/test/onnx/onnx_import_const_folding.in.cpp rename to src/core/tests/onnx/onnx_import_const_folding.in.cpp diff --git a/ngraph/test/onnx/onnx_import_controlflow.in.cpp b/src/core/tests/onnx/onnx_import_controlflow.in.cpp similarity index 100% rename from ngraph/test/onnx/onnx_import_controlflow.in.cpp rename to src/core/tests/onnx/onnx_import_controlflow.in.cpp diff --git a/ngraph/test/onnx/onnx_import_convpool.in.cpp b/src/core/tests/onnx/onnx_import_convpool.in.cpp similarity index 100% rename from ngraph/test/onnx/onnx_import_convpool.in.cpp rename to src/core/tests/onnx/onnx_import_convpool.in.cpp diff --git a/ngraph/test/onnx/onnx_import_deprecated.in.cpp b/src/core/tests/onnx/onnx_import_deprecated.in.cpp similarity index 100% rename from ngraph/test/onnx/onnx_import_deprecated.in.cpp rename to src/core/tests/onnx/onnx_import_deprecated.in.cpp diff --git a/ngraph/test/onnx/onnx_import_dyn_shapes.in.cpp b/src/core/tests/onnx/onnx_import_dyn_shapes.in.cpp similarity index 100% rename from ngraph/test/onnx/onnx_import_dyn_shapes.in.cpp rename to src/core/tests/onnx/onnx_import_dyn_shapes.in.cpp diff --git a/ngraph/test/onnx/onnx_import_exceptions.cpp b/src/core/tests/onnx/onnx_import_exceptions.cpp similarity index 100% rename from ngraph/test/onnx/onnx_import_exceptions.cpp rename to src/core/tests/onnx/onnx_import_exceptions.cpp diff --git a/ngraph/test/onnx/onnx_import_external_data.in.cpp b/src/core/tests/onnx/onnx_import_external_data.in.cpp similarity index 100% rename from ngraph/test/onnx/onnx_import_external_data.in.cpp rename to src/core/tests/onnx/onnx_import_external_data.in.cpp diff --git a/ngraph/test/onnx/onnx_import_library.cpp b/src/core/tests/onnx/onnx_import_library.cpp similarity index 100% rename from ngraph/test/onnx/onnx_import_library.cpp rename to src/core/tests/onnx/onnx_import_library.cpp diff --git a/ngraph/test/onnx/onnx_import_org_openvino.in.cpp b/src/core/tests/onnx/onnx_import_org_openvino.in.cpp similarity index 100% rename from ngraph/test/onnx/onnx_import_org_openvino.in.cpp rename to src/core/tests/onnx/onnx_import_org_openvino.in.cpp diff --git a/ngraph/test/onnx/onnx_import_quant.in.cpp b/src/core/tests/onnx/onnx_import_quant.in.cpp similarity index 100% rename from ngraph/test/onnx/onnx_import_quant.in.cpp rename to src/core/tests/onnx/onnx_import_quant.in.cpp diff --git a/ngraph/test/onnx/onnx_import_reshape.in.cpp b/src/core/tests/onnx/onnx_import_reshape.in.cpp similarity index 100% rename from ngraph/test/onnx/onnx_import_reshape.in.cpp rename to src/core/tests/onnx/onnx_import_reshape.in.cpp diff --git a/ngraph/test/onnx/onnx_import_rnn.in.cpp b/src/core/tests/onnx/onnx_import_rnn.in.cpp similarity index 100% rename from ngraph/test/onnx/onnx_import_rnn.in.cpp rename to src/core/tests/onnx/onnx_import_rnn.in.cpp diff --git a/ngraph/test/onnx/onnx_import_with_editor.in.cpp b/src/core/tests/onnx/onnx_import_with_editor.in.cpp similarity index 100% rename from ngraph/test/onnx/onnx_import_with_editor.in.cpp rename to src/core/tests/onnx/onnx_import_with_editor.in.cpp diff --git a/ngraph/test/onnx/onnx_tensor_names.cpp b/src/core/tests/onnx/onnx_tensor_names.cpp similarity index 100% rename from ngraph/test/onnx/onnx_tensor_names.cpp rename to src/core/tests/onnx/onnx_tensor_names.cpp diff --git a/ngraph/test/onnx/onnx_test_utils.in.cpp b/src/core/tests/onnx/onnx_test_utils.in.cpp similarity index 100% rename from ngraph/test/onnx/onnx_test_utils.in.cpp rename to src/core/tests/onnx/onnx_test_utils.in.cpp diff --git a/ngraph/test/onnx/onnx_transformations.cpp b/src/core/tests/onnx/onnx_transformations.cpp similarity index 100% rename from ngraph/test/onnx/onnx_transformations.cpp rename to src/core/tests/onnx/onnx_transformations.cpp diff --git a/ngraph/test/onnx_test_util/CMakeLists.txt b/src/core/tests/onnx_test_util/CMakeLists.txt similarity index 100% rename from ngraph/test/onnx_test_util/CMakeLists.txt rename to src/core/tests/onnx_test_util/CMakeLists.txt diff --git a/ngraph/test/onnx_test_util/onnx_test_util.cpp b/src/core/tests/onnx_test_util/onnx_test_util.cpp similarity index 100% rename from ngraph/test/onnx_test_util/onnx_test_util.cpp rename to src/core/tests/onnx_test_util/onnx_test_util.cpp diff --git a/ngraph/test/onnx_test_util/onnx_test_util.hpp b/src/core/tests/onnx_test_util/onnx_test_util.hpp similarity index 100% rename from ngraph/test/onnx_test_util/onnx_test_util.hpp rename to src/core/tests/onnx_test_util/onnx_test_util.hpp diff --git a/ngraph/test/op.cpp b/src/core/tests/op.cpp similarity index 100% rename from ngraph/test/op.cpp rename to src/core/tests/op.cpp diff --git a/ngraph/test/op_eval/binary_convolution.cpp b/src/core/tests/op_eval/binary_convolution.cpp similarity index 100% rename from ngraph/test/op_eval/binary_convolution.cpp rename to src/core/tests/op_eval/binary_convolution.cpp diff --git a/ngraph/test/op_eval/bucketize.cpp b/src/core/tests/op_eval/bucketize.cpp similarity index 100% rename from ngraph/test/op_eval/bucketize.cpp rename to src/core/tests/op_eval/bucketize.cpp diff --git a/ngraph/test/op_eval/clamp.cpp b/src/core/tests/op_eval/clamp.cpp similarity index 100% rename from ngraph/test/op_eval/clamp.cpp rename to src/core/tests/op_eval/clamp.cpp diff --git a/ngraph/test/op_eval/einsum.cpp b/src/core/tests/op_eval/einsum.cpp similarity index 100% rename from ngraph/test/op_eval/einsum.cpp rename to src/core/tests/op_eval/einsum.cpp diff --git a/ngraph/test/op_eval/floor_mod.cpp b/src/core/tests/op_eval/floor_mod.cpp similarity index 100% rename from ngraph/test/op_eval/floor_mod.cpp rename to src/core/tests/op_eval/floor_mod.cpp diff --git a/ngraph/test/op_eval/gelu.cpp b/src/core/tests/op_eval/gelu.cpp similarity index 100% rename from ngraph/test/op_eval/gelu.cpp rename to src/core/tests/op_eval/gelu.cpp diff --git a/ngraph/test/op_eval/hsigmoid.cpp b/src/core/tests/op_eval/hsigmoid.cpp similarity index 100% rename from ngraph/test/op_eval/hsigmoid.cpp rename to src/core/tests/op_eval/hsigmoid.cpp diff --git a/ngraph/test/op_eval/hswish.cpp b/src/core/tests/op_eval/hswish.cpp similarity index 100% rename from ngraph/test/op_eval/hswish.cpp rename to src/core/tests/op_eval/hswish.cpp diff --git a/ngraph/test/op_eval/interpolate.cpp b/src/core/tests/op_eval/interpolate.cpp similarity index 100% rename from ngraph/test/op_eval/interpolate.cpp rename to src/core/tests/op_eval/interpolate.cpp diff --git a/ngraph/test/op_eval/matmul.cpp b/src/core/tests/op_eval/matmul.cpp similarity index 100% rename from ngraph/test/op_eval/matmul.cpp rename to src/core/tests/op_eval/matmul.cpp diff --git a/ngraph/test/op_eval/memory.cpp b/src/core/tests/op_eval/memory.cpp similarity index 100% rename from ngraph/test/op_eval/memory.cpp rename to src/core/tests/op_eval/memory.cpp diff --git a/ngraph/test/op_eval/mish.cpp b/src/core/tests/op_eval/mish.cpp similarity index 100% rename from ngraph/test/op_eval/mish.cpp rename to src/core/tests/op_eval/mish.cpp diff --git a/ngraph/test/op_eval/non_zero.cpp b/src/core/tests/op_eval/non_zero.cpp similarity index 100% rename from ngraph/test/op_eval/non_zero.cpp rename to src/core/tests/op_eval/non_zero.cpp diff --git a/ngraph/test/op_eval/roi_align.cpp b/src/core/tests/op_eval/roi_align.cpp similarity index 100% rename from ngraph/test/op_eval/roi_align.cpp rename to src/core/tests/op_eval/roi_align.cpp diff --git a/ngraph/test/op_eval/roi_pooling.cpp b/src/core/tests/op_eval/roi_pooling.cpp similarity index 100% rename from ngraph/test/op_eval/roi_pooling.cpp rename to src/core/tests/op_eval/roi_pooling.cpp diff --git a/ngraph/test/op_eval/round.cpp b/src/core/tests/op_eval/round.cpp similarity index 100% rename from ngraph/test/op_eval/round.cpp rename to src/core/tests/op_eval/round.cpp diff --git a/ngraph/test/op_eval/softplus.cpp b/src/core/tests/op_eval/softplus.cpp similarity index 100% rename from ngraph/test/op_eval/softplus.cpp rename to src/core/tests/op_eval/softplus.cpp diff --git a/ngraph/test/op_eval/split.cpp b/src/core/tests/op_eval/split.cpp similarity index 100% rename from ngraph/test/op_eval/split.cpp rename to src/core/tests/op_eval/split.cpp diff --git a/ngraph/test/op_eval/strided_slice.cpp b/src/core/tests/op_eval/strided_slice.cpp similarity index 100% rename from ngraph/test/op_eval/strided_slice.cpp rename to src/core/tests/op_eval/strided_slice.cpp diff --git a/ngraph/test/op_eval/swish.cpp b/src/core/tests/op_eval/swish.cpp similarity index 100% rename from ngraph/test/op_eval/swish.cpp rename to src/core/tests/op_eval/swish.cpp diff --git a/ngraph/test/op_eval/transpose.cpp b/src/core/tests/op_eval/transpose.cpp similarity index 100% rename from ngraph/test/op_eval/transpose.cpp rename to src/core/tests/op_eval/transpose.cpp diff --git a/ngraph/test/op_eval/variadic_split.cpp b/src/core/tests/op_eval/variadic_split.cpp similarity index 100% rename from ngraph/test/op_eval/variadic_split.cpp rename to src/core/tests/op_eval/variadic_split.cpp diff --git a/ngraph/test/op_version_tbl.hpp b/src/core/tests/op_version_tbl.hpp similarity index 100% rename from ngraph/test/op_version_tbl.hpp rename to src/core/tests/op_version_tbl.hpp diff --git a/ngraph/test/opset.cpp b/src/core/tests/opset.cpp similarity index 100% rename from ngraph/test/opset.cpp rename to src/core/tests/opset.cpp diff --git a/ngraph/test/opset1.cpp b/src/core/tests/opset1.cpp similarity index 100% rename from ngraph/test/opset1.cpp rename to src/core/tests/opset1.cpp diff --git a/ngraph/test/ov_default_allocator_test.cpp b/src/core/tests/ov_default_allocator_test.cpp similarity index 100% rename from ngraph/test/ov_default_allocator_test.cpp rename to src/core/tests/ov_default_allocator_test.cpp diff --git a/ngraph/test/ov_tensor_test.cpp b/src/core/tests/ov_tensor_test.cpp similarity index 100% rename from ngraph/test/ov_tensor_test.cpp rename to src/core/tests/ov_tensor_test.cpp diff --git a/ngraph/test/partial_shape.cpp b/src/core/tests/partial_shape.cpp similarity index 100% rename from ngraph/test/partial_shape.cpp rename to src/core/tests/partial_shape.cpp diff --git a/ngraph/test/pass/serialization/cleanup.cpp b/src/core/tests/pass/serialization/cleanup.cpp similarity index 100% rename from ngraph/test/pass/serialization/cleanup.cpp rename to src/core/tests/pass/serialization/cleanup.cpp diff --git a/ngraph/test/pass/serialization/const_compression.cpp b/src/core/tests/pass/serialization/const_compression.cpp similarity index 100% rename from ngraph/test/pass/serialization/const_compression.cpp rename to src/core/tests/pass/serialization/const_compression.cpp diff --git a/ngraph/test/pass/serialization/deterministicity.cpp b/src/core/tests/pass/serialization/deterministicity.cpp similarity index 100% rename from ngraph/test/pass/serialization/deterministicity.cpp rename to src/core/tests/pass/serialization/deterministicity.cpp diff --git a/ngraph/test/pass/serialization/read_ir.hpp b/src/core/tests/pass/serialization/read_ir.hpp similarity index 100% rename from ngraph/test/pass/serialization/read_ir.hpp rename to src/core/tests/pass/serialization/read_ir.hpp diff --git a/ngraph/test/pass/serialization/serialize.cpp b/src/core/tests/pass/serialization/serialize.cpp similarity index 100% rename from ngraph/test/pass/serialization/serialize.cpp rename to src/core/tests/pass/serialization/serialize.cpp diff --git a/ngraph/test/pass/serialization/tensor_names.cpp b/src/core/tests/pass/serialization/tensor_names.cpp similarity index 100% rename from ngraph/test/pass/serialization/tensor_names.cpp rename to src/core/tests/pass/serialization/tensor_names.cpp diff --git a/ngraph/test/pass_config.cpp b/src/core/tests/pass_config.cpp similarity index 100% rename from ngraph/test/pass_config.cpp rename to src/core/tests/pass_config.cpp diff --git a/ngraph/test/pass_manager.cpp b/src/core/tests/pass_manager.cpp similarity index 100% rename from ngraph/test/pass_manager.cpp rename to src/core/tests/pass_manager.cpp diff --git a/ngraph/test/pattern.cpp b/src/core/tests/pattern.cpp similarity index 100% rename from ngraph/test/pattern.cpp rename to src/core/tests/pattern.cpp diff --git a/ngraph/test/preprocess.cpp b/src/core/tests/preprocess.cpp similarity index 100% rename from ngraph/test/preprocess.cpp rename to src/core/tests/preprocess.cpp diff --git a/ngraph/test/replace_node.cpp b/src/core/tests/replace_node.cpp similarity index 100% rename from ngraph/test/replace_node.cpp rename to src/core/tests/replace_node.cpp diff --git a/ngraph/test/requirements_test_onnx.txt b/src/core/tests/requirements_test_onnx.txt similarity index 100% rename from ngraph/test/requirements_test_onnx.txt rename to src/core/tests/requirements_test_onnx.txt diff --git a/ngraph/test/reshape_opt_kernel.cpp b/src/core/tests/reshape_opt_kernel.cpp similarity index 100% rename from ngraph/test/reshape_opt_kernel.cpp rename to src/core/tests/reshape_opt_kernel.cpp diff --git a/ngraph/test/rtti.cpp b/src/core/tests/rtti.cpp similarity index 100% rename from ngraph/test/rtti.cpp rename to src/core/tests/rtti.cpp diff --git a/ngraph/test/runtime/CMakeLists.txt b/src/core/tests/runtime/CMakeLists.txt similarity index 100% rename from ngraph/test/runtime/CMakeLists.txt rename to src/core/tests/runtime/CMakeLists.txt diff --git a/ngraph/test/runtime/backend.cpp b/src/core/tests/runtime/backend.cpp similarity index 100% rename from ngraph/test/runtime/backend.cpp rename to src/core/tests/runtime/backend.cpp diff --git a/ngraph/test/runtime/backend.hpp b/src/core/tests/runtime/backend.hpp similarity index 100% rename from ngraph/test/runtime/backend.hpp rename to src/core/tests/runtime/backend.hpp diff --git a/ngraph/test/runtime/backend_manager.cpp b/src/core/tests/runtime/backend_manager.cpp similarity index 100% rename from ngraph/test/runtime/backend_manager.cpp rename to src/core/tests/runtime/backend_manager.cpp diff --git a/ngraph/test/runtime/backend_manager.hpp b/src/core/tests/runtime/backend_manager.hpp similarity index 100% rename from ngraph/test/runtime/backend_manager.hpp rename to src/core/tests/runtime/backend_manager.hpp diff --git a/ngraph/test/runtime/backend_visibility.hpp b/src/core/tests/runtime/backend_visibility.hpp similarity index 100% rename from ngraph/test/runtime/backend_visibility.hpp rename to src/core/tests/runtime/backend_visibility.hpp diff --git a/ngraph/test/runtime/cache.cpp b/src/core/tests/runtime/cache.cpp similarity index 100% rename from ngraph/test/runtime/cache.cpp rename to src/core/tests/runtime/cache.cpp diff --git a/ngraph/test/runtime/cache.hpp b/src/core/tests/runtime/cache.hpp similarity index 100% rename from ngraph/test/runtime/cache.hpp rename to src/core/tests/runtime/cache.hpp diff --git a/ngraph/test/runtime/dynamic/dynamic_backend.cpp b/src/core/tests/runtime/dynamic/dynamic_backend.cpp similarity index 100% rename from ngraph/test/runtime/dynamic/dynamic_backend.cpp rename to src/core/tests/runtime/dynamic/dynamic_backend.cpp diff --git a/ngraph/test/runtime/dynamic/dynamic_backend.hpp b/src/core/tests/runtime/dynamic/dynamic_backend.hpp similarity index 100% rename from ngraph/test/runtime/dynamic/dynamic_backend.hpp rename to src/core/tests/runtime/dynamic/dynamic_backend.hpp diff --git a/ngraph/test/runtime/executable.cpp b/src/core/tests/runtime/executable.cpp similarity index 100% rename from ngraph/test/runtime/executable.cpp rename to src/core/tests/runtime/executable.cpp diff --git a/ngraph/test/runtime/executable.hpp b/src/core/tests/runtime/executable.hpp similarity index 100% rename from ngraph/test/runtime/executable.hpp rename to src/core/tests/runtime/executable.hpp diff --git a/ngraph/test/runtime/ie/CMakeLists.txt b/src/core/tests/runtime/ie/CMakeLists.txt similarity index 100% rename from ngraph/test/runtime/ie/CMakeLists.txt rename to src/core/tests/runtime/ie/CMakeLists.txt diff --git a/ngraph/test/runtime/ie/ie_backend.cpp b/src/core/tests/runtime/ie/ie_backend.cpp similarity index 100% rename from ngraph/test/runtime/ie/ie_backend.cpp rename to src/core/tests/runtime/ie/ie_backend.cpp diff --git a/ngraph/test/runtime/ie/ie_backend.hpp b/src/core/tests/runtime/ie/ie_backend.hpp similarity index 100% rename from ngraph/test/runtime/ie/ie_backend.hpp rename to src/core/tests/runtime/ie/ie_backend.hpp diff --git a/ngraph/test/runtime/ie/ie_backend_visibility.hpp b/src/core/tests/runtime/ie/ie_backend_visibility.hpp similarity index 100% rename from ngraph/test/runtime/ie/ie_backend_visibility.hpp rename to src/core/tests/runtime/ie/ie_backend_visibility.hpp diff --git a/ngraph/test/runtime/ie/ie_executable.cpp b/src/core/tests/runtime/ie/ie_executable.cpp similarity index 100% rename from ngraph/test/runtime/ie/ie_executable.cpp rename to src/core/tests/runtime/ie/ie_executable.cpp diff --git a/ngraph/test/runtime/ie/ie_executable.hpp b/src/core/tests/runtime/ie/ie_executable.hpp similarity index 100% rename from ngraph/test/runtime/ie/ie_executable.hpp rename to src/core/tests/runtime/ie/ie_executable.hpp diff --git a/ngraph/test/runtime/ie/ie_tensor.cpp b/src/core/tests/runtime/ie/ie_tensor.cpp similarity index 100% rename from ngraph/test/runtime/ie/ie_tensor.cpp rename to src/core/tests/runtime/ie/ie_tensor.cpp diff --git a/ngraph/test/runtime/ie/ie_tensor.hpp b/src/core/tests/runtime/ie/ie_tensor.hpp similarity index 100% rename from ngraph/test/runtime/ie/ie_tensor.hpp rename to src/core/tests/runtime/ie/ie_tensor.hpp diff --git a/ngraph/test/runtime/ie/unit_test.manifest b/src/core/tests/runtime/ie/unit_test.manifest similarity index 100% rename from ngraph/test/runtime/ie/unit_test.manifest rename to src/core/tests/runtime/ie/unit_test.manifest diff --git a/ngraph/test/runtime/interpreter/CMakeLists.txt b/src/core/tests/runtime/interpreter/CMakeLists.txt similarity index 100% rename from ngraph/test/runtime/interpreter/CMakeLists.txt rename to src/core/tests/runtime/interpreter/CMakeLists.txt diff --git a/ngraph/test/runtime/interpreter/evaluates_map.cpp b/src/core/tests/runtime/interpreter/evaluates_map.cpp similarity index 99% rename from ngraph/test/runtime/interpreter/evaluates_map.cpp rename to src/core/tests/runtime/interpreter/evaluates_map.cpp index ccc4cf9071c..b83769c5757 100644 --- a/ngraph/test/runtime/interpreter/evaluates_map.cpp +++ b/src/core/tests/runtime/interpreter/evaluates_map.cpp @@ -1526,17 +1526,6 @@ bool evaluate(const shared_ptr& op, const HostTensorVector& outputs return true; } -template -bool evaluate(const shared_ptr& op, const HostTensorVector& outputs, const HostTensorVector& inputs) { - using T = typename element_type_traits::value_type; - runtime::reference::prior_box(inputs[0]->get_data_ptr(), - inputs[1]->get_data_ptr(), - outputs[0]->get_data_ptr(), - outputs[0]->get_shape(), - op->get_attrs()); - return true; -} - template bool evaluate(const shared_ptr& op, const HostTensorVector& outputs, const HostTensorVector& inputs) { using T = typename element_type_traits::value_type; @@ -2704,11 +2693,8 @@ bool evaluate(const shared_ptr& op, const HostTensorVector& outp template bool evaluate_node(std::shared_ptr node, const HostTensorVector& outputs, const HostTensorVector& inputs) { auto element_type = node->get_output_element_type(0); - if (ov::is_type(node)) { + if (ov::is_type(node)) element_type = node->get_input_element_type(1); - } else if (ov::is_type(node)) { - element_type = node->get_input_element_type(0); - } switch (element_type) { case element::Type_t::boolean: diff --git a/ngraph/test/runtime/interpreter/evaluates_map.hpp b/src/core/tests/runtime/interpreter/evaluates_map.hpp similarity index 100% rename from ngraph/test/runtime/interpreter/evaluates_map.hpp rename to src/core/tests/runtime/interpreter/evaluates_map.hpp diff --git a/ngraph/test/runtime/interpreter/int_backend.cpp b/src/core/tests/runtime/interpreter/int_backend.cpp similarity index 100% rename from ngraph/test/runtime/interpreter/int_backend.cpp rename to src/core/tests/runtime/interpreter/int_backend.cpp diff --git a/ngraph/test/runtime/interpreter/int_backend.hpp b/src/core/tests/runtime/interpreter/int_backend.hpp similarity index 100% rename from ngraph/test/runtime/interpreter/int_backend.hpp rename to src/core/tests/runtime/interpreter/int_backend.hpp diff --git a/ngraph/test/runtime/interpreter/int_backend_visibility.hpp b/src/core/tests/runtime/interpreter/int_backend_visibility.hpp similarity index 100% rename from ngraph/test/runtime/interpreter/int_backend_visibility.hpp rename to src/core/tests/runtime/interpreter/int_backend_visibility.hpp diff --git a/ngraph/test/runtime/interpreter/int_executable.cpp b/src/core/tests/runtime/interpreter/int_executable.cpp similarity index 98% rename from ngraph/test/runtime/interpreter/int_executable.cpp rename to src/core/tests/runtime/interpreter/int_executable.cpp index 45b5302541e..3aa12c2740e 100644 --- a/ngraph/test/runtime/interpreter/int_executable.cpp +++ b/src/core/tests/runtime/interpreter/int_executable.cpp @@ -128,7 +128,7 @@ bool runtime::interpreter::INTExecutable::call(const vector(op) || ov::is_type(op)) { + if (ov::is_type(op) || ov::is_type(op) || ov::is_type(op)) { type = op->get_input_element_type(0); } else if (ov::is_type(op) || ov::is_type(op) || ov::is_type(op) || ov::is_type(op) || diff --git a/ngraph/test/runtime/interpreter/int_executable.hpp b/src/core/tests/runtime/interpreter/int_executable.hpp similarity index 100% rename from ngraph/test/runtime/interpreter/int_executable.hpp rename to src/core/tests/runtime/interpreter/int_executable.hpp diff --git a/ngraph/test/runtime/interpreter/opset_int_tbl.hpp b/src/core/tests/runtime/interpreter/opset_int_tbl.hpp similarity index 98% rename from ngraph/test/runtime/interpreter/opset_int_tbl.hpp rename to src/core/tests/runtime/interpreter/opset_int_tbl.hpp index 8c58e32a3c2..e100660e9a9 100644 --- a/ngraph/test/runtime/interpreter/opset_int_tbl.hpp +++ b/src/core/tests/runtime/interpreter/opset_int_tbl.hpp @@ -111,3 +111,4 @@ NGRAPH_OP(Sigmoid, op::v0) NGRAPH_OP(Tanh, op::v0) NGRAPH_OP(Exp, op::v0) NGRAPH_OP(Log, op::v0) +NGRAPH_OP(PriorBox, ngraph::op::v8) diff --git a/ngraph/test/runtime/interpreter/unit_test.manifest b/src/core/tests/runtime/interpreter/unit_test.manifest similarity index 100% rename from ngraph/test/runtime/interpreter/unit_test.manifest rename to src/core/tests/runtime/interpreter/unit_test.manifest diff --git a/ngraph/test/runtime/pass/dyn_elimination.cpp b/src/core/tests/runtime/pass/dyn_elimination.cpp similarity index 100% rename from ngraph/test/runtime/pass/dyn_elimination.cpp rename to src/core/tests/runtime/pass/dyn_elimination.cpp diff --git a/ngraph/test/runtime/pass/dyn_elimination.hpp b/src/core/tests/runtime/pass/dyn_elimination.hpp similarity index 100% rename from ngraph/test/runtime/pass/dyn_elimination.hpp rename to src/core/tests/runtime/pass/dyn_elimination.hpp diff --git a/ngraph/test/runtime/pass/shape_relevance.cpp b/src/core/tests/runtime/pass/shape_relevance.cpp similarity index 100% rename from ngraph/test/runtime/pass/shape_relevance.cpp rename to src/core/tests/runtime/pass/shape_relevance.cpp diff --git a/ngraph/test/runtime/pass/shape_relevance.hpp b/src/core/tests/runtime/pass/shape_relevance.hpp similarity index 100% rename from ngraph/test/runtime/pass/shape_relevance.hpp rename to src/core/tests/runtime/pass/shape_relevance.hpp diff --git a/ngraph/test/runtime/performance_counter.hpp b/src/core/tests/runtime/performance_counter.hpp similarity index 100% rename from ngraph/test/runtime/performance_counter.hpp rename to src/core/tests/runtime/performance_counter.hpp diff --git a/ngraph/test/shape.cpp b/src/core/tests/shape.cpp similarity index 100% rename from ngraph/test/shape.cpp rename to src/core/tests/shape.cpp diff --git a/ngraph/test/span.cpp b/src/core/tests/span.cpp similarity index 100% rename from ngraph/test/span.cpp rename to src/core/tests/span.cpp diff --git a/ngraph/test/specialize_function.cpp b/src/core/tests/specialize_function.cpp similarity index 100% rename from ngraph/test/specialize_function.cpp rename to src/core/tests/specialize_function.cpp diff --git a/ngraph/test/tensor.cpp b/src/core/tests/tensor.cpp similarity index 100% rename from ngraph/test/tensor.cpp rename to src/core/tests/tensor.cpp diff --git a/ngraph/test/threading.cpp b/src/core/tests/threading.cpp similarity index 100% rename from ngraph/test/threading.cpp rename to src/core/tests/threading.cpp diff --git a/ngraph/test/type_info.cpp b/src/core/tests/type_info.cpp similarity index 100% rename from ngraph/test/type_info.cpp rename to src/core/tests/type_info.cpp diff --git a/ngraph/test/type_prop/abs.cpp b/src/core/tests/type_prop/abs.cpp similarity index 100% rename from ngraph/test/type_prop/abs.cpp rename to src/core/tests/type_prop/abs.cpp diff --git a/ngraph/test/type_prop/acos.cpp b/src/core/tests/type_prop/acos.cpp similarity index 100% rename from ngraph/test/type_prop/acos.cpp rename to src/core/tests/type_prop/acos.cpp diff --git a/ngraph/test/type_prop/acosh.cpp b/src/core/tests/type_prop/acosh.cpp similarity index 100% rename from ngraph/test/type_prop/acosh.cpp rename to src/core/tests/type_prop/acosh.cpp diff --git a/ngraph/test/type_prop/adaptive_avg_pool.cpp b/src/core/tests/type_prop/adaptive_avg_pool.cpp similarity index 100% rename from ngraph/test/type_prop/adaptive_avg_pool.cpp rename to src/core/tests/type_prop/adaptive_avg_pool.cpp diff --git a/ngraph/test/type_prop/adaptive_max_pool.cpp b/src/core/tests/type_prop/adaptive_max_pool.cpp similarity index 100% rename from ngraph/test/type_prop/adaptive_max_pool.cpp rename to src/core/tests/type_prop/adaptive_max_pool.cpp diff --git a/ngraph/test/type_prop/add.cpp b/src/core/tests/type_prop/add.cpp similarity index 100% rename from ngraph/test/type_prop/add.cpp rename to src/core/tests/type_prop/add.cpp diff --git a/ngraph/test/type_prop/arithmetic_ops.hpp b/src/core/tests/type_prop/arithmetic_ops.hpp similarity index 100% rename from ngraph/test/type_prop/arithmetic_ops.hpp rename to src/core/tests/type_prop/arithmetic_ops.hpp diff --git a/ngraph/test/type_prop/asin.cpp b/src/core/tests/type_prop/asin.cpp similarity index 100% rename from ngraph/test/type_prop/asin.cpp rename to src/core/tests/type_prop/asin.cpp diff --git a/ngraph/test/type_prop/asinh.cpp b/src/core/tests/type_prop/asinh.cpp similarity index 100% rename from ngraph/test/type_prop/asinh.cpp rename to src/core/tests/type_prop/asinh.cpp diff --git a/ngraph/test/type_prop/assign.cpp b/src/core/tests/type_prop/assign.cpp similarity index 100% rename from ngraph/test/type_prop/assign.cpp rename to src/core/tests/type_prop/assign.cpp diff --git a/ngraph/test/type_prop/atan.cpp b/src/core/tests/type_prop/atan.cpp similarity index 100% rename from ngraph/test/type_prop/atan.cpp rename to src/core/tests/type_prop/atan.cpp diff --git a/ngraph/test/type_prop/atanh.cpp b/src/core/tests/type_prop/atanh.cpp similarity index 100% rename from ngraph/test/type_prop/atanh.cpp rename to src/core/tests/type_prop/atanh.cpp diff --git a/ngraph/test/type_prop/avg_pool.cpp b/src/core/tests/type_prop/avg_pool.cpp similarity index 100% rename from ngraph/test/type_prop/avg_pool.cpp rename to src/core/tests/type_prop/avg_pool.cpp diff --git a/ngraph/test/type_prop/batch_norm.cpp b/src/core/tests/type_prop/batch_norm.cpp similarity index 100% rename from ngraph/test/type_prop/batch_norm.cpp rename to src/core/tests/type_prop/batch_norm.cpp diff --git a/ngraph/test/type_prop/batch_to_space.cpp b/src/core/tests/type_prop/batch_to_space.cpp similarity index 100% rename from ngraph/test/type_prop/batch_to_space.cpp rename to src/core/tests/type_prop/batch_to_space.cpp diff --git a/ngraph/test/type_prop/binary_convolution.cpp b/src/core/tests/type_prop/binary_convolution.cpp similarity index 100% rename from ngraph/test/type_prop/binary_convolution.cpp rename to src/core/tests/type_prop/binary_convolution.cpp diff --git a/ngraph/test/type_prop/binary_elementwise.cpp b/src/core/tests/type_prop/binary_elementwise.cpp similarity index 100% rename from ngraph/test/type_prop/binary_elementwise.cpp rename to src/core/tests/type_prop/binary_elementwise.cpp diff --git a/ngraph/test/type_prop/broadcast.cpp b/src/core/tests/type_prop/broadcast.cpp similarity index 100% rename from ngraph/test/type_prop/broadcast.cpp rename to src/core/tests/type_prop/broadcast.cpp diff --git a/ngraph/test/type_prop/bucketize.cpp b/src/core/tests/type_prop/bucketize.cpp similarity index 100% rename from ngraph/test/type_prop/bucketize.cpp rename to src/core/tests/type_prop/bucketize.cpp diff --git a/ngraph/test/type_prop/ceiling.cpp b/src/core/tests/type_prop/ceiling.cpp similarity index 100% rename from ngraph/test/type_prop/ceiling.cpp rename to src/core/tests/type_prop/ceiling.cpp diff --git a/ngraph/test/type_prop/clamp.cpp b/src/core/tests/type_prop/clamp.cpp similarity index 100% rename from ngraph/test/type_prop/clamp.cpp rename to src/core/tests/type_prop/clamp.cpp diff --git a/ngraph/test/type_prop/concat.cpp b/src/core/tests/type_prop/concat.cpp similarity index 100% rename from ngraph/test/type_prop/concat.cpp rename to src/core/tests/type_prop/concat.cpp diff --git a/ngraph/test/type_prop/constant.cpp b/src/core/tests/type_prop/constant.cpp similarity index 100% rename from ngraph/test/type_prop/constant.cpp rename to src/core/tests/type_prop/constant.cpp diff --git a/ngraph/test/type_prop/convert.cpp b/src/core/tests/type_prop/convert.cpp similarity index 100% rename from ngraph/test/type_prop/convert.cpp rename to src/core/tests/type_prop/convert.cpp diff --git a/ngraph/test/type_prop/convert_color_i420.cpp b/src/core/tests/type_prop/convert_color_i420.cpp similarity index 100% rename from ngraph/test/type_prop/convert_color_i420.cpp rename to src/core/tests/type_prop/convert_color_i420.cpp diff --git a/ngraph/test/type_prop/convert_color_i420_base.hpp b/src/core/tests/type_prop/convert_color_i420_base.hpp similarity index 100% rename from ngraph/test/type_prop/convert_color_i420_base.hpp rename to src/core/tests/type_prop/convert_color_i420_base.hpp diff --git a/ngraph/test/type_prop/convert_color_nv12.cpp b/src/core/tests/type_prop/convert_color_nv12.cpp similarity index 100% rename from ngraph/test/type_prop/convert_color_nv12.cpp rename to src/core/tests/type_prop/convert_color_nv12.cpp diff --git a/ngraph/test/type_prop/convert_color_nv12_base.hpp b/src/core/tests/type_prop/convert_color_nv12_base.hpp similarity index 100% rename from ngraph/test/type_prop/convert_color_nv12_base.hpp rename to src/core/tests/type_prop/convert_color_nv12_base.hpp diff --git a/ngraph/test/type_prop/convolution.cpp b/src/core/tests/type_prop/convolution.cpp similarity index 100% rename from ngraph/test/type_prop/convolution.cpp rename to src/core/tests/type_prop/convolution.cpp diff --git a/ngraph/test/type_prop/convolution_backprop_data.cpp b/src/core/tests/type_prop/convolution_backprop_data.cpp similarity index 100% rename from ngraph/test/type_prop/convolution_backprop_data.cpp rename to src/core/tests/type_prop/convolution_backprop_data.cpp diff --git a/ngraph/test/type_prop/cos.cpp b/src/core/tests/type_prop/cos.cpp similarity index 100% rename from ngraph/test/type_prop/cos.cpp rename to src/core/tests/type_prop/cos.cpp diff --git a/ngraph/test/type_prop/cosh.cpp b/src/core/tests/type_prop/cosh.cpp similarity index 100% rename from ngraph/test/type_prop/cosh.cpp rename to src/core/tests/type_prop/cosh.cpp diff --git a/ngraph/test/type_prop/ctc_greedy_decoder.cpp b/src/core/tests/type_prop/ctc_greedy_decoder.cpp similarity index 100% rename from ngraph/test/type_prop/ctc_greedy_decoder.cpp rename to src/core/tests/type_prop/ctc_greedy_decoder.cpp diff --git a/ngraph/test/type_prop/ctc_greedy_decoder_seq_len.cpp b/src/core/tests/type_prop/ctc_greedy_decoder_seq_len.cpp similarity index 100% rename from ngraph/test/type_prop/ctc_greedy_decoder_seq_len.cpp rename to src/core/tests/type_prop/ctc_greedy_decoder_seq_len.cpp diff --git a/ngraph/test/type_prop/ctc_loss.cpp b/src/core/tests/type_prop/ctc_loss.cpp similarity index 100% rename from ngraph/test/type_prop/ctc_loss.cpp rename to src/core/tests/type_prop/ctc_loss.cpp diff --git a/ngraph/test/type_prop/cum_sum.cpp b/src/core/tests/type_prop/cum_sum.cpp similarity index 100% rename from ngraph/test/type_prop/cum_sum.cpp rename to src/core/tests/type_prop/cum_sum.cpp diff --git a/ngraph/test/type_prop/deformable_convolution.cpp b/src/core/tests/type_prop/deformable_convolution.cpp similarity index 100% rename from ngraph/test/type_prop/deformable_convolution.cpp rename to src/core/tests/type_prop/deformable_convolution.cpp diff --git a/ngraph/test/type_prop/deformable_convolution_opset8.cpp b/src/core/tests/type_prop/deformable_convolution_opset8.cpp similarity index 100% rename from ngraph/test/type_prop/deformable_convolution_opset8.cpp rename to src/core/tests/type_prop/deformable_convolution_opset8.cpp diff --git a/ngraph/test/type_prop/deformable_psroi_pooling.cpp b/src/core/tests/type_prop/deformable_psroi_pooling.cpp similarity index 100% rename from ngraph/test/type_prop/deformable_psroi_pooling.cpp rename to src/core/tests/type_prop/deformable_psroi_pooling.cpp diff --git a/ngraph/test/type_prop/depth_to_space.cpp b/src/core/tests/type_prop/depth_to_space.cpp similarity index 100% rename from ngraph/test/type_prop/depth_to_space.cpp rename to src/core/tests/type_prop/depth_to_space.cpp diff --git a/ngraph/test/type_prop/detection_output.cpp b/src/core/tests/type_prop/detection_output.cpp similarity index 100% rename from ngraph/test/type_prop/detection_output.cpp rename to src/core/tests/type_prop/detection_output.cpp diff --git a/ngraph/test/type_prop/dft.cpp b/src/core/tests/type_prop/dft.cpp similarity index 100% rename from ngraph/test/type_prop/dft.cpp rename to src/core/tests/type_prop/dft.cpp diff --git a/ngraph/test/type_prop/divide.cpp b/src/core/tests/type_prop/divide.cpp similarity index 100% rename from ngraph/test/type_prop/divide.cpp rename to src/core/tests/type_prop/divide.cpp diff --git a/ngraph/test/type_prop/dyn_reshape.cpp b/src/core/tests/type_prop/dyn_reshape.cpp similarity index 100% rename from ngraph/test/type_prop/dyn_reshape.cpp rename to src/core/tests/type_prop/dyn_reshape.cpp diff --git a/ngraph/test/type_prop/einsum.cpp b/src/core/tests/type_prop/einsum.cpp similarity index 100% rename from ngraph/test/type_prop/einsum.cpp rename to src/core/tests/type_prop/einsum.cpp diff --git a/ngraph/test/type_prop/elu.cpp b/src/core/tests/type_prop/elu.cpp similarity index 100% rename from ngraph/test/type_prop/elu.cpp rename to src/core/tests/type_prop/elu.cpp diff --git a/ngraph/test/type_prop/embedding_segments_sum.cpp b/src/core/tests/type_prop/embedding_segments_sum.cpp similarity index 100% rename from ngraph/test/type_prop/embedding_segments_sum.cpp rename to src/core/tests/type_prop/embedding_segments_sum.cpp diff --git a/ngraph/test/type_prop/embeddingbag_offsetssum.cpp b/src/core/tests/type_prop/embeddingbag_offsetssum.cpp similarity index 100% rename from ngraph/test/type_prop/embeddingbag_offsetssum.cpp rename to src/core/tests/type_prop/embeddingbag_offsetssum.cpp diff --git a/ngraph/test/type_prop/embeddingbag_packedsum.cpp b/src/core/tests/type_prop/embeddingbag_packedsum.cpp similarity index 100% rename from ngraph/test/type_prop/embeddingbag_packedsum.cpp rename to src/core/tests/type_prop/embeddingbag_packedsum.cpp diff --git a/ngraph/test/type_prop/erf.cpp b/src/core/tests/type_prop/erf.cpp similarity index 100% rename from ngraph/test/type_prop/erf.cpp rename to src/core/tests/type_prop/erf.cpp diff --git a/ngraph/test/type_prop/exp.cpp b/src/core/tests/type_prop/exp.cpp similarity index 100% rename from ngraph/test/type_prop/exp.cpp rename to src/core/tests/type_prop/exp.cpp diff --git a/ngraph/test/type_prop/experimental_detectron_detection_output.cpp b/src/core/tests/type_prop/experimental_detectron_detection_output.cpp similarity index 100% rename from ngraph/test/type_prop/experimental_detectron_detection_output.cpp rename to src/core/tests/type_prop/experimental_detectron_detection_output.cpp diff --git a/ngraph/test/type_prop/experimental_detectron_generate_proposals.cpp b/src/core/tests/type_prop/experimental_detectron_generate_proposals.cpp similarity index 100% rename from ngraph/test/type_prop/experimental_detectron_generate_proposals.cpp rename to src/core/tests/type_prop/experimental_detectron_generate_proposals.cpp diff --git a/ngraph/test/type_prop/experimental_detectron_prior_grid_generator.cpp b/src/core/tests/type_prop/experimental_detectron_prior_grid_generator.cpp similarity index 100% rename from ngraph/test/type_prop/experimental_detectron_prior_grid_generator.cpp rename to src/core/tests/type_prop/experimental_detectron_prior_grid_generator.cpp diff --git a/ngraph/test/type_prop/experimental_detectron_roi_feature_extractor.cpp b/src/core/tests/type_prop/experimental_detectron_roi_feature_extractor.cpp similarity index 100% rename from ngraph/test/type_prop/experimental_detectron_roi_feature_extractor.cpp rename to src/core/tests/type_prop/experimental_detectron_roi_feature_extractor.cpp diff --git a/ngraph/test/type_prop/experimental_detectron_topkrois.cpp b/src/core/tests/type_prop/experimental_detectron_topkrois.cpp similarity index 100% rename from ngraph/test/type_prop/experimental_detectron_topkrois.cpp rename to src/core/tests/type_prop/experimental_detectron_topkrois.cpp diff --git a/ngraph/test/type_prop/extractimagepatches.cpp b/src/core/tests/type_prop/extractimagepatches.cpp similarity index 100% rename from ngraph/test/type_prop/extractimagepatches.cpp rename to src/core/tests/type_prop/extractimagepatches.cpp diff --git a/ngraph/test/type_prop/fake_quantize.cpp b/src/core/tests/type_prop/fake_quantize.cpp similarity index 100% rename from ngraph/test/type_prop/fake_quantize.cpp rename to src/core/tests/type_prop/fake_quantize.cpp diff --git a/ngraph/test/type_prop/floor.cpp b/src/core/tests/type_prop/floor.cpp similarity index 100% rename from ngraph/test/type_prop/floor.cpp rename to src/core/tests/type_prop/floor.cpp diff --git a/ngraph/test/type_prop/floor_mod.cpp b/src/core/tests/type_prop/floor_mod.cpp similarity index 100% rename from ngraph/test/type_prop/floor_mod.cpp rename to src/core/tests/type_prop/floor_mod.cpp diff --git a/ngraph/test/type_prop/framework_node.cpp b/src/core/tests/type_prop/framework_node.cpp similarity index 100% rename from ngraph/test/type_prop/framework_node.cpp rename to src/core/tests/type_prop/framework_node.cpp diff --git a/ngraph/test/type_prop/gather.cpp b/src/core/tests/type_prop/gather.cpp similarity index 100% rename from ngraph/test/type_prop/gather.cpp rename to src/core/tests/type_prop/gather.cpp diff --git a/ngraph/test/type_prop/gather_elements.cpp b/src/core/tests/type_prop/gather_elements.cpp similarity index 100% rename from ngraph/test/type_prop/gather_elements.cpp rename to src/core/tests/type_prop/gather_elements.cpp diff --git a/ngraph/test/type_prop/gather_nd.cpp b/src/core/tests/type_prop/gather_nd.cpp similarity index 100% rename from ngraph/test/type_prop/gather_nd.cpp rename to src/core/tests/type_prop/gather_nd.cpp diff --git a/ngraph/test/type_prop/gather_tree.cpp b/src/core/tests/type_prop/gather_tree.cpp similarity index 100% rename from ngraph/test/type_prop/gather_tree.cpp rename to src/core/tests/type_prop/gather_tree.cpp diff --git a/ngraph/test/type_prop/gelu.cpp b/src/core/tests/type_prop/gelu.cpp similarity index 100% rename from ngraph/test/type_prop/gelu.cpp rename to src/core/tests/type_prop/gelu.cpp diff --git a/ngraph/test/type_prop/grn.cpp b/src/core/tests/type_prop/grn.cpp similarity index 100% rename from ngraph/test/type_prop/grn.cpp rename to src/core/tests/type_prop/grn.cpp diff --git a/ngraph/test/type_prop/group_convolution.cpp b/src/core/tests/type_prop/group_convolution.cpp similarity index 100% rename from ngraph/test/type_prop/group_convolution.cpp rename to src/core/tests/type_prop/group_convolution.cpp diff --git a/ngraph/test/type_prop/group_convolution_backprop_data.cpp b/src/core/tests/type_prop/group_convolution_backprop_data.cpp similarity index 100% rename from ngraph/test/type_prop/group_convolution_backprop_data.cpp rename to src/core/tests/type_prop/group_convolution_backprop_data.cpp diff --git a/ngraph/test/type_prop/gru_cell.cpp b/src/core/tests/type_prop/gru_cell.cpp similarity index 100% rename from ngraph/test/type_prop/gru_cell.cpp rename to src/core/tests/type_prop/gru_cell.cpp diff --git a/ngraph/test/type_prop/gru_sequence.cpp b/src/core/tests/type_prop/gru_sequence.cpp similarity index 100% rename from ngraph/test/type_prop/gru_sequence.cpp rename to src/core/tests/type_prop/gru_sequence.cpp diff --git a/ngraph/test/type_prop/hard_sigmoid.cpp b/src/core/tests/type_prop/hard_sigmoid.cpp similarity index 100% rename from ngraph/test/type_prop/hard_sigmoid.cpp rename to src/core/tests/type_prop/hard_sigmoid.cpp diff --git a/ngraph/test/type_prop/hsigmoid.cpp b/src/core/tests/type_prop/hsigmoid.cpp similarity index 100% rename from ngraph/test/type_prop/hsigmoid.cpp rename to src/core/tests/type_prop/hsigmoid.cpp diff --git a/ngraph/test/type_prop/hswish.cpp b/src/core/tests/type_prop/hswish.cpp similarity index 100% rename from ngraph/test/type_prop/hswish.cpp rename to src/core/tests/type_prop/hswish.cpp diff --git a/ngraph/test/type_prop/idft.cpp b/src/core/tests/type_prop/idft.cpp similarity index 100% rename from ngraph/test/type_prop/idft.cpp rename to src/core/tests/type_prop/idft.cpp diff --git a/ngraph/test/type_prop/if.cpp b/src/core/tests/type_prop/if.cpp similarity index 100% rename from ngraph/test/type_prop/if.cpp rename to src/core/tests/type_prop/if.cpp diff --git a/ngraph/test/type_prop/interpolate.cpp b/src/core/tests/type_prop/interpolate.cpp similarity index 100% rename from ngraph/test/type_prop/interpolate.cpp rename to src/core/tests/type_prop/interpolate.cpp diff --git a/ngraph/test/type_prop/log_softmax.cpp b/src/core/tests/type_prop/log_softmax.cpp similarity index 100% rename from ngraph/test/type_prop/log_softmax.cpp rename to src/core/tests/type_prop/log_softmax.cpp diff --git a/ngraph/test/type_prop/logical_and.cpp b/src/core/tests/type_prop/logical_and.cpp similarity index 100% rename from ngraph/test/type_prop/logical_and.cpp rename to src/core/tests/type_prop/logical_and.cpp diff --git a/ngraph/test/type_prop/logical_not.cpp b/src/core/tests/type_prop/logical_not.cpp similarity index 100% rename from ngraph/test/type_prop/logical_not.cpp rename to src/core/tests/type_prop/logical_not.cpp diff --git a/ngraph/test/type_prop/logical_ops.hpp b/src/core/tests/type_prop/logical_ops.hpp similarity index 100% rename from ngraph/test/type_prop/logical_ops.hpp rename to src/core/tests/type_prop/logical_ops.hpp diff --git a/ngraph/test/type_prop/logical_or.cpp b/src/core/tests/type_prop/logical_or.cpp similarity index 100% rename from ngraph/test/type_prop/logical_or.cpp rename to src/core/tests/type_prop/logical_or.cpp diff --git a/ngraph/test/type_prop/logical_xor.cpp b/src/core/tests/type_prop/logical_xor.cpp similarity index 100% rename from ngraph/test/type_prop/logical_xor.cpp rename to src/core/tests/type_prop/logical_xor.cpp diff --git a/ngraph/test/type_prop/loop.cpp b/src/core/tests/type_prop/loop.cpp similarity index 100% rename from ngraph/test/type_prop/loop.cpp rename to src/core/tests/type_prop/loop.cpp diff --git a/ngraph/test/type_prop/lrn.cpp b/src/core/tests/type_prop/lrn.cpp similarity index 100% rename from ngraph/test/type_prop/lrn.cpp rename to src/core/tests/type_prop/lrn.cpp diff --git a/ngraph/test/type_prop/lstm_cell.cpp b/src/core/tests/type_prop/lstm_cell.cpp similarity index 100% rename from ngraph/test/type_prop/lstm_cell.cpp rename to src/core/tests/type_prop/lstm_cell.cpp diff --git a/ngraph/test/type_prop/lstm_sequence.cpp b/src/core/tests/type_prop/lstm_sequence.cpp similarity index 100% rename from ngraph/test/type_prop/lstm_sequence.cpp rename to src/core/tests/type_prop/lstm_sequence.cpp diff --git a/ngraph/test/type_prop/matmul.cpp b/src/core/tests/type_prop/matmul.cpp similarity index 100% rename from ngraph/test/type_prop/matmul.cpp rename to src/core/tests/type_prop/matmul.cpp diff --git a/ngraph/test/type_prop/matrix_nms.cpp b/src/core/tests/type_prop/matrix_nms.cpp similarity index 100% rename from ngraph/test/type_prop/matrix_nms.cpp rename to src/core/tests/type_prop/matrix_nms.cpp diff --git a/ngraph/test/type_prop/max_pool.cpp b/src/core/tests/type_prop/max_pool.cpp similarity index 100% rename from ngraph/test/type_prop/max_pool.cpp rename to src/core/tests/type_prop/max_pool.cpp diff --git a/ngraph/test/type_prop/maximum.cpp b/src/core/tests/type_prop/maximum.cpp similarity index 100% rename from ngraph/test/type_prop/maximum.cpp rename to src/core/tests/type_prop/maximum.cpp diff --git a/ngraph/test/type_prop/minimum.cpp b/src/core/tests/type_prop/minimum.cpp similarity index 100% rename from ngraph/test/type_prop/minimum.cpp rename to src/core/tests/type_prop/minimum.cpp diff --git a/ngraph/test/type_prop/mish.cpp b/src/core/tests/type_prop/mish.cpp similarity index 100% rename from ngraph/test/type_prop/mish.cpp rename to src/core/tests/type_prop/mish.cpp diff --git a/ngraph/test/type_prop/mod.cpp b/src/core/tests/type_prop/mod.cpp similarity index 100% rename from ngraph/test/type_prop/mod.cpp rename to src/core/tests/type_prop/mod.cpp diff --git a/ngraph/test/type_prop/multiclass_nms.cpp b/src/core/tests/type_prop/multiclass_nms.cpp similarity index 100% rename from ngraph/test/type_prop/multiclass_nms.cpp rename to src/core/tests/type_prop/multiclass_nms.cpp diff --git a/ngraph/test/type_prop/multiply.cpp b/src/core/tests/type_prop/multiply.cpp similarity index 100% rename from ngraph/test/type_prop/multiply.cpp rename to src/core/tests/type_prop/multiply.cpp diff --git a/ngraph/test/type_prop/mvn.cpp b/src/core/tests/type_prop/mvn.cpp similarity index 100% rename from ngraph/test/type_prop/mvn.cpp rename to src/core/tests/type_prop/mvn.cpp diff --git a/ngraph/test/type_prop/negative.cpp b/src/core/tests/type_prop/negative.cpp similarity index 100% rename from ngraph/test/type_prop/negative.cpp rename to src/core/tests/type_prop/negative.cpp diff --git a/ngraph/test/type_prop/non_max_suppression.cpp b/src/core/tests/type_prop/non_max_suppression.cpp similarity index 100% rename from ngraph/test/type_prop/non_max_suppression.cpp rename to src/core/tests/type_prop/non_max_suppression.cpp diff --git a/ngraph/test/type_prop/non_zero.cpp b/src/core/tests/type_prop/non_zero.cpp similarity index 100% rename from ngraph/test/type_prop/non_zero.cpp rename to src/core/tests/type_prop/non_zero.cpp diff --git a/ngraph/test/type_prop/normalize_l2.cpp b/src/core/tests/type_prop/normalize_l2.cpp similarity index 100% rename from ngraph/test/type_prop/normalize_l2.cpp rename to src/core/tests/type_prop/normalize_l2.cpp diff --git a/ngraph/test/type_prop/one_hot.cpp b/src/core/tests/type_prop/one_hot.cpp similarity index 100% rename from ngraph/test/type_prop/one_hot.cpp rename to src/core/tests/type_prop/one_hot.cpp diff --git a/ngraph/test/type_prop/pad.cpp b/src/core/tests/type_prop/pad.cpp similarity index 100% rename from ngraph/test/type_prop/pad.cpp rename to src/core/tests/type_prop/pad.cpp diff --git a/ngraph/test/type_prop/parameter.cpp b/src/core/tests/type_prop/parameter.cpp similarity index 100% rename from ngraph/test/type_prop/parameter.cpp rename to src/core/tests/type_prop/parameter.cpp diff --git a/ngraph/test/type_prop/power.cpp b/src/core/tests/type_prop/power.cpp similarity index 100% rename from ngraph/test/type_prop/power.cpp rename to src/core/tests/type_prop/power.cpp diff --git a/ngraph/test/type_prop/prelu.cpp b/src/core/tests/type_prop/prelu.cpp similarity index 100% rename from ngraph/test/type_prop/prelu.cpp rename to src/core/tests/type_prop/prelu.cpp diff --git a/src/core/tests/type_prop/prior_box.cpp b/src/core/tests/type_prop/prior_box.cpp new file mode 100644 index 00000000000..a980728f76a --- /dev/null +++ b/src/core/tests/type_prop/prior_box.cpp @@ -0,0 +1,75 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "ngraph/op/prior_box.hpp" + +#include "gtest/gtest.h" +#include "ngraph/ngraph.hpp" + +using namespace ngraph; + +TEST(type_prop, prior_box1) { + op::v0::PriorBox::Attributes attrs; + attrs.min_size = {2.0f, 3.0f}; + attrs.aspect_ratio = {1.5f, 2.0f, 2.5f}; + attrs.scale_all_sizes = false; + + auto layer_shape = op::Constant::create(element::i64, Shape{2}, {32, 32}); + auto image_shape = op::Constant::create(element::i64, Shape{2}, {300, 300}); + auto pb = std::make_shared(layer_shape, image_shape, attrs); + ASSERT_EQ(pb->get_shape(), (Shape{2, 20480})); +} + +TEST(type_prop, prior_box2) { + op::v0::PriorBox::Attributes attrs; + attrs.min_size = {2.0f, 3.0f}; + attrs.aspect_ratio = {1.5f, 2.0f, 2.5f}; + attrs.flip = true; + attrs.scale_all_sizes = false; + + auto layer_shape = op::Constant::create(element::i64, Shape{2}, {32, 32}); + auto image_shape = op::Constant::create(element::i64, Shape{2}, {300, 300}); + auto pb = std::make_shared(layer_shape, image_shape, attrs); + ASSERT_EQ(pb->get_shape(), (Shape{2, 32768})); +} + +TEST(type_prop, prior_box3) { + op::v0::PriorBox::Attributes attrs; + attrs.min_size = {256.0f}; + attrs.max_size = {315.0f}; + attrs.aspect_ratio = {2.0f}; + attrs.flip = true; + + auto layer_shape = op::Constant::create(element::i64, Shape{2}, {1, 1}); + auto image_shape = op::Constant::create(element::i64, Shape{2}, {300, 300}); + auto pb = std::make_shared(layer_shape, image_shape, attrs); + ASSERT_EQ(pb->get_shape(), (Shape{2, 16})); +} + +TEST(type_prop, prior_box_v8_1) { + op::v8::PriorBox::Attributes attrs; + attrs.min_size = {2.0f, 3.0f}; + attrs.aspect_ratio = {1.5f, 2.0f, 2.5f}; + attrs.scale_all_sizes = false; + attrs.min_max_aspect_ratios_order = true; + + auto layer_shape = op::Constant::create(element::i64, Shape{2}, {32, 32}); + auto image_shape = op::Constant::create(element::i64, Shape{2}, {300, 300}); + auto pb = std::make_shared(layer_shape, image_shape, attrs); + ASSERT_EQ(pb->get_shape(), (Shape{2, 20480})); +} + +TEST(type_prop, prior_box_v8_2) { + op::v8::PriorBox::Attributes attrs; + attrs.min_size = {2.0f, 3.0f}; + attrs.aspect_ratio = {1.5f, 2.0f, 2.5f}; + attrs.flip = true; + attrs.scale_all_sizes = false; + attrs.min_max_aspect_ratios_order = false; + + auto layer_shape = op::Constant::create(element::i64, Shape{2}, {32, 32}); + auto image_shape = op::Constant::create(element::i64, Shape{2}, {300, 300}); + auto pb = std::make_shared(layer_shape, image_shape, attrs); + ASSERT_EQ(pb->get_shape(), (Shape{2, 32768})); +} \ No newline at end of file diff --git a/ngraph/test/type_prop/prior_box_clustered.cpp b/src/core/tests/type_prop/prior_box_clustered.cpp similarity index 100% rename from ngraph/test/type_prop/prior_box_clustered.cpp rename to src/core/tests/type_prop/prior_box_clustered.cpp diff --git a/ngraph/test/type_prop/proposal.cpp b/src/core/tests/type_prop/proposal.cpp similarity index 100% rename from ngraph/test/type_prop/proposal.cpp rename to src/core/tests/type_prop/proposal.cpp diff --git a/ngraph/test/type_prop/psroi_pooling.cpp b/src/core/tests/type_prop/psroi_pooling.cpp similarity index 100% rename from ngraph/test/type_prop/psroi_pooling.cpp rename to src/core/tests/type_prop/psroi_pooling.cpp diff --git a/ngraph/test/type_prop/random_uniform.cpp b/src/core/tests/type_prop/random_uniform.cpp similarity index 100% rename from ngraph/test/type_prop/random_uniform.cpp rename to src/core/tests/type_prop/random_uniform.cpp diff --git a/ngraph/test/type_prop/range.cpp b/src/core/tests/type_prop/range.cpp similarity index 100% rename from ngraph/test/type_prop/range.cpp rename to src/core/tests/type_prop/range.cpp diff --git a/ngraph/test/type_prop/read_value.cpp b/src/core/tests/type_prop/read_value.cpp similarity index 100% rename from ngraph/test/type_prop/read_value.cpp rename to src/core/tests/type_prop/read_value.cpp diff --git a/ngraph/test/type_prop/reduce_l1.cpp b/src/core/tests/type_prop/reduce_l1.cpp similarity index 100% rename from ngraph/test/type_prop/reduce_l1.cpp rename to src/core/tests/type_prop/reduce_l1.cpp diff --git a/ngraph/test/type_prop/reduce_l2.cpp b/src/core/tests/type_prop/reduce_l2.cpp similarity index 100% rename from ngraph/test/type_prop/reduce_l2.cpp rename to src/core/tests/type_prop/reduce_l2.cpp diff --git a/ngraph/test/type_prop/reduce_logical_and.cpp b/src/core/tests/type_prop/reduce_logical_and.cpp similarity index 100% rename from ngraph/test/type_prop/reduce_logical_and.cpp rename to src/core/tests/type_prop/reduce_logical_and.cpp diff --git a/ngraph/test/type_prop/reduce_logical_or.cpp b/src/core/tests/type_prop/reduce_logical_or.cpp similarity index 100% rename from ngraph/test/type_prop/reduce_logical_or.cpp rename to src/core/tests/type_prop/reduce_logical_or.cpp diff --git a/ngraph/test/type_prop/reduce_max.cpp b/src/core/tests/type_prop/reduce_max.cpp similarity index 100% rename from ngraph/test/type_prop/reduce_max.cpp rename to src/core/tests/type_prop/reduce_max.cpp diff --git a/ngraph/test/type_prop/reduce_mean.cpp b/src/core/tests/type_prop/reduce_mean.cpp similarity index 100% rename from ngraph/test/type_prop/reduce_mean.cpp rename to src/core/tests/type_prop/reduce_mean.cpp diff --git a/ngraph/test/type_prop/reduce_min.cpp b/src/core/tests/type_prop/reduce_min.cpp similarity index 100% rename from ngraph/test/type_prop/reduce_min.cpp rename to src/core/tests/type_prop/reduce_min.cpp diff --git a/ngraph/test/type_prop/reduce_ops.hpp b/src/core/tests/type_prop/reduce_ops.hpp similarity index 100% rename from ngraph/test/type_prop/reduce_ops.hpp rename to src/core/tests/type_prop/reduce_ops.hpp diff --git a/ngraph/test/type_prop/reduce_prod.cpp b/src/core/tests/type_prop/reduce_prod.cpp similarity index 100% rename from ngraph/test/type_prop/reduce_prod.cpp rename to src/core/tests/type_prop/reduce_prod.cpp diff --git a/ngraph/test/type_prop/reduce_sum.cpp b/src/core/tests/type_prop/reduce_sum.cpp similarity index 100% rename from ngraph/test/type_prop/reduce_sum.cpp rename to src/core/tests/type_prop/reduce_sum.cpp diff --git a/ngraph/test/type_prop/relu.cpp b/src/core/tests/type_prop/relu.cpp similarity index 100% rename from ngraph/test/type_prop/relu.cpp rename to src/core/tests/type_prop/relu.cpp diff --git a/ngraph/test/type_prop/reorg_yolo.cpp b/src/core/tests/type_prop/reorg_yolo.cpp similarity index 100% rename from ngraph/test/type_prop/reorg_yolo.cpp rename to src/core/tests/type_prop/reorg_yolo.cpp diff --git a/ngraph/test/type_prop/reshape.cpp b/src/core/tests/type_prop/reshape.cpp similarity index 100% rename from ngraph/test/type_prop/reshape.cpp rename to src/core/tests/type_prop/reshape.cpp diff --git a/ngraph/test/type_prop/result.cpp b/src/core/tests/type_prop/result.cpp similarity index 100% rename from ngraph/test/type_prop/result.cpp rename to src/core/tests/type_prop/result.cpp diff --git a/ngraph/test/type_prop/reverse.cpp b/src/core/tests/type_prop/reverse.cpp similarity index 100% rename from ngraph/test/type_prop/reverse.cpp rename to src/core/tests/type_prop/reverse.cpp diff --git a/ngraph/test/type_prop/reverse_sequence.cpp b/src/core/tests/type_prop/reverse_sequence.cpp similarity index 100% rename from ngraph/test/type_prop/reverse_sequence.cpp rename to src/core/tests/type_prop/reverse_sequence.cpp diff --git a/ngraph/test/type_prop/rnn_cell.cpp b/src/core/tests/type_prop/rnn_cell.cpp similarity index 100% rename from ngraph/test/type_prop/rnn_cell.cpp rename to src/core/tests/type_prop/rnn_cell.cpp diff --git a/ngraph/test/type_prop/rnn_sequence.cpp b/src/core/tests/type_prop/rnn_sequence.cpp similarity index 100% rename from ngraph/test/type_prop/rnn_sequence.cpp rename to src/core/tests/type_prop/rnn_sequence.cpp diff --git a/ngraph/test/type_prop/roi_align.cpp b/src/core/tests/type_prop/roi_align.cpp similarity index 100% rename from ngraph/test/type_prop/roi_align.cpp rename to src/core/tests/type_prop/roi_align.cpp diff --git a/ngraph/test/type_prop/roi_pooling.cpp b/src/core/tests/type_prop/roi_pooling.cpp similarity index 100% rename from ngraph/test/type_prop/roi_pooling.cpp rename to src/core/tests/type_prop/roi_pooling.cpp diff --git a/ngraph/test/type_prop/roll.cpp b/src/core/tests/type_prop/roll.cpp similarity index 100% rename from ngraph/test/type_prop/roll.cpp rename to src/core/tests/type_prop/roll.cpp diff --git a/ngraph/test/type_prop/round.cpp b/src/core/tests/type_prop/round.cpp similarity index 100% rename from ngraph/test/type_prop/round.cpp rename to src/core/tests/type_prop/round.cpp diff --git a/ngraph/test/type_prop/scatter_elements_update.cpp b/src/core/tests/type_prop/scatter_elements_update.cpp similarity index 100% rename from ngraph/test/type_prop/scatter_elements_update.cpp rename to src/core/tests/type_prop/scatter_elements_update.cpp diff --git a/ngraph/test/type_prop/scatter_nd_update.cpp b/src/core/tests/type_prop/scatter_nd_update.cpp similarity index 100% rename from ngraph/test/type_prop/scatter_nd_update.cpp rename to src/core/tests/type_prop/scatter_nd_update.cpp diff --git a/ngraph/test/type_prop/scatter_update.cpp b/src/core/tests/type_prop/scatter_update.cpp similarity index 100% rename from ngraph/test/type_prop/scatter_update.cpp rename to src/core/tests/type_prop/scatter_update.cpp diff --git a/ngraph/test/type_prop/select.cpp b/src/core/tests/type_prop/select.cpp similarity index 100% rename from ngraph/test/type_prop/select.cpp rename to src/core/tests/type_prop/select.cpp diff --git a/ngraph/test/type_prop/selu.cpp b/src/core/tests/type_prop/selu.cpp similarity index 100% rename from ngraph/test/type_prop/selu.cpp rename to src/core/tests/type_prop/selu.cpp diff --git a/ngraph/test/type_prop/shape_of.cpp b/src/core/tests/type_prop/shape_of.cpp similarity index 100% rename from ngraph/test/type_prop/shape_of.cpp rename to src/core/tests/type_prop/shape_of.cpp diff --git a/ngraph/test/type_prop/shuffle_channels.cpp b/src/core/tests/type_prop/shuffle_channels.cpp similarity index 100% rename from ngraph/test/type_prop/shuffle_channels.cpp rename to src/core/tests/type_prop/shuffle_channels.cpp diff --git a/ngraph/test/type_prop/sigmoid.cpp b/src/core/tests/type_prop/sigmoid.cpp similarity index 100% rename from ngraph/test/type_prop/sigmoid.cpp rename to src/core/tests/type_prop/sigmoid.cpp diff --git a/ngraph/test/type_prop/sign.cpp b/src/core/tests/type_prop/sign.cpp similarity index 100% rename from ngraph/test/type_prop/sign.cpp rename to src/core/tests/type_prop/sign.cpp diff --git a/ngraph/test/type_prop/sin.cpp b/src/core/tests/type_prop/sin.cpp similarity index 100% rename from ngraph/test/type_prop/sin.cpp rename to src/core/tests/type_prop/sin.cpp diff --git a/ngraph/test/type_prop/sinh.cpp b/src/core/tests/type_prop/sinh.cpp similarity index 100% rename from ngraph/test/type_prop/sinh.cpp rename to src/core/tests/type_prop/sinh.cpp diff --git a/ngraph/test/type_prop/slice.cpp b/src/core/tests/type_prop/slice.cpp similarity index 100% rename from ngraph/test/type_prop/slice.cpp rename to src/core/tests/type_prop/slice.cpp diff --git a/ngraph/test/type_prop/softmax.cpp b/src/core/tests/type_prop/softmax.cpp similarity index 100% rename from ngraph/test/type_prop/softmax.cpp rename to src/core/tests/type_prop/softmax.cpp diff --git a/ngraph/test/type_prop/softplus.cpp b/src/core/tests/type_prop/softplus.cpp similarity index 100% rename from ngraph/test/type_prop/softplus.cpp rename to src/core/tests/type_prop/softplus.cpp diff --git a/ngraph/test/type_prop/space_to_batch.cpp b/src/core/tests/type_prop/space_to_batch.cpp similarity index 100% rename from ngraph/test/type_prop/space_to_batch.cpp rename to src/core/tests/type_prop/space_to_batch.cpp diff --git a/ngraph/test/type_prop/space_to_depth.cpp b/src/core/tests/type_prop/space_to_depth.cpp similarity index 100% rename from ngraph/test/type_prop/space_to_depth.cpp rename to src/core/tests/type_prop/space_to_depth.cpp diff --git a/ngraph/test/type_prop/split.cpp b/src/core/tests/type_prop/split.cpp similarity index 100% rename from ngraph/test/type_prop/split.cpp rename to src/core/tests/type_prop/split.cpp diff --git a/ngraph/test/type_prop/sqrt.cpp b/src/core/tests/type_prop/sqrt.cpp similarity index 100% rename from ngraph/test/type_prop/sqrt.cpp rename to src/core/tests/type_prop/sqrt.cpp diff --git a/ngraph/test/type_prop/squared_difference.cpp b/src/core/tests/type_prop/squared_difference.cpp similarity index 100% rename from ngraph/test/type_prop/squared_difference.cpp rename to src/core/tests/type_prop/squared_difference.cpp diff --git a/ngraph/test/type_prop/squeeze.cpp b/src/core/tests/type_prop/squeeze.cpp similarity index 100% rename from ngraph/test/type_prop/squeeze.cpp rename to src/core/tests/type_prop/squeeze.cpp diff --git a/ngraph/test/type_prop/strided_slice.cpp b/src/core/tests/type_prop/strided_slice.cpp similarity index 100% rename from ngraph/test/type_prop/strided_slice.cpp rename to src/core/tests/type_prop/strided_slice.cpp diff --git a/ngraph/test/type_prop/subtract.cpp b/src/core/tests/type_prop/subtract.cpp similarity index 100% rename from ngraph/test/type_prop/subtract.cpp rename to src/core/tests/type_prop/subtract.cpp diff --git a/ngraph/test/type_prop/swish.cpp b/src/core/tests/type_prop/swish.cpp similarity index 100% rename from ngraph/test/type_prop/swish.cpp rename to src/core/tests/type_prop/swish.cpp diff --git a/ngraph/test/type_prop/tan.cpp b/src/core/tests/type_prop/tan.cpp similarity index 100% rename from ngraph/test/type_prop/tan.cpp rename to src/core/tests/type_prop/tan.cpp diff --git a/ngraph/test/type_prop/tanh.cpp b/src/core/tests/type_prop/tanh.cpp similarity index 100% rename from ngraph/test/type_prop/tanh.cpp rename to src/core/tests/type_prop/tanh.cpp diff --git a/ngraph/test/type_prop/ti.cpp b/src/core/tests/type_prop/ti.cpp similarity index 100% rename from ngraph/test/type_prop/ti.cpp rename to src/core/tests/type_prop/ti.cpp diff --git a/ngraph/test/type_prop/tile.cpp b/src/core/tests/type_prop/tile.cpp similarity index 100% rename from ngraph/test/type_prop/tile.cpp rename to src/core/tests/type_prop/tile.cpp diff --git a/ngraph/test/type_prop/top_k.cpp b/src/core/tests/type_prop/top_k.cpp similarity index 100% rename from ngraph/test/type_prop/top_k.cpp rename to src/core/tests/type_prop/top_k.cpp diff --git a/ngraph/test/type_prop/transpose.cpp b/src/core/tests/type_prop/transpose.cpp similarity index 100% rename from ngraph/test/type_prop/transpose.cpp rename to src/core/tests/type_prop/transpose.cpp diff --git a/ngraph/test/type_prop/unary_elementwise.cpp b/src/core/tests/type_prop/unary_elementwise.cpp similarity index 100% rename from ngraph/test/type_prop/unary_elementwise.cpp rename to src/core/tests/type_prop/unary_elementwise.cpp diff --git a/ngraph/test/type_prop/unary_ops.hpp b/src/core/tests/type_prop/unary_ops.hpp similarity index 100% rename from ngraph/test/type_prop/unary_ops.hpp rename to src/core/tests/type_prop/unary_ops.hpp diff --git a/ngraph/test/type_prop/unsqueeze.cpp b/src/core/tests/type_prop/unsqueeze.cpp similarity index 100% rename from ngraph/test/type_prop/unsqueeze.cpp rename to src/core/tests/type_prop/unsqueeze.cpp diff --git a/ngraph/test/type_prop/variadic_split.cpp b/src/core/tests/type_prop/variadic_split.cpp similarity index 100% rename from ngraph/test/type_prop/variadic_split.cpp rename to src/core/tests/type_prop/variadic_split.cpp diff --git a/ngraph/test/type_prop_layers.cpp b/src/core/tests/type_prop_layers.cpp similarity index 100% rename from ngraph/test/type_prop_layers.cpp rename to src/core/tests/type_prop_layers.cpp diff --git a/ngraph/test/uint4.cpp b/src/core/tests/uint4.cpp similarity index 100% rename from ngraph/test/uint4.cpp rename to src/core/tests/uint4.cpp diff --git a/ngraph/test/util.cpp b/src/core/tests/util.cpp similarity index 100% rename from ngraph/test/util.cpp rename to src/core/tests/util.cpp diff --git a/ngraph/test/util/CMakeLists.txt b/src/core/tests/util/CMakeLists.txt similarity index 85% rename from ngraph/test/util/CMakeLists.txt rename to src/core/tests/util/CMakeLists.txt index 70ec394bf5f..a43400183d0 100644 --- a/ngraph/test/util/CMakeLists.txt +++ b/src/core/tests/util/CMakeLists.txt @@ -14,7 +14,5 @@ target_include_directories(ngraph_test_util PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) file(GLOB_RECURSE all_util_src "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/*.hpp") add_clang_format_target(ngraph_test_util_clang FOR_SOURCES ${all_util_src}) -set_source_files_properties(${all_util_src} PROPERTIES INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/../../core/src/) - # developer package openvino_developer_export_targets(COMPONENT ngraph TARGETS ngraph_test_util) diff --git a/ngraph/test/util/all_close.cpp b/src/core/tests/util/all_close.cpp similarity index 100% rename from ngraph/test/util/all_close.cpp rename to src/core/tests/util/all_close.cpp diff --git a/ngraph/test/util/all_close.hpp b/src/core/tests/util/all_close.hpp similarity index 100% rename from ngraph/test/util/all_close.hpp rename to src/core/tests/util/all_close.hpp diff --git a/ngraph/test/util/all_close_f.cpp b/src/core/tests/util/all_close_f.cpp similarity index 100% rename from ngraph/test/util/all_close_f.cpp rename to src/core/tests/util/all_close_f.cpp diff --git a/ngraph/test/util/all_close_f.hpp b/src/core/tests/util/all_close_f.hpp similarity index 100% rename from ngraph/test/util/all_close_f.hpp rename to src/core/tests/util/all_close_f.hpp diff --git a/ngraph/test/util/float_util.cpp b/src/core/tests/util/float_util.cpp similarity index 100% rename from ngraph/test/util/float_util.cpp rename to src/core/tests/util/float_util.cpp diff --git a/ngraph/test/util/float_util.hpp b/src/core/tests/util/float_util.hpp similarity index 100% rename from ngraph/test/util/float_util.hpp rename to src/core/tests/util/float_util.hpp diff --git a/ngraph/test/util/graph_comparator.cpp b/src/core/tests/util/graph_comparator.cpp similarity index 100% rename from ngraph/test/util/graph_comparator.cpp rename to src/core/tests/util/graph_comparator.cpp diff --git a/ngraph/test/util/graph_comparator.hpp b/src/core/tests/util/graph_comparator.hpp similarity index 100% rename from ngraph/test/util/graph_comparator.hpp rename to src/core/tests/util/graph_comparator.hpp diff --git a/ngraph/test/util/matcher.hpp b/src/core/tests/util/matcher.hpp similarity index 100% rename from ngraph/test/util/matcher.hpp rename to src/core/tests/util/matcher.hpp diff --git a/ngraph/test/util/ndarray.hpp b/src/core/tests/util/ndarray.hpp similarity index 100% rename from ngraph/test/util/ndarray.hpp rename to src/core/tests/util/ndarray.hpp diff --git a/ngraph/test/util/test_common.cpp b/src/core/tests/util/test_common.cpp similarity index 100% rename from ngraph/test/util/test_common.cpp rename to src/core/tests/util/test_common.cpp diff --git a/ngraph/test/util/test_common.hpp b/src/core/tests/util/test_common.hpp similarity index 96% rename from ngraph/test/util/test_common.hpp rename to src/core/tests/util/test_common.hpp index f34cac6b61f..9e8514e307a 100644 --- a/ngraph/test/util/test_common.hpp +++ b/src/core/tests/util/test_common.hpp @@ -8,11 +8,13 @@ #include #include -#include #include #include namespace ov { + +class SharedRTInfo; + namespace test { class TestsCommon : virtual public ::testing::Test { diff --git a/ngraph/test/util/test_control.cpp b/src/core/tests/util/test_control.cpp similarity index 100% rename from ngraph/test/util/test_control.cpp rename to src/core/tests/util/test_control.cpp diff --git a/ngraph/test/util/test_control.hpp b/src/core/tests/util/test_control.hpp similarity index 100% rename from ngraph/test/util/test_control.hpp rename to src/core/tests/util/test_control.hpp diff --git a/ngraph/test/util/test_tools.hpp b/src/core/tests/util/test_tools.hpp similarity index 100% rename from ngraph/test/util/test_tools.hpp rename to src/core/tests/util/test_tools.hpp diff --git a/ngraph/test/util/type_prop.hpp b/src/core/tests/util/type_prop.hpp similarity index 100% rename from ngraph/test/util/type_prop.hpp rename to src/core/tests/util/type_prop.hpp diff --git a/ngraph/test/util/visitor.hpp b/src/core/tests/util/visitor.hpp similarity index 100% rename from ngraph/test/util/visitor.hpp rename to src/core/tests/util/visitor.hpp diff --git a/ngraph/test/visitors/op/acos.cpp b/src/core/tests/visitors/op/acos.cpp similarity index 100% rename from ngraph/test/visitors/op/acos.cpp rename to src/core/tests/visitors/op/acos.cpp diff --git a/ngraph/test/visitors/op/acosh.cpp b/src/core/tests/visitors/op/acosh.cpp similarity index 100% rename from ngraph/test/visitors/op/acosh.cpp rename to src/core/tests/visitors/op/acosh.cpp diff --git a/ngraph/test/visitors/op/adaptive_avg_pool.cpp b/src/core/tests/visitors/op/adaptive_avg_pool.cpp similarity index 100% rename from ngraph/test/visitors/op/adaptive_avg_pool.cpp rename to src/core/tests/visitors/op/adaptive_avg_pool.cpp diff --git a/ngraph/test/visitors/op/adaptive_max_pool.cpp b/src/core/tests/visitors/op/adaptive_max_pool.cpp similarity index 100% rename from ngraph/test/visitors/op/adaptive_max_pool.cpp rename to src/core/tests/visitors/op/adaptive_max_pool.cpp diff --git a/ngraph/test/visitors/op/add.cpp b/src/core/tests/visitors/op/add.cpp similarity index 100% rename from ngraph/test/visitors/op/add.cpp rename to src/core/tests/visitors/op/add.cpp diff --git a/ngraph/test/visitors/op/asin.cpp b/src/core/tests/visitors/op/asin.cpp similarity index 100% rename from ngraph/test/visitors/op/asin.cpp rename to src/core/tests/visitors/op/asin.cpp diff --git a/ngraph/test/visitors/op/asinh.cpp b/src/core/tests/visitors/op/asinh.cpp similarity index 100% rename from ngraph/test/visitors/op/asinh.cpp rename to src/core/tests/visitors/op/asinh.cpp diff --git a/ngraph/test/visitors/op/atan.cpp b/src/core/tests/visitors/op/atan.cpp similarity index 100% rename from ngraph/test/visitors/op/atan.cpp rename to src/core/tests/visitors/op/atan.cpp diff --git a/ngraph/test/visitors/op/atanh.cpp b/src/core/tests/visitors/op/atanh.cpp similarity index 100% rename from ngraph/test/visitors/op/atanh.cpp rename to src/core/tests/visitors/op/atanh.cpp diff --git a/ngraph/test/visitors/op/avg_pool.cpp b/src/core/tests/visitors/op/avg_pool.cpp similarity index 100% rename from ngraph/test/visitors/op/avg_pool.cpp rename to src/core/tests/visitors/op/avg_pool.cpp diff --git a/ngraph/test/visitors/op/batch_norm.cpp b/src/core/tests/visitors/op/batch_norm.cpp similarity index 100% rename from ngraph/test/visitors/op/batch_norm.cpp rename to src/core/tests/visitors/op/batch_norm.cpp diff --git a/ngraph/test/visitors/op/batch_to_space.cpp b/src/core/tests/visitors/op/batch_to_space.cpp similarity index 100% rename from ngraph/test/visitors/op/batch_to_space.cpp rename to src/core/tests/visitors/op/batch_to_space.cpp diff --git a/ngraph/test/visitors/op/binary_convolution.cpp b/src/core/tests/visitors/op/binary_convolution.cpp similarity index 100% rename from ngraph/test/visitors/op/binary_convolution.cpp rename to src/core/tests/visitors/op/binary_convolution.cpp diff --git a/ngraph/test/visitors/op/binary_ops.hpp b/src/core/tests/visitors/op/binary_ops.hpp similarity index 100% rename from ngraph/test/visitors/op/binary_ops.hpp rename to src/core/tests/visitors/op/binary_ops.hpp diff --git a/ngraph/test/visitors/op/broadcast.cpp b/src/core/tests/visitors/op/broadcast.cpp similarity index 100% rename from ngraph/test/visitors/op/broadcast.cpp rename to src/core/tests/visitors/op/broadcast.cpp diff --git a/ngraph/test/visitors/op/bucketize.cpp b/src/core/tests/visitors/op/bucketize.cpp similarity index 100% rename from ngraph/test/visitors/op/bucketize.cpp rename to src/core/tests/visitors/op/bucketize.cpp diff --git a/ngraph/test/visitors/op/ceiling.cpp b/src/core/tests/visitors/op/ceiling.cpp similarity index 100% rename from ngraph/test/visitors/op/ceiling.cpp rename to src/core/tests/visitors/op/ceiling.cpp diff --git a/ngraph/test/visitors/op/clamp.cpp b/src/core/tests/visitors/op/clamp.cpp similarity index 100% rename from ngraph/test/visitors/op/clamp.cpp rename to src/core/tests/visitors/op/clamp.cpp diff --git a/ngraph/test/visitors/op/constant.cpp b/src/core/tests/visitors/op/constant.cpp similarity index 100% rename from ngraph/test/visitors/op/constant.cpp rename to src/core/tests/visitors/op/constant.cpp diff --git a/ngraph/test/visitors/op/convert.cpp b/src/core/tests/visitors/op/convert.cpp similarity index 100% rename from ngraph/test/visitors/op/convert.cpp rename to src/core/tests/visitors/op/convert.cpp diff --git a/ngraph/test/visitors/op/convert_color_i420.cpp b/src/core/tests/visitors/op/convert_color_i420.cpp similarity index 100% rename from ngraph/test/visitors/op/convert_color_i420.cpp rename to src/core/tests/visitors/op/convert_color_i420.cpp diff --git a/ngraph/test/visitors/op/convert_color_nv12.cpp b/src/core/tests/visitors/op/convert_color_nv12.cpp similarity index 100% rename from ngraph/test/visitors/op/convert_color_nv12.cpp rename to src/core/tests/visitors/op/convert_color_nv12.cpp diff --git a/ngraph/test/visitors/op/convolution.cpp b/src/core/tests/visitors/op/convolution.cpp similarity index 100% rename from ngraph/test/visitors/op/convolution.cpp rename to src/core/tests/visitors/op/convolution.cpp diff --git a/ngraph/test/visitors/op/convolution_backprop.cpp b/src/core/tests/visitors/op/convolution_backprop.cpp similarity index 100% rename from ngraph/test/visitors/op/convolution_backprop.cpp rename to src/core/tests/visitors/op/convolution_backprop.cpp diff --git a/ngraph/test/visitors/op/cos.cpp b/src/core/tests/visitors/op/cos.cpp similarity index 100% rename from ngraph/test/visitors/op/cos.cpp rename to src/core/tests/visitors/op/cos.cpp diff --git a/ngraph/test/visitors/op/cosh.cpp b/src/core/tests/visitors/op/cosh.cpp similarity index 100% rename from ngraph/test/visitors/op/cosh.cpp rename to src/core/tests/visitors/op/cosh.cpp diff --git a/ngraph/test/visitors/op/ctc_greedy_decoder.cpp b/src/core/tests/visitors/op/ctc_greedy_decoder.cpp similarity index 100% rename from ngraph/test/visitors/op/ctc_greedy_decoder.cpp rename to src/core/tests/visitors/op/ctc_greedy_decoder.cpp diff --git a/ngraph/test/visitors/op/ctc_greedy_decoder_seq_len.cpp b/src/core/tests/visitors/op/ctc_greedy_decoder_seq_len.cpp similarity index 100% rename from ngraph/test/visitors/op/ctc_greedy_decoder_seq_len.cpp rename to src/core/tests/visitors/op/ctc_greedy_decoder_seq_len.cpp diff --git a/ngraph/test/visitors/op/ctc_loss.cpp b/src/core/tests/visitors/op/ctc_loss.cpp similarity index 100% rename from ngraph/test/visitors/op/ctc_loss.cpp rename to src/core/tests/visitors/op/ctc_loss.cpp diff --git a/ngraph/test/visitors/op/cum_sum.cpp b/src/core/tests/visitors/op/cum_sum.cpp similarity index 100% rename from ngraph/test/visitors/op/cum_sum.cpp rename to src/core/tests/visitors/op/cum_sum.cpp diff --git a/ngraph/test/visitors/op/deformable_convolution.cpp b/src/core/tests/visitors/op/deformable_convolution.cpp similarity index 100% rename from ngraph/test/visitors/op/deformable_convolution.cpp rename to src/core/tests/visitors/op/deformable_convolution.cpp diff --git a/ngraph/test/visitors/op/deformable_psroi_pooling.cpp b/src/core/tests/visitors/op/deformable_psroi_pooling.cpp similarity index 100% rename from ngraph/test/visitors/op/deformable_psroi_pooling.cpp rename to src/core/tests/visitors/op/deformable_psroi_pooling.cpp diff --git a/ngraph/test/visitors/op/depth_to_space.cpp b/src/core/tests/visitors/op/depth_to_space.cpp similarity index 100% rename from ngraph/test/visitors/op/depth_to_space.cpp rename to src/core/tests/visitors/op/depth_to_space.cpp diff --git a/ngraph/test/visitors/op/detection_output.cpp b/src/core/tests/visitors/op/detection_output.cpp similarity index 100% rename from ngraph/test/visitors/op/detection_output.cpp rename to src/core/tests/visitors/op/detection_output.cpp diff --git a/ngraph/test/visitors/op/dft.cpp b/src/core/tests/visitors/op/dft.cpp similarity index 100% rename from ngraph/test/visitors/op/dft.cpp rename to src/core/tests/visitors/op/dft.cpp diff --git a/ngraph/test/visitors/op/divide.cpp b/src/core/tests/visitors/op/divide.cpp similarity index 100% rename from ngraph/test/visitors/op/divide.cpp rename to src/core/tests/visitors/op/divide.cpp diff --git a/ngraph/test/visitors/op/einsum.cpp b/src/core/tests/visitors/op/einsum.cpp similarity index 100% rename from ngraph/test/visitors/op/einsum.cpp rename to src/core/tests/visitors/op/einsum.cpp diff --git a/ngraph/test/visitors/op/elu.cpp b/src/core/tests/visitors/op/elu.cpp similarity index 100% rename from ngraph/test/visitors/op/elu.cpp rename to src/core/tests/visitors/op/elu.cpp diff --git a/ngraph/test/visitors/op/embedding_segments_sum.cpp b/src/core/tests/visitors/op/embedding_segments_sum.cpp similarity index 100% rename from ngraph/test/visitors/op/embedding_segments_sum.cpp rename to src/core/tests/visitors/op/embedding_segments_sum.cpp diff --git a/ngraph/test/visitors/op/embeddingbag_offsetssum.cpp b/src/core/tests/visitors/op/embeddingbag_offsetssum.cpp similarity index 100% rename from ngraph/test/visitors/op/embeddingbag_offsetssum.cpp rename to src/core/tests/visitors/op/embeddingbag_offsetssum.cpp diff --git a/ngraph/test/visitors/op/embeddingbag_packedsum.cpp b/src/core/tests/visitors/op/embeddingbag_packedsum.cpp similarity index 100% rename from ngraph/test/visitors/op/embeddingbag_packedsum.cpp rename to src/core/tests/visitors/op/embeddingbag_packedsum.cpp diff --git a/ngraph/test/visitors/op/equal.cpp b/src/core/tests/visitors/op/equal.cpp similarity index 100% rename from ngraph/test/visitors/op/equal.cpp rename to src/core/tests/visitors/op/equal.cpp diff --git a/ngraph/test/visitors/op/erf.cpp b/src/core/tests/visitors/op/erf.cpp similarity index 100% rename from ngraph/test/visitors/op/erf.cpp rename to src/core/tests/visitors/op/erf.cpp diff --git a/ngraph/test/visitors/op/exp.cpp b/src/core/tests/visitors/op/exp.cpp similarity index 100% rename from ngraph/test/visitors/op/exp.cpp rename to src/core/tests/visitors/op/exp.cpp diff --git a/ngraph/test/visitors/op/experimental_detectron_detection_output.cpp b/src/core/tests/visitors/op/experimental_detectron_detection_output.cpp similarity index 100% rename from ngraph/test/visitors/op/experimental_detectron_detection_output.cpp rename to src/core/tests/visitors/op/experimental_detectron_detection_output.cpp diff --git a/ngraph/test/visitors/op/experimental_detectron_generate_proposals.cpp b/src/core/tests/visitors/op/experimental_detectron_generate_proposals.cpp similarity index 100% rename from ngraph/test/visitors/op/experimental_detectron_generate_proposals.cpp rename to src/core/tests/visitors/op/experimental_detectron_generate_proposals.cpp diff --git a/ngraph/test/visitors/op/experimental_detectron_topkrois.cpp b/src/core/tests/visitors/op/experimental_detectron_topkrois.cpp similarity index 100% rename from ngraph/test/visitors/op/experimental_detectron_topkrois.cpp rename to src/core/tests/visitors/op/experimental_detectron_topkrois.cpp diff --git a/ngraph/test/visitors/op/extractimagepatches.cpp b/src/core/tests/visitors/op/extractimagepatches.cpp similarity index 100% rename from ngraph/test/visitors/op/extractimagepatches.cpp rename to src/core/tests/visitors/op/extractimagepatches.cpp diff --git a/ngraph/test/visitors/op/fake_quantize.cpp b/src/core/tests/visitors/op/fake_quantize.cpp similarity index 100% rename from ngraph/test/visitors/op/fake_quantize.cpp rename to src/core/tests/visitors/op/fake_quantize.cpp diff --git a/ngraph/test/visitors/op/floor.cpp b/src/core/tests/visitors/op/floor.cpp similarity index 100% rename from ngraph/test/visitors/op/floor.cpp rename to src/core/tests/visitors/op/floor.cpp diff --git a/ngraph/test/visitors/op/floor_mod.cpp b/src/core/tests/visitors/op/floor_mod.cpp similarity index 100% rename from ngraph/test/visitors/op/floor_mod.cpp rename to src/core/tests/visitors/op/floor_mod.cpp diff --git a/ngraph/test/visitors/op/gather.cpp b/src/core/tests/visitors/op/gather.cpp similarity index 100% rename from ngraph/test/visitors/op/gather.cpp rename to src/core/tests/visitors/op/gather.cpp diff --git a/ngraph/test/visitors/op/gather_elements.cpp b/src/core/tests/visitors/op/gather_elements.cpp similarity index 100% rename from ngraph/test/visitors/op/gather_elements.cpp rename to src/core/tests/visitors/op/gather_elements.cpp diff --git a/ngraph/test/visitors/op/gather_nd.cpp b/src/core/tests/visitors/op/gather_nd.cpp similarity index 100% rename from ngraph/test/visitors/op/gather_nd.cpp rename to src/core/tests/visitors/op/gather_nd.cpp diff --git a/ngraph/test/visitors/op/gather_tree.cpp b/src/core/tests/visitors/op/gather_tree.cpp similarity index 100% rename from ngraph/test/visitors/op/gather_tree.cpp rename to src/core/tests/visitors/op/gather_tree.cpp diff --git a/ngraph/test/visitors/op/gelu.cpp b/src/core/tests/visitors/op/gelu.cpp similarity index 100% rename from ngraph/test/visitors/op/gelu.cpp rename to src/core/tests/visitors/op/gelu.cpp diff --git a/ngraph/test/visitors/op/greater.cpp b/src/core/tests/visitors/op/greater.cpp similarity index 100% rename from ngraph/test/visitors/op/greater.cpp rename to src/core/tests/visitors/op/greater.cpp diff --git a/ngraph/test/visitors/op/greater_equal.cpp b/src/core/tests/visitors/op/greater_equal.cpp similarity index 100% rename from ngraph/test/visitors/op/greater_equal.cpp rename to src/core/tests/visitors/op/greater_equal.cpp diff --git a/ngraph/test/visitors/op/grn.cpp b/src/core/tests/visitors/op/grn.cpp similarity index 100% rename from ngraph/test/visitors/op/grn.cpp rename to src/core/tests/visitors/op/grn.cpp diff --git a/ngraph/test/visitors/op/group_conv.cpp b/src/core/tests/visitors/op/group_conv.cpp similarity index 100% rename from ngraph/test/visitors/op/group_conv.cpp rename to src/core/tests/visitors/op/group_conv.cpp diff --git a/ngraph/test/visitors/op/gru_cell.cpp b/src/core/tests/visitors/op/gru_cell.cpp similarity index 100% rename from ngraph/test/visitors/op/gru_cell.cpp rename to src/core/tests/visitors/op/gru_cell.cpp diff --git a/ngraph/test/visitors/op/gru_sequence.cpp b/src/core/tests/visitors/op/gru_sequence.cpp similarity index 100% rename from ngraph/test/visitors/op/gru_sequence.cpp rename to src/core/tests/visitors/op/gru_sequence.cpp diff --git a/ngraph/test/visitors/op/hard_sigmoid.cpp b/src/core/tests/visitors/op/hard_sigmoid.cpp similarity index 100% rename from ngraph/test/visitors/op/hard_sigmoid.cpp rename to src/core/tests/visitors/op/hard_sigmoid.cpp diff --git a/ngraph/test/visitors/op/hsigmoid.cpp b/src/core/tests/visitors/op/hsigmoid.cpp similarity index 100% rename from ngraph/test/visitors/op/hsigmoid.cpp rename to src/core/tests/visitors/op/hsigmoid.cpp diff --git a/ngraph/test/visitors/op/hswish.cpp b/src/core/tests/visitors/op/hswish.cpp similarity index 100% rename from ngraph/test/visitors/op/hswish.cpp rename to src/core/tests/visitors/op/hswish.cpp diff --git a/ngraph/test/visitors/op/idft.cpp b/src/core/tests/visitors/op/idft.cpp similarity index 100% rename from ngraph/test/visitors/op/idft.cpp rename to src/core/tests/visitors/op/idft.cpp diff --git a/ngraph/test/visitors/op/if.cpp b/src/core/tests/visitors/op/if.cpp similarity index 100% rename from ngraph/test/visitors/op/if.cpp rename to src/core/tests/visitors/op/if.cpp diff --git a/ngraph/test/visitors/op/interpolate.cpp b/src/core/tests/visitors/op/interpolate.cpp similarity index 100% rename from ngraph/test/visitors/op/interpolate.cpp rename to src/core/tests/visitors/op/interpolate.cpp diff --git a/ngraph/test/visitors/op/less.cpp b/src/core/tests/visitors/op/less.cpp similarity index 100% rename from ngraph/test/visitors/op/less.cpp rename to src/core/tests/visitors/op/less.cpp diff --git a/ngraph/test/visitors/op/less_equal.cpp b/src/core/tests/visitors/op/less_equal.cpp similarity index 100% rename from ngraph/test/visitors/op/less_equal.cpp rename to src/core/tests/visitors/op/less_equal.cpp diff --git a/ngraph/test/visitors/op/log.cpp b/src/core/tests/visitors/op/log.cpp similarity index 100% rename from ngraph/test/visitors/op/log.cpp rename to src/core/tests/visitors/op/log.cpp diff --git a/ngraph/test/visitors/op/log_softmax.cpp b/src/core/tests/visitors/op/log_softmax.cpp similarity index 100% rename from ngraph/test/visitors/op/log_softmax.cpp rename to src/core/tests/visitors/op/log_softmax.cpp diff --git a/ngraph/test/visitors/op/logical_and.cpp b/src/core/tests/visitors/op/logical_and.cpp similarity index 100% rename from ngraph/test/visitors/op/logical_and.cpp rename to src/core/tests/visitors/op/logical_and.cpp diff --git a/ngraph/test/visitors/op/logical_not.cpp b/src/core/tests/visitors/op/logical_not.cpp similarity index 100% rename from ngraph/test/visitors/op/logical_not.cpp rename to src/core/tests/visitors/op/logical_not.cpp diff --git a/ngraph/test/visitors/op/logical_or.cpp b/src/core/tests/visitors/op/logical_or.cpp similarity index 100% rename from ngraph/test/visitors/op/logical_or.cpp rename to src/core/tests/visitors/op/logical_or.cpp diff --git a/ngraph/test/visitors/op/logical_xor.cpp b/src/core/tests/visitors/op/logical_xor.cpp similarity index 100% rename from ngraph/test/visitors/op/logical_xor.cpp rename to src/core/tests/visitors/op/logical_xor.cpp diff --git a/ngraph/test/visitors/op/lrn.cpp b/src/core/tests/visitors/op/lrn.cpp similarity index 100% rename from ngraph/test/visitors/op/lrn.cpp rename to src/core/tests/visitors/op/lrn.cpp diff --git a/ngraph/test/visitors/op/lstm_cell.cpp b/src/core/tests/visitors/op/lstm_cell.cpp similarity index 100% rename from ngraph/test/visitors/op/lstm_cell.cpp rename to src/core/tests/visitors/op/lstm_cell.cpp diff --git a/ngraph/test/visitors/op/lstm_sequence.cpp b/src/core/tests/visitors/op/lstm_sequence.cpp similarity index 100% rename from ngraph/test/visitors/op/lstm_sequence.cpp rename to src/core/tests/visitors/op/lstm_sequence.cpp diff --git a/ngraph/test/visitors/op/matmul.cpp b/src/core/tests/visitors/op/matmul.cpp similarity index 100% rename from ngraph/test/visitors/op/matmul.cpp rename to src/core/tests/visitors/op/matmul.cpp diff --git a/ngraph/test/visitors/op/matrix_nms.cpp b/src/core/tests/visitors/op/matrix_nms.cpp similarity index 100% rename from ngraph/test/visitors/op/matrix_nms.cpp rename to src/core/tests/visitors/op/matrix_nms.cpp diff --git a/ngraph/test/visitors/op/max_pool.cpp b/src/core/tests/visitors/op/max_pool.cpp similarity index 100% rename from ngraph/test/visitors/op/max_pool.cpp rename to src/core/tests/visitors/op/max_pool.cpp diff --git a/ngraph/test/visitors/op/maximum.cpp b/src/core/tests/visitors/op/maximum.cpp similarity index 100% rename from ngraph/test/visitors/op/maximum.cpp rename to src/core/tests/visitors/op/maximum.cpp diff --git a/ngraph/test/visitors/op/minimum.cpp b/src/core/tests/visitors/op/minimum.cpp similarity index 100% rename from ngraph/test/visitors/op/minimum.cpp rename to src/core/tests/visitors/op/minimum.cpp diff --git a/ngraph/test/visitors/op/mish.cpp b/src/core/tests/visitors/op/mish.cpp similarity index 100% rename from ngraph/test/visitors/op/mish.cpp rename to src/core/tests/visitors/op/mish.cpp diff --git a/ngraph/test/visitors/op/mod.cpp b/src/core/tests/visitors/op/mod.cpp similarity index 100% rename from ngraph/test/visitors/op/mod.cpp rename to src/core/tests/visitors/op/mod.cpp diff --git a/ngraph/test/visitors/op/multiclass_nms.cpp b/src/core/tests/visitors/op/multiclass_nms.cpp similarity index 100% rename from ngraph/test/visitors/op/multiclass_nms.cpp rename to src/core/tests/visitors/op/multiclass_nms.cpp diff --git a/ngraph/test/visitors/op/multiply.cpp b/src/core/tests/visitors/op/multiply.cpp similarity index 100% rename from ngraph/test/visitors/op/multiply.cpp rename to src/core/tests/visitors/op/multiply.cpp diff --git a/ngraph/test/visitors/op/mvn.cpp b/src/core/tests/visitors/op/mvn.cpp similarity index 100% rename from ngraph/test/visitors/op/mvn.cpp rename to src/core/tests/visitors/op/mvn.cpp diff --git a/ngraph/test/visitors/op/negative.cpp b/src/core/tests/visitors/op/negative.cpp similarity index 100% rename from ngraph/test/visitors/op/negative.cpp rename to src/core/tests/visitors/op/negative.cpp diff --git a/ngraph/test/visitors/op/non_max_suppression.cpp b/src/core/tests/visitors/op/non_max_suppression.cpp similarity index 100% rename from ngraph/test/visitors/op/non_max_suppression.cpp rename to src/core/tests/visitors/op/non_max_suppression.cpp diff --git a/ngraph/test/visitors/op/non_zero.cpp b/src/core/tests/visitors/op/non_zero.cpp similarity index 100% rename from ngraph/test/visitors/op/non_zero.cpp rename to src/core/tests/visitors/op/non_zero.cpp diff --git a/ngraph/test/visitors/op/normalize_l2.cpp b/src/core/tests/visitors/op/normalize_l2.cpp similarity index 100% rename from ngraph/test/visitors/op/normalize_l2.cpp rename to src/core/tests/visitors/op/normalize_l2.cpp diff --git a/ngraph/test/visitors/op/not_equal.cpp b/src/core/tests/visitors/op/not_equal.cpp similarity index 100% rename from ngraph/test/visitors/op/not_equal.cpp rename to src/core/tests/visitors/op/not_equal.cpp diff --git a/ngraph/test/visitors/op/one_hot.cpp b/src/core/tests/visitors/op/one_hot.cpp similarity index 100% rename from ngraph/test/visitors/op/one_hot.cpp rename to src/core/tests/visitors/op/one_hot.cpp diff --git a/ngraph/test/visitors/op/pad.cpp b/src/core/tests/visitors/op/pad.cpp similarity index 100% rename from ngraph/test/visitors/op/pad.cpp rename to src/core/tests/visitors/op/pad.cpp diff --git a/ngraph/test/visitors/op/parameter.cpp b/src/core/tests/visitors/op/parameter.cpp similarity index 100% rename from ngraph/test/visitors/op/parameter.cpp rename to src/core/tests/visitors/op/parameter.cpp diff --git a/ngraph/test/visitors/op/power.cpp b/src/core/tests/visitors/op/power.cpp similarity index 100% rename from ngraph/test/visitors/op/power.cpp rename to src/core/tests/visitors/op/power.cpp diff --git a/ngraph/test/visitors/op/prelu.cpp b/src/core/tests/visitors/op/prelu.cpp similarity index 100% rename from ngraph/test/visitors/op/prelu.cpp rename to src/core/tests/visitors/op/prelu.cpp diff --git a/ngraph/test/visitors/op/prior_box.cpp b/src/core/tests/visitors/op/prior_box.cpp similarity index 52% rename from ngraph/test/visitors/op/prior_box.cpp rename to src/core/tests/visitors/op/prior_box.cpp index 7ff922c62ce..26f5000fc55 100644 --- a/ngraph/test/visitors/op/prior_box.cpp +++ b/src/core/tests/visitors/op/prior_box.cpp @@ -9,6 +9,7 @@ #include "ngraph/opsets/opset3.hpp" #include "ngraph/opsets/opset4.hpp" #include "ngraph/opsets/opset5.hpp" +#include "ngraph/opsets/opset8.hpp" #include "util/visitor.hpp" using namespace std; @@ -21,7 +22,7 @@ TEST(attributes, prior_box_op) { const auto layer_shape = make_shared(element::i64, Shape{128, 128}); const auto image_shape = make_shared(element::i64, Shape{32, 32}); - op::PriorBoxAttrs attrs; + op::v0::PriorBox::Attributes attrs; attrs.min_size = vector{16.f, 32.f}; attrs.max_size = vector{256.f, 512.f}; attrs.aspect_ratio = vector{0.66f, 1.56f}; @@ -57,3 +58,47 @@ TEST(attributes, prior_box_op) { EXPECT_EQ(g_prior_box_attrs.variance, prior_box_attrs.variance); EXPECT_EQ(g_prior_box_attrs.scale_all_sizes, prior_box_attrs.scale_all_sizes); } + +TEST(attributes, prior_box_v8_op) { + NodeBuilder::get_ops().register_factory(); + const auto layer_shape = make_shared(element::i64, Shape{128, 128}); + const auto image_shape = make_shared(element::i64, Shape{32, 32}); + + op::v8::PriorBox::Attributes attrs; + attrs.min_size = vector{16.f, 32.f}; + attrs.max_size = vector{256.f, 512.f}; + attrs.aspect_ratio = vector{0.66f, 1.56f}; + attrs.density = vector{0.55f}; + attrs.fixed_ratio = vector{0.88f}; + attrs.fixed_size = vector{1.25f}; + attrs.clip = true; + attrs.flip = false; + attrs.step = 1.0f; + attrs.offset = 0.0f; + attrs.variance = vector{2.22f, 3.14f}; + attrs.scale_all_sizes = true; + attrs.min_max_aspect_ratios_order = false; + + auto prior_box = make_shared(layer_shape, image_shape, attrs); + NodeBuilder builder(prior_box); + auto g_prior_box = ov::as_type_ptr(builder.create()); + + const auto prior_box_attrs = prior_box->get_attrs(); + const auto g_prior_box_attrs = g_prior_box->get_attrs(); + + const auto expected_attr_count = 13; + EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); + EXPECT_EQ(g_prior_box_attrs.min_size, prior_box_attrs.min_size); + EXPECT_EQ(g_prior_box_attrs.max_size, prior_box_attrs.max_size); + EXPECT_EQ(g_prior_box_attrs.aspect_ratio, prior_box_attrs.aspect_ratio); + EXPECT_EQ(g_prior_box_attrs.density, prior_box_attrs.density); + EXPECT_EQ(g_prior_box_attrs.fixed_ratio, prior_box_attrs.fixed_ratio); + EXPECT_EQ(g_prior_box_attrs.fixed_size, prior_box_attrs.fixed_size); + EXPECT_EQ(g_prior_box_attrs.clip, prior_box_attrs.clip); + EXPECT_EQ(g_prior_box_attrs.flip, prior_box_attrs.flip); + EXPECT_EQ(g_prior_box_attrs.step, prior_box_attrs.step); + EXPECT_EQ(g_prior_box_attrs.offset, prior_box_attrs.offset); + EXPECT_EQ(g_prior_box_attrs.variance, prior_box_attrs.variance); + EXPECT_EQ(g_prior_box_attrs.scale_all_sizes, prior_box_attrs.scale_all_sizes); + EXPECT_EQ(g_prior_box_attrs.min_max_aspect_ratios_order, prior_box_attrs.min_max_aspect_ratios_order); +} diff --git a/ngraph/test/visitors/op/prior_box_clustered.cpp b/src/core/tests/visitors/op/prior_box_clustered.cpp similarity index 100% rename from ngraph/test/visitors/op/prior_box_clustered.cpp rename to src/core/tests/visitors/op/prior_box_clustered.cpp diff --git a/ngraph/test/visitors/op/proposal.cpp b/src/core/tests/visitors/op/proposal.cpp similarity index 100% rename from ngraph/test/visitors/op/proposal.cpp rename to src/core/tests/visitors/op/proposal.cpp diff --git a/ngraph/test/visitors/op/psroi_pooling.cpp b/src/core/tests/visitors/op/psroi_pooling.cpp similarity index 100% rename from ngraph/test/visitors/op/psroi_pooling.cpp rename to src/core/tests/visitors/op/psroi_pooling.cpp diff --git a/ngraph/test/visitors/op/random_uniform.cpp b/src/core/tests/visitors/op/random_uniform.cpp similarity index 100% rename from ngraph/test/visitors/op/random_uniform.cpp rename to src/core/tests/visitors/op/random_uniform.cpp diff --git a/ngraph/test/visitors/op/reduce_l1.cpp b/src/core/tests/visitors/op/reduce_l1.cpp similarity index 100% rename from ngraph/test/visitors/op/reduce_l1.cpp rename to src/core/tests/visitors/op/reduce_l1.cpp diff --git a/ngraph/test/visitors/op/reduce_l2.cpp b/src/core/tests/visitors/op/reduce_l2.cpp similarity index 100% rename from ngraph/test/visitors/op/reduce_l2.cpp rename to src/core/tests/visitors/op/reduce_l2.cpp diff --git a/ngraph/test/visitors/op/reduce_logical_and.cpp b/src/core/tests/visitors/op/reduce_logical_and.cpp similarity index 100% rename from ngraph/test/visitors/op/reduce_logical_and.cpp rename to src/core/tests/visitors/op/reduce_logical_and.cpp diff --git a/ngraph/test/visitors/op/reduce_logical_or.cpp b/src/core/tests/visitors/op/reduce_logical_or.cpp similarity index 100% rename from ngraph/test/visitors/op/reduce_logical_or.cpp rename to src/core/tests/visitors/op/reduce_logical_or.cpp diff --git a/ngraph/test/visitors/op/reduce_max.cpp b/src/core/tests/visitors/op/reduce_max.cpp similarity index 100% rename from ngraph/test/visitors/op/reduce_max.cpp rename to src/core/tests/visitors/op/reduce_max.cpp diff --git a/ngraph/test/visitors/op/reduce_mean.cpp b/src/core/tests/visitors/op/reduce_mean.cpp similarity index 100% rename from ngraph/test/visitors/op/reduce_mean.cpp rename to src/core/tests/visitors/op/reduce_mean.cpp diff --git a/ngraph/test/visitors/op/reduce_min.cpp b/src/core/tests/visitors/op/reduce_min.cpp similarity index 100% rename from ngraph/test/visitors/op/reduce_min.cpp rename to src/core/tests/visitors/op/reduce_min.cpp diff --git a/ngraph/test/visitors/op/reduce_ops.hpp b/src/core/tests/visitors/op/reduce_ops.hpp similarity index 100% rename from ngraph/test/visitors/op/reduce_ops.hpp rename to src/core/tests/visitors/op/reduce_ops.hpp diff --git a/ngraph/test/visitors/op/reduce_prod.cpp b/src/core/tests/visitors/op/reduce_prod.cpp similarity index 100% rename from ngraph/test/visitors/op/reduce_prod.cpp rename to src/core/tests/visitors/op/reduce_prod.cpp diff --git a/ngraph/test/visitors/op/reduce_sum.cpp b/src/core/tests/visitors/op/reduce_sum.cpp similarity index 100% rename from ngraph/test/visitors/op/reduce_sum.cpp rename to src/core/tests/visitors/op/reduce_sum.cpp diff --git a/ngraph/test/visitors/op/region_yolo.cpp b/src/core/tests/visitors/op/region_yolo.cpp similarity index 100% rename from ngraph/test/visitors/op/region_yolo.cpp rename to src/core/tests/visitors/op/region_yolo.cpp diff --git a/ngraph/test/visitors/op/relu.cpp b/src/core/tests/visitors/op/relu.cpp similarity index 100% rename from ngraph/test/visitors/op/relu.cpp rename to src/core/tests/visitors/op/relu.cpp diff --git a/ngraph/test/visitors/op/reorg_yolo.cpp b/src/core/tests/visitors/op/reorg_yolo.cpp similarity index 100% rename from ngraph/test/visitors/op/reorg_yolo.cpp rename to src/core/tests/visitors/op/reorg_yolo.cpp diff --git a/ngraph/test/visitors/op/reshape.cpp b/src/core/tests/visitors/op/reshape.cpp similarity index 100% rename from ngraph/test/visitors/op/reshape.cpp rename to src/core/tests/visitors/op/reshape.cpp diff --git a/ngraph/test/visitors/op/result.cpp b/src/core/tests/visitors/op/result.cpp similarity index 100% rename from ngraph/test/visitors/op/result.cpp rename to src/core/tests/visitors/op/result.cpp diff --git a/ngraph/test/visitors/op/reverse.cpp b/src/core/tests/visitors/op/reverse.cpp similarity index 100% rename from ngraph/test/visitors/op/reverse.cpp rename to src/core/tests/visitors/op/reverse.cpp diff --git a/ngraph/test/visitors/op/reverse_sequence.cpp b/src/core/tests/visitors/op/reverse_sequence.cpp similarity index 100% rename from ngraph/test/visitors/op/reverse_sequence.cpp rename to src/core/tests/visitors/op/reverse_sequence.cpp diff --git a/ngraph/test/visitors/op/rnn_cell.cpp b/src/core/tests/visitors/op/rnn_cell.cpp similarity index 100% rename from ngraph/test/visitors/op/rnn_cell.cpp rename to src/core/tests/visitors/op/rnn_cell.cpp diff --git a/ngraph/test/visitors/op/rnn_sequence.cpp b/src/core/tests/visitors/op/rnn_sequence.cpp similarity index 100% rename from ngraph/test/visitors/op/rnn_sequence.cpp rename to src/core/tests/visitors/op/rnn_sequence.cpp diff --git a/ngraph/test/visitors/op/roi_pooling.cpp b/src/core/tests/visitors/op/roi_pooling.cpp similarity index 100% rename from ngraph/test/visitors/op/roi_pooling.cpp rename to src/core/tests/visitors/op/roi_pooling.cpp diff --git a/ngraph/test/visitors/op/roll.cpp b/src/core/tests/visitors/op/roll.cpp similarity index 100% rename from ngraph/test/visitors/op/roll.cpp rename to src/core/tests/visitors/op/roll.cpp diff --git a/ngraph/test/visitors/op/round.cpp b/src/core/tests/visitors/op/round.cpp similarity index 100% rename from ngraph/test/visitors/op/round.cpp rename to src/core/tests/visitors/op/round.cpp diff --git a/ngraph/test/visitors/op/scatter_elements_update.cpp b/src/core/tests/visitors/op/scatter_elements_update.cpp similarity index 100% rename from ngraph/test/visitors/op/scatter_elements_update.cpp rename to src/core/tests/visitors/op/scatter_elements_update.cpp diff --git a/ngraph/test/visitors/op/scatter_update.cpp b/src/core/tests/visitors/op/scatter_update.cpp similarity index 100% rename from ngraph/test/visitors/op/scatter_update.cpp rename to src/core/tests/visitors/op/scatter_update.cpp diff --git a/ngraph/test/visitors/op/select.cpp b/src/core/tests/visitors/op/select.cpp similarity index 100% rename from ngraph/test/visitors/op/select.cpp rename to src/core/tests/visitors/op/select.cpp diff --git a/ngraph/test/visitors/op/selu.cpp b/src/core/tests/visitors/op/selu.cpp similarity index 100% rename from ngraph/test/visitors/op/selu.cpp rename to src/core/tests/visitors/op/selu.cpp diff --git a/ngraph/test/visitors/op/shape_of.cpp b/src/core/tests/visitors/op/shape_of.cpp similarity index 100% rename from ngraph/test/visitors/op/shape_of.cpp rename to src/core/tests/visitors/op/shape_of.cpp diff --git a/ngraph/test/visitors/op/shuffle_channels.cpp b/src/core/tests/visitors/op/shuffle_channels.cpp similarity index 100% rename from ngraph/test/visitors/op/shuffle_channels.cpp rename to src/core/tests/visitors/op/shuffle_channels.cpp diff --git a/ngraph/test/visitors/op/sigmoid.cpp b/src/core/tests/visitors/op/sigmoid.cpp similarity index 100% rename from ngraph/test/visitors/op/sigmoid.cpp rename to src/core/tests/visitors/op/sigmoid.cpp diff --git a/ngraph/test/visitors/op/sign.cpp b/src/core/tests/visitors/op/sign.cpp similarity index 100% rename from ngraph/test/visitors/op/sign.cpp rename to src/core/tests/visitors/op/sign.cpp diff --git a/ngraph/test/visitors/op/sin.cpp b/src/core/tests/visitors/op/sin.cpp similarity index 100% rename from ngraph/test/visitors/op/sin.cpp rename to src/core/tests/visitors/op/sin.cpp diff --git a/ngraph/test/visitors/op/sinh.cpp b/src/core/tests/visitors/op/sinh.cpp similarity index 100% rename from ngraph/test/visitors/op/sinh.cpp rename to src/core/tests/visitors/op/sinh.cpp diff --git a/ngraph/test/visitors/op/slice.cpp b/src/core/tests/visitors/op/slice.cpp similarity index 100% rename from ngraph/test/visitors/op/slice.cpp rename to src/core/tests/visitors/op/slice.cpp diff --git a/ngraph/test/visitors/op/softmax.cpp b/src/core/tests/visitors/op/softmax.cpp similarity index 100% rename from ngraph/test/visitors/op/softmax.cpp rename to src/core/tests/visitors/op/softmax.cpp diff --git a/ngraph/test/visitors/op/softplus.cpp b/src/core/tests/visitors/op/softplus.cpp similarity index 100% rename from ngraph/test/visitors/op/softplus.cpp rename to src/core/tests/visitors/op/softplus.cpp diff --git a/ngraph/test/visitors/op/space_to_batch.cpp b/src/core/tests/visitors/op/space_to_batch.cpp similarity index 100% rename from ngraph/test/visitors/op/space_to_batch.cpp rename to src/core/tests/visitors/op/space_to_batch.cpp diff --git a/ngraph/test/visitors/op/space_to_depth.cpp b/src/core/tests/visitors/op/space_to_depth.cpp similarity index 100% rename from ngraph/test/visitors/op/space_to_depth.cpp rename to src/core/tests/visitors/op/space_to_depth.cpp diff --git a/ngraph/test/visitors/op/split.cpp b/src/core/tests/visitors/op/split.cpp similarity index 100% rename from ngraph/test/visitors/op/split.cpp rename to src/core/tests/visitors/op/split.cpp diff --git a/ngraph/test/visitors/op/sqrt.cpp b/src/core/tests/visitors/op/sqrt.cpp similarity index 100% rename from ngraph/test/visitors/op/sqrt.cpp rename to src/core/tests/visitors/op/sqrt.cpp diff --git a/ngraph/test/visitors/op/squared_difference.cpp b/src/core/tests/visitors/op/squared_difference.cpp similarity index 100% rename from ngraph/test/visitors/op/squared_difference.cpp rename to src/core/tests/visitors/op/squared_difference.cpp diff --git a/ngraph/test/visitors/op/squeeze.cpp b/src/core/tests/visitors/op/squeeze.cpp similarity index 100% rename from ngraph/test/visitors/op/squeeze.cpp rename to src/core/tests/visitors/op/squeeze.cpp diff --git a/ngraph/test/visitors/op/strided_slice.cpp b/src/core/tests/visitors/op/strided_slice.cpp similarity index 100% rename from ngraph/test/visitors/op/strided_slice.cpp rename to src/core/tests/visitors/op/strided_slice.cpp diff --git a/ngraph/test/visitors/op/subtract.cpp b/src/core/tests/visitors/op/subtract.cpp similarity index 100% rename from ngraph/test/visitors/op/subtract.cpp rename to src/core/tests/visitors/op/subtract.cpp diff --git a/ngraph/test/visitors/op/swish.cpp b/src/core/tests/visitors/op/swish.cpp similarity index 100% rename from ngraph/test/visitors/op/swish.cpp rename to src/core/tests/visitors/op/swish.cpp diff --git a/ngraph/test/visitors/op/tan.cpp b/src/core/tests/visitors/op/tan.cpp similarity index 100% rename from ngraph/test/visitors/op/tan.cpp rename to src/core/tests/visitors/op/tan.cpp diff --git a/ngraph/test/visitors/op/tanh.cpp b/src/core/tests/visitors/op/tanh.cpp similarity index 100% rename from ngraph/test/visitors/op/tanh.cpp rename to src/core/tests/visitors/op/tanh.cpp diff --git a/ngraph/test/visitors/op/topk.cpp b/src/core/tests/visitors/op/topk.cpp similarity index 100% rename from ngraph/test/visitors/op/topk.cpp rename to src/core/tests/visitors/op/topk.cpp diff --git a/ngraph/test/visitors/op/transpose.cpp b/src/core/tests/visitors/op/transpose.cpp similarity index 100% rename from ngraph/test/visitors/op/transpose.cpp rename to src/core/tests/visitors/op/transpose.cpp diff --git a/ngraph/test/visitors/op/unary_ops.hpp b/src/core/tests/visitors/op/unary_ops.hpp similarity index 100% rename from ngraph/test/visitors/op/unary_ops.hpp rename to src/core/tests/visitors/op/unary_ops.hpp diff --git a/ngraph/test/visitors/op/unsqueeze.cpp b/src/core/tests/visitors/op/unsqueeze.cpp similarity index 100% rename from ngraph/test/visitors/op/unsqueeze.cpp rename to src/core/tests/visitors/op/unsqueeze.cpp diff --git a/ngraph/test/visitors/op/variadic_split.cpp b/src/core/tests/visitors/op/variadic_split.cpp similarity index 100% rename from ngraph/test/visitors/op/variadic_split.cpp rename to src/core/tests/visitors/op/variadic_split.cpp diff --git a/ngraph/test/visitors/partial_shape.cpp b/src/core/tests/visitors/partial_shape.cpp similarity index 100% rename from ngraph/test/visitors/partial_shape.cpp rename to src/core/tests/visitors/partial_shape.cpp diff --git a/ngraph/test/visitors/user_op.cpp b/src/core/tests/visitors/user_op.cpp similarity index 100% rename from ngraph/test/visitors/user_op.cpp rename to src/core/tests/visitors/user_op.cpp diff --git a/ngraph/test/visitors/value_map.cpp b/src/core/tests/visitors/value_map.cpp similarity index 100% rename from ngraph/test/visitors/value_map.cpp rename to src/core/tests/visitors/value_map.cpp diff --git a/ngraph/frontend/CMakeLists.txt b/src/frontends/CMakeLists.txt similarity index 53% rename from ngraph/frontend/CMakeLists.txt rename to src/frontends/CMakeLists.txt index bf81fe58baa..d8db4a68ed6 100644 --- a/ngraph/frontend/CMakeLists.txt +++ b/src/frontends/CMakeLists.txt @@ -2,23 +2,23 @@ # SPDX-License-Identifier: Apache-2.0 # -set(FRONTEND_INSTALL_INCLUDE "runtime/include/ngraph/frontend") -set(FRONTEND_NAME_SUFFIX "_ov_frontend") - add_subdirectory(common) -if (NGRAPH_ONNX_FRONTEND_ENABLE) +if(NGRAPH_ONNX_FRONTEND_ENABLE) add_subdirectory(onnx) endif() -if (NGRAPH_PDPD_FRONTEND_ENABLE) +if(NGRAPH_PDPD_FRONTEND_ENABLE) add_subdirectory(paddlepaddle) endif() -if (NGRAPH_IR_FRONTEND_ENABLE) +if(NGRAPH_IR_FRONTEND_ENABLE) add_subdirectory(ir) endif() -if (NGRAPH_TF_FRONTEND_ENABLE) +if(NGRAPH_TF_FRONTEND_ENABLE) add_subdirectory(tensorflow) endif() + +# used for static build +ov_generate_frontends_hpp() diff --git a/ngraph/frontend/common/CMakeLists.txt b/src/frontends/common/CMakeLists.txt similarity index 92% rename from ngraph/frontend/common/CMakeLists.txt rename to src/frontends/common/CMakeLists.txt index 697a6994f38..9d5ab39c6df 100644 --- a/ngraph/frontend/common/CMakeLists.txt +++ b/src/frontends/common/CMakeLists.txt @@ -14,7 +14,7 @@ file(GLOB_RECURSE LIBRARY_PUBLIC_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include/*.h # Add include path to so_extension.hpp set_property(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/src/frontend_manager.cpp - APPEND PROPERTY INCLUDE_DIRECTORIES "${OpenVINO_SOURCE_DIR}/ngraph/core/src/") + APPEND PROPERTY INCLUDE_DIRECTORIES "${OpenVINO_SOURCE_DIR}/src/core/src/") set(FRONTEND_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include) @@ -28,15 +28,19 @@ add_library(${TARGET_NAME} ${LIBRARY_SRC} ${LIBRARY_HEADERS} ${LIBRARY_PUBLIC_HE add_library(ngraph::${TARGET_NAME} ALIAS ${TARGET_NAME}) add_library(openvino::frontend::common ALIAS ${TARGET_NAME}) -target_include_directories(${TARGET_NAME} PUBLIC +target_include_directories(${TARGET_NAME} + PUBLIC $ - $) + $ + PRIVATE + # for ov_frontends.hpp in static build + "${CMAKE_CURRENT_BINARY_DIR}/src") + target_include_directories(${TARGET_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src) target_link_libraries(${TARGET_NAME} PRIVATE ${CMAKE_DL_LIBS} openvino::util PUBLIC ngraph) set_property(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/src/plugin_loader.cpp APPEND PROPERTY COMPILE_DEFINITIONS FRONTEND_LIB_PREFIX="${CMAKE_SHARED_LIBRARY_PREFIX}" - FRONTEND_LIB_SUFFIX="${FRONTEND_NAME_SUFFIX}${IE_BUILD_POSTFIX}${CMAKE_SHARED_LIBRARY_SUFFIX}" - ) + FRONTEND_LIB_SUFFIX="${FRONTEND_NAME_SUFFIX}${IE_BUILD_POSTFIX}${CMAKE_SHARED_LIBRARY_SUFFIX}") add_clang_format_target(${TARGET_NAME}_clang FOR_TARGETS ${TARGET_NAME}) @@ -76,7 +80,7 @@ install(DIRECTORY ${FRONTEND_INCLUDE_DIR}/common DESTINATION ${FRONTEND_INSTALL_INCLUDE} COMPONENT ngraph_dev FILES_MATCHING PATTERN "*.hpp") - + install(DIRECTORY ${FRONTEND_INCLUDE_DIR}/ DESTINATION ${FRONTEND_INSTALL_INCLUDE} COMPONENT ngraph_dev diff --git a/ngraph/frontend/common/include/common/frontend.hpp b/src/frontends/common/include/common/frontend.hpp similarity index 100% rename from ngraph/frontend/common/include/common/frontend.hpp rename to src/frontends/common/include/common/frontend.hpp diff --git a/ngraph/frontend/common/include/common/frontend_defs.hpp b/src/frontends/common/include/common/frontend_defs.hpp similarity index 100% rename from ngraph/frontend/common/include/common/frontend_defs.hpp rename to src/frontends/common/include/common/frontend_defs.hpp diff --git a/ngraph/frontend/common/include/common/frontend_exceptions.hpp b/src/frontends/common/include/common/frontend_exceptions.hpp similarity index 100% rename from ngraph/frontend/common/include/common/frontend_exceptions.hpp rename to src/frontends/common/include/common/frontend_exceptions.hpp diff --git a/ngraph/frontend/common/include/common/input_model.hpp b/src/frontends/common/include/common/input_model.hpp similarity index 100% rename from ngraph/frontend/common/include/common/input_model.hpp rename to src/frontends/common/include/common/input_model.hpp diff --git a/ngraph/frontend/common/include/common/parameters.hpp b/src/frontends/common/include/common/parameters.hpp similarity index 100% rename from ngraph/frontend/common/include/common/parameters.hpp rename to src/frontends/common/include/common/parameters.hpp diff --git a/ngraph/frontend/common/include/common/place.hpp b/src/frontends/common/include/common/place.hpp similarity index 100% rename from ngraph/frontend/common/include/common/place.hpp rename to src/frontends/common/include/common/place.hpp diff --git a/ngraph/frontend/common/include/manager.hpp b/src/frontends/common/include/manager.hpp similarity index 100% rename from ngraph/frontend/common/include/manager.hpp rename to src/frontends/common/include/manager.hpp diff --git a/ngraph/frontend/common/src/frontend_manager.cpp b/src/frontends/common/src/frontend_manager.cpp similarity index 100% rename from ngraph/frontend/common/src/frontend_manager.cpp rename to src/frontends/common/src/frontend_manager.cpp diff --git a/ngraph/frontend/common/src/parameters.cpp b/src/frontends/common/src/parameters.cpp similarity index 100% rename from ngraph/frontend/common/src/parameters.cpp rename to src/frontends/common/src/parameters.cpp diff --git a/ngraph/frontend/common/src/plugin_loader.cpp b/src/frontends/common/src/plugin_loader.cpp similarity index 69% rename from ngraph/frontend/common/src/plugin_loader.cpp rename to src/frontends/common/src/plugin_loader.cpp index 0be0739389d..b09d83bb77c 100644 --- a/ngraph/frontend/common/src/plugin_loader.cpp +++ b/src/frontends/common/src/plugin_loader.cpp @@ -26,6 +26,26 @@ using namespace ov; using namespace ov::frontend; +#ifdef OPENVINO_STATIC_LIBRARY + +# include "ov_frontends.hpp" + +namespace { + +std::vector load_static_plugins() { + std::vector res; + for (const auto& frontend : getStaticFrontendsRegistry()) { + PluginHandle fakeGuard([]() {}); + std::unique_ptr fact{reinterpret_cast(frontend.m_dataFunc())}; + res.emplace_back(std::move(fakeGuard), std::move(*fact)); + } + return res; +} + +} // namespace + +#endif // OPENVINO_STATIC_LIBRARY + #ifdef WIN32 # define DLOPEN(file_str) LoadLibrary(TEXT(file_str.c_str())) # define DLSYM(obj, func) GetProcAddress(obj, func) @@ -43,8 +63,8 @@ static std::vector list_files(const std::string& path) { NGRAPH_SUPPRESS_DEPRECATED_START std::vector res; try { - auto prefix = std::string(FRONTEND_LIB_PREFIX); - auto suffix = std::string(FRONTEND_LIB_SUFFIX); + const auto prefix = std::string(FRONTEND_LIB_PREFIX); + const auto suffix = std::string(FRONTEND_LIB_SUFFIX); ov::util::iterate_files( path, [&res, &prefix, &suffix](const std::string& file_path, bool is_dir) { @@ -55,12 +75,7 @@ static std::vector list_files(const std::string& path) { res.push_back(file_path); } }, - // ilavreno: this is current solution for static runtime - // since frontends are still dynamic libraries and they are located in - // a different folder with compare to frontend_common one (in ./lib) - // we are trying to use recursive search. Can be reverted back in future - // once the frontends are static too. - true, + false, true); } catch (...) { // Ignore exceptions @@ -69,10 +84,9 @@ static std::vector list_files(const std::string& path) { NGRAPH_SUPPRESS_DEPRECATED_END } -std::vector ov::frontend::load_plugins(const std::string& dir_name) { - auto files = list_files(dir_name); +static std::vector load_dynamic_plugins(const std::string& dir_name) { std::vector res; - for (const auto& file : files) { + for (const auto& file : list_files(dir_name)) { auto shared_object = DLOPEN(file); if (!shared_object) { NGRAPH_DEBUG << "Error loading FrontEnd " << file << " " << DLERROR() << std::endl; @@ -105,3 +119,19 @@ std::vector ov::frontend::load_plugins(const std::string& dir_name) } return res; } + +std::vector ov::frontend::load_plugins(const std::string& dir_name) { + std::vector res; +#ifdef OPENVINO_STATIC_LIBRARY + res = load_static_plugins(); +#endif // OPENVINO_STATIC_LIBRARY + for (auto&& fe : load_dynamic_plugins(dir_name)) { + // if frontend is registered as static one, skip dynamic version + if (std::find_if(res.begin(), res.end(), [&fe](const PluginData& pd) { + return pd.m_plugin_info.m_name == fe.m_plugin_info.m_name; + }) == res.end()) { + res.emplace_back(std::move(fe)); + } + } + return res; +} diff --git a/ngraph/frontend/common/src/plugin_loader.hpp b/src/frontends/common/src/plugin_loader.hpp similarity index 92% rename from ngraph/frontend/common/src/plugin_loader.hpp rename to src/frontends/common/src/plugin_loader.hpp index 86036fbbf34..9e5fbd813df 100644 --- a/ngraph/frontend/common/src/plugin_loader.hpp +++ b/src/frontends/common/src/plugin_loader.hpp @@ -7,10 +7,8 @@ #include #ifdef _WIN32 -static const char FileSeparator[] = "\\"; static const char PathSeparator[] = ";"; #else -static const char FileSeparator[] = "/"; static const char PathSeparator[] = ":"; #endif // _WIN32 @@ -42,6 +40,7 @@ private: struct PluginData { PluginData(PluginHandle&& h, FrontEndPluginInfo&& info) : m_lib_handle(std::move(h)), m_plugin_info(info) {} + PluginData(PluginData&& pd) : m_lib_handle(std::move(pd.m_lib_handle)), m_plugin_info(pd.m_plugin_info) {} PluginHandle m_lib_handle; // Shall be destroyed when plugin is not needed anymore to free memory FrontEndPluginInfo m_plugin_info; diff --git a/ngraph/frontend/common/src/utils.cpp b/src/frontends/common/src/utils.cpp similarity index 81% rename from ngraph/frontend/common/src/utils.cpp rename to src/frontends/common/src/utils.cpp index 742f7a8b8f9..98e62ec12e2 100644 --- a/ngraph/frontend/common/src/utils.cpp +++ b/src/frontends/common/src/utils.cpp @@ -5,6 +5,7 @@ #include "utils.hpp" #include "common/frontend_exceptions.hpp" +#include "openvino/util/file_util.hpp" #include "plugin_loader.hpp" #ifndef _WIN32 @@ -25,18 +26,6 @@ # include #endif -namespace { -std::string get_path_name(const std::string& s) { - size_t i = s.rfind(FileSeparator, s.length()); - if (i != std::string::npos) { - return (s.substr(0, i)); - } - - return {}; -} - -} // namespace - static std::string _get_frontend_library_path() { #ifdef _WIN32 CHAR ie_library_path[MAX_PATH]; @@ -47,11 +36,11 @@ static std::string _get_frontend_library_path() { FRONT_END_INITIALIZATION_CHECK(false, "GetModuleHandle returned ", GetLastError()); } GetModuleFileNameA(hm, (LPSTR)ie_library_path, sizeof(ie_library_path)); - return get_path_name(std::string(ie_library_path)); + return ov::util::get_directory(std::string(ie_library_path)); #elif defined(__APPLE__) || defined(__linux__) Dl_info info; dladdr(reinterpret_cast(ov::frontend::get_frontend_library_path), &info); - return get_path_name(std::string(info.dli_fname)).c_str(); + return ov::util::get_directory(std::string(info.dli_fname)).c_str(); #else # error "Unsupported OS" #endif // _WIN32 diff --git a/ngraph/frontend/common/src/utils.hpp b/src/frontends/common/src/utils.hpp similarity index 100% rename from ngraph/frontend/common/src/utils.hpp rename to src/frontends/common/src/utils.hpp diff --git a/src/frontends/ir/CMakeLists.txt b/src/frontends/ir/CMakeLists.txt new file mode 100644 index 00000000000..120bae4b6d5 --- /dev/null +++ b/src/frontends/ir/CMakeLists.txt @@ -0,0 +1,13 @@ +# Copyright (C) 2018-2021 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 +# + +ov_add_frontend(NAME ir + FILEDESCRIPTION "FrontEnd to load OpenVINO IR file format" + LINK_LIBRARIES inference_engine_transformations pugixml::static + # TODO: remove dependencies below in CVS-69781 + inference_engine inference_engine_plugin_api) + +# Add include path to so_extension.hpp +set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/src/frontend.cpp + PROPERTIES INCLUDE_DIRECTORIES "${OpenVINO_SOURCE_DIR}/src/core/src/") diff --git a/ngraph/frontend/ir/include/ir_frontend/frontend.hpp b/src/frontends/ir/include/ir_frontend/frontend.hpp similarity index 100% rename from ngraph/frontend/ir/include/ir_frontend/frontend.hpp rename to src/frontends/ir/include/ir_frontend/frontend.hpp diff --git a/ngraph/frontend/ir/include/ir_frontend/model.hpp b/src/frontends/ir/include/ir_frontend/model.hpp similarity index 100% rename from ngraph/frontend/ir/include/ir_frontend/model.hpp rename to src/frontends/ir/include/ir_frontend/model.hpp diff --git a/ngraph/frontend/ir/include/ir_frontend/utility.hpp b/src/frontends/ir/include/ir_frontend/utility.hpp similarity index 55% rename from ngraph/frontend/ir/include/ir_frontend/utility.hpp rename to src/frontends/ir/include/ir_frontend/utility.hpp index 7164541cadf..5e9555fc50d 100644 --- a/ngraph/frontend/ir/include/ir_frontend/utility.hpp +++ b/src/frontends/ir/include/ir_frontend/utility.hpp @@ -6,12 +6,18 @@ #include -// Defined if we are building the plugin DLL (instead of using it) -#ifdef ir_ov_frontend_EXPORTS -# define IR_API OPENVINO_CORE_EXPORTS +#ifdef OPENVINO_STATIC_LIBRARY +# define IR_API +# define IR_C_API #else -# define IR_API OPENVINO_CORE_IMPORTS -#endif // ir_ov_frontend_EXPORTS +# ifdef ir_ov_frontend_EXPORTS +# define IR_API OPENVINO_CORE_EXPORTS +# define IR_C_API OPENVINO_EXTERN_C OPENVINO_CORE_EXPORTS +# else +# define IR_API OPENVINO_CORE_IMPORTS +# define IR_C_API OPENVINO_EXTERN_C OPENVINO_CORE_IMPORTS +# endif // ir_ov_frontend_EXPORTS +#endif // OPENVINO_STATIC_LIBRARY #define IR_ASSERT(ex, msg) \ { \ diff --git a/ngraph/frontend/ir/src/frontend.cpp b/src/frontends/ir/src/frontend.cpp similarity index 98% rename from ngraph/frontend/ir/src/frontend.cpp rename to src/frontends/ir/src/frontend.cpp index b02cb3a58ed..d7a7cc15ba3 100644 --- a/ngraph/frontend/ir/src/frontend.cpp +++ b/src/frontends/ir/src/frontend.cpp @@ -236,11 +236,11 @@ std::string FrontEndIR::get_name() const { } // namespace frontend } // namespace ov -extern "C" IR_API ov::frontend::FrontEndVersion GetAPIVersion() { +IR_C_API ov::frontend::FrontEndVersion GetAPIVersion() { return OV_FRONTEND_API_VERSION; } -extern "C" IR_API void* GetFrontEndData() { +IR_C_API void* GetFrontEndData() { frontend::FrontEndPluginInfo* res = new frontend::FrontEndPluginInfo(); res->m_name = "ir"; res->m_creator = []() { diff --git a/ngraph/frontend/ir/src/ir_deserializer.cpp b/src/frontends/ir/src/ir_deserializer.cpp similarity index 99% rename from ngraph/frontend/ir/src/ir_deserializer.cpp rename to src/frontends/ir/src/ir_deserializer.cpp index 8908fb6c03a..c19c1e4d98c 100644 --- a/ngraph/frontend/ir/src/ir_deserializer.cpp +++ b/src/frontends/ir/src/ir_deserializer.cpp @@ -733,12 +733,12 @@ std::shared_ptr XmlDeserializer::createNode(const std::vectorvisit_attributes(attribute_visitor)) { - rt_info[type_info] = std::shared_ptr(attr); + rt_info[type_info] = attr; } else { - IE_THROW() << "VisitAttributes is not supported for: " << item.name() << " attribute"; + IE_THROW() << "VisitAttributes is not supported for: " << attribute_name << " attribute"; } } else { - IE_THROW() << "Attribute: " << item.name() << " is not recognized"; + IE_THROW() << "Attribute: " << attribute_name << " is not recognized"; } } }; diff --git a/ngraph/frontend/ir/src/ir_deserializer.hpp b/src/frontends/ir/src/ir_deserializer.hpp similarity index 100% rename from ngraph/frontend/ir/src/ir_deserializer.hpp rename to src/frontends/ir/src/ir_deserializer.hpp diff --git a/ngraph/frontend/ir/src/model.cpp b/src/frontends/ir/src/model.cpp similarity index 100% rename from ngraph/frontend/ir/src/model.cpp rename to src/frontends/ir/src/model.cpp diff --git a/ngraph/frontend/ir/src/rt_info_deserializer.cpp b/src/frontends/ir/src/rt_info_deserializer.cpp similarity index 100% rename from ngraph/frontend/ir/src/rt_info_deserializer.cpp rename to src/frontends/ir/src/rt_info_deserializer.cpp diff --git a/ngraph/frontend/ir/src/rt_info_deserializer.hpp b/src/frontends/ir/src/rt_info_deserializer.hpp similarity index 100% rename from ngraph/frontend/ir/src/rt_info_deserializer.hpp rename to src/frontends/ir/src/rt_info_deserializer.hpp diff --git a/ngraph/frontend/ir/src/utils.cpp b/src/frontends/ir/src/utils.cpp similarity index 100% rename from ngraph/frontend/ir/src/utils.cpp rename to src/frontends/ir/src/utils.cpp diff --git a/ngraph/frontend/ir/src/utils.hpp b/src/frontends/ir/src/utils.hpp similarity index 100% rename from ngraph/frontend/ir/src/utils.hpp rename to src/frontends/ir/src/utils.hpp diff --git a/ngraph/frontend/onnx/CMakeLists.txt b/src/frontends/onnx/CMakeLists.txt similarity index 100% rename from ngraph/frontend/onnx/CMakeLists.txt rename to src/frontends/onnx/CMakeLists.txt diff --git a/src/frontends/onnx/frontend/CMakeLists.txt b/src/frontends/onnx/frontend/CMakeLists.txt new file mode 100644 index 00000000000..d671a9fc7a6 --- /dev/null +++ b/src/frontends/onnx/frontend/CMakeLists.txt @@ -0,0 +1,25 @@ +# Copyright (C) 2021 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 +# + +ov_add_frontend(NAME onnx + LINKABLE_FRONTEND + PROTOBUF_LITE + SKIP_NCC_STYLE + FILEDESCRIPTION "FrontEnd to load and convert ONNX file format" + LINK_LIBRARIES ngraph::builder openvino::util onnx_common inference_engine_transformations) + +set(ONNX_OPSET_VERSION 13 CACHE INTERNAL "Supported version of ONNX operator set") +target_compile_definitions(${TARGET_NAME} PRIVATE ONNX_OPSET_VERSION=${ONNX_OPSET_VERSION}) + +ov_ncc_naming_style(FOR_TARGET ${TARGET_NAME} + INCLUDE_DIRECTORY "${${TARGET_NAME}_INCLUDE_DIR}" + DEFINITIONS + $ + ADDITIONAL_INCLUDE_DIRECTORIES + $) + +install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/onnx_import + DESTINATION ${FRONTEND_INSTALL_INCLUDE} + COMPONENT ngraph_dev + FILES_MATCHING PATTERN "*.hpp") diff --git a/ngraph/frontend/onnx/frontend/include/onnx_frontend/frontend.hpp b/src/frontends/onnx/frontend/include/onnx_frontend/frontend.hpp similarity index 61% rename from ngraph/frontend/onnx/frontend/include/onnx_frontend/frontend.hpp rename to src/frontends/onnx/frontend/include/onnx_frontend/frontend.hpp index e3f900d6f03..ddd1ef66b4e 100644 --- a/ngraph/frontend/onnx/frontend/include/onnx_frontend/frontend.hpp +++ b/src/frontends/onnx/frontend/include/onnx_frontend/frontend.hpp @@ -6,11 +6,18 @@ #include -#ifdef onnx_ov_frontend_EXPORTS -# define ONNX_FRONTEND_API OPENVINO_CORE_EXPORTS +#ifdef OPENVINO_STATIC_LIBRARY +# define ONNX_FRONTEND_API +# define ONNX_FRONTEND_C_API #else -# define ONNX_FRONTEND_API OPENVINO_CORE_IMPORTS -#endif +# ifdef onnx_ov_frontend_EXPORTS +# define ONNX_FRONTEND_API OPENVINO_CORE_EXPORTS +# define ONNX_FRONTEND_C_API OPENVINO_EXTERN_C OPENVINO_CORE_EXPORTS +# else +# define ONNX_FRONTEND_API OPENVINO_CORE_IMPORTS +# define ONNX_FRONTEND_C_API OPENVINO_EXTERN_C OPENVINO_CORE_IMPORTS +# endif // onnx_ov_frontend_EXPORTS +#endif // OPENVINO_STATIC_LIBRARY namespace ov { namespace frontend { diff --git a/ngraph/frontend/onnx/frontend/include/onnx_import/core/node.hpp b/src/frontends/onnx/frontend/include/onnx_import/core/node.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/include/onnx_import/core/node.hpp rename to src/frontends/onnx/frontend/include/onnx_import/core/node.hpp diff --git a/ngraph/frontend/onnx/frontend/include/onnx_import/core/null_node.hpp b/src/frontends/onnx/frontend/include/onnx_import/core/null_node.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/include/onnx_import/core/null_node.hpp rename to src/frontends/onnx/frontend/include/onnx_import/core/null_node.hpp diff --git a/ngraph/frontend/onnx/frontend/include/onnx_import/core/operator_set.hpp b/src/frontends/onnx/frontend/include/onnx_import/core/operator_set.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/include/onnx_import/core/operator_set.hpp rename to src/frontends/onnx/frontend/include/onnx_import/core/operator_set.hpp diff --git a/ngraph/frontend/onnx/frontend/include/onnx_import/onnx.hpp b/src/frontends/onnx/frontend/include/onnx_import/onnx.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/include/onnx_import/onnx.hpp rename to src/frontends/onnx/frontend/include/onnx_import/onnx.hpp diff --git a/src/frontends/onnx/frontend/include/onnx_import/onnx_importer_visibility.hpp b/src/frontends/onnx/frontend/include/onnx_import/onnx_importer_visibility.hpp new file mode 100644 index 00000000000..fcce9aaa746 --- /dev/null +++ b/src/frontends/onnx/frontend/include/onnx_import/onnx_importer_visibility.hpp @@ -0,0 +1,15 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "ngraph/visibility.hpp" + +#ifdef OPENVINO_STATIC_LIBRARY +# define ONNX_IMPORTER_API +#else +# ifdef onnx_ov_frontend_EXPORTS +# define ONNX_IMPORTER_API OPENVINO_CORE_EXPORTS +# else +# define ONNX_IMPORTER_API OPENVINO_CORE_IMPORTS +# endif // onnx_ov_frontend_EXPORTS +#endif // OPENVINO_STATIC_LIBRARY diff --git a/ngraph/frontend/onnx/frontend/include/onnx_import/onnx_utils.hpp b/src/frontends/onnx/frontend/include/onnx_import/onnx_utils.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/include/onnx_import/onnx_utils.hpp rename to src/frontends/onnx/frontend/include/onnx_import/onnx_utils.hpp diff --git a/ngraph/frontend/onnx/frontend/src/core/attribute.cpp b/src/frontends/onnx/frontend/src/core/attribute.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/core/attribute.cpp rename to src/frontends/onnx/frontend/src/core/attribute.cpp diff --git a/ngraph/frontend/onnx/frontend/src/core/attribute.hpp b/src/frontends/onnx/frontend/src/core/attribute.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/core/attribute.hpp rename to src/frontends/onnx/frontend/src/core/attribute.hpp diff --git a/ngraph/frontend/onnx/frontend/src/core/graph.cpp b/src/frontends/onnx/frontend/src/core/graph.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/core/graph.cpp rename to src/frontends/onnx/frontend/src/core/graph.cpp diff --git a/ngraph/frontend/onnx/frontend/src/core/graph.hpp b/src/frontends/onnx/frontend/src/core/graph.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/core/graph.hpp rename to src/frontends/onnx/frontend/src/core/graph.hpp diff --git a/ngraph/frontend/onnx/frontend/src/core/graph_cache.cpp b/src/frontends/onnx/frontend/src/core/graph_cache.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/core/graph_cache.cpp rename to src/frontends/onnx/frontend/src/core/graph_cache.cpp diff --git a/ngraph/frontend/onnx/frontend/src/core/graph_cache.hpp b/src/frontends/onnx/frontend/src/core/graph_cache.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/core/graph_cache.hpp rename to src/frontends/onnx/frontend/src/core/graph_cache.hpp diff --git a/ngraph/frontend/onnx/frontend/src/core/model.cpp b/src/frontends/onnx/frontend/src/core/model.cpp similarity index 98% rename from ngraph/frontend/onnx/frontend/src/core/model.cpp rename to src/frontends/onnx/frontend/src/core/model.cpp index fe86093825d..a3141e7e582 100644 --- a/ngraph/frontend/onnx/frontend/src/core/model.cpp +++ b/src/frontends/onnx/frontend/src/core/model.cpp @@ -71,7 +71,7 @@ void Model::enable_opset_domain(const std::string& domain) { if (m_opset.find(domain) == std::end(m_opset)) { OperatorSet opset{OperatorsBridge::get_operator_set(domain)}; if (opset.empty()) { - NGRAPH_WARN << "Couldn't enable domain: " << domain << " since it hasn't any registered operators."; + NGRAPH_WARN << "Couldn't enable domain: " << domain << " since it does not have any registered operators."; return; } diff --git a/ngraph/frontend/onnx/frontend/src/core/model.hpp b/src/frontends/onnx/frontend/src/core/model.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/core/model.hpp rename to src/frontends/onnx/frontend/src/core/model.hpp diff --git a/ngraph/frontend/onnx/frontend/src/core/node.cpp b/src/frontends/onnx/frontend/src/core/node.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/core/node.cpp rename to src/frontends/onnx/frontend/src/core/node.cpp diff --git a/ngraph/frontend/onnx/frontend/src/core/null_node.cpp b/src/frontends/onnx/frontend/src/core/null_node.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/core/null_node.cpp rename to src/frontends/onnx/frontend/src/core/null_node.cpp diff --git a/ngraph/frontend/onnx/frontend/src/core/sparse_tensor.hpp b/src/frontends/onnx/frontend/src/core/sparse_tensor.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/core/sparse_tensor.hpp rename to src/frontends/onnx/frontend/src/core/sparse_tensor.hpp diff --git a/ngraph/frontend/onnx/frontend/src/core/tensor.hpp b/src/frontends/onnx/frontend/src/core/tensor.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/core/tensor.hpp rename to src/frontends/onnx/frontend/src/core/tensor.hpp diff --git a/ngraph/frontend/onnx/frontend/src/core/transform.cpp b/src/frontends/onnx/frontend/src/core/transform.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/core/transform.cpp rename to src/frontends/onnx/frontend/src/core/transform.cpp diff --git a/ngraph/frontend/onnx/frontend/src/core/transform.hpp b/src/frontends/onnx/frontend/src/core/transform.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/core/transform.hpp rename to src/frontends/onnx/frontend/src/core/transform.hpp diff --git a/ngraph/frontend/onnx/frontend/src/core/value_info.hpp b/src/frontends/onnx/frontend/src/core/value_info.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/core/value_info.hpp rename to src/frontends/onnx/frontend/src/core/value_info.hpp diff --git a/ngraph/frontend/onnx/frontend/src/default_opset.hpp b/src/frontends/onnx/frontend/src/default_opset.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/default_opset.hpp rename to src/frontends/onnx/frontend/src/default_opset.hpp diff --git a/ngraph/frontend/onnx/frontend/src/detail/subgraph_extraction.cpp b/src/frontends/onnx/frontend/src/detail/subgraph_extraction.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/detail/subgraph_extraction.cpp rename to src/frontends/onnx/frontend/src/detail/subgraph_extraction.cpp diff --git a/ngraph/frontend/onnx/frontend/src/detail/subgraph_extraction.hpp b/src/frontends/onnx/frontend/src/detail/subgraph_extraction.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/detail/subgraph_extraction.hpp rename to src/frontends/onnx/frontend/src/detail/subgraph_extraction.hpp diff --git a/ngraph/frontend/onnx/frontend/src/edge_mapper.cpp b/src/frontends/onnx/frontend/src/edge_mapper.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/edge_mapper.cpp rename to src/frontends/onnx/frontend/src/edge_mapper.cpp diff --git a/ngraph/frontend/onnx/frontend/src/edge_mapper.hpp b/src/frontends/onnx/frontend/src/edge_mapper.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/edge_mapper.hpp rename to src/frontends/onnx/frontend/src/edge_mapper.hpp diff --git a/ngraph/frontend/onnx/frontend/src/editor.cpp b/src/frontends/onnx/frontend/src/editor.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/editor.cpp rename to src/frontends/onnx/frontend/src/editor.cpp diff --git a/ngraph/frontend/onnx/frontend/src/editor.hpp b/src/frontends/onnx/frontend/src/editor.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/editor.hpp rename to src/frontends/onnx/frontend/src/editor.hpp diff --git a/ngraph/frontend/onnx/frontend/src/editor_types.hpp b/src/frontends/onnx/frontend/src/editor_types.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/editor_types.hpp rename to src/frontends/onnx/frontend/src/editor_types.hpp diff --git a/ngraph/frontend/onnx/frontend/src/exceptions.cpp b/src/frontends/onnx/frontend/src/exceptions.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/exceptions.cpp rename to src/frontends/onnx/frontend/src/exceptions.cpp diff --git a/ngraph/frontend/onnx/frontend/src/exceptions.hpp b/src/frontends/onnx/frontend/src/exceptions.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/exceptions.hpp rename to src/frontends/onnx/frontend/src/exceptions.hpp diff --git a/ngraph/frontend/onnx/frontend/src/frontend.cpp b/src/frontends/onnx/frontend/src/frontend.cpp similarity index 97% rename from ngraph/frontend/onnx/frontend/src/frontend.cpp rename to src/frontends/onnx/frontend/src/frontend.cpp index afa90828f99..8f9b333a074 100644 --- a/ngraph/frontend/onnx/frontend/src/frontend.cpp +++ b/src/frontends/onnx/frontend/src/frontend.cpp @@ -20,11 +20,11 @@ using VariantString = VariantWrapper; using VariantWString = VariantWrapper; using VariantIstreamPtr = VariantWrapper; -extern "C" ONNX_FRONTEND_API FrontEndVersion GetAPIVersion() { +ONNX_FRONTEND_C_API FrontEndVersion GetAPIVersion() { return OV_FRONTEND_API_VERSION; } -extern "C" ONNX_FRONTEND_API void* GetFrontEndData() { +ONNX_FRONTEND_C_API void* GetFrontEndData() { FrontEndPluginInfo* res = new FrontEndPluginInfo(); res->m_name = "onnx"; res->m_creator = []() { diff --git a/ngraph/frontend/onnx/frontend/src/input_model.cpp b/src/frontends/onnx/frontend/src/input_model.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/input_model.cpp rename to src/frontends/onnx/frontend/src/input_model.cpp diff --git a/ngraph/frontend/onnx/frontend/src/input_model.hpp b/src/frontends/onnx/frontend/src/input_model.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/input_model.hpp rename to src/frontends/onnx/frontend/src/input_model.hpp diff --git a/ngraph/frontend/onnx/frontend/src/onnx.cpp b/src/frontends/onnx/frontend/src/onnx.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/onnx.cpp rename to src/frontends/onnx/frontend/src/onnx.cpp diff --git a/ngraph/frontend/onnx/frontend/src/onnx_framework_node.cpp b/src/frontends/onnx/frontend/src/onnx_framework_node.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/onnx_framework_node.cpp rename to src/frontends/onnx/frontend/src/onnx_framework_node.cpp diff --git a/ngraph/frontend/onnx/frontend/src/onnx_framework_node.hpp b/src/frontends/onnx/frontend/src/onnx_framework_node.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/onnx_framework_node.hpp rename to src/frontends/onnx/frontend/src/onnx_framework_node.hpp diff --git a/ngraph/frontend/onnx/frontend/src/onnx_utils.cpp b/src/frontends/onnx/frontend/src/onnx_utils.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/onnx_utils.cpp rename to src/frontends/onnx/frontend/src/onnx_utils.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/abs.hpp b/src/frontends/onnx/frontend/src/op/abs.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/abs.hpp rename to src/frontends/onnx/frontend/src/op/abs.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/acos.hpp b/src/frontends/onnx/frontend/src/op/acos.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/acos.hpp rename to src/frontends/onnx/frontend/src/op/acos.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/acosh.hpp b/src/frontends/onnx/frontend/src/op/acosh.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/acosh.hpp rename to src/frontends/onnx/frontend/src/op/acosh.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/add.cpp b/src/frontends/onnx/frontend/src/op/add.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/add.cpp rename to src/frontends/onnx/frontend/src/op/add.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/add.hpp b/src/frontends/onnx/frontend/src/op/add.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/add.hpp rename to src/frontends/onnx/frontend/src/op/add.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/affine.cpp b/src/frontends/onnx/frontend/src/op/affine.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/affine.cpp rename to src/frontends/onnx/frontend/src/op/affine.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/affine.hpp b/src/frontends/onnx/frontend/src/op/affine.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/affine.hpp rename to src/frontends/onnx/frontend/src/op/affine.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/and.hpp b/src/frontends/onnx/frontend/src/op/and.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/and.hpp rename to src/frontends/onnx/frontend/src/op/and.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/argmax.cpp b/src/frontends/onnx/frontend/src/op/argmax.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/argmax.cpp rename to src/frontends/onnx/frontend/src/op/argmax.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/argmax.hpp b/src/frontends/onnx/frontend/src/op/argmax.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/argmax.hpp rename to src/frontends/onnx/frontend/src/op/argmax.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/argmin.cpp b/src/frontends/onnx/frontend/src/op/argmin.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/argmin.cpp rename to src/frontends/onnx/frontend/src/op/argmin.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/argmin.hpp b/src/frontends/onnx/frontend/src/op/argmin.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/argmin.hpp rename to src/frontends/onnx/frontend/src/op/argmin.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/asin.hpp b/src/frontends/onnx/frontend/src/op/asin.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/asin.hpp rename to src/frontends/onnx/frontend/src/op/asin.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/asinh.hpp b/src/frontends/onnx/frontend/src/op/asinh.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/asinh.hpp rename to src/frontends/onnx/frontend/src/op/asinh.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/atan.hpp b/src/frontends/onnx/frontend/src/op/atan.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/atan.hpp rename to src/frontends/onnx/frontend/src/op/atan.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/atanh.hpp b/src/frontends/onnx/frontend/src/op/atanh.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/atanh.hpp rename to src/frontends/onnx/frontend/src/op/atanh.hpp diff --git a/src/frontends/onnx/frontend/src/op/aten.cpp b/src/frontends/onnx/frontend/src/op/aten.cpp new file mode 100644 index 00000000000..3c507559f22 --- /dev/null +++ b/src/frontends/onnx/frontend/src/op/aten.cpp @@ -0,0 +1,93 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "op/aten.hpp" + +#include "default_opset.hpp" +#include "exceptions.hpp" +#include "onnx_import/core/node.hpp" +#include "onnx_import/core/null_node.hpp" +#include "openvino/opsets/opset8.hpp" + +namespace ngraph { +namespace onnx_import { +namespace op { +namespace set_1 { + +OutputVector aten(const Node& node) { + OutputVector inputs{node.get_ng_inputs()}; + + const auto operator_name = node.get_attribute_value("operator", ""); + CHECK_VALID_NODE(node, + operator_name == "embedding_bag", + "Only `embedding_bag` is supported as ATen `operator` attribute. Got: ", + operator_name); + + const auto mode = node.get_attribute_value("mode"); + CHECK_VALID_NODE(node, + mode == 0, + "Unsupported mode, only `0` (sum) is supported as ATen embedding_bag `mode` attribute. Got: ", + mode); + CHECK_VALID_NODE(node, inputs.size() >= 2, "Minimum 2 inputs are required. Got: ", inputs.size()); + + const bool is_packed_two_inputs = + inputs.size() == 2 || (inputs.size() == 3 && ngraph::op::is_null(inputs[2])) || + (inputs.size() == 4 && ngraph::op::is_null(inputs[2]) && ngraph::op::is_null(inputs[3])); + const bool is_packed_three_inputs = + inputs.size() == 4 && ngraph::op::is_null(inputs[2]) && !ngraph::op::is_null(inputs[3]); + const bool is_offsets_three_inputs = inputs.size() == 3 && !ngraph::op::is_null(inputs[2]); + + Output embedding_bag; + if (is_packed_two_inputs) { + embedding_bag = std::make_shared(inputs[0], inputs[1]); + } else if (is_packed_three_inputs) { + embedding_bag = std::make_shared(inputs[0], inputs[1], inputs[3]); + } else if (is_offsets_three_inputs) { + embedding_bag = std::make_shared(inputs[0], inputs[1], inputs[2]); + } else if (inputs.size() >= 4) { + // Need to expand embedding table with zeros (default values for empty bags) + const auto& emb_tbl_in = inputs[0]; + const auto& indices_in = inputs[1]; + const auto& offsets_in = inputs[2]; + const auto& per_sample_weights_in = inputs[3]; + + const auto data_type = emb_tbl_in.get_element_type(); + const auto ind_type = indices_in.get_element_type(); + + const auto zero_const = std::make_shared(ind_type, Shape{}, 0); + + // Shape aligned node, filled with zeros + const auto zero_of_data_type_const = std::make_shared(data_type, Shape{1}, 0); + const auto weights_shape_node = std::make_shared(emb_tbl_in, ind_type); + const auto weights_last_dim_idx = std::make_shared(element::i32, Shape{1}, -1); + const auto weights_last_dim = + std::make_shared(weights_shape_node, weights_last_dim_idx, zero_const); + const auto zero_col_node = + std::make_shared(zero_of_data_type_const, weights_last_dim); + const auto default_embeddings_node = std::make_shared(zero_col_node, zero_const); + + // Expanded embedding table weights + const auto weights_concat = + std::make_shared(OutputVector{emb_tbl_in, default_embeddings_node}, 0); + // Index in embedding table to fill empty bags + const auto weights_first_dim = std::make_shared( + std::make_shared(weights_shape_node, zero_const, zero_const)); + + embedding_bag = std::make_shared(weights_concat, + indices_in, + offsets_in, + weights_first_dim, // default index + per_sample_weights_in); + + } else { + OPENVINO_UNREACHABLE("Unsupported inputs configuration for ATen `embedding_bag` operation."); + } + // Enable import onnx Node with duplicated outputs + return OutputVector(node.get_outputs_size(), embedding_bag); +} + +} // namespace set_1 +} // namespace op +} // namespace onnx_import +} // namespace ngraph diff --git a/src/frontends/onnx/frontend/src/op/aten.hpp b/src/frontends/onnx/frontend/src/op/aten.hpp new file mode 100644 index 00000000000..89b0ea3e7c2 --- /dev/null +++ b/src/frontends/onnx/frontend/src/op/aten.hpp @@ -0,0 +1,21 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include "default_opset.hpp" +#include "ngraph/node.hpp" +#include "onnx_import/core/node.hpp" + +namespace ngraph { +namespace onnx_import { +namespace op { +namespace set_1 { + +OutputVector aten(const Node& node); + +} // namespace set_1 +} // namespace op +} // namespace onnx_import +} // namespace ngraph diff --git a/ngraph/frontend/onnx/frontend/src/op/average_pool.cpp b/src/frontends/onnx/frontend/src/op/average_pool.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/average_pool.cpp rename to src/frontends/onnx/frontend/src/op/average_pool.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/average_pool.hpp b/src/frontends/onnx/frontend/src/op/average_pool.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/average_pool.hpp rename to src/frontends/onnx/frontend/src/op/average_pool.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/batch_norm.cpp b/src/frontends/onnx/frontend/src/op/batch_norm.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/batch_norm.cpp rename to src/frontends/onnx/frontend/src/op/batch_norm.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/batch_norm.hpp b/src/frontends/onnx/frontend/src/op/batch_norm.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/batch_norm.hpp rename to src/frontends/onnx/frontend/src/op/batch_norm.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/bitshift.cpp b/src/frontends/onnx/frontend/src/op/bitshift.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/bitshift.cpp rename to src/frontends/onnx/frontend/src/op/bitshift.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/bitshift.hpp b/src/frontends/onnx/frontend/src/op/bitshift.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/bitshift.hpp rename to src/frontends/onnx/frontend/src/op/bitshift.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/cast.cpp b/src/frontends/onnx/frontend/src/op/cast.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/cast.cpp rename to src/frontends/onnx/frontend/src/op/cast.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/cast.hpp b/src/frontends/onnx/frontend/src/op/cast.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/cast.hpp rename to src/frontends/onnx/frontend/src/op/cast.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/cast_like.cpp b/src/frontends/onnx/frontend/src/op/cast_like.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/cast_like.cpp rename to src/frontends/onnx/frontend/src/op/cast_like.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/cast_like.hpp b/src/frontends/onnx/frontend/src/op/cast_like.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/cast_like.hpp rename to src/frontends/onnx/frontend/src/op/cast_like.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/ceil.hpp b/src/frontends/onnx/frontend/src/op/ceil.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/ceil.hpp rename to src/frontends/onnx/frontend/src/op/ceil.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/clip.cpp b/src/frontends/onnx/frontend/src/op/clip.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/clip.cpp rename to src/frontends/onnx/frontend/src/op/clip.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/clip.hpp b/src/frontends/onnx/frontend/src/op/clip.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/clip.hpp rename to src/frontends/onnx/frontend/src/op/clip.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/com.microsoft/attention.cpp b/src/frontends/onnx/frontend/src/op/com.microsoft/attention.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/com.microsoft/attention.cpp rename to src/frontends/onnx/frontend/src/op/com.microsoft/attention.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/com.microsoft/attention.hpp b/src/frontends/onnx/frontend/src/op/com.microsoft/attention.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/com.microsoft/attention.hpp rename to src/frontends/onnx/frontend/src/op/com.microsoft/attention.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/com.microsoft/bias_gelu.cpp b/src/frontends/onnx/frontend/src/op/com.microsoft/bias_gelu.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/com.microsoft/bias_gelu.cpp rename to src/frontends/onnx/frontend/src/op/com.microsoft/bias_gelu.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/com.microsoft/bias_gelu.hpp b/src/frontends/onnx/frontend/src/op/com.microsoft/bias_gelu.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/com.microsoft/bias_gelu.hpp rename to src/frontends/onnx/frontend/src/op/com.microsoft/bias_gelu.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/com.microsoft/embed_layer_normalization.cpp b/src/frontends/onnx/frontend/src/op/com.microsoft/embed_layer_normalization.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/com.microsoft/embed_layer_normalization.cpp rename to src/frontends/onnx/frontend/src/op/com.microsoft/embed_layer_normalization.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/com.microsoft/embed_layer_normalization.hpp b/src/frontends/onnx/frontend/src/op/com.microsoft/embed_layer_normalization.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/com.microsoft/embed_layer_normalization.hpp rename to src/frontends/onnx/frontend/src/op/com.microsoft/embed_layer_normalization.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/com.microsoft/skip_layer_normalization.cpp b/src/frontends/onnx/frontend/src/op/com.microsoft/skip_layer_normalization.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/com.microsoft/skip_layer_normalization.cpp rename to src/frontends/onnx/frontend/src/op/com.microsoft/skip_layer_normalization.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/com.microsoft/skip_layer_normalization.hpp b/src/frontends/onnx/frontend/src/op/com.microsoft/skip_layer_normalization.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/com.microsoft/skip_layer_normalization.hpp rename to src/frontends/onnx/frontend/src/op/com.microsoft/skip_layer_normalization.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/compress.cpp b/src/frontends/onnx/frontend/src/op/compress.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/compress.cpp rename to src/frontends/onnx/frontend/src/op/compress.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/compress.hpp b/src/frontends/onnx/frontend/src/op/compress.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/compress.hpp rename to src/frontends/onnx/frontend/src/op/compress.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/concat.cpp b/src/frontends/onnx/frontend/src/op/concat.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/concat.cpp rename to src/frontends/onnx/frontend/src/op/concat.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/concat.hpp b/src/frontends/onnx/frontend/src/op/concat.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/concat.hpp rename to src/frontends/onnx/frontend/src/op/concat.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/constant.cpp b/src/frontends/onnx/frontend/src/op/constant.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/constant.cpp rename to src/frontends/onnx/frontend/src/op/constant.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/constant.hpp b/src/frontends/onnx/frontend/src/op/constant.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/constant.hpp rename to src/frontends/onnx/frontend/src/op/constant.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/constant_fill.cpp b/src/frontends/onnx/frontend/src/op/constant_fill.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/constant_fill.cpp rename to src/frontends/onnx/frontend/src/op/constant_fill.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/constant_fill.hpp b/src/frontends/onnx/frontend/src/op/constant_fill.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/constant_fill.hpp rename to src/frontends/onnx/frontend/src/op/constant_fill.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/constant_of_shape.cpp b/src/frontends/onnx/frontend/src/op/constant_of_shape.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/constant_of_shape.cpp rename to src/frontends/onnx/frontend/src/op/constant_of_shape.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/constant_of_shape.hpp b/src/frontends/onnx/frontend/src/op/constant_of_shape.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/constant_of_shape.hpp rename to src/frontends/onnx/frontend/src/op/constant_of_shape.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/conv.cpp b/src/frontends/onnx/frontend/src/op/conv.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/conv.cpp rename to src/frontends/onnx/frontend/src/op/conv.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/conv.hpp b/src/frontends/onnx/frontend/src/op/conv.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/conv.hpp rename to src/frontends/onnx/frontend/src/op/conv.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/conv_integer.cpp b/src/frontends/onnx/frontend/src/op/conv_integer.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/conv_integer.cpp rename to src/frontends/onnx/frontend/src/op/conv_integer.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/conv_integer.hpp b/src/frontends/onnx/frontend/src/op/conv_integer.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/conv_integer.hpp rename to src/frontends/onnx/frontend/src/op/conv_integer.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/conv_transpose.cpp b/src/frontends/onnx/frontend/src/op/conv_transpose.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/conv_transpose.cpp rename to src/frontends/onnx/frontend/src/op/conv_transpose.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/conv_transpose.hpp b/src/frontends/onnx/frontend/src/op/conv_transpose.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/conv_transpose.hpp rename to src/frontends/onnx/frontend/src/op/conv_transpose.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/cos.cpp b/src/frontends/onnx/frontend/src/op/cos.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/cos.cpp rename to src/frontends/onnx/frontend/src/op/cos.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/cos.hpp b/src/frontends/onnx/frontend/src/op/cos.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/cos.hpp rename to src/frontends/onnx/frontend/src/op/cos.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/cosh.cpp b/src/frontends/onnx/frontend/src/op/cosh.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/cosh.cpp rename to src/frontends/onnx/frontend/src/op/cosh.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/cosh.hpp b/src/frontends/onnx/frontend/src/op/cosh.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/cosh.hpp rename to src/frontends/onnx/frontend/src/op/cosh.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/crop.cpp b/src/frontends/onnx/frontend/src/op/crop.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/crop.cpp rename to src/frontends/onnx/frontend/src/op/crop.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/crop.hpp b/src/frontends/onnx/frontend/src/op/crop.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/crop.hpp rename to src/frontends/onnx/frontend/src/op/crop.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/cum_sum.cpp b/src/frontends/onnx/frontend/src/op/cum_sum.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/cum_sum.cpp rename to src/frontends/onnx/frontend/src/op/cum_sum.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/cum_sum.hpp b/src/frontends/onnx/frontend/src/op/cum_sum.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/cum_sum.hpp rename to src/frontends/onnx/frontend/src/op/cum_sum.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/depth_to_space.cpp b/src/frontends/onnx/frontend/src/op/depth_to_space.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/depth_to_space.cpp rename to src/frontends/onnx/frontend/src/op/depth_to_space.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/depth_to_space.hpp b/src/frontends/onnx/frontend/src/op/depth_to_space.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/depth_to_space.hpp rename to src/frontends/onnx/frontend/src/op/depth_to_space.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/dequantize_linear.cpp b/src/frontends/onnx/frontend/src/op/dequantize_linear.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/dequantize_linear.cpp rename to src/frontends/onnx/frontend/src/op/dequantize_linear.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/dequantize_linear.hpp b/src/frontends/onnx/frontend/src/op/dequantize_linear.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/dequantize_linear.hpp rename to src/frontends/onnx/frontend/src/op/dequantize_linear.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/div.hpp b/src/frontends/onnx/frontend/src/op/div.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/div.hpp rename to src/frontends/onnx/frontend/src/op/div.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/dropout.cpp b/src/frontends/onnx/frontend/src/op/dropout.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/dropout.cpp rename to src/frontends/onnx/frontend/src/op/dropout.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/dropout.hpp b/src/frontends/onnx/frontend/src/op/dropout.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/dropout.hpp rename to src/frontends/onnx/frontend/src/op/dropout.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/einsum.cpp b/src/frontends/onnx/frontend/src/op/einsum.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/einsum.cpp rename to src/frontends/onnx/frontend/src/op/einsum.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/einsum.hpp b/src/frontends/onnx/frontend/src/op/einsum.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/einsum.hpp rename to src/frontends/onnx/frontend/src/op/einsum.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/elu.cpp b/src/frontends/onnx/frontend/src/op/elu.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/elu.cpp rename to src/frontends/onnx/frontend/src/op/elu.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/elu.hpp b/src/frontends/onnx/frontend/src/op/elu.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/elu.hpp rename to src/frontends/onnx/frontend/src/op/elu.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/equal.hpp b/src/frontends/onnx/frontend/src/op/equal.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/equal.hpp rename to src/frontends/onnx/frontend/src/op/equal.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/erf.hpp b/src/frontends/onnx/frontend/src/op/erf.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/erf.hpp rename to src/frontends/onnx/frontend/src/op/erf.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/exp.hpp b/src/frontends/onnx/frontend/src/op/exp.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/exp.hpp rename to src/frontends/onnx/frontend/src/op/exp.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/expand.cpp b/src/frontends/onnx/frontend/src/op/expand.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/expand.cpp rename to src/frontends/onnx/frontend/src/op/expand.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/expand.hpp b/src/frontends/onnx/frontend/src/op/expand.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/expand.hpp rename to src/frontends/onnx/frontend/src/op/expand.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/eye_like.cpp b/src/frontends/onnx/frontend/src/op/eye_like.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/eye_like.cpp rename to src/frontends/onnx/frontend/src/op/eye_like.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/eye_like.hpp b/src/frontends/onnx/frontend/src/op/eye_like.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/eye_like.hpp rename to src/frontends/onnx/frontend/src/op/eye_like.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/flatten.cpp b/src/frontends/onnx/frontend/src/op/flatten.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/flatten.cpp rename to src/frontends/onnx/frontend/src/op/flatten.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/flatten.hpp b/src/frontends/onnx/frontend/src/op/flatten.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/flatten.hpp rename to src/frontends/onnx/frontend/src/op/flatten.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/floor.hpp b/src/frontends/onnx/frontend/src/op/floor.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/floor.hpp rename to src/frontends/onnx/frontend/src/op/floor.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/gather.hpp b/src/frontends/onnx/frontend/src/op/gather.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/gather.hpp rename to src/frontends/onnx/frontend/src/op/gather.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/gather_elements.hpp b/src/frontends/onnx/frontend/src/op/gather_elements.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/gather_elements.hpp rename to src/frontends/onnx/frontend/src/op/gather_elements.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/gather_nd.cpp b/src/frontends/onnx/frontend/src/op/gather_nd.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/gather_nd.cpp rename to src/frontends/onnx/frontend/src/op/gather_nd.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/gather_nd.hpp b/src/frontends/onnx/frontend/src/op/gather_nd.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/gather_nd.hpp rename to src/frontends/onnx/frontend/src/op/gather_nd.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/gemm.cpp b/src/frontends/onnx/frontend/src/op/gemm.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/gemm.cpp rename to src/frontends/onnx/frontend/src/op/gemm.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/gemm.hpp b/src/frontends/onnx/frontend/src/op/gemm.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/gemm.hpp rename to src/frontends/onnx/frontend/src/op/gemm.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/global_average_pool.cpp b/src/frontends/onnx/frontend/src/op/global_average_pool.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/global_average_pool.cpp rename to src/frontends/onnx/frontend/src/op/global_average_pool.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/global_average_pool.hpp b/src/frontends/onnx/frontend/src/op/global_average_pool.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/global_average_pool.hpp rename to src/frontends/onnx/frontend/src/op/global_average_pool.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/global_max_pool.cpp b/src/frontends/onnx/frontend/src/op/global_max_pool.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/global_max_pool.cpp rename to src/frontends/onnx/frontend/src/op/global_max_pool.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/global_max_pool.hpp b/src/frontends/onnx/frontend/src/op/global_max_pool.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/global_max_pool.hpp rename to src/frontends/onnx/frontend/src/op/global_max_pool.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/greater.hpp b/src/frontends/onnx/frontend/src/op/greater.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/greater.hpp rename to src/frontends/onnx/frontend/src/op/greater.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/gru.cpp b/src/frontends/onnx/frontend/src/op/gru.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/gru.cpp rename to src/frontends/onnx/frontend/src/op/gru.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/gru.hpp b/src/frontends/onnx/frontend/src/op/gru.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/gru.hpp rename to src/frontends/onnx/frontend/src/op/gru.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/hard_sigmoid.cpp b/src/frontends/onnx/frontend/src/op/hard_sigmoid.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/hard_sigmoid.cpp rename to src/frontends/onnx/frontend/src/op/hard_sigmoid.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/hard_sigmoid.hpp b/src/frontends/onnx/frontend/src/op/hard_sigmoid.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/hard_sigmoid.hpp rename to src/frontends/onnx/frontend/src/op/hard_sigmoid.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/hard_swish.hpp b/src/frontends/onnx/frontend/src/op/hard_swish.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/hard_swish.hpp rename to src/frontends/onnx/frontend/src/op/hard_swish.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/hardmax.cpp b/src/frontends/onnx/frontend/src/op/hardmax.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/hardmax.cpp rename to src/frontends/onnx/frontend/src/op/hardmax.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/hardmax.hpp b/src/frontends/onnx/frontend/src/op/hardmax.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/hardmax.hpp rename to src/frontends/onnx/frontend/src/op/hardmax.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/identity.hpp b/src/frontends/onnx/frontend/src/op/identity.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/identity.hpp rename to src/frontends/onnx/frontend/src/op/identity.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/if.cpp b/src/frontends/onnx/frontend/src/op/if.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/if.cpp rename to src/frontends/onnx/frontend/src/op/if.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/if.hpp b/src/frontends/onnx/frontend/src/op/if.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/if.hpp rename to src/frontends/onnx/frontend/src/op/if.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/image_scaler.cpp b/src/frontends/onnx/frontend/src/op/image_scaler.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/image_scaler.cpp rename to src/frontends/onnx/frontend/src/op/image_scaler.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/image_scaler.hpp b/src/frontends/onnx/frontend/src/op/image_scaler.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/image_scaler.hpp rename to src/frontends/onnx/frontend/src/op/image_scaler.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/instance_norm.cpp b/src/frontends/onnx/frontend/src/op/instance_norm.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/instance_norm.cpp rename to src/frontends/onnx/frontend/src/op/instance_norm.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/instance_norm.hpp b/src/frontends/onnx/frontend/src/op/instance_norm.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/instance_norm.hpp rename to src/frontends/onnx/frontend/src/op/instance_norm.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/leaky_relu.cpp b/src/frontends/onnx/frontend/src/op/leaky_relu.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/leaky_relu.cpp rename to src/frontends/onnx/frontend/src/op/leaky_relu.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/leaky_relu.hpp b/src/frontends/onnx/frontend/src/op/leaky_relu.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/leaky_relu.hpp rename to src/frontends/onnx/frontend/src/op/leaky_relu.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/less.hpp b/src/frontends/onnx/frontend/src/op/less.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/less.hpp rename to src/frontends/onnx/frontend/src/op/less.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/log.cpp b/src/frontends/onnx/frontend/src/op/log.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/log.cpp rename to src/frontends/onnx/frontend/src/op/log.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/log.hpp b/src/frontends/onnx/frontend/src/op/log.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/log.hpp rename to src/frontends/onnx/frontend/src/op/log.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/log_softmax.cpp b/src/frontends/onnx/frontend/src/op/log_softmax.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/log_softmax.cpp rename to src/frontends/onnx/frontend/src/op/log_softmax.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/log_softmax.hpp b/src/frontends/onnx/frontend/src/op/log_softmax.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/log_softmax.hpp rename to src/frontends/onnx/frontend/src/op/log_softmax.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/loop.cpp b/src/frontends/onnx/frontend/src/op/loop.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/loop.cpp rename to src/frontends/onnx/frontend/src/op/loop.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/loop.hpp b/src/frontends/onnx/frontend/src/op/loop.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/loop.hpp rename to src/frontends/onnx/frontend/src/op/loop.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/lp_norm.cpp b/src/frontends/onnx/frontend/src/op/lp_norm.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/lp_norm.cpp rename to src/frontends/onnx/frontend/src/op/lp_norm.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/lp_norm.hpp b/src/frontends/onnx/frontend/src/op/lp_norm.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/lp_norm.hpp rename to src/frontends/onnx/frontend/src/op/lp_norm.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/lp_pool.cpp b/src/frontends/onnx/frontend/src/op/lp_pool.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/lp_pool.cpp rename to src/frontends/onnx/frontend/src/op/lp_pool.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/lp_pool.hpp b/src/frontends/onnx/frontend/src/op/lp_pool.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/lp_pool.hpp rename to src/frontends/onnx/frontend/src/op/lp_pool.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/lrn.cpp b/src/frontends/onnx/frontend/src/op/lrn.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/lrn.cpp rename to src/frontends/onnx/frontend/src/op/lrn.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/lrn.hpp b/src/frontends/onnx/frontend/src/op/lrn.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/lrn.hpp rename to src/frontends/onnx/frontend/src/op/lrn.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/lstm.cpp b/src/frontends/onnx/frontend/src/op/lstm.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/lstm.cpp rename to src/frontends/onnx/frontend/src/op/lstm.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/lstm.hpp b/src/frontends/onnx/frontend/src/op/lstm.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/lstm.hpp rename to src/frontends/onnx/frontend/src/op/lstm.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/matmul.hpp b/src/frontends/onnx/frontend/src/op/matmul.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/matmul.hpp rename to src/frontends/onnx/frontend/src/op/matmul.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/matmul_integer.cpp b/src/frontends/onnx/frontend/src/op/matmul_integer.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/matmul_integer.cpp rename to src/frontends/onnx/frontend/src/op/matmul_integer.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/matmul_integer.hpp b/src/frontends/onnx/frontend/src/op/matmul_integer.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/matmul_integer.hpp rename to src/frontends/onnx/frontend/src/op/matmul_integer.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/max.hpp b/src/frontends/onnx/frontend/src/op/max.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/max.hpp rename to src/frontends/onnx/frontend/src/op/max.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/max_pool.cpp b/src/frontends/onnx/frontend/src/op/max_pool.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/max_pool.cpp rename to src/frontends/onnx/frontend/src/op/max_pool.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/max_pool.hpp b/src/frontends/onnx/frontend/src/op/max_pool.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/max_pool.hpp rename to src/frontends/onnx/frontend/src/op/max_pool.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/mean.cpp b/src/frontends/onnx/frontend/src/op/mean.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/mean.cpp rename to src/frontends/onnx/frontend/src/op/mean.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/mean.hpp b/src/frontends/onnx/frontend/src/op/mean.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/mean.hpp rename to src/frontends/onnx/frontend/src/op/mean.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/mean_variance_normalization.cpp b/src/frontends/onnx/frontend/src/op/mean_variance_normalization.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/mean_variance_normalization.cpp rename to src/frontends/onnx/frontend/src/op/mean_variance_normalization.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/mean_variance_normalization.hpp b/src/frontends/onnx/frontend/src/op/mean_variance_normalization.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/mean_variance_normalization.hpp rename to src/frontends/onnx/frontend/src/op/mean_variance_normalization.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/min.hpp b/src/frontends/onnx/frontend/src/op/min.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/min.hpp rename to src/frontends/onnx/frontend/src/op/min.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/mod.cpp b/src/frontends/onnx/frontend/src/op/mod.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/mod.cpp rename to src/frontends/onnx/frontend/src/op/mod.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/mod.hpp b/src/frontends/onnx/frontend/src/op/mod.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/mod.hpp rename to src/frontends/onnx/frontend/src/op/mod.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/mul.hpp b/src/frontends/onnx/frontend/src/op/mul.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/mul.hpp rename to src/frontends/onnx/frontend/src/op/mul.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/neg.hpp b/src/frontends/onnx/frontend/src/op/neg.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/neg.hpp rename to src/frontends/onnx/frontend/src/op/neg.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/non_max_suppression.cpp b/src/frontends/onnx/frontend/src/op/non_max_suppression.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/non_max_suppression.cpp rename to src/frontends/onnx/frontend/src/op/non_max_suppression.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/non_max_suppression.hpp b/src/frontends/onnx/frontend/src/op/non_max_suppression.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/non_max_suppression.hpp rename to src/frontends/onnx/frontend/src/op/non_max_suppression.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/non_zero.cpp b/src/frontends/onnx/frontend/src/op/non_zero.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/non_zero.cpp rename to src/frontends/onnx/frontend/src/op/non_zero.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/non_zero.hpp b/src/frontends/onnx/frontend/src/op/non_zero.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/non_zero.hpp rename to src/frontends/onnx/frontend/src/op/non_zero.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/not.hpp b/src/frontends/onnx/frontend/src/op/not.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/not.hpp rename to src/frontends/onnx/frontend/src/op/not.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/onehot.cpp b/src/frontends/onnx/frontend/src/op/onehot.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/onehot.cpp rename to src/frontends/onnx/frontend/src/op/onehot.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/onehot.hpp b/src/frontends/onnx/frontend/src/op/onehot.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/onehot.hpp rename to src/frontends/onnx/frontend/src/op/onehot.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/or.hpp b/src/frontends/onnx/frontend/src/op/or.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/or.hpp rename to src/frontends/onnx/frontend/src/op/or.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/org.openvinotoolkit/deformable_conv_2d.cpp b/src/frontends/onnx/frontend/src/op/org.openvinotoolkit/deformable_conv_2d.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/org.openvinotoolkit/deformable_conv_2d.cpp rename to src/frontends/onnx/frontend/src/op/org.openvinotoolkit/deformable_conv_2d.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/org.openvinotoolkit/deformable_conv_2d.hpp b/src/frontends/onnx/frontend/src/op/org.openvinotoolkit/deformable_conv_2d.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/org.openvinotoolkit/deformable_conv_2d.hpp rename to src/frontends/onnx/frontend/src/op/org.openvinotoolkit/deformable_conv_2d.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/org.openvinotoolkit/detection_output.cpp b/src/frontends/onnx/frontend/src/op/org.openvinotoolkit/detection_output.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/org.openvinotoolkit/detection_output.cpp rename to src/frontends/onnx/frontend/src/op/org.openvinotoolkit/detection_output.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/org.openvinotoolkit/detection_output.hpp b/src/frontends/onnx/frontend/src/op/org.openvinotoolkit/detection_output.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/org.openvinotoolkit/detection_output.hpp rename to src/frontends/onnx/frontend/src/op/org.openvinotoolkit/detection_output.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/org.openvinotoolkit/experimental_detectron/detection_output.cpp b/src/frontends/onnx/frontend/src/op/org.openvinotoolkit/experimental_detectron/detection_output.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/org.openvinotoolkit/experimental_detectron/detection_output.cpp rename to src/frontends/onnx/frontend/src/op/org.openvinotoolkit/experimental_detectron/detection_output.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/org.openvinotoolkit/experimental_detectron/detection_output.hpp b/src/frontends/onnx/frontend/src/op/org.openvinotoolkit/experimental_detectron/detection_output.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/org.openvinotoolkit/experimental_detectron/detection_output.hpp rename to src/frontends/onnx/frontend/src/op/org.openvinotoolkit/experimental_detectron/detection_output.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/org.openvinotoolkit/experimental_detectron/generate_proposals_single_image.cpp b/src/frontends/onnx/frontend/src/op/org.openvinotoolkit/experimental_detectron/generate_proposals_single_image.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/org.openvinotoolkit/experimental_detectron/generate_proposals_single_image.cpp rename to src/frontends/onnx/frontend/src/op/org.openvinotoolkit/experimental_detectron/generate_proposals_single_image.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/org.openvinotoolkit/experimental_detectron/generate_proposals_single_image.hpp b/src/frontends/onnx/frontend/src/op/org.openvinotoolkit/experimental_detectron/generate_proposals_single_image.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/org.openvinotoolkit/experimental_detectron/generate_proposals_single_image.hpp rename to src/frontends/onnx/frontend/src/op/org.openvinotoolkit/experimental_detectron/generate_proposals_single_image.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/org.openvinotoolkit/experimental_detectron/prior_grid_generator.cpp b/src/frontends/onnx/frontend/src/op/org.openvinotoolkit/experimental_detectron/prior_grid_generator.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/org.openvinotoolkit/experimental_detectron/prior_grid_generator.cpp rename to src/frontends/onnx/frontend/src/op/org.openvinotoolkit/experimental_detectron/prior_grid_generator.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/org.openvinotoolkit/experimental_detectron/prior_grid_generator.hpp b/src/frontends/onnx/frontend/src/op/org.openvinotoolkit/experimental_detectron/prior_grid_generator.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/org.openvinotoolkit/experimental_detectron/prior_grid_generator.hpp rename to src/frontends/onnx/frontend/src/op/org.openvinotoolkit/experimental_detectron/prior_grid_generator.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/org.openvinotoolkit/experimental_detectron/roi_feature_extractor.cpp b/src/frontends/onnx/frontend/src/op/org.openvinotoolkit/experimental_detectron/roi_feature_extractor.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/org.openvinotoolkit/experimental_detectron/roi_feature_extractor.cpp rename to src/frontends/onnx/frontend/src/op/org.openvinotoolkit/experimental_detectron/roi_feature_extractor.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/org.openvinotoolkit/experimental_detectron/roi_feature_extractor.hpp b/src/frontends/onnx/frontend/src/op/org.openvinotoolkit/experimental_detectron/roi_feature_extractor.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/org.openvinotoolkit/experimental_detectron/roi_feature_extractor.hpp rename to src/frontends/onnx/frontend/src/op/org.openvinotoolkit/experimental_detectron/roi_feature_extractor.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/org.openvinotoolkit/experimental_detectron/topk_rios.cpp b/src/frontends/onnx/frontend/src/op/org.openvinotoolkit/experimental_detectron/topk_rios.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/org.openvinotoolkit/experimental_detectron/topk_rios.cpp rename to src/frontends/onnx/frontend/src/op/org.openvinotoolkit/experimental_detectron/topk_rios.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/org.openvinotoolkit/experimental_detectron/topk_rios.hpp b/src/frontends/onnx/frontend/src/op/org.openvinotoolkit/experimental_detectron/topk_rios.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/org.openvinotoolkit/experimental_detectron/topk_rios.hpp rename to src/frontends/onnx/frontend/src/op/org.openvinotoolkit/experimental_detectron/topk_rios.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/org.openvinotoolkit/fake_quantize.cpp b/src/frontends/onnx/frontend/src/op/org.openvinotoolkit/fake_quantize.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/org.openvinotoolkit/fake_quantize.cpp rename to src/frontends/onnx/frontend/src/op/org.openvinotoolkit/fake_quantize.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/org.openvinotoolkit/fake_quantize.hpp b/src/frontends/onnx/frontend/src/op/org.openvinotoolkit/fake_quantize.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/org.openvinotoolkit/fake_quantize.hpp rename to src/frontends/onnx/frontend/src/op/org.openvinotoolkit/fake_quantize.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/org.openvinotoolkit/group_norm.cpp b/src/frontends/onnx/frontend/src/op/org.openvinotoolkit/group_norm.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/org.openvinotoolkit/group_norm.cpp rename to src/frontends/onnx/frontend/src/op/org.openvinotoolkit/group_norm.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/org.openvinotoolkit/group_norm.hpp b/src/frontends/onnx/frontend/src/op/org.openvinotoolkit/group_norm.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/org.openvinotoolkit/group_norm.hpp rename to src/frontends/onnx/frontend/src/op/org.openvinotoolkit/group_norm.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/org.openvinotoolkit/normalize.cpp b/src/frontends/onnx/frontend/src/op/org.openvinotoolkit/normalize.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/org.openvinotoolkit/normalize.cpp rename to src/frontends/onnx/frontend/src/op/org.openvinotoolkit/normalize.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/org.openvinotoolkit/normalize.hpp b/src/frontends/onnx/frontend/src/op/org.openvinotoolkit/normalize.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/org.openvinotoolkit/normalize.hpp rename to src/frontends/onnx/frontend/src/op/org.openvinotoolkit/normalize.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/org.openvinotoolkit/prior_box.cpp b/src/frontends/onnx/frontend/src/op/org.openvinotoolkit/prior_box.cpp similarity index 96% rename from ngraph/frontend/onnx/frontend/src/op/org.openvinotoolkit/prior_box.cpp rename to src/frontends/onnx/frontend/src/op/org.openvinotoolkit/prior_box.cpp index 5b178eb96cc..52a28e525e8 100644 --- a/ngraph/frontend/onnx/frontend/src/op/org.openvinotoolkit/prior_box.cpp +++ b/src/frontends/onnx/frontend/src/op/org.openvinotoolkit/prior_box.cpp @@ -38,7 +38,7 @@ OutputVector prior_box(const Node& node) { auto output_shape_slice = detail::make_slice(output_shape, 2, 4); auto image_shape_slice = detail::make_slice(image_shape, 2, 4); - ngraph::op::PriorBoxAttrs attrs; + ngraph::op::v0::PriorBox::Attributes attrs; attrs.min_size = node.get_attribute_value>("min_size", {}); attrs.max_size = node.get_attribute_value>("max_size", {}); attrs.aspect_ratio = node.get_attribute_value>("aspect_ratio", {}); @@ -55,7 +55,7 @@ OutputVector prior_box(const Node& node) { auto axes = default_opset::Constant::create(element::i64, Shape{1}, std::vector{0}); return {std::make_shared( - std::make_shared(output_shape_slice, image_shape_slice, attrs), + std::make_shared(output_shape_slice, image_shape_slice, attrs), axes)}; } diff --git a/ngraph/frontend/onnx/frontend/src/op/org.openvinotoolkit/prior_box.hpp b/src/frontends/onnx/frontend/src/op/org.openvinotoolkit/prior_box.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/org.openvinotoolkit/prior_box.hpp rename to src/frontends/onnx/frontend/src/op/org.openvinotoolkit/prior_box.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/org.openvinotoolkit/swish.cpp b/src/frontends/onnx/frontend/src/op/org.openvinotoolkit/swish.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/org.openvinotoolkit/swish.cpp rename to src/frontends/onnx/frontend/src/op/org.openvinotoolkit/swish.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/org.openvinotoolkit/swish.hpp b/src/frontends/onnx/frontend/src/op/org.openvinotoolkit/swish.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/org.openvinotoolkit/swish.hpp rename to src/frontends/onnx/frontend/src/op/org.openvinotoolkit/swish.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/pad.cpp b/src/frontends/onnx/frontend/src/op/pad.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/pad.cpp rename to src/frontends/onnx/frontend/src/op/pad.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/pad.hpp b/src/frontends/onnx/frontend/src/op/pad.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/pad.hpp rename to src/frontends/onnx/frontend/src/op/pad.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/pow.cpp b/src/frontends/onnx/frontend/src/op/pow.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/pow.cpp rename to src/frontends/onnx/frontend/src/op/pow.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/pow.hpp b/src/frontends/onnx/frontend/src/op/pow.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/pow.hpp rename to src/frontends/onnx/frontend/src/op/pow.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/prelu.cpp b/src/frontends/onnx/frontend/src/op/prelu.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/prelu.cpp rename to src/frontends/onnx/frontend/src/op/prelu.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/prelu.hpp b/src/frontends/onnx/frontend/src/op/prelu.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/prelu.hpp rename to src/frontends/onnx/frontend/src/op/prelu.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/qlinear_conv.cpp b/src/frontends/onnx/frontend/src/op/qlinear_conv.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/qlinear_conv.cpp rename to src/frontends/onnx/frontend/src/op/qlinear_conv.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/qlinear_conv.hpp b/src/frontends/onnx/frontend/src/op/qlinear_conv.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/qlinear_conv.hpp rename to src/frontends/onnx/frontend/src/op/qlinear_conv.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/qlinear_matmul.cpp b/src/frontends/onnx/frontend/src/op/qlinear_matmul.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/qlinear_matmul.cpp rename to src/frontends/onnx/frontend/src/op/qlinear_matmul.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/qlinear_matmul.hpp b/src/frontends/onnx/frontend/src/op/qlinear_matmul.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/qlinear_matmul.hpp rename to src/frontends/onnx/frontend/src/op/qlinear_matmul.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/quant_conv.cpp b/src/frontends/onnx/frontend/src/op/quant_conv.cpp similarity index 95% rename from ngraph/frontend/onnx/frontend/src/op/quant_conv.cpp rename to src/frontends/onnx/frontend/src/op/quant_conv.cpp index fe359f3cd91..4f2e180012a 100644 --- a/ngraph/frontend/onnx/frontend/src/op/quant_conv.cpp +++ b/src/frontends/onnx/frontend/src/op/quant_conv.cpp @@ -2,22 +2,25 @@ // SPDX-License-Identifier: Apache-2.0 // -// Disabled in CMakeList -// Update to higher opset required +// Disabled in CMakeLists.txt +// Update to higher opset is required -#include -#include -#include +#if 0 -#include "default_opset.hpp" -#include "exceptions.hpp" -#include "ngraph/builder/quantization/quantized_linear_convolution.hpp" -#include "ngraph/coordinate_diff.hpp" -#include "ngraph/frontend/onnx_import/utils/convpool.hpp" -#include "ngraph/op/util/attr_types.hpp" -#include "ngraph/opsets/opset0.hpp" -#include "ngraph/strides.hpp" -#include "op/quant_conv.hpp" +# include "op/quant_conv.hpp" + +# include +# include +# include + +# include "default_opset.hpp" +# include "exceptions.hpp" +# include "ngraph/builder/quantization/quantized_linear_convolution.hpp" +# include "ngraph/coordinate_diff.hpp" +# include "ngraph/frontend/onnx_import/utils/convpool.hpp" +# include "ngraph/op/util/attr_types.hpp" +# include "ngraph/opsets/opset0.hpp" +# include "ngraph/strides.hpp" namespace ngraph { @@ -269,3 +272,5 @@ namespace ngraph } // namespace onnx_import } // namespace ngraph + +#endif diff --git a/src/frontends/onnx/frontend/src/op/quant_conv.hpp b/src/frontends/onnx/frontend/src/op/quant_conv.hpp new file mode 100644 index 00000000000..8df3eba0f2b --- /dev/null +++ b/src/frontends/onnx/frontend/src/op/quant_conv.hpp @@ -0,0 +1,31 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +// Disabled in CMakeList +// Update to higher opset required + +#pragma once + +#include "ngraph/node.hpp" +#include "onnx_import/core/node.hpp" + +namespace ngraph { +namespace onnx_import { +namespace op { +namespace set_1 { +/// \brief Performs ONNX Quant Conv operation. +/// +/// \param node The ONNX node object representing this operation. +/// +/// \return The vector containing Ngraph nodes producing output of ONNX quantizied +/// convolution operation. +OutputVector quant_conv(const Node& node); + +} // namespace set_1 + +} // namespace op + +} // namespace onnx_import + +} // namespace ngraph diff --git a/ngraph/frontend/onnx/frontend/src/op/quantize_linear.cpp b/src/frontends/onnx/frontend/src/op/quantize_linear.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/quantize_linear.cpp rename to src/frontends/onnx/frontend/src/op/quantize_linear.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/quantize_linear.hpp b/src/frontends/onnx/frontend/src/op/quantize_linear.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/quantize_linear.hpp rename to src/frontends/onnx/frontend/src/op/quantize_linear.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/random_normal.cpp b/src/frontends/onnx/frontend/src/op/random_normal.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/random_normal.cpp rename to src/frontends/onnx/frontend/src/op/random_normal.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/random_normal.hpp b/src/frontends/onnx/frontend/src/op/random_normal.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/random_normal.hpp rename to src/frontends/onnx/frontend/src/op/random_normal.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/random_normal_like.cpp b/src/frontends/onnx/frontend/src/op/random_normal_like.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/random_normal_like.cpp rename to src/frontends/onnx/frontend/src/op/random_normal_like.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/random_normal_like.hpp b/src/frontends/onnx/frontend/src/op/random_normal_like.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/random_normal_like.hpp rename to src/frontends/onnx/frontend/src/op/random_normal_like.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/random_uniform.cpp b/src/frontends/onnx/frontend/src/op/random_uniform.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/random_uniform.cpp rename to src/frontends/onnx/frontend/src/op/random_uniform.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/random_uniform.hpp b/src/frontends/onnx/frontend/src/op/random_uniform.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/random_uniform.hpp rename to src/frontends/onnx/frontend/src/op/random_uniform.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/random_uniform_like.cpp b/src/frontends/onnx/frontend/src/op/random_uniform_like.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/random_uniform_like.cpp rename to src/frontends/onnx/frontend/src/op/random_uniform_like.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/random_uniform_like.hpp b/src/frontends/onnx/frontend/src/op/random_uniform_like.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/random_uniform_like.hpp rename to src/frontends/onnx/frontend/src/op/random_uniform_like.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/range.cpp b/src/frontends/onnx/frontend/src/op/range.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/range.cpp rename to src/frontends/onnx/frontend/src/op/range.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/range.hpp b/src/frontends/onnx/frontend/src/op/range.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/range.hpp rename to src/frontends/onnx/frontend/src/op/range.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/reciprocal.cpp b/src/frontends/onnx/frontend/src/op/reciprocal.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/reciprocal.cpp rename to src/frontends/onnx/frontend/src/op/reciprocal.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/reciprocal.hpp b/src/frontends/onnx/frontend/src/op/reciprocal.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/reciprocal.hpp rename to src/frontends/onnx/frontend/src/op/reciprocal.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/reduce.cpp b/src/frontends/onnx/frontend/src/op/reduce.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/reduce.cpp rename to src/frontends/onnx/frontend/src/op/reduce.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/reduce.hpp b/src/frontends/onnx/frontend/src/op/reduce.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/reduce.hpp rename to src/frontends/onnx/frontend/src/op/reduce.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/relu.hpp b/src/frontends/onnx/frontend/src/op/relu.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/relu.hpp rename to src/frontends/onnx/frontend/src/op/relu.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/reshape.cpp b/src/frontends/onnx/frontend/src/op/reshape.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/reshape.cpp rename to src/frontends/onnx/frontend/src/op/reshape.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/reshape.hpp b/src/frontends/onnx/frontend/src/op/reshape.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/reshape.hpp rename to src/frontends/onnx/frontend/src/op/reshape.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/resize.cpp b/src/frontends/onnx/frontend/src/op/resize.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/resize.cpp rename to src/frontends/onnx/frontend/src/op/resize.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/resize.hpp b/src/frontends/onnx/frontend/src/op/resize.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/resize.hpp rename to src/frontends/onnx/frontend/src/op/resize.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/reverse_sequence.cpp b/src/frontends/onnx/frontend/src/op/reverse_sequence.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/reverse_sequence.cpp rename to src/frontends/onnx/frontend/src/op/reverse_sequence.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/reverse_sequence.hpp b/src/frontends/onnx/frontend/src/op/reverse_sequence.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/reverse_sequence.hpp rename to src/frontends/onnx/frontend/src/op/reverse_sequence.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/rnn.cpp b/src/frontends/onnx/frontend/src/op/rnn.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/rnn.cpp rename to src/frontends/onnx/frontend/src/op/rnn.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/rnn.hpp b/src/frontends/onnx/frontend/src/op/rnn.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/rnn.hpp rename to src/frontends/onnx/frontend/src/op/rnn.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/roi_align.cpp b/src/frontends/onnx/frontend/src/op/roi_align.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/roi_align.cpp rename to src/frontends/onnx/frontend/src/op/roi_align.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/roi_align.hpp b/src/frontends/onnx/frontend/src/op/roi_align.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/roi_align.hpp rename to src/frontends/onnx/frontend/src/op/roi_align.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/round.cpp b/src/frontends/onnx/frontend/src/op/round.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/round.cpp rename to src/frontends/onnx/frontend/src/op/round.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/round.hpp b/src/frontends/onnx/frontend/src/op/round.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/round.hpp rename to src/frontends/onnx/frontend/src/op/round.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/scatter_elements.cpp b/src/frontends/onnx/frontend/src/op/scatter_elements.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/scatter_elements.cpp rename to src/frontends/onnx/frontend/src/op/scatter_elements.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/scatter_elements.hpp b/src/frontends/onnx/frontend/src/op/scatter_elements.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/scatter_elements.hpp rename to src/frontends/onnx/frontend/src/op/scatter_elements.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/scatter_nd.cpp b/src/frontends/onnx/frontend/src/op/scatter_nd.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/scatter_nd.cpp rename to src/frontends/onnx/frontend/src/op/scatter_nd.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/scatter_nd.hpp b/src/frontends/onnx/frontend/src/op/scatter_nd.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/scatter_nd.hpp rename to src/frontends/onnx/frontend/src/op/scatter_nd.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/selu.cpp b/src/frontends/onnx/frontend/src/op/selu.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/selu.cpp rename to src/frontends/onnx/frontend/src/op/selu.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/selu.hpp b/src/frontends/onnx/frontend/src/op/selu.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/selu.hpp rename to src/frontends/onnx/frontend/src/op/selu.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/shape.cpp b/src/frontends/onnx/frontend/src/op/shape.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/shape.cpp rename to src/frontends/onnx/frontend/src/op/shape.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/shape.hpp b/src/frontends/onnx/frontend/src/op/shape.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/shape.hpp rename to src/frontends/onnx/frontend/src/op/shape.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/shrink.cpp b/src/frontends/onnx/frontend/src/op/shrink.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/shrink.cpp rename to src/frontends/onnx/frontend/src/op/shrink.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/shrink.hpp b/src/frontends/onnx/frontend/src/op/shrink.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/shrink.hpp rename to src/frontends/onnx/frontend/src/op/shrink.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/sigmoid.hpp b/src/frontends/onnx/frontend/src/op/sigmoid.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/sigmoid.hpp rename to src/frontends/onnx/frontend/src/op/sigmoid.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/sign.hpp b/src/frontends/onnx/frontend/src/op/sign.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/sign.hpp rename to src/frontends/onnx/frontend/src/op/sign.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/sin.hpp b/src/frontends/onnx/frontend/src/op/sin.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/sin.hpp rename to src/frontends/onnx/frontend/src/op/sin.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/sinh.hpp b/src/frontends/onnx/frontend/src/op/sinh.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/sinh.hpp rename to src/frontends/onnx/frontend/src/op/sinh.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/size.cpp b/src/frontends/onnx/frontend/src/op/size.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/size.cpp rename to src/frontends/onnx/frontend/src/op/size.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/size.hpp b/src/frontends/onnx/frontend/src/op/size.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/size.hpp rename to src/frontends/onnx/frontend/src/op/size.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/slice.cpp b/src/frontends/onnx/frontend/src/op/slice.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/slice.cpp rename to src/frontends/onnx/frontend/src/op/slice.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/slice.hpp b/src/frontends/onnx/frontend/src/op/slice.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/slice.hpp rename to src/frontends/onnx/frontend/src/op/slice.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/softmax.cpp b/src/frontends/onnx/frontend/src/op/softmax.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/softmax.cpp rename to src/frontends/onnx/frontend/src/op/softmax.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/softmax.hpp b/src/frontends/onnx/frontend/src/op/softmax.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/softmax.hpp rename to src/frontends/onnx/frontend/src/op/softmax.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/softplus.cpp b/src/frontends/onnx/frontend/src/op/softplus.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/softplus.cpp rename to src/frontends/onnx/frontend/src/op/softplus.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/softplus.hpp b/src/frontends/onnx/frontend/src/op/softplus.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/softplus.hpp rename to src/frontends/onnx/frontend/src/op/softplus.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/softsign.cpp b/src/frontends/onnx/frontend/src/op/softsign.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/softsign.cpp rename to src/frontends/onnx/frontend/src/op/softsign.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/softsign.hpp b/src/frontends/onnx/frontend/src/op/softsign.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/softsign.hpp rename to src/frontends/onnx/frontend/src/op/softsign.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/space_to_depth.cpp b/src/frontends/onnx/frontend/src/op/space_to_depth.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/space_to_depth.cpp rename to src/frontends/onnx/frontend/src/op/space_to_depth.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/space_to_depth.hpp b/src/frontends/onnx/frontend/src/op/space_to_depth.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/space_to_depth.hpp rename to src/frontends/onnx/frontend/src/op/space_to_depth.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/split.cpp b/src/frontends/onnx/frontend/src/op/split.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/split.cpp rename to src/frontends/onnx/frontend/src/op/split.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/split.hpp b/src/frontends/onnx/frontend/src/op/split.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/split.hpp rename to src/frontends/onnx/frontend/src/op/split.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/sqrt.hpp b/src/frontends/onnx/frontend/src/op/sqrt.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/sqrt.hpp rename to src/frontends/onnx/frontend/src/op/sqrt.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/squeeze.cpp b/src/frontends/onnx/frontend/src/op/squeeze.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/squeeze.cpp rename to src/frontends/onnx/frontend/src/op/squeeze.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/squeeze.hpp b/src/frontends/onnx/frontend/src/op/squeeze.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/squeeze.hpp rename to src/frontends/onnx/frontend/src/op/squeeze.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/sub.hpp b/src/frontends/onnx/frontend/src/op/sub.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/sub.hpp rename to src/frontends/onnx/frontend/src/op/sub.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/sum.hpp b/src/frontends/onnx/frontend/src/op/sum.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/sum.hpp rename to src/frontends/onnx/frontend/src/op/sum.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/tan.hpp b/src/frontends/onnx/frontend/src/op/tan.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/tan.hpp rename to src/frontends/onnx/frontend/src/op/tan.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/tanh.hpp b/src/frontends/onnx/frontend/src/op/tanh.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/tanh.hpp rename to src/frontends/onnx/frontend/src/op/tanh.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/thresholded_relu.cpp b/src/frontends/onnx/frontend/src/op/thresholded_relu.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/thresholded_relu.cpp rename to src/frontends/onnx/frontend/src/op/thresholded_relu.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/thresholded_relu.hpp b/src/frontends/onnx/frontend/src/op/thresholded_relu.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/thresholded_relu.hpp rename to src/frontends/onnx/frontend/src/op/thresholded_relu.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/tile.cpp b/src/frontends/onnx/frontend/src/op/tile.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/tile.cpp rename to src/frontends/onnx/frontend/src/op/tile.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/tile.hpp b/src/frontends/onnx/frontend/src/op/tile.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/tile.hpp rename to src/frontends/onnx/frontend/src/op/tile.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/topk.cpp b/src/frontends/onnx/frontend/src/op/topk.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/topk.cpp rename to src/frontends/onnx/frontend/src/op/topk.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/topk.hpp b/src/frontends/onnx/frontend/src/op/topk.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/topk.hpp rename to src/frontends/onnx/frontend/src/op/topk.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/transpose.cpp b/src/frontends/onnx/frontend/src/op/transpose.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/transpose.cpp rename to src/frontends/onnx/frontend/src/op/transpose.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/transpose.hpp b/src/frontends/onnx/frontend/src/op/transpose.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/transpose.hpp rename to src/frontends/onnx/frontend/src/op/transpose.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/unsqueeze.cpp b/src/frontends/onnx/frontend/src/op/unsqueeze.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/unsqueeze.cpp rename to src/frontends/onnx/frontend/src/op/unsqueeze.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/unsqueeze.hpp b/src/frontends/onnx/frontend/src/op/unsqueeze.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/unsqueeze.hpp rename to src/frontends/onnx/frontend/src/op/unsqueeze.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/upsample.cpp b/src/frontends/onnx/frontend/src/op/upsample.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/upsample.cpp rename to src/frontends/onnx/frontend/src/op/upsample.cpp diff --git a/ngraph/frontend/onnx/frontend/src/op/upsample.hpp b/src/frontends/onnx/frontend/src/op/upsample.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/upsample.hpp rename to src/frontends/onnx/frontend/src/op/upsample.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/where.hpp b/src/frontends/onnx/frontend/src/op/where.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/where.hpp rename to src/frontends/onnx/frontend/src/op/where.hpp diff --git a/ngraph/frontend/onnx/frontend/src/op/xor.hpp b/src/frontends/onnx/frontend/src/op/xor.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/op/xor.hpp rename to src/frontends/onnx/frontend/src/op/xor.hpp diff --git a/ngraph/frontend/onnx/frontend/src/ops_bridge.cpp b/src/frontends/onnx/frontend/src/ops_bridge.cpp similarity index 99% rename from ngraph/frontend/onnx/frontend/src/ops_bridge.cpp rename to src/frontends/onnx/frontend/src/ops_bridge.cpp index 7d12281d446..4bd94665bbb 100644 --- a/ngraph/frontend/onnx/frontend/src/ops_bridge.cpp +++ b/src/frontends/onnx/frontend/src/ops_bridge.cpp @@ -24,6 +24,7 @@ #include "op/asinh.hpp" #include "op/atan.hpp" #include "op/atanh.hpp" +#include "op/aten.hpp" #include "op/average_pool.hpp" #include "op/batch_norm.hpp" #include "op/bitshift.hpp" @@ -293,6 +294,7 @@ OperatorsBridge::OperatorsBridge() { REGISTER_OPERATOR("Asin", 1, asin); REGISTER_OPERATOR("Asinh", 1, asinh); REGISTER_OPERATOR("Atan", 1, atan); + REGISTER_OPERATOR("ATen", 1, aten); REGISTER_OPERATOR("Atanh", 1, atanh); REGISTER_OPERATOR("AveragePool", 1, average_pool); REGISTER_OPERATOR("BatchNormalization", 1, batch_norm); diff --git a/ngraph/frontend/onnx/frontend/src/ops_bridge.hpp b/src/frontends/onnx/frontend/src/ops_bridge.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/ops_bridge.hpp rename to src/frontends/onnx/frontend/src/ops_bridge.hpp diff --git a/ngraph/frontend/onnx/frontend/src/place.cpp b/src/frontends/onnx/frontend/src/place.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/place.cpp rename to src/frontends/onnx/frontend/src/place.cpp diff --git a/ngraph/frontend/onnx/frontend/src/place.hpp b/src/frontends/onnx/frontend/src/place.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/place.hpp rename to src/frontends/onnx/frontend/src/place.hpp diff --git a/ngraph/frontend/onnx/frontend/src/precomp.hpp b/src/frontends/onnx/frontend/src/precomp.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/precomp.hpp rename to src/frontends/onnx/frontend/src/precomp.hpp diff --git a/ngraph/frontend/onnx/frontend/src/utils/arg_min_max_factory.cpp b/src/frontends/onnx/frontend/src/utils/arg_min_max_factory.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/utils/arg_min_max_factory.cpp rename to src/frontends/onnx/frontend/src/utils/arg_min_max_factory.cpp diff --git a/ngraph/frontend/onnx/frontend/src/utils/arg_min_max_factory.hpp b/src/frontends/onnx/frontend/src/utils/arg_min_max_factory.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/utils/arg_min_max_factory.hpp rename to src/frontends/onnx/frontend/src/utils/arg_min_max_factory.hpp diff --git a/ngraph/frontend/onnx/frontend/src/utils/common.cpp b/src/frontends/onnx/frontend/src/utils/common.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/utils/common.cpp rename to src/frontends/onnx/frontend/src/utils/common.cpp diff --git a/ngraph/frontend/onnx/frontend/src/utils/common.hpp b/src/frontends/onnx/frontend/src/utils/common.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/utils/common.hpp rename to src/frontends/onnx/frontend/src/utils/common.hpp diff --git a/ngraph/frontend/onnx/frontend/src/utils/conv_factory.cpp b/src/frontends/onnx/frontend/src/utils/conv_factory.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/utils/conv_factory.cpp rename to src/frontends/onnx/frontend/src/utils/conv_factory.cpp diff --git a/ngraph/frontend/onnx/frontend/src/utils/conv_factory.hpp b/src/frontends/onnx/frontend/src/utils/conv_factory.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/utils/conv_factory.hpp rename to src/frontends/onnx/frontend/src/utils/conv_factory.hpp diff --git a/ngraph/frontend/onnx/frontend/src/utils/convpool.cpp b/src/frontends/onnx/frontend/src/utils/convpool.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/utils/convpool.cpp rename to src/frontends/onnx/frontend/src/utils/convpool.cpp diff --git a/ngraph/frontend/onnx/frontend/src/utils/convpool.hpp b/src/frontends/onnx/frontend/src/utils/convpool.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/utils/convpool.hpp rename to src/frontends/onnx/frontend/src/utils/convpool.hpp diff --git a/ngraph/frontend/onnx/frontend/src/utils/onnx_internal.cpp b/src/frontends/onnx/frontend/src/utils/onnx_internal.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/utils/onnx_internal.cpp rename to src/frontends/onnx/frontend/src/utils/onnx_internal.cpp diff --git a/ngraph/frontend/onnx/frontend/src/utils/onnx_internal.hpp b/src/frontends/onnx/frontend/src/utils/onnx_internal.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/utils/onnx_internal.hpp rename to src/frontends/onnx/frontend/src/utils/onnx_internal.hpp diff --git a/ngraph/frontend/onnx/frontend/src/utils/pooling_factory.cpp b/src/frontends/onnx/frontend/src/utils/pooling_factory.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/utils/pooling_factory.cpp rename to src/frontends/onnx/frontend/src/utils/pooling_factory.cpp diff --git a/ngraph/frontend/onnx/frontend/src/utils/pooling_factory.hpp b/src/frontends/onnx/frontend/src/utils/pooling_factory.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/utils/pooling_factory.hpp rename to src/frontends/onnx/frontend/src/utils/pooling_factory.hpp diff --git a/ngraph/frontend/onnx/frontend/src/utils/random_normal.cpp b/src/frontends/onnx/frontend/src/utils/random_normal.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/utils/random_normal.cpp rename to src/frontends/onnx/frontend/src/utils/random_normal.cpp diff --git a/ngraph/frontend/onnx/frontend/src/utils/random_normal.hpp b/src/frontends/onnx/frontend/src/utils/random_normal.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/utils/random_normal.hpp rename to src/frontends/onnx/frontend/src/utils/random_normal.hpp diff --git a/ngraph/frontend/onnx/frontend/src/utils/recurrent.cpp b/src/frontends/onnx/frontend/src/utils/recurrent.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/utils/recurrent.cpp rename to src/frontends/onnx/frontend/src/utils/recurrent.cpp diff --git a/ngraph/frontend/onnx/frontend/src/utils/recurrent.hpp b/src/frontends/onnx/frontend/src/utils/recurrent.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/utils/recurrent.hpp rename to src/frontends/onnx/frontend/src/utils/recurrent.hpp diff --git a/ngraph/frontend/onnx/frontend/src/utils/reshape.cpp b/src/frontends/onnx/frontend/src/utils/reshape.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/utils/reshape.cpp rename to src/frontends/onnx/frontend/src/utils/reshape.cpp diff --git a/ngraph/frontend/onnx/frontend/src/utils/reshape.hpp b/src/frontends/onnx/frontend/src/utils/reshape.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/utils/reshape.hpp rename to src/frontends/onnx/frontend/src/utils/reshape.hpp diff --git a/ngraph/frontend/onnx/frontend/src/utils/tensor_external_data.cpp b/src/frontends/onnx/frontend/src/utils/tensor_external_data.cpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/utils/tensor_external_data.cpp rename to src/frontends/onnx/frontend/src/utils/tensor_external_data.cpp diff --git a/ngraph/frontend/onnx/frontend/src/utils/tensor_external_data.hpp b/src/frontends/onnx/frontend/src/utils/tensor_external_data.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/utils/tensor_external_data.hpp rename to src/frontends/onnx/frontend/src/utils/tensor_external_data.hpp diff --git a/ngraph/frontend/onnx/frontend/src/utils/variadic.hpp b/src/frontends/onnx/frontend/src/utils/variadic.hpp similarity index 100% rename from ngraph/frontend/onnx/frontend/src/utils/variadic.hpp rename to src/frontends/onnx/frontend/src/utils/variadic.hpp diff --git a/ngraph/frontend/onnx/onnx_common/CMakeLists.txt b/src/frontends/onnx/onnx_common/CMakeLists.txt similarity index 81% rename from ngraph/frontend/onnx/onnx_common/CMakeLists.txt rename to src/frontends/onnx/onnx_common/CMakeLists.txt index 1c4d330290d..4d90061a21f 100644 --- a/ngraph/frontend/onnx/onnx_common/CMakeLists.txt +++ b/src/frontends/onnx/onnx_common/CMakeLists.txt @@ -26,7 +26,14 @@ target_include_directories(${TARGET_NAME} PUBLIC $) target_link_libraries(${TARGET_NAME} PRIVATE ngraph) -link_system_libraries(${TARGET_NAME} PUBLIC onnx_proto onnx ${Protobuf_LITE_LIBRARIES}) + +if(ONNX_USE_LITE_PROTO) + link_system_libraries(${TARGET_NAME} PUBLIC onnx_proto onnx ${Protobuf_LITE_LIBRARIES}) +else() + link_system_libraries(${TARGET_NAME} PUBLIC onnx_proto onnx ${Protobuf_LIBRARIES}) +endif() target_include_directories(${TARGET_NAME} PRIVATE ${ONNX_COMMON_SRC_DIR}) add_clang_format_target(${TARGET_NAME}_clang FOR_TARGETS ${TARGET_NAME}) + +ov_install_static_lib(${TARGET_NAME} ngraph) diff --git a/ngraph/frontend/onnx/onnx_common/include/onnx_common/onnx_model_validator.hpp b/src/frontends/onnx/onnx_common/include/onnx_common/onnx_model_validator.hpp similarity index 100% rename from ngraph/frontend/onnx/onnx_common/include/onnx_common/onnx_model_validator.hpp rename to src/frontends/onnx/onnx_common/include/onnx_common/onnx_model_validator.hpp diff --git a/ngraph/frontend/onnx/onnx_common/include/onnx_common/parser.hpp b/src/frontends/onnx/onnx_common/include/onnx_common/parser.hpp similarity index 100% rename from ngraph/frontend/onnx/onnx_common/include/onnx_common/parser.hpp rename to src/frontends/onnx/onnx_common/include/onnx_common/parser.hpp diff --git a/ngraph/frontend/onnx/onnx_common/include/onnx_common/utils.hpp b/src/frontends/onnx/onnx_common/include/onnx_common/utils.hpp similarity index 100% rename from ngraph/frontend/onnx/onnx_common/include/onnx_common/utils.hpp rename to src/frontends/onnx/onnx_common/include/onnx_common/utils.hpp diff --git a/ngraph/frontend/onnx/onnx_common/src/onnx_model_validator.cpp b/src/frontends/onnx/onnx_common/src/onnx_model_validator.cpp similarity index 100% rename from ngraph/frontend/onnx/onnx_common/src/onnx_model_validator.cpp rename to src/frontends/onnx/onnx_common/src/onnx_model_validator.cpp diff --git a/ngraph/frontend/onnx/onnx_common/src/parser.cpp b/src/frontends/onnx/onnx_common/src/parser.cpp similarity index 100% rename from ngraph/frontend/onnx/onnx_common/src/parser.cpp rename to src/frontends/onnx/onnx_common/src/parser.cpp diff --git a/ngraph/frontend/onnx/onnx_common/src/utils.cpp b/src/frontends/onnx/onnx_common/src/utils.cpp similarity index 100% rename from ngraph/frontend/onnx/onnx_common/src/utils.cpp rename to src/frontends/onnx/onnx_common/src/utils.cpp diff --git a/src/frontends/paddlepaddle/CMakeLists.txt b/src/frontends/paddlepaddle/CMakeLists.txt new file mode 100644 index 00000000000..e4d064b2388 --- /dev/null +++ b/src/frontends/paddlepaddle/CMakeLists.txt @@ -0,0 +1,9 @@ +# Copyright (C) 2018-2021 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 +# + +ov_add_frontend(NAME paddlepaddle + LINKABLE_FRONTEND + PROTOBUF_LITE + FILEDESCRIPTION "FrontEnd to load and convert PaddlePaddle file format" + LINK_LIBRARIES ngraph::builder) diff --git a/ngraph/frontend/paddlepaddle/include/paddlepaddle_frontend/exceptions.hpp b/src/frontends/paddlepaddle/include/paddlepaddle_frontend/exceptions.hpp similarity index 100% rename from ngraph/frontend/paddlepaddle/include/paddlepaddle_frontend/exceptions.hpp rename to src/frontends/paddlepaddle/include/paddlepaddle_frontend/exceptions.hpp diff --git a/ngraph/frontend/paddlepaddle/include/paddlepaddle_frontend/frontend.hpp b/src/frontends/paddlepaddle/include/paddlepaddle_frontend/frontend.hpp similarity index 87% rename from ngraph/frontend/paddlepaddle/include/paddlepaddle_frontend/frontend.hpp rename to src/frontends/paddlepaddle/include/paddlepaddle_frontend/frontend.hpp index dcda3d0bca4..55275c4b6a3 100644 --- a/ngraph/frontend/paddlepaddle/include/paddlepaddle_frontend/frontend.hpp +++ b/src/frontends/paddlepaddle/include/paddlepaddle_frontend/frontend.hpp @@ -18,12 +18,12 @@ public: FrontEndPDPD() = default; /// \brief Completely convert the remaining, not converted part of a function. - /// \param partiallyConverted partially converted nGraph function - /// \return fully converted nGraph function + /// \param partiallyConverted partially converted OV function + /// \return fully converted OV function std::shared_ptr convert(InputModel::Ptr model) const override; /// \brief Completely convert the remaining, not converted part of a function. - /// \param partiallyConverted partially converted nGraph function + /// \param partiallyConverted partially converted OV function void convert(std::shared_ptr partiallyConverted) const override; /// \brief Convert only those parts of the model that can be converted leaving others @@ -31,14 +31,14 @@ public: /// function or another form of convert function should be called to finalize the /// conversion process. /// \param model Input model - /// \return partially converted nGraph function + /// \return partially converted OV function std::shared_ptr convert_partially(InputModel::Ptr model) const override; /// \brief Convert operations with one-to-one mapping with decoding nodes. - /// Each decoding node is an nGraph node representing a single FW operation node with + /// Each decoding node is an OV node representing a single FW operation node with /// all attributes represented in FW-independent way. /// \param model Input model - /// \return nGraph function after decoding + /// \return OV function after decoding std::shared_ptr decode(InputModel::Ptr model) const override; /// \brief Gets name of this FrontEnd. Can be used by clients diff --git a/ngraph/frontend/paddlepaddle/include/paddlepaddle_frontend/model.hpp b/src/frontends/paddlepaddle/include/paddlepaddle_frontend/model.hpp similarity index 97% rename from ngraph/frontend/paddlepaddle/include/paddlepaddle_frontend/model.hpp rename to src/frontends/paddlepaddle/include/paddlepaddle_frontend/model.hpp index 54ba4d49834..abd51f0956c 100644 --- a/ngraph/frontend/paddlepaddle/include/paddlepaddle_frontend/model.hpp +++ b/src/frontends/paddlepaddle/include/paddlepaddle_frontend/model.hpp @@ -5,7 +5,8 @@ #pragma once #include -#include + +#include "paddlepaddle_frontend/utility.hpp" namespace ov { namespace frontend { diff --git a/ngraph/frontend/paddlepaddle/include/paddlepaddle_frontend/place.hpp b/src/frontends/paddlepaddle/include/paddlepaddle_frontend/place.hpp similarity index 99% rename from ngraph/frontend/paddlepaddle/include/paddlepaddle_frontend/place.hpp rename to src/frontends/paddlepaddle/include/paddlepaddle_frontend/place.hpp index f8905bf4437..e41e39564db 100644 --- a/ngraph/frontend/paddlepaddle/include/paddlepaddle_frontend/place.hpp +++ b/src/frontends/paddlepaddle/include/paddlepaddle_frontend/place.hpp @@ -5,7 +5,8 @@ #pragma once #include -#include + +#include "paddlepaddle_frontend/exceptions.hpp" namespace paddle { namespace framework { diff --git a/ngraph/frontend/paddlepaddle/include/paddlepaddle_frontend/utility.hpp b/src/frontends/paddlepaddle/include/paddlepaddle_frontend/utility.hpp similarity index 52% rename from ngraph/frontend/paddlepaddle/include/paddlepaddle_frontend/utility.hpp rename to src/frontends/paddlepaddle/include/paddlepaddle_frontend/utility.hpp index 55ba86cb1c8..8d61af08ff6 100644 --- a/ngraph/frontend/paddlepaddle/include/paddlepaddle_frontend/utility.hpp +++ b/src/frontends/paddlepaddle/include/paddlepaddle_frontend/utility.hpp @@ -6,12 +6,18 @@ #include -// Defined if we are building the plugin DLL (instead of using it) -#ifdef paddlepaddle_ov_frontend_EXPORTS -# define PDPD_API OPENVINO_CORE_EXPORTS +#ifdef OPENVINO_STATIC_LIBRARY +# define PDPD_API +# define PDPD_C_API #else -# define PDPD_API OPENVINO_CORE_IMPORTS -#endif // paddlepaddle_ov_frontend_EXPORTS +# ifdef paddlepaddle_ov_frontend_EXPORTS +# define PDPD_API OPENVINO_CORE_EXPORTS +# define PDPD_C_API OPENVINO_EXTERN_C OPENVINO_CORE_EXPORTS +# else +# define PDPD_API OPENVINO_CORE_IMPORTS +# define PDPD_C_API OPENVINO_EXTERN_C OPENVINO_CORE_IMPORTS +# endif // paddlepaddle_ov_frontend_EXPORTS +#endif // OPENVINO_STATIC_LIBRARY #define PDPD_ASSERT(ex, msg) \ { \ diff --git a/ngraph/frontend/paddlepaddle/src/decoder.cpp b/src/frontends/paddlepaddle/src/decoder.cpp similarity index 81% rename from ngraph/frontend/paddlepaddle/src/decoder.cpp rename to src/frontends/paddlepaddle/src/decoder.cpp index d157a349a8f..56f21f0d15b 100644 --- a/ngraph/frontend/paddlepaddle/src/decoder.cpp +++ b/src/frontends/paddlepaddle/src/decoder.cpp @@ -19,17 +19,17 @@ namespace ov { namespace frontend { using namespace paddle::framework; -std::map TYPE_MAP{ - {proto::VarType_Type::VarType_Type_BOOL, ngraph::element::boolean}, - {proto::VarType_Type::VarType_Type_INT16, ngraph::element::i16}, - {proto::VarType_Type::VarType_Type_INT32, ngraph::element::i32}, - {proto::VarType_Type::VarType_Type_INT64, ngraph::element::i64}, - {proto::VarType_Type::VarType_Type_FP16, ngraph::element::f16}, - {proto::VarType_Type::VarType_Type_FP32, ngraph::element::f32}, - {proto::VarType_Type::VarType_Type_FP64, ngraph::element::f64}, - {proto::VarType_Type::VarType_Type_UINT8, ngraph::element::u8}, - {proto::VarType_Type::VarType_Type_INT8, ngraph::element::i8}, - {proto::VarType_Type::VarType_Type_BF16, ngraph::element::bf16}}; +std::map TYPE_MAP{ + {proto::VarType_Type::VarType_Type_BOOL, ov::element::boolean}, + {proto::VarType_Type::VarType_Type_INT16, ov::element::i16}, + {proto::VarType_Type::VarType_Type_INT32, ov::element::i32}, + {proto::VarType_Type::VarType_Type_INT64, ov::element::i64}, + {proto::VarType_Type::VarType_Type_FP16, ov::element::f16}, + {proto::VarType_Type::VarType_Type_FP32, ov::element::f32}, + {proto::VarType_Type::VarType_Type_FP64, ov::element::f64}, + {proto::VarType_Type::VarType_Type_UINT8, ov::element::u8}, + {proto::VarType_Type::VarType_Type_INT8, ov::element::i8}, + {proto::VarType_Type::VarType_Type_BF16, ov::element::bf16}}; std::shared_ptr DecoderPDPDProto::get_attribute(const std::string& name, const VariantTypeInfo& type_info) const { @@ -55,9 +55,9 @@ std::shared_ptr DecoderPDPDProto::get_attribute(const std::string& name } else if (type_info == VariantWrapper>::get_type_info_static()) { auto floats = std::vector(attrs[0].floats().begin(), attrs[0].floats().end()); return std::make_shared>>(floats); - } else if (type_info == VariantWrapper::get_type_info_static()) { + } else if (type_info == VariantWrapper::get_type_info_static()) { auto data_type = (paddle::framework::proto::VarType_Type)attrs[0].i(); - return std::make_shared>(TYPE_MAP[data_type]); + return std::make_shared>(TYPE_MAP[data_type]); } else if (type_info == VariantWrapper::get_type_info_static()) { return std::make_shared>(attrs[0].b()); } @@ -82,8 +82,8 @@ size_t DecoderPDPDProto::get_output_size() const { return res; } -std::map> DecoderPDPDProto::get_output_type_map() const { - std::map> output_types; +std::map> DecoderPDPDProto::get_output_type_map() const { + std::map> output_types; for (const auto& out_port_pair : op_place->get_output_ports()) { for (const auto& p_place : out_port_pair.second) { output_types[out_port_pair.first].push_back(p_place->get_target_tensor_pdpd()->get_element_type()); @@ -92,8 +92,8 @@ std::map> DecoderPDPDProto::get_ return output_types; } -ngraph::element::Type DecoderPDPDProto::get_out_port_type(const std::string& port_name) const { - std::vector output_types; +ov::element::Type DecoderPDPDProto::get_out_port_type(const std::string& port_name) const { + std::vector output_types; for (const auto& out_port : op_place->get_output_ports().at(port_name)) { output_types.push_back(out_port->get_target_tensor_pdpd()->get_element_type()); } diff --git a/ngraph/frontend/paddlepaddle/src/decoder.hpp b/src/frontends/paddlepaddle/src/decoder.hpp similarity index 78% rename from ngraph/frontend/paddlepaddle/src/decoder.hpp rename to src/frontends/paddlepaddle/src/decoder.hpp index a87bf04f591..29ef5ee9eda 100644 --- a/ngraph/frontend/paddlepaddle/src/decoder.hpp +++ b/src/frontends/paddlepaddle/src/decoder.hpp @@ -9,18 +9,18 @@ #include #include #include -#include -#include #include #include #include #include "framework.pb.h" #include "node_context.hpp" +#include "paddlepaddle_frontend/frontend.hpp" +#include "paddlepaddle_frontend/place.hpp" namespace ov { namespace frontend { -extern std::map TYPE_MAP; +extern std::map TYPE_MAP; class DecoderPDPDProto : public pdpd::DecoderBase { public: @@ -32,11 +32,11 @@ public: size_t get_output_size() const override; - ngraph::element::Type get_out_port_type(const std::string& port_name) const override; + ov::element::Type get_out_port_type(const std::string& port_name) const override; std::string get_op_type() const override; - std::map> get_output_type_map() const; + std::map> get_output_type_map() const; std::map map_for_each_input( const std::function(const std::string&, size_t)>& func) const; diff --git a/ngraph/frontend/paddlepaddle/src/default_opset.hpp b/src/frontends/paddlepaddle/src/default_opset.hpp similarity index 75% rename from ngraph/frontend/paddlepaddle/src/default_opset.hpp rename to src/frontends/paddlepaddle/src/default_opset.hpp index 677e48045cf..852018f88a1 100644 --- a/ngraph/frontend/paddlepaddle/src/default_opset.hpp +++ b/src/frontends/paddlepaddle/src/default_opset.hpp @@ -2,13 +2,13 @@ // SPDX-License-Identifier: Apache-2.0 // -#include "ngraph/opsets/opset8.hpp" +#include "openvino/opsets/opset8.hpp" namespace ov { namespace frontend { namespace pdpd { namespace op { -namespace default_opset = ngraph::opset8; +namespace default_opset = ov::opset8; } // namespace op } // namespace pdpd diff --git a/ngraph/frontend/paddlepaddle/src/exceptions.cpp b/src/frontends/paddlepaddle/src/exceptions.cpp similarity index 100% rename from ngraph/frontend/paddlepaddle/src/exceptions.cpp rename to src/frontends/paddlepaddle/src/exceptions.cpp diff --git a/ngraph/frontend/paddlepaddle/src/frontend.cpp b/src/frontends/paddlepaddle/src/frontend.cpp similarity index 94% rename from ngraph/frontend/paddlepaddle/src/frontend.cpp rename to src/frontends/paddlepaddle/src/frontend.cpp index 009626b6d15..113e57632c7 100644 --- a/ngraph/frontend/paddlepaddle/src/frontend.cpp +++ b/src/frontends/paddlepaddle/src/frontend.cpp @@ -2,15 +2,10 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "paddlepaddle_frontend/frontend.hpp" + #include #include -#include -#include -#include -#include -#include -#include -#include #include #include @@ -18,6 +13,11 @@ #include "framework.pb.h" #include "node_context.hpp" #include "op_table.hpp" +#include "openvino/core/variant.hpp" +#include "openvino/opsets/opset7.hpp" +#include "paddlepaddle_frontend/exceptions.hpp" +#include "paddlepaddle_frontend/model.hpp" +#include "paddlepaddle_frontend/place.hpp" #include "pdpd_fw_node.hpp" #include "pdpd_utils.hpp" @@ -178,7 +178,7 @@ std::shared_ptr FrontEndPDPD::convert_each_node( const auto& ng_outputs = named_outputs.at(port.parameter()); FRONT_END_OP_CONVERSION_CHECK(ng_outputs.size() == port.arguments_size(), "The number of output tensors must be equal to " - "the number of outputs of the ngraph node."); + "the number of outputs of the OV node."); for (size_t idx = 0; idx < ng_outputs.size(); ++idx) { const auto& var_name = port.arguments()[idx]; ng_outputs[idx].get_tensor().set_names({var_name}); @@ -202,7 +202,7 @@ std::shared_ptr FrontEndPDPD::convert_each_node( result_nodes.push_back(result); } - return std::make_shared(result_nodes, parameter_nodes); + return std::make_shared(result_nodes, parameter_nodes); } bool FrontEndPDPD::supported_impl(const std::vector>& variants) const { @@ -276,7 +276,7 @@ InputModel::Ptr FrontEndPDPD::load_impl(const std::vector FrontEndPDPD::convert(InputModel::Ptr model) const { +std::shared_ptr FrontEndPDPD::convert(InputModel::Ptr model) const { auto pdpd_model = std::dynamic_pointer_cast(model); std::map CREATORS_MAP = pdpd::get_supported_ops(); auto f = convert_each_node( @@ -287,7 +287,7 @@ std::shared_ptr FrontEndPDPD::convert(InputModel::Ptr model) c return f; } -void FrontEndPDPD::convert(std::shared_ptr partiallyConverted) const { +void FrontEndPDPD::convert(std::shared_ptr partiallyConverted) const { for (const auto& node : partiallyConverted->get_ordered_ops()) { if (ov::is_type(node)) { pdpd::normalize_framework_node(std::dynamic_pointer_cast(node), @@ -299,7 +299,7 @@ void FrontEndPDPD::convert(std::shared_ptr partiallyConverted) } } -std::shared_ptr FrontEndPDPD::convert_partially(InputModel::Ptr model) const { +std::shared_ptr FrontEndPDPD::convert_partially(InputModel::Ptr model) const { auto pdpd_model = std::dynamic_pointer_cast(model); std::map CREATORS_MAP = pdpd::get_supported_ops(); auto f = convert_each_node( @@ -316,7 +316,7 @@ std::shared_ptr FrontEndPDPD::convert_partially(InputModel::Pt return f; } -std::shared_ptr FrontEndPDPD::decode(InputModel::Ptr model) const { +std::shared_ptr FrontEndPDPD::decode(InputModel::Ptr model) const { auto pdpd_model = std::dynamic_pointer_cast(model); std::map CREATORS_MAP = pdpd::get_supported_ops(); auto f = convert_each_node(pdpd_model, pdpd::make_framework_node); @@ -329,11 +329,11 @@ std::string FrontEndPDPD::get_name() const { } // namespace frontend } // namespace ov -extern "C" PDPD_API FrontEndVersion GetAPIVersion() { +PDPD_C_API FrontEndVersion GetAPIVersion() { return OV_FRONTEND_API_VERSION; } -extern "C" PDPD_API void* GetFrontEndData() { +PDPD_C_API void* GetFrontEndData() { FrontEndPluginInfo* res = new FrontEndPluginInfo(); res->m_name = "paddle"; res->m_creator = []() { diff --git a/ngraph/frontend/paddlepaddle/src/model.cpp b/src/frontends/paddlepaddle/src/model.cpp similarity index 95% rename from ngraph/frontend/paddlepaddle/src/model.cpp rename to src/frontends/paddlepaddle/src/model.cpp index 0cbb9038e87..0cd4c7376a8 100644 --- a/ngraph/frontend/paddlepaddle/src/model.cpp +++ b/src/frontends/paddlepaddle/src/model.cpp @@ -2,16 +2,17 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "paddlepaddle_frontend/model.hpp" + #include -#include -#include -#include -#include #include #include "decoder.hpp" #include "framework.pb.h" #include "node_context.hpp" +#include "openvino/opsets/opset7.hpp" +#include "paddlepaddle_frontend/exceptions.hpp" +#include "paddlepaddle_frontend/place.hpp" #include "pdpd_utils.hpp" #if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32) @@ -34,10 +35,10 @@ public: void overrideAllOutputs(const std::vector& outputs); void overrideAllInputs(const std::vector& inputs); void extractSubgraph(const std::vector& inputs, const std::vector& outputs); - void setDefaultShape(Place::Ptr place, const ngraph::Shape&); - void setPartialShape(Place::Ptr place, const ngraph::PartialShape&); - ngraph::PartialShape getPartialShape(Place::Ptr place) const; - void setElementType(Place::Ptr place, const ngraph::element::Type&); + void setDefaultShape(Place::Ptr place, const ov::Shape&); + void setPartialShape(Place::Ptr place, const ov::PartialShape&); + ov::PartialShape getPartialShape(Place::Ptr place) const; + void setElementType(Place::Ptr place, const ov::element::Type&); void setTensorValue(Place::Ptr place, const void* value); std::vector> get_op_places() const; @@ -374,19 +375,19 @@ void InputModelPDPD::InputModelPDPDImpl::extractSubgraph(const std::vectorset_partial_shape(p_shape); } -ngraph::PartialShape InputModelPDPD::InputModelPDPDImpl::getPartialShape(Place::Ptr place) const { +ov::PartialShape InputModelPDPD::InputModelPDPDImpl::getPartialShape(Place::Ptr place) const { return castToTensorPlace(place)->get_partial_shape(); } -void InputModelPDPD::InputModelPDPDImpl::setElementType(Place::Ptr place, const ngraph::element::Type& type) { +void InputModelPDPD::InputModelPDPDImpl::setElementType(Place::Ptr place, const ov::element::Type& type) { castToTensorPlace(place)->set_element_type(type); } @@ -446,15 +447,15 @@ void InputModelPDPD::extract_subgraph(const std::vector& inputs, con _impl->extractSubgraph(inputs, outputs); } -void InputModelPDPD::set_partial_shape(Place::Ptr place, const ngraph::PartialShape& p_shape) { +void InputModelPDPD::set_partial_shape(Place::Ptr place, const ov::PartialShape& p_shape) { _impl->setPartialShape(place, p_shape); } -ngraph::PartialShape InputModelPDPD::get_partial_shape(Place::Ptr place) const { +ov::PartialShape InputModelPDPD::get_partial_shape(Place::Ptr place) const { return _impl->getPartialShape(place); } -void InputModelPDPD::set_element_type(Place::Ptr place, const ngraph::element::Type& type) { +void InputModelPDPD::set_element_type(Place::Ptr place, const ov::element::Type& type) { _impl->setElementType(place, type); } diff --git a/ngraph/frontend/paddlepaddle/src/node_context.hpp b/src/frontends/paddlepaddle/src/node_context.hpp similarity index 88% rename from ngraph/frontend/paddlepaddle/src/node_context.hpp rename to src/frontends/paddlepaddle/src/node_context.hpp index 2e02119c485..28461725362 100644 --- a/ngraph/frontend/paddlepaddle/src/node_context.hpp +++ b/src/frontends/paddlepaddle/src/node_context.hpp @@ -8,7 +8,7 @@ #include "paddlepaddle_frontend/exceptions.hpp" #include "paddlepaddle_frontend/utility.hpp" -#define NGRAPH_VARIANT_DECLARATION(TYPE, info) \ +#define OPENVINO_VARIANT_DECLARATION(TYPE, info) \ template <> \ class VariantWrapper : public VariantImpl { \ public: \ @@ -17,13 +17,13 @@ } namespace ov { -NGRAPH_VARIANT_DECLARATION(int32_t, "Variant::int32"); -NGRAPH_VARIANT_DECLARATION(std::vector, "Variant::int32_vector"); -NGRAPH_VARIANT_DECLARATION(float, "Variant::float"); -NGRAPH_VARIANT_DECLARATION(std::vector, "Variant::float_vector"); -NGRAPH_VARIANT_DECLARATION(bool, "Variant::bool"); -NGRAPH_VARIANT_DECLARATION(ngraph::element::Type, "Variant::element_type"); -NGRAPH_VARIANT_DECLARATION(std::vector, "Variant::int64_vector"); +OPENVINO_VARIANT_DECLARATION(int32_t, "Variant::int32"); +OPENVINO_VARIANT_DECLARATION(std::vector, "Variant::int32_vector"); +OPENVINO_VARIANT_DECLARATION(float, "Variant::float"); +OPENVINO_VARIANT_DECLARATION(std::vector, "Variant::float_vector"); +OPENVINO_VARIANT_DECLARATION(bool, "Variant::bool"); +OPENVINO_VARIANT_DECLARATION(ov::element::Type, "Variant::element_type"); +OPENVINO_VARIANT_DECLARATION(std::vector, "Variant::int64_vector"); namespace frontend { namespace pdpd { using InPortName = std::string; @@ -54,7 +54,7 @@ public: /// \param port_name Port name for the node /// /// \return Type of specified output port - virtual ngraph::element::Type get_out_port_type(const std::string& port_name) const = 0; + virtual ov::element::Type get_out_port_type(const std::string& port_name) const = 0; virtual std::string get_op_type() const = 0; }; @@ -170,7 +170,7 @@ public: return decoder.get_output_names(); } - ngraph::element::Type get_out_port_type(const std::string& port_name) const { + ov::element::Type get_out_port_type(const std::string& port_name) const { return decoder.get_out_port_type(port_name); } @@ -178,21 +178,21 @@ public: return decoder.get_op_type(); } - NamedOutputs default_single_output_mapping(const std::shared_ptr& ngraph_node, + NamedOutputs default_single_output_mapping(const std::shared_ptr& node, const std::vector& required_pdpd_out_names) const; }; inline NamedOutputs NodeContext::default_single_output_mapping( - const std::shared_ptr& ngraph_node, + const std::shared_ptr& node, const std::vector& required_pdpd_out_names) const { NamedOutputs named_outputs; - const auto& ngraph_outputs = ngraph_node->outputs(); + const auto& outputs = node->outputs(); const auto& pdpd_op_output_names = this->get_output_names(); - FRONT_END_GENERAL_CHECK(ngraph_outputs.size() == 1, "nGraph node must have exactly one output"); + FRONT_END_GENERAL_CHECK(outputs.size() == 1, "OV node must have exactly one output"); for (const auto& pdpd_name : pdpd_op_output_names) { if (std::find(required_pdpd_out_names.begin(), required_pdpd_out_names.end(), pdpd_name) != required_pdpd_out_names.end()) - named_outputs[pdpd_name] = {ngraph_outputs[0]}; + named_outputs[pdpd_name] = {outputs[0]}; } return named_outputs; } diff --git a/src/frontends/paddlepaddle/src/op/argmax.cpp b/src/frontends/paddlepaddle/src/op/argmax.cpp new file mode 100644 index 00000000000..265c12ad879 --- /dev/null +++ b/src/frontends/paddlepaddle/src/op/argmax.cpp @@ -0,0 +1,41 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include + +#include "openvino/opsets/opset6.hpp" + +namespace ov { +namespace frontend { +namespace pdpd { +namespace op { +NamedOutputs argmax(const NodeContext& node) { + auto data = node.get_ng_input("X"); + bool flatten = node.get_attribute("flatten"); + const element::Type& index_element_type = element::i64; + const Output k = ov::opset6::Constant::create(ov::element::i64, {}, {1}); + + if (!flatten) { + auto axis = node.get_attribute("axis"); + const auto axis_to_remove = ov::opset6::Constant::create(element::u64, Shape{}, {axis}); + auto node_topk = std::make_shared(data, k, axis, "max", "index", index_element_type); + const auto reshaped_indices = std::make_shared(node_topk->output(1), axis_to_remove); + return node.default_single_output_mapping( + {std::make_shared(reshaped_indices, element::i64)}, + {"Out"}); + } else { + int64_t axis = 0; + const Output reshape_flatten = ov::opset6::Constant::create(ov::element::i64, {1}, {-1}); + auto node_reshape = std::make_shared(data, reshape_flatten, true); + auto node_topk = std::make_shared(node_reshape, k, axis, "max", "index", index_element_type); + return node.default_single_output_mapping( + {std::make_shared(node_topk->output(1), element::i64)}, + {"Out"}); + } +} + +} // namespace op +} // namespace pdpd +} // namespace frontend +} // namespace ov diff --git a/ngraph/frontend/paddlepaddle/src/op/assign_value.cpp b/src/frontends/paddlepaddle/src/op/assign_value.cpp similarity index 93% rename from ngraph/frontend/paddlepaddle/src/op/assign_value.cpp rename to src/frontends/paddlepaddle/src/op/assign_value.cpp index ad5482f8d67..93b2fdfb08e 100644 --- a/ngraph/frontend/paddlepaddle/src/op/assign_value.cpp +++ b/src/frontends/paddlepaddle/src/op/assign_value.cpp @@ -3,14 +3,15 @@ // #include -#include + +#include "openvino/opsets/opset6.hpp" namespace ov { namespace frontend { namespace pdpd { namespace op { NamedOutputs assign_value(const NodeContext& node) { std::vector shape = node.get_attribute>("shape"); - auto dtype = node.get_attribute("dtype"); + auto dtype = node.get_attribute("dtype"); std::shared_ptr const_node; switch (dtype) { diff --git a/ngraph/frontend/paddlepaddle/src/op/batch_norm.cpp b/src/frontends/paddlepaddle/src/op/batch_norm.cpp similarity index 53% rename from ngraph/frontend/paddlepaddle/src/op/batch_norm.cpp rename to src/frontends/paddlepaddle/src/op/batch_norm.cpp index 1d52fecd0d3..86f4cea41fc 100644 --- a/ngraph/frontend/paddlepaddle/src/op/batch_norm.cpp +++ b/src/frontends/paddlepaddle/src/op/batch_norm.cpp @@ -2,9 +2,10 @@ // SPDX-License-Identifier: Apache-2.0 // -#include #include +#include "openvino/opsets/opset6.hpp" + namespace ov { namespace frontend { namespace pdpd { @@ -20,26 +21,25 @@ NamedOutputs batch_norm(const NodeContext& node) { PDPD_ASSERT((data_layout == "NCHW" || data_layout == "NHWC"), "Not supported input data layout!"); if (data_layout == "NCHW") { return node.default_single_output_mapping( - {std::make_shared(data, - gamma, - beta, - mean, - variance, - node.get_attribute("epsilon"))}, + {std::make_shared(data, + gamma, + beta, + mean, + variance, + node.get_attribute("epsilon"))}, {"Y"}); } else { - auto input_order = ngraph::opset6::Constant::create(ngraph::element::i64, {4}, {0, 3, 1, 2}); - auto data_nchw = std::make_shared(data, input_order); - auto node_batch_norm = - std::make_shared(data_nchw, - gamma, - beta, - mean, - variance, - node.get_attribute("epsilon")); - auto output_order = ngraph::opset6::Constant::create(ngraph::element::i64, {4}, {0, 2, 3, 1}); + auto input_order = ov::opset6::Constant::create(ov::element::i64, {4}, {0, 3, 1, 2}); + auto data_nchw = std::make_shared(data, input_order); + auto node_batch_norm = std::make_shared(data_nchw, + gamma, + beta, + mean, + variance, + node.get_attribute("epsilon")); + auto output_order = ov::opset6::Constant::create(ov::element::i64, {4}, {0, 2, 3, 1}); return node.default_single_output_mapping( - {std::make_shared(node_batch_norm, output_order)}, + {std::make_shared(node_batch_norm, output_order)}, {"Y"}); } } diff --git a/ngraph/frontend/paddlepaddle/src/op/cast.cpp b/src/frontends/paddlepaddle/src/op/cast.cpp similarity index 71% rename from ngraph/frontend/paddlepaddle/src/op/cast.cpp rename to src/frontends/paddlepaddle/src/op/cast.cpp index 75cf919a12c..4530705483a 100644 --- a/ngraph/frontend/paddlepaddle/src/op/cast.cpp +++ b/src/frontends/paddlepaddle/src/op/cast.cpp @@ -2,18 +2,19 @@ // SPDX-License-Identifier: Apache-2.0 // -#include #include +#include "openvino/opsets/opset6.hpp" + namespace ov { namespace frontend { namespace pdpd { namespace op { NamedOutputs cast(const NodeContext& node) { auto data = node.get_ng_input("X"); - auto out_dtype = node.get_attribute("out_dtype"); + auto out_dtype = node.get_attribute("out_dtype"); - return node.default_single_output_mapping({std::make_shared(data, out_dtype)}, {"Out"}); + return node.default_single_output_mapping({std::make_shared(data, out_dtype)}, {"Out"}); } } // namespace op diff --git a/ngraph/frontend/paddlepaddle/src/op/clip.cpp b/src/frontends/paddlepaddle/src/op/clip.cpp similarity index 87% rename from ngraph/frontend/paddlepaddle/src/op/clip.cpp rename to src/frontends/paddlepaddle/src/op/clip.cpp index 551548f89b8..c34806a1d53 100644 --- a/ngraph/frontend/paddlepaddle/src/op/clip.cpp +++ b/src/frontends/paddlepaddle/src/op/clip.cpp @@ -2,9 +2,10 @@ // SPDX-License-Identifier: Apache-2.0 // -#include #include +#include "openvino/opsets/opset6.hpp" + namespace ov { namespace frontend { namespace pdpd { @@ -15,7 +16,7 @@ NamedOutputs clip(const NodeContext& node) { auto max = node.get_attribute("max"); PDPD_OP_VALIDATION_CHECK(node, max >= min, "clip: max value must greater than min value!"); - return node.default_single_output_mapping({std::make_shared(data, min, max)}, {"Out"}); + return node.default_single_output_mapping({std::make_shared(data, min, max)}, {"Out"}); } } // namespace op diff --git a/ngraph/frontend/paddlepaddle/src/op/concat.cpp b/src/frontends/paddlepaddle/src/op/concat.cpp similarity index 92% rename from ngraph/frontend/paddlepaddle/src/op/concat.cpp rename to src/frontends/paddlepaddle/src/op/concat.cpp index 13fb8b45318..512df6cc806 100644 --- a/ngraph/frontend/paddlepaddle/src/op/concat.cpp +++ b/src/frontends/paddlepaddle/src/op/concat.cpp @@ -3,7 +3,8 @@ // #include -#include + +#include "openvino/opsets/opset6.hpp" namespace ov { namespace frontend { diff --git a/ngraph/frontend/paddlepaddle/src/op/conv2d.cpp b/src/frontends/paddlepaddle/src/op/conv2d.cpp similarity index 90% rename from ngraph/frontend/paddlepaddle/src/op/conv2d.cpp rename to src/frontends/paddlepaddle/src/op/conv2d.cpp index 87b0b9f53f9..cd71b250fcd 100644 --- a/ngraph/frontend/paddlepaddle/src/op/conv2d.cpp +++ b/src/frontends/paddlepaddle/src/op/conv2d.cpp @@ -2,9 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 // -#include - #include "conv2d_utils.hpp" +#include "openvino/opsets/opset6.hpp" namespace ov { namespace frontend { diff --git a/ngraph/frontend/paddlepaddle/src/op/conv2d_transpose.cpp b/src/frontends/paddlepaddle/src/op/conv2d_transpose.cpp similarity index 92% rename from ngraph/frontend/paddlepaddle/src/op/conv2d_transpose.cpp rename to src/frontends/paddlepaddle/src/op/conv2d_transpose.cpp index 57133dd626c..e0f8db7655f 100644 --- a/ngraph/frontend/paddlepaddle/src/op/conv2d_transpose.cpp +++ b/src/frontends/paddlepaddle/src/op/conv2d_transpose.cpp @@ -3,9 +3,9 @@ // #include -#include #include "conv2d_utils.hpp" +#include "openvino/opsets/opset6.hpp" namespace ov { namespace frontend { diff --git a/ngraph/frontend/paddlepaddle/src/op/conv2d_utils.cpp b/src/frontends/paddlepaddle/src/op/conv2d_utils.cpp similarity index 88% rename from ngraph/frontend/paddlepaddle/src/op/conv2d_utils.cpp rename to src/frontends/paddlepaddle/src/op/conv2d_utils.cpp index 31dd422f53f..d1b7689d561 100644 --- a/ngraph/frontend/paddlepaddle/src/op/conv2d_utils.cpp +++ b/src/frontends/paddlepaddle/src/op/conv2d_utils.cpp @@ -4,28 +4,27 @@ #include "conv2d_utils.hpp" -#include - #include "node_context.hpp" +#include "openvino/opsets/opset6.hpp" namespace ov { namespace frontend { namespace pdpd { namespace op { -ngraph::op::PadType get_auto_pad(const NodeContext& node) { +ov::op::PadType get_auto_pad(const NodeContext& node) { // Default value means use explicitly provided padding values. - ngraph::op::PadType pad_type{ngraph::op::PadType::NOTSET}; + ov::op::PadType pad_type{ov::op::PadType::NOTSET}; auto padding_algorithm = node.get_attribute("padding_algorithm"); - static std::unordered_map auto_pad_values{ - {"VALID", ngraph::op::PadType::VALID}, - {"SAME", ngraph::op::PadType::SAME_UPPER}, - {"NOTSET", ngraph::op::PadType::NOTSET}, + static std::unordered_map auto_pad_values{ + {"VALID", ov::op::PadType::VALID}, + {"SAME", ov::op::PadType::SAME_UPPER}, + {"NOTSET", ov::op::PadType::NOTSET}, }; const auto pad_val_it = auto_pad_values.find(padding_algorithm); if (pad_val_it == auto_pad_values.end()) { - pad_type = ngraph::op::PadType::NOTSET; + pad_type = ov::op::PadType::NOTSET; } else { pad_type = pad_val_it->second; } diff --git a/src/frontends/paddlepaddle/src/op/conv2d_utils.hpp b/src/frontends/paddlepaddle/src/op/conv2d_utils.hpp new file mode 100644 index 00000000000..f5632612191 --- /dev/null +++ b/src/frontends/paddlepaddle/src/op/conv2d_utils.hpp @@ -0,0 +1,58 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once +#include "node_context.hpp" + +namespace ov { +namespace frontend { +namespace pdpd { +namespace op { +ov::op::PadType get_auto_pad(const NodeContext& node); +std::pair get_pads(const NodeContext& node); +std::shared_ptr get_reshaped_filter(const Output& filters, int32_t groups); + +template +NamedOutputs conv2d_base(const NodeContext& node) { + auto data = node.get_ng_input("Input"); + auto filters = node.get_ng_input("Filter"); + + const auto strides = node.get_attribute>("strides"); + const auto dilations = node.get_attribute>("dilations"); + const auto auto_pad_type = get_auto_pad(node); + const auto paddings = get_pads(node); + const auto pads_begin = paddings.first; + const auto pads_end = paddings.second; + const auto groups = node.get_attribute("groups"); + const auto data_format = node.get_attribute("data_format"); + // TODO Support Other data layout #55423 + PDPD_ASSERT(data_format == "NCHW", "conv2d only supports NCHW now"); + + if (groups > 1) { + const auto reshaped_filters = get_reshaped_filter(filters, groups); + + return node.default_single_output_mapping({std::make_shared(data, + reshaped_filters, + ov::Strides(strides.begin(), strides.end()), + pads_begin, + pads_end, + ov::Strides(dilations.begin(), dilations.end()), + auto_pad_type)}, + {"Output"}); + } else { + return node.default_single_output_mapping({std::make_shared(data, + filters, + ov::Strides(strides.begin(), strides.end()), + pads_begin, + pads_end, + ov::Strides(dilations.begin(), dilations.end()), + auto_pad_type)}, + {"Output"}); + } +} + +} // namespace op +} // namespace pdpd +} // namespace frontend +} // namespace ov diff --git a/ngraph/frontend/paddlepaddle/src/op/cumsum.cpp b/src/frontends/paddlepaddle/src/op/cumsum.cpp similarity index 94% rename from ngraph/frontend/paddlepaddle/src/op/cumsum.cpp rename to src/frontends/paddlepaddle/src/op/cumsum.cpp index 13916a8efd2..a56724f0bf5 100644 --- a/ngraph/frontend/paddlepaddle/src/op/cumsum.cpp +++ b/src/frontends/paddlepaddle/src/op/cumsum.cpp @@ -17,7 +17,7 @@ NamedOutputs cumsum(const NodeContext& node) { const auto reverse = node.get_attribute("reverse", false); const auto exclusive = node.get_attribute("exclusive", false); - std::shared_ptr input = x.get_node_shared_ptr(); + std::shared_ptr input = x.get_node_shared_ptr(); if (flatten) { // convert to 1-d tensor input = std::make_shared(x, diff --git a/ngraph/frontend/paddlepaddle/src/op/deformable_conv.cpp b/src/frontends/paddlepaddle/src/op/deformable_conv.cpp similarity index 77% rename from ngraph/frontend/paddlepaddle/src/op/deformable_conv.cpp rename to src/frontends/paddlepaddle/src/op/deformable_conv.cpp index 5c5b5a7689d..93b03e9d9ec 100644 --- a/ngraph/frontend/paddlepaddle/src/op/deformable_conv.cpp +++ b/src/frontends/paddlepaddle/src/op/deformable_conv.cpp @@ -1,10 +1,10 @@ // Copyright (C) 2018-2021 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // -#include #include #include "conv2d_utils.hpp" +#include "openvino/opsets/opset8.hpp" namespace ov { namespace frontend { @@ -25,37 +25,37 @@ NamedOutputs deformable_conv(const NodeContext& node) { const auto pads_begin = paddings.first; const auto pads_end = paddings.second; - const ngraph::op::PadType auto_pad{ngraph::op::PadType::EXPLICIT}; + const ov::op::PadType auto_pad{ov::op::PadType::EXPLICIT}; std::shared_ptr output_node; if (node.has_ng_input("Mask")) { auto mask = node.get_ng_input("Mask"); output_node = - std::make_shared(input, - offset, - filter, - mask, - ngraph::Strides(strides.begin(), strides.end()), - pads_begin, - pads_end, - ngraph::Strides(dilations.begin(), dilations.end()), - auto_pad, - groups, - deformable_groups, - true); + std::make_shared(input, + offset, + filter, + mask, + ov::Strides(strides.begin(), strides.end()), + pads_begin, + pads_end, + ov::Strides(dilations.begin(), dilations.end()), + auto_pad, + groups, + deformable_groups, + true); } else { output_node = - std::make_shared(input, - offset, - filter, - ngraph::Strides(strides.begin(), strides.end()), - pads_begin, - pads_end, - ngraph::Strides(dilations.begin(), dilations.end()), - auto_pad, - groups, - deformable_groups, - true); + std::make_shared(input, + offset, + filter, + ov::Strides(strides.begin(), strides.end()), + pads_begin, + pads_end, + ov::Strides(dilations.begin(), dilations.end()), + auto_pad, + groups, + deformable_groups, + true); } return node.default_single_output_mapping({output_node}, {"Output"}); diff --git a/ngraph/frontend/paddlepaddle/src/op/dropout.cpp b/src/frontends/paddlepaddle/src/op/dropout.cpp similarity index 72% rename from ngraph/frontend/paddlepaddle/src/op/dropout.cpp rename to src/frontends/paddlepaddle/src/op/dropout.cpp index 3548e63b226..fd4d5546184 100644 --- a/ngraph/frontend/paddlepaddle/src/op/dropout.cpp +++ b/src/frontends/paddlepaddle/src/op/dropout.cpp @@ -2,9 +2,10 @@ // SPDX-License-Identifier: Apache-2.0 // -#include #include +#include "openvino/opsets/opset6.hpp" + namespace ov { namespace frontend { namespace pdpd { @@ -17,10 +18,9 @@ NamedOutputs dropout(const NodeContext& node) { (dropout_implementation == "downgrade_in_infer" || dropout_implementation == "upscale_in_train"), "Unsupported dropout mode!"); if (dropout_implementation == "downgrade_in_infer") { - auto dropout_prob = ngraph::opset6::Constant::create(ngraph::element::f32, - {1}, - {1 - node.get_attribute("dropout_prob")}); - return node.default_single_output_mapping({std::make_shared(data, dropout_prob)}, + auto dropout_prob = + ov::opset6::Constant::create(ov::element::f32, {1}, {1 - node.get_attribute("dropout_prob")}); + return node.default_single_output_mapping({std::make_shared(data, dropout_prob)}, {"Out"}); } else { return node.default_single_output_mapping(data.get_node_shared_ptr(), {"Out"}); diff --git a/ngraph/frontend/paddlepaddle/src/op/elementwise_ops.cpp b/src/frontends/paddlepaddle/src/op/elementwise_ops.cpp similarity index 62% rename from ngraph/frontend/paddlepaddle/src/op/elementwise_ops.cpp rename to src/frontends/paddlepaddle/src/op/elementwise_ops.cpp index dd08bdc7b15..7dcf4a62a11 100644 --- a/ngraph/frontend/paddlepaddle/src/op/elementwise_ops.cpp +++ b/src/frontends/paddlepaddle/src/op/elementwise_ops.cpp @@ -3,9 +3,10 @@ // #include -#include #include +#include "openvino/opsets/opset6.hpp" + namespace ov { namespace frontend { namespace pdpd { @@ -25,9 +26,9 @@ NamedOutputs elementwise_ops(const NodeContext& node) { if ((axis == -1) || (axis == x_rank - 1) || (x_rank == y_rank)) { return node.default_single_output_mapping({std::make_shared(x, y)}, {"Out"}); } else { - // This broadcast can be implemented by either ngraph::Reshape or - // ngraph::Broadcast. Since PDPD implicates y_shape is a subsequence of - // x_shape starting from axis, to use ngraph::Reshape like Paddle2ONNX, + // This broadcast can be implemented by either ov::Reshape or + // ov::Broadcast. Since PDPD implicates y_shape is a subsequence of + // x_shape starting from axis, to use ov::Reshape like Paddle2ONNX, // which is more friendly to PnP. auto broadcast_shape = std::vector(x_rank, 1); PartialShape y_shape = y.get_partial_shape(); @@ -35,49 +36,48 @@ NamedOutputs elementwise_ops(const NodeContext& node) { for (auto it = y_shape.begin(); it != y_shape.end(); ++i, ++it) broadcast_shape[axis + i] = (*it).get_length(); - auto reshape_node = ngraph::opset6::Constant::create(ngraph::element::i64, - ngraph::Shape{broadcast_shape.size()}, - broadcast_shape); - auto y_node = std::make_shared(y, reshape_node, false); + auto reshape_node = + ov::opset6::Constant::create(ov::element::i64, ov::Shape{broadcast_shape.size()}, broadcast_shape); + auto y_node = std::make_shared(y, reshape_node, false); return node.default_single_output_mapping({std::make_shared(x, y_node)}, {"Out"}); } } // NamedOutputs elementwise_add(const NodeContext& node_context) { - return elementwise_ops(node_context); + return elementwise_ops(node_context); } NamedOutputs elementwise_sub(const NodeContext& node_context) { - return elementwise_ops(node_context); + return elementwise_ops(node_context); } NamedOutputs elementwise_mul(const NodeContext& node_context) { - return elementwise_ops(node_context); + return elementwise_ops(node_context); } NamedOutputs elementwise_div(const NodeContext& node_context) { - return elementwise_ops(node_context); + return elementwise_ops(node_context); } NamedOutputs elementwise_min(const NodeContext& node_context) { - return elementwise_ops(node_context); + return elementwise_ops(node_context); } NamedOutputs elementwise_max(const NodeContext& node_context) { - return elementwise_ops(node_context); + return elementwise_ops(node_context); } NamedOutputs elementwise_pow(const NodeContext& node_context) { - return elementwise_ops(node_context); + return elementwise_ops(node_context); } NamedOutputs elementwise_equal(const NodeContext& node_context) { - return elementwise_ops(node_context); + return elementwise_ops(node_context); } NamedOutputs elementwise_greater_equal(const NodeContext& node_context) { - return elementwise_ops(node_context); + return elementwise_ops(node_context); } } // namespace op diff --git a/ngraph/frontend/paddlepaddle/src/op/embedding.cpp b/src/frontends/paddlepaddle/src/op/embedding.cpp similarity index 98% rename from ngraph/frontend/paddlepaddle/src/op/embedding.cpp rename to src/frontends/paddlepaddle/src/op/embedding.cpp index 7a2c337b753..e8cfe77f4e8 100644 --- a/ngraph/frontend/paddlepaddle/src/op/embedding.cpp +++ b/src/frontends/paddlepaddle/src/op/embedding.cpp @@ -3,7 +3,8 @@ // #include -#include + +#include "openvino/opsets/opset8.hpp" namespace ov { namespace frontend { diff --git a/ngraph/frontend/paddlepaddle/src/op/exp.cpp b/src/frontends/paddlepaddle/src/op/exp.cpp similarity index 100% rename from ngraph/frontend/paddlepaddle/src/op/exp.cpp rename to src/frontends/paddlepaddle/src/op/exp.cpp diff --git a/ngraph/frontend/paddlepaddle/src/op/expand_v2.cpp b/src/frontends/paddlepaddle/src/op/expand_v2.cpp similarity index 51% rename from ngraph/frontend/paddlepaddle/src/op/expand_v2.cpp rename to src/frontends/paddlepaddle/src/op/expand_v2.cpp index c9ab3347d1e..3cc59b41778 100644 --- a/ngraph/frontend/paddlepaddle/src/op/expand_v2.cpp +++ b/src/frontends/paddlepaddle/src/op/expand_v2.cpp @@ -2,9 +2,10 @@ // SPDX-License-Identifier: Apache-2.0 // -#include #include -#include + +#include "openvino/opsets/opset6.hpp" +#include "paddlepaddle_frontend/utility.hpp" namespace ov { namespace frontend { @@ -17,12 +18,12 @@ NamedOutputs expand_v2(const NodeContext& node) { shape_expected_node = node.get_ng_input("Shape"); } else if (node.has_ng_input("expand_shapes_tensor")) { auto inputs = node.get_ng_inputs("expand_shapes_tensor"); - ngraph::NodeVector node_vec; + ov::NodeVector node_vec; for (auto& input : inputs) { - auto cast = std::make_shared(input, element::i32); + auto cast = std::make_shared(input, element::i32); node_vec.push_back(cast); } - shape_expected_node = std::make_shared(node_vec, 0); + shape_expected_node = std::make_shared(node_vec, 0); } else { std::vector shape_expected; if (node.has_attribute>("shape")) { @@ -30,20 +31,17 @@ NamedOutputs expand_v2(const NodeContext& node) { } else { throw std::runtime_error("expand: has no shape attribute"); } - shape_expected_node = - ngraph::opset6::Constant::create(ngraph::element::i32, {shape_expected.size()}, shape_expected); + shape_expected_node = ov::opset6::Constant::create(ov::element::i32, {shape_expected.size()}, shape_expected); } // if -1 in shape we will copy the orginal value from input - auto zero_node = ngraph::opset6::Constant::create(ngraph::element::i32, {1}, {0}); - auto mask_node = std::make_shared(shape_expected_node, zero_node); - auto input_shape_node = std::make_shared(x, element::i32); - auto fixed_shape_node = std::make_shared(mask_node, shape_expected_node, input_shape_node); - auto repeated_node = std::make_shared(fixed_shape_node, input_shape_node, false); + auto zero_node = ov::opset6::Constant::create(ov::element::i32, {1}, {0}); + auto mask_node = std::make_shared(shape_expected_node, zero_node); + auto input_shape_node = std::make_shared(x, element::i32); + auto fixed_shape_node = std::make_shared(mask_node, shape_expected_node, input_shape_node); + auto repeated_node = std::make_shared(fixed_shape_node, input_shape_node, false); return node.default_single_output_mapping( - {std::make_shared( - x, - std::make_shared(repeated_node, element::i64))}, + {std::make_shared(x, std::make_shared(repeated_node, element::i64))}, {"Out"}); } diff --git a/ngraph/frontend/paddlepaddle/src/op/fill_any_like.cpp b/src/frontends/paddlepaddle/src/op/fill_any_like.cpp similarity index 94% rename from ngraph/frontend/paddlepaddle/src/op/fill_any_like.cpp rename to src/frontends/paddlepaddle/src/op/fill_any_like.cpp index 11a2371c0d4..af52a2581b4 100644 --- a/ngraph/frontend/paddlepaddle/src/op/fill_any_like.cpp +++ b/src/frontends/paddlepaddle/src/op/fill_any_like.cpp @@ -12,7 +12,7 @@ namespace pdpd { namespace op { NamedOutputs fill_any_like(const NodeContext& node) { const auto x = node.get_ng_input("X"); - auto dtype = node.get_attribute("dtype", element::undefined); + auto dtype = node.get_attribute("dtype", element::undefined); const auto value = node.get_attribute("value"); if (dtype == element::undefined) { // when type does not define, use the input type diff --git a/ngraph/frontend/paddlepaddle/src/op/fill_constant.cpp b/src/frontends/paddlepaddle/src/op/fill_constant.cpp similarity index 94% rename from ngraph/frontend/paddlepaddle/src/op/fill_constant.cpp rename to src/frontends/paddlepaddle/src/op/fill_constant.cpp index ffc92c3397b..0983bbabe41 100644 --- a/ngraph/frontend/paddlepaddle/src/op/fill_constant.cpp +++ b/src/frontends/paddlepaddle/src/op/fill_constant.cpp @@ -3,7 +3,8 @@ // #include -#include + +#include "openvino/opsets/opset6.hpp" namespace ov { namespace frontend { @@ -11,7 +12,7 @@ namespace pdpd { namespace op { NamedOutputs fill_constant(const NodeContext& node) { auto shape = node.get_attribute>("shape"); - auto dtype = node.get_attribute("dtype"); + auto dtype = node.get_attribute("dtype"); Output value_node; Output shape_node; if (node.has_ng_input("ValueTensor")) { diff --git a/ngraph/frontend/paddlepaddle/src/op/fill_constant_batch_size_like.cpp b/src/frontends/paddlepaddle/src/op/fill_constant_batch_size_like.cpp similarity index 58% rename from ngraph/frontend/paddlepaddle/src/op/fill_constant_batch_size_like.cpp rename to src/frontends/paddlepaddle/src/op/fill_constant_batch_size_like.cpp index 04676913e74..e0f4c5728b0 100644 --- a/ngraph/frontend/paddlepaddle/src/op/fill_constant_batch_size_like.cpp +++ b/src/frontends/paddlepaddle/src/op/fill_constant_batch_size_like.cpp @@ -4,55 +4,56 @@ #include -#include #include -#include + +#include "openvino/opsets/opset6.hpp" +#include "paddlepaddle_frontend/utility.hpp" namespace ov { namespace frontend { namespace pdpd { namespace op { static std::shared_ptr get_val(int32_t idx, const Output& data) { - auto startsNode = ngraph::opset6::Constant::create(element::i32, {1}, {idx}); - auto endsNode = ngraph::opset6::Constant::create(element::i32, {1}, {idx + 1}); - auto stridesNode = ngraph::opset6::Constant::create(element::i32, {1}, {1}); - return std::make_shared(data, - startsNode, - endsNode, - stridesNode, - std::vector(1, 0), - std::vector(1, 0)); + auto startsNode = ov::opset6::Constant::create(element::i32, {1}, {idx}); + auto endsNode = ov::opset6::Constant::create(element::i32, {1}, {idx + 1}); + auto stridesNode = ov::opset6::Constant::create(element::i32, {1}, {1}); + return std::make_shared(data, + startsNode, + endsNode, + stridesNode, + std::vector(1, 0), + std::vector(1, 0)); } static std::shared_ptr set_val(int32_t idx, std::shared_ptr val_node, std::shared_ptr array_node) { NodeVector nodes; if (idx > 0) { // [0, idx) - auto startsNode = ngraph::opset6::Constant::create(element::i32, {1}, {0}); - auto endsNode = ngraph::opset6::Constant::create(element::i32, {1}, {idx}); - auto stridesNode = ngraph::opset6::Constant::create(element::i32, {1}, {1}); - auto head = std::make_shared(array_node, - startsNode, - endsNode, - stridesNode, - std::vector(1, 0), - std::vector(1, 0)); - nodes.push_back(head); - } - nodes.push_back(val_node); - // [idx + 1, max) - auto startsNode = ngraph::opset6::Constant::create(element::i32, {1}, {idx + 1}); - auto endsNode = ngraph::opset6::Constant::create(element::i32, {1}, {INT_MAX}); - auto stridesNode = ngraph::opset6::Constant::create(element::i32, {1}, {1}); - auto tail = std::make_shared(array_node, + auto startsNode = ov::opset6::Constant::create(element::i32, {1}, {0}); + auto endsNode = ov::opset6::Constant::create(element::i32, {1}, {idx}); + auto stridesNode = ov::opset6::Constant::create(element::i32, {1}, {1}); + auto head = std::make_shared(array_node, startsNode, endsNode, stridesNode, std::vector(1, 0), std::vector(1, 0)); + nodes.push_back(head); + } + nodes.push_back(val_node); + // [idx + 1, max) + auto startsNode = ov::opset6::Constant::create(element::i32, {1}, {idx + 1}); + auto endsNode = ov::opset6::Constant::create(element::i32, {1}, {INT_MAX}); + auto stridesNode = ov::opset6::Constant::create(element::i32, {1}, {1}); + auto tail = std::make_shared(array_node, + startsNode, + endsNode, + stridesNode, + std::vector(1, 0), + std::vector(1, 0)); nodes.push_back(tail); - return std::make_shared(nodes, 0); + return std::make_shared(nodes, 0); } template get_seed_node(const NodeContext& node) { auto str_value = node.get_attribute("str_value"); if (str_value.empty()) { auto float_value = node.get_attribute("value"); - val_node = ngraph::opset6::Constant::create(dtype, {1}, {static_cast(float_value)}); + val_node = ov::opset6::Constant::create(dtype, {1}, {static_cast(float_value)}); } else { std::stringstream ss(str_value); StorageDataType tmp_value; ss >> tmp_value; - val_node = ngraph::opset6::Constant::create(dtype, {1}, {static_cast(tmp_value)}); + val_node = ov::opset6::Constant::create(dtype, {1}, {static_cast(tmp_value)}); } return val_node; } @@ -105,18 +106,17 @@ NamedOutputs fill_constant_batch_size_like(const NodeContext& node) { auto output_dim_idx = node.get_attribute("output_dim_idx"); auto shapes = node.get_attribute>("shape"); auto input = node.get_ng_input("Input"); - auto input_shape = std::make_shared(input, element::i32); + auto input_shape = std::make_shared(input, element::i32); // 1, cat the array: // shape[0, shape[output_dim_idx]) + input_shape[input_dim_idx] + // shape[shape[output_dim_idx + 1], -1] auto input_val_node = get_val(input_dim_idx, input_shape); - auto shapes_node = ngraph::opset6::Constant::create(ngraph::element::i32, {shapes.size()}, shapes); + auto shapes_node = ov::opset6::Constant::create(ov::element::i32, {shapes.size()}, shapes); auto shape_node = set_val(output_dim_idx, input_val_node, shapes_node); // 2, use the shape broadcast the node auto val_node = get_seed_node(node); - return node.default_single_output_mapping({std::make_shared(val_node, shape_node)}, - {"Out"}); + return node.default_single_output_mapping({std::make_shared(val_node, shape_node)}, {"Out"}); } } // namespace op diff --git a/ngraph/frontend/paddlepaddle/src/op/flatten_contiguous_range.cpp b/src/frontends/paddlepaddle/src/op/flatten_contiguous_range.cpp similarity index 96% rename from ngraph/frontend/paddlepaddle/src/op/flatten_contiguous_range.cpp rename to src/frontends/paddlepaddle/src/op/flatten_contiguous_range.cpp index 0a32a251ac5..7a395248b1d 100644 --- a/ngraph/frontend/paddlepaddle/src/op/flatten_contiguous_range.cpp +++ b/src/frontends/paddlepaddle/src/op/flatten_contiguous_range.cpp @@ -2,9 +2,9 @@ // SPDX-License-Identifier: Apache-2.0 // -#include #include -#include + +#include "openvino/opsets/opset6.hpp" namespace ov { namespace frontend { diff --git a/ngraph/frontend/paddlepaddle/src/op/gelu.cpp b/src/frontends/paddlepaddle/src/op/gelu.cpp similarity index 83% rename from ngraph/frontend/paddlepaddle/src/op/gelu.cpp rename to src/frontends/paddlepaddle/src/op/gelu.cpp index 6f0593e9215..a5ed25ec636 100644 --- a/ngraph/frontend/paddlepaddle/src/op/gelu.cpp +++ b/src/frontends/paddlepaddle/src/op/gelu.cpp @@ -13,7 +13,7 @@ namespace op { NamedOutputs gelu(const NodeContext& node) { const auto data = node.get_ng_input("X"); const auto approximate = node.get_attribute("approximate", false); - const auto mode = approximate ? ngraph::op::GeluApproximationMode::TANH : ngraph::op::GeluApproximationMode::ERF; + const auto mode = approximate ? ov::op::GeluApproximationMode::TANH : ov::op::GeluApproximationMode::ERF; return node.default_single_output_mapping({std::make_shared(data, mode)}, {"Out"}); } diff --git a/ngraph/frontend/paddlepaddle/src/op/hard_sigmoid.cpp b/src/frontends/paddlepaddle/src/op/hard_sigmoid.cpp similarity index 63% rename from ngraph/frontend/paddlepaddle/src/op/hard_sigmoid.cpp rename to src/frontends/paddlepaddle/src/op/hard_sigmoid.cpp index b3a840c4618..fa993e5e444 100644 --- a/ngraph/frontend/paddlepaddle/src/op/hard_sigmoid.cpp +++ b/src/frontends/paddlepaddle/src/op/hard_sigmoid.cpp @@ -2,9 +2,10 @@ // SPDX-License-Identifier: Apache-2.0 // -#include #include -#include + +#include "openvino/opsets/opset6.hpp" +#include "paddlepaddle_frontend/utility.hpp" namespace ov { namespace frontend { @@ -15,10 +16,9 @@ NamedOutputs hard_sigmoid(const NodeContext& node) { auto dtype = data.get_element_type(); float slope = node.get_attribute("slope", 0.2f); float offset = node.get_attribute("offset", 0.5f); - auto alpha = ngraph::opset6::Constant::create(dtype, Shape{}, {slope}); - auto beta = ngraph::opset6::Constant::create(dtype, Shape{}, {offset}); - return node.default_single_output_mapping({std::make_shared(data, alpha, beta)}, - {"Out"}); + auto alpha = ov::opset6::Constant::create(dtype, Shape{}, {slope}); + auto beta = ov::opset6::Constant::create(dtype, Shape{}, {offset}); + return node.default_single_output_mapping({std::make_shared(data, alpha, beta)}, {"Out"}); } } // namespace op diff --git a/ngraph/frontend/paddlepaddle/src/op/hard_swish.cpp b/src/frontends/paddlepaddle/src/op/hard_swish.cpp similarity index 89% rename from ngraph/frontend/paddlepaddle/src/op/hard_swish.cpp rename to src/frontends/paddlepaddle/src/op/hard_swish.cpp index 618d29ae3bc..196705e0496 100644 --- a/ngraph/frontend/paddlepaddle/src/op/hard_swish.cpp +++ b/src/frontends/paddlepaddle/src/op/hard_swish.cpp @@ -2,9 +2,10 @@ // SPDX-License-Identifier: Apache-2.0 // -#include #include -#include + +#include "openvino/opsets/opset6.hpp" +#include "paddlepaddle_frontend/utility.hpp" namespace ov { namespace frontend { @@ -24,7 +25,7 @@ NamedOutputs hard_swish(const NodeContext& node) { auto offset = node.get_attribute("offset"); PDPD_ASSERT(std::abs(offset - 3.0) < 0.001, "hard_swish: Only offset = 3.0 is currently supported"); } - return node.default_single_output_mapping({std::make_shared(data)}, {"Out"}); + return node.default_single_output_mapping({std::make_shared(data)}, {"Out"}); } } // namespace op diff --git a/ngraph/frontend/paddlepaddle/src/op/interp.cpp b/src/frontends/paddlepaddle/src/op/interp.cpp similarity index 90% rename from ngraph/frontend/paddlepaddle/src/op/interp.cpp rename to src/frontends/paddlepaddle/src/op/interp.cpp index e1a6fdca36e..7831ce06389 100644 --- a/ngraph/frontend/paddlepaddle/src/op/interp.cpp +++ b/src/frontends/paddlepaddle/src/op/interp.cpp @@ -12,10 +12,10 @@ namespace pdpd { namespace op { using namespace default_opset; -static std::shared_ptr calculate_output_shape_based_on_scales(const Output& data, - const std::vector& scale, - Output& scales, - const int space_dim) { +static std::shared_ptr calculate_output_shape_based_on_scales(const Output& data, + const std::vector& scale, + Output& scales, + const int space_dim) { const size_t scale_size = static_cast(space_dim + 2); FRONT_END_GENERAL_CHECK(scale.size() > 0 && scale.size() <= scale_size); @@ -25,25 +25,25 @@ static std::shared_ptr calculate_output_shape_based_on_scales(cons const auto shape_of_data = std::make_shared(std::make_shared(data), scales.get_element_type()); const auto multiply = std::make_shared(shape_of_data, scales); - const auto output_shape = std::make_shared(multiply, ngraph::element::i64); + const auto output_shape = std::make_shared(multiply, ov::element::i64); return output_shape; } -static std::shared_ptr calculate_scales_based_on_sizes(const Output& data, - const Output& sizes) { +static std::shared_ptr calculate_scales_based_on_sizes(const Output& data, + const Output& sizes) { const float epsilon = 1.0e-5; - const auto shape_of_data = std::make_shared(std::make_shared(data), ngraph::element::f32); - const auto converted_sizes = std::make_shared(sizes, ngraph::element::f32); + const auto shape_of_data = std::make_shared(std::make_shared(data), ov::element::f32); + const auto converted_sizes = std::make_shared(sizes, ov::element::f32); const auto divide = std::make_shared(converted_sizes, shape_of_data); - const auto eps_node = std::make_shared(ngraph::element::f32, Shape{}, epsilon); + const auto eps_node = std::make_shared(ov::element::f32, Shape{}, epsilon); const auto scales = std::make_shared(divide, eps_node); return scales; } -static std::shared_ptr extract_out_sizes(const Output& data, - const std::vector& out_sizes) { +static std::shared_ptr extract_out_sizes(const Output& data, + const std::vector& out_sizes) { const auto shape_of_x = std::make_shared(data); const auto shape_begin = Constant::create(element::i64, {1}, {0}); const int end_idx = static_cast(out_sizes.size()); diff --git a/ngraph/frontend/paddlepaddle/src/op/layer_norm.cpp b/src/frontends/paddlepaddle/src/op/layer_norm.cpp similarity index 96% rename from ngraph/frontend/paddlepaddle/src/op/layer_norm.cpp rename to src/frontends/paddlepaddle/src/op/layer_norm.cpp index f28468a1523..12599ad99bc 100644 --- a/ngraph/frontend/paddlepaddle/src/op/layer_norm.cpp +++ b/src/frontends/paddlepaddle/src/op/layer_norm.cpp @@ -37,8 +37,8 @@ NamedOutputs layer_norm(const NodeContext& node) { std::vector{0}, std::vector{1}); - const auto mvn = std::make_shared(data, axis, true, epsilon, ngraph::op::MVNEpsMode::INSIDE_SQRT); - std::shared_ptr result = mvn; + const auto mvn = std::make_shared(data, axis, true, epsilon, ov::op::MVNEpsMode::INSIDE_SQRT); + std::shared_ptr result = mvn; if (node.has_ng_input("Scale")) { const auto s = node.get_ng_input("Scale"); const auto reshaped_s = std::make_shared(s, scale_bias_shape, false); diff --git a/ngraph/frontend/paddlepaddle/src/op/leakyrelu.cpp b/src/frontends/paddlepaddle/src/op/leakyrelu.cpp similarity index 68% rename from ngraph/frontend/paddlepaddle/src/op/leakyrelu.cpp rename to src/frontends/paddlepaddle/src/op/leakyrelu.cpp index c5ab5b74f21..4a54ccb5173 100644 --- a/ngraph/frontend/paddlepaddle/src/op/leakyrelu.cpp +++ b/src/frontends/paddlepaddle/src/op/leakyrelu.cpp @@ -2,17 +2,18 @@ // SPDX-License-Identifier: Apache-2.0 // -#include #include +#include "openvino/opsets/opset6.hpp" + namespace ov { namespace frontend { namespace pdpd { namespace op { NamedOutputs leaky_relu(const NodeContext& node) { auto data = node.get_ng_input("X"); - auto alpha = ngraph::opset6::Constant::create(ngraph::element::f32, {1}, {node.get_attribute("alpha")}); - return node.default_single_output_mapping({std::make_shared(data, alpha)}, {"Out"}); + auto alpha = ov::opset6::Constant::create(ov::element::f32, {1}, {node.get_attribute("alpha")}); + return node.default_single_output_mapping({std::make_shared(data, alpha)}, {"Out"}); } } // namespace op } // namespace pdpd diff --git a/ngraph/frontend/paddlepaddle/src/op/log.cpp b/src/frontends/paddlepaddle/src/op/log.cpp similarity index 78% rename from ngraph/frontend/paddlepaddle/src/op/log.cpp rename to src/frontends/paddlepaddle/src/op/log.cpp index 8b0e18c5826..a38e802cb5a 100644 --- a/ngraph/frontend/paddlepaddle/src/op/log.cpp +++ b/src/frontends/paddlepaddle/src/op/log.cpp @@ -2,9 +2,10 @@ // SPDX-License-Identifier: Apache-2.0 // -#include #include -#include + +#include "openvino/opsets/opset6.hpp" +#include "paddlepaddle_frontend/utility.hpp" namespace ov { namespace frontend { @@ -12,7 +13,7 @@ namespace pdpd { namespace op { NamedOutputs log(const NodeContext& node) { auto x = node.get_ng_input("X"); - return node.default_single_output_mapping({std::make_shared(x)}, {"Out"}); + return node.default_single_output_mapping({std::make_shared(x)}, {"Out"}); } } // namespace op } // namespace pdpd diff --git a/ngraph/frontend/paddlepaddle/src/op/logical_not.cpp b/src/frontends/paddlepaddle/src/op/logical_not.cpp similarity index 83% rename from ngraph/frontend/paddlepaddle/src/op/logical_not.cpp rename to src/frontends/paddlepaddle/src/op/logical_not.cpp index 71d571d56c8..f182be450ec 100644 --- a/ngraph/frontend/paddlepaddle/src/op/logical_not.cpp +++ b/src/frontends/paddlepaddle/src/op/logical_not.cpp @@ -2,16 +2,17 @@ // SPDX-License-Identifier: Apache-2.0 // -#include #include +#include "openvino/opsets/opset6.hpp" + namespace ov { namespace frontend { namespace pdpd { namespace op { NamedOutputs logical_not(const NodeContext& node) { auto data = node.get_ng_input("X"); - return node.default_single_output_mapping({std::make_shared(data)}, {"Out"}); + return node.default_single_output_mapping({std::make_shared(data)}, {"Out"}); } } // namespace op } // namespace pdpd diff --git a/ngraph/frontend/paddlepaddle/src/op/lstm.cpp b/src/frontends/paddlepaddle/src/op/lstm.cpp similarity index 84% rename from ngraph/frontend/paddlepaddle/src/op/lstm.cpp rename to src/frontends/paddlepaddle/src/op/lstm.cpp index 3f34629b394..da8c93a2cff 100644 --- a/ngraph/frontend/paddlepaddle/src/op/lstm.cpp +++ b/src/frontends/paddlepaddle/src/op/lstm.cpp @@ -3,10 +3,10 @@ // #include -#include -#include "ngraph/builder/reshape.hpp" +#include "openvino/opsets/opset6.hpp" #include "paddlepaddle_frontend/utility.hpp" +#include "pdpd_utils.hpp" namespace ov { namespace frontend { @@ -28,7 +28,7 @@ enum class LSTMInput { struct LSTMNgInputMap { explicit LSTMNgInputMap(const NodeContext& node, Output& prev_output, int layer) { - auto input_x = ngraph::builder::opset1::reorder_axes(prev_output, {1, 0, 2}); + auto input_x = reorder_axes(prev_output, {1, 0, 2}); //[begin. end) auto weight_list = node.get_ng_inputs("WeightList"); auto weight_begin = weight_list.begin(); @@ -115,39 +115,39 @@ struct LSTMNgInputMap { auto c_end = opset6::Constant::create(element::i64, {1}, {layer * bidirect_len + bidirect_len}); m_input_map[LSTMInput::LSTM_INPUT_INIT_H] = - ngraph::builder::opset1::reorder_axes(std::make_shared(init_states[0], - h_begin, - h_end, - std::vector{0}, - std::vector{0}), - {1, 0, 2}); + reorder_axes(std::make_shared(init_states[0], + h_begin, + h_end, + std::vector{0}, + std::vector{0}), + {1, 0, 2}); m_input_map[LSTMInput::LSTM_INPUT_INIT_C] = - ngraph::builder::opset1::reorder_axes(std::make_shared(init_states[1], - c_begin, - c_end, - std::vector{0}, - std::vector{0}), - {1, 0, 2}); + reorder_axes(std::make_shared(init_states[1], + c_begin, + c_end, + std::vector{0}, + std::vector{0}), + {1, 0, 2}); } - Output& at(const LSTMInput& key) { + Output& at(const LSTMInput& key) { return m_input_map.at(key); } - std::map> m_input_map; + std::map> m_input_map; }; // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ATTRIBUTES PARSING ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ struct LSTMAttributes { explicit LSTMAttributes(const NodeContext& node) - : m_direction(node.get_attribute("is_bidirec") ? ngraph::op::RecurrentSequenceDirection::BIDIRECTIONAL - : ngraph::op::RecurrentSequenceDirection::FORWARD), + : m_direction(node.get_attribute("is_bidirec") ? ov::op::RecurrentSequenceDirection::BIDIRECTIONAL + : ov::op::RecurrentSequenceDirection::FORWARD), m_hidden_size(node.get_attribute("hidden_size")), m_layers(node.get_attribute("num_layers")) {}; - ngraph::op::RecurrentSequenceDirection m_direction; + ov::op::RecurrentSequenceDirection m_direction; int32_t m_hidden_size; int32_t m_layers; }; @@ -172,12 +172,12 @@ NamedOutputs lstm(const NodeContext& node) { input_map.at(LSTMInput::LSTM_INPUT_B), attrs.m_hidden_size, attrs.m_direction); - prev_output = ngraph::builder::opset1::reorder_axes(lstm_sequence->output(0), {2, 0, 1, 3}); + prev_output = reorder_axes(lstm_sequence->output(0), {2, 0, 1, 3}); auto out_shape = opset6::Constant::create(element::i64, Shape{3}, {0, 0, -1}); prev_output = std::make_shared(prev_output, out_shape, true); - final_h.push_back(ngraph::builder::opset1::reorder_axes(lstm_sequence->output(1), {1, 0, 2})); - final_c.push_back(ngraph::builder::opset1::reorder_axes(lstm_sequence->output(2), {1, 0, 2})); + final_h.push_back(reorder_axes(lstm_sequence->output(1), {1, 0, 2})); + final_c.push_back(reorder_axes(lstm_sequence->output(2), {1, 0, 2})); } NamedOutputs named_outputs; diff --git a/ngraph/frontend/paddlepaddle/src/op/matmul.cpp b/src/frontends/paddlepaddle/src/op/matmul.cpp similarity index 69% rename from ngraph/frontend/paddlepaddle/src/op/matmul.cpp rename to src/frontends/paddlepaddle/src/op/matmul.cpp index 4e7f76d0e57..37a4a69eeb5 100644 --- a/ngraph/frontend/paddlepaddle/src/op/matmul.cpp +++ b/src/frontends/paddlepaddle/src/op/matmul.cpp @@ -1,9 +1,10 @@ // Copyright (C) 2018-2021 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // -#include #include +#include "openvino/opsets/opset6.hpp" + namespace ov { namespace frontend { namespace pdpd { @@ -14,13 +15,12 @@ NamedOutputs matmul(const NodeContext& node) { auto alpha = node.get_attribute("alpha", 1); auto transpose_a = node.get_attribute("transpose_X", false); auto transpose_b = node.get_attribute("transpose_Y", false); - auto mm = std::make_shared(x, y, transpose_a, transpose_b); + auto mm = std::make_shared(x, y, transpose_a, transpose_b); if (alpha == 1) { return node.default_single_output_mapping({mm}, {"Out"}); } else { - auto alpha_node = ngraph::opset6::Constant::create(ngraph::element::f32, {1}, {alpha}); - return node.default_single_output_mapping({std::make_shared(mm, alpha_node)}, - {"Out"}); + auto alpha_node = ov::opset6::Constant::create(ov::element::f32, {1}, {alpha}); + return node.default_single_output_mapping({std::make_shared(mm, alpha_node)}, {"Out"}); } } diff --git a/ngraph/frontend/paddlepaddle/src/op/matmul_v2.cpp b/src/frontends/paddlepaddle/src/op/matmul_v2.cpp similarity index 100% rename from ngraph/frontend/paddlepaddle/src/op/matmul_v2.cpp rename to src/frontends/paddlepaddle/src/op/matmul_v2.cpp diff --git a/ngraph/frontend/paddlepaddle/src/op/matrix_nms.cpp b/src/frontends/paddlepaddle/src/op/matrix_nms.cpp similarity index 96% rename from ngraph/frontend/paddlepaddle/src/op/matrix_nms.cpp rename to src/frontends/paddlepaddle/src/op/matrix_nms.cpp index 85ee304832c..12a7df7cd1d 100644 --- a/ngraph/frontend/paddlepaddle/src/op/matrix_nms.cpp +++ b/src/frontends/paddlepaddle/src/op/matrix_nms.cpp @@ -1,16 +1,16 @@ // Copyright (C) 2018-2021 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // -#include #include -#include + +#include "openvino/opsets/opset8.hpp" +#include "paddlepaddle_frontend/utility.hpp" namespace ov { namespace frontend { namespace pdpd { namespace op { NamedOutputs matrix_nms(const NodeContext& node) { - using namespace ngraph; using namespace opset8; using namespace element; diff --git a/ngraph/frontend/paddlepaddle/src/op/multiclass_nms.cpp b/src/frontends/paddlepaddle/src/op/multiclass_nms.cpp similarity index 95% rename from ngraph/frontend/paddlepaddle/src/op/multiclass_nms.cpp rename to src/frontends/paddlepaddle/src/op/multiclass_nms.cpp index ced2a327107..88871e680ea 100644 --- a/ngraph/frontend/paddlepaddle/src/op/multiclass_nms.cpp +++ b/src/frontends/paddlepaddle/src/op/multiclass_nms.cpp @@ -1,16 +1,16 @@ // Copyright (C) 2018-2021 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // -#include #include -#include + +#include "openvino/opsets/opset8.hpp" +#include "paddlepaddle_frontend/utility.hpp" namespace ov { namespace frontend { namespace pdpd { namespace op { NamedOutputs multiclass_nms(const NodeContext& node) { - using namespace ngraph; using namespace opset8; using namespace element; diff --git a/ngraph/frontend/paddlepaddle/src/op/pad3d.cpp b/src/frontends/paddlepaddle/src/op/pad3d.cpp similarity index 67% rename from ngraph/frontend/paddlepaddle/src/op/pad3d.cpp rename to src/frontends/paddlepaddle/src/op/pad3d.cpp index 5c92ad7d1e9..8a2a8f1b555 100644 --- a/ngraph/frontend/paddlepaddle/src/op/pad3d.cpp +++ b/src/frontends/paddlepaddle/src/op/pad3d.cpp @@ -2,9 +2,10 @@ // SPDX-License-Identifier: Apache-2.0 // -#include #include +#include "openvino/opsets/opset6.hpp" + namespace ov { namespace frontend { namespace pdpd { @@ -28,27 +29,27 @@ NamedOutputs pad3d(const NodeContext& node) { for (int i = 0; i < 6; i++) paddings[i] = padding_int; } else { - throw ngraph::ngraph_error("Unsupported paddings attribute!"); + PDPD_OP_VALIDATION_CHECK(node, false, "Unsupported paddings attribute!"); } auto pads_begin = std::vector(5, 0); auto pads_end = std::vector(5, 0); - Output values; - Output padding_begin; - Output padding_end; + Output values; + Output padding_begin; + Output padding_end; - ngraph::op::PadMode pad_mode; + ov::op::PadMode pad_mode; // TODO Support Circular mode in #55704 if (mode == "constant") { - pad_mode = ngraph::op::PadMode::CONSTANT; - values = ngraph::opset6::Constant::create(element::f32, ngraph::Shape{}, {value}); + pad_mode = ov::op::PadMode::CONSTANT; + values = ov::opset6::Constant::create(element::f32, ov::Shape{}, {value}); } else if (mode == "reflect") { - pad_mode = ngraph::op::PadMode::REFLECT; + pad_mode = ov::op::PadMode::REFLECT; } else if (mode == "replicate") { - pad_mode = ngraph::op::PadMode::EDGE; + pad_mode = ov::op::PadMode::EDGE; } else { - throw ngraph::ngraph_error("Unsupported 3d paddings mode: [" + mode + "]"); + PDPD_OP_VALIDATION_CHECK(node, false, "Unsupported 3d paddings mode: [" + mode + "]"); } if (data_format == "NCDHW") { @@ -66,19 +67,19 @@ NamedOutputs pad3d(const NodeContext& node) { pads_begin[1] = paddings[4]; // front pads_end[1] = paddings[5]; // back } else { - throw ngraph::ngraph_error("Unsupported 3d paddings data_format: [" + data_format + "]"); + PDPD_OP_VALIDATION_CHECK(node, false, "Unsupported 3d paddings data_format: [" + data_format + "]"); } - padding_begin = ngraph::opset6::Constant::create(element::i32, ngraph::Shape{pads_begin.size()}, pads_begin); - padding_end = ngraph::opset6::Constant::create(element::i32, ngraph::Shape{pads_end.size()}, pads_end); + padding_begin = ov::opset6::Constant::create(element::i32, ov::Shape{pads_begin.size()}, pads_begin); + padding_end = ov::opset6::Constant::create(element::i32, ov::Shape{pads_end.size()}, pads_end); if (mode == "constant") return node.default_single_output_mapping( - {std::make_shared(data, padding_begin, padding_end, values, pad_mode)}, + {std::make_shared(data, padding_begin, padding_end, values, pad_mode)}, {"Out"}); else return node.default_single_output_mapping( - {std::make_shared(data, padding_begin, padding_end, pad_mode)}, + {std::make_shared(data, padding_begin, padding_end, pad_mode)}, {"Out"}); } } // namespace op diff --git a/ngraph/frontend/paddlepaddle/src/op/pool2d.cpp b/src/frontends/paddlepaddle/src/op/pool2d.cpp similarity index 70% rename from ngraph/frontend/paddlepaddle/src/op/pool2d.cpp rename to src/frontends/paddlepaddle/src/op/pool2d.cpp index 8869a0c387b..d7606aa85bb 100644 --- a/ngraph/frontend/paddlepaddle/src/op/pool2d.cpp +++ b/src/frontends/paddlepaddle/src/op/pool2d.cpp @@ -4,33 +4,31 @@ // //***************************************************************************** -#include -#include #include +#include "openvino/opsets/opset6.hpp" +#include "openvino/opsets/opset8.hpp" + namespace ov { namespace frontend { namespace pdpd { namespace op { // helper func - get pad_begin and pad_end -static void get_paddings(const NodeContext& node, - ngraph::Shape& pad_begin, - ngraph::Shape& pad_end, - ngraph::op::PadType& auto_pad) { +static void get_paddings(const NodeContext& node, ov::Shape& pad_begin, ov::Shape& pad_end, ov::op::PadType& auto_pad) { if (node.has_attribute("padding_algorithm")) { auto pad_algo = node.get_attribute("padding_algorithm"); if (pad_algo == "SAME") { - auto_pad = ngraph::op::PadType::SAME_UPPER; + auto_pad = ov::op::PadType::SAME_UPPER; } else if (pad_algo == "VALID") { - auto_pad = ngraph::op::PadType::VALID; + auto_pad = ov::op::PadType::VALID; } else if (pad_algo == "EXPLICIT") { - auto_pad = ngraph::op::PadType::EXPLICIT; + auto_pad = ov::op::PadType::EXPLICIT; } else { throw std::runtime_error("Unsupported pooling padding_algorithm " + pad_algo); } } else { // adaptive_maxpool with no such attr. - auto_pad = ngraph::op::PadType::EXPLICIT; + auto_pad = ov::op::PadType::EXPLICIT; } /*If pool padding size is a tuple or list, it could be in three forms: @@ -69,7 +67,7 @@ NamedOutputs pool2d(const NodeContext& node) { auto kernel_shape = node.get_attribute>("ksize"); auto rounding_type = - node.get_attribute("ceil_mode", false) ? ngraph::op::RoundingType::CEIL : ngraph::op::RoundingType::FLOOR; + node.get_attribute("ceil_mode", false) ? ov::op::RoundingType::CEIL : ov::op::RoundingType::FLOOR; if (pooling_type.empty()) { pooling_type = "max"; @@ -83,20 +81,20 @@ NamedOutputs pool2d(const NodeContext& node) { int32_t input_rank = input_shape.rank().get_length(); PDPD_ASSERT(input_rank >= 2, "input tensor rank must be greater than 2"); - auto auto_pad = ngraph::op::PadType::EXPLICIT; - ngraph::Shape pad_begin, pad_end; + auto auto_pad = ov::op::PadType::EXPLICIT; + ov::Shape pad_begin, pad_end; get_paddings(node, pad_begin, pad_end, auto_pad); if (global_pooling || (adaptive && std::any_of(kernel_shape.begin(), kernel_shape.end(), [](int32_t i) { return i == 1; }))) { if (pooling_type == "max") { - auto axes = ngraph::opset6::Constant::create(ngraph::element::i64, {2}, {input_rank - 2, input_rank - 1}); - return node.default_single_output_mapping({std::make_shared(data, axes, true)}, + auto axes = ov::opset6::Constant::create(ov::element::i64, {2}, {input_rank - 2, input_rank - 1}); + return node.default_single_output_mapping({std::make_shared(data, axes, true)}, {"Out"}); } else { - auto axes = ngraph::opset6::Constant::create(ngraph::element::i64, {2}, {input_rank - 2, input_rank - 1}); - return node.default_single_output_mapping({std::make_shared(data, axes, true)}, + auto axes = ov::opset6::Constant::create(ov::element::i64, {2}, {input_rank - 2, input_rank - 1}); + return node.default_single_output_mapping({std::make_shared(data, axes, true)}, {"Out"}); } } else if (adaptive) { @@ -111,20 +109,20 @@ NamedOutputs pool2d(const NodeContext& node) { pool_size[1] = kernel_shape[1]; } - const Output output_shape = - ngraph::opset6::Constant::create(ngraph::element::i64, {pool_size.size()}, pool_size); + const Output output_shape = + ov::opset6::Constant::create(ov::element::i64, {pool_size.size()}, pool_size); if (pooling_type == "max") { std::vector> pool_outputs; pool_outputs = - std::make_shared(data, output_shape, ngraph::element::i32)->outputs(); + std::make_shared(data, output_shape, ov::element::i32)->outputs(); NamedOutputs outputs; outputs["Out"] = {pool_outputs[0]}; outputs["Mask"] = {pool_outputs[1]}; return outputs; } else { return node.default_single_output_mapping( - {std::make_shared(data, output_shape)}, + {std::make_shared(data, output_shape)}, {"Out"}); } } else { @@ -158,25 +156,25 @@ NamedOutputs pool2d(const NodeContext& node) { if (pooling_type == "max") { return node.default_single_output_mapping( - {std::make_shared(data, - ngraph::Strides(strides.begin(), strides.end()), - pad_begin, - pad_end, - ngraph::Shape{kernel_h, kernel_w}, - rounding_type, - auto_pad)}, + {std::make_shared(data, + ov::Strides(strides.begin(), strides.end()), + pad_begin, + pad_end, + ov::Shape{kernel_h, kernel_w}, + rounding_type, + auto_pad)}, {"Out"}); } else { bool exclude_pad = node.get_attribute("exclusive", false); return node.default_single_output_mapping( - {std::make_shared(data, - ngraph::Strides(strides.begin(), strides.end()), - pad_begin, - pad_end, - ngraph::Shape{kernel_h, kernel_w}, - exclude_pad, - rounding_type, - auto_pad)}, + {std::make_shared(data, + ov::Strides(strides.begin(), strides.end()), + pad_begin, + pad_end, + ov::Shape{kernel_h, kernel_w}, + exclude_pad, + rounding_type, + auto_pad)}, {"Out"}); } } diff --git a/ngraph/frontend/paddlepaddle/src/op/pow.cpp b/src/frontends/paddlepaddle/src/op/pow.cpp similarity index 66% rename from ngraph/frontend/paddlepaddle/src/op/pow.cpp rename to src/frontends/paddlepaddle/src/op/pow.cpp index 52182946a6e..22cbc91461e 100644 --- a/ngraph/frontend/paddlepaddle/src/op/pow.cpp +++ b/src/frontends/paddlepaddle/src/op/pow.cpp @@ -1,9 +1,10 @@ // Copyright (C) 2018-2021 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // -#include #include -#include + +#include "openvino/opsets/opset6.hpp" +#include "paddlepaddle_frontend/utility.hpp" namespace ov { namespace frontend { @@ -16,12 +17,12 @@ NamedOutputs pow(const NodeContext& node) { if (node.has_ng_input("FactorTensor")) { factor_node = node.get_ng_input("FactorTensor"); if (factor_node.get_element_type() != dtype) - factor_node = std::make_shared(factor_node, dtype); + factor_node = std::make_shared(factor_node, dtype); } else { - factor_node = ngraph::opset6::Constant::create(dtype, Shape{1}, {node.get_attribute("factor")}); + factor_node = ov::opset6::Constant::create(dtype, Shape{1}, {node.get_attribute("factor")}); } - return node.default_single_output_mapping({std::make_shared(x, factor_node)}, {"Out"}); + return node.default_single_output_mapping({std::make_shared(x, factor_node)}, {"Out"}); } } // namespace op diff --git a/src/frontends/paddlepaddle/src/op/prior_box.cpp b/src/frontends/paddlepaddle/src/op/prior_box.cpp new file mode 100644 index 00000000000..1801f8fd59f --- /dev/null +++ b/src/frontends/paddlepaddle/src/op/prior_box.cpp @@ -0,0 +1,70 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "openvino/op/prior_box.hpp" + +#include + +#include "default_opset.hpp" + +namespace ov { +namespace frontend { +namespace pdpd { +namespace op { +using namespace default_opset; +using namespace element; +namespace detail { +namespace { +std::shared_ptr make_slice(const std::shared_ptr& node, int64_t start, int64_t end) { + return std::make_shared(node, + Constant::create(i64, Shape{1}, std::vector{start}), + Constant::create(i64, Shape{1}, std::vector{end}), + std::vector{0}, // begin mask + std::vector{0}); // end mask +} +} // namespace +} // namespace detail +NamedOutputs prior_box(const NodeContext& node) { + auto input = node.get_ng_input("Input"); + auto Image = node.get_ng_input("Image"); + const auto input_shape = std::make_shared(input); + const auto Image_shape = std::make_shared(Image); + const auto output_shape_slice = detail::make_slice(input_shape, 2, 4); + const auto image_shape_slice = detail::make_slice(Image_shape, 2, 4); + + PriorBox::Attributes attrs; + attrs.min_size = node.get_attribute>("min_sizes", {}); + attrs.max_size = node.get_attribute>("max_sizes", {}); + attrs.aspect_ratio = node.get_attribute>("aspect_ratios", {1.0}); + attrs.flip = node.get_attribute("flip", false); + attrs.clip = node.get_attribute("clip", false); + attrs.step = node.get_attribute("step_w", 0); + attrs.min_max_aspect_ratios_order = node.get_attribute("min_max_aspect_ratios_order", false); + + attrs.offset = node.get_attribute("offset", 0.5); + attrs.variance = node.get_attribute>("variances", {0.1, 0.1, 0.2, 0.2}); + + const auto ov_prior_box_node = std::make_shared(output_shape_slice, image_shape_slice, attrs); + + const auto split_axis_node = Constant::create(i64, ov::Shape{}, {0}); + const auto node_prior_box_split = std::make_shared(ov_prior_box_node, split_axis_node, 2); + + const auto node_boxes_origin = node_prior_box_split->output(0); + const auto node_variances_origin = node_prior_box_split->output(1); + + const auto out_shape = + std::make_shared(NodeVector{output_shape_slice, Constant::create(i64, {2}, {-1, 4})}, 0); + + auto node_boxes_reshape = std::make_shared(node_boxes_origin, out_shape, true); + const auto node_variances_reshape = std::make_shared(node_variances_origin, out_shape, true); + + NamedOutputs outputs; + outputs["Boxes"] = {node_boxes_reshape}; + outputs["Variances"] = {node_variances_reshape}; + return outputs; +} +} // namespace op +} // namespace pdpd +} // namespace frontend +} // namespace ov diff --git a/ngraph/frontend/paddlepaddle/src/op/range.cpp b/src/frontends/paddlepaddle/src/op/range.cpp similarity index 55% rename from ngraph/frontend/paddlepaddle/src/op/range.cpp rename to src/frontends/paddlepaddle/src/op/range.cpp index a90f60d0cb5..9ebeff92d06 100644 --- a/ngraph/frontend/paddlepaddle/src/op/range.cpp +++ b/src/frontends/paddlepaddle/src/op/range.cpp @@ -2,9 +2,10 @@ // SPDX-License-Identifier: Apache-2.0 // -#include #include +#include "openvino/opsets/opset6.hpp" + namespace ov { namespace frontend { namespace pdpd { @@ -15,13 +16,13 @@ NamedOutputs range(const NodeContext& node) { auto step = node.get_ng_input("Step"); auto type = node.get_out_port_type("Out"); - const auto axis = ngraph::opset6::Constant::create(element::i64, Shape{}, {0}); - auto start_scalar = std::make_shared(start, axis); - auto stop_scalar = std::make_shared(stop, axis); - auto step_scalar = std::make_shared(step, axis); + const auto axis = ov::opset6::Constant::create(element::i64, Shape{}, {0}); + auto start_scalar = std::make_shared(start, axis); + auto stop_scalar = std::make_shared(stop, axis); + auto step_scalar = std::make_shared(step, axis); return node.default_single_output_mapping( - {std::make_shared(start_scalar, stop_scalar, step_scalar, type)}, + {std::make_shared(start_scalar, stop_scalar, step_scalar, type)}, {"Out"}); } diff --git a/ngraph/frontend/paddlepaddle/src/op/relu.cpp b/src/frontends/paddlepaddle/src/op/relu.cpp similarity index 73% rename from ngraph/frontend/paddlepaddle/src/op/relu.cpp rename to src/frontends/paddlepaddle/src/op/relu.cpp index 4aa63bda1dc..9277594cc9a 100644 --- a/ngraph/frontend/paddlepaddle/src/op/relu.cpp +++ b/src/frontends/paddlepaddle/src/op/relu.cpp @@ -2,16 +2,16 @@ // SPDX-License-Identifier: Apache-2.0 // -#include #include +#include "openvino/opsets/opset6.hpp" + namespace ov { namespace frontend { namespace pdpd { namespace op { NamedOutputs relu(const NodeContext& node) { - return node.default_single_output_mapping({std::make_shared(node.get_ng_input("X"))}, - {"Out"}); + return node.default_single_output_mapping({std::make_shared(node.get_ng_input("X"))}, {"Out"}); } } // namespace op diff --git a/ngraph/frontend/paddlepaddle/src/op/relu6.cpp b/src/frontends/paddlepaddle/src/op/relu6.cpp similarity index 77% rename from ngraph/frontend/paddlepaddle/src/op/relu6.cpp rename to src/frontends/paddlepaddle/src/op/relu6.cpp index 65aa1354cdd..2c37f0ac81f 100644 --- a/ngraph/frontend/paddlepaddle/src/op/relu6.cpp +++ b/src/frontends/paddlepaddle/src/op/relu6.cpp @@ -2,9 +2,10 @@ // SPDX-License-Identifier: Apache-2.0 // -#include #include -#include + +#include "openvino/opsets/opset6.hpp" +#include "paddlepaddle_frontend/utility.hpp" namespace ov { namespace frontend { @@ -13,7 +14,7 @@ namespace op { NamedOutputs relu6(const NodeContext& node) { auto data = node.get_ng_input("X"); auto threshold = node.get_attribute("threshold", 6.0f); - return node.default_single_output_mapping({std::make_shared(data, 0.0, threshold)}, {"Out"}); + return node.default_single_output_mapping({std::make_shared(data, 0.0, threshold)}, {"Out"}); } } // namespace op diff --git a/ngraph/frontend/paddlepaddle/src/op/reshape2.cpp b/src/frontends/paddlepaddle/src/op/reshape2.cpp similarity index 66% rename from ngraph/frontend/paddlepaddle/src/op/reshape2.cpp rename to src/frontends/paddlepaddle/src/op/reshape2.cpp index 6cffb7557ec..20e2bccea10 100644 --- a/ngraph/frontend/paddlepaddle/src/op/reshape2.cpp +++ b/src/frontends/paddlepaddle/src/op/reshape2.cpp @@ -2,9 +2,10 @@ // SPDX-License-Identifier: Apache-2.0 // -#include #include -#include + +#include "openvino/opsets/opset6.hpp" +#include "paddlepaddle_frontend/utility.hpp" namespace ov { namespace frontend { @@ -14,8 +15,8 @@ NamedOutputs reshape2(const NodeContext& node) { auto data = node.get_ng_input("X"); if (!node.has_ng_input("Shape") && !node.has_ng_input("ShapeTensor")) { auto shape_attr = node.get_attribute>("shape"); - auto shape_node = ngraph::opset6::Constant::create(ngraph::element::i32, {shape_attr.size()}, shape_attr); - return node.default_single_output_mapping({std::make_shared(data, shape_node, true)}, + auto shape_node = ov::opset6::Constant::create(ov::element::i32, {shape_attr.size()}, shape_attr); + return node.default_single_output_mapping({std::make_shared(data, shape_node, true)}, {"Out"}); } else { std::string name = "Shape"; @@ -24,14 +25,14 @@ NamedOutputs reshape2(const NodeContext& node) { } auto nodes = node.get_ng_inputs(name); - ngraph::NodeVector node_vec; + ov::NodeVector node_vec; for (auto& input_node : nodes) { - auto cast = std::make_shared(input_node, element::i64); + auto cast = std::make_shared(input_node, element::i64); node_vec.push_back(cast); } - auto shape_node = std::make_shared(node_vec, 0); - return node.default_single_output_mapping({std::make_shared(data, shape_node, true)}, + auto shape_node = std::make_shared(node_vec, 0); + return node.default_single_output_mapping({std::make_shared(data, shape_node, true)}, {"Out"}); } } diff --git a/ngraph/frontend/paddlepaddle/src/op/rnn.cpp b/src/frontends/paddlepaddle/src/op/rnn.cpp similarity index 94% rename from ngraph/frontend/paddlepaddle/src/op/rnn.cpp rename to src/frontends/paddlepaddle/src/op/rnn.cpp index f0e594079b9..0e779c168de 100644 --- a/ngraph/frontend/paddlepaddle/src/op/rnn.cpp +++ b/src/frontends/paddlepaddle/src/op/rnn.cpp @@ -2,9 +2,9 @@ // SPDX-License-Identifier: Apache-2.0 // -#include #include +#include "openvino/opsets/opset6.hpp" #include "paddlepaddle_frontend/utility.hpp" namespace ov { diff --git a/ngraph/frontend/paddlepaddle/src/op/scale.cpp b/src/frontends/paddlepaddle/src/op/scale.cpp similarity index 95% rename from ngraph/frontend/paddlepaddle/src/op/scale.cpp rename to src/frontends/paddlepaddle/src/op/scale.cpp index 9b67eedc70a..da8dd865178 100644 --- a/ngraph/frontend/paddlepaddle/src/op/scale.cpp +++ b/src/frontends/paddlepaddle/src/op/scale.cpp @@ -2,9 +2,9 @@ // SPDX-License-Identifier: Apache-2.0 // -#include #include -#include + +#include "openvino/opsets/opset6.hpp" namespace ov { namespace frontend { diff --git a/ngraph/frontend/paddlepaddle/src/op/shape.cpp b/src/frontends/paddlepaddle/src/op/shape.cpp similarity index 78% rename from ngraph/frontend/paddlepaddle/src/op/shape.cpp rename to src/frontends/paddlepaddle/src/op/shape.cpp index 3c777cb87a9..b2594edcba3 100644 --- a/ngraph/frontend/paddlepaddle/src/op/shape.cpp +++ b/src/frontends/paddlepaddle/src/op/shape.cpp @@ -2,16 +2,17 @@ // SPDX-License-Identifier: Apache-2.0 // -#include #include +#include "openvino/opsets/opset6.hpp" + namespace ov { namespace frontend { namespace pdpd { namespace op { NamedOutputs shape(const NodeContext& node) { auto data = node.get_ng_input("Input"); - auto shape_node = std::make_shared(data, element::i32); + auto shape_node = std::make_shared(data, element::i32); return node.default_single_output_mapping({shape_node}, {"Out"}); } diff --git a/ngraph/frontend/paddlepaddle/src/op/sigmoid.cpp b/src/frontends/paddlepaddle/src/op/sigmoid.cpp similarity index 84% rename from ngraph/frontend/paddlepaddle/src/op/sigmoid.cpp rename to src/frontends/paddlepaddle/src/op/sigmoid.cpp index f9122d2562f..b4145c68695 100644 --- a/ngraph/frontend/paddlepaddle/src/op/sigmoid.cpp +++ b/src/frontends/paddlepaddle/src/op/sigmoid.cpp @@ -2,16 +2,17 @@ // SPDX-License-Identifier: Apache-2.0 // -#include #include +#include "openvino/opsets/opset6.hpp" + namespace ov { namespace frontend { namespace pdpd { namespace op { NamedOutputs sigmoid(const NodeContext& node) { auto data = node.get_ng_input("X"); - return node.default_single_output_mapping({std::make_shared(data)}, {"Out"}); + return node.default_single_output_mapping({std::make_shared(data)}, {"Out"}); } } // namespace op diff --git a/ngraph/frontend/paddlepaddle/src/op/slice.cpp b/src/frontends/paddlepaddle/src/op/slice.cpp similarity index 100% rename from ngraph/frontend/paddlepaddle/src/op/slice.cpp rename to src/frontends/paddlepaddle/src/op/slice.cpp diff --git a/ngraph/frontend/paddlepaddle/src/op/softmax.cpp b/src/frontends/paddlepaddle/src/op/softmax.cpp similarity index 89% rename from ngraph/frontend/paddlepaddle/src/op/softmax.cpp rename to src/frontends/paddlepaddle/src/op/softmax.cpp index 0646df0b704..b70dd6971d9 100644 --- a/ngraph/frontend/paddlepaddle/src/op/softmax.cpp +++ b/src/frontends/paddlepaddle/src/op/softmax.cpp @@ -2,9 +2,10 @@ // SPDX-License-Identifier: Apache-2.0 // -#include #include +#include "openvino/opsets/opset6.hpp" + namespace ov { namespace frontend { namespace pdpd { @@ -17,7 +18,7 @@ NamedOutputs softmax(const NodeContext& node) { auto data_rank = data.get_partial_shape().rank().get_length(); axis = data_rank + axis; } - return node.default_single_output_mapping({std::make_shared(data, axis)}, {"Out"}); + return node.default_single_output_mapping({std::make_shared(data, axis)}, {"Out"}); } } // namespace op } // namespace pdpd diff --git a/src/frontends/paddlepaddle/src/op/softplus.cpp b/src/frontends/paddlepaddle/src/op/softplus.cpp new file mode 100644 index 00000000000..35e2ec3f132 --- /dev/null +++ b/src/frontends/paddlepaddle/src/op/softplus.cpp @@ -0,0 +1,28 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// +#include + +#include "default_opset.hpp" + +namespace ov { +namespace frontend { +namespace pdpd { +namespace op { +NamedOutputs softplus(const NodeContext& node) { + auto data = node.get_ng_input("X"); + auto beta = node.get_attribute("beta"); + auto threshold = node.get_attribute("threshold"); + float supported_beta = 1.0; + float supported_threshold = 20.0; + const float EPSINON = 1e-6; + + if (!(abs(beta - supported_beta) <= EPSINON) || !(abs(threshold - supported_threshold) <= EPSINON)) { + PDPD_OP_VALIDATION_CHECK(node, false, "only support beta==1.0 && threshold==20.0"); + } + return node.default_single_output_mapping({std::make_shared(data)}, {"Out"}); +} +} // namespace op +} // namespace pdpd +} // namespace frontend +} // namespace ov diff --git a/ngraph/frontend/paddlepaddle/src/op/split.cpp b/src/frontends/paddlepaddle/src/op/split.cpp similarity index 88% rename from ngraph/frontend/paddlepaddle/src/op/split.cpp rename to src/frontends/paddlepaddle/src/op/split.cpp index e4fff9fd0cc..843f2bb6df5 100644 --- a/ngraph/frontend/paddlepaddle/src/op/split.cpp +++ b/src/frontends/paddlepaddle/src/op/split.cpp @@ -2,16 +2,16 @@ // SPDX-License-Identifier: Apache-2.0 // -#include #include -#include + +#include "openvino/opsets/opset7.hpp" +#include "paddlepaddle_frontend/utility.hpp" namespace ov { namespace frontend { namespace pdpd { namespace op { NamedOutputs split(const NodeContext& node) { - using namespace ngraph; using namespace opset7; const auto& data = node.get_ng_input("X"); Output axis; @@ -24,7 +24,7 @@ NamedOutputs split(const NodeContext& node) { if (node.has_attribute("axis")) { dim = node.get_attribute("axis"); } - axis = std::make_shared(ngraph::element::i32, Shape{}, dim); + axis = std::make_shared(ov::element::i32, Shape{}, dim); } auto num_or_sections = node.get_attribute("num"); NamedOutputs named_outputs; @@ -33,7 +33,7 @@ NamedOutputs split(const NodeContext& node) { Output sections_node; if (node.has_ng_input("SectionsTensorList")) { auto inputs = node.get_ng_inputs("SectionsTensorList"); - sections_node = std::make_shared(inputs, 0); + sections_node = std::make_shared(inputs, 0); } else { PDPD_ASSERT(node.has_attribute>("sections"), "split: num==0 && no sections is invalid."); diff --git a/ngraph/frontend/paddlepaddle/src/op/squeeze.cpp b/src/frontends/paddlepaddle/src/op/squeeze.cpp similarity index 70% rename from ngraph/frontend/paddlepaddle/src/op/squeeze.cpp rename to src/frontends/paddlepaddle/src/op/squeeze.cpp index ec52228e43d..2c3472df019 100644 --- a/ngraph/frontend/paddlepaddle/src/op/squeeze.cpp +++ b/src/frontends/paddlepaddle/src/op/squeeze.cpp @@ -2,9 +2,10 @@ // SPDX-License-Identifier: Apache-2.0 // -#include #include +#include "openvino/opsets/opset6.hpp" + namespace ov { namespace frontend { namespace pdpd { @@ -18,10 +19,10 @@ NamedOutputs squeeze(const NodeContext& node) { std::shared_ptr out; if (!axes.empty()) { - auto axesNode = ngraph::opset6::Constant::create(ngraph::element::i32, {axes.size()}, axes); - out = std::make_shared(data, axesNode); + auto axesNode = ov::opset6::Constant::create(ov::element::i32, {axes.size()}, axes); + out = std::make_shared(data, axesNode); } else { - out = std::make_shared(data); + out = std::make_shared(data); } return node.default_single_output_mapping(out, {"Out"}); } diff --git a/ngraph/frontend/paddlepaddle/src/op/stack.cpp b/src/frontends/paddlepaddle/src/op/stack.cpp similarity index 100% rename from ngraph/frontend/paddlepaddle/src/op/stack.cpp rename to src/frontends/paddlepaddle/src/op/stack.cpp diff --git a/ngraph/frontend/paddlepaddle/src/op/tanh.cpp b/src/frontends/paddlepaddle/src/op/tanh.cpp similarity index 100% rename from ngraph/frontend/paddlepaddle/src/op/tanh.cpp rename to src/frontends/paddlepaddle/src/op/tanh.cpp diff --git a/ngraph/frontend/paddlepaddle/src/op/transpose2.cpp b/src/frontends/paddlepaddle/src/op/transpose2.cpp similarity index 67% rename from ngraph/frontend/paddlepaddle/src/op/transpose2.cpp rename to src/frontends/paddlepaddle/src/op/transpose2.cpp index ece4118d602..2c2464fd01b 100644 --- a/ngraph/frontend/paddlepaddle/src/op/transpose2.cpp +++ b/src/frontends/paddlepaddle/src/op/transpose2.cpp @@ -2,9 +2,10 @@ // SPDX-License-Identifier: Apache-2.0 // -#include #include +#include "openvino/opsets/opset6.hpp" + namespace ov { namespace frontend { namespace pdpd { @@ -12,9 +13,8 @@ namespace op { NamedOutputs transpose2(const NodeContext& node) { auto data = node.get_ng_input("X"); auto perm = node.get_attribute>("axis"); - auto input_order = ngraph::opset6::Constant::create(ngraph::element::i64, {perm.size()}, perm); - return node.default_single_output_mapping({std::make_shared(data, input_order)}, - {"Out"}); + auto input_order = ov::opset6::Constant::create(ov::element::i64, {perm.size()}, perm); + return node.default_single_output_mapping({std::make_shared(data, input_order)}, {"Out"}); } } // namespace op diff --git a/ngraph/frontend/paddlepaddle/src/op/unsqueeze.cpp b/src/frontends/paddlepaddle/src/op/unsqueeze.cpp similarity index 74% rename from ngraph/frontend/paddlepaddle/src/op/unsqueeze.cpp rename to src/frontends/paddlepaddle/src/op/unsqueeze.cpp index 34970c70639..0d4a583b5a8 100644 --- a/ngraph/frontend/paddlepaddle/src/op/unsqueeze.cpp +++ b/src/frontends/paddlepaddle/src/op/unsqueeze.cpp @@ -2,9 +2,10 @@ // SPDX-License-Identifier: Apache-2.0 // -#include #include +#include "openvino/opsets/opset6.hpp" + namespace ov { namespace frontend { namespace pdpd { @@ -16,12 +17,12 @@ NamedOutputs unsqueeze(const NodeContext& node) { axesNode = node.get_ng_input("AxesTensor"); } else if (node.has_ng_input("AxesTensorList")) { auto inputs = node.get_ng_inputs("AxesTensorList"); - axesNode = std::make_shared(inputs, 0); + axesNode = std::make_shared(inputs, 0); } else { auto axes = node.get_attribute>("axes"); - axesNode = ngraph::opset6::Constant::create(ngraph::element::i32, {axes.size()}, axes); + axesNode = ov::opset6::Constant::create(ov::element::i32, {axes.size()}, axes); } - return node.default_single_output_mapping({std::make_shared(data, axesNode)}, {"Out"}); + return node.default_single_output_mapping({std::make_shared(data, axesNode)}, {"Out"}); } } // namespace op } // namespace pdpd diff --git a/ngraph/frontend/paddlepaddle/src/op/yolo_box.cpp b/src/frontends/paddlepaddle/src/op/yolo_box.cpp similarity index 98% rename from ngraph/frontend/paddlepaddle/src/op/yolo_box.cpp rename to src/frontends/paddlepaddle/src/op/yolo_box.cpp index c2ad5f91b1a..4393304ef99 100644 --- a/ngraph/frontend/paddlepaddle/src/op/yolo_box.cpp +++ b/src/frontends/paddlepaddle/src/op/yolo_box.cpp @@ -4,7 +4,8 @@ #include // std::numeric_limits #include #include -#include + +#include "openvino/opsets/opset6.hpp" namespace ov { namespace frontend { @@ -109,8 +110,8 @@ NamedOutputs yolo_box(const NodeContext& node_context) { auto node_prob = node_split_input->output(5); // x/y - std::shared_ptr node_box_x_sigmoid = std::make_shared(node_box_x); - std::shared_ptr node_box_y_sigmoid = std::make_shared(node_box_y); + std::shared_ptr node_box_x_sigmoid = std::make_shared(node_box_x); + std::shared_ptr node_box_y_sigmoid = std::make_shared(node_box_y); if (std::fabs(scale_x_y - default_scale) > 1e-6) { // float not-equal float bias_x_y = -0.5 * (scale_x_y - 1.0); @@ -270,7 +271,7 @@ NamedOutputs yolo_box(const NodeContext& node_context) { auto node_pred_box_x2_squeeze = std::make_shared(node_pred_box_x2_reshape, node_img_width_cast); auto node_pred_box_y2_squeeze = std::make_shared(node_pred_box_y2_reshape, node_img_height_cast); - std::shared_ptr node_pred_box_result; + std::shared_ptr node_pred_box_result; if (clip_bbox) { auto node_number_one = Constant::create(f32, {1}, {1.0}); auto node_new_img_height = std::make_shared(node_img_height_cast, node_number_one); diff --git a/ngraph/frontend/paddlepaddle/src/op_table.cpp b/src/frontends/paddlepaddle/src/op_table.cpp similarity index 98% rename from ngraph/frontend/paddlepaddle/src/op_table.cpp rename to src/frontends/paddlepaddle/src/op_table.cpp index 36b978258f6..e5c508c3237 100644 --- a/ngraph/frontend/paddlepaddle/src/op_table.cpp +++ b/src/frontends/paddlepaddle/src/op_table.cpp @@ -63,6 +63,7 @@ OP_CONVERTER(scale); OP_CONVERTER(shape); OP_CONVERTER(slice); OP_CONVERTER(softmax); +OP_CONVERTER(softplus); OP_CONVERTER(sigmoid); OP_CONVERTER(split); OP_CONVERTER(squeeze); @@ -136,6 +137,7 @@ std::map get_supported_ops() { {"shape", op::shape}, {"slice", op::slice}, {"softmax", op::softmax}, + {"softplus", op::softplus}, {"sigmoid", op::sigmoid}, {"split", op::split}, {"squeeze2", op::squeeze}, diff --git a/ngraph/frontend/paddlepaddle/src/op_table.hpp b/src/frontends/paddlepaddle/src/op_table.hpp similarity index 92% rename from ngraph/frontend/paddlepaddle/src/op_table.hpp rename to src/frontends/paddlepaddle/src/op_table.hpp index 76ee7d5e3c3..b24f2f94180 100644 --- a/ngraph/frontend/paddlepaddle/src/op_table.hpp +++ b/src/frontends/paddlepaddle/src/op_table.hpp @@ -6,7 +6,6 @@ #include #include -#include #include #include "node_context.hpp" diff --git a/ngraph/frontend/paddlepaddle/src/pdpd_fw_node.cpp b/src/frontends/paddlepaddle/src/pdpd_fw_node.cpp similarity index 94% rename from ngraph/frontend/paddlepaddle/src/pdpd_fw_node.cpp rename to src/frontends/paddlepaddle/src/pdpd_fw_node.cpp index e91df788b85..b4e43718790 100644 --- a/ngraph/frontend/paddlepaddle/src/pdpd_fw_node.cpp +++ b/src/frontends/paddlepaddle/src/pdpd_fw_node.cpp @@ -6,7 +6,6 @@ namespace ov { namespace frontend { -NGRAPH_RTTI_DEFINITION(PDPDFrameworkNode, "PDPDFrameworkNode", 1); void PDPDFrameworkNode::validate_and_infer_types() { FrameworkNode::validate_and_infer_types(); diff --git a/ngraph/frontend/paddlepaddle/src/pdpd_fw_node.hpp b/src/frontends/paddlepaddle/src/pdpd_fw_node.hpp similarity index 95% rename from ngraph/frontend/paddlepaddle/src/pdpd_fw_node.hpp rename to src/frontends/paddlepaddle/src/pdpd_fw_node.hpp index 558b29b0e75..81ede7fa33e 100644 --- a/ngraph/frontend/paddlepaddle/src/pdpd_fw_node.hpp +++ b/src/frontends/paddlepaddle/src/pdpd_fw_node.hpp @@ -12,7 +12,7 @@ namespace ov { namespace frontend { class PDPDFrameworkNode : public ov::op::util::FrameworkNode { public: - NGRAPH_RTTI_DECLARATION; + OPENVINO_OP("PDPDFrameworkNode", "util", ov::op::util::FrameworkNode); PDPDFrameworkNode(const DecoderPDPDProto& decoder, const OutputVector& inputs, diff --git a/src/frontends/paddlepaddle/src/pdpd_utils.cpp b/src/frontends/paddlepaddle/src/pdpd_utils.cpp new file mode 100644 index 00000000000..5545de213bb --- /dev/null +++ b/src/frontends/paddlepaddle/src/pdpd_utils.cpp @@ -0,0 +1,14 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "pdpd_utils.hpp" + +std::shared_ptr ov::frontend::pdpd::reorder_axes(const ov::Output& value, + std::vector axes_order) { + const auto axes_order_const = + std::make_shared(element::i64, + Shape{axes_order.size()}, + std::vector(axes_order.begin(), axes_order.end())); + return std::make_shared(value, axes_order_const); +} diff --git a/ngraph/frontend/paddlepaddle/src/pdpd_utils.hpp b/src/frontends/paddlepaddle/src/pdpd_utils.hpp similarity index 88% rename from ngraph/frontend/paddlepaddle/src/pdpd_utils.hpp rename to src/frontends/paddlepaddle/src/pdpd_utils.hpp index 286f6e11b9b..6f98dcd16db 100644 --- a/ngraph/frontend/paddlepaddle/src/pdpd_utils.hpp +++ b/src/frontends/paddlepaddle/src/pdpd_utils.hpp @@ -5,6 +5,7 @@ #pragma once #include "common/frontend_exceptions.hpp" +#include "openvino/opsets/opset6.hpp" namespace ov { namespace frontend { @@ -38,6 +39,7 @@ bool endsWith(const std::basic_string& str, const std::basic_string& suffi return false; } +std::shared_ptr reorder_axes(const Output& value, std::vector axes_order); } // namespace pdpd } // namespace frontend } // namespace ov diff --git a/ngraph/frontend/paddlepaddle/src/place.cpp b/src/frontends/paddlepaddle/src/place.cpp similarity index 99% rename from ngraph/frontend/paddlepaddle/src/place.cpp rename to src/frontends/paddlepaddle/src/place.cpp index 873eca5a24e..cfc4ecf2585 100644 --- a/ngraph/frontend/paddlepaddle/src/place.cpp +++ b/src/frontends/paddlepaddle/src/place.cpp @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // -#include +#include "paddlepaddle_frontend/place.hpp" #include "decoder.hpp" #include "framework.pb.h" diff --git a/ngraph/frontend/paddlepaddle/src/proto/framework.proto b/src/frontends/paddlepaddle/src/proto/framework.proto similarity index 100% rename from ngraph/frontend/paddlepaddle/src/proto/framework.proto rename to src/frontends/paddlepaddle/src/proto/framework.proto diff --git a/src/frontends/tensorflow/CMakeLists.txt b/src/frontends/tensorflow/CMakeLists.txt new file mode 100644 index 00000000000..1e049c6d66d --- /dev/null +++ b/src/frontends/tensorflow/CMakeLists.txt @@ -0,0 +1,15 @@ +# Copyright (C) 2018-2021 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 +# + +ov_add_frontend(NAME tensorflow + LINKABLE_FRONTEND + SKIP_INSTALL + FILEDESCRIPTION "FrontEnd to load and convert TensorFlow file format" + LINK_LIBRARIES openvino::util) + +# TODO: once TensorFlow FE become releasable component, need to remove these lines and SKIP_INSTALL above +install(TARGETS ${TARGET_NAME} + RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT tests EXCLUDE_FROM_ALL + ARCHIVE DESTINATION ${IE_CPACK_ARCHIVE_PATH} COMPONENT tests EXCLUDE_FROM_ALL + LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT tests EXCLUDE_FROM_ALL) diff --git a/ngraph/frontend/tensorflow/include/tensorflow_frontend/decoder.hpp b/src/frontends/tensorflow/include/tensorflow_frontend/decoder.hpp similarity index 97% rename from ngraph/frontend/tensorflow/include/tensorflow_frontend/decoder.hpp rename to src/frontends/tensorflow/include/tensorflow_frontend/decoder.hpp index 7d9f2a32f4a..80ecb99935f 100644 --- a/ngraph/frontend/tensorflow/include/tensorflow_frontend/decoder.hpp +++ b/src/frontends/tensorflow/include/tensorflow_frontend/decoder.hpp @@ -4,6 +4,7 @@ #pragma once +#include "openvino/core/any.hpp" #include "openvino/core/variant.hpp" #include "tensorflow_frontend/utility.hpp" diff --git a/ngraph/frontend/tensorflow/include/tensorflow_frontend/frontend.hpp b/src/frontends/tensorflow/include/tensorflow_frontend/frontend.hpp similarity index 98% rename from ngraph/frontend/tensorflow/include/tensorflow_frontend/frontend.hpp rename to src/frontends/tensorflow/include/tensorflow_frontend/frontend.hpp index 64adfedee71..ab4a8062904 100644 --- a/ngraph/frontend/tensorflow/include/tensorflow_frontend/frontend.hpp +++ b/src/frontends/tensorflow/include/tensorflow_frontend/frontend.hpp @@ -9,6 +9,7 @@ #include "common/frontend.hpp" #include "common/input_model.hpp" +#include "openvino/core/any.hpp" #include "openvino/core/node_vector.hpp" #include "openvino/core/variant.hpp" #include "tensorflow_frontend/utility.hpp" diff --git a/ngraph/frontend/tensorflow/include/tensorflow_frontend/graph_iterator.hpp b/src/frontends/tensorflow/include/tensorflow_frontend/graph_iterator.hpp similarity index 97% rename from ngraph/frontend/tensorflow/include/tensorflow_frontend/graph_iterator.hpp rename to src/frontends/tensorflow/include/tensorflow_frontend/graph_iterator.hpp index 16fe1501707..613035894f5 100644 --- a/ngraph/frontend/tensorflow/include/tensorflow_frontend/graph_iterator.hpp +++ b/src/frontends/tensorflow/include/tensorflow_frontend/graph_iterator.hpp @@ -4,6 +4,7 @@ #pragma once +#include "openvino/core/any.hpp" #include "openvino/core/variant.hpp" #include "tensorflow_frontend/decoder.hpp" #include "tensorflow_frontend/utility.hpp" diff --git a/src/frontends/tensorflow/include/tensorflow_frontend/utility.hpp b/src/frontends/tensorflow/include/tensorflow_frontend/utility.hpp new file mode 100644 index 00000000000..2e6c3abf6b2 --- /dev/null +++ b/src/frontends/tensorflow/include/tensorflow_frontend/utility.hpp @@ -0,0 +1,20 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include "common/frontend_exceptions.hpp" + +#ifdef OPENVINO_STATIC_LIBRARY +# define TF_API +# define TF_C_API +#else +# ifdef tensorflow_ov_frontend_EXPORTS +# define TF_API OPENVINO_CORE_EXPORTS +# define TF_C_API OPENVINO_EXTERN_C OPENVINO_CORE_EXPORTS +# else +# define TF_API OPENVINO_CORE_IMPORTS +# define TF_C_API OPENVINO_EXTERN_C OPENVINO_CORE_IMPORTS +# endif // tensorflow_ov_frontend_EXPORTS +#endif // OPENVINO_STATIC_LIBRARY diff --git a/ngraph/frontend/tensorflow/src/decoder_proto.cpp b/src/frontends/tensorflow/src/decoder_proto.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/decoder_proto.cpp rename to src/frontends/tensorflow/src/decoder_proto.cpp diff --git a/ngraph/frontend/tensorflow/src/decoder_proto.hpp b/src/frontends/tensorflow/src/decoder_proto.hpp similarity index 100% rename from ngraph/frontend/tensorflow/src/decoder_proto.hpp rename to src/frontends/tensorflow/src/decoder_proto.hpp diff --git a/ngraph/frontend/tensorflow/src/exceptions.cpp b/src/frontends/tensorflow/src/exceptions.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/exceptions.cpp rename to src/frontends/tensorflow/src/exceptions.cpp diff --git a/ngraph/frontend/tensorflow/src/exceptions.hpp b/src/frontends/tensorflow/src/exceptions.hpp similarity index 100% rename from ngraph/frontend/tensorflow/src/exceptions.hpp rename to src/frontends/tensorflow/src/exceptions.hpp diff --git a/ngraph/frontend/tensorflow/src/frontend.cpp b/src/frontends/tensorflow/src/frontend.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/frontend.cpp rename to src/frontends/tensorflow/src/frontend.cpp diff --git a/ngraph/frontend/tensorflow/src/graph_iterator_proto.hpp b/src/frontends/tensorflow/src/graph_iterator_proto.hpp similarity index 100% rename from ngraph/frontend/tensorflow/src/graph_iterator_proto.hpp rename to src/frontends/tensorflow/src/graph_iterator_proto.hpp diff --git a/ngraph/frontend/tensorflow/src/model.cpp b/src/frontends/tensorflow/src/model.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/model.cpp rename to src/frontends/tensorflow/src/model.cpp diff --git a/ngraph/frontend/tensorflow/src/model.hpp b/src/frontends/tensorflow/src/model.hpp similarity index 100% rename from ngraph/frontend/tensorflow/src/model.hpp rename to src/frontends/tensorflow/src/model.hpp diff --git a/ngraph/frontend/tensorflow/src/node_context.hpp b/src/frontends/tensorflow/src/node_context.hpp similarity index 99% rename from ngraph/frontend/tensorflow/src/node_context.hpp rename to src/frontends/tensorflow/src/node_context.hpp index 31d583def6d..28a8729140f 100644 --- a/ngraph/frontend/tensorflow/src/node_context.hpp +++ b/src/frontends/tensorflow/src/node_context.hpp @@ -5,6 +5,7 @@ #pragma once #include "exceptions.hpp" +#include "openvino/core/any.hpp" #include "openvino/core/variant.hpp" #include "place.hpp" #include "tensor.pb.h" diff --git a/ngraph/frontend/tensorflow/src/op/addN.cpp b/src/frontends/tensorflow/src/op/addN.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/addN.cpp rename to src/frontends/tensorflow/src/op/addN.cpp diff --git a/ngraph/frontend/tensorflow/src/op/arg_min_max.cpp b/src/frontends/tensorflow/src/op/arg_min_max.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/arg_min_max.cpp rename to src/frontends/tensorflow/src/op/arg_min_max.cpp diff --git a/ngraph/frontend/tensorflow/src/op/avg_pool.cpp b/src/frontends/tensorflow/src/op/avg_pool.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/avg_pool.cpp rename to src/frontends/tensorflow/src/op/avg_pool.cpp diff --git a/ngraph/frontend/tensorflow/src/op/bias_add.cpp b/src/frontends/tensorflow/src/op/bias_add.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/bias_add.cpp rename to src/frontends/tensorflow/src/op/bias_add.cpp diff --git a/ngraph/frontend/tensorflow/src/op/binary_op.cpp b/src/frontends/tensorflow/src/op/binary_op.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/binary_op.cpp rename to src/frontends/tensorflow/src/op/binary_op.cpp diff --git a/ngraph/frontend/tensorflow/src/op/cast.cpp b/src/frontends/tensorflow/src/op/cast.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/cast.cpp rename to src/frontends/tensorflow/src/op/cast.cpp diff --git a/ngraph/frontend/tensorflow/src/op/concat.cpp b/src/frontends/tensorflow/src/op/concat.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/concat.cpp rename to src/frontends/tensorflow/src/op/concat.cpp diff --git a/ngraph/frontend/tensorflow/src/op/const.cpp b/src/frontends/tensorflow/src/op/const.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/const.cpp rename to src/frontends/tensorflow/src/op/const.cpp diff --git a/ngraph/frontend/tensorflow/src/op/conv_2d.cpp b/src/frontends/tensorflow/src/op/conv_2d.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/conv_2d.cpp rename to src/frontends/tensorflow/src/op/conv_2d.cpp diff --git a/ngraph/frontend/tensorflow/src/op/conv_2d_backprop.cpp b/src/frontends/tensorflow/src/op/conv_2d_backprop.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/conv_2d_backprop.cpp rename to src/frontends/tensorflow/src/op/conv_2d_backprop.cpp diff --git a/ngraph/frontend/tensorflow/src/op/conv_3d.cpp b/src/frontends/tensorflow/src/op/conv_3d.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/conv_3d.cpp rename to src/frontends/tensorflow/src/op/conv_3d.cpp diff --git a/ngraph/frontend/tensorflow/src/op/crop_and_resize.cpp b/src/frontends/tensorflow/src/op/crop_and_resize.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/crop_and_resize.cpp rename to src/frontends/tensorflow/src/op/crop_and_resize.cpp diff --git a/ngraph/frontend/tensorflow/src/op/cumsum.cpp b/src/frontends/tensorflow/src/op/cumsum.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/cumsum.cpp rename to src/frontends/tensorflow/src/op/cumsum.cpp diff --git a/ngraph/frontend/tensorflow/src/op/depth_to_space.cpp b/src/frontends/tensorflow/src/op/depth_to_space.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/depth_to_space.cpp rename to src/frontends/tensorflow/src/op/depth_to_space.cpp diff --git a/ngraph/frontend/tensorflow/src/op/depthwise_conv_2d.cpp b/src/frontends/tensorflow/src/op/depthwise_conv_2d.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/depthwise_conv_2d.cpp rename to src/frontends/tensorflow/src/op/depthwise_conv_2d.cpp diff --git a/ngraph/frontend/tensorflow/src/op/elu.cpp b/src/frontends/tensorflow/src/op/elu.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/elu.cpp rename to src/frontends/tensorflow/src/op/elu.cpp diff --git a/ngraph/frontend/tensorflow/src/op/expand_dims.cpp b/src/frontends/tensorflow/src/op/expand_dims.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/expand_dims.cpp rename to src/frontends/tensorflow/src/op/expand_dims.cpp diff --git a/ngraph/frontend/tensorflow/src/op/fake_quant_min_max_vars.cpp b/src/frontends/tensorflow/src/op/fake_quant_min_max_vars.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/fake_quant_min_max_vars.cpp rename to src/frontends/tensorflow/src/op/fake_quant_min_max_vars.cpp diff --git a/ngraph/frontend/tensorflow/src/op/fill.cpp b/src/frontends/tensorflow/src/op/fill.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/fill.cpp rename to src/frontends/tensorflow/src/op/fill.cpp diff --git a/ngraph/frontend/tensorflow/src/op/fused_batch_norm.cpp b/src/frontends/tensorflow/src/op/fused_batch_norm.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/fused_batch_norm.cpp rename to src/frontends/tensorflow/src/op/fused_batch_norm.cpp diff --git a/ngraph/frontend/tensorflow/src/op/gather.cpp b/src/frontends/tensorflow/src/op/gather.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/gather.cpp rename to src/frontends/tensorflow/src/op/gather.cpp diff --git a/ngraph/frontend/tensorflow/src/op/identity.cpp b/src/frontends/tensorflow/src/op/identity.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/identity.cpp rename to src/frontends/tensorflow/src/op/identity.cpp diff --git a/ngraph/frontend/tensorflow/src/op/interpolate.cpp b/src/frontends/tensorflow/src/op/interpolate.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/interpolate.cpp rename to src/frontends/tensorflow/src/op/interpolate.cpp diff --git a/ngraph/frontend/tensorflow/src/op/is_finite.cpp b/src/frontends/tensorflow/src/op/is_finite.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/is_finite.cpp rename to src/frontends/tensorflow/src/op/is_finite.cpp diff --git a/ngraph/frontend/tensorflow/src/op/l2_loss.cpp b/src/frontends/tensorflow/src/op/l2_loss.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/l2_loss.cpp rename to src/frontends/tensorflow/src/op/l2_loss.cpp diff --git a/ngraph/frontend/tensorflow/src/op/leaky_relu.cpp b/src/frontends/tensorflow/src/op/leaky_relu.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/leaky_relu.cpp rename to src/frontends/tensorflow/src/op/leaky_relu.cpp diff --git a/ngraph/frontend/tensorflow/src/op/log1p.cpp b/src/frontends/tensorflow/src/op/log1p.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/log1p.cpp rename to src/frontends/tensorflow/src/op/log1p.cpp diff --git a/ngraph/frontend/tensorflow/src/op/log_softmax.cpp b/src/frontends/tensorflow/src/op/log_softmax.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/log_softmax.cpp rename to src/frontends/tensorflow/src/op/log_softmax.cpp diff --git a/ngraph/frontend/tensorflow/src/op/lrn.cpp b/src/frontends/tensorflow/src/op/lrn.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/lrn.cpp rename to src/frontends/tensorflow/src/op/lrn.cpp diff --git a/ngraph/frontend/tensorflow/src/op/matmul.cpp b/src/frontends/tensorflow/src/op/matmul.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/matmul.cpp rename to src/frontends/tensorflow/src/op/matmul.cpp diff --git a/ngraph/frontend/tensorflow/src/op/max_pool.cpp b/src/frontends/tensorflow/src/op/max_pool.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/max_pool.cpp rename to src/frontends/tensorflow/src/op/max_pool.cpp diff --git a/ngraph/frontend/tensorflow/src/op/no_op.cpp b/src/frontends/tensorflow/src/op/no_op.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/no_op.cpp rename to src/frontends/tensorflow/src/op/no_op.cpp diff --git a/ngraph/frontend/tensorflow/src/op/non_max_suppression.cpp b/src/frontends/tensorflow/src/op/non_max_suppression.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/non_max_suppression.cpp rename to src/frontends/tensorflow/src/op/non_max_suppression.cpp diff --git a/ngraph/frontend/tensorflow/src/op/one_hot.cpp b/src/frontends/tensorflow/src/op/one_hot.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/one_hot.cpp rename to src/frontends/tensorflow/src/op/one_hot.cpp diff --git a/ngraph/frontend/tensorflow/src/op/pack.cpp b/src/frontends/tensorflow/src/op/pack.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/pack.cpp rename to src/frontends/tensorflow/src/op/pack.cpp diff --git a/ngraph/frontend/tensorflow/src/op/pad.cpp b/src/frontends/tensorflow/src/op/pad.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/pad.cpp rename to src/frontends/tensorflow/src/op/pad.cpp diff --git a/ngraph/frontend/tensorflow/src/op/placeholder.cpp b/src/frontends/tensorflow/src/op/placeholder.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/placeholder.cpp rename to src/frontends/tensorflow/src/op/placeholder.cpp diff --git a/ngraph/frontend/tensorflow/src/op/random_uniform.cpp b/src/frontends/tensorflow/src/op/random_uniform.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/random_uniform.cpp rename to src/frontends/tensorflow/src/op/random_uniform.cpp diff --git a/ngraph/frontend/tensorflow/src/op/range.cpp b/src/frontends/tensorflow/src/op/range.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/range.cpp rename to src/frontends/tensorflow/src/op/range.cpp diff --git a/ngraph/frontend/tensorflow/src/op/rank.cpp b/src/frontends/tensorflow/src/op/rank.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/rank.cpp rename to src/frontends/tensorflow/src/op/rank.cpp diff --git a/ngraph/frontend/tensorflow/src/op/reciprocal.cpp b/src/frontends/tensorflow/src/op/reciprocal.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/reciprocal.cpp rename to src/frontends/tensorflow/src/op/reciprocal.cpp diff --git a/ngraph/frontend/tensorflow/src/op/reduce.cpp b/src/frontends/tensorflow/src/op/reduce.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/reduce.cpp rename to src/frontends/tensorflow/src/op/reduce.cpp diff --git a/ngraph/frontend/tensorflow/src/op/relu_6.cpp b/src/frontends/tensorflow/src/op/relu_6.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/relu_6.cpp rename to src/frontends/tensorflow/src/op/relu_6.cpp diff --git a/ngraph/frontend/tensorflow/src/op/reshape.cpp b/src/frontends/tensorflow/src/op/reshape.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/reshape.cpp rename to src/frontends/tensorflow/src/op/reshape.cpp diff --git a/ngraph/frontend/tensorflow/src/op/reverse.cpp b/src/frontends/tensorflow/src/op/reverse.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/reverse.cpp rename to src/frontends/tensorflow/src/op/reverse.cpp diff --git a/ngraph/frontend/tensorflow/src/op/roll.cpp b/src/frontends/tensorflow/src/op/roll.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/roll.cpp rename to src/frontends/tensorflow/src/op/roll.cpp diff --git a/ngraph/frontend/tensorflow/src/op/round.cpp b/src/frontends/tensorflow/src/op/round.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/round.cpp rename to src/frontends/tensorflow/src/op/round.cpp diff --git a/ngraph/frontend/tensorflow/src/op/rsqrt.cpp b/src/frontends/tensorflow/src/op/rsqrt.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/rsqrt.cpp rename to src/frontends/tensorflow/src/op/rsqrt.cpp diff --git a/ngraph/frontend/tensorflow/src/op/select.cpp b/src/frontends/tensorflow/src/op/select.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/select.cpp rename to src/frontends/tensorflow/src/op/select.cpp diff --git a/ngraph/frontend/tensorflow/src/op/shape.cpp b/src/frontends/tensorflow/src/op/shape.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/shape.cpp rename to src/frontends/tensorflow/src/op/shape.cpp diff --git a/ngraph/frontend/tensorflow/src/op/size.cpp b/src/frontends/tensorflow/src/op/size.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/size.cpp rename to src/frontends/tensorflow/src/op/size.cpp diff --git a/ngraph/frontend/tensorflow/src/op/slice.cpp b/src/frontends/tensorflow/src/op/slice.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/slice.cpp rename to src/frontends/tensorflow/src/op/slice.cpp diff --git a/ngraph/frontend/tensorflow/src/op/softmax.cpp b/src/frontends/tensorflow/src/op/softmax.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/softmax.cpp rename to src/frontends/tensorflow/src/op/softmax.cpp diff --git a/ngraph/frontend/tensorflow/src/op/space_to_batch_nd.cpp b/src/frontends/tensorflow/src/op/space_to_batch_nd.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/space_to_batch_nd.cpp rename to src/frontends/tensorflow/src/op/space_to_batch_nd.cpp diff --git a/ngraph/frontend/tensorflow/src/op/space_to_depth.cpp b/src/frontends/tensorflow/src/op/space_to_depth.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/space_to_depth.cpp rename to src/frontends/tensorflow/src/op/space_to_depth.cpp diff --git a/ngraph/frontend/tensorflow/src/op/split.cpp b/src/frontends/tensorflow/src/op/split.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/split.cpp rename to src/frontends/tensorflow/src/op/split.cpp diff --git a/ngraph/frontend/tensorflow/src/op/sqrt.cpp b/src/frontends/tensorflow/src/op/sqrt.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/sqrt.cpp rename to src/frontends/tensorflow/src/op/sqrt.cpp diff --git a/ngraph/frontend/tensorflow/src/op/square.cpp b/src/frontends/tensorflow/src/op/square.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/square.cpp rename to src/frontends/tensorflow/src/op/square.cpp diff --git a/ngraph/frontend/tensorflow/src/op/squeeze.cpp b/src/frontends/tensorflow/src/op/squeeze.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/squeeze.cpp rename to src/frontends/tensorflow/src/op/squeeze.cpp diff --git a/ngraph/frontend/tensorflow/src/op/strided_slice.cpp b/src/frontends/tensorflow/src/op/strided_slice.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/strided_slice.cpp rename to src/frontends/tensorflow/src/op/strided_slice.cpp diff --git a/ngraph/frontend/tensorflow/src/op/tile.cpp b/src/frontends/tensorflow/src/op/tile.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/tile.cpp rename to src/frontends/tensorflow/src/op/tile.cpp diff --git a/ngraph/frontend/tensorflow/src/op/top_k.cpp b/src/frontends/tensorflow/src/op/top_k.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/top_k.cpp rename to src/frontends/tensorflow/src/op/top_k.cpp diff --git a/ngraph/frontend/tensorflow/src/op/transpose.cpp b/src/frontends/tensorflow/src/op/transpose.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/transpose.cpp rename to src/frontends/tensorflow/src/op/transpose.cpp diff --git a/ngraph/frontend/tensorflow/src/op/unary_op.cpp b/src/frontends/tensorflow/src/op/unary_op.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/unary_op.cpp rename to src/frontends/tensorflow/src/op/unary_op.cpp diff --git a/ngraph/frontend/tensorflow/src/op/unpack.cpp b/src/frontends/tensorflow/src/op/unpack.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/unpack.cpp rename to src/frontends/tensorflow/src/op/unpack.cpp diff --git a/ngraph/frontend/tensorflow/src/op/where.cpp b/src/frontends/tensorflow/src/op/where.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/where.cpp rename to src/frontends/tensorflow/src/op/where.cpp diff --git a/ngraph/frontend/tensorflow/src/op/xdivy.cpp b/src/frontends/tensorflow/src/op/xdivy.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/xdivy.cpp rename to src/frontends/tensorflow/src/op/xdivy.cpp diff --git a/ngraph/frontend/tensorflow/src/op/zeros_like.cpp b/src/frontends/tensorflow/src/op/zeros_like.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op/zeros_like.cpp rename to src/frontends/tensorflow/src/op/zeros_like.cpp diff --git a/ngraph/frontend/tensorflow/src/op_table.cpp b/src/frontends/tensorflow/src/op_table.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op_table.cpp rename to src/frontends/tensorflow/src/op_table.cpp diff --git a/ngraph/frontend/tensorflow/src/op_table.hpp b/src/frontends/tensorflow/src/op_table.hpp similarity index 100% rename from ngraph/frontend/tensorflow/src/op_table.hpp rename to src/frontends/tensorflow/src/op_table.hpp diff --git a/ngraph/frontend/tensorflow/src/openvino_conversions.cpp b/src/frontends/tensorflow/src/openvino_conversions.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/openvino_conversions.cpp rename to src/frontends/tensorflow/src/openvino_conversions.cpp diff --git a/ngraph/frontend/tensorflow/src/openvino_conversions.hpp b/src/frontends/tensorflow/src/openvino_conversions.hpp similarity index 100% rename from ngraph/frontend/tensorflow/src/openvino_conversions.hpp rename to src/frontends/tensorflow/src/openvino_conversions.hpp diff --git a/ngraph/frontend/tensorflow/src/pass/transpose_sinking.cpp b/src/frontends/tensorflow/src/pass/transpose_sinking.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/pass/transpose_sinking.cpp rename to src/frontends/tensorflow/src/pass/transpose_sinking.cpp diff --git a/ngraph/frontend/tensorflow/src/pass/transpose_sinking.hpp b/src/frontends/tensorflow/src/pass/transpose_sinking.hpp similarity index 100% rename from ngraph/frontend/tensorflow/src/pass/transpose_sinking.hpp rename to src/frontends/tensorflow/src/pass/transpose_sinking.hpp diff --git a/ngraph/frontend/tensorflow/src/place.cpp b/src/frontends/tensorflow/src/place.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/place.cpp rename to src/frontends/tensorflow/src/place.cpp diff --git a/ngraph/frontend/tensorflow/src/place.hpp b/src/frontends/tensorflow/src/place.hpp similarity index 100% rename from ngraph/frontend/tensorflow/src/place.hpp rename to src/frontends/tensorflow/src/place.hpp diff --git a/ngraph/frontend/tensorflow/src/proto/allocation_description.proto b/src/frontends/tensorflow/src/proto/allocation_description.proto similarity index 100% rename from ngraph/frontend/tensorflow/src/proto/allocation_description.proto rename to src/frontends/tensorflow/src/proto/allocation_description.proto diff --git a/ngraph/frontend/tensorflow/src/proto/api_def.proto b/src/frontends/tensorflow/src/proto/api_def.proto similarity index 100% rename from ngraph/frontend/tensorflow/src/proto/api_def.proto rename to src/frontends/tensorflow/src/proto/api_def.proto diff --git a/ngraph/frontend/tensorflow/src/proto/attr_value.proto b/src/frontends/tensorflow/src/proto/attr_value.proto similarity index 100% rename from ngraph/frontend/tensorflow/src/proto/attr_value.proto rename to src/frontends/tensorflow/src/proto/attr_value.proto diff --git a/ngraph/frontend/tensorflow/src/proto/cost_graph.proto b/src/frontends/tensorflow/src/proto/cost_graph.proto similarity index 100% rename from ngraph/frontend/tensorflow/src/proto/cost_graph.proto rename to src/frontends/tensorflow/src/proto/cost_graph.proto diff --git a/ngraph/frontend/tensorflow/src/proto/dataset_options.proto b/src/frontends/tensorflow/src/proto/dataset_options.proto similarity index 100% rename from ngraph/frontend/tensorflow/src/proto/dataset_options.proto rename to src/frontends/tensorflow/src/proto/dataset_options.proto diff --git a/ngraph/frontend/tensorflow/src/proto/device_attributes.proto b/src/frontends/tensorflow/src/proto/device_attributes.proto similarity index 100% rename from ngraph/frontend/tensorflow/src/proto/device_attributes.proto rename to src/frontends/tensorflow/src/proto/device_attributes.proto diff --git a/ngraph/frontend/tensorflow/src/proto/function.proto b/src/frontends/tensorflow/src/proto/function.proto similarity index 100% rename from ngraph/frontend/tensorflow/src/proto/function.proto rename to src/frontends/tensorflow/src/proto/function.proto diff --git a/ngraph/frontend/tensorflow/src/proto/graph.proto b/src/frontends/tensorflow/src/proto/graph.proto similarity index 100% rename from ngraph/frontend/tensorflow/src/proto/graph.proto rename to src/frontends/tensorflow/src/proto/graph.proto diff --git a/ngraph/frontend/tensorflow/src/proto/graph_transfer_info.proto b/src/frontends/tensorflow/src/proto/graph_transfer_info.proto similarity index 100% rename from ngraph/frontend/tensorflow/src/proto/graph_transfer_info.proto rename to src/frontends/tensorflow/src/proto/graph_transfer_info.proto diff --git a/ngraph/frontend/tensorflow/src/proto/kernel_def.proto b/src/frontends/tensorflow/src/proto/kernel_def.proto similarity index 100% rename from ngraph/frontend/tensorflow/src/proto/kernel_def.proto rename to src/frontends/tensorflow/src/proto/kernel_def.proto diff --git a/ngraph/frontend/tensorflow/src/proto/log_memory.proto b/src/frontends/tensorflow/src/proto/log_memory.proto similarity index 100% rename from ngraph/frontend/tensorflow/src/proto/log_memory.proto rename to src/frontends/tensorflow/src/proto/log_memory.proto diff --git a/ngraph/frontend/tensorflow/src/proto/model.proto b/src/frontends/tensorflow/src/proto/model.proto similarity index 100% rename from ngraph/frontend/tensorflow/src/proto/model.proto rename to src/frontends/tensorflow/src/proto/model.proto diff --git a/ngraph/frontend/tensorflow/src/proto/node_def.proto b/src/frontends/tensorflow/src/proto/node_def.proto similarity index 100% rename from ngraph/frontend/tensorflow/src/proto/node_def.proto rename to src/frontends/tensorflow/src/proto/node_def.proto diff --git a/ngraph/frontend/tensorflow/src/proto/op_def.proto b/src/frontends/tensorflow/src/proto/op_def.proto similarity index 100% rename from ngraph/frontend/tensorflow/src/proto/op_def.proto rename to src/frontends/tensorflow/src/proto/op_def.proto diff --git a/ngraph/frontend/tensorflow/src/proto/reader_base.proto b/src/frontends/tensorflow/src/proto/reader_base.proto similarity index 100% rename from ngraph/frontend/tensorflow/src/proto/reader_base.proto rename to src/frontends/tensorflow/src/proto/reader_base.proto diff --git a/ngraph/frontend/tensorflow/src/proto/remote_fused_graph_execute_info.proto b/src/frontends/tensorflow/src/proto/remote_fused_graph_execute_info.proto similarity index 100% rename from ngraph/frontend/tensorflow/src/proto/remote_fused_graph_execute_info.proto rename to src/frontends/tensorflow/src/proto/remote_fused_graph_execute_info.proto diff --git a/ngraph/frontend/tensorflow/src/proto/resource_handle.proto b/src/frontends/tensorflow/src/proto/resource_handle.proto similarity index 100% rename from ngraph/frontend/tensorflow/src/proto/resource_handle.proto rename to src/frontends/tensorflow/src/proto/resource_handle.proto diff --git a/ngraph/frontend/tensorflow/src/proto/step_stats.proto b/src/frontends/tensorflow/src/proto/step_stats.proto similarity index 100% rename from ngraph/frontend/tensorflow/src/proto/step_stats.proto rename to src/frontends/tensorflow/src/proto/step_stats.proto diff --git a/ngraph/frontend/tensorflow/src/proto/summary.proto b/src/frontends/tensorflow/src/proto/summary.proto similarity index 100% rename from ngraph/frontend/tensorflow/src/proto/summary.proto rename to src/frontends/tensorflow/src/proto/summary.proto diff --git a/ngraph/frontend/tensorflow/src/proto/tensor.proto b/src/frontends/tensorflow/src/proto/tensor.proto similarity index 100% rename from ngraph/frontend/tensorflow/src/proto/tensor.proto rename to src/frontends/tensorflow/src/proto/tensor.proto diff --git a/ngraph/frontend/tensorflow/src/proto/tensor_description.proto b/src/frontends/tensorflow/src/proto/tensor_description.proto similarity index 100% rename from ngraph/frontend/tensorflow/src/proto/tensor_description.proto rename to src/frontends/tensorflow/src/proto/tensor_description.proto diff --git a/ngraph/frontend/tensorflow/src/proto/tensor_shape.proto b/src/frontends/tensorflow/src/proto/tensor_shape.proto similarity index 100% rename from ngraph/frontend/tensorflow/src/proto/tensor_shape.proto rename to src/frontends/tensorflow/src/proto/tensor_shape.proto diff --git a/ngraph/frontend/tensorflow/src/proto/tensor_slice.proto b/src/frontends/tensorflow/src/proto/tensor_slice.proto similarity index 100% rename from ngraph/frontend/tensorflow/src/proto/tensor_slice.proto rename to src/frontends/tensorflow/src/proto/tensor_slice.proto diff --git a/ngraph/frontend/tensorflow/src/proto/types.proto b/src/frontends/tensorflow/src/proto/types.proto similarity index 100% rename from ngraph/frontend/tensorflow/src/proto/types.proto rename to src/frontends/tensorflow/src/proto/types.proto diff --git a/ngraph/frontend/tensorflow/src/proto/variable.proto b/src/frontends/tensorflow/src/proto/variable.proto similarity index 100% rename from ngraph/frontend/tensorflow/src/proto/variable.proto rename to src/frontends/tensorflow/src/proto/variable.proto diff --git a/ngraph/frontend/tensorflow/src/proto/versions.proto b/src/frontends/tensorflow/src/proto/versions.proto similarity index 100% rename from ngraph/frontend/tensorflow/src/proto/versions.proto rename to src/frontends/tensorflow/src/proto/versions.proto diff --git a/ngraph/frontend/tensorflow/src/tensorflow.cpp b/src/frontends/tensorflow/src/tensorflow.cpp similarity index 73% rename from ngraph/frontend/tensorflow/src/tensorflow.cpp rename to src/frontends/tensorflow/src/tensorflow.cpp index 7dec8591b78..24824017e42 100644 --- a/ngraph/frontend/tensorflow/src/tensorflow.cpp +++ b/src/frontends/tensorflow/src/tensorflow.cpp @@ -5,11 +5,11 @@ #include "manager.hpp" #include "tensorflow_frontend/frontend.hpp" -extern "C" OPENVINO_CORE_EXPORTS ov::frontend::FrontEndVersion GetAPIVersion() { +TF_C_API ov::frontend::FrontEndVersion GetAPIVersion() { return OV_FRONTEND_API_VERSION; } -extern "C" OPENVINO_CORE_EXPORTS void* GetFrontEndData() { +TF_C_API void* GetFrontEndData() { auto res = new ov::frontend::FrontEndPluginInfo(); res->m_name = "tf"; res->m_creator = []() { diff --git a/ngraph/frontend/tensorflow/src/tf_framework_node.cpp b/src/frontends/tensorflow/src/tf_framework_node.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/tf_framework_node.cpp rename to src/frontends/tensorflow/src/tf_framework_node.cpp diff --git a/ngraph/frontend/tensorflow/src/tf_framework_node.hpp b/src/frontends/tensorflow/src/tf_framework_node.hpp similarity index 100% rename from ngraph/frontend/tensorflow/src/tf_framework_node.hpp rename to src/frontends/tensorflow/src/tf_framework_node.hpp diff --git a/ngraph/frontend/tensorflow/src/utils.cpp b/src/frontends/tensorflow/src/utils.cpp similarity index 100% rename from ngraph/frontend/tensorflow/src/utils.cpp rename to src/frontends/tensorflow/src/utils.cpp diff --git a/ngraph/frontend/tensorflow/src/utils.hpp b/src/frontends/tensorflow/src/utils.hpp similarity index 99% rename from ngraph/frontend/tensorflow/src/utils.hpp rename to src/frontends/tensorflow/src/utils.hpp index 27183ea5ec8..7ab6aa9f093 100644 --- a/ngraph/frontend/tensorflow/src/utils.hpp +++ b/src/frontends/tensorflow/src/utils.hpp @@ -99,6 +99,7 @@ void values_from_const_node(const NodeContext& node, ov::Shape* const_tensor_sha auto tensor_proto_var = decoder->get_attribute("value", ::ov::VariantWrapper<::tensorflow::TensorProto>::get_type_info_static()); FRONT_END_GENERAL_CHECK(tensor_proto_var != nullptr); + auto tensor_proto = std::dynamic_pointer_cast<::ov::VariantWrapper<::tensorflow::TensorProto>>(tensor_proto_var)->get(); diff --git a/openvino/util/.clang-format b/src/inference/.clang-format similarity index 100% rename from openvino/util/.clang-format rename to src/inference/.clang-format diff --git a/inference-engine/src/inference_engine/CMakeLists.txt b/src/inference/CMakeLists.txt similarity index 95% rename from inference-engine/src/inference_engine/CMakeLists.txt rename to src/inference/CMakeLists.txt index 0ffabc46306..9c044d8a7d9 100644 --- a/inference-engine/src/inference_engine/CMakeLists.txt +++ b/src/inference/CMakeLists.txt @@ -27,10 +27,10 @@ file (GLOB LIBRARY_SRC # Add include path to so_extension.hpp set_property(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/src/ie_core.cpp - APPEND PROPERTY INCLUDE_DIRECTORIES "${OpenVINO_SOURCE_DIR}/ngraph/core/src/") + APPEND PROPERTY INCLUDE_DIRECTORIES "${OpenVINO_SOURCE_DIR}/src/core/src/") # TODO: WA for OneHot pass usage in reshape -set(LEGACY_SRC_ROOT "${IE_MAIN_SOURCE_DIR}/src/legacy_api/src") +set(LEGACY_SRC_ROOT "${OpenVINO_SOURCE_DIR}/src/common/legacy/src") set(LEGACY_LIBRARY_SHARED_SRCS "${LEGACY_SRC_ROOT}/transformations/convert_opset1_to_legacy/convert_one_hot_to_one_hot_ie.cpp" "${LEGACY_SRC_ROOT}/transformations/convert_opset1_to_legacy/convert_nms_5_to_legacy.cpp" @@ -108,7 +108,7 @@ add_library(${TARGET_NAME}_plugin_api INTERFACE) target_include_directories(${TARGET_NAME}_plugin_api INTERFACE $ - $ + $ $ $) @@ -119,8 +119,8 @@ target_link_libraries(${TARGET_NAME}_plugin_api INTERFACE pugixml::static openvi set_ie_threading_interface_for(${TARGET_NAME}_plugin_api) -file(GLOB_RECURSE plugin_api_src "${IE_MAIN_SOURCE_DIR}/src/plugin_api/*.hpp" - "${IE_MAIN_SOURCE_DIR}/src/plugin_api/*.h") +file(GLOB_RECURSE plugin_api_src "${CMAKE_CURRENT_SOURCE_DIR}/dev_api/*.hpp" + "${CMAKE_CURRENT_SOURCE_DIR}/dev_api/*.h") add_clang_format_target(${TARGET_NAME}_plugin_api_clang FOR_SOURCES ${plugin_api_src}) @@ -152,7 +152,7 @@ target_include_directories(${TARGET_NAME}_obj PRIVATE "${CMAKE_CURRENT_SOURCE_DI $ $) -target_link_libraries(${TARGET_NAME}_obj PRIVATE ${TARGET_NAME}_reader_api openvino::itt openvino::util) +target_link_libraries(${TARGET_NAME}_obj PRIVATE openvino::itt openvino::util) set_ie_threading_interface_for(${TARGET_NAME}_obj) if (TBBBIND_2_5_FOUND) @@ -200,7 +200,7 @@ endif() target_compile_definitions(${TARGET_NAME} PRIVATE IMPLEMENT_INFERENCE_ENGINE_API) ie_register_plugins(MAIN_TARGET ${TARGET_NAME} - POSSIBLE_PLUGINS MultiDevicePlugin HeteroPlugin clDNNPlugin GNAPlugin MKLDNNPlugin myriadPlugin) + POSSIBLE_PLUGINS MultiDevicePlugin ov_hetero_plugin clDNNPlugin GNAPlugin MKLDNNPlugin myriadPlugin) ie_add_api_validator_post_build_step(TARGET ${TARGET_NAME}) @@ -351,9 +351,9 @@ install(EXPORT OpenVINOTargets DESTINATION runtime/cmake COMPONENT core_dev) -set(IE_NGRAPH_DIR "${CMAKE_BINARY_DIR}/ngraph") +set(IE_NGRAPH_DIR "${CMAKE_BINARY_DIR}/src/core") set(IE_INCLUDE_DIR "${PUBLIC_HEADERS_DIR}/ie") -set(IE_PARALLEL_CMAKE "${InferenceEngine_SOURCE_DIR}/cmake/ie_parallel.cmake") +set(IE_PARALLEL_CMAKE "${OpenVINO_SOURCE_DIR}/cmake/ie_parallel.cmake") configure_package_config_file("${OpenVINO_SOURCE_DIR}/cmake/templates/InferenceEngineConfig.cmake.in" "${CMAKE_BINARY_DIR}/InferenceEngineConfig.cmake" @@ -388,7 +388,7 @@ configure_file("${OpenVINO_SOURCE_DIR}/cmake/templates/OpenVINOConfig-version.cm install(FILES "${CMAKE_BINARY_DIR}/share/InferenceEngineConfig.cmake" "${CMAKE_BINARY_DIR}/InferenceEngineConfig-version.cmake" - "${InferenceEngine_SOURCE_DIR}/cmake/ie_parallel.cmake" + "${OpenVINO_SOURCE_DIR}/cmake/ie_parallel.cmake" DESTINATION runtime/cmake COMPONENT core_dev) diff --git a/runtime/bindings/python/.clang-format b/src/inference/dev_api/.clang-format similarity index 100% rename from runtime/bindings/python/.clang-format rename to src/inference/dev_api/.clang-format diff --git a/inference-engine/src/plugin_api/blob_factory.hpp b/src/inference/dev_api/blob_factory.hpp similarity index 100% rename from inference-engine/src/plugin_api/blob_factory.hpp rename to src/inference/dev_api/blob_factory.hpp diff --git a/inference-engine/src/plugin_api/blob_transform.hpp b/src/inference/dev_api/blob_transform.hpp similarity index 100% rename from inference-engine/src/plugin_api/blob_transform.hpp rename to src/inference/dev_api/blob_transform.hpp diff --git a/inference-engine/src/plugin_api/caseless.hpp b/src/inference/dev_api/caseless.hpp similarity index 100% rename from inference-engine/src/plugin_api/caseless.hpp rename to src/inference/dev_api/caseless.hpp diff --git a/inference-engine/src/plugin_api/cpp_interfaces/impl/ie_executable_network_thread_safe_default.hpp b/src/inference/dev_api/cpp_interfaces/impl/ie_executable_network_thread_safe_default.hpp similarity index 100% rename from inference-engine/src/plugin_api/cpp_interfaces/impl/ie_executable_network_thread_safe_default.hpp rename to src/inference/dev_api/cpp_interfaces/impl/ie_executable_network_thread_safe_default.hpp diff --git a/inference-engine/src/plugin_api/cpp_interfaces/impl/ie_infer_async_request_thread_safe_default.hpp b/src/inference/dev_api/cpp_interfaces/impl/ie_infer_async_request_thread_safe_default.hpp similarity index 100% rename from inference-engine/src/plugin_api/cpp_interfaces/impl/ie_infer_async_request_thread_safe_default.hpp rename to src/inference/dev_api/cpp_interfaces/impl/ie_infer_async_request_thread_safe_default.hpp diff --git a/inference-engine/src/plugin_api/cpp_interfaces/interface/ie_iexecutable_network_internal.hpp b/src/inference/dev_api/cpp_interfaces/interface/ie_iexecutable_network_internal.hpp similarity index 100% rename from inference-engine/src/plugin_api/cpp_interfaces/interface/ie_iexecutable_network_internal.hpp rename to src/inference/dev_api/cpp_interfaces/interface/ie_iexecutable_network_internal.hpp diff --git a/inference-engine/src/plugin_api/cpp_interfaces/interface/ie_iinfer_request_internal.hpp b/src/inference/dev_api/cpp_interfaces/interface/ie_iinfer_request_internal.hpp similarity index 100% rename from inference-engine/src/plugin_api/cpp_interfaces/interface/ie_iinfer_request_internal.hpp rename to src/inference/dev_api/cpp_interfaces/interface/ie_iinfer_request_internal.hpp diff --git a/inference-engine/src/plugin_api/cpp_interfaces/interface/ie_internal_plugin_config.hpp b/src/inference/dev_api/cpp_interfaces/interface/ie_internal_plugin_config.hpp similarity index 100% rename from inference-engine/src/plugin_api/cpp_interfaces/interface/ie_internal_plugin_config.hpp rename to src/inference/dev_api/cpp_interfaces/interface/ie_internal_plugin_config.hpp diff --git a/inference-engine/src/plugin_api/cpp_interfaces/interface/ie_iplugin_internal.hpp b/src/inference/dev_api/cpp_interfaces/interface/ie_iplugin_internal.hpp similarity index 99% rename from inference-engine/src/plugin_api/cpp_interfaces/interface/ie_iplugin_internal.hpp rename to src/inference/dev_api/cpp_interfaces/interface/ie_iplugin_internal.hpp index e9799495680..d8a08e3d0d3 100644 --- a/inference-engine/src/plugin_api/cpp_interfaces/interface/ie_iplugin_internal.hpp +++ b/src/inference/dev_api/cpp_interfaces/interface/ie_iplugin_internal.hpp @@ -19,7 +19,7 @@ #include "ie_iextension.h" #include "ie_input_info.hpp" #include "ie_parameter.hpp" -#include "openvino/pp.hpp" +#include "openvino/util/pp.hpp" #include "so_ptr.hpp" namespace ov { diff --git a/inference-engine/src/plugin_api/cpp_interfaces/interface/ie_ivariable_state_internal.hpp b/src/inference/dev_api/cpp_interfaces/interface/ie_ivariable_state_internal.hpp similarity index 100% rename from inference-engine/src/plugin_api/cpp_interfaces/interface/ie_ivariable_state_internal.hpp rename to src/inference/dev_api/cpp_interfaces/interface/ie_ivariable_state_internal.hpp diff --git a/inference-engine/src/plugin_api/cpp_interfaces/plugin_itt.hpp b/src/inference/dev_api/cpp_interfaces/plugin_itt.hpp similarity index 100% rename from inference-engine/src/plugin_api/cpp_interfaces/plugin_itt.hpp rename to src/inference/dev_api/cpp_interfaces/plugin_itt.hpp diff --git a/inference-engine/src/plugin_api/debug.h b/src/inference/dev_api/debug.h similarity index 100% rename from inference-engine/src/plugin_api/debug.h rename to src/inference/dev_api/debug.h diff --git a/inference-engine/src/plugin_api/description_buffer.hpp b/src/inference/dev_api/description_buffer.hpp similarity index 100% rename from inference-engine/src/plugin_api/description_buffer.hpp rename to src/inference/dev_api/description_buffer.hpp diff --git a/inference-engine/src/plugin_api/exec_graph_info.hpp b/src/inference/dev_api/exec_graph_info.hpp similarity index 100% rename from inference-engine/src/plugin_api/exec_graph_info.hpp rename to src/inference/dev_api/exec_graph_info.hpp diff --git a/inference-engine/src/plugin_api/file_utils.h b/src/inference/dev_api/file_utils.h similarity index 100% rename from inference-engine/src/plugin_api/file_utils.h rename to src/inference/dev_api/file_utils.h diff --git a/inference-engine/src/plugin_api/ie_algorithm.hpp b/src/inference/dev_api/ie_algorithm.hpp similarity index 100% rename from inference-engine/src/plugin_api/ie_algorithm.hpp rename to src/inference/dev_api/ie_algorithm.hpp diff --git a/inference-engine/src/plugin_api/ie_icore.hpp b/src/inference/dev_api/ie_icore.hpp similarity index 100% rename from inference-engine/src/plugin_api/ie_icore.hpp rename to src/inference/dev_api/ie_icore.hpp diff --git a/inference-engine/src/plugin_api/ie_memcpy.h b/src/inference/dev_api/ie_memcpy.h similarity index 100% rename from inference-engine/src/plugin_api/ie_memcpy.h rename to src/inference/dev_api/ie_memcpy.h diff --git a/inference-engine/src/plugin_api/ie_metric_helpers.hpp b/src/inference/dev_api/ie_metric_helpers.hpp similarity index 100% rename from inference-engine/src/plugin_api/ie_metric_helpers.hpp rename to src/inference/dev_api/ie_metric_helpers.hpp diff --git a/inference-engine/src/plugin_api/ie_ngraph_utils.hpp b/src/inference/dev_api/ie_ngraph_utils.hpp similarity index 100% rename from inference-engine/src/plugin_api/ie_ngraph_utils.hpp rename to src/inference/dev_api/ie_ngraph_utils.hpp diff --git a/inference-engine/src/plugin_api/ie_performance_hints.hpp b/src/inference/dev_api/ie_performance_hints.hpp similarity index 100% rename from inference-engine/src/plugin_api/ie_performance_hints.hpp rename to src/inference/dev_api/ie_performance_hints.hpp diff --git a/inference-engine/src/plugin_api/ie_system_conf.h b/src/inference/dev_api/ie_system_conf.h similarity index 100% rename from inference-engine/src/plugin_api/ie_system_conf.h rename to src/inference/dev_api/ie_system_conf.h diff --git a/inference-engine/src/plugin_api/memory_solver.hpp b/src/inference/dev_api/memory_solver.hpp similarity index 100% rename from inference-engine/src/plugin_api/memory_solver.hpp rename to src/inference/dev_api/memory_solver.hpp diff --git a/inference-engine/src/plugin_api/performance_heuristics.hpp b/src/inference/dev_api/performance_heuristics.hpp similarity index 100% rename from inference-engine/src/plugin_api/performance_heuristics.hpp rename to src/inference/dev_api/performance_heuristics.hpp diff --git a/inference-engine/src/plugin_api/precision_utils.h b/src/inference/dev_api/precision_utils.h similarity index 100% rename from inference-engine/src/plugin_api/precision_utils.h rename to src/inference/dev_api/precision_utils.h diff --git a/inference-engine/src/plugin_api/so_ptr.hpp b/src/inference/dev_api/so_ptr.hpp similarity index 100% rename from inference-engine/src/plugin_api/so_ptr.hpp rename to src/inference/dev_api/so_ptr.hpp diff --git a/inference-engine/src/plugin_api/threading/ie_cpu_streams_executor.hpp b/src/inference/dev_api/threading/ie_cpu_streams_executor.hpp similarity index 100% rename from inference-engine/src/plugin_api/threading/ie_cpu_streams_executor.hpp rename to src/inference/dev_api/threading/ie_cpu_streams_executor.hpp diff --git a/inference-engine/src/plugin_api/threading/ie_executor_manager.hpp b/src/inference/dev_api/threading/ie_executor_manager.hpp similarity index 100% rename from inference-engine/src/plugin_api/threading/ie_executor_manager.hpp rename to src/inference/dev_api/threading/ie_executor_manager.hpp diff --git a/inference-engine/src/plugin_api/threading/ie_immediate_executor.hpp b/src/inference/dev_api/threading/ie_immediate_executor.hpp similarity index 100% rename from inference-engine/src/plugin_api/threading/ie_immediate_executor.hpp rename to src/inference/dev_api/threading/ie_immediate_executor.hpp diff --git a/inference-engine/src/plugin_api/threading/ie_istreams_executor.hpp b/src/inference/dev_api/threading/ie_istreams_executor.hpp similarity index 100% rename from inference-engine/src/plugin_api/threading/ie_istreams_executor.hpp rename to src/inference/dev_api/threading/ie_istreams_executor.hpp diff --git a/inference-engine/src/plugin_api/threading/ie_itask_executor.hpp b/src/inference/dev_api/threading/ie_itask_executor.hpp similarity index 100% rename from inference-engine/src/plugin_api/threading/ie_itask_executor.hpp rename to src/inference/dev_api/threading/ie_itask_executor.hpp diff --git a/inference-engine/src/plugin_api/threading/ie_tbb_streams_executor.hpp b/src/inference/dev_api/threading/ie_tbb_streams_executor.hpp similarity index 100% rename from inference-engine/src/plugin_api/threading/ie_tbb_streams_executor.hpp rename to src/inference/dev_api/threading/ie_tbb_streams_executor.hpp diff --git a/inference-engine/src/plugin_api/threading/ie_thread_local.hpp b/src/inference/dev_api/threading/ie_thread_local.hpp similarity index 100% rename from inference-engine/src/plugin_api/threading/ie_thread_local.hpp rename to src/inference/dev_api/threading/ie_thread_local.hpp diff --git a/inference-engine/src/plugin_api/xml_parse_utils.h b/src/inference/dev_api/xml_parse_utils.h similarity index 100% rename from inference-engine/src/plugin_api/xml_parse_utils.h rename to src/inference/dev_api/xml_parse_utils.h diff --git a/inference-engine/src/inference_engine/include/ie/cldnn/cldnn_config.hpp b/src/inference/include/ie/cldnn/cldnn_config.hpp similarity index 100% rename from inference-engine/src/inference_engine/include/ie/cldnn/cldnn_config.hpp rename to src/inference/include/ie/cldnn/cldnn_config.hpp diff --git a/inference-engine/src/inference_engine/include/ie/cpp/ie_cnn_network.h b/src/inference/include/ie/cpp/ie_cnn_network.h similarity index 100% rename from inference-engine/src/inference_engine/include/ie/cpp/ie_cnn_network.h rename to src/inference/include/ie/cpp/ie_cnn_network.h diff --git a/inference-engine/src/inference_engine/include/ie/cpp/ie_executable_network.hpp b/src/inference/include/ie/cpp/ie_executable_network.hpp similarity index 100% rename from inference-engine/src/inference_engine/include/ie/cpp/ie_executable_network.hpp rename to src/inference/include/ie/cpp/ie_executable_network.hpp diff --git a/inference-engine/src/inference_engine/include/ie/cpp/ie_infer_request.hpp b/src/inference/include/ie/cpp/ie_infer_request.hpp similarity index 100% rename from inference-engine/src/inference_engine/include/ie/cpp/ie_infer_request.hpp rename to src/inference/include/ie/cpp/ie_infer_request.hpp diff --git a/inference-engine/src/inference_engine/include/ie/cpp/ie_memory_state.hpp b/src/inference/include/ie/cpp/ie_memory_state.hpp similarity index 100% rename from inference-engine/src/inference_engine/include/ie/cpp/ie_memory_state.hpp rename to src/inference/include/ie/cpp/ie_memory_state.hpp diff --git a/inference-engine/src/inference_engine/include/ie/details/ie_blob_iterator.hpp b/src/inference/include/ie/details/ie_blob_iterator.hpp similarity index 100% rename from inference-engine/src/inference_engine/include/ie/details/ie_blob_iterator.hpp rename to src/inference/include/ie/details/ie_blob_iterator.hpp diff --git a/inference-engine/src/inference_engine/include/ie/details/ie_exception.hpp b/src/inference/include/ie/details/ie_exception.hpp similarity index 100% rename from inference-engine/src/inference_engine/include/ie/details/ie_exception.hpp rename to src/inference/include/ie/details/ie_exception.hpp diff --git a/inference-engine/src/inference_engine/include/ie/details/ie_pre_allocator.hpp b/src/inference/include/ie/details/ie_pre_allocator.hpp similarity index 100% rename from inference-engine/src/inference_engine/include/ie/details/ie_pre_allocator.hpp rename to src/inference/include/ie/details/ie_pre_allocator.hpp diff --git a/inference-engine/src/inference_engine/include/ie/details/ie_so_loader.h b/src/inference/include/ie/details/ie_so_loader.h similarity index 100% rename from inference-engine/src/inference_engine/include/ie/details/ie_so_loader.h rename to src/inference/include/ie/details/ie_so_loader.h diff --git a/inference-engine/src/inference_engine/include/ie/details/ie_so_pointer.hpp b/src/inference/include/ie/details/ie_so_pointer.hpp similarity index 100% rename from inference-engine/src/inference_engine/include/ie/details/ie_so_pointer.hpp rename to src/inference/include/ie/details/ie_so_pointer.hpp diff --git a/inference-engine/src/inference_engine/include/ie/gna/gna_config.hpp b/src/inference/include/ie/gna/gna_config.hpp similarity index 100% rename from inference-engine/src/inference_engine/include/ie/gna/gna_config.hpp rename to src/inference/include/ie/gna/gna_config.hpp diff --git a/inference-engine/src/inference_engine/include/ie/gpu/details/gpu_context_helpers.hpp b/src/inference/include/ie/gpu/details/gpu_context_helpers.hpp similarity index 94% rename from inference-engine/src/inference_engine/include/ie/gpu/details/gpu_context_helpers.hpp rename to src/inference/include/ie/gpu/details/gpu_context_helpers.hpp index 3f2e7b77212..0c90a5e2156 100644 --- a/inference-engine/src/inference_engine/include/ie/gpu/details/gpu_context_helpers.hpp +++ b/src/inference/include/ie/gpu/details/gpu_context_helpers.hpp @@ -47,8 +47,7 @@ protected: IE_THROW() << "No parameter " << handle_Key << " found"; } - Tmp handle = itrHandle->second; - return static_cast(handle); + return static_cast(itrHandle->second.as()); } /** @@ -62,8 +61,7 @@ protected: IE_THROW() << "No parameter " << handle_Key << " found"; } - Result handle = itrHandle->second; - return handle; + return itrHandle->second.as(); } /** diff --git a/inference-engine/src/inference_engine/include/ie/gpu/gpu_config.hpp b/src/inference/include/ie/gpu/gpu_config.hpp similarity index 100% rename from inference-engine/src/inference_engine/include/ie/gpu/gpu_config.hpp rename to src/inference/include/ie/gpu/gpu_config.hpp diff --git a/inference-engine/src/inference_engine/include/ie/gpu/gpu_context_api_dx.hpp b/src/inference/include/ie/gpu/gpu_context_api_dx.hpp similarity index 100% rename from inference-engine/src/inference_engine/include/ie/gpu/gpu_context_api_dx.hpp rename to src/inference/include/ie/gpu/gpu_context_api_dx.hpp diff --git a/inference-engine/src/inference_engine/include/ie/gpu/gpu_context_api_ocl.hpp b/src/inference/include/ie/gpu/gpu_context_api_ocl.hpp similarity index 100% rename from inference-engine/src/inference_engine/include/ie/gpu/gpu_context_api_ocl.hpp rename to src/inference/include/ie/gpu/gpu_context_api_ocl.hpp diff --git a/inference-engine/src/inference_engine/include/ie/gpu/gpu_context_api_va.hpp b/src/inference/include/ie/gpu/gpu_context_api_va.hpp similarity index 100% rename from inference-engine/src/inference_engine/include/ie/gpu/gpu_context_api_va.hpp rename to src/inference/include/ie/gpu/gpu_context_api_va.hpp diff --git a/inference-engine/src/inference_engine/include/ie/gpu/gpu_ocl_wrapper.hpp b/src/inference/include/ie/gpu/gpu_ocl_wrapper.hpp similarity index 100% rename from inference-engine/src/inference_engine/include/ie/gpu/gpu_ocl_wrapper.hpp rename to src/inference/include/ie/gpu/gpu_ocl_wrapper.hpp diff --git a/inference-engine/src/inference_engine/include/ie/gpu/gpu_params.hpp b/src/inference/include/ie/gpu/gpu_params.hpp similarity index 100% rename from inference-engine/src/inference_engine/include/ie/gpu/gpu_params.hpp rename to src/inference/include/ie/gpu/gpu_params.hpp diff --git a/inference-engine/src/inference_engine/include/ie/hetero/hetero_plugin_config.hpp b/src/inference/include/ie/hetero/hetero_plugin_config.hpp similarity index 100% rename from inference-engine/src/inference_engine/include/ie/hetero/hetero_plugin_config.hpp rename to src/inference/include/ie/hetero/hetero_plugin_config.hpp diff --git a/inference-engine/src/inference_engine/include/ie/ie_allocator.hpp b/src/inference/include/ie/ie_allocator.hpp similarity index 100% rename from inference-engine/src/inference_engine/include/ie/ie_allocator.hpp rename to src/inference/include/ie/ie_allocator.hpp diff --git a/inference-engine/src/inference_engine/include/ie/ie_api.h b/src/inference/include/ie/ie_api.h similarity index 100% rename from inference-engine/src/inference_engine/include/ie/ie_api.h rename to src/inference/include/ie/ie_api.h diff --git a/inference-engine/src/inference_engine/include/ie/ie_blob.h b/src/inference/include/ie/ie_blob.h similarity index 100% rename from inference-engine/src/inference_engine/include/ie/ie_blob.h rename to src/inference/include/ie/ie_blob.h diff --git a/inference-engine/src/inference_engine/include/ie/ie_common.h b/src/inference/include/ie/ie_common.h similarity index 99% rename from inference-engine/src/inference_engine/include/ie/ie_common.h rename to src/inference/include/ie/ie_common.h index 936b7f52b30..28025b09b33 100644 --- a/inference-engine/src/inference_engine/include/ie/ie_common.h +++ b/src/inference/include/ie/ie_common.h @@ -403,7 +403,7 @@ struct ThrowNow final { # define IE_LOCATION "" #endif // NDEBUG -// WARNING: DO NOT USE THIS MACRO! Use openvino/pp.hpp macro library +// WARNING: DO NOT USE THIS MACRO! Use openvino/util/pp.hpp macro library #define IE_PP_EXPAND(X) X #define IE_PP_NARG(...) IE_PP_EXPAND(IE_PP_NARG_(__VA_ARGS__, IE_PP_RSEQ_N())) #define IE_PP_NARG_(...) IE_PP_EXPAND(IE_PP_ARG_N(__VA_ARGS__)) diff --git a/inference-engine/src/inference_engine/include/ie/ie_compound_blob.h b/src/inference/include/ie/ie_compound_blob.h similarity index 100% rename from inference-engine/src/inference_engine/include/ie/ie_compound_blob.h rename to src/inference/include/ie/ie_compound_blob.h diff --git a/inference-engine/src/inference_engine/include/ie/ie_core.hpp b/src/inference/include/ie/ie_core.hpp similarity index 100% rename from inference-engine/src/inference_engine/include/ie/ie_core.hpp rename to src/inference/include/ie/ie_core.hpp diff --git a/inference-engine/src/inference_engine/include/ie/ie_data.h b/src/inference/include/ie/ie_data.h similarity index 100% rename from inference-engine/src/inference_engine/include/ie/ie_data.h rename to src/inference/include/ie/ie_data.h diff --git a/inference-engine/src/inference_engine/include/ie/ie_extension.h b/src/inference/include/ie/ie_extension.h similarity index 100% rename from inference-engine/src/inference_engine/include/ie/ie_extension.h rename to src/inference/include/ie/ie_extension.h diff --git a/inference-engine/src/inference_engine/include/ie/ie_icnn_network.hpp b/src/inference/include/ie/ie_icnn_network.hpp similarity index 100% rename from inference-engine/src/inference_engine/include/ie/ie_icnn_network.hpp rename to src/inference/include/ie/ie_icnn_network.hpp diff --git a/inference-engine/src/inference_engine/include/ie/ie_iexecutable_network.hpp b/src/inference/include/ie/ie_iexecutable_network.hpp similarity index 100% rename from inference-engine/src/inference_engine/include/ie/ie_iexecutable_network.hpp rename to src/inference/include/ie/ie_iexecutable_network.hpp diff --git a/inference-engine/src/inference_engine/include/ie/ie_iextension.h b/src/inference/include/ie/ie_iextension.h similarity index 100% rename from inference-engine/src/inference_engine/include/ie/ie_iextension.h rename to src/inference/include/ie/ie_iextension.h diff --git a/inference-engine/src/inference_engine/include/ie/ie_iinfer_request.hpp b/src/inference/include/ie/ie_iinfer_request.hpp similarity index 100% rename from inference-engine/src/inference_engine/include/ie/ie_iinfer_request.hpp rename to src/inference/include/ie/ie_iinfer_request.hpp diff --git a/inference-engine/src/inference_engine/include/ie/ie_input_info.hpp b/src/inference/include/ie/ie_input_info.hpp similarity index 100% rename from inference-engine/src/inference_engine/include/ie/ie_input_info.hpp rename to src/inference/include/ie/ie_input_info.hpp diff --git a/inference-engine/src/inference_engine/include/ie/ie_layouts.h b/src/inference/include/ie/ie_layouts.h similarity index 100% rename from inference-engine/src/inference_engine/include/ie/ie_layouts.h rename to src/inference/include/ie/ie_layouts.h diff --git a/inference-engine/src/inference_engine/include/ie/ie_locked_memory.hpp b/src/inference/include/ie/ie_locked_memory.hpp similarity index 100% rename from inference-engine/src/inference_engine/include/ie/ie_locked_memory.hpp rename to src/inference/include/ie/ie_locked_memory.hpp diff --git a/inference-engine/src/inference_engine/include/ie/ie_parallel.hpp b/src/inference/include/ie/ie_parallel.hpp similarity index 100% rename from inference-engine/src/inference_engine/include/ie/ie_parallel.hpp rename to src/inference/include/ie/ie_parallel.hpp diff --git a/inference-engine/src/inference_engine/include/ie/ie_parameter.hpp b/src/inference/include/ie/ie_parameter.hpp similarity index 67% rename from inference-engine/src/inference_engine/include/ie/ie_parameter.hpp rename to src/inference/include/ie/ie_parameter.hpp index 0be3fd9d786..7f1bf0ef02a 100644 --- a/inference-engine/src/inference_engine/include/ie/ie_parameter.hpp +++ b/src/inference/include/ie/ie_parameter.hpp @@ -24,17 +24,10 @@ namespace InferenceEngine { -using ov::runtime::Parameter; +/** + * @brief Alias for type that can store any value + */ +using Parameter = ov::Any; using ov::runtime::ParamMap; } // namespace InferenceEngine - -namespace ov { -namespace runtime { - -#ifdef __ANDROID__ -extern template struct INFERENCE_ENGINE_API_CLASS(InferenceEngine::Parameter::RealData); -#endif - -} // namespace runtime -} // namespace ov diff --git a/inference-engine/src/inference_engine/include/ie/ie_plugin_config.hpp b/src/inference/include/ie/ie_plugin_config.hpp similarity index 100% rename from inference-engine/src/inference_engine/include/ie/ie_plugin_config.hpp rename to src/inference/include/ie/ie_plugin_config.hpp diff --git a/inference-engine/src/inference_engine/include/ie/ie_precision.hpp b/src/inference/include/ie/ie_precision.hpp similarity index 100% rename from inference-engine/src/inference_engine/include/ie/ie_precision.hpp rename to src/inference/include/ie/ie_precision.hpp diff --git a/inference-engine/src/inference_engine/include/ie/ie_preprocess.hpp b/src/inference/include/ie/ie_preprocess.hpp similarity index 100% rename from inference-engine/src/inference_engine/include/ie/ie_preprocess.hpp rename to src/inference/include/ie/ie_preprocess.hpp diff --git a/inference-engine/src/inference_engine/include/ie/ie_remote_blob.hpp b/src/inference/include/ie/ie_remote_blob.hpp similarity index 100% rename from inference-engine/src/inference_engine/include/ie/ie_remote_blob.hpp rename to src/inference/include/ie/ie_remote_blob.hpp diff --git a/inference-engine/src/inference_engine/include/ie/ie_remote_context.hpp b/src/inference/include/ie/ie_remote_context.hpp similarity index 100% rename from inference-engine/src/inference_engine/include/ie/ie_remote_context.hpp rename to src/inference/include/ie/ie_remote_context.hpp diff --git a/inference-engine/src/inference_engine/include/ie/ie_transformations.hpp b/src/inference/include/ie/ie_transformations.hpp similarity index 100% rename from inference-engine/src/inference_engine/include/ie/ie_transformations.hpp rename to src/inference/include/ie/ie_transformations.hpp diff --git a/inference-engine/src/inference_engine/include/ie/ie_version.hpp b/src/inference/include/ie/ie_version.hpp similarity index 100% rename from inference-engine/src/inference_engine/include/ie/ie_version.hpp rename to src/inference/include/ie/ie_version.hpp diff --git a/inference-engine/src/inference_engine/include/ie/inference_engine.hpp b/src/inference/include/ie/inference_engine.hpp similarity index 100% rename from inference-engine/src/inference_engine/include/ie/inference_engine.hpp rename to src/inference/include/ie/inference_engine.hpp diff --git a/inference-engine/src/inference_engine/include/ie/multi-device/multi_device_config.hpp b/src/inference/include/ie/multi-device/multi_device_config.hpp similarity index 100% rename from inference-engine/src/inference_engine/include/ie/multi-device/multi_device_config.hpp rename to src/inference/include/ie/multi-device/multi_device_config.hpp diff --git a/inference-engine/src/inference_engine/include/ie/vpu/hddl_config.hpp b/src/inference/include/ie/vpu/hddl_config.hpp similarity index 100% rename from inference-engine/src/inference_engine/include/ie/vpu/hddl_config.hpp rename to src/inference/include/ie/vpu/hddl_config.hpp diff --git a/inference-engine/src/inference_engine/include/ie/vpu/hddl_plugin_config.hpp b/src/inference/include/ie/vpu/hddl_plugin_config.hpp similarity index 100% rename from inference-engine/src/inference_engine/include/ie/vpu/hddl_plugin_config.hpp rename to src/inference/include/ie/vpu/hddl_plugin_config.hpp diff --git a/inference-engine/src/inference_engine/include/ie/vpu/myriad_config.hpp b/src/inference/include/ie/vpu/myriad_config.hpp similarity index 100% rename from inference-engine/src/inference_engine/include/ie/vpu/myriad_config.hpp rename to src/inference/include/ie/vpu/myriad_config.hpp diff --git a/inference-engine/src/inference_engine/include/ie/vpu/myriad_plugin_config.hpp b/src/inference/include/ie/vpu/myriad_plugin_config.hpp similarity index 100% rename from inference-engine/src/inference_engine/include/ie/vpu/myriad_plugin_config.hpp rename to src/inference/include/ie/vpu/myriad_plugin_config.hpp diff --git a/inference-engine/src/inference_engine/include/ie/vpu/vpu_config.hpp b/src/inference/include/ie/vpu/vpu_config.hpp similarity index 100% rename from inference-engine/src/inference_engine/include/ie/vpu/vpu_config.hpp rename to src/inference/include/ie/vpu/vpu_config.hpp diff --git a/inference-engine/src/inference_engine/include/ie/vpu/vpu_plugin_config.hpp b/src/inference/include/ie/vpu/vpu_plugin_config.hpp similarity index 100% rename from inference-engine/src/inference_engine/include/ie/vpu/vpu_plugin_config.hpp rename to src/inference/include/ie/vpu/vpu_plugin_config.hpp diff --git a/inference-engine/src/inference_engine/include/openvino/openvino.hpp b/src/inference/include/openvino/openvino.hpp similarity index 100% rename from inference-engine/src/inference_engine/include/openvino/openvino.hpp rename to src/inference/include/openvino/openvino.hpp diff --git a/inference-engine/src/inference_engine/include/openvino/runtime/common.hpp b/src/inference/include/openvino/runtime/common.hpp similarity index 100% rename from inference-engine/src/inference_engine/include/openvino/runtime/common.hpp rename to src/inference/include/openvino/runtime/common.hpp diff --git a/inference-engine/src/inference_engine/include/openvino/runtime/core.hpp b/src/inference/include/openvino/runtime/core.hpp similarity index 98% rename from inference-engine/src/inference_engine/include/openvino/runtime/core.hpp rename to src/inference/include/openvino/runtime/core.hpp index ca4e85de4e3..1044a2d91bf 100644 --- a/inference-engine/src/inference_engine/include/openvino/runtime/core.hpp +++ b/src/inference/include/openvino/runtime/core.hpp @@ -281,7 +281,7 @@ public: * @param name - config key. * @return Value of config corresponding to config key. */ - Parameter get_config(const std::string& deviceName, const std::string& name) const; + Any get_config(const std::string& deviceName, const std::string& name) const; /** * @brief Gets general runtime metric for dedicated hardware. @@ -293,7 +293,7 @@ public: * @param name - metric name to request. * @return Metric value corresponding to metric key. */ - Parameter get_metric(const std::string& deviceName, const std::string& name) const; + Any get_metric(const std::string& deviceName, const std::string& name) const; /** * @brief Returns devices available for neural networks inference diff --git a/inference-engine/src/inference_engine/include/openvino/runtime/exception.hpp b/src/inference/include/openvino/runtime/exception.hpp similarity index 100% rename from inference-engine/src/inference_engine/include/openvino/runtime/exception.hpp rename to src/inference/include/openvino/runtime/exception.hpp diff --git a/inference-engine/src/inference_engine/include/openvino/runtime/executable_network.hpp b/src/inference/include/openvino/runtime/executable_network.hpp similarity index 98% rename from inference-engine/src/inference_engine/include/openvino/runtime/executable_network.hpp rename to src/inference/include/openvino/runtime/executable_network.hpp index 0587e9afcc7..7c966434445 100644 --- a/inference-engine/src/inference_engine/include/openvino/runtime/executable_network.hpp +++ b/src/inference/include/openvino/runtime/executable_network.hpp @@ -148,7 +148,7 @@ public: * @param name config key, can be found in ie_plugin_config.hpp * @return Configuration parameter value */ - Parameter get_config(const std::string& name) const; + Any get_config(const std::string& name) const; /** * @brief Gets general runtime metric for an executable network. @@ -159,7 +159,7 @@ public: * @param name metric name to request * @return Metric parameter value */ - Parameter get_metric(const std::string& name) const; + Any get_metric(const std::string& name) const; /** * @brief Returns pointer to plugin-specific shared context diff --git a/inference-engine/src/inference_engine/include/openvino/runtime/gpu/ocl/dx.hpp b/src/inference/include/openvino/runtime/gpu/ocl/dx.hpp similarity index 100% rename from inference-engine/src/inference_engine/include/openvino/runtime/gpu/ocl/dx.hpp rename to src/inference/include/openvino/runtime/gpu/ocl/dx.hpp diff --git a/inference-engine/src/inference_engine/include/openvino/runtime/gpu/ocl/ocl.hpp b/src/inference/include/openvino/runtime/gpu/ocl/ocl.hpp similarity index 100% rename from inference-engine/src/inference_engine/include/openvino/runtime/gpu/ocl/ocl.hpp rename to src/inference/include/openvino/runtime/gpu/ocl/ocl.hpp diff --git a/inference-engine/src/inference_engine/include/openvino/runtime/gpu/ocl/ocl_wrapper.hpp b/src/inference/include/openvino/runtime/gpu/ocl/ocl_wrapper.hpp similarity index 100% rename from inference-engine/src/inference_engine/include/openvino/runtime/gpu/ocl/ocl_wrapper.hpp rename to src/inference/include/openvino/runtime/gpu/ocl/ocl_wrapper.hpp diff --git a/inference-engine/src/inference_engine/include/openvino/runtime/gpu/ocl/va.hpp b/src/inference/include/openvino/runtime/gpu/ocl/va.hpp similarity index 100% rename from inference-engine/src/inference_engine/include/openvino/runtime/gpu/ocl/va.hpp rename to src/inference/include/openvino/runtime/gpu/ocl/va.hpp diff --git a/inference-engine/src/inference_engine/include/openvino/runtime/infer_request.hpp b/src/inference/include/openvino/runtime/infer_request.hpp similarity index 100% rename from inference-engine/src/inference_engine/include/openvino/runtime/infer_request.hpp rename to src/inference/include/openvino/runtime/infer_request.hpp diff --git a/src/inference/include/openvino/runtime/parameter.hpp b/src/inference/include/openvino/runtime/parameter.hpp new file mode 100644 index 00000000000..0fe1c9ded2f --- /dev/null +++ b/src/inference/include/openvino/runtime/parameter.hpp @@ -0,0 +1,22 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +/** + * @brief A header file for the Parameter class + * @file openvino/runtime/parameter.hpp + */ +#pragma once + +#include + +#include "openvino/core/any.hpp" + +namespace ov { +namespace runtime { +/** + * @brief An std::map object containing parameters + */ +using ParamMap = std::map; +} // namespace runtime +} // namespace ov diff --git a/inference-engine/src/inference_engine/include/openvino/runtime/profiling_info.hpp b/src/inference/include/openvino/runtime/profiling_info.hpp similarity index 100% rename from inference-engine/src/inference_engine/include/openvino/runtime/profiling_info.hpp rename to src/inference/include/openvino/runtime/profiling_info.hpp diff --git a/inference-engine/src/inference_engine/include/openvino/runtime/remote_context.hpp b/src/inference/include/openvino/runtime/remote_context.hpp similarity index 100% rename from inference-engine/src/inference_engine/include/openvino/runtime/remote_context.hpp rename to src/inference/include/openvino/runtime/remote_context.hpp diff --git a/inference-engine/src/inference_engine/include/openvino/runtime/remote_tensor.hpp b/src/inference/include/openvino/runtime/remote_tensor.hpp similarity index 97% rename from inference-engine/src/inference_engine/include/openvino/runtime/remote_tensor.hpp rename to src/inference/include/openvino/runtime/remote_tensor.hpp index 0f6545b2cac..b0f60afe2e5 100644 --- a/inference-engine/src/inference_engine/include/openvino/runtime/remote_tensor.hpp +++ b/src/inference/include/openvino/runtime/remote_tensor.hpp @@ -9,6 +9,7 @@ */ #pragma once +#include "openvino/runtime/common.hpp" #include "openvino/runtime/parameter.hpp" #include "openvino/runtime/tensor.hpp" diff --git a/inference-engine/src/inference_engine/include/openvino/runtime/runtime.hpp b/src/inference/include/openvino/runtime/runtime.hpp similarity index 100% rename from inference-engine/src/inference_engine/include/openvino/runtime/runtime.hpp rename to src/inference/include/openvino/runtime/runtime.hpp diff --git a/inference-engine/src/inference_engine/include/openvino/runtime/variable_state.hpp b/src/inference/include/openvino/runtime/variable_state.hpp similarity index 100% rename from inference-engine/src/inference_engine/include/openvino/runtime/variable_state.hpp rename to src/inference/include/openvino/runtime/variable_state.hpp diff --git a/inference-engine/src/inference_engine/src/blob_transform.cpp b/src/inference/src/blob_transform.cpp similarity index 100% rename from inference-engine/src/inference_engine/src/blob_transform.cpp rename to src/inference/src/blob_transform.cpp diff --git a/inference-engine/src/inference_engine/src/cnn_network_ngraph_impl.cpp b/src/inference/src/cnn_network_ngraph_impl.cpp similarity index 99% rename from inference-engine/src/inference_engine/src/cnn_network_ngraph_impl.cpp rename to src/inference/src/cnn_network_ngraph_impl.cpp index 24484c2f8f2..015859e9274 100644 --- a/inference-engine/src/inference_engine/src/cnn_network_ngraph_impl.cpp +++ b/src/inference/src/cnn_network_ngraph_impl.cpp @@ -423,8 +423,9 @@ void CNNNetworkNGraphImpl::reshape(const std::map(false); - manager.register_pass<::ngraph::pass::ConvertMulticlassNmsToMulticlassNmsIE>(); - manager.register_pass<::ngraph::pass::ConvertMatrixNmsToMatrixNmsIE>(); + // TODO [DS NMS]: remove when nodes from models where nms is not last node in model supports DS + manager.register_pass<::ngraph::pass::ConvertMulticlassNmsToMulticlassNmsIE>(false); + manager.register_pass<::ngraph::pass::ConvertMatrixNmsToMatrixNmsIE>(false); manager.register_pass<::ngraph::pass::DisableConvertConstantFoldingOnConstPath>(); manager.register_pass<::ngraph::pass::ConstantFolding>(); // OneHotToLegacy changes output precision diff --git a/inference-engine/src/inference_engine/src/cnn_network_ngraph_impl.hpp b/src/inference/src/cnn_network_ngraph_impl.hpp similarity index 100% rename from inference-engine/src/inference_engine/src/cnn_network_ngraph_impl.hpp rename to src/inference/src/cnn_network_ngraph_impl.hpp diff --git a/inference-engine/src/inference_engine/src/compilation_context.cpp b/src/inference/src/compilation_context.cpp similarity index 100% rename from inference-engine/src/inference_engine/src/compilation_context.cpp rename to src/inference/src/compilation_context.cpp diff --git a/inference-engine/src/inference_engine/src/compilation_context.hpp b/src/inference/src/compilation_context.hpp similarity index 100% rename from inference-engine/src/inference_engine/src/compilation_context.hpp rename to src/inference/src/compilation_context.hpp diff --git a/inference-engine/src/inference_engine/src/cpp/exception2status.hpp b/src/inference/src/cpp/exception2status.hpp similarity index 100% rename from inference-engine/src/inference_engine/src/cpp/exception2status.hpp rename to src/inference/src/cpp/exception2status.hpp diff --git a/inference-engine/src/inference_engine/src/cpp/ie_cnn_network.cpp b/src/inference/src/cpp/ie_cnn_network.cpp similarity index 100% rename from inference-engine/src/inference_engine/src/cpp/ie_cnn_network.cpp rename to src/inference/src/cpp/ie_cnn_network.cpp diff --git a/inference-engine/src/inference_engine/src/cpp/ie_executable_network.cpp b/src/inference/src/cpp/ie_executable_network.cpp similarity index 96% rename from inference-engine/src/inference_engine/src/cpp/ie_executable_network.cpp rename to src/inference/src/cpp/ie_executable_network.cpp index 9c0d444acd1..53a026de1d1 100644 --- a/inference-engine/src/inference_engine/src/cpp/ie_executable_network.cpp +++ b/src/inference/src/cpp/ie_executable_network.cpp @@ -90,11 +90,11 @@ void ExecutableNetwork::SetConfig(const std::map& config } Parameter ExecutableNetwork::GetConfig(const std::string& name) const { - EXEC_NET_CALL_STATEMENT(return _impl->GetConfig(name)); + EXEC_NET_CALL_STATEMENT(return {_so, _impl->GetConfig(name)}); } Parameter ExecutableNetwork::GetMetric(const std::string& name) const { - EXEC_NET_CALL_STATEMENT(return _impl->GetMetric(name)); + EXEC_NET_CALL_STATEMENT(return {_so, _impl->GetMetric(name)}); } RemoteContext::Ptr ExecutableNetwork::GetContext() const { @@ -203,11 +203,11 @@ void ExecutableNetwork::set_config(const ie::ParamMap& config) { } ie::Parameter ExecutableNetwork::get_config(const std::string& name) const { - OV_EXEC_NET_CALL_STATEMENT(return _impl->GetConfig(name)); + OV_EXEC_NET_CALL_STATEMENT(return {_so, _impl->GetConfig(name)}); } ie::Parameter ExecutableNetwork::get_metric(const std::string& name) const { - OV_EXEC_NET_CALL_STATEMENT(return _impl->GetMetric(name)); + OV_EXEC_NET_CALL_STATEMENT(return {_so, _impl->GetMetric(name)}); } RemoteContext ExecutableNetwork::get_context() const { diff --git a/inference-engine/src/inference_engine/src/cpp/ie_executable_network_base.hpp b/src/inference/src/cpp/ie_executable_network_base.hpp similarity index 100% rename from inference-engine/src/inference_engine/src/cpp/ie_executable_network_base.hpp rename to src/inference/src/cpp/ie_executable_network_base.hpp diff --git a/inference-engine/src/inference_engine/src/cpp/ie_extension.cpp b/src/inference/src/cpp/ie_extension.cpp similarity index 100% rename from inference-engine/src/inference_engine/src/cpp/ie_extension.cpp rename to src/inference/src/cpp/ie_extension.cpp diff --git a/inference-engine/src/inference_engine/src/cpp/ie_infer_async_request_base.hpp b/src/inference/src/cpp/ie_infer_async_request_base.hpp similarity index 100% rename from inference-engine/src/inference_engine/src/cpp/ie_infer_async_request_base.hpp rename to src/inference/src/cpp/ie_infer_async_request_base.hpp diff --git a/inference-engine/src/inference_engine/src/cpp/ie_infer_request.cpp b/src/inference/src/cpp/ie_infer_request.cpp similarity index 100% rename from inference-engine/src/inference_engine/src/cpp/ie_infer_request.cpp rename to src/inference/src/cpp/ie_infer_request.cpp diff --git a/inference-engine/src/inference_engine/src/cpp/ie_plugin.hpp b/src/inference/src/cpp/ie_plugin.hpp similarity index 96% rename from inference-engine/src/inference_engine/src/cpp/ie_plugin.hpp rename to src/inference/src/cpp/ie_plugin.hpp index e525103c06c..26a02391f74 100644 --- a/inference-engine/src/inference_engine/src/cpp/ie_plugin.hpp +++ b/src/inference/src/cpp/ie_plugin.hpp @@ -100,7 +100,7 @@ struct InferencePlugin { } Parameter GetMetric(const std::string& name, const std::map& options) const { - PLUGIN_CALL_STATEMENT(return _ptr->GetMetric(name, options)); + PLUGIN_CALL_STATEMENT(return {_so, _ptr->GetMetric(name, options)}); } ov::runtime::SoPtr CreateContext(const ParamMap& params) { @@ -112,7 +112,7 @@ struct InferencePlugin { } Parameter GetConfig(const std::string& name, const std::map& options) const { - PLUGIN_CALL_STATEMENT(return _ptr->GetConfig(name, options)); + PLUGIN_CALL_STATEMENT(return {_so, _ptr->GetConfig(name, options)}); } }; } // namespace InferenceEngine @@ -210,7 +210,7 @@ public: } ie::Parameter get_metric(const std::string& name, const ie::ParamMap& options) const { - OV_PLUGIN_CALL_STATEMENT(return _ptr->GetMetric(name, options)); + OV_PLUGIN_CALL_STATEMENT(return {_so, _ptr->GetMetric(name, options)}); } SoPtr create_context(const ie::ParamMap& params) { @@ -222,7 +222,7 @@ public: } ie::Parameter get_config(const std::string& name, const ie::ParamMap& options) const { - OV_PLUGIN_CALL_STATEMENT(return _ptr->GetConfig(name, options)); + OV_PLUGIN_CALL_STATEMENT(return {_so, _ptr->GetConfig(name, options)}); } }; diff --git a/inference-engine/src/inference_engine/src/cpp/ie_remote_context.cpp b/src/inference/src/cpp/ie_remote_context.cpp similarity index 91% rename from inference-engine/src/inference_engine/src/cpp/ie_remote_context.cpp rename to src/inference/src/cpp/ie_remote_context.cpp index 1c3942bfc10..0c873efa297 100644 --- a/inference-engine/src/inference_engine/src/cpp/ie_remote_context.cpp +++ b/src/inference/src/cpp/ie_remote_context.cpp @@ -59,7 +59,7 @@ std::string RemoteContext::get_device_name() const { RemoteTensor RemoteContext::create_tensor(const element::Type& element_type, const Shape& shape, - const ie::ParamMap& params) { + const ParamMap& params) { OV_REMOTE_CONTEXT_STATEMENT({ auto blob = _impl->CreateBlob( {ie::details::convertPrecision(element_type), shape, ie::TensorDesc::getLayoutByRank(shape.size())}, @@ -78,8 +78,14 @@ Tensor RemoteContext::create_host_tensor(const element::Type element_type, const }); } -ie::ParamMap RemoteContext::get_params() const { - OV_REMOTE_CONTEXT_STATEMENT(return _impl->getParams()); +ParamMap RemoteContext::get_params() const { + ParamMap paramMap; + OV_REMOTE_CONTEXT_STATEMENT({ + for (auto&& param : _impl->getParams()) { + paramMap.emplace(param.first, Any{_so, param.second}); + } + }); + return paramMap; } } // namespace runtime diff --git a/inference-engine/src/inference_engine/src/cpp/ie_variable_state.cpp b/src/inference/src/cpp/ie_variable_state.cpp similarity index 100% rename from inference-engine/src/inference_engine/src/cpp/ie_variable_state.cpp rename to src/inference/src/cpp/ie_variable_state.cpp diff --git a/inference-engine/src/inference_engine/src/cpp_interfaces/interface/ie_iexecutable_network_internal.cpp b/src/inference/src/cpp_interfaces/interface/ie_iexecutable_network_internal.cpp similarity index 100% rename from inference-engine/src/inference_engine/src/cpp_interfaces/interface/ie_iexecutable_network_internal.cpp rename to src/inference/src/cpp_interfaces/interface/ie_iexecutable_network_internal.cpp diff --git a/inference-engine/src/inference_engine/src/cpp_interfaces/interface/ie_iinfer_request_internal.cpp b/src/inference/src/cpp_interfaces/interface/ie_iinfer_request_internal.cpp similarity index 100% rename from inference-engine/src/inference_engine/src/cpp_interfaces/interface/ie_iinfer_request_internal.cpp rename to src/inference/src/cpp_interfaces/interface/ie_iinfer_request_internal.cpp diff --git a/inference-engine/src/inference_engine/src/cpp_interfaces/interface/ie_iplugin_internal.cpp b/src/inference/src/cpp_interfaces/interface/ie_iplugin_internal.cpp similarity index 100% rename from inference-engine/src/inference_engine/src/cpp_interfaces/interface/ie_iplugin_internal.cpp rename to src/inference/src/cpp_interfaces/interface/ie_iplugin_internal.cpp diff --git a/inference-engine/src/inference_engine/src/cpp_interfaces/interface/ie_ivariable_state_internal.cpp b/src/inference/src/cpp_interfaces/interface/ie_ivariable_state_internal.cpp similarity index 100% rename from inference-engine/src/inference_engine/src/cpp_interfaces/interface/ie_ivariable_state_internal.cpp rename to src/inference/src/cpp_interfaces/interface/ie_ivariable_state_internal.cpp diff --git a/inference-engine/src/inference_engine/src/cpu_x86_sse42/blob_transform_sse42.cpp b/src/inference/src/cpu_x86_sse42/blob_transform_sse42.cpp similarity index 100% rename from inference-engine/src/inference_engine/src/cpu_x86_sse42/blob_transform_sse42.cpp rename to src/inference/src/cpu_x86_sse42/blob_transform_sse42.cpp diff --git a/inference-engine/src/inference_engine/src/cpu_x86_sse42/blob_transform_sse42.hpp b/src/inference/src/cpu_x86_sse42/blob_transform_sse42.hpp similarity index 100% rename from inference-engine/src/inference_engine/src/cpu_x86_sse42/blob_transform_sse42.hpp rename to src/inference/src/cpu_x86_sse42/blob_transform_sse42.hpp diff --git a/inference-engine/src/inference_engine/src/file_utils.cpp b/src/inference/src/file_utils.cpp similarity index 100% rename from inference-engine/src/inference_engine/src/file_utils.cpp rename to src/inference/src/file_utils.cpp diff --git a/inference-engine/src/inference_engine/src/ie_cache_guard.cpp b/src/inference/src/ie_cache_guard.cpp similarity index 100% rename from inference-engine/src/inference_engine/src/ie_cache_guard.cpp rename to src/inference/src/ie_cache_guard.cpp diff --git a/inference-engine/src/inference_engine/src/ie_cache_guard.hpp b/src/inference/src/ie_cache_guard.hpp similarity index 100% rename from inference-engine/src/inference_engine/src/ie_cache_guard.hpp rename to src/inference/src/ie_cache_guard.hpp diff --git a/inference-engine/src/inference_engine/src/ie_cache_manager.hpp b/src/inference/src/ie_cache_manager.hpp similarity index 100% rename from inference-engine/src/inference_engine/src/ie_cache_manager.hpp rename to src/inference/src/ie_cache_manager.hpp diff --git a/inference-engine/src/inference_engine/src/ie_common.cpp b/src/inference/src/ie_common.cpp similarity index 77% rename from inference-engine/src/inference_engine/src/ie_common.cpp rename to src/inference/src/ie_common.cpp index 1a269837baf..da54d47b01f 100644 --- a/inference-engine/src/inference_engine/src/ie_common.cpp +++ b/src/inference/src/ie_common.cpp @@ -116,37 +116,3 @@ StatusCode InferenceEngineException::getStatus() const { IE_SUPPRESS_DEPRECATED_END } // namespace InferenceEngine - -namespace ov { - -namespace runtime { - -// -// openvino/runtime/parameter.hpp -// - -Parameter::~Parameter() { - clear(); -} - -#ifdef __ANDROID__ -Parameter::Any::~Any() {} - -template struct Parameter::RealData; -template struct Parameter::RealData; -template struct Parameter::RealData; -template struct Parameter::RealData; -template struct Parameter::RealData; -template struct Parameter::RealData; -template struct Parameter::RealData; -template struct Parameter::RealData; -template struct Parameter::RealData>; -template struct Parameter::RealData>; -template struct Parameter::RealData>; -template struct Parameter::RealData>; -template struct Parameter::RealData>; -#endif - -} // namespace runtime - -} // namespace ov diff --git a/inference-engine/src/inference_engine/src/ie_compound_blob.cpp b/src/inference/src/ie_compound_blob.cpp similarity index 100% rename from inference-engine/src/inference_engine/src/ie_compound_blob.cpp rename to src/inference/src/ie_compound_blob.cpp diff --git a/inference-engine/src/inference_engine/src/ie_core.cpp b/src/inference/src/ie_core.cpp similarity index 96% rename from inference-engine/src/inference_engine/src/ie_core.cpp rename to src/inference/src/ie_core.cpp index 4e69217b882..09fe7a043d5 100644 --- a/inference-engine/src/inference_engine/src/ie_core.cpp +++ b/src/inference/src/ie_core.cpp @@ -110,34 +110,6 @@ Parsed parseDeviceNameIntoConfig(const std::string& deviceName, const std::ma return {deviceName_, config_}; } -ie::Parameter copyParameterValue(const ie::Parameter& value) { - if (value.is()) { - return {value.as()}; - } else if (value.is()) { - return {value.as()}; - } else if (value.is()) { - return {value.as()}; - } else if (value.is()) { - return {value.as()}; - } else if (value.is()) { - return {value.as()}; - } else if (value.is>()) { - return {value.as>()}; - } else if (value.is>()) { - return {value.as>()}; - } else if (value.is>()) { - return {value.as>()}; - } else if (value.is>()) { - return {value.as>()}; - } else if (value.is>()) { - return {value.as>()}; - } else if (value.is>()) { - return {value.as>()}; - } - - return std::move(value); -} - template void allowNotImplemented(F&& f) { try { @@ -235,7 +207,8 @@ class CoreImpl : public ie::ICore, public std::enable_shared_from_this supportedMetricKeys = plugin.get_metric(METRIC_KEY(SUPPORTED_METRICS), {}); auto it = std::find(supportedMetricKeys.begin(), supportedMetricKeys.end(), METRIC_KEY(IMPORT_EXPORT_SUPPORT)); - bool supported = (it != supportedMetricKeys.end()) && plugin.get_metric(METRIC_KEY(IMPORT_EXPORT_SUPPORT), {}); + bool supported = + (it != supportedMetricKeys.end()) && plugin.get_metric(METRIC_KEY(IMPORT_EXPORT_SUPPORT), {}).as(); return supported; } @@ -785,19 +758,12 @@ public: parsed._config.insert(o); } - // we need to return a copy of Parameter object which is created on Core side, - // not in InferenceEngine plugin side, which can be unloaded from Core in a parallel thread - // TODO: remove this WA after *-31417 is resolved - return copyParameterValue(GetCPPPluginByName(parsed._deviceName).get_metric(name, parsed._config)); + return GetCPPPluginByName(parsed._deviceName).get_metric(name, parsed._config); } ie::Parameter GetConfig(const std::string& deviceName, const std::string& name) const override { auto parsed = parseDeviceNameIntoConfig(deviceName); - - // we need to return a copy of Parameter object which is created on Core side, - // not in InferenceEngine plugin side, which can be unloaded from Core in a parallel thread - // TODO: remove this WA after *-31417 is resolved - return copyParameterValue(GetCPPPluginByName(parsed._deviceName).get_config(name, parsed._config)); + return GetCPPPluginByName(parsed._deviceName).get_config(name, parsed._config); } /** @@ -1506,12 +1472,7 @@ Parameter Core::GetConfig(const std::string& deviceName, const std::string& name } auto parsed = ov::runtime::parseDeviceNameIntoConfig(deviceName); - - // we need to return a copy of Parameter object which is created on Core side, - // not in InferenceEngine plugin side, which can be unloaded from Core in a parallel thread - // TODO: remove this WA after *-31417 is resolved - return ov::runtime::copyParameterValue( - _impl->GetCPPPluginByName(parsed._deviceName).get_config(name, parsed._config)); + return _impl->GetCPPPluginByName(parsed._deviceName).get_config(name, parsed._config); } Parameter Core::GetMetric(const std::string& deviceName, const std::string& name, const ParamMap& options) const { @@ -1718,7 +1679,7 @@ void Core::set_config(const ConfigMap& config, const std::string& deviceName) { }); } -Parameter Core::get_config(const std::string& deviceName, const std::string& name) const { +Any Core::get_config(const std::string& deviceName, const std::string& name) const { OPENVINO_ASSERT(deviceName.find("HETERO:") != 0, "You can only get_config of the HETERO itself (without devices). " "get_config is also possible for the individual devices before creating the HETERO on top."); @@ -1731,15 +1692,11 @@ Parameter Core::get_config(const std::string& deviceName, const std::string& nam OV_CORE_CALL_STATEMENT({ auto parsed = parseDeviceNameIntoConfig(deviceName); - - // we need to return a copy of Parameter object which is created on Core side, - // not in ie plugin side, which can be unloaded from Core in a parallel thread - // TODO: remove this WA after *-31417 is resolved - return copyParameterValue(_impl->GetCPPPluginByName(parsed._deviceName).get_config(name, parsed._config)); + return _impl->GetCPPPluginByName(parsed._deviceName).get_config(name, parsed._config); }); } -Parameter Core::get_metric(const std::string& deviceName, const std::string& name) const { +Any Core::get_metric(const std::string& deviceName, const std::string& name) const { OV_CORE_CALL_STATEMENT(return _impl->GetMetric(deviceName, name);); } diff --git a/inference-engine/src/inference_engine/src/ie_data.cpp b/src/inference/src/ie_data.cpp similarity index 100% rename from inference-engine/src/inference_engine/src/ie_data.cpp rename to src/inference/src/ie_data.cpp diff --git a/inference-engine/src/inference_engine/src/ie_itt.hpp b/src/inference/src/ie_itt.hpp similarity index 100% rename from inference-engine/src/inference_engine/src/ie_itt.hpp rename to src/inference/src/ie_itt.hpp diff --git a/inference-engine/src/inference_engine/src/ie_memcpy.cpp b/src/inference/src/ie_memcpy.cpp similarity index 100% rename from inference-engine/src/inference_engine/src/ie_memcpy.cpp rename to src/inference/src/ie_memcpy.cpp diff --git a/inference-engine/src/inference_engine/src/ie_network_reader.cpp b/src/inference/src/ie_network_reader.cpp similarity index 99% rename from inference-engine/src/inference_engine/src/ie_network_reader.cpp rename to src/inference/src/ie_network_reader.cpp index b4e04f139c6..473394e7ae2 100644 --- a/inference-engine/src/inference_engine/src/ie_network_reader.cpp +++ b/src/inference/src/ie_network_reader.cpp @@ -20,10 +20,10 @@ #include "ie_input_info.hpp" #include "manager.hpp" #ifdef ENABLE_IR_V7_READER -# include "ie_ir_version.hpp" +# include "legacy/ie_ir_version.hpp" #endif #include "ie_itt.hpp" -#include "ie_reader.hpp" +#include "legacy/ie_reader.hpp" #include "ngraph/function.hpp" #include "ngraph/type/element_type.hpp" #include "ngraph/variant.hpp" diff --git a/inference-engine/src/inference_engine/src/ie_network_reader.hpp b/src/inference/src/ie_network_reader.hpp similarity index 100% rename from inference-engine/src/inference_engine/src/ie_network_reader.hpp rename to src/inference/src/ie_network_reader.hpp diff --git a/inference-engine/src/inference_engine/src/ie_ngraph_utils.cpp b/src/inference/src/ie_ngraph_utils.cpp similarity index 100% rename from inference-engine/src/inference_engine/src/ie_ngraph_utils.cpp rename to src/inference/src/ie_ngraph_utils.cpp diff --git a/inference-engine/src/inference_engine/src/ie_remote_context.cpp b/src/inference/src/ie_remote_context.cpp similarity index 100% rename from inference-engine/src/inference_engine/src/ie_remote_context.cpp rename to src/inference/src/ie_remote_context.cpp diff --git a/inference-engine/src/inference_engine/src/ie_system_conf.cpp b/src/inference/src/ie_system_conf.cpp similarity index 100% rename from inference-engine/src/inference_engine/src/ie_system_conf.cpp rename to src/inference/src/ie_system_conf.cpp diff --git a/inference-engine/src/inference_engine/src/ie_transformations.cpp b/src/inference/src/ie_transformations.cpp similarity index 100% rename from inference-engine/src/inference_engine/src/ie_transformations.cpp rename to src/inference/src/ie_transformations.cpp diff --git a/inference-engine/src/inference_engine/src/ie_version.cpp b/src/inference/src/ie_version.cpp similarity index 100% rename from inference-engine/src/inference_engine/src/ie_version.cpp rename to src/inference/src/ie_version.cpp diff --git a/inference-engine/src/inference_engine/src/os/lin/lin_system_conf.cpp b/src/inference/src/os/lin/lin_system_conf.cpp similarity index 100% rename from inference-engine/src/inference_engine/src/os/lin/lin_system_conf.cpp rename to src/inference/src/os/lin/lin_system_conf.cpp diff --git a/inference-engine/src/inference_engine/src/os/win/win_system_conf.cpp b/src/inference/src/os/win/win_system_conf.cpp similarity index 100% rename from inference-engine/src/inference_engine/src/os/win/win_system_conf.cpp rename to src/inference/src/os/win/win_system_conf.cpp diff --git a/inference-engine/src/inference_engine/src/precision_utils.cpp b/src/inference/src/precision_utils.cpp similarity index 100% rename from inference-engine/src/inference_engine/src/precision_utils.cpp rename to src/inference/src/precision_utils.cpp diff --git a/inference-engine/src/inference_engine/src/precomp.hpp b/src/inference/src/precomp.hpp similarity index 100% rename from inference-engine/src/inference_engine/src/precomp.hpp rename to src/inference/src/precomp.hpp diff --git a/inference-engine/src/inference_engine/src/remote_tensor.cpp b/src/inference/src/remote_tensor.cpp similarity index 93% rename from inference-engine/src/inference_engine/src/remote_tensor.cpp rename to src/inference/src/remote_tensor.cpp index 88af4062adf..d1bf97474cd 100644 --- a/inference-engine/src/inference_engine/src/remote_tensor.cpp +++ b/src/inference/src/remote_tensor.cpp @@ -38,7 +38,11 @@ ie::ParamMap RemoteTensor::get_params() const { type_check(*this); auto remote_impl = static_cast(_impl.get()); try { - return remote_impl->getParams(); + ParamMap paramMap; + for (auto&& param : remote_impl->getParams()) { + paramMap.emplace(param.first, Any{_so, param.second}); + } + return paramMap; } catch (const std::exception& ex) { throw ov::Exception(ex.what()); } catch (...) { diff --git a/inference-engine/src/inference_engine/src/shared_object_loader.cpp b/src/inference/src/shared_object_loader.cpp similarity index 100% rename from inference-engine/src/inference_engine/src/shared_object_loader.cpp rename to src/inference/src/shared_object_loader.cpp diff --git a/inference-engine/src/inference_engine/src/system_allocator.hpp b/src/inference/src/system_allocator.hpp similarity index 100% rename from inference-engine/src/inference_engine/src/system_allocator.hpp rename to src/inference/src/system_allocator.hpp diff --git a/inference-engine/src/inference_engine/src/threading/ie_cpu_streams_executor.cpp b/src/inference/src/threading/ie_cpu_streams_executor.cpp similarity index 100% rename from inference-engine/src/inference_engine/src/threading/ie_cpu_streams_executor.cpp rename to src/inference/src/threading/ie_cpu_streams_executor.cpp diff --git a/inference-engine/src/inference_engine/src/threading/ie_executor_manager.cpp b/src/inference/src/threading/ie_executor_manager.cpp similarity index 100% rename from inference-engine/src/inference_engine/src/threading/ie_executor_manager.cpp rename to src/inference/src/threading/ie_executor_manager.cpp diff --git a/inference-engine/src/inference_engine/src/threading/ie_istreams_executor.cpp b/src/inference/src/threading/ie_istreams_executor.cpp similarity index 100% rename from inference-engine/src/inference_engine/src/threading/ie_istreams_executor.cpp rename to src/inference/src/threading/ie_istreams_executor.cpp diff --git a/inference-engine/src/inference_engine/src/threading/ie_itask_executor.cpp b/src/inference/src/threading/ie_itask_executor.cpp similarity index 100% rename from inference-engine/src/inference_engine/src/threading/ie_itask_executor.cpp rename to src/inference/src/threading/ie_itask_executor.cpp diff --git a/inference-engine/src/inference_engine/src/threading/ie_parallel_custom_arena.cpp b/src/inference/src/threading/ie_parallel_custom_arena.cpp similarity index 100% rename from inference-engine/src/inference_engine/src/threading/ie_parallel_custom_arena.cpp rename to src/inference/src/threading/ie_parallel_custom_arena.cpp diff --git a/inference-engine/src/inference_engine/src/threading/ie_parallel_custom_arena.hpp b/src/inference/src/threading/ie_parallel_custom_arena.hpp similarity index 100% rename from inference-engine/src/inference_engine/src/threading/ie_parallel_custom_arena.hpp rename to src/inference/src/threading/ie_parallel_custom_arena.hpp diff --git a/inference-engine/src/inference_engine/src/threading/ie_tbb_streams_executor.cpp b/src/inference/src/threading/ie_tbb_streams_executor.cpp similarity index 100% rename from inference-engine/src/inference_engine/src/threading/ie_tbb_streams_executor.cpp rename to src/inference/src/threading/ie_tbb_streams_executor.cpp diff --git a/inference-engine/src/inference_engine/src/threading/ie_thread_affinity.cpp b/src/inference/src/threading/ie_thread_affinity.cpp similarity index 100% rename from inference-engine/src/inference_engine/src/threading/ie_thread_affinity.cpp rename to src/inference/src/threading/ie_thread_affinity.cpp diff --git a/inference-engine/src/inference_engine/src/threading/ie_thread_affinity.hpp b/src/inference/src/threading/ie_thread_affinity.hpp similarity index 100% rename from inference-engine/src/inference_engine/src/threading/ie_thread_affinity.hpp rename to src/inference/src/threading/ie_thread_affinity.hpp diff --git a/inference-engine/src/inference_engine/src/xml_parse_utils.cpp b/src/inference/src/xml_parse_utils.cpp similarity index 100% rename from inference-engine/src/inference_engine/src/xml_parse_utils.cpp rename to src/inference/src/xml_parse_utils.cpp diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt new file mode 100644 index 00000000000..7743176ab42 --- /dev/null +++ b/src/plugins/CMakeLists.txt @@ -0,0 +1,7 @@ +# Copyright (C) 2021 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 +# + +if(ENABLE_HETERO) + add_subdirectory(hetero) +endif() diff --git a/inference-engine/src/hetero_plugin/CMakeLists.txt b/src/plugins/hetero/CMakeLists.txt similarity index 84% rename from inference-engine/src/hetero_plugin/CMakeLists.txt rename to src/plugins/hetero/CMakeLists.txt index 4f325769369..61c9eab2a94 100644 --- a/inference-engine/src/hetero_plugin/CMakeLists.txt +++ b/src/plugins/hetero/CMakeLists.txt @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 # -set (TARGET_NAME "HeteroPlugin") +set (TARGET_NAME "ov_hetero_plugin") file(GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) file(GLOB_RECURSE HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp) @@ -10,7 +10,8 @@ file(GLOB_RECURSE HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp) ie_add_plugin(NAME ${TARGET_NAME} DEVICE_NAME "HETERO" SOURCES ${SOURCES} ${HEADERS} - VERSION_DEFINES_FOR hetero_plugin.cpp) + VERSION_DEFINES_FOR plugin.cpp + ADD_CLANG_FORMAT) ie_faster_build(${TARGET_NAME} UNITY diff --git a/inference-engine/src/hetero_plugin/hetero_async_infer_request.cpp b/src/plugins/hetero/async_infer_request.cpp similarity index 66% rename from inference-engine/src/hetero_plugin/hetero_async_infer_request.cpp rename to src/plugins/hetero/async_infer_request.cpp index 019332f0a62..8496ceb172b 100644 --- a/inference-engine/src/hetero_plugin/hetero_async_infer_request.cpp +++ b/src/plugins/hetero/async_infer_request.cpp @@ -2,24 +2,24 @@ // SPDX-License-Identifier: Apache-2.0 // -#include +#include "async_infer_request.hpp" + #include -#include "hetero_async_infer_request.hpp" +#include using namespace HeteroPlugin; using namespace InferenceEngine; -HeteroAsyncInferRequest::HeteroAsyncInferRequest(const IInferRequestInternal::Ptr& request, - const ITaskExecutor::Ptr& taskExecutor, - const ITaskExecutor::Ptr& callbackExecutor) : - AsyncInferRequestThreadSafeDefault(request, taskExecutor, callbackExecutor), - _heteroInferRequest(std::static_pointer_cast(request)) { +HeteroAsyncInferRequest::HeteroAsyncInferRequest(const IInferRequestInternal::Ptr& request, + const ITaskExecutor::Ptr& taskExecutor, + const ITaskExecutor::Ptr& callbackExecutor) + : AsyncInferRequestThreadSafeDefault(request, taskExecutor, callbackExecutor), + _heteroInferRequest(std::static_pointer_cast(request)) { _pipeline.clear(); for (std::size_t requestId = 0; requestId < _heteroInferRequest->_inferRequests.size(); ++requestId) { struct RequestExecutor : ITaskExecutor { - explicit RequestExecutor(SoIInferRequestInternal & inferRequest) : _inferRequest(inferRequest) { - _inferRequest->SetCallback( - [this] (std::exception_ptr exceptionPtr) mutable { + explicit RequestExecutor(SoIInferRequestInternal& inferRequest) : _inferRequest(inferRequest) { + _inferRequest->SetCallback([this](std::exception_ptr exceptionPtr) mutable { _exceptionPtr = exceptionPtr; auto capturedTask = std::move(_task); capturedTask(); @@ -29,12 +29,13 @@ HeteroAsyncInferRequest::HeteroAsyncInferRequest(const IInferRequestInternal::Pt _task = std::move(task); _inferRequest->StartAsync(); }; - SoIInferRequestInternal & _inferRequest; - std::exception_ptr _exceptionPtr; - Task _task; + SoIInferRequestInternal& _inferRequest; + std::exception_ptr _exceptionPtr; + Task _task; }; - auto requestExecutor = std::make_shared(_heteroInferRequest->_inferRequests[requestId]._request); + auto requestExecutor = + std::make_shared(_heteroInferRequest->_inferRequests[requestId]._request); _pipeline.emplace_back(requestExecutor, [requestExecutor] { if (nullptr != requestExecutor->_exceptionPtr) { std::rethrow_exception(requestExecutor->_exceptionPtr); @@ -47,7 +48,7 @@ StatusCode HeteroAsyncInferRequest::Wait(int64_t millis_timeout) { auto waitStatus = StatusCode::OK; try { waitStatus = AsyncInferRequestThreadSafeDefault::Wait(millis_timeout); - } catch(...) { + } catch (...) { for (auto&& requestDesc : _heteroInferRequest->_inferRequests) { requestDesc._request->Wait(InferRequest::RESULT_READY); } diff --git a/inference-engine/src/hetero_plugin/hetero_async_infer_request.hpp b/src/plugins/hetero/async_infer_request.hpp similarity index 82% rename from inference-engine/src/hetero_plugin/hetero_async_infer_request.hpp rename to src/plugins/hetero/async_infer_request.hpp index 85d6a13afba..1f0befcc720 100644 --- a/inference-engine/src/hetero_plugin/hetero_async_infer_request.hpp +++ b/src/plugins/hetero/async_infer_request.hpp @@ -4,10 +4,11 @@ #pragma once -#include #include +#include + #include "cpp_interfaces/impl/ie_infer_async_request_thread_safe_default.hpp" -#include "hetero_infer_request.hpp" +#include "infer_request.hpp" namespace HeteroPlugin { @@ -15,14 +16,13 @@ class HeteroAsyncInferRequest : public InferenceEngine::AsyncInferRequestThreadS public: using Ptr = std::shared_ptr; HeteroAsyncInferRequest(const InferenceEngine::IInferRequestInternal::Ptr& request, - const InferenceEngine::ITaskExecutor::Ptr& taskExecutor, - const InferenceEngine::ITaskExecutor::Ptr& callbackExecutor); + const InferenceEngine::ITaskExecutor::Ptr& taskExecutor, + const InferenceEngine::ITaskExecutor::Ptr& callbackExecutor); ~HeteroAsyncInferRequest(); InferenceEngine::StatusCode Wait(int64_t millis_timeout) override; private: - HeteroInferRequest::Ptr _heteroInferRequest; + HeteroInferRequest::Ptr _heteroInferRequest; }; } // namespace HeteroPlugin - diff --git a/inference-engine/src/hetero_plugin/hetero_executable_network.cpp b/src/plugins/hetero/executable_network.cpp similarity index 76% rename from inference-engine/src/hetero_plugin/hetero_executable_network.cpp rename to src/plugins/hetero/executable_network.cpp index c38ea9ed112..c79090d9c12 100644 --- a/inference-engine/src/hetero_plugin/hetero_executable_network.cpp +++ b/src/plugins/hetero/executable_network.cpp @@ -2,10 +2,11 @@ // SPDX-License-Identifier: Apache-2.0 // +// clang-format off #include "ie_metric_helpers.hpp" -#include "hetero_executable_network.hpp" -#include "hetero_async_infer_request.hpp" -#include "hetero_itt.hpp" +#include "executable_network.hpp" +#include "async_infer_request.hpp" +#include "itt.hpp" #include "ie_precision.hpp" #include "openvino/core/dimension.hpp" #include "openvino/core/except.hpp" @@ -34,7 +35,7 @@ #include "ie_plugin_config.hpp" #include "ie_algorithm.hpp" #include "cpp_interfaces/interface/ie_internal_plugin_config.hpp" -#include "hetero_plugin.hpp" +#include "plugin.hpp" #include #include @@ -45,6 +46,7 @@ #include #include #include +// clang-format on using namespace InferenceEngine; using namespace details; @@ -52,25 +54,25 @@ using namespace HeteroPlugin; using namespace InferenceEngine::PluginConfigParams; using namespace InferenceEngine::HeteroConfigParams; -template +template using NodeMap = std::unordered_map; -HeteroExecutableNetwork::HeteroExecutableNetwork(const InferenceEngine::CNNNetwork& network, - const Engine::Configs& config, - Engine* plugin): - InferenceEngine::ExecutableNetworkThreadSafeDefault( - nullptr, std::make_shared()), - _heteroPlugin{plugin}, - _name{network.getName()}, - _config{config} { +HeteroExecutableNetwork::HeteroExecutableNetwork(const InferenceEngine::CNNNetwork& network, + const Engine::Configs& config, + Engine* plugin) + : InferenceEngine::ExecutableNetworkThreadSafeDefault(nullptr, + std::make_shared()), + _heteroPlugin{plugin}, + _name{network.getName()}, + _config{config} { auto function = network.getFunction(); IE_ASSERT(function != nullptr); auto clonedFunction = ngraph::clone_function(*function); auto itDumpDotFile = _config.find(HETERO_CONFIG_KEY(DUMP_GRAPH_DOT)); bool dumpDotFile = itDumpDotFile != _config.end() ? (itDumpDotFile->second == YES) : false; -//#ifndef NDEBUG -// dumpDotFile = true; -//#endif + //#ifndef NDEBUG + // dumpDotFile = true; + //#endif QueryNetworkResult queryNetworkResult; auto orderedOps = clonedFunction->get_ordered_ops(); @@ -101,7 +103,7 @@ HeteroExecutableNetwork::HeteroExecutableNetwork(const InferenceEngine::CNNNetwo using NodeSet = std::unordered_set; using InputSet = std::set; - auto InputNode = [] (const ngraph::Input& input) { + auto InputNode = [](const ngraph::Input& input) { return input.get_source_output().get_node(); }; @@ -109,13 +111,13 @@ HeteroExecutableNetwork::HeteroExecutableNetwork(const InferenceEngine::CNNNetwo for (auto&& node : clonedFunction->get_ops()) { if (ngraph::op::is_constant(node) || ngraph::op::is_output(node) || ngraph::op::is_parameter(node)) { if (!contains(queryNetworkResult.supportedLayersMap, node->get_friendly_name())) { - auto& nodeWithAffinityName = ngraph::op::is_output(node) - ? node->input_value(0).get_node()->get_friendly_name() - : node->output(0).get_target_inputs().begin()->get_node()->get_friendly_name(); + auto& nodeWithAffinityName = + ngraph::op::is_output(node) + ? node->input_value(0).get_node()->get_friendly_name() + : node->output(0).get_target_inputs().begin()->get_node()->get_friendly_name(); auto itAffinity = queryNetworkResult.supportedLayersMap.find(nodeWithAffinityName); if (itAffinity == queryNetworkResult.supportedLayersMap.end()) { - IE_THROW() << "Node " << nodeWithAffinityName << - " was not assigned on any pointed device."; + IE_THROW() << "Node " << nodeWithAffinityName << " was not assigned on any pointed device."; } queryNetworkResult.supportedLayersMap.emplace(node->get_friendly_name(), itAffinity->second); } @@ -131,18 +133,18 @@ HeteroExecutableNetwork::HeteroExecutableNetwork(const InferenceEngine::CNNNetwo affinities[node.get()] = itAffinity->second; devices.emplace(itAffinity->second); } else if (allEmpty) { - IE_THROW() << "Hetero plugin used default fallback policy, but some layers eg: \n(Name:" << - node->get_friendly_name() << ", Type: " << node->get_type_name() << - ") were not able to be assigned on any pointed device.\n" << - "It happened because these layers are not supported in plugins by default.\n" << - "You need to implement custom layers to support them."; + IE_THROW() << "Hetero plugin used default fallback policy, but some layers eg: \n(Name:" + << node->get_friendly_name() << ", Type: " << node->get_type_name() + << ") were not able to be assigned on any pointed device.\n" + << "It happened because these layers are not supported in plugins by default.\n" + << "You need to implement custom layers to support them."; } else { - IE_THROW() << "Network passed to LoadNetwork has affinity assigned, but some layers eg: \n(Name:" << - node->get_friendly_name() << ", Type: " << node->get_type_name() << - ") were not assigned to any device.\n" << - "It might happen if you assigned layers manually and missed some layers or\n" << - "if you used some automatic assigning mode which decided that these layers are not\n" << - "supported by any plugin"; + IE_THROW() << "Network passed to LoadNetwork has affinity assigned, but some layers eg: \n(Name:" + << node->get_friendly_name() << ", Type: " << node->get_type_name() + << ") were not assigned to any device.\n" + << "It might happen if you assigned layers manually and missed some layers or\n" + << "if you used some automatic assigning mode which decided that these layers are not\n" + << "supported by any plugin"; } } @@ -164,17 +166,21 @@ HeteroExecutableNetwork::HeteroExecutableNetwork(const InferenceEngine::CNNNetwo }; if (dumpDotFile) { - ngraph::pass::VisualizeTree{"hetero_affinity_" + _name + ".dot", - [&] (const ngraph::Node& node, std::vector& attributes) { + ngraph::pass::VisualizeTree{ + "hetero_affinity_" + _name + ".dot", + [&](const ngraph::Node& node, std::vector& attributes) { auto nodeDevice = queryNetworkResult.supportedLayersMap.at(node.get_friendly_name()); int colorIndex = 0; for (auto&& device : devices) { if (device == nodeDevice) { - attributes.push_back(std::string {"fillcolor="} + colors[colorIndex % colors.size()] + " style=filled"); - auto itLabel = std::find_if(std::begin(attributes), std::end(attributes), [] (const std::string& str) { - return str.find("label") != std::string::npos; - }); - auto label = "\\ndevice=" + queryNetworkResult.supportedLayersMap.at(node.get_friendly_name()) + '\"'; + attributes.push_back(std::string{"fillcolor="} + colors[colorIndex % colors.size()] + + " style=filled"); + auto itLabel = + std::find_if(std::begin(attributes), std::end(attributes), [](const std::string& str) { + return str.find("label") != std::string::npos; + }); + auto label = + "\\ndevice=" + queryNetworkResult.supportedLayersMap.at(node.get_friendly_name()) + '\"'; IE_ASSERT(itLabel != attributes.end()); itLabel->pop_back(); (*itLabel) += label; @@ -182,10 +188,10 @@ HeteroExecutableNetwork::HeteroExecutableNetwork(const InferenceEngine::CNNNetwo } colorIndex++; } - }}.run_on_function(ngraph::clone_function(*function)); + }} + .run_on_function(ngraph::clone_function(*function)); } - NodeMap nodeInputDependencies; NodeSet graphInputNodes; InputSet subgraphInputs; @@ -245,7 +251,8 @@ HeteroExecutableNetwork::HeteroExecutableNetwork(const InferenceEngine::CNNNetwo }; // Split cyclic dependencies. - for (std::size_t prevSubgraphs = 0, cyclicSplitStep = 0; prevSubgraphs != subgraphInputs.size(); ++cyclicSplitStep) { + for (std::size_t prevSubgraphs = 0, cyclicSplitStep = 0; prevSubgraphs != subgraphInputs.size(); + ++cyclicSplitStep) { IE_ASSERT(cyclicSplitStep < orderedOps.size()); prevSubgraphs = subgraphInputs.size(); auto subgraphIds = CollectSubgraphs(); @@ -282,10 +289,10 @@ HeteroExecutableNetwork::HeteroExecutableNetwork(const InferenceEngine::CNNNetwo } } for (auto&& input : node->inputs()) { - auto& inputNodeSubgraphCyclicInputDependency = nodeSubgraphCyclicInputDependencies[InputNode(input)]; + auto& inputNodeSubgraphCyclicInputDependency = + nodeSubgraphCyclicInputDependencies[InputNode(input)]; auto& inputNodeSubgraphInputDependency = nodeSubgraphInputDependencies[InputNode(input)]; - if (!Intersects(nodeSubgraphCyclicInputDependency, - inputNodeSubgraphCyclicInputDependency) && + if (!Intersects(nodeSubgraphCyclicInputDependency, inputNodeSubgraphCyclicInputDependency) && Intersects(cyclicInputsDependencies, inputNodeSubgraphInputDependency)) { subgraphInputs.insert(input); } @@ -303,30 +310,32 @@ HeteroExecutableNetwork::HeteroExecutableNetwork(const InferenceEngine::CNNNetwo auto output = input.get_source_output(); output.remove_target_input(input); auto result = std::make_shared(output); - result->set_friendly_name(output.get_node()->get_friendly_name() - + "_" + std::to_string(output.get_index()) + "_result"); + result->set_friendly_name(output.get_node()->get_friendly_name() + "_" + + std::to_string(output.get_index()) + "_result"); ngraph::copy_runtime_info(output.get_node_shared_ptr(), result); - auto parameter = std::make_shared(output.get_element_type(), output.get_partial_shape()); - parameter->set_friendly_name(input.get_node()->get_friendly_name() - + "_" + std::to_string(input.get_index()) + "_parameter"); + auto parameter = + std::make_shared(output.get_element_type(), output.get_partial_shape()); + parameter->set_friendly_name(input.get_node()->get_friendly_name() + "_" + + std::to_string(input.get_index()) + "_parameter"); ngraph::copy_runtime_info(input.get_node()->shared_from_this(), parameter); input.replace_source_output(parameter->output(0)); results.push_back(result); subgraphIds.emplace(result.get(), subgraphIds[output.get_node()]); subgraphIds.emplace(parameter.get(), subgraphIds[input.get_node()]); subgraphParameterToPrevResult.emplace(parameter.get(), result.get()); - _blobNameMap.emplace(parameter->get_friendly_name(), - output.get_node()->get_friendly_name() + - ((output.get_node()->get_output_size() != 1) - ? ("." + std::to_string(output.get_index())) : std::string{})); + _blobNameMap.emplace( + parameter->get_friendly_name(), + output.get_node()->get_friendly_name() + ((output.get_node()->get_output_size() != 1) + ? ("." + std::to_string(output.get_index())) + : std::string{})); } } struct Subgraph { - ngraph::ResultVector _results; + ngraph::ResultVector _results; ngraph::ParameterVector _parameters; - ngraph::SinkVector _sinks; - std::string _affinity; + ngraph::SinkVector _sinks; + std::string _affinity; }; std::unordered_map subgraphs; // Extracts subgraph parameters, results and affinities @@ -334,14 +343,12 @@ HeteroExecutableNetwork::HeteroExecutableNetwork(const InferenceEngine::CNNNetwo auto node = subgraphIdPtrValue.first; auto& subgraph = subgraphs[subgraphIdPtrValue.second]; if (ngraph::op::is_output(node)) { - subgraph._results.emplace_back( - std::dynamic_pointer_cast(node->shared_from_this())); + subgraph._results.emplace_back(std::dynamic_pointer_cast(node->shared_from_this())); } else if (ngraph::op::is_parameter(node)) { subgraph._parameters.emplace_back( std::dynamic_pointer_cast(node->shared_from_this())); } else if (ngraph::op::is_sink(node)) { - subgraph._sinks.emplace_back( - std::dynamic_pointer_cast(node->shared_from_this())); + subgraph._sinks.emplace_back(std::dynamic_pointer_cast(node->shared_from_this())); } auto itAffinity = affinities.find(node); if (itAffinity != affinities.end()) { @@ -362,20 +369,24 @@ HeteroExecutableNetwork::HeteroExecutableNetwork(const InferenceEngine::CNNNetwo IE_ASSERT(subgraphTopoSortsStep < subgraphs.size()); ++subgraphTopoSortsStep; std::vector nextSubgraphs; - auto IsNextSubGraph = [&] (const Subgraph& subgraph) { + auto IsNextSubGraph = [&](const Subgraph& subgraph) { auto& parameters = subgraph._parameters; - return std::all_of(parameters.begin(), parameters.end(), - [&] (const ngraph::ParameterVector::value_type& parameter) { - return contains(graphInputNodes, parameter.get()) || - contains(prevResults, subgraphParameterToPrevResult[parameter.get()]);}); + return std::all_of(parameters.begin(), + parameters.end(), + [&](const ngraph::ParameterVector::value_type& parameter) { + return contains(graphInputNodes, parameter.get()) || + contains(prevResults, subgraphParameterToPrevResult[parameter.get()]); + }); }; - std::remove_copy_if(std::begin(allSubgraphs), std::end(allSubgraphs), + std::remove_copy_if(std::begin(allSubgraphs), + std::end(allSubgraphs), std::back_inserter(nextSubgraphs), - [&] (const Subgraph& subgraph) { return !IsNextSubGraph(subgraph);}); - allSubgraphs.erase( - std::remove_if(std::begin(allSubgraphs), std::end(allSubgraphs), IsNextSubGraph), - std::end(allSubgraphs)); - for (auto&& subgraph : nextSubgraphs) { + [&](const Subgraph& subgraph) { + return !IsNextSubGraph(subgraph); + }); + allSubgraphs.erase(std::remove_if(std::begin(allSubgraphs), std::end(allSubgraphs), IsNextSubGraph), + std::end(allSubgraphs)); + for (auto&& subgraph : nextSubgraphs) { for (auto&& result : subgraph._results) { prevResults.insert(result.get()); } @@ -390,9 +401,10 @@ HeteroExecutableNetwork::HeteroExecutableNetwork(const InferenceEngine::CNNNetwo int id = 0; for (auto&& subgraph : orderedSubgraphs) { _networks[id]._device = subgraph._affinity; - subFunctions[id] = - std::make_shared(subgraph._results, subgraph._sinks, subgraph._parameters, - _name + '_' + std::to_string(id)); + subFunctions[id] = std::make_shared(subgraph._results, + subgraph._sinks, + subgraph._parameters, + _name + '_' + std::to_string(id)); _networks[id]._clonedNetwork = CNNNetwork{subFunctions[id]}; // update of pre-processing info auto clonedInputs = _networks[id]._clonedNetwork.getInputsInfo(); @@ -414,9 +426,9 @@ HeteroExecutableNetwork::HeteroExecutableNetwork(const InferenceEngine::CNNNetwo } } - auto toLegacyType = [] (const ngraph::element::Type& ngraph_type) { - return (ngraph_type == ngraph::element::f16 || ngraph_type == ngraph::element::bf16) ? - ngraph::element::f32 : ngraph_type; + auto toLegacyType = [](const ngraph::element::Type& ngraph_type) { + return (ngraph_type == ngraph::element::f16 || ngraph_type == ngraph::element::bf16) ? ngraph::element::f32 + : ngraph_type; }; // CNNNetwork converts input and output types to preserve legacy behaviour @@ -428,8 +440,7 @@ HeteroExecutableNetwork::HeteroExecutableNetwork(const InferenceEngine::CNNNetwo auto name = parameter->get_friendly_name(); if (parameter->get_friendly_name() == input.first) { input.second->setPrecision( - InferenceEngine::details::convertPrecision( - toLegacyType(parameter->get_element_type()))); + InferenceEngine::details::convertPrecision(toLegacyType(parameter->get_element_type()))); } } } @@ -441,8 +452,7 @@ HeteroExecutableNetwork::HeteroExecutableNetwork(const InferenceEngine::CNNNetwo auto output_name = ngraph::op::util::create_ie_output_name(source_output); if (output_name == output.first) { output.second->setPrecision( - InferenceEngine::details::convertPrecision( - toLegacyType(source_output.get_element_type()))); + InferenceEngine::details::convertPrecision(toLegacyType(source_output.get_element_type()))); } } } @@ -450,37 +460,42 @@ HeteroExecutableNetwork::HeteroExecutableNetwork(const InferenceEngine::CNNNetwo ++id; } if (dumpDotFile) { - ngraph::pass::VisualizeTree{"hetero_subgraphs_" + _name + ".dot", - [&] (const ngraph::Node& node, std::vector& attributes) { + ngraph::pass::VisualizeTree{ + "hetero_subgraphs_" + _name + ".dot", + [&](const ngraph::Node& node, std::vector& attributes) { for (size_t i = 0; i < subFunctions.size(); i++) { for (auto&& nodeInSubfunction : subFunctions[i]->get_ops()) { if (nodeInSubfunction->get_friendly_name() == node.get_friendly_name()) { - attributes.push_back(std::string {"fillcolor="} + colors[i % colors.size()] + " style=filled"); - auto itLabel = std::find_if(std::begin(attributes), std::end(attributes), [] (const std::string& str) { - return str.find("label") != std::string::npos; - }); - auto label = "\\nsubgraph=" + std::to_string(i) + "\\n" - + "device=" + queryNetworkResult.supportedLayersMap.at(node.get_friendly_name()) + '\"'; + attributes.push_back(std::string{"fillcolor="} + colors[i % colors.size()] + + " style=filled"); + auto itLabel = + std::find_if(std::begin(attributes), std::end(attributes), [](const std::string& str) { + return str.find("label") != std::string::npos; + }); + auto label = "\\nsubgraph=" + std::to_string(i) + "\\n" + "device=" + + queryNetworkResult.supportedLayersMap.at(node.get_friendly_name()) + '\"'; IE_ASSERT(itLabel != attributes.end()); itLabel->pop_back(); (*itLabel) += label; } } } - }}.run_on_function(ngraph::clone_function(*function)); + }} + .run_on_function(ngraph::clone_function(*function)); } for (auto&& network : _networks) { auto metaDevices = _heteroPlugin->GetDevicePlugins(network._device, _config); metaDevices[network._device].emplace(CONFIG_KEY_INTERNAL(FORCE_DISABLE_CACHE), ""); network._network = _heteroPlugin->GetCore()->LoadNetwork(network._clonedNetwork, - network._device, metaDevices[network._device]); + network._device, + metaDevices[network._device]); } } -HeteroExecutableNetwork::HeteroExecutableNetwork(std::istream& heteroModel, - const std::map& configs, - Engine* heteroPlugin) : - _heteroPlugin(heteroPlugin) { +HeteroExecutableNetwork::HeteroExecutableNetwork(std::istream& heteroModel, + const std::map& configs, + Engine* heteroPlugin) + : _heteroPlugin(heteroPlugin) { std::string heteroXmlStr; std::getline(heteroModel, heteroXmlStr); @@ -498,24 +513,20 @@ HeteroExecutableNetwork::HeteroExecutableNetwork(std::istream& std::unordered_set networkInputs; pugi::xml_node inputsNode = heteroNode.child("inputs"); - FOREACH_CHILD(inputNode, inputsNode, "input") { - networkInputs.insert(GetStrAttr(inputNode, "name")); - } + FOREACH_CHILD (inputNode, inputsNode, "input") { networkInputs.insert(GetStrAttr(inputNode, "name")); } std::unordered_set networkOutputs; pugi::xml_node outputsNode = heteroNode.child("outputs"); - FOREACH_CHILD(outputNode, outputsNode, "output") { - networkOutputs.insert(GetStrAttr(outputNode, "name")); - } + FOREACH_CHILD (outputNode, outputsNode, "output") { networkOutputs.insert(GetStrAttr(outputNode, "name")); } Engine::Configs importedConfigs; auto configsNode = heteroNode.child("configs"); - FOREACH_CHILD(configNode, configsNode, "config") { + FOREACH_CHILD (configNode, configsNode, "config") { importedConfigs.emplace(GetStrAttr(configNode, "key"), GetStrAttr(configNode, "value")); } auto blobNamesNode = heteroNode.child("blob_names_map"); - FOREACH_CHILD(blobNameNode, blobNamesNode, "blob_name_map") { + FOREACH_CHILD (blobNameNode, blobNamesNode, "blob_name_map") { _blobNameMap.emplace(GetStrAttr(blobNameNode, "key"), GetStrAttr(blobNameNode, "value")); } @@ -525,7 +536,7 @@ HeteroExecutableNetwork::HeteroExecutableNetwork(std::istream& std::vector descs; pugi::xml_node subnetworksNode = heteroNode.child("subnetworks"); - FOREACH_CHILD(subnetworkNode, subnetworksNode, "subnetwork") { + FOREACH_CHILD (subnetworkNode, subnetworksNode, "subnetwork") { auto deviceName = GetStrAttr(subnetworkNode, "device"); auto metaDevices = _heteroPlugin->GetDevicePlugins(deviceName, importedConfigs); @@ -560,14 +571,14 @@ HeteroExecutableNetwork::HeteroExecutableNetwork(std::istream& cnnnetwork = _heteroPlugin->GetCore()->ReadNetwork(xmlString, std::move(dataBlob)); auto inputs = cnnnetwork.getInputsInfo(); auto inputsNode = subnetworkNode.child("inputs"); - FOREACH_CHILD(inputNode, inputsNode, "input") { + FOREACH_CHILD (inputNode, inputsNode, "input") { auto inputName = GetStrAttr(inputNode, "name"); inputs[inputName]->setPrecision(Precision::FromStr(GetStrAttr(inputNode, "precision"))); } auto outputs = cnnnetwork.getOutputsInfo(); auto outputsNode = subnetworkNode.child("outputs"); - FOREACH_CHILD(outputNode, outputsNode, "output") { + FOREACH_CHILD (outputNode, outputsNode, "output") { auto outputName = GetStrAttr(outputNode, "name"); outputs[outputName]->setPrecision(Precision::FromStr(GetStrAttr(outputNode, "precision"))); } @@ -596,21 +607,19 @@ HeteroExecutableNetwork::HeteroExecutableNetwork(std::istream& }); } - const auto parseNode = [] (const pugi::xml_node & xml_node, bool is_param) -> - std::shared_ptr { + const auto parseNode = [](const pugi::xml_node& xml_node, bool is_param) -> std::shared_ptr { const std::string operation_name = GetStrAttr(xml_node, "operation_name"); - const auto elementType = - ov::EnumNames::as_enum(GetStrAttr(xml_node, "element_type")); + const auto elementType = ov::EnumNames::as_enum(GetStrAttr(xml_node, "element_type")); std::vector partialShape; pugi::xml_node partialShapeNode = xml_node.child("partial_shape"); - FOREACH_CHILD(dimNode, partialShapeNode, "dim") { + FOREACH_CHILD (dimNode, partialShapeNode, "dim") { partialShape.emplace_back(ov::Dimension(GetInt64Attr(dimNode, "value"))); } pugi::xml_node tensorNamesNode = xml_node.child("tensor_names"); std::unordered_set tensorNames; - FOREACH_CHILD(tensorNameNode, tensorNamesNode, "tensor_name") { + FOREACH_CHILD (tensorNameNode, tensorNamesNode, "tensor_name") { tensorNames.insert(GetStrAttr(tensorNameNode, "value")); } @@ -625,14 +634,12 @@ HeteroExecutableNetwork::HeteroExecutableNetwork(std::istream& (void)parseNode; pugi::xml_node parametersNode = heteroNode.child("parameters"); - FOREACH_CHILD(parameterNode, parametersNode, "parameter") { + FOREACH_CHILD (parameterNode, parametersNode, "parameter") { _parameters.emplace_back(parseNode(parameterNode, true)); } pugi::xml_node resultsNode = heteroNode.child("results"); - FOREACH_CHILD(resultNode, resultsNode, "result") { - _results.emplace_back(parseNode(resultNode, false)); - } + FOREACH_CHILD (resultNode, resultsNode, "result") { _results.emplace_back(parseNode(resultNode, false)); } // save state this->_config = importedConfigs; @@ -657,28 +664,26 @@ void HeteroExecutableNetwork::Export(std::ostream& heteroModel) { outputsNode.append_child("output").append_attribute("name").set_value(networkInput.first.c_str()); } - const auto serializeNode = [&] (const std::shared_ptr& node, - pugi::xml_node & xml_node) { + const auto serializeNode = [&](const std::shared_ptr& node, pugi::xml_node& xml_node) { const bool is_result = ov::is_type(node); - const std::string name = is_result ? - ngraph::op::util::create_ie_output_name(node->input_value(0)) : - node->get_friendly_name(); + const std::string name = + is_result ? ngraph::op::util::create_ie_output_name(node->input_value(0)) : node->get_friendly_name(); xml_node.append_attribute("operation_name").set_value(name.c_str()); - xml_node.append_attribute("element_type").set_value( - node->get_output_element_type(0).get_type_name().c_str()); + xml_node.append_attribute("element_type").set_value(node->get_output_element_type(0).get_type_name().c_str()); - const auto & pShape = node->get_output_partial_shape(0); + const auto& pShape = node->get_output_partial_shape(0); OPENVINO_ASSERT(pShape.rank().is_static(), "Serialization of shapes with dynamic rank is not supported"); auto partialShapeNode = xml_node.append_child("partial_shape"); - for (auto && dim : node->get_output_partial_shape(0)) { + for (auto&& dim : node->get_output_partial_shape(0)) { if (dim.is_dynamic()) partialShapeNode.append_child("dim").append_attribute("value").set_value("-1"); else - partialShapeNode.append_child("dim").append_attribute("value").set_value(std::to_string(dim.get_length()).c_str()); + partialShapeNode.append_child("dim").append_attribute("value").set_value( + std::to_string(dim.get_length()).c_str()); } auto tensorNamesNode = xml_node.append_child("tensor_names"); - for (auto & tensorName : node->get_output_tensor(0).get_names()) { + for (auto& tensorName : node->get_output_tensor(0).get_names()) { tensorNamesNode.append_child("tensor_name").append_attribute("value").set_value(tensorName.c_str()); } }; @@ -753,8 +758,7 @@ void HeteroExecutableNetwork::Export(std::ostream& heteroModel) { // Note: custom ngraph extensions are not supported std::stringstream xmlFile, binFile; - ov::pass::Serialize serializer(xmlFile, binFile, - ov::pass::Serialize::Version::IR_V10); + ov::pass::Serialize serializer(xmlFile, binFile, ov::pass::Serialize::Version::IR_V10); serializer.run_on_function(subnet.getFunction()); auto m_constants = binFile.str(); @@ -784,15 +788,11 @@ IInferRequestInternal::Ptr HeteroExecutableNetwork::CreateInferRequestImpl( desc._profilingTask = openvino::itt::handle("Infer" + std::to_string(index++)); inferRequests.push_back(desc); } - return std::make_shared(inputs, - outputs, - inferRequests, - _blobNameMap); + return std::make_shared(inputs, outputs, inferRequests, _blobNameMap); } -IInferRequestInternal::Ptr HeteroExecutableNetwork::CreateInferRequestImpl( - InputsDataMap networkInputs, - OutputsDataMap networkOutputs) { +IInferRequestInternal::Ptr HeteroExecutableNetwork::CreateInferRequestImpl(InputsDataMap networkInputs, + OutputsDataMap networkOutputs) { HeteroInferRequest::SubRequestsList inferRequests; int index = 0; for (auto&& subnetwork : _networks) { @@ -801,17 +801,14 @@ IInferRequestInternal::Ptr HeteroExecutableNetwork::CreateInferRequestImpl( desc._profilingTask = openvino::itt::handle("Infer" + std::to_string(index++)); inferRequests.push_back(desc); } - return std::make_shared(networkInputs, - networkOutputs, - inferRequests, - _blobNameMap); + return std::make_shared(networkInputs, networkOutputs, inferRequests, _blobNameMap); } IInferRequestInternal::Ptr HeteroExecutableNetwork::CreateInferRequest() { return CreateAsyncInferRequestFromSync(); } -InferenceEngine::Parameter HeteroExecutableNetwork::GetConfig(const std::string &name) const { +InferenceEngine::Parameter HeteroExecutableNetwork::GetConfig(const std::string& name) const { InferenceEngine::Parameter result; if (name == "TARGET_FALLBACK") { auto it = _config.find(name); @@ -820,8 +817,7 @@ InferenceEngine::Parameter HeteroExecutableNetwork::GetConfig(const std::string } else { result = std::string{}; } - } else if (name == HETERO_CONFIG_KEY(DUMP_GRAPH_DOT) || - name == CONFIG_KEY(EXCLUSIVE_ASYNC_REQUESTS)) { + } else if (name == HETERO_CONFIG_KEY(DUMP_GRAPH_DOT) || name == CONFIG_KEY(EXCLUSIVE_ASYNC_REQUESTS)) { auto it = _config.find(name); IE_ASSERT(it != _config.end()); result = it->second == YES ? true : false; @@ -830,7 +826,7 @@ InferenceEngine::Parameter HeteroExecutableNetwork::GetConfig(const std::string for (auto&& desc : _networks) { auto execNetwork = desc._network; auto param = execNetwork->GetMetric(METRIC_KEY(SUPPORTED_CONFIG_KEYS)); - for (auto && configKey : param.as>()) { + for (auto&& configKey : param.as>()) { if (configKey == name) { return execNetwork->GetConfig(configKey); } @@ -847,16 +843,14 @@ using Metrics = std::map; namespace { -void collectPluginMetrics(std::vector & baseMetrics, - const std::vector<::Metrics> pluginMetrics) { +void collectPluginMetrics(std::vector& baseMetrics, const std::vector<::Metrics> pluginMetrics) { // check whether the metric has unique name and value among all the plugins - auto isMetricValueUnique = [&](const std::string & key, - const Parameter & value) -> bool { - if (std::find(baseMetrics.begin(), baseMetrics.end(), key) != baseMetrics.end()) + auto isMetricValueUnique = [&](const std::string& key, const Parameter& value) -> bool { + if (std::find(baseMetrics.begin(), baseMetrics.end(), key) != baseMetrics.end()) return false; - for (auto && metrics : pluginMetrics) { - for (auto && metric : metrics) + for (auto&& metrics : pluginMetrics) { + for (auto&& metric : metrics) if (key == metric.first && value != metric.second) return false; } @@ -866,8 +860,8 @@ void collectPluginMetrics(std::vector & baseMetrics, // collect only unique metrics std::vector uniqueMetrics; - for (auto && metrics : pluginMetrics) { - for (auto && metric : metrics) { + for (auto&& metrics : pluginMetrics) { + for (auto&& metric : metrics) { if (isMetricValueUnique(metric.first, metric.second)) { uniqueMetrics.push_back(metric.first); } @@ -880,14 +874,12 @@ void collectPluginMetrics(std::vector & baseMetrics, } // namespace -InferenceEngine::Parameter HeteroExecutableNetwork::GetMetric(const std::string &name) const { +InferenceEngine::Parameter HeteroExecutableNetwork::GetMetric(const std::string& name) const { if (EXEC_NETWORK_METRIC_KEY(SUPPORTED_METRICS) == name) { - std::vector heteroMetrics = { - METRIC_KEY(NETWORK_NAME), - METRIC_KEY(SUPPORTED_METRICS), - METRIC_KEY(SUPPORTED_CONFIG_KEYS), - METRIC_KEY(OPTIMAL_NUMBER_OF_INFER_REQUESTS) - }; + std::vector heteroMetrics = {METRIC_KEY(NETWORK_NAME), + METRIC_KEY(SUPPORTED_METRICS), + METRIC_KEY(SUPPORTED_CONFIG_KEYS), + METRIC_KEY(OPTIMAL_NUMBER_OF_INFER_REQUESTS)}; { std::vector<::Metrics> pluginMetrics; @@ -895,7 +887,7 @@ InferenceEngine::Parameter HeteroExecutableNetwork::GetMetric(const std::string auto execNetwork = desc._network; auto param = execNetwork->GetMetric(METRIC_KEY(SUPPORTED_METRICS)); ::Metrics metrics; - for (auto && metricName : param.as>()) { + for (auto&& metricName : param.as>()) { metrics[metricName] = execNetwork->GetMetric(metricName); } pluginMetrics.push_back(std::move(metrics)); @@ -906,11 +898,9 @@ InferenceEngine::Parameter HeteroExecutableNetwork::GetMetric(const std::string IE_SET_METRIC_RETURN(SUPPORTED_METRICS, heteroMetrics); } else if (EXEC_NETWORK_METRIC_KEY(SUPPORTED_CONFIG_KEYS) == name) { - std::vector heteroConfigKeys = { - "TARGET_FALLBACK", - HETERO_CONFIG_KEY(DUMP_GRAPH_DOT), - CONFIG_KEY(EXCLUSIVE_ASYNC_REQUESTS) - }; + std::vector heteroConfigKeys = {"TARGET_FALLBACK", + HETERO_CONFIG_KEY(DUMP_GRAPH_DOT), + CONFIG_KEY(EXCLUSIVE_ASYNC_REQUESTS)}; { std::vector<::Metrics> pluginConfigKeys; @@ -918,7 +908,7 @@ InferenceEngine::Parameter HeteroExecutableNetwork::GetMetric(const std::string auto execNetwork = desc._network; auto param = execNetwork->GetMetric(METRIC_KEY(SUPPORTED_CONFIG_KEYS)); ::Metrics configKeys; - for (auto && metricName : param.as>()) { + for (auto&& metricName : param.as>()) { configKeys[metricName] = execNetwork->GetConfig(metricName); } pluginConfigKeys.push_back(std::move(configKeys)); @@ -933,7 +923,8 @@ InferenceEngine::Parameter HeteroExecutableNetwork::GetMetric(const std::string } else if (EXEC_NETWORK_METRIC_KEY(OPTIMAL_NUMBER_OF_INFER_REQUESTS) == name) { unsigned int value = 0u; for (auto&& desc : _networks) { - value = std::max(value, desc._network->GetMetric(METRIC_KEY(OPTIMAL_NUMBER_OF_INFER_REQUESTS)).as()); + value = std::max(value, + desc._network->GetMetric(METRIC_KEY(OPTIMAL_NUMBER_OF_INFER_REQUESTS)).as()); } IE_SET_METRIC_RETURN(OPTIMAL_NUMBER_OF_INFER_REQUESTS, value); } else { @@ -941,7 +932,7 @@ InferenceEngine::Parameter HeteroExecutableNetwork::GetMetric(const std::string for (auto&& desc : _networks) { auto execNetwork = desc._network; auto param = execNetwork->GetMetric(METRIC_KEY(SUPPORTED_METRICS)); - for (auto && metricKey : param.as>()) { + for (auto&& metricKey : param.as>()) { if (metricKey == name) { return execNetwork->GetMetric(metricKey); } diff --git a/src/plugins/hetero/executable_network.hpp b/src/plugins/hetero/executable_network.hpp new file mode 100644 index 00000000000..db8c3efb59f --- /dev/null +++ b/src/plugins/hetero/executable_network.hpp @@ -0,0 +1,82 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +/** + * @brief a header file for ExecutableNetwork + * @file executable_network.hpp + */ +#pragma once + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "async_infer_request.hpp" +#include "ie_icore.hpp" +#include "infer_request.hpp" + +namespace HeteroPlugin { + +class Engine; + +/** + * @class ExecutableNetwork + * @brief Interface of executable network + */ +class HeteroExecutableNetwork : public InferenceEngine::ExecutableNetworkThreadSafeDefault { +public: + typedef std::shared_ptr Ptr; + + /** + * @brief constructor + */ + HeteroExecutableNetwork(const InferenceEngine::CNNNetwork& network, + const std::map& config, + Engine* plugin); + /** + * @brief Import from opened file constructor + */ + HeteroExecutableNetwork(std::istream& heteroModel, + const std::map& config, + Engine* plugin); + + InferenceEngine::IInferRequestInternal::Ptr CreateInferRequestImpl( + InferenceEngine::InputsDataMap networkInputs, + InferenceEngine::OutputsDataMap networkOutputs) override; + InferenceEngine::IInferRequestInternal::Ptr CreateInferRequestImpl( + const std::vector>& inputs, + const std::vector>& outputs) override; + + InferenceEngine::IInferRequestInternal::Ptr CreateInferRequest() override; + + InferenceEngine::Parameter GetConfig(const std::string& name) const override; + + InferenceEngine::Parameter GetMetric(const std::string& name) const override; + + void Export(std::ostream& modelFile) override; + +private: + void InitCNNImpl(const InferenceEngine::CNNNetwork& network); + void InitNgraph(const InferenceEngine::CNNNetwork& network); + + struct NetworkDesc { + std::string _device; + InferenceEngine::CNNNetwork _clonedNetwork; + InferenceEngine::SoExecutableNetworkInternal _network; + }; + + std::vector _networks; + Engine* _heteroPlugin; + std::string _name; + std::map _config; + std::unordered_map _blobNameMap; +}; + +} // namespace HeteroPlugin diff --git a/inference-engine/src/hetero_plugin/hetero_infer_request.cpp b/src/plugins/hetero/infer_request.cpp similarity index 77% rename from inference-engine/src/hetero_plugin/hetero_infer_request.cpp rename to src/plugins/hetero/infer_request.cpp index df8490df742..13a90b7e749 100644 --- a/inference-engine/src/hetero_plugin/hetero_infer_request.cpp +++ b/src/plugins/hetero/infer_request.cpp @@ -2,40 +2,45 @@ // SPDX-License-Identifier: Apache-2.0 // -#include "hetero_infer_request.hpp" -#include "hetero_itt.hpp" +#include "infer_request.hpp" + #include -#include #include -#include + #include +#include +#include #include #include +#include "itt.hpp" + using namespace HeteroPlugin; using namespace InferenceEngine; using namespace InferenceEngine::details; -HeteroInferRequest::HeteroInferRequest(const std::vector>& inputs, - const std::vector>& outputs, - const SubRequestsList& inferRequests, - const std::unordered_map& subgraphInputToOutputBlobNames) : - IInferRequestInternal(inputs, outputs), - _inferRequests(inferRequests) { +HeteroInferRequest::HeteroInferRequest( + const std::vector>& inputs, + const std::vector>& outputs, + const SubRequestsList& inferRequests, + const std::unordered_map& subgraphInputToOutputBlobNames) + : IInferRequestInternal(inputs, outputs), + _inferRequests(inferRequests) { CreateInferRequest(subgraphInputToOutputBlobNames); } - -HeteroInferRequest::HeteroInferRequest(InferenceEngine::InputsDataMap networkInputs, - InferenceEngine::OutputsDataMap networkOutputs, - const SubRequestsList& inferRequests, - const std::unordered_map& subgraphInputToOutputBlobNames) : - IInferRequestInternal(networkInputs, networkOutputs), - _inferRequests(inferRequests) { +HeteroInferRequest::HeteroInferRequest( + InferenceEngine::InputsDataMap networkInputs, + InferenceEngine::OutputsDataMap networkOutputs, + const SubRequestsList& inferRequests, + const std::unordered_map& subgraphInputToOutputBlobNames) + : IInferRequestInternal(networkInputs, networkOutputs), + _inferRequests(inferRequests) { CreateInferRequest(subgraphInputToOutputBlobNames); } -void HeteroInferRequest::CreateInferRequest(const std::unordered_map& subgraphInputToOutputBlobNames) { +void HeteroInferRequest::CreateInferRequest( + const std::unordered_map& subgraphInputToOutputBlobNames) { if (_networkOutputs.empty() || _networkInputs.empty()) { IE_THROW() << "Internal error: no information about network's output/input"; } @@ -112,9 +117,9 @@ const InferenceEngine::PreProcessInfo& HeteroInferRequest::GetPreProcess(const s } void HeteroInferRequest::InferImpl() { - for (auto &&desc : _inferRequests) { + for (auto&& desc : _inferRequests) { OV_ITT_SCOPED_TASK(itt::domains::HeteroPlugin, desc._profilingTask); - auto &r = desc._request; + auto& r = desc._request; assert(r); r->Infer(); } @@ -124,7 +129,7 @@ std::map HeteroInferRequest::GetPerform std::map perfMap; for (size_t i = 0; i < _inferRequests.size(); i++) { auto perfMapRequest = _inferRequests[i]._request->GetPerformanceCounts(); - for (auto &&r : perfMapRequest) { + for (auto&& r : perfMapRequest) { perfMap[std::string("subgraph") + std::to_string(i) + ": " + r.first] = r.second; } } diff --git a/inference-engine/src/hetero_plugin/hetero_infer_request.hpp b/src/plugins/hetero/infer_request.hpp similarity index 82% rename from inference-engine/src/hetero_plugin/hetero_infer_request.hpp rename to src/plugins/hetero/infer_request.hpp index 0d141231f33..fc08e786bd0 100644 --- a/inference-engine/src/hetero_plugin/hetero_infer_request.hpp +++ b/src/plugins/hetero/infer_request.hpp @@ -4,15 +4,16 @@ #pragma once -#include -#include -#include -#include -#include #include -#include + #include +#include +#include +#include #include +#include +#include +#include namespace HeteroPlugin { @@ -21,20 +22,20 @@ public: typedef std::shared_ptr Ptr; struct SubRequestDesc { - InferenceEngine::SoExecutableNetworkInternal _network; - InferenceEngine::SoIInferRequestInternal _request; - openvino::itt::handle_t _profilingTask; + InferenceEngine::SoExecutableNetworkInternal _network; + InferenceEngine::SoIInferRequestInternal _request; + openvino::itt::handle_t _profilingTask; }; using SubRequestsList = std::vector; HeteroInferRequest(InferenceEngine::InputsDataMap networkInputs, InferenceEngine::OutputsDataMap networkOutputs, - const SubRequestsList &inferRequests, + const SubRequestsList& inferRequests, const std::unordered_map& blobNameMap); HeteroInferRequest(const std::vector>& networkInputs, const std::vector>& networkOutputs, - const SubRequestsList &inferRequests, + const SubRequestsList& inferRequests, const std::unordered_map& blobNameMap); void InferImpl() override; @@ -52,12 +53,11 @@ public: std::map GetPerformanceCounts() const override; SubRequestsList _inferRequests; - std::map _blobs; - std::map _subRequestFromBlobName; + std::map _blobs; + std::map _subRequestFromBlobName; private: void CreateInferRequest(const std::unordered_map& subgraphInputToOutputBlobNames); }; } // namespace HeteroPlugin - diff --git a/inference-engine/src/hetero_plugin/hetero_itt.hpp b/src/plugins/hetero/itt.hpp similarity index 72% rename from inference-engine/src/hetero_plugin/hetero_itt.hpp rename to src/plugins/hetero/itt.hpp index f14541b380a..68ad91551ec 100644 --- a/inference-engine/src/hetero_plugin/hetero_itt.hpp +++ b/src/plugins/hetero/itt.hpp @@ -4,7 +4,7 @@ /** * @brief Defines openvino domains for tracing - * @file hetero_itt.hpp + * @file itt.hpp */ #pragma once @@ -14,7 +14,7 @@ namespace HeteroPlugin { namespace itt { namespace domains { - OV_ITT_DOMAIN(HeteroPlugin); -} -} +OV_ITT_DOMAIN(HeteroPlugin); } +} // namespace itt +} // namespace HeteroPlugin diff --git a/inference-engine/src/hetero_plugin/hetero_plugin.cpp b/src/plugins/hetero/plugin.cpp similarity index 78% rename from inference-engine/src/hetero_plugin/hetero_plugin.cpp rename to src/plugins/hetero/plugin.cpp index 6b376b93f6a..8ff68515290 100644 --- a/inference-engine/src/hetero_plugin/hetero_plugin.cpp +++ b/src/plugins/hetero/plugin.cpp @@ -2,8 +2,9 @@ // SPDX-License-Identifier: Apache-2.0 // +// clang-format off #include "ie_metric_helpers.hpp" -#include "hetero_plugin.hpp" +#include "plugin.hpp" #include #include #include @@ -12,8 +13,9 @@ #include #include #include "ie_plugin_config.hpp" -#include "hetero_executable_network.hpp" +#include "executable_network.hpp" #include +// clang-format on using namespace InferenceEngine; using namespace InferenceEngine::PluginConfigParams; @@ -28,18 +30,17 @@ Engine::Engine() { namespace { -Engine::Configs mergeConfigs(Engine::Configs config, const Engine::Configs & local) { - for (auto && kvp : local) { +Engine::Configs mergeConfigs(Engine::Configs config, const Engine::Configs& local) { + for (auto&& kvp : local) { config[kvp.first] = kvp.second; } return config; } -const std::vector & getSupportedConfigKeys() { - static const std::vector supported_configKeys = { - HETERO_CONFIG_KEY(DUMP_GRAPH_DOT), - "TARGET_FALLBACK", - CONFIG_KEY(EXCLUSIVE_ASYNC_REQUESTS) }; +const std::vector& getSupportedConfigKeys() { + static const std::vector supported_configKeys = {HETERO_CONFIG_KEY(DUMP_GRAPH_DOT), + "TARGET_FALLBACK", + CONFIG_KEY(EXCLUSIVE_ASYNC_REQUESTS)}; return supported_configKeys; } @@ -47,7 +48,7 @@ const std::vector & getSupportedConfigKeys() { } // namespace InferenceEngine::IExecutableNetworkInternal::Ptr Engine::LoadExeNetworkImpl(const InferenceEngine::CNNNetwork& network, - const Configs& config) { + const Configs& config) { if (GetCore() == nullptr) { IE_THROW() << "Please, work with HETERO device via InferencEngine::Core object"; } @@ -66,11 +67,13 @@ InferenceEngine::IExecutableNetworkInternal::Ptr Engine::LoadExeNetworkImpl(cons return std::make_shared(network, mergeConfigs(_config, config), this); } -InferenceEngine::IExecutableNetworkInternal::Ptr Engine::ImportNetwork(std::istream& heteroModel, const std::map& config) { +InferenceEngine::IExecutableNetworkInternal::Ptr Engine::ImportNetwork( + std::istream& heteroModel, + const std::map& config) { return std::make_shared(heteroModel, mergeConfigs(_config, config), this); } -Engine::Configs Engine::GetSupportedConfig(const Engine::Configs& config, const std::string & deviceName) const { +Engine::Configs Engine::GetSupportedConfig(const Engine::Configs& config, const std::string& deviceName) const { std::vector supportedConfigKeys = GetCore()->GetMetric(deviceName, METRIC_KEY(SUPPORTED_CONFIG_KEYS)); Engine::Configs supportedConfig; for (auto&& key : supportedConfigKeys) { @@ -83,8 +86,8 @@ Engine::Configs Engine::GetSupportedConfig(const Engine::Configs& config, const } Engine::DeviceMetaInformationMap Engine::GetDevicePlugins(const std::string& targetFallback, - const Configs & localConfig) const { - auto getDeviceConfig = [&](const std::string & deviceWithID) { + const Configs& localConfig) const { + auto getDeviceConfig = [&](const std::string& deviceWithID) { DeviceIDParser deviceParser(deviceWithID); std::string deviceName = deviceParser.getDeviceName(); Configs tconfig = mergeConfigs(_config, localConfig); @@ -109,10 +112,10 @@ Engine::DeviceMetaInformationMap Engine::GetDevicePlugins(const std::string& tar return metaDevices; } -void Engine::SetConfig(const Configs &configs) { - for (auto && kvp : configs) { +void Engine::SetConfig(const Configs& configs) { + for (auto&& kvp : configs) { const auto& name = kvp.first; - const auto & supported_configKeys = getSupportedConfigKeys(); + const auto& supported_configKeys = getSupportedConfigKeys(); if (supported_configKeys.end() != std::find(supported_configKeys.begin(), supported_configKeys.end(), name)) _config[name] = kvp.second; else @@ -120,7 +123,7 @@ void Engine::SetConfig(const Configs &configs) { } } -QueryNetworkResult Engine::QueryNetwork(const CNNNetwork &network, const Configs& config) const { +QueryNetworkResult Engine::QueryNetwork(const CNNNetwork& network, const Configs& config) const { QueryNetworkResult qr; if (GetCore() == nullptr) { @@ -164,12 +167,12 @@ QueryNetworkResult Engine::QueryNetwork(const CNNNetwork &network, const Configs Parameter Engine::GetMetric(const std::string& name, const std::map& options) const { if (METRIC_KEY(SUPPORTED_METRICS) == name) { - IE_SET_METRIC_RETURN(SUPPORTED_METRICS, std::vector{ - METRIC_KEY(SUPPORTED_METRICS), - METRIC_KEY(FULL_DEVICE_NAME), - METRIC_KEY(SUPPORTED_CONFIG_KEYS), - METRIC_KEY(DEVICE_ARCHITECTURE), - METRIC_KEY(IMPORT_EXPORT_SUPPORT)}); + IE_SET_METRIC_RETURN(SUPPORTED_METRICS, + std::vector{METRIC_KEY(SUPPORTED_METRICS), + METRIC_KEY(FULL_DEVICE_NAME), + METRIC_KEY(SUPPORTED_CONFIG_KEYS), + METRIC_KEY(DEVICE_ARCHITECTURE), + METRIC_KEY(IMPORT_EXPORT_SUPPORT)}); } else if (METRIC_KEY(SUPPORTED_CONFIG_KEYS) == name) { IE_SET_METRIC_RETURN(SUPPORTED_CONFIG_KEYS, getSupportedConfigKeys()); } else if (METRIC_KEY(FULL_DEVICE_NAME) == name) { @@ -195,29 +198,29 @@ std::string Engine::DeviceArchitecture(const std::string& targetFallback) const for (const auto& device : fallbackDevices) { InferenceEngine::DeviceIDParser parser(device); - std::vector supportedMetricKeys = GetCore()->GetMetric( - parser.getDeviceName(), METRIC_KEY(SUPPORTED_METRICS)); - auto it = std::find(supportedMetricKeys.begin(), supportedMetricKeys.end(), - METRIC_KEY(DEVICE_ARCHITECTURE)); - auto arch = (it != supportedMetricKeys.end()) ? - GetCore()->GetMetric(device, METRIC_KEY(DEVICE_ARCHITECTURE)).as() : parser.getDeviceName(); + std::vector supportedMetricKeys = + GetCore()->GetMetric(parser.getDeviceName(), METRIC_KEY(SUPPORTED_METRICS)); + auto it = std::find(supportedMetricKeys.begin(), supportedMetricKeys.end(), METRIC_KEY(DEVICE_ARCHITECTURE)); + auto arch = (it != supportedMetricKeys.end()) + ? GetCore()->GetMetric(device, METRIC_KEY(DEVICE_ARCHITECTURE)).as() + : parser.getDeviceName(); resArch += " " + arch; } return resArch; } -Parameter Engine::GetConfig(const std::string& name, const std::map & /*options*/) const { +Parameter Engine::GetConfig(const std::string& name, const std::map& /*options*/) const { if (name == HETERO_CONFIG_KEY(DUMP_GRAPH_DOT)) { auto it = _config.find(HETERO_CONFIG_KEY(DUMP_GRAPH_DOT)); IE_ASSERT(it != _config.end()); bool dump = it->second == YES; - return { dump }; + return {dump}; } else if (name == "TARGET_FALLBACK") { auto it = _config.find("TARGET_FALLBACK"); if (it == _config.end()) { IE_THROW() << "Value for TARGET_FALLBACK is not set"; } else { - return { it->second }; + return {it->second}; } } else { IE_THROW() << "Unsupported config key: " << name; @@ -225,9 +228,9 @@ Parameter Engine::GetConfig(const std::string& name, const std::map #include #include -#include #include -#include #include +#include + +#include "cpp_interfaces/interface/ie_iplugin_internal.hpp" +#include "description_buffer.hpp" +#include "ie_icore.hpp" namespace HeteroPlugin { @@ -23,28 +24,30 @@ public: Engine(); - InferenceEngine::IExecutableNetworkInternal::Ptr - LoadExeNetworkImpl(const InferenceEngine::CNNNetwork &network, const Configs &config) override; + InferenceEngine::IExecutableNetworkInternal::Ptr LoadExeNetworkImpl(const InferenceEngine::CNNNetwork& network, + const Configs& config) override; - void SetConfig(const Configs &config) override; + void SetConfig(const Configs& config) override; - InferenceEngine::QueryNetworkResult QueryNetwork(const InferenceEngine::CNNNetwork &network, + InferenceEngine::QueryNetworkResult QueryNetwork(const InferenceEngine::CNNNetwork& network, const Configs& config) const override; - InferenceEngine::Parameter GetMetric(const std::string& name, const std::map & options) const override; + InferenceEngine::Parameter GetMetric( + const std::string& name, + const std::map& options) const override; - InferenceEngine::Parameter GetConfig(const std::string& name, const std::map & options) const override; + InferenceEngine::Parameter GetConfig( + const std::string& name, + const std::map& options) const override; - InferenceEngine::IExecutableNetworkInternal::Ptr - ImportNetwork(std::istream& heteroModel, const std::map& config) override; + InferenceEngine::IExecutableNetworkInternal::Ptr ImportNetwork( + std::istream& heteroModel, + const std::map& config) override; - DeviceMetaInformationMap GetDevicePlugins(const std::string& targetFallback, - const Configs & localConfig) const; + DeviceMetaInformationMap GetDevicePlugins(const std::string& targetFallback, const Configs& localConfig) const; private: - Configs GetSupportedConfig(const Configs& config, const std::string & deviceName) const; + Configs GetSupportedConfig(const Configs& config, const std::string& deviceName) const; std::string DeviceArchitecture(const std::string& targetFallback) const; }; } // namespace HeteroPlugin diff --git a/tests/fuzz/CMakeLists.txt b/tests/fuzz/CMakeLists.txt index a5f46c5a07e..b0fbdf5cbe0 100644 --- a/tests/fuzz/CMakeLists.txt +++ b/tests/fuzz/CMakeLists.txt @@ -6,10 +6,8 @@ project(openvino_fuzzing) cmake_minimum_required(VERSION 3.13) -if (CMAKE_BUILD_TYPE STREQUAL "") - message(STATUS "CMAKE_BUILD_TYPE not defined, 'Release' will be used") - set(CMAKE_BUILD_TYPE "Release") -endif() +set(CMAKE_BUILD_TYPE "Release" CACHE STRING "CMake build type") +set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Release" "Debug" "RelWithDebInfo" "MinSizeRel") set(OpenVINO_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../") diff --git a/tests/layer_tests/tensorflow_tests/test_tf_RandomUniform.py b/tests/layer_tests/tensorflow_tests/test_tf_RandomUniform.py index 347c092cddf..09e5185d3ba 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_RandomUniform.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_RandomUniform.py @@ -26,7 +26,7 @@ class TestTFRandomUniform(CommonTFLayerTest): x = tf.compat.v1.placeholder(input_type, tf_x_shape, 'Input') if global_seed is not None: tf.compat.v1.random.set_random_seed(global_seed) - random_uniform = tf.random.uniform(x_shape, seed=op_seed, dtype=input_type, minval=min_val, + random_uniform = tf.random.uniform(tf_x_shape, seed=op_seed, dtype=input_type, minval=min_val, maxval=max_val) + x tf.compat.v1.global_variables_initializer() @@ -80,6 +80,7 @@ class TestTFRandomUniform(CommonTFLayerTest): dict(global_seed=32465, op_seed=48971, min_val=0.0, max_val=1.0, x_shape=[3, 7], input_type=tf.float32), marks=pytest.mark.precommit), dict(global_seed=None, op_seed=56197, min_val=-100, max_val=100, x_shape=[6], input_type=tf.float32), + dict(global_seed=None, op_seed=56197, min_val=-100, max_val=100, x_shape=[1, 2, 1, 1], input_type=tf.float32), dict(global_seed=78132, op_seed=None, min_val=-200, max_val=-50, x_shape=[5, 8], input_type=tf.int32), dict(global_seed=4571, op_seed=48971, min_val=1.5, max_val=2.3, x_shape=[7], input_type=tf.float32), dict(global_seed=32465, op_seed=12335, min_val=-150, max_val=-100, x_shape=[18], input_type=tf.int32)] diff --git a/tests/layer_tests/tensorflow_tests/test_tf_ReverseV2.py b/tests/layer_tests/tensorflow_tests/test_tf_ReverseV2.py new file mode 100644 index 00000000000..ceb4b7ba34d --- /dev/null +++ b/tests/layer_tests/tensorflow_tests/test_tf_ReverseV2.py @@ -0,0 +1,56 @@ +# Copyright (C) 2018-2021 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +import pytest +import numpy as np + +from common.tf_layer_test_class import CommonTFLayerTest + + +class TestReverseV2Ops(CommonTFLayerTest): + def _prepare_input(self, inputs_dict): + for input in inputs_dict.keys(): + inputs_dict[input] = np.random.random(inputs_dict[input]) + return inputs_dict + + def create_reversev2_net(self, shape, keep_dims, axis, ir_version): + import tensorflow as tf + tf.compat.v1.reset_default_graph() + with tf.compat.v1.Session() as sess: + shapes = shape.copy() + if len(shapes) >= 4: + shapes.append(shapes.pop(1)) + + x = tf.compat.v1.placeholder(tf.float32, shapes, 'Input') + tf.compat.v1.reverse_v2(x, axis) + tf.compat.v1.global_variables_initializer() + tf_net = sess.graph_def + + return tf_net, None + + test_data = [] + test_data.extend([ + dict(shape=[5], axis=[0]), + dict(shape=[2, 3], axis=[1]), + dict(shape=[2, 3, 5], axis=[-2]), + dict(shape=[2, 3, 5, 7], axis=[0]), + ]) + + @pytest.mark.parametrize("params", test_data) + @pytest.mark.parametrize("keep_dims", [True, False]) + @pytest.mark.nightly + def test_reversev2(self, params, keep_dims, ie_device, precision, ir_version, temp_dir): + self._test(*self.create_reversev2_net(**params, keep_dims=keep_dims, ir_version=ir_version), + ie_device, precision, ir_version, temp_dir=temp_dir) + + test_data_pre_commit = [] + test_data_pre_commit.extend([dict(shape=[5], axis=[0]), + dict(shape=[2, 3, 5], axis=[-2]) + ]) + + @pytest.mark.parametrize("params", test_data_pre_commit) + @pytest.mark.parametrize("keep_dims", [True]) + @pytest.mark.precommit + def test_reversev2_precommit(self, params, keep_dims, ie_device, precision, ir_version, temp_dir): + self._test(*self.create_reversev2_net(**params, keep_dims=keep_dims, ir_version=ir_version), + ie_device, precision, ir_version, temp_dir=temp_dir) diff --git a/tests/memory_tests/CMakeLists.txt b/tests/memory_tests/CMakeLists.txt index d2ca2f7eccd..27700420b6c 100644 --- a/tests/memory_tests/CMakeLists.txt +++ b/tests/memory_tests/CMakeLists.txt @@ -11,7 +11,8 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") set (CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}") endif() -set (CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the build type") +set(CMAKE_BUILD_TYPE "Release" CACHE STRING "CMake build type") +set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Release" "Debug" "RelWithDebInfo" "MinSizeRel") project(memory_tests) diff --git a/tests/stress_tests/.automation/memcheck_tests/precommit_configs/desktop_references_config.xml b/tests/stress_tests/.automation/memcheck_tests/precommit_configs/desktop_references_config.xml index 05d67549066..4b054cd07bc 100644 --- a/tests/stress_tests/.automation/memcheck_tests/precommit_configs/desktop_references_config.xml +++ b/tests/stress_tests/.automation/memcheck_tests/precommit_configs/desktop_references_config.xml @@ -11,11 +11,11 @@ - + - + - + @@ -40,11 +40,11 @@ - + - + - + diff --git a/tests/stress_tests/CMakeLists.txt b/tests/stress_tests/CMakeLists.txt index a2c328b16c3..62b96f2f042 100644 --- a/tests/stress_tests/CMakeLists.txt +++ b/tests/stress_tests/CMakeLists.txt @@ -11,10 +11,8 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") set (CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}") endif() -if (CMAKE_BUILD_TYPE STREQUAL "") - message(STATUS "CMAKE_BUILD_TYPE not defined, 'Release' will be used") - set(CMAKE_BUILD_TYPE "Release") -endif() +set(CMAKE_BUILD_TYPE "Release" CACHE STRING "CMake build type") +set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Release" "Debug" "RelWithDebInfo" "MinSizeRel") # Define directory where artifacts will be placed set(OUTPUT_ROOT ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/thirdparty/CMakeLists.txt b/thirdparty/CMakeLists.txt index a913e797b27..8a4733aba8a 100644 --- a/thirdparty/CMakeLists.txt +++ b/thirdparty/CMakeLists.txt @@ -90,24 +90,26 @@ if(NGRAPH_PDPD_FRONTEND_ENABLE OR NGRAPH_ONNX_FRONTEND_ENABLE OR NGRAPH_TF_FRONT endif() find_package(Protobuf 3.9.0 REQUIRED) set(Protobuf_LITE_LIBRARIES protobuf::libprotobuf-lite) + set(Protobuf_LIBRARIES protobuf::libprotobuf) set(SYSTEM_PROTOC protobuf::protoc) set(PROTOC_EXECUTABLE ${SYSTEM_PROTOC}) - foreach(target ${SYSTEM_PROTOC} ${Protobuf_LITE_LIBRARIES}) + foreach(target ${SYSTEM_PROTOC} ${Protobuf_LIBRARIES} ${Protobuf_LITE_LIBRARIES}) set_property(TARGET ${target} PROPERTY IMPORTED_GLOBAL TRUE) endforeach() else() - add_subdirectory(protobuf) + add_subdirectory(protobuf EXCLUDE_FROM_ALL) endif() # forward variables used in the other places set(SYSTEM_PROTOC ${SYSTEM_PROTOC} PARENT_SCOPE) set(PROTOC_EXECUTABLE ${PROTOC_EXECUTABLE} PARENT_SCOPE) + set(Protobuf_LIBRARIES ${Protobuf_LIBRARIES} PARENT_SCOPE) set(Protobuf_LITE_LIBRARIES ${Protobuf_LITE_LIBRARIES} PARENT_SCOPE) set(Protobuf_INCLUDE_DIRS ${Protobuf_INCLUDE_DIRS} PARENT_SCOPE) # set public / interface compile options - foreach(target IN LISTS Protobuf_LITE_LIBRARIES) + foreach(target IN LISTS Protobuf_LITE_LIBRARIES Protobuf_LIBRARIES) set(link_type PUBLIC) if(NGRAPH_USE_SYSTEM_PROTOBUF) set(link_type INTERFACE) diff --git a/thirdparty/onnx/CMakeLists.txt b/thirdparty/onnx/CMakeLists.txt index 263802dd42f..0bafecc72c5 100644 --- a/thirdparty/onnx/CMakeLists.txt +++ b/thirdparty/onnx/CMakeLists.txt @@ -8,26 +8,51 @@ set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE OFF) set(NGRAPH_ONNX_NAMESPACE ngraph_onnx) -set(BUILD_SHARED_LIBS OFF) if(NOT DEFINED ONNX_USE_MSVC_STATIC_RUNTIME) set(ONNX_USE_MSVC_STATIC_RUNTIME OFF) endif() -macro(onnx_set_target_properties) - target_include_directories(onnx SYSTEM PRIVATE "${Protobuf_INCLUDE_DIRS}") - target_include_directories(onnx_proto SYSTEM PRIVATE "${Protobuf_INCLUDE_DIRS}") +if(FORCE_FRONTENDS_USE_PROTOBUF) + set(ONNX_USE_LITE_PROTO_DEFAULT OFF) +else() + set(ONNX_USE_LITE_PROTO_DEFAULT ON) +endif() - ov_disable_all_warnings(onnx onnx_proto) -endmacro() - -set(ONNX_USE_PROTOBUF_SHARED_LIBS ${BUILD_SHARED_LIBS} CACHE BOOL "Use dynamic protobuf by ONNX library" FORCE) +set(ONNX_USE_PROTOBUF_SHARED_LIBS CACHE BOOL "Use dynamic protobuf by ONNX library" FORCE) set(ONNX_NAMESPACE ${NGRAPH_ONNX_NAMESPACE}) -set(ONNX_USE_LITE_PROTO ON CACHE BOOL "Use protobuf lite for ONNX library" FORCE) +set(ONNX_USE_LITE_PROTO ${ONNX_USE_LITE_PROTO_DEFAULT} CACHE BOOL "Use protobuf lite for ONNX library" FORCE) set(ONNX_ML ON CACHE BOOL "Use ONNX ML" FORCE) if(CMAKE_CROSSCOMPILING) set(ONNX_CUSTOM_PROTOC_EXECUTABLE ${SYSTEM_PROTOC}) endif() -add_subdirectory(onnx EXCLUDE_FROM_ALL) -onnx_set_target_properties() +# build targets + +function(ov_onnx_build_static) + set(BUILD_SHARED_LIBS OFF) + add_subdirectory(onnx EXCLUDE_FROM_ALL) +endfunction() + +ov_onnx_build_static() + +target_include_directories(onnx SYSTEM PRIVATE "${Protobuf_INCLUDE_DIRS}") +target_include_directories(onnx_proto SYSTEM PRIVATE "${Protobuf_INCLUDE_DIRS}") + +ov_disable_all_warnings(onnx onnx_proto) + +# install + +ov_install_static_lib(onnx ngraph) +ov_install_static_lib(onnx_proto ngraph) + +# WA for ONNX: protobuf must be in the same export set of ONNX targets +if(NOT BUILD_SHARED_LIBS) + if(ONNX_USE_LITE_PROTO) + install(TARGETS ${Protobuf_LITE_LIBRARIES} EXPORT ONNXTargets + ARCHIVE DESTINATION ${IE_CPACK_ARCHIVE_PATH} COMPONENT ngraph) + else() + install(TARGETS ${Protobuf_LIBRARIES} EXPORT ONNXTargets + ARCHIVE DESTINATION ${IE_CPACK_ARCHIVE_PATH} COMPONENT ngraph) + endif() +endif() diff --git a/thirdparty/protobuf/CMakeLists.txt b/thirdparty/protobuf/CMakeLists.txt index 97cb66b5462..c3867073e83 100644 --- a/thirdparty/protobuf/CMakeLists.txt +++ b/thirdparty/protobuf/CMakeLists.txt @@ -16,9 +16,11 @@ if(OV_COMPILER_IS_CLANG) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-inconsistent-missing-override") endif() -set(protobuf_BUILD_TESTS OFF CACHE BOOL "Build tests") -set(protobuf_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS} CACHE BOOL "Build shared libs" FORCE) -set(protobuf_WITH_ZLIB OFF CACHE BOOL "Build with zlib support") +set(protobuf_VERBOSE ON) +set(protobuf_BUILD_TESTS OFF CACHE BOOL "Build tests" FORCE) +set(protobuf_BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared libs" FORCE) +set(protobuf_WITH_ZLIB OFF CACHE BOOL "Build with zlib support" FORCE) +set(protobuf_BUILD_CONFORMANCE OFF CACHE BOOL "" FORCE) # When we build dll libraries. These flags make sure onnx and protobuf build with /MD, not /MT. # These two options can't be mixed, because they requires link two imcompatiable runtime. @@ -77,7 +79,8 @@ if(CMAKE_CROSSCOMPILING AND NOT PROTOC_VERSION VERSION_EQUAL protobuf_VERSION) message(WARNING "system protobuf version does not match with the compiled one, please update system protobuf or submodule") endif() -# forward variables used in the other places +# set to parent scope + if(SYSTEM_PROTOC) set(SYSTEM_PROTOC ${SYSTEM_PROTOC} PARENT_SCOPE) set(PROTOC_EXECUTABLE ${SYSTEM_PROTOC} PARENT_SCOPE) @@ -87,4 +90,5 @@ endif() set(protobuf_VERSION ${protobuf_VERSION} PARENT_SCOPE) set(Protobuf_LITE_LIBRARIES libprotobuf-lite PARENT_SCOPE) +set(Protobuf_LIBRARIES libprotobuf PARENT_SCOPE) set(Protobuf_INCLUDE_DIRS ${Protobuf_INCLUDE_DIRS} PARENT_SCOPE) diff --git a/thirdparty/zlib/CMakeLists.txt b/thirdparty/zlib/CMakeLists.txt index d887e275611..9a24a5daff7 100644 --- a/thirdparty/zlib/CMakeLists.txt +++ b/thirdparty/zlib/CMakeLists.txt @@ -5,7 +5,8 @@ project(zlib) if(CMAKE_C_COMPILER_ID STREQUAL "MSVC") - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4996 /W3") + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4996 /W3") + set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /wd4995 /wd4996") else() set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-all") if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel") diff --git a/tools/deployment_manager/configs/darwin.json b/tools/deployment_manager/configs/darwin.json index 232d2f275c0..6efba1e28bb 100644 --- a/tools/deployment_manager/configs/darwin.json +++ b/tools/deployment_manager/configs/darwin.json @@ -20,7 +20,7 @@ "runtime/lib/intel64/libinference_engine_transformations.dylib", "runtime/lib/intel64/libinference_engine_preproc.so", "runtime/lib/intel64/libinference_engine_c_api.dylib", - "runtime/lib/intel64/libHeteroPlugin.so", + "runtime/lib/intel64/libov_hetero_plugin.so", "runtime/lib/intel64/libMultiDevicePlugin.so", "runtime/lib/intel64/libngraph.dylib", "runtime/lib/intel64/libfrontend_common.dylib", diff --git a/tools/deployment_manager/configs/linux.json b/tools/deployment_manager/configs/linux.json index 4e4c530919c..d05f2f5a8fa 100644 --- a/tools/deployment_manager/configs/linux.json +++ b/tools/deployment_manager/configs/linux.json @@ -26,7 +26,7 @@ "runtime/lib/intel64/libinference_engine_transformations.so", "runtime/lib/intel64/libinference_engine_preproc.so", "runtime/lib/intel64/libinference_engine_c_api.so", - "runtime/lib/intel64/libHeteroPlugin.so", + "runtime/lib/intel64/libov_hetero_plugin.so", "runtime/lib/intel64/libMultiDevicePlugin.so", "runtime/lib/intel64/libngraph.so", "runtime/lib/intel64/libfrontend_common.so", diff --git a/tools/deployment_manager/configs/windows.json b/tools/deployment_manager/configs/windows.json index cf1a64f04bb..e04ccd3094c 100644 --- a/tools/deployment_manager/configs/windows.json +++ b/tools/deployment_manager/configs/windows.json @@ -20,7 +20,7 @@ "runtime/bin/intel64/Release/inference_engine_transformations.dll", "runtime/bin/intel64/Release/inference_engine_preproc.dll", "runtime/bin/intel64/Release/inference_engine_c_api.dll", - "runtime/bin/intel64/Release/HeteroPlugin.dll", + "runtime/bin/intel64/Release/ov_hetero_plugin.dll", "runtime/bin/intel64/Release/MultiDevicePlugin.dll", "runtime/bin/intel64/Release/ngraph.dll", "runtime/bin/intel64/Release/frontend_common.dll", diff --git a/tools/pot/README_dev.md b/tools/pot/README_dev.md index b5ec6b69dd1..7c5d30ddb9f 100644 --- a/tools/pot/README_dev.md +++ b/tools/pot/README_dev.md @@ -30,7 +30,7 @@ Post-Training Optimization Tool includes standalone command-line tool and Python git submodule init git submodule update ``` -3) Clone DLDT repo: `git clone https://gitlab-icv.inn.intel.com/inference-engine/dldt` (Not into the post-training-compression-tool) +3) Clone DLDT repo: `git clone https://github.com/openvinotoolkit/openvino` (Not into the post-training-compression-tool) 4) Switch dldt to required branch: `feature/low_precision/develop_fp_v10` 5) Build inference engine (Instruction can be found in dldt repo) 6) Switch dldt to _mkaglins/poc_ branch (Inference engine is built from _feature/low_precision/develop_fp_v10_ branch to support `FakeQuantize` layers. ModelOptimizer is used from _mkaglins/poc_ branch. So stay on _mkaglins/poc_ branch as you've built IE and don't build it from there again) diff --git a/tools/pot/openvino/tools/pot/algorithms/algorithm.py b/tools/pot/openvino/tools/pot/algorithms/algorithm.py index 04305ddc193..4a8352c010e 100644 --- a/tools/pot/openvino/tools/pot/algorithms/algorithm.py +++ b/tools/pot/openvino/tools/pot/algorithms/algorithm.py @@ -4,6 +4,7 @@ from abc import ABC, abstractmethod from copy import deepcopy +from .utils import process_ignored_scope from ..api.engine import Engine @@ -23,6 +24,9 @@ class Algorithm(ABC): self.default_steps_size = 0.05 self.total_exec_steps = 0 + if isinstance(self._config.ignored, dict) and 'scope' in self._config.ignored: + self._config.ignored.scope = process_ignored_scope(self._config.ignored.scope) + @property def config(self): return self._config diff --git a/tools/pot/openvino/tools/pot/algorithms/finetuning/algorithm.py b/tools/pot/openvino/tools/pot/algorithms/finetuning/algorithm.py index 0f6ac6bc675..7ef3c6c3b53 100644 --- a/tools/pot/openvino/tools/pot/algorithms/finetuning/algorithm.py +++ b/tools/pot/openvino/tools/pot/algorithms/finetuning/algorithm.py @@ -125,7 +125,7 @@ class LayerwiseModelFinetuning(Algorithm): logger.warning('Undefined parameter found: {}'.format(name)) continue else: - logger.warning('Was not able to wrap layer {} with PyTorch'.format(op_node.name)) + logger.warning('Was not able to wrap layer {} with PyTorch'.format(op_node.fullname)) return wrapped_op, params def _fine_tuning_loop( @@ -285,7 +285,7 @@ class LayerwiseModelFinetuning(Algorithm): base_algo.register_statistics(self._original_model, self.algo_collector) collect_statistics(self._engine, self._original_model, [base_algo]) base_model = base_algo.run(deepcopy(self._original_model)) - output_node_name = nu.get_node_input(self._original_model.get_final_output_nodes()[0], 0).name + output_node_name = nu.get_node_input(self._original_model.get_final_output_nodes()[0], 0).fullname stats_layout = {output_node_name: {'output_logits': TensorStatistic(lambda logits: logits)}} metric_subset_size = int(self._dataset_size * self._metric_subset_ratio) @@ -344,9 +344,9 @@ class LayerwiseModelFinetuning(Algorithm): fp_model_callbacks[input_node_name] = {'output': lambda tensor: tensor} else: modified_model_callbacks[input_node_name] = {'output': lambda tensor: tensor} - fp_model_callbacks[output_node.name] = {'output': lambda tensor: tensor} + fp_model_callbacks[output_node.fullname] = {'output': lambda tensor: tensor} self._nodes_to_tune_input[op_name] = input_node_name - self._nodes_to_tune_output[op_name] = output_node.name + self._nodes_to_tune_output[op_name] = output_node.fullname return fp_model_callbacks, modified_model_callbacks diff --git a/tools/pot/openvino/tools/pot/algorithms/quantization/accuracy_aware_common/algorithm.py b/tools/pot/openvino/tools/pot/algorithms/quantization/accuracy_aware_common/algorithm.py index 17e0d5e504c..23978777c3d 100644 --- a/tools/pot/openvino/tools/pot/algorithms/quantization/accuracy_aware_common/algorithm.py +++ b/tools/pot/openvino/tools/pot/algorithms/quantization/accuracy_aware_common/algorithm.py @@ -9,7 +9,7 @@ from sys import maxsize import numpy as np from .utils import create_metric_config, is_preset_performance, \ - get_mixed_preset_config, evaluate_model, get_num_of_quantized_ops + get_mixed_preset_config, evaluate_model, get_num_of_quantized_ops, prepare_nodes_for_logger from ..utils import load_hardware_config from ...algorithm import Algorithm from ...algorithm_selector import COMPRESSION_ALGORITHMS @@ -356,7 +356,7 @@ class AccuracyAwareCommon(Algorithm): logger.debug('Changed FakeQuantize nodes:\n %s', '\n'.join(all_changed_nodes_names)) logger.info(' %d out of %d layers have been reverted back to the %s precision: %s', len(all_ops_in_targeted_prec), self._quantized_layers_num, self._precision_change_to, - ', '.join(all_ops_in_targeted_prec)) + ', '.join(prepare_nodes_for_logger(all_ops_in_targeted_prec))) send_event("result_aa", self._get_result_aa(metrics_accuracy_drop, len(all_ops_in_targeted_prec))) logger.update_progress(self.total_exec_steps) @@ -418,10 +418,10 @@ class AccuracyAwareCommon(Algorithm): fake_quantize_nodes = get_nodes_by_type(model, ['FakeQuantize']) for node in fake_quantize_nodes: - if excluded_nodes and node.name in excluded_nodes: + if excluded_nodes and node.fullname in excluded_nodes: continue - if node.name not in change_fqs: - modified_model, modified_fq_layers, _ = self._modify_model_in_scope(deepcopy(model), [node.name]) + if node.fullname not in change_fqs: + modified_model, modified_fq_layers, _ = self._modify_model_in_scope(deepcopy(model), [node.fullname]) if not modified_fq_layers: continue logger.debug('Changed\\Removed a block of %d FQ layers: %s', len(modified_fq_layers), @@ -434,7 +434,7 @@ class AccuracyAwareCommon(Algorithm): self._engine.allow_pairwise_subset = False logger.update_progress(self._config.ranking_subset_size) ranking_metric = self._metrics_config[metric_name].ranking - node_importance_score[node.name] = ranking_metric.comparator(metrics[ranking_metric.name]) + node_importance_score[node.fullname] = ranking_metric.comparator(metrics[ranking_metric.name]) eu.reset_dataset_to_default(self._engine) diff --git a/tools/pot/openvino/tools/pot/algorithms/quantization/accuracy_aware_common/mixed_precision.py b/tools/pot/openvino/tools/pot/algorithms/quantization/accuracy_aware_common/mixed_precision.py index 3234adbb4ce..0cd61e85e00 100644 --- a/tools/pot/openvino/tools/pot/algorithms/quantization/accuracy_aware_common/mixed_precision.py +++ b/tools/pot/openvino/tools/pot/algorithms/quantization/accuracy_aware_common/mixed_precision.py @@ -43,7 +43,7 @@ class INT4MixedQuantization(AccuracyAwareCommon): # pylint: disable=W0221, W0212 def _quantize_model(self, model, quantize_with_low_bitwidth=True): convolution_fq_nodes = [ - node.name + node.fullname for node in mu.get_nodes_by_type(model, ['FakeQuantize']) if self._can_set_fq_to_low_bitwidth(node) ] @@ -67,9 +67,9 @@ class INT4MixedQuantization(AccuracyAwareCommon): cut_fqs = [] cut_model = deepcopy(model) for node in mu.get_nodes_by_type(model, ['FakeQuantize']): - if node.name not in cut_fqs: + if node.fullname not in cut_fqs: cut_model, cut_fq_layers, _ = self._graph_transformer.remove_fq_nodes( - cut_model, [node.name] + cut_model, [node.fullname] ) cut_fqs += cut_fq_layers return cut_model @@ -136,9 +136,9 @@ class INT4MixedQuantization(AccuracyAwareCommon): ] for node in convolution_fq_nodes: - if node.name not in cut_fqs: + if node.fullname not in cut_fqs: cut_model, cut_fq_layers, _ = self._modify_model_in_scope( - model, [node.name] + model, [node.fullname] ) logger.info( 'Removed a block of %d FQ layers: %s', @@ -155,7 +155,7 @@ class INT4MixedQuantization(AccuracyAwareCommon): self._engine.allow_pairwise_subset = False logger.update_progress(self._config.ranking_subset_size) ranking_metric = self._metrics_config[metric_name].ranking - node_importance_score[node.name] = ranking_metric.comparator( + node_importance_score[node.fullname] = ranking_metric.comparator( metrics[ranking_metric.name] ) diff --git a/tools/pot/openvino/tools/pot/algorithms/quantization/accuracy_aware_common/utils.py b/tools/pot/openvino/tools/pot/algorithms/quantization/accuracy_aware_common/utils.py index 7c9f0d80c57..554425326e8 100644 --- a/tools/pot/openvino/tools/pot/algorithms/quantization/accuracy_aware_common/utils.py +++ b/tools/pot/openvino/tools/pot/algorithms/quantization/accuracy_aware_common/utils.py @@ -338,3 +338,14 @@ def process_per_sample_metrics(metrics_per_sample, metrics_config, processed_metrics_per_sample[name] = [values[i] for i in indices] return processed_metrics_per_sample + + +def prepare_nodes_for_logger(nodes_names): + postprocessed_nodes_names = [] + for name in nodes_names: + subgraphs = name.split('|') + if len(subgraphs) > 1: + postprocessed_nodes_names.append(str(subgraphs)) + else: + postprocessed_nodes_names.append(subgraphs[0]) + return postprocessed_nodes_names diff --git a/tools/pot/openvino/tools/pot/algorithms/quantization/bias_correction/algorithm.py b/tools/pot/openvino/tools/pot/algorithms/quantization/bias_correction/algorithm.py index ddf74a68a87..d36f8602fa5 100644 --- a/tools/pot/openvino/tools/pot/algorithms/quantization/bias_correction/algorithm.py +++ b/tools/pot/openvino/tools/pot/algorithms/quantization/bias_correction/algorithm.py @@ -112,16 +112,16 @@ class BiasCorrection(Algorithm): def skip_node(node): if not nu.node_with_quantized_weights(node) and not self._apply_for_all_nodes: - logger.debug('%s skipped because it does not have FQ weights.', node.name) + logger.debug('%s skipped because it does not have FQ weights.', node.fullname) return True if not nu.check_const_input(node): - logger.debug('%s skipped because channel axis is not defined', node.name) + logger.debug('%s skipped because channel axis is not defined', node.fullname) return True bias_node = nu.get_bias_for_node(node) if bias_node is None: - logger.debug('%s skipped because its bias is empty.', node.name) + logger.debug('%s skipped because its bias is empty.', node.fullname) return True return False @@ -135,9 +135,9 @@ class BiasCorrection(Algorithm): continue input_nodes, stats_nodes, output_nodes = self._get_subgraph_data_for_node(node) subgraphs_data[node_name] = { - 'input_nodes': [n.name for n in input_nodes], - 'stats_nodes': [n.name for n in stats_nodes], - 'output_nodes': [n.name for n in output_nodes] + 'input_nodes': [n.fullname for n in input_nodes], + 'stats_nodes': [n.fullname for n in stats_nodes], + 'output_nodes': [n.fullname for n in output_nodes] } del model_copy return subgraphs_data @@ -147,7 +147,7 @@ class BiasCorrection(Algorithm): fq_names_to_cut = [] for fq_node in fq_nodes: if nu.get_node_input(fq_node, 0).type != 'Const': - fq_names_to_cut.append(fq_node.name) + fq_names_to_cut.append(fq_node.fullname) self._graph_transformer.remove_fq_nodes(model, fq_names_to_cut, True) def _get_subgraph_data_for_node(self, main_node): @@ -170,9 +170,9 @@ class BiasCorrection(Algorithm): walk_to_parents(stat_node_parent) def fill_output_nodes(): - assigns = ge.get_nodes_by_type(main_node.graph, ['Assign']) + assigns = ge.get_nodes_by_type(main_node.graph, ['Assign'], recursively=False) for node_name in checked_input_names: - node = ge.get_node_by_name(main_node.graph, node_name) + node = ge.get_node_by_name(main_node.graph, node_name, recursively=False) if node.type == 'ReadValue': output_nodes.extend(nu.get_lstm_ends(node, assigns, checked_input_names)) @@ -185,11 +185,11 @@ class BiasCorrection(Algorithm): node_input_0 = nu.get_node_input(node_input_0, 0) if node.type in self._types_with_bias \ and (nu.node_with_quantized_weights(node) and not self._apply_for_all_nodes): - if node_input_0.name not in checked_stat_names: - checked_stat_names.append(node_input_0.name) - checked_input_names.append(node_input_0.name) + if node_input_0.fullname not in checked_stat_names: + checked_stat_names.append(node_input_0.fullname) + checked_input_names.append(node_input_0.fullname) stats_nodes.append(node_input_0) - self._collected_stat_inputs.append(node_input_0.name) + self._collected_stat_inputs.append(node_input_0.fullname) elif is_this_branch_node and len(node_parents) > 1: return else: @@ -200,10 +200,10 @@ class BiasCorrection(Algorithm): def walk_to_parents(node): node_parents = self.get_node_parents(node) - if node.name in checked_input_names: + if node.fullname in checked_input_names: return - checked_input_names.append(node.name) - if node.name in self._collected_stat_inputs: + checked_input_names.append(node.fullname) + if node.fullname in self._collected_stat_inputs: if node not in input_nodes: input_nodes.append(node) else: @@ -225,11 +225,11 @@ class BiasCorrection(Algorithm): model.clean_up() else: input_nodes = [mu.get_node_by_name(model, name) for name in - self._subgraphs_data[node.name]['input_nodes']] + self._subgraphs_data[node.fullname]['input_nodes']] stats_nodes = [mu.get_node_by_name(model, name) for name in - self._subgraphs_data[node.name]['stats_nodes']] + self._subgraphs_data[node.fullname]['stats_nodes']] output_nodes = [mu.get_node_by_name(model, name) for name in - self._subgraphs_data[node.name]['output_nodes']] + self._subgraphs_data[node.fullname]['output_nodes']] self._remove_default_results(node.graph) if node_bias_add not in output_nodes: @@ -248,7 +248,7 @@ class BiasCorrection(Algorithm): @staticmethod def _remove_default_results(graph): - graph_outputs = ge.get_nodes_by_type(graph, ['Result']) + graph_outputs = ge.get_nodes_by_type(graph, ['Result'], recursively=False) for graph_output in graph_outputs: graph.remove_node(graph_output.id) @@ -294,7 +294,7 @@ class BiasCorrection(Algorithm): return outputs_data def _update_split_subgraphs(self, model_copy): - for node_split in mu.get_nodes_by_type(model_copy, self._split_types): + for node_split in mu.get_nodes_by_type(model_copy, self._split_types, recursively=False): for port_id in node_split.out_ports(): split_result_name = '{}/result/{}'.format(node_split.name, port_id) split_result = ge.create_node(node_split.graph, split_result_name, 'Result', {}) @@ -322,7 +322,7 @@ class BiasCorrection(Algorithm): self._launcher.set_model(model_copy, md_shapes=feed_shapes) def _compute_bias_shift(self, model_copy, **params): - add_name = params['node_bias_add'].name + add_name = params['node_bias_add'].fullname fp32_output = agf.mean(self._fp32_statistics[add_name]['mean_per_channel']) if model_copy.is_cascade: @@ -382,7 +382,7 @@ class BiasCorrection(Algorithm): if trigger: for stat_node_name in self._subgraphs_data[node_name]['input_nodes']: input_node = mu.get_node_by_name(graph, stat_node_name) - stat_nodes_list.append(input_node.name) + stat_nodes_list.append(input_node.fullname) return stat_nodes_list def register_statistics(self, model, stats_collector): @@ -395,18 +395,18 @@ class BiasCorrection(Algorithm): fqut.insert_fake_quantize_nodes(self._config, quantized_model) topological_biased_ops = self._get_topological_biased_ops(quantized_model) - self._nodes_with_bias_names = [node.name for node in topological_biased_ops] - parameter_nodes = mu.get_nodes_by_type(model, ['Parameter']) + self._nodes_with_bias_names = [node.fullname for node in topological_biased_ops] + parameter_nodes = mu.get_nodes_by_type(model, ['Parameter'], recursively=False) biased_after_param_nodes = self._get_biased_after_params(parameter_nodes) for node in topological_biased_ops: add_node = self._get_add_node_for_bias(node) - add_node_name = add_node.name + add_node_name = add_node.fullname if 'orig_node_name' in add_node: - add_node_name = add_node['orig_node_name'] + add_node_name = nu.reset_node_fullname(add_node_name, add_node['orig_node_name']) axis = OPERATIONS_CHANNEL_AXIS[node.type] self._channel_axis[add_node_name] = axis - if node.name in biased_after_param_nodes: - input_name = biased_after_param_nodes[node.name] + if node.fullname in biased_after_param_nodes: + input_name = biased_after_param_nodes[node.fullname] statistics_layout[input_name] = {'batch_mean_param_in': agf.batch_mean} self._collected_stat_inputs.append(input_name) statistics_layout[add_node_name] =\ @@ -447,13 +447,13 @@ class BiasCorrection(Algorithm): node_children = self.get_node_children(node) if node.type in self._types_with_bias: node_input = nu.get_node_input(node, 0) - biased_after_param_nodes[node.name] = node_input.name + biased_after_param_nodes[node.fullname] = node_input.fullname return for node_child in node_children: walk_to_children(node_child, parameter_name) for param_node in parameter_nodes: - walk_to_children(param_node, param_node.name) + walk_to_children(param_node, param_node.fullname) return biased_after_param_nodes diff --git a/tools/pot/openvino/tools/pot/algorithms/quantization/channel_alignment/algorithm.py b/tools/pot/openvino/tools/pot/algorithms/quantization/channel_alignment/algorithm.py index 4d6a9632867..d7454dddf92 100644 --- a/tools/pot/openvino/tools/pot/algorithms/quantization/channel_alignment/algorithm.py +++ b/tools/pot/openvino/tools/pot/algorithms/quantization/channel_alignment/algorithm.py @@ -75,7 +75,7 @@ class ActivationChannelAlignment(Algorithm): # Step over bias Add node if nu.get_bias_for_node(node_in): node_in = nu.get_node_output(node_in, 0)[0] - name = node_in.name + name = node_in.fullname stats_layout[name] = {'channel_range_min': TensorStatistic(asf.quantile_per_channel, q=1e-4), 'channel_range_max': TensorStatistic(asf.quantile_per_channel, q=1-1e-4)} @@ -86,7 +86,7 @@ class ActivationChannelAlignment(Algorithm): # Step over bias Add node if nu.get_bias_for_node(node_in): node_in = nu.get_node_output(node_in, 0)[0] - name = node_in.name + name = node_in.fullname amin = stats[name]['channel_range_min'] amax = stats[name]['channel_range_max'] @@ -151,7 +151,7 @@ class ActivationChannelAlignment(Algorithm): def find_node_pairs(self, model): node_pairs_list = [] - nodes = sorted([(n.name, n) for n in mu.get_nodes_by_type(model, ['Convolution'])]) + nodes = sorted([(n.fullname, n) for n in mu.get_nodes_by_type(model, ['Convolution'])]) for _, node_out in nodes: if not self.check_conv_node(node_out): continue @@ -173,7 +173,7 @@ class ActivationChannelAlignment(Algorithm): node_pairs_list.append((node_in, weights_in, bias_in, node_out, weights_out, bias_out)) # align activations channels inside this sequence - logger.debug('{} -> {}'.format(node_in.name, node_out.name)) + logger.debug('{} -> {}'.format(node_in.fullname, node_out.fullname)) return node_pairs_list @@ -184,15 +184,15 @@ class ActivationChannelAlignment(Algorithm): if not node_out.has_valid('pads_begin') or not node_out.has_valid('pads_end') or \ not np.all(np.array(node_out.pads_begin) == 0) or not np.all(np.array(node_out.pads_end) == 0): logger.debug('Pad of {} Convolution node != 0 ' - 'Do not align activations for this node pair.'.format(node_out.name)) + 'Do not align activations for this node pair.'.format(node_out.fullname)) return False if not node_out.has_valid('strides') or not np.all(np.array(node_out.strides) == 1): logger.debug('Strides of {} Convolution node != 1 ' - 'Do not align activations for this node pair.'.format(node_out.name)) + 'Do not align activations for this node pair.'.format(node_out.fullname)) return False if not node_out.has_valid('strides') or not np.all(np.array(node_out.dilations) == 1): logger.debug('Dilation of {} Convolution node != 1 ' - 'Do not align activations for this node pair.'.format(node_out.name)) + 'Do not align activations for this node pair.'.format(node_out.fullname)) return False return True @@ -203,13 +203,13 @@ class ActivationChannelAlignment(Algorithm): node_out_producer_port = node_out.in_port(0).get_source() if len(node_out_producer_port.get_destinations()) > 1: logger.debug('{} has a producer that feeds many nodes. ' - 'Do not align activations for this node pair.'.format(node_out.name)) + 'Do not align activations for this node pair.'.format(node_out.fullname)) return False # check that producer is convolution if node_in.type not in ['Convolution', 'MatMul']: - logger.debug('{} gets data from {} {}'.format(node_out.name, node_in.name, node_in.type)) + logger.debug('{} gets data from {} {}'.format(node_out.fullname, node_in.fullname, node_in.type)) logger.debug('{} has no Convolution producer. ' - 'Do not align activations for this node pair.'.format(node_out.name)) + 'Do not align activations for this node pair.'.format(node_out.fullname)) return False return True @@ -241,7 +241,7 @@ class ActivationChannelAlignment(Algorithm): if w_out.type != 'Const': w_out = None logger.debug('{} has no const weights. ' - 'Do not align activations for this node pair.'.format(node_out.name)) + 'Do not align activations for this node pair.'.format(node_out.fullname)) # get consumer convolution bias b_out = nu.get_bias_for_node(node_out) diff --git a/tools/pot/openvino/tools/pot/algorithms/quantization/datafree/algorithm.py b/tools/pot/openvino/tools/pot/algorithms/quantization/datafree/algorithm.py index 44654c6ce16..4f9874e005b 100644 --- a/tools/pot/openvino/tools/pot/algorithms/quantization/datafree/algorithm.py +++ b/tools/pot/openvino/tools/pot/algorithms/quantization/datafree/algorithm.py @@ -11,7 +11,6 @@ from ...algorithm_selector import COMPRESSION_ALGORITHMS from ...quantization import fake_quantize as fqut from ....graph import editor as ge from ....graph import node_utils as nu -from ....graph.editor import get_nodes_by_type from ....graph.special_operations import is_eltwise @@ -36,7 +35,7 @@ class DataFreeQuantization(Algorithm): # init BatchNorm dict for node in ge.get_all_operation_nodes(model): if 'bn_weights' in node: - self._bn_dict[node.name] = node['bn_weights'] + self._bn_dict[node.fullname] = node['bn_weights'] fqut.insert_fake_quantize_nodes(self._config, model) fake_quantize_config = fqut.compute_stats_layouts(self._config, model) @@ -48,7 +47,7 @@ class DataFreeQuantization(Algorithm): # compute weights statistics weights_stats = fqut.compute_weights_stats(model, weights_stats_layout) - for fq_ in get_nodes_by_type(model, ['FakeQuantize']): + for fq_ in ge.get_nodes_by_type(model, ['FakeQuantize']): # get zero parent because this is FakeQuantize node input _node_input = fqut.get_fake_quantize_input(fq_) if _node_input.type != 'Const': @@ -60,10 +59,10 @@ class DataFreeQuantization(Algorithm): self._std_multiplier * stats_dict['std']) else: tensor_min, tensor_max = stats_dict['min'], stats_dict['max'] - fq_input_stats[_node_input.name] = {'min': tensor_min, - 'max': max(tensor_max, np.abs(tensor_min))} + fq_input_stats[_node_input.fullname] = {'min': tensor_min, + 'max': max(tensor_max, np.abs(tensor_min))} - if fake_quantize_config[fq_.name]['mode'] == 'symmetric': + if fake_quantize_config[fq_.fullname]['mode'] == 'symmetric': min_level_, max_level_ = fqut.symmetric_range(_node_input, fq_, weights_stats, fq_input_stats, fake_quantize_config) else: @@ -88,15 +87,15 @@ class DataFreeQuantization(Algorithm): range_estimator_config = get_range_estimator_config(config, 'weights', scale_, q_mode_) return get_tensor_statistics(range_estimator_config, for_weights=True) - fq_nodes = get_nodes_by_type(model, ['FakeQuantize']) + fq_nodes = ge.get_nodes_by_type(model, ['FakeQuantize']) weights_layout = {} for fq in fq_nodes: fq_input = fqut.get_fake_quantize_input(fq) - layer_config = fake_quantize_config[fq.name] + layer_config = fake_quantize_config[fq.fullname] scale = layer_config['granularity'] if layer_config['granularity'] else 'pertensor' q_mode = layer_config['mode'] if fq_input.type == 'Const': - weights_layout[fq.name] = _get_stats(scale, q_mode) + weights_layout[fq.fullname] = _get_stats(scale, q_mode) return weights_layout @staticmethod @@ -120,11 +119,11 @@ class DataFreeQuantization(Algorithm): node_min, node_max) tensor_max = np.max(bn_weight_dict['mean'] + self._std_multiplier * bn_weight_dict['std']) tensor_min = np.min(bn_weight_dict['mean'] - self._std_multiplier * bn_weight_dict['std']) - self._bn_dict[node.name] = {'mean': clipped_mean, - 'std': clipped_sigma, - 'max': np.array(min(tensor_max, node_max)), - 'min': np.array(max(tensor_min, node_min))} - return self._bn_dict[node.name] + self._bn_dict[node.fullname] = {'mean': clipped_mean, + 'std': clipped_sigma, + 'max': np.array(min(tensor_max, node_max)), + 'min': np.array(max(tensor_min, node_min))} + return self._bn_dict[node.fullname] def _propagate_stats(self, bn_weights, node): # will need to be handled, when perchannel quantization of activations will be supported @@ -143,9 +142,9 @@ class DataFreeQuantization(Algorithm): pass_ops = channel_changing_ops + \ stat_prop_agnostic_ops - if node.name in self._bn_dict: + if node.fullname in self._bn_dict: stats_dict = bn_weights - if 'max' not in self._bn_dict[node.name]: + if 'max' not in self._bn_dict[node.fullname]: tensor_max = np.max(bn_weights['mean'] + self._std_multiplier * bn_weights['std']) tensor_min = np.min(bn_weights['mean'] - @@ -170,8 +169,8 @@ class DataFreeQuantization(Algorithm): node.type == 'ScaleShift' and nu.get_node_input(node, 0).type == 'Parameter': stats_dict = bn_weights else: - raise RuntimeError('{} layer {} does not support stats propagation'.format(node.type, node.name)) - self._bn_dict[node.name] = stats_dict + raise RuntimeError('{} layer {} does not support stats propagation'.format(node.type, node.fullname)) + self._bn_dict[node.fullname] = stats_dict return stats_dict def _find_stats_in_branch(self, start_node): @@ -179,13 +178,13 @@ class DataFreeQuantization(Algorithm): current_node = start_node visited_nodes = [start_node] while True: - if current_node.name in self._bn_dict: - bn_weights = self._bn_dict[current_node.name] + if current_node.fullname in self._bn_dict: + bn_weights = self._bn_dict[current_node.fullname] for node in visited_nodes[::-1]: bn_weights = self._propagate_stats(bn_weights, node) return bn_weights if branching_ops(current_node): - self._bn_dict[current_node.name] = self._collect_stats_for_branching_op(current_node) + self._bn_dict[current_node.fullname] = self._collect_stats_for_branching_op(current_node) continue if nu.get_node_inputs(current_node): current_node = nu.get_node_input(current_node, 0) @@ -194,7 +193,7 @@ class DataFreeQuantization(Algorithm): if current_node.type != 'Parameter': raise RuntimeError('Node has no parents and stats were not found') bn_weights = {'mean': np.array(0.0), 'std': np.array(1.0)} - self._bn_dict[current_node.name] = bn_weights + self._bn_dict[current_node.fullname] = bn_weights for node in visited_nodes[::-1]: bn_weights = self._propagate_stats(bn_weights, node) return bn_weights diff --git a/tools/pot/openvino/tools/pot/algorithms/quantization/fake_quantize.py b/tools/pot/openvino/tools/pot/algorithms/quantization/fake_quantize.py index 306def42cb6..e1e23dd3900 100644 --- a/tools/pot/openvino/tools/pot/algorithms/quantization/fake_quantize.py +++ b/tools/pot/openvino/tools/pot/algorithms/quantization/fake_quantize.py @@ -131,18 +131,18 @@ def compute_stats_layouts(config, model, qscheme=None): node_input = get_node_input(fq, 0) is_weights = node_input.type == 'Const' if is_weights: - fq_config = copy(fq_configuration[fq.name]['weights']) + fq_config = copy(fq_configuration[fq.fullname]['weights']) else: - fq_config = copy(fq_configuration[fq.name]['activations']) - fake_quantize_config[fq.name] = fq_config - if fq.name in config.layerwise_configs[0]: - fq_config = Dict(merge_nested_dicts(fq_config, config.layerwise_configs[0][fq.name])) + fq_config = copy(fq_configuration[fq.fullname]['activations']) + fake_quantize_config[fq.fullname] = fq_config + if fq.fullname in config.layerwise_configs[0]: + fq_config = Dict(merge_nested_dicts(fq_config, config.layerwise_configs[0][fq.fullname])) fq_config['signed'] = False if 'level_low' in fq_config and 'level_high' in fq_config and fq_config['level_low'] < 0: fq_config['signed'] = True - fake_quantize_config[fq.name] = fq_config + fake_quantize_config[fq.fullname] = fq_config fq.levels = compute_levels(fq_config, is_weights) return fake_quantize_config @@ -242,19 +242,19 @@ def symmetric_range(node, fq, weights_stats, name = get_quantized_input_key(fq) if node.type == 'Const' or get_input_data_value(fq, 0) is not None: node_output = get_fake_quantize_first_output(fq) - max_level = weights_stats[node_output.name]['max'] + max_level = weights_stats[node_output.fullname]['max'] max_level = fix_zero_filters_symmetric(max_level) min_level = -max_level elif name in batch_inputs_stats: max_level = batch_inputs_stats[name]['max'] min_level = batch_inputs_stats[name]['min'] max_level = fix_zero_filters_symmetric(max_level) - signed = fake_quantize_config[fq.name]['signed'] + signed = fake_quantize_config[fq.fullname]['signed'] min_level = np.zeros(max_level.shape) if np.all(min_level >= 0) and not signed else \ -max_level * fq.levels / (fq.levels - 2) else: raise Exception( - 'WARNING: Fake quantize node {} is missed'.format(fq.name)) + 'WARNING: Fake quantize node {} is missed'.format(fq.fullname)) min_level, max_level = broadcast_fq_values(fq, node, min_level, max_level, fake_quantize_config) return min_level, max_level @@ -264,14 +264,14 @@ def asymmetric_range(node, fq, weights_stats, name = get_quantized_input_key(fq) if node.type == 'Const' or get_input_data_value(fq, 0) is not None: node_output = get_fake_quantize_first_output(fq) - max_level = weights_stats[node_output.name]['max'] - min_level = weights_stats[node_output.name]['min'] + max_level = weights_stats[node_output.fullname]['max'] + min_level = weights_stats[node_output.fullname]['min'] elif name in batch_inputs_stats: max_level = batch_inputs_stats[name]['max'] min_level = batch_inputs_stats[name]['min'] else: raise Exception( - 'WARNING: Fake quantize node {} is missed'.format(fq.name)) + 'WARNING: Fake quantize node {} is missed'.format(fq.fullname)) max_level, min_level = fix_zero_filters_asymmetric(max_level, min_level) min_level = np.where(min_level < 0.0, min_level, 0.0) @@ -279,13 +279,13 @@ def asymmetric_range(node, fq, weights_stats, if unify_zp: if name in batch_inputs_stats: raise Exception( - 'WARING: unify zero point of fake quantize node {} not supported'.format(fq.name) + 'WARING: unify zero point of fake quantize node {} not supported'.format(fq.fullname) ) min_level, max_level = tune_range_unify_zp( - min_level, max_level, fake_quantize_config[fq.name]['bits']) + min_level, max_level, fake_quantize_config[fq.fullname]['bits']) else: min_level, max_level = tune_range( - min_level, max_level, fake_quantize_config[fq.name]['bits']) + min_level, max_level, fake_quantize_config[fq.fullname]['bits']) min_level, max_level = broadcast_fq_values(fq, node, min_level, max_level, fake_quantize_config) return min_level, max_level @@ -341,11 +341,11 @@ def compute_weights_stats(model, stats_layout): if weights_node.type != 'Const' and weights_value is None: raise Exception('Incorrect stats layout for weights:' ' {} is activation'.format(weights_node.name)) - if node.name not in weights_stats: - weights_stats[node.name] = {} + if node.fullname not in weights_stats: + weights_stats[node.fullname] = {} for stat_name, stat_fn in stats.items(): weights = weights_value.astype(np.float32) - weights_stats[node.name][stat_name] = stat_fn(weights) + weights_stats[node.fullname][stat_name] = stat_fn(weights) return weights_stats @@ -375,7 +375,7 @@ def broadcast_fq_values(fq, node, min_level, max_level, fq_config): else: bounds_shape[0] = input_shape[0] else: - if fq_config[fq.name]['granularity'] == 'perchannel': + if fq_config[fq.fullname]['granularity'] == 'perchannel': bounds_shape[1] = input_shape[1] min_level = min_level.reshape(bounds_shape) @@ -395,18 +395,18 @@ def set_rescaling_factors(target_device, model, scaling_factor=2.0): """ fqs_to_rescale = [] - if target_device not in ['CPU', 'ANY'] or not get_nodes_by_type(model, ['Convolution', ]): + if target_device not in ['CPU', 'ANY'] or not get_nodes_by_type(model, ['Convolution'], recursively=False): return {'scaling_factor': 1.0, 'fqs_to_rescale': fqs_to_rescale} - input_nodes = get_nodes_by_type(model, ['Parameter']) + input_nodes = get_nodes_by_type(model, ['Parameter'], recursively=False) input_convolutions = get_first_convolutions(input_nodes) for node in input_convolutions: fqs_to_rescale.append(get_node_input(node, 1).name) - conv_nodes_to_rescale = get_nodes_by_type(model, [op['type'] for op in OPERATIONS_WITH_WEIGHTS]) + conv_nodes_to_rescale = get_nodes_by_type(model, [op['type'] for op in OPERATIONS_WITH_WEIGHTS], recursively=False) conv_fqs_to_rescale = [get_node_input(node, 1).name for node in conv_nodes_to_rescale if 'need_rescale' in node and node['need_rescale']] fqs_to_rescale.extend(conv_fqs_to_rescale) diff --git a/tools/pot/openvino/tools/pot/algorithms/quantization/fake_quantize_configuration.py b/tools/pot/openvino/tools/pot/algorithms/quantization/fake_quantize_configuration.py index a8ba9f332fb..63a00cc0cbc 100644 --- a/tools/pot/openvino/tools/pot/algorithms/quantization/fake_quantize_configuration.py +++ b/tools/pot/openvino/tools/pot/algorithms/quantization/fake_quantize_configuration.py @@ -130,11 +130,11 @@ def read_all_fake_quantize_configurations(config, hardware_config, model): if not _is_quantizable(child): queue.append(child) elif child.type not in descendants: - descendants.append((child.name, + descendants.append((child.fullname, get_hardware_config_operation_type(child, available_types))) if current.type == 'Split' \ and child.type == 'Concat' \ - and len({child_.name for child_ in children}) == 1: + and len({child_.fullname for child_ in children}) == 1: break return descendants @@ -146,7 +146,7 @@ def read_all_fake_quantize_configurations(config, hardware_config, model): available_types = [layer['type'] for layer in hardware_config] for fq in get_nodes_by_type(model, ['FakeQuantize']): node_input = get_node_input(fq, 0) - out[fq.name] = (_get_node_valuable_descendant(fq), node_input.type == 'Const') + out[fq.fullname] = (_get_node_valuable_descendant(fq), node_input.type == 'Const') return out @@ -320,7 +320,7 @@ def find_fqs_to_unify(model, config): 'Concat': _is_concat_unify_condition } if node.type in check_map: - logger.debug('Checking {} node with {} type'.format(node.name, node.type)) + logger.debug('Checking {} node with {} type'.format(node.fullname, node.type)) return check_map[node.type](node) return True @@ -331,7 +331,7 @@ def find_fqs_to_unify(model, config): elif input_node.type in [n['type'] for n in CONCAT_UNIFY_OUTPUTS]: concat_stack.clear() logger.debug('Found %s %s as Concat %s output', - input_node.type, input_node.name, node.name) + input_node.type, input_node.fullname, node.fullname) return True return False @@ -340,7 +340,7 @@ def find_fqs_to_unify(model, config): for concat_input in concat_inputs: if concat_input.type not in [n['type'] for n in CONCAT_UNIFY_INPUTS]: logger.debug('Concat %s without FQ or Concat as input will not unified', - node.name) + node.fullname) return res concat_stack = [node] while concat_stack: @@ -363,24 +363,24 @@ def find_fqs_to_unify(model, config): return 'Const' in [parent.type for parent in get_node_inputs(layer) if parent] def _process_node(node_, stack_, visited_, to_unify_): - visited_[node_.name] = True + visited_[node_.fullname] = True if _is_unified_scales_op(node_) or _is_agnostic_branching_op(node_): if not _has_const_input(node_): - to_unify_[0].append(node_.name) + to_unify_[0].append(node_.fullname) elif node_.type == 'FakeQuantize' and get_node_input(node_, 0).type != 'Const': - to_unify_[1].append(node_.name) + to_unify_[1].append(node_.fullname) # traverse down if node_.type == 'FakeQuantize' or _is_quantize_agnostic_op(node_): for child in get_all_node_outputs(node_): node_data_type = get_node_data_type(child) - if not visited_[child.name] and is_data_type_quantizable(node_data_type) and \ + if not visited_[child.fullname] and is_data_type_quantizable(node_data_type) and \ (_is_quantize_agnostic_op(child) or _is_unified_scales_op(child)): stack_.append(child) # traverse up if node_.type != 'FakeQuantize': for parent in get_node_inputs(node_): node_data_type = get_node_data_type(parent) - if parent and not visited_[parent.name] and is_data_type_quantizable(node_data_type) and \ + if parent and not visited_[parent.fullname] and is_data_type_quantizable(node_data_type) and \ (parent.type == 'FakeQuantize' or _is_quantize_agnostic_op(parent)): stack_.append(parent) @@ -396,7 +396,7 @@ def find_fqs_to_unify(model, config): if model is None: return fqs_to_unify for fq in get_nodes_by_type(model, ['FakeQuantize']): - if not visited[fq.name] and get_node_input(fq, 0).type != 'Const': + if not visited[fq.fullname] and get_node_input(fq, 0).type != 'Const': stack = [fq] to_unify = [[], []] while stack: diff --git a/tools/pot/openvino/tools/pot/algorithms/quantization/fast_bias_correction/algorithm.py b/tools/pot/openvino/tools/pot/algorithms/quantization/fast_bias_correction/algorithm.py index 28361e060dc..e0693af0a32 100755 --- a/tools/pot/openvino/tools/pot/algorithms/quantization/fast_bias_correction/algorithm.py +++ b/tools/pot/openvino/tools/pot/algorithms/quantization/fast_bias_correction/algorithm.py @@ -60,11 +60,11 @@ class FastBiasCorrection(Algorithm): bias_node = nu.get_bias_for_node(op_node) if bias_node is None: - logger.debug('{} skipped because of bias is empty'.format(op_node.name)) + logger.debug('{} skipped because of bias is empty'.format(op_node.fullname)) continue if not nu.check_const_input(op_node): - logger.debug('{} skipped because channel axis is not defiened'.format(op_node.name)) + logger.debug('{} skipped because channel axis is not defiened'.format(op_node.fullname)) continue input_node = nu.get_node_input(op_node, 0) @@ -74,7 +74,7 @@ class FastBiasCorrection(Algorithm): quantized_node = nu.get_node_input(op_node, 0) input_shape = nu.get_input_shape_for_bias(op_node) - op_model = mu.build_model_for_node(model, input_node.name, input_shape, op_node, + op_model = mu.build_model_for_node(model, input_node.fullname, input_shape, op_node, remove_bias=True, target_device=self._config['target_device']) # We need to get output from the biased operation @@ -84,10 +84,10 @@ class FastBiasCorrection(Algorithm): input_node_name = get_quantized_input_key(quantized_node) fp32_inputs = agf.mean(activations_statistics[input_node_name]["mean_per_channel"]) - fp32_outputs = agf.mean(activations_statistics[after_biased_conv.name]["mean_per_channel"]) + fp32_outputs = agf.mean(activations_statistics[after_biased_conv.fullname]["mean_per_channel"]) bias_shift = self._calculate_bias_shift( - launcher, input_node.name, input_shape, op_model, fp32_inputs, fp32_outputs) + launcher, input_node.fullname, input_shape, op_model, fp32_inputs, fp32_outputs) current_bias_value = nu.get_node_value(bias_node) # Reshaped since bias are broadcasted add_out_shape = nu.get_input_shape_for_bias(after_biased_conv) @@ -102,14 +102,14 @@ class FastBiasCorrection(Algorithm): bias_shift_magnitude = np.max(np.abs((bias_shift - current_bias_value) / current_bias_value)) bias_original_value = nu.get_node_value(bias_node) if bias_original_value.shape != bias_shift.shape: - logger.debug('{} skipped because shift shape and original shape are inconsistent'.format(op_node.name)) + logger.debug(f'{op_node.fullname} skipped because shift shape and original shape are inconsistent') continue if bias_shift_magnitude < self._threshold: op_node['original_bias'] = current_bias_value nu.set_node_value(bias_node, bias_shift) else: - logger.debug('{} skipped by threshold'.format(op_node.name)) + logger.debug('{} skipped by threshold'.format(op_node.fullname)) return model def register_statistics(self, model, stats_collector): @@ -132,14 +132,14 @@ class FastBiasCorrection(Algorithm): if nu.get_node_input(quantized_node, 0).type == 'FakeQuantize': quantized_node = nu.get_node_input(op_node, 0) - op_output_name = op_node.name - if op_node.name not in inputs_outputs_layout: + op_output_name = op_node.fullname + if op_node.fullname not in inputs_outputs_layout: # Conv -> Add, MatMul -> Add cases # We need to get output from the biased operation if nu.get_bias_for_node(op_node): bias = nu.get_bias_for_node(op_node) op_node_output = nu.get_node_output(bias, 0)[0] - op_output_name = op_node_output.name + op_output_name = op_node_output.fullname inputs_outputs_layout[op_output_name] = { "mean_per_channel": TensorStatisticAxis(inplace_statistics=inplace_statistics, granularity='perchannel', type='mean', @@ -191,8 +191,8 @@ class FastBiasCorrection(Algorithm): axis = OPERATIONS_CHANNEL_AXIS[op_node.type] - self._channel_axis[input_node.name] = axis - add_name = after_biased_conv.name + self._channel_axis[input_node.fullname] = axis + add_name = after_biased_conv.fullname if 'orig_node_name' in after_biased_conv: add_name = after_biased_conv['orig_node_name'] self._channel_axis[add_name] = axis diff --git a/tools/pot/openvino/tools/pot/algorithms/quantization/layerwise_finetuning/algorithm.py b/tools/pot/openvino/tools/pot/algorithms/quantization/layerwise_finetuning/algorithm.py index 210481cea83..029a65fe2b4 100644 --- a/tools/pot/openvino/tools/pot/algorithms/quantization/layerwise_finetuning/algorithm.py +++ b/tools/pot/openvino/tools/pot/algorithms/quantization/layerwise_finetuning/algorithm.py @@ -61,9 +61,9 @@ class QuantizeModelFinetuning(LayerwiseModelFinetuning): quantized_model = model # Add first convolutions and their weight FQ's to tuning ignored scope - input_nodes = mu.get_nodes_by_type(model, ['Parameter']) + input_nodes = mu.get_nodes_by_type(model, ['Parameter'], recursively=False) input_convolutions = get_first_convolutions(input_nodes) - input_convolutions_names = [node.name for node in input_convolutions] + input_convolutions_names = [node.fullname for node in input_convolutions] self._tconf['tuning_ignored_scope'].extend(input_convolutions_names) logger.debug('Tuning ignored scope updated with: {}'.format(input_convolutions_names)) @@ -111,8 +111,8 @@ class QuantizeModelFinetuning(LayerwiseModelFinetuning): fq_node = mu.get_node_by_name(modified_model, op_name) wrapped_op, params = self._wrap_node(fq_node, FakeQuantize, op_info['params']) if wrapped_op: - wrapped_ops[fq_node.name] = wrapped_op - ops_parameters[fq_node.name] = params + wrapped_ops[fq_node.fullname] = wrapped_op + ops_parameters[fq_node.fullname] = params for op_name, op_info in nodes_to_tune.items(): if op_name in wrapped_ops: @@ -120,13 +120,13 @@ class QuantizeModelFinetuning(LayerwiseModelFinetuning): conv_node = mu.get_node_by_name(modified_model, op_name) conv_node_input = nu.get_node_input(conv_node, 0) input_fq = None - if conv_node_input.type == 'FakeQuantize' and conv_node_input.name in wrapped_ops: - input_fq = wrapped_ops[conv_node_input.name] + if conv_node_input.type == 'FakeQuantize' and conv_node_input.fullname in wrapped_ops: + input_fq = wrapped_ops[conv_node_input.fullname] op_info['input_fq'] = input_fq wrapped_op, params = self._wrap_node(conv_node, LinearModule, op_info['params']) if wrapped_op: - wrapped_ops[conv_node.name] = wrapped_op - ops_parameters[conv_node.name] = params + wrapped_ops[conv_node.fullname] = wrapped_op + ops_parameters[conv_node.fullname] = params return wrapped_ops, ops_parameters diff --git a/tools/pot/openvino/tools/pot/algorithms/quantization/minmax/algorithm.py b/tools/pot/openvino/tools/pot/algorithms/quantization/minmax/algorithm.py index 561ada1a1ad..d344eeb1ae1 100644 --- a/tools/pot/openvino/tools/pot/algorithms/quantization/minmax/algorithm.py +++ b/tools/pot/openvino/tools/pot/algorithms/quantization/minmax/algorithm.py @@ -93,15 +93,15 @@ class MinMaxQuantization(Algorithm): for fq in fq_nodes: fq_input = fqut.get_fake_quantize_input(fq) fq_input_value = fqut.get_fake_quantize_input_value(fq) - layer_config = fake_quantize_config[fq.name] + layer_config = fake_quantize_config[fq.fullname] is_weights = fq_input.type == 'Const' or fq_input_value is not None ts_args = {} if is_weights is True and for_weights is True: node = fqut.get_fake_quantize_first_output(fq) if node.type in [op['type'] for op in TRANSPOSED_OPERATIONS]: ts_args.update({'transpose': True}) - statistics_layout[fq.name] = get_tensor_statistics(layer_config['range_estimator'], - for_weights=True, **ts_args) + statistics_layout[fq.fullname] = get_tensor_statistics(layer_config['range_estimator'], + for_weights=True, **ts_args) elif is_weights is False and for_weights is False: fq_input_key = nu.get_quantized_input_key(fq) ts_args['inplace_statistics'] = inplace_statistics @@ -124,39 +124,39 @@ class MinMaxQuantization(Algorithm): fq_input = fqut.get_fake_quantize_input(fq) fq_input_value = fqut.get_fake_quantize_input_value(fq) stat_config_keys = {} - if fq.name not in fake_quantize_config: + if fq.fullname not in fake_quantize_config: continue - for stat_type in fake_quantize_config[fq.name]['range_estimator']: - stat_config_keys[stat_type] = get_stat_name_by_config(fake_quantize_config[fq.name]['range_estimator'], - stat_type) + for stat_type in fake_quantize_config[fq.fullname]['range_estimator']: + stat_config_keys[stat_type] = get_stat_name_by_config( + fake_quantize_config[fq.fullname]['range_estimator'], stat_type) if fq_input.type != 'Const' and fq_input_value is None: fq_input_key = nu.get_quantized_input_key(fq) max_values = inputs_stats[fq_input_key][stat_config_keys['max']] min_values = inputs_stats[fq_input_key][stat_config_keys['min']] min_aggregator, max_aggregator = \ - get_aggregator(fake_quantize_config[fq.name]['range_estimator']) + get_aggregator(fake_quantize_config[fq.fullname]['range_estimator']) batch_inputs_stats[fq_input_key] = {'max': max_aggregator(max_values), 'min': min_aggregator(min_values)} else: node_output = fqut.get_fake_quantize_first_output(fq) - batch_weights_stats[node_output.name] = {} + batch_weights_stats[node_output.fullname] = {} for stat_type in ['min', 'max']: if stat_type in stat_config_keys: - batch_weights_stats[node_output.name][stat_type] = weights_stats[node_output.name][ + batch_weights_stats[node_output.fullname][stat_type] = weights_stats[node_output.fullname][ stat_config_keys[stat_type]] for fq_ in fake_quantizations: # get first input because this is FakeQuantize node input _node_input = fqut.get_fake_quantize_input(fq_) - if fq_.name not in fake_quantize_config: + if fq_.fullname not in fake_quantize_config: continue - if fake_quantize_config[fq_.name]['mode'] == 'symmetric': + if fake_quantize_config[fq_.fullname]['mode'] == 'symmetric': min_level_, max_level_ = fqut.symmetric_range(_node_input, fq_, batch_weights_stats, batch_inputs_stats, fake_quantize_config) else: - if 'unified_zeropoint' in fake_quantize_config[fq_.name].keys(): - unify_zp = fake_quantize_config[fq_.name]['unified_zeropoint'] + if 'unified_zeropoint' in fake_quantize_config[fq_.fullname].keys(): + unify_zp = fake_quantize_config[fq_.fullname]['unified_zeropoint'] else: unify_zp = False min_level_, max_level_ = fqut.asymmetric_range(_node_input, fq_, batch_weights_stats, @@ -170,13 +170,13 @@ class MinMaxQuantization(Algorithm): return stat_value return stat_value - range_estimator_config = fake_quantize_config[fq_.name]['range_estimator'] + range_estimator_config = fake_quantize_config[fq_.fullname]['range_estimator'] min_level_ = clip_stat(min_level_, 'min', range_estimator_config) \ if 'min' in range_estimator_config else min_level_ max_level_ = clip_stat(max_level_, 'max', range_estimator_config) \ if 'max' in range_estimator_config else max_level_ - if fq_.name in fake_quantize_config['fqs_to_rescale']: + if fq_.fullname in fake_quantize_config['fqs_to_rescale']: weights_node = nu.get_node_input(fq_, 0) weights = nu.get_node_value(weights_node) conv_node = nu.get_node_output(fq_, 0)[0] diff --git a/tools/pot/openvino/tools/pot/algorithms/quantization/optimization/rangeopt.py b/tools/pot/openvino/tools/pot/algorithms/quantization/optimization/rangeopt.py index e8b613a38aa..003dc2fcc3d 100644 --- a/tools/pot/openvino/tools/pot/algorithms/quantization/optimization/rangeopt.py +++ b/tools/pot/openvino/tools/pot/algorithms/quantization/optimization/rangeopt.py @@ -63,20 +63,20 @@ class RangeOptimization(OptimizationAlgorithm): parents = nu.get_node_inputs(fq) if parents[0].type != 'Const': if parents[0].type in ('Clamp', 'ReLU'): - out[parents[0].name] = [nu.get_node_value(parents[2])] - self._optimization_scope[parents[0].name] = 'ReLU' - if parents[0].name not in self._optimization_scope: - out[parents[0].name] = [ + out[parents[0].fullname] = [nu.get_node_value(parents[2])] + self._optimization_scope[parents[0].fullname] = 'ReLU' + if parents[0].fullname not in self._optimization_scope: + out[parents[0].fullname] = [ nu.get_node_value(val) for val in parents[1:3] ] return out def _set_parameter_values(self, model, param_values): - for fq in model.get_op_nodes(type='FakeQuantize'): + for fq in mu.get_nodes_by_type(model, ['FakeQuantize']): # get zero parent because this is FakeQuantize node input _node_input = nu.get_node_input(fq, 0) - if _node_input.name in self._activation_ranges: - min_level_, max_level_ = param_values[_node_input.name] + if _node_input.fullname in self._activation_ranges: + min_level_, max_level_ = param_values[_node_input.fullname] fqut.fill_fake_quantize_node(fq, min_level_, max_level_) return model diff --git a/tools/pot/openvino/tools/pot/algorithms/quantization/outlier_channel_splitting/algorithm.py b/tools/pot/openvino/tools/pot/algorithms/quantization/outlier_channel_splitting/algorithm.py index 1fa44e4a886..60d0d080678 100644 --- a/tools/pot/openvino/tools/pot/algorithms/quantization/outlier_channel_splitting/algorithm.py +++ b/tools/pot/openvino/tools/pot/algorithms/quantization/outlier_channel_splitting/algorithm.py @@ -39,7 +39,7 @@ class OutlierChannelSplitting(Algorithm): if self.add_input_channels_for_conv_node(conv_node, ocs_channels_idxs): nu.set_node_value(weights_node, ocs_weights) logger.debug('Node {}: Channels {} were splitted'. - format(conv_node.name, ','.join(str(idx) for idx in ocs_channels_idxs))) + format(conv_node.fullname, ','.join(str(idx) for idx in ocs_channels_idxs))) model.clean_up() return model @@ -85,7 +85,7 @@ class OutlierChannelSplitting(Algorithm): def get_conv_nodes(self, model): conv_nodes_list = [] - nodes = sorted([(n.name, n) for n in mu.get_nodes_by_type(model, ['Convolution'])]) + nodes = sorted([(n.fullname, n) for n in mu.get_nodes_by_type(model, ['Convolution'])]) for _, node in nodes: if not self.check_conv_node(node): continue diff --git a/tools/pot/openvino/tools/pot/algorithms/quantization/overflow_correction/algorithm.py b/tools/pot/openvino/tools/pot/algorithms/quantization/overflow_correction/algorithm.py index 34147d8cfa2..a3e6d981a27 100644 --- a/tools/pot/openvino/tools/pot/algorithms/quantization/overflow_correction/algorithm.py +++ b/tools/pot/openvino/tools/pot/algorithms/quantization/overflow_correction/algorithm.py @@ -47,20 +47,20 @@ class OverflowCorrection(Algorithm): if bias_node is None: continue add_node = nu.get_node_output(bias_node, 0)[0] - add_node_name = add_node.name + add_node_name = add_node.fullname if add_node_name not in activation_statistics \ or 'max_per_tensor' not in activation_statistics[add_node_name]: - logger.debug('Skipping {}'.format(weighted_node.name)) + logger.debug('Skipping {}'.format(weighted_node.fullname)) continue - logger.debug('Processing {}'.format(weighted_node.name)) + logger.debug('Processing {}'.format(weighted_node.fullname)) weight_fq = nu.get_node_input(weighted_node, 1) if weight_fq.levels <= np.iinfo(np.uint8).max: - logger.debug('Skipping {} due to INT8 weights quantization'.format(weighted_node.name)) + logger.debug('Skipping {} due to INT8 weights quantization'.format(weighted_node.fullname)) continue rescale_value = correct_node_overflow(weighted_node, activation_statistics[add_node_name]['max_per_tensor']) if rescale_value: logger.debug('Weights and scales for node {} ' - 'updated with scale coefficient: {}'.format(weighted_node.name, rescale_value)) + 'updated with scale coefficient: {}'.format(weighted_node.fullname, rescale_value)) return model def register_statistics(self, model, stats_collector): @@ -72,7 +72,7 @@ class OverflowCorrection(Algorithm): if bias_node is None: continue add_node = nu.get_node_output(bias_node, 0)[0] - stats_layout[add_node.name] = {'max_per_tensor': acf.abs_max_per_tensor} + stats_layout[add_node.fullname] = {'max_per_tensor': acf.abs_max_per_tensor} quantized_model = deepcopy(model) fqut.insert_fake_quantize_nodes(self._config, quantized_model) layers_mapping = fqut.create_renamed_layers_mapping(quantized_model, stats_layout) diff --git a/tools/pot/openvino/tools/pot/algorithms/quantization/qnoise_estimator/algorithm.py b/tools/pot/openvino/tools/pot/algorithms/quantization/qnoise_estimator/algorithm.py index 90ecaba3b1a..88984f1dc45 100644 --- a/tools/pot/openvino/tools/pot/algorithms/quantization/qnoise_estimator/algorithm.py +++ b/tools/pot/openvino/tools/pot/algorithms/quantization/qnoise_estimator/algorithm.py @@ -5,6 +5,7 @@ from copy import deepcopy import numpy as np import pandas as pd +from mo.graph.graph import rename_node from .utils import get_composite_model from ..utils import load_hardware_config @@ -57,7 +58,8 @@ class QuantNoiseEstimator(Algorithm): fully_quantized_model = deepcopy(model) model = self.get_nonquantized_model(model) for node in mu.get_all_operation_nodes(fully_quantized_model): - node.name = node.name + self.q_suffix + rename_node(node, node.name + self.q_suffix) + node.fullname += self.q_suffix composite_model = get_composite_model( model, fully_quantized_model, quantized_suffix=self.q_suffix @@ -75,13 +77,13 @@ class QuantNoiseEstimator(Algorithm): add_after_conv = nu.get_node_output(conv, 0)[0] if add_after_conv.type == 'Add': # needs special layout for input/output stats - stat_calculation_layers.update({add_after_conv.name: conv.name}) - inputs_outputs_layout[add_after_conv.name] = { + stat_calculation_layers.update({add_after_conv.fullname: conv.fullname}) + inputs_outputs_layout[add_after_conv.fullname] = { 'layerwise_stat': SQNRStatistic( self.activation_stats, self.q_suffix ) } - inputs_outputs_layout[add_after_conv.name + self.q_suffix] = {} + inputs_outputs_layout[add_after_conv.fullname + self.q_suffix] = {} del model, fully_quantized_model self._engine.set_model(composite_model) @@ -108,7 +110,7 @@ class QuantNoiseEstimator(Algorithm): fq_cut_node_list = fq_remover.find_fq_nodes_to_cut(fq_node) cut_fqs = [] fq_names = [ - node.name for node in mu.get_nodes_by_type(model, ['FakeQuantize']) + node.fullname for node in mu.get_nodes_by_type(model, ['FakeQuantize']) ] for node_name in fq_names: if node_name not in cut_fqs and node_name not in fq_cut_node_list: @@ -132,7 +134,7 @@ class QuantNoiseEstimator(Algorithm): if conv_input_node.type == 'FakeQuantize' and add_after_conv.type == 'Add': logger.info( 'Calculating stats for quantized convolution {}'.format( - conv_node.name + conv_node.fullname ) ) single_fq_layer_model = get_single_fq_model( @@ -140,7 +142,8 @@ class QuantNoiseEstimator(Algorithm): ) for node in mu.get_all_operation_nodes(single_fq_layer_model): - node.name = node.name + self.q_suffix + rename_node(node, node.name + self.q_suffix) + node.fullname += self.q_suffix composite_model = get_composite_model( deepcopy(model), single_fq_layer_model @@ -149,15 +152,15 @@ class QuantNoiseEstimator(Algorithm): # collect convolution output residuals for original vs. quantized model inputs_outputs_layout = {} add_after_conv = nu.get_node_output( - mu.get_node_by_name(composite_model, conv_node.name), 0 + mu.get_node_by_name(composite_model, conv_node.fullname), 0 )[0] # needs special layout for input/output stats - inputs_outputs_layout[add_after_conv.name] = { + inputs_outputs_layout[add_after_conv.fullname] = { 'layerwise_stat': SQNRStatistic( self.activation_stats, self.q_suffix ) } - inputs_outputs_layout[add_after_conv.name + self.q_suffix] = {} + inputs_outputs_layout[add_after_conv.fullname + self.q_suffix] = {} self._engine.set_model(composite_model) _, accumulated_stats = self._engine.predict(stats_layout=inputs_outputs_layout, @@ -165,10 +168,10 @@ class QuantNoiseEstimator(Algorithm): range(self._config['stat_subset_size']))) qnoise_values.append( self.mean_estimator( - accumulated_stats[add_after_conv.name]['layerwise_stat'] + accumulated_stats[add_after_conv.fullname]['layerwise_stat'] ) ) - node_names.append(conv_node.name) + node_names.append(conv_node.fullname) noise_data = {'noise_metric': qnoise_values, 'layer_name': node_names} if 'results_dump_filename' in self._config: @@ -179,9 +182,9 @@ class QuantNoiseEstimator(Algorithm): cut_fqs = [] cut_model = deepcopy(model) for node in mu.get_nodes_by_type(model, ['FakeQuantize']): - if node.name not in cut_fqs: + if node.fullname not in cut_fqs: cut_model, cut_fq_layers, _ = self._graph_transformer.remove_fq_nodes( - cut_model, [node.name] + cut_model, [node.fullname] ) cut_fqs += cut_fq_layers return cut_model diff --git a/tools/pot/openvino/tools/pot/algorithms/quantization/qnoise_estimator/utils.py b/tools/pot/openvino/tools/pot/algorithms/quantization/qnoise_estimator/utils.py index 7210b71f789..c52c199427e 100644 --- a/tools/pot/openvino/tools/pot/algorithms/quantization/qnoise_estimator/utils.py +++ b/tools/pot/openvino/tools/pot/algorithms/quantization/qnoise_estimator/utils.py @@ -22,12 +22,12 @@ def get_composite_model(model, quantized_model, quantized_suffix='_quantized'): composite_model = model_disjoint_union(model, quantized_model) fq_inputs = [ node - for node in get_nodes_by_type(composite_model, ['Parameter']) + for node in get_nodes_by_type(composite_model, ['Parameter'], recursively=False) if quantized_suffix not in node.name ] q_inputs = [ node - for node in get_nodes_by_type(composite_model, ['Parameter']) + for node in get_nodes_by_type(composite_model, ['Parameter'], recursively=False) if quantized_suffix in node.name ] for fp_input_node, q_input_node in zip(fq_inputs, q_inputs): diff --git a/tools/pot/openvino/tools/pot/algorithms/quantization/ranger/algorithm.py b/tools/pot/openvino/tools/pot/algorithms/quantization/ranger/algorithm.py index 771e0f75a38..191fdc5c61b 100644 --- a/tools/pot/openvino/tools/pot/algorithms/quantization/ranger/algorithm.py +++ b/tools/pot/openvino/tools/pot/algorithms/quantization/ranger/algorithm.py @@ -7,6 +7,7 @@ from ...algorithm_selector import COMPRESSION_ALGORITHMS from ....algorithms.algorithm import Algorithm from ....graph import editor as ge from ....graph import model_utils as mu +from ....graph import node_utils as nu from ....samplers.creator import create_sampler from ....statistics.functions import activations as acf from ....utils.logger import get_logger @@ -39,14 +40,15 @@ class Ranger(Algorithm): act_nodes = mu.get_nodes_by_type(model, self._act_types) for act_node in act_nodes: - if act_node.name not in activation_statistics: - logger.debug('Stats After {} not found!'.format(act_node.name)) + if act_node.fullname not in activation_statistics: + logger.debug('Stats After {} not found!'.format(act_node.fullname)) continue - min_after_act = np.min(activation_statistics[act_node.name]['min_per_tensor']) - max_after_act = np.max(activation_statistics[act_node.name]['max_per_tensor']) + min_after_act = np.min(activation_statistics[act_node.fullname]['min_per_tensor']) + max_after_act = np.max(activation_statistics[act_node.fullname]['max_per_tensor']) clamp_attrs = {'min': min_after_act, 'max': max_after_act} clamp_name = act_node.name + '/min_max_Clamp' clamp_node = ge.create_node(act_node.graph, clamp_name, 'AttributedClamp', clamp_attrs) + clamp_node['fullname'] = nu.reset_node_fullname(act_node.fullname, clamp_name) dest_ports = act_node.out_port(0).get_destinations() act_node.out_port(0).disconnect() @@ -61,8 +63,8 @@ class Ranger(Algorithm): act_nodes = mu.get_nodes_by_type(model, self._act_types) stats_layout = {} for act_node in act_nodes: - stats_layout[act_node.name] = {'max_per_tensor': acf.max_per_tensor, - 'min_per_tensor': acf.min_per_tensor} + stats_layout[act_node.fullname] = {'max_per_tensor': acf.max_per_tensor, + 'min_per_tensor': acf.min_per_tensor} stats_collector.register(self.name, stats_layout, self._sampler) @property diff --git a/tools/pot/openvino/tools/pot/algorithms/quantization/tunable_quantization/algorithm.py b/tools/pot/openvino/tools/pot/algorithms/quantization/tunable_quantization/algorithm.py index 58b8fe8926e..d95d709be45 100644 --- a/tools/pot/openvino/tools/pot/algorithms/quantization/tunable_quantization/algorithm.py +++ b/tools/pot/openvino/tools/pot/algorithms/quantization/tunable_quantization/algorithm.py @@ -72,7 +72,7 @@ class TunableQuantization(MinMaxQuantization): for fq in get_nodes_by_type(model, ['FakeQuantize']): node_input = get_node_input(fq, 0) op_type = 'weights' if node_input.type == 'Const' else 'activations' - fq_node_config = fq_configuration[fq.name][op_type] + fq_node_config = fq_configuration[fq.fullname][op_type] for child_name, child_config in fq_node_config: if child_name not in nodes_config: nodes_config[child_name] = {'weights': [], 'activations': []} diff --git a/tools/pot/openvino/tools/pot/algorithms/quantization/weight_bias_correction/algorithm.py b/tools/pot/openvino/tools/pot/algorithms/quantization/weight_bias_correction/algorithm.py index a60151de049..5d75d9bdc98 100644 --- a/tools/pot/openvino/tools/pot/algorithms/quantization/weight_bias_correction/algorithm.py +++ b/tools/pot/openvino/tools/pot/algorithms/quantization/weight_bias_correction/algorithm.py @@ -35,7 +35,7 @@ class WeightBiasCorrection(Algorithm): for fq in mu.get_nodes_by_type(model, ['FakeQuantize']): node_input = nu.get_node_input(fq, 0) if node_input.type == 'Const': - quantized_weights_layout[fq.name] = {'tensor': lambda tensor: tensor} + quantized_weights_layout[fq.fullname] = {'tensor': lambda tensor: tensor} self._engine.set_model(model) _, quantized_weights = self._engine.predict(quantized_weights_layout, range(1)) @@ -61,7 +61,7 @@ class WeightBiasCorrection(Algorithm): fq_weights_node = nu.get_node_input(op_node, 1) weights_node = nu.get_node_input(fq_weights_node, 0) fp32_weights = weights_node.value * first_conv_scaling_factor - int_weights = quantized_weights[fq_weights_node.name]['tensor'][0] + int_weights = quantized_weights[fq_weights_node.fullname]['tensor'][0] axis = tuple(range(1, len(fp32_weights.shape))) variance_per_channel_shift = np.std(fp32_weights, axis=axis) / ( np.std(int_weights, axis=axis) + safety_eps diff --git a/tools/pot/openvino/tools/pot/algorithms/sparsity/default/utils.py b/tools/pot/openvino/tools/pot/algorithms/sparsity/default/utils.py index e2e78eb259c..dc7a2f32c96 100644 --- a/tools/pot/openvino/tools/pot/algorithms/sparsity/default/utils.py +++ b/tools/pot/openvino/tools/pot/algorithms/sparsity/default/utils.py @@ -35,7 +35,7 @@ def check_model_sparsity_level(model, all_nodes_with_weights = [ node for node in all_nodes_with_weights - if (node.name not in sparsity_ignored_scope) + if (node.fullname not in sparsity_ignored_scope) ] for node in all_nodes_with_weights: weight_node = nu.get_weights_for_node(node) diff --git a/tools/pot/openvino/tools/pot/algorithms/sparsity/layerwise_finetuning/algorithm.py b/tools/pot/openvino/tools/pot/algorithms/sparsity/layerwise_finetuning/algorithm.py index 6abc0187765..6063b2ee0d5 100644 --- a/tools/pot/openvino/tools/pot/algorithms/sparsity/layerwise_finetuning/algorithm.py +++ b/tools/pot/openvino/tools/pot/algorithms/sparsity/layerwise_finetuning/algorithm.py @@ -143,8 +143,8 @@ class SparseModelFinetuning(LayerwiseModelFinetuning): def _collect_nodes_to_tune(self, modified_model): nodes_to_tune = {} for op_node in mu.get_nodes_by_type(modified_model, self._weighted_operations): - if op_node.name not in self._tconf['tuning_ignored_scope']: - nodes_to_tune[op_node.name] = { + if op_node.fullname not in self._tconf['tuning_ignored_scope']: + nodes_to_tune[op_node.fullname] = { 'type': op_node.type, 'params': {} } @@ -158,8 +158,8 @@ class SparseModelFinetuning(LayerwiseModelFinetuning): op_node = mu.get_node_by_name(modified_model, op_name) wrapped_op, params = self._wrap_node(op_node, LinearModule, op_info['params']) if wrapped_op: - wrapped_ops[op_node.name] = wrapped_op - ops_parameters[op_node.name] = params + wrapped_ops[op_node.fullname] = wrapped_op + ops_parameters[op_node.fullname] = params return wrapped_ops, ops_parameters def _fallback_to_baseline(self): diff --git a/tools/pot/openvino/tools/pot/algorithms/sparsity/magnitude_sparsity/algorithm.py b/tools/pot/openvino/tools/pot/algorithms/sparsity/magnitude_sparsity/algorithm.py index a565d17e5fb..ca8c8db8bcd 100644 --- a/tools/pot/openvino/tools/pot/algorithms/sparsity/magnitude_sparsity/algorithm.py +++ b/tools/pot/openvino/tools/pot/algorithms/sparsity/magnitude_sparsity/algorithm.py @@ -58,7 +58,7 @@ class MagnitudeSparsity(Algorithm): self._safety_eps_variance_factor, ) conv_node = get_node_output(node, 0)[0] - self.sparsity_levels_per_layer[conv_node.name] = node_sparsity_mask.mean() + self.sparsity_levels_per_layer[conv_node.fullname] = node_sparsity_mask.mean() self.statistics_table = self._sparsity_statistics(model) return model @@ -87,7 +87,7 @@ class MagnitudeSparsity(Algorithm): if self.ignored_scope is not None: all_nodes_with_weights = [node for node in all_nodes_with_weights - if node.name not in self.ignored_scope] + if node.fullname not in self.ignored_scope] for node in all_nodes_with_weights: if model.is_node_ignored(self.ignored_params, node, skipped=False): @@ -166,8 +166,8 @@ class MagnitudeSparsity(Algorithm): weight_tensor = self._get_weights_value(node) drow['Weight tensor shape'] = list(weight_tensor.shape) conv_node = get_node_output(node, 0)[0] - drow['Layer name'] = conv_node.name - drow['Sparsity rate'] = 100 * self.sparsity_levels_per_layer[conv_node.name] + drow['Layer name'] = conv_node.fullname + drow['Sparsity rate'] = 100 * self.sparsity_levels_per_layer[conv_node.fullname] row = [drow[h] for h in header] data.append(row) diff --git a/tools/pot/openvino/tools/pot/algorithms/utils.py b/tools/pot/openvino/tools/pot/algorithms/utils.py new file mode 100644 index 00000000000..86bf0f0d3d8 --- /dev/null +++ b/tools/pot/openvino/tools/pot/algorithms/utils.py @@ -0,0 +1,15 @@ +# Copyright (C) 2020-2021 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +def process_ignored_scope(ignored_scope): + """ Returns ignored scope with names containing all nested subgraphs for nodes + :param ignored_scope: ignored_scope from algorithm specific config + :return ignored scope with fullnames for nodes + """ + ignored_scope_with_fullnames = [] + for layer in ignored_scope: + if isinstance(layer, (tuple, list)): + ignored_scope_with_fullnames.append('|'.join(layer)) + else: + ignored_scope_with_fullnames.append(layer) + return ignored_scope_with_fullnames diff --git a/tools/pot/openvino/tools/pot/data_loaders/creator.py b/tools/pot/openvino/tools/pot/data_loaders/creator.py index fd0aef7315e..14e76e92f00 100644 --- a/tools/pot/openvino/tools/pot/data_loaders/creator.py +++ b/tools/pot/openvino/tools/pot/data_loaders/creator.py @@ -13,7 +13,7 @@ def create_data_loader(config, model): :return: instance of DataLoader descendant class """ - inputs = get_nodes_by_type(model, ['Parameter']) + inputs = get_nodes_by_type(model, ['Parameter'], recursively=False) if len(inputs) > 1 and\ not any([tuple(i.shape) == (1, 3) for i in inputs]): diff --git a/tools/pot/openvino/tools/pot/engines/ac_engine.py b/tools/pot/openvino/tools/pot/engines/ac_engine.py index 8791dae3179..47ce1b57110 100644 --- a/tools/pot/openvino/tools/pot/engines/ac_engine.py +++ b/tools/pot/openvino/tools/pot/engines/ac_engine.py @@ -9,7 +9,8 @@ from functools import partial import numpy as np -from .utils import append_stats, process_accumulated_stats +from .utils import append_stats, process_accumulated_stats, \ + restore_original_node_names, align_stat_names_with_results from ..api.engine import Engine from ..data_loaders.ac_data_loader import ACDataLoader from ..graph.model_utils import save_model, add_outputs @@ -122,12 +123,20 @@ class ACEngine(Engine): callback_layout, stat_names_aliases = {}, {} # add outputs for activation statistics collection if stats_layout is not None: - model_with_stat_op, nodes_name = self._statistic_graph_builder.\ + model_with_stat_op, nodes_name, output_to_node_names = self._statistic_graph_builder.\ insert_statistic(copy.deepcopy(self._nx_model), stats_layout, stat_aliases) self.set_model(model_with_stat_op) add_outputs(self._model, nodes_name) self._model_evaluator.load_network(self._model) + + model_output_names = [out for m_dict in self._model for out in m_dict['model'].outputs.keys()] + align_stat_names_with_results(model_output_names, + nodes_name, + output_to_node_names, + stats_layout, + stat_aliases) + # Creating statistics layout with IE-like names stat_names_aliases = {convert_output_key(key): key for key in stats_layout} callback_layout = {convert_output_key(key): value @@ -189,6 +198,9 @@ class ACEngine(Engine): self._per_sample_metrics.clear() self.dump_prediction_to_annotation = False + if stats_layout: + restore_original_node_names(output_to_node_names, accumulated_stats, stats_layout, stat_aliases) + return metrics, accumulated_stats def _load_model(self, paths): diff --git a/tools/pot/openvino/tools/pot/engines/ie_engine.py b/tools/pot/openvino/tools/pot/engines/ie_engine.py index 1267facb6a6..5fc59655e95 100644 --- a/tools/pot/openvino/tools/pot/engines/ie_engine.py +++ b/tools/pot/openvino/tools/pot/engines/ie_engine.py @@ -9,7 +9,8 @@ import copy import numpy as np from openvino.inference_engine import IECore, StatusCode # pylint: disable=E0611 -from .utils import append_stats, process_accumulated_stats +from .utils import append_stats, process_accumulated_stats, \ + restore_original_node_names, align_stat_names_with_results from ..api.engine import Engine from ..graph.model_utils import save_model from ..samplers.batch_sampler import BatchSampler @@ -90,11 +91,19 @@ class IEEngine(Engine): stat_names_aliases = None if stats_layout: - model_with_stat_op, nodes_name = self._statistic_graph_builder.\ + model_with_stat_op, nodes_name, output_to_node_names = self._statistic_graph_builder.\ insert_statistic(copy.deepcopy(self._nx_model), stats_layout, stat_aliases) self.set_model(model_with_stat_op) self._add_outputs(nodes_name) + + model_output_names = self._model.outputs.keys() + align_stat_names_with_results(model_output_names, + nodes_name, + output_to_node_names, + stats_layout, + stat_aliases) + # Creating statistics layout with IE-like names stats_layout, stat_names_aliases = self._convert_stats_names(stats_layout) @@ -109,6 +118,9 @@ class IEEngine(Engine): process_accumulated_stats(accumulated_stats=self._accumulated_layer_stats, stat_names_aliases=stat_names_aliases) + if stats_layout: + restore_original_node_names(output_to_node_names, accumulated_stats, stats_layout, stat_aliases) + # Calculate metrics of required type. Reset collected statistics metrics = None if self._metric: diff --git a/tools/pot/openvino/tools/pot/engines/utils.py b/tools/pot/openvino/tools/pot/engines/utils.py index a3fa808924b..fd9cf941144 100644 --- a/tools/pot/openvino/tools/pot/engines/utils.py +++ b/tools/pot/openvino/tools/pot/engines/utils.py @@ -64,7 +64,7 @@ def get_per_layer_stat_mapping(stats_layout): for stat_name, _ in stats.items(): layer_stat_name = layer if hasattr(stat_name, 'kwargs') and stat_name.kwargs.get('inplace_statistics', False): - layer_stat_name = stat_name.kwargs['type'] + '_' + layer + layer_stat_name = stat_name.kwargs.get('layer_stat_name', stat_name.kwargs['type'] + '_' + layer) old_names_mapping[layer_stat_name], stat_names_by_layer[layer_stat_name] = layer, stat_name return stat_names_by_layer, old_names_mapping @@ -76,7 +76,7 @@ def get_inplace_stats_mapping(stats_layout): for stat_name, _ in stats.items(): layer_stat_name = layer if hasattr(stat_name, 'kwargs') and stat_name.kwargs.get('inplace_statistics', False): - layer_stat_name = stat_name.kwargs['type'] + '_' + layer + layer_stat_name = stat_name.kwargs.get('layer_stat_name', stat_name.kwargs['type'] + '_' + layer) if layer not in old_name_stat_new_name: old_name_stat_new_name[layer] = {stat_name: layer_stat_name} else: @@ -100,3 +100,36 @@ def get_sequential_activations(activations, layer, activation_seq, stats_layout, activation_seq[layer].append(activations) elif old_names_mapping.get(layer, None) in stats_layout and callable(stat_names_by_layer[layer]): activation_seq[layer].append(activations) + + +def update_stats(stats_layout: dict, stat_aliases: dict, old_key: str, new_key: str): + stats_layout[new_key] = stats_layout.pop(old_key) + for algo_name in stat_aliases: + if old_key in stat_aliases[algo_name]: + stat_aliases[algo_name][new_key] = stat_aliases[algo_name].pop(old_key) + + +def restore_original_node_names(output2node, accumulated_stats, stats_layout, stat_aliases): + if output2node and stats_layout: + for out_name, original_node_name in output2node.items(): + accumulated_stats[original_node_name] = accumulated_stats.pop(out_name) + update_stats(stats_layout, stat_aliases, out_name, original_node_name) + + +def align_stat_names_with_results(result_names, nodes_name, output2node, stats_layout, stat_aliases): + """ Change node name in stast to result name if in the original model the subgraph had 1 output, + but after adding outputs in the subgraph, the number of output ports increased. + For such nodes, it is necessary to add a '.0' to the original output name + :param: result_names: names of Result nodes + :param: nodes_name: node name in graph + :param: output2node: a dict storing the matching of the result to the node + :param: stats_layout: dict of stats collection functions + :param: stat_aliases: dict of algorithms collections stats + """ + if output2node: + for original_out_name in nodes_name: + if original_out_name not in result_names and (original_out_name, 0) not in stats_layout: + out_name_with_port = original_out_name + '.0' + assert out_name_with_port in result_names + update_stats(stats_layout, stat_aliases, original_out_name, out_name_with_port) + output2node[out_name_with_port] = original_out_name diff --git a/tools/pot/openvino/tools/pot/graph/builder.py b/tools/pot/openvino/tools/pot/graph/builder.py index 368d90f8847..1a2adf03910 100644 --- a/tools/pot/openvino/tools/pot/graph/builder.py +++ b/tools/pot/openvino/tools/pot/graph/builder.py @@ -2,11 +2,12 @@ # SPDX-License-Identifier: Apache-2.0 from copy import deepcopy +import numpy as np from mo.graph.graph import Graph -from openvino.tools.pot.graph.node_utils import get_node_inputs -from .editor import create_node, connect_nodes_by_name +from openvino.tools.pot.graph.node_utils import get_node_input, get_node_inputs +from .editor import create_node, connect_nodes_by_name, get_node_by_name def build_graph(graph_attrs, meta_data, nodes, edges): @@ -139,4 +140,12 @@ def build_graph_for_node(model, input_name, input_shape, node, remove_bias=False edges.append((node.name, result_name, {'out': 0, 'in': 0})) graph = build_graph(*make_copy_graph_attrs(model, input_name, input_shape), nodes, edges) graph.ir_v10 = True + + # Add the neccessary attribute to the new graph + src_node = get_node_by_name(graph, node.name) + weights_node = get_node_input(src_node, 1) + weights_node = get_node_input(weights_node, 0) \ + if weights_node.type == 'FakeQuantize' else weights_node + if weights_node.out_port(0).get_data_type() == np.float16: + weights_node.out_node(0)['Insert_Convert_operation_after'] = True return graph diff --git a/tools/pot/openvino/tools/pot/graph/editor.py b/tools/pot/openvino/tools/pot/graph/editor.py index ed407b4262f..a0b6ae972ba 100644 --- a/tools/pot/openvino/tools/pot/graph/editor.py +++ b/tools/pot/openvino/tools/pot/graph/editor.py @@ -1,11 +1,32 @@ # Copyright (C) 2020-2021 Intel Corporation # SPDX-License-Identifier: Apache-2.0 +from functools import partial + from mo.graph.graph import Graph, Node +from mo.middle.pattern_match import for_graph_and_each_sub_graph_recursively from .ops import OPERATIONS +class FunctionResultsAccumulator: + """ + Run function on graph and store each call result in the list + """ + def __init__(self, func): + self._results = [] + self._func = func + + @property + def results(self): + return self._results + + def __call__(self, graph): + result = self._func(graph) + if not result is None: + self._results.extend(result) + + def find_node(graph: Graph, name): """ Get node by name :param graph: NetworkX model to search in @@ -19,13 +40,27 @@ def find_node(graph: Graph, name): return None -def get_node_by_name(graph: Graph, name: str) -> Node: +# TODO: set recursively = True to enable subgraphs quantization +def get_node_by_name(graph: Graph, name: str, recursively: bool = False) -> Node: """ Returns node by name :param graph: NetworkX model to take node :param name: name of the node + :param recursively: whether return all nodes from the graph + and each subgraph or only from the external graph :return node from NetworkX model (of type Node or None if there's no such node) """ - node = graph.get_op_nodes(name=name) + if recursively: + def get_node_by_fullname(graph: Graph, name: str) -> Node: + nodes = graph.get_nodes_with_attributes(**dict(kind='op', fullname=name)) + return [Node(graph, nodes[0])] if nodes else None + + partial_get_node_by_fullname = partial(get_node_by_fullname, name=name) + get_node_by_fullname_func = FunctionResultsAccumulator(partial_get_node_by_fullname) + for_graph_and_each_sub_graph_recursively(graph, get_node_by_fullname_func) + node = get_node_by_fullname_func.results + else: + node = graph.get_op_nodes(name=name) + return node[0] if node else None @@ -59,37 +94,70 @@ def connect_nodes_by_name(graph: Graph, src_node_name, src_port, dst_node_name, :param dst_node_name: name of the destination node :param dst_port: index of the port for destination node """ - src_node = get_node_by_name(graph, src_node_name) + src_node = get_node_by_name(graph, src_node_name, recursively=False) if src_node is None: raise Exception('There\'s no node with {} name'.format(src_node_name)) - dst_node = get_node_by_name(graph, dst_node_name) + dst_node = get_node_by_name(graph, dst_node_name, recursively=False) if dst_node is None: raise Exception('There\'s no node with {} name'.format(dst_node_name)) connect_nodes(src_node, src_port, dst_node, dst_port) -def get_all_operation_nodes(graph: Graph): +# TODO: set recursively = True to enable subgraphs quantization +def get_all_operation_nodes(graph: Graph, recursively: bool = False): """ Returns sequence of all nodes in graph :param graph: NetworkX model to take nodes + :param recursively: whether return all nodes from the graph + and each subgraph or only from the external graph :return list of all nodes """ + if recursively: + get_all_op_nodes_func = FunctionResultsAccumulator(lambda graph: graph.get_op_nodes()) + for_graph_and_each_sub_graph_recursively(graph, get_all_op_nodes_func) + return get_all_op_nodes_func.results + return graph.get_op_nodes() -def get_nodes_by_type(graph: Graph, types: list): +# TODO: set recursively = True to enable subgraphs quantization +def get_nodes_by_type(graph: Graph, types: list, recursively: bool = False) -> list: """ Returns all nodes with type from types collection :param graph: NetworkX model to collect nodes :param types: list of required types + :param recursively: whether return all nodes from the graph + and each subgraph or only from the main graph :return list of nodes filtered by 'types' collection """ - nodes = [] - for t in types: - for node in graph.get_op_nodes(type=t): - nodes.append(node) + def get_nodes_by_type_from_main_graph(graph, types): + return [node for t in types for node in graph.get_op_nodes(type=t)] + + if recursively: + partial_get_nodes_by_type = partial(get_nodes_by_type_from_main_graph, types=types) + get_nodes_by_type_recursively = FunctionResultsAccumulator(partial_get_nodes_by_type) + for_graph_and_each_sub_graph_recursively(graph, get_nodes_by_type_recursively) + nodes = [node for node in get_nodes_by_type_recursively.results if node] + else: + nodes = get_nodes_by_type_from_main_graph(graph, types) return nodes +def add_fullname_for_nodes(graph: Graph): + def set_fullname(graph, subgraphs=None): + if subgraphs is None: + subgraphs = [] + for node in graph: + node = Node(graph, node) + if node.has_valid('sub_graphs'): + for sub_graph_name in node.sub_graphs: + subgraphs.append(node.name) + set_fullname(node[sub_graph_name], subgraphs) + subgraphs = subgraphs[:-1] + node['fullname'] = '|'.join(subgraphs + [node.name]) + + set_fullname(graph) + + def create_node(graph: Graph, node_name, node_type, node_attrs): """ Create node in graph :param graph: NetworkX model diff --git a/tools/pot/openvino/tools/pot/graph/graph_utils.py b/tools/pot/openvino/tools/pot/graph/graph_utils.py index 86d9473b943..e6a1daf3bf5 100644 --- a/tools/pot/openvino/tools/pot/graph/graph_utils.py +++ b/tools/pot/openvino/tools/pot/graph/graph_utils.py @@ -10,7 +10,7 @@ from mo.utils.logger import init_logger from openvino.inference_engine import IECore # pylint: disable=E0611 from openvino.offline_transformations import ApplyPOTTransformations # pylint: disable=import-error,no-name-in-module -from ..graph.passes import ModelPreprocessor +from ..graph.passes import ModelPreprocessor, remove_converts, add_removed_converts from ..utils.logger import stdout_redirect init_logger('ERROR', False) @@ -47,6 +47,7 @@ def load_graph(model_config, target_device='ANY'): graph_from_ir.meta_data = meta_data graph_from_ir.ir_v10 = True graph_from_ir.graph['cmd_params'] = orig_graph_from_ir.graph['cmd_params'] + remove_converts(graph_from_ir) model_preprocessing(graph_from_ir) if os.path.exists(serialized_xml_path): os.remove(serialized_xml_path) @@ -71,8 +72,9 @@ def save_graph(graph: Graph, save_path, model_name=None): if not os.access(save_path, os.W_OK): raise PermissionError( 'Output directory {} is not writable for the current user. '.format(save_path)) - - save_restored_graph(graph=deepcopy(graph), path=save_path, meta_data=graph.meta_data, + graph_copy = deepcopy(graph) + add_removed_converts(graph_copy) + save_restored_graph(graph=graph_copy, path=save_path, meta_data=graph.meta_data, name=model_name) diff --git a/tools/pot/openvino/tools/pot/graph/model_utils.py b/tools/pot/openvino/tools/pot/graph/model_utils.py index cd0e9eb568f..1f29a66486b 100644 --- a/tools/pot/openvino/tools/pot/graph/model_utils.py +++ b/tools/pot/openvino/tools/pot/graph/model_utils.py @@ -52,18 +52,21 @@ def compress_model_weights(model: NXModel): compress_weights(model_dict['model']) -def get_nodes_by_type(model: NXModel, types: list): +# TODO: set recursively = True to enable subgraphs quantization +def get_nodes_by_type(model: NXModel, types: list, recursively: bool = False): """ Returns all nodes with type from types collection :param model: NXModel model :param types: list of required types + :param recursively: whether return all nodes from the model + and each subgraph or only from the external model :return list of nodes filtered by 'types' collection """ return [node for model_dict in model.models - for node in ge.get_nodes_by_type(model_dict['model'], types)] + for node in ge.get_nodes_by_type(model_dict['model'], types, recursively)] def get_node_by_name(model: NXModel, name: str) -> Node: - """ Returns node by name + """ Returns node by name found in the graph and each subgraph :param model: NXModel model :param name: name of the node :return node from model (of type Node or None if there's no such node) @@ -77,13 +80,16 @@ def get_node_by_name(model: NXModel, name: str) -> Node: return names[0] if names else None -def get_all_operation_nodes(model: NXModel): +# TODO: set recursively = True to enable subgraphs quantization +def get_all_operation_nodes(model: NXModel, recursively: bool = False): """ Returns sequence of all nodes in all graphs :param model: NXModel model + :param recursively: whether return all nodes from the model + and each subgraph or only from the external model :return list of all nodes """ return [node for model_dict in model.models - for node in ge.get_all_operation_nodes(model_dict['model'])] + for node in ge.get_all_operation_nodes(model_dict['model'], recursively)] def build_model_for_node(nx_model, input_name, input_shape, node, remove_bias=False, diff --git a/tools/pot/openvino/tools/pot/graph/node_utils.py b/tools/pot/openvino/tools/pot/graph/node_utils.py index b5bdbc335ca..51cae922f43 100644 --- a/tools/pot/openvino/tools/pot/graph/node_utils.py +++ b/tools/pot/openvino/tools/pot/graph/node_utils.py @@ -23,7 +23,8 @@ def get_node_input_ports(node: Node): :return: list of node inputs """ sources_ports = [parent.get_source() for parent in node.in_ports().values()] - return [port if port is not None else None for port in sources_ports] + return [port for port in sources_ports if port is not None] + def get_node_input(node: Node, in_port: int): """ @@ -191,10 +192,10 @@ def get_quantized_input_key(quantized_node): Otherwise, key is tuple (fq_input name, output port number) """ quantized_input = get_node_input(quantized_node, 0) - key = quantized_input.name + key = quantized_input.fullname if len(quantized_input.out_ports()) > 1: port_number = quantized_node.in_port(0).get_source().out - key = (quantized_input.name, port_number) + key = (quantized_input.fullname, port_number) return key @@ -271,3 +272,7 @@ def get_node_data_type(node): and node.in_port(0).get_source().is_data_type_defined(): return node.in_port(0).get_source().get_data_type() return None + + +def reset_node_fullname(old_fullname, node_name): + return '|'.join(old_fullname.split('|')[:-1] + [node_name]) diff --git a/tools/pot/openvino/tools/pot/graph/nx_model.py b/tools/pot/openvino/tools/pot/graph/nx_model.py index 2898e268550..1767a96b1a1 100644 --- a/tools/pot/openvino/tools/pot/graph/nx_model.py +++ b/tools/pot/openvino/tools/pot/graph/nx_model.py @@ -5,6 +5,7 @@ import os from copy import deepcopy from addict import Dict import networkx as nx +from mo.graph.graph import rename_node from openvino.tools.pot.graph.graph_utils import load_graph, save_graph from openvino.tools.pot.graph import editor as ge @@ -42,6 +43,9 @@ class NXModel: raise TypeError('Unable to load models. Invalid keyword argument. ' 'Either model config (config=) or NetworkX graph (graph=) is expected.') + for model in self._models: + ge.add_fullname_for_nodes(model['model']) + def _from_config(self, model_config, target_device='ANY'): if not isinstance(model_config, Dict): model_config = Dict(model_config) @@ -59,8 +63,11 @@ class NXModel: self._is_cascade = len(self._models) > 1 if self._is_cascade: self._add_models_prefix() + for model in self._models: + ge.add_fullname_for_nodes(model['model']) def _from_graph(self, graph): + ge.add_fullname_for_nodes(graph) self._models.append({'model': graph}) self._is_cascade = False @@ -134,7 +141,7 @@ class NXModel: def get_final_output_nodes(self): """Returns list of Result nodes from the last model of cascade""" last_model = self._models[-1]['model'] - return ge.get_nodes_by_type(last_model, ['Result']) + return ge.get_nodes_by_type(last_model, ['Result'], recursively=False) def clean_up(self): for model_dict in self._models: @@ -178,8 +185,8 @@ class NXModel: self._prefix_is_applied = True for model_dict in self._models: model_name, model = model_dict['name'], model_dict['model'] - for node in ge.get_all_operation_nodes(model): - node.name = '{}_{}'.format(model_name, node.name) + for node in ge.get_all_operation_nodes(model, recursively=False): + rename_node(node, f'{model_name}_{node.name}') def _remove_models_prefix(self): """Removes model name prefix from node names""" @@ -188,9 +195,9 @@ class NXModel: for model_dict in self._models: model_name, model = model_dict['name'], model_dict['model'] self._cache.node_names[model_name] = [] - for node in ge.get_all_operation_nodes(model): + for node in ge.get_all_operation_nodes(model, recursively=False): if node.name.startswith(model_name): - node.name = node.name.replace(model_name + '_', '', 1) + rename_node(node, node.name.replace(model_name + '_', '', 1)) self._cache.node_names[model_name].append(node.name) def _restore_models_prefix(self): @@ -199,7 +206,7 @@ class NXModel: self._prefix_is_applied = True for model_dict in self._models: model_name, model = model_dict['name'], model_dict['model'] - for node in ge.get_all_operation_nodes(model): + for node in ge.get_all_operation_nodes(model, recursively=False): if node.name in self._cache.node_names[model_name]: - node.name = '{}_{}'.format(model_name, node.name) + rename_node(node, f'{model_name}_{node.name}') self._cache.pop('node_names') diff --git a/tools/pot/openvino/tools/pot/graph/passes.py b/tools/pot/openvino/tools/pot/graph/passes.py index 100eac8ab4e..1c8f11a55a4 100644 --- a/tools/pot/openvino/tools/pot/graph/passes.py +++ b/tools/pot/openvino/tools/pot/graph/passes.py @@ -13,13 +13,15 @@ import numpy as np from extensions.back.ForceStrictPrecision import ForceStrictPrecision from extensions.back.compress_quantized_weights import CompressQuantizeWeights from extensions.ops.elementwise import Add +from extensions.ops.Cast import Cast from extensions.ops.fakequantize import FakeQuantize from mo.back.replacement import BackReplacementPattern from mo.front.common.replacement import FrontReplacementSubgraph -from mo.graph.graph import Graph, Node +from mo.graph.graph import Graph, Node, rename_node from mo.graph.port import Port from mo.middle.pattern_match import apply_pattern from mo.ops.const import Const +from mo.middle.passes.convert_data_type import convert_blob from mo.middle.passes.infer import type_infer from . import editor as ge @@ -111,7 +113,7 @@ class InsertFakeQuantize(BackReplacementPattern): @staticmethod def quantize_only_input(node: Node): if node.type in ['Interpolate', 'Power', 'ReduceMean', 'NormalizeL2', - 'Assign', 'PReLU', 'ReLU', 'Sigmoid', 'Tanh', 'Clamp']: + 'Assign', 'PReLU', 'ReLU', 'Sigmoid', 'Tanh', 'Clamp', 'MVN']: return True # ScaleSift case, FQ only for input if node.type == 'Multiply' and nu.check_input_data_is_const(node, 1): @@ -129,6 +131,8 @@ class InsertFakeQuantize(BackReplacementPattern): if m_op.type in ['Convolution', 'ConvolutionBackpropData', 'MatMul']: insert_fake_quantize(graph, m_op, [0, 1], ['fq_input', 'fq_weights']) + elif m_op.type == 'LSTMCell': + insert_fake_quantize(graph, m_op, [0, 1, 2, 3, 4]) elif self.quantize_only_input(m_op): insert_fake_quantize(graph, m_op, [0]) else: @@ -343,7 +347,7 @@ class FakeQuantizePropagation(BackReplacementPattern): _skip_multibranch_ascent_ops[name] = skip_ascent_map[name] else: _skip_multibranch_ascent_ops[name] = _is_node_skippable( - ge.get_node_by_name(graph, name), skip_ascent_map) + ge.get_node_by_name(graph, name, recursively=False), skip_ascent_map) skip_ascent_map.update(_skip_multibranch_ascent_ops) return any(_skip_multibranch_ascent_ops.values()) @@ -409,7 +413,7 @@ class FakeQuantizeOptimization(BackReplacementPattern): class RemoveFakeQuantize: def find_and_remove_node(self, graph, node_name, force=False): - node = ge.get_node_by_name(graph, node_name) + node = ge.get_node_by_name(graph, node_name, recursively=False) if not node: return [], [] @@ -506,9 +510,11 @@ class RemoveFakeQuantize: @staticmethod def undo_renaming(graph, fq_node): if 'orig_fq_name' in fq_node: - node = ge.get_node_by_name(graph, '{fq_name}/pre_fq_input'.format(fq_name=fq_node.name)) - node.name = node['orig_node_name'] - fq_node.name = fq_node['orig_fq_name'] + node = ge.get_node_by_name(graph, + '{fq_name}/pre_fq_input'.format(fq_name=fq_node.fullname), + recursively=False) + rename_node(node, node['orig_node_name']) + rename_node(fq_node, fq_node['orig_fq_name']) @property def quantize_agnostic_operations(self): @@ -654,15 +660,15 @@ class FakeQuantizeNameSwapper(BackReplacementPattern): new_fq_name = copy(input_node['orig_node_name']) input_node_outputs = get_all_node_outputs(input_node) - if all([op.type == 'FakeQuantize' for op in input_node_outputs]): + if len(input_node_outputs) > 1 and all([op.type == 'FakeQuantize' for op in input_node_outputs]): new_fq_name += '.{}'.format(fq_node.in_port(0).get_source().idx) fq_node['orig_fq_name'] = copy(fq_node.name) - fq_node.name = copy(new_fq_name) + rename_node(fq_node, new_fq_name) if 'orig_node_name' not in input_node: input_node['orig_node_name'] = copy(input_node.name) - input_node.name = '{original_name}/pre_fq_input'.format(original_name=input_node.name) + rename_node(input_node, f'{input_node.name}/pre_fq_input') pattern = get_fq_result_pattern() apply_pattern( @@ -704,6 +710,7 @@ def create_bias_node(graph: Graph, src_node): for destination_port in destination_ports: add_op.out_port(0).connect(destination_port) + add_bias.out_node(0)['Insert_Convert_operation_after'] = True def create_fake_quantize_node(graph: Graph, name): @@ -878,3 +885,39 @@ def find_shape_subgraph_endpoints(out_ports: List[Port], visited: set = None) -> visited_nodes.add(in_port.node) visited.add(in_port) return visited_nodes + + +def remove_converts(graph: Graph): + for op in graph.get_op_nodes(type='Convert'): + source_op = op.in_port(0).get_source().node + if source_op.type == 'Const' and source_op.data_type == np.float16: + # Get access to data node after Convert operation and set Insert_Convert_operation_after + # to restore Convert operation later + op.out_node(0)['Insert_Convert_operation_after'] = True + # Mark Const and Convert operation to fold them + source_op['need_shape_inference'] = True + op['stop_value_propagation'] = False + op['need_shape_inference'] = True + graph.clean_up() + + +def add_removed_converts(graph: Graph): + for data_node_name in graph.get_nodes_with_attributes(Insert_Convert_operation_after=True): + data_node = Node(graph, data_node_name) + # Get access to Const node connected to data node + const_op = data_node.in_node(0) + assert const_op.data_type == np.float32, "Error when try to insert Convert operation after Const: {}".\ + format(const_op.soft_get('name')) + + convert_op = Cast(graph, {'dst_type': np.float32, + 'name': const_op.name + '/restored_convert', + 'stop_value_propagation': True}).create_node() + + # Insert Convert operation after Const operation + consumer_port = const_op.out_port(0).get_connection().get_destination() + const_op.out_port(0).get_connection().set_destination(convert_op.in_port(0)) + convert_op.out_port(0).connect(consumer_port) + + # Convert Const value to FP32 to make types in graph consistent + const_op.value, _, _ = convert_blob(const_op.value, np.float16) + const_op.infer(const_op) diff --git a/tools/pot/openvino/tools/pot/graph/transformer.py b/tools/pot/openvino/tools/pot/graph/transformer.py index 44e1fb4e8e8..179b6c3c392 100644 --- a/tools/pot/openvino/tools/pot/graph/transformer.py +++ b/tools/pot/openvino/tools/pot/graph/transformer.py @@ -1,6 +1,7 @@ # Copyright (C) 2020-2021 Intel Corporation # SPDX-License-Identifier: Apache-2.0 +from .editor import add_fullname_for_nodes from .special_operations import QUANTIZE_AGNOSTIC_OPERATIONS from .passes import InsertFakeQuantize, FakeQuantizePropagation, FakeQuantizeOptimization, RemoveFakeQuantize, \ SpecialBlocksMarker, FakeQuantizeNameSwapper @@ -68,6 +69,10 @@ class GraphTransformer: self.fq_insertion.ignored_params = ignored_params_[model_dict['name']] if model.is_cascade \ else ignored_params_ self._insert_fake_quantize(model_dict['model']) + # TODO: Uncomment to enable subgraphs quantization + # from mo.middle.pattern_match import for_graph_and_each_sub_graph_recursively + # for_graph_and_each_sub_graph_recursively(model_dict['model'], self._insert_fake_quantize) + add_fullname_for_nodes(model_dict['model']) return model def _remove_fq_nodes(self, graph, node_names, force=False): diff --git a/tools/pot/openvino/tools/pot/graph/utils.py b/tools/pot/openvino/tools/pot/graph/utils.py index bce43fd8823..0067b56d693 100644 --- a/tools/pot/openvino/tools/pot/graph/utils.py +++ b/tools/pot/openvino/tools/pot/graph/utils.py @@ -142,7 +142,7 @@ def is_ignored(ignored_params, op, skipped=True): """ if ignored_params.get('skip_model') or \ skipped and 'skipped' in op and op['skipped'] or\ - op.name in ignored_params['scope']: + op.fullname in ignored_params['scope']: return True for operation in ignored_params['operations']: if op.type == operation['type']: @@ -188,7 +188,7 @@ def check_agnostic_and_ignored_params(model, ignored_params): children = [node for node in get_all_node_outputs(node) if node is not None] for child in children: if child not in quantize_agnostic: - ignored_params['scope'].append(child.name) + ignored_params['scope'].append(child.fullname) else: add_new_ignored_params(model, node, quantize_agnostic,\ ignored_params, model_is_cascade) @@ -200,7 +200,7 @@ def check_agnostic_and_ignored_params(model, ignored_params): ignored_params_operation = [op['type'] for op in dict_ignored_operation_model['operations']] for node in model_dict['model'].get_op_nodes(): - if (node.type in ignored_params_operation or node.name in dict_ignored_operation_model['scope']) \ + if (node.type in ignored_params_operation or node.fullname in dict_ignored_operation_model['scope']) \ and node.type in quantize_agnostic: new_ignored_params = add_new_ignored_params(model_dict['model'], node, diff --git a/tools/pot/openvino/tools/pot/statistics/statistic_graph_builder.py b/tools/pot/openvino/tools/pot/statistics/statistic_graph_builder.py index 6e537a29604..d66c962fbe8 100644 --- a/tools/pot/openvino/tools/pot/statistics/statistic_graph_builder.py +++ b/tools/pot/openvino/tools/pot/statistics/statistic_graph_builder.py @@ -1,94 +1,148 @@ # Copyright (C) 2020-2021 Intel Corporation # SPDX-License-Identifier: Apache-2.0 +from copy import deepcopy +from mo.ops.op import Op from mo.ops.result import Result from mo.front.tf.graph_utils import create_op_node_with_second_input from mo.front.common.partial_infer.utils import int64_array + +try: + from extensions.back.add_outputs_recursive import AddOutputRecursive +except ImportError: + pass # we try to import AddOutputRecursive for subgraphs quantization + from extensions.ops.ReduceOps import ReduceMin, ReduceMax, ReduceMean from extensions.ops.activation_ops import Abs from ..graph.model_utils import get_node_by_name -from ..graph.node_utils import get_output_shape +from ..graph.node_utils import get_output_shape, reset_node_fullname from ..statistics.statistics import Statistic, TensorStatistic, TensorStatisticAxis from ..statistics.function_selector import ACTIVATIONS, get_stats_function -from ..utils.utils import convert_output_key - - class StatisticGraphBuilder: def insert_statistic(self, model, stats_layout, stat_aliases=None): + output_to_node_names = {} if stat_aliases is None or model is None: - return model, list(stats_layout.keys()) + return model, list(stats_layout.keys()), output_to_node_names nodes_names = [] - for algo_name, node_stats in stat_aliases.items(): + copy_stat_aliases = deepcopy(stat_aliases) + for algo_name, node_stats in copy_stat_aliases.items(): for node_name, stats in node_stats.items(): node_name_in_graph = node_name[0] if isinstance(node_name, tuple) else node_name + node_name_in_graph = node_name_in_graph.replace('/pre_fq_input', '') node = get_node_by_name(model, node_name_in_graph) - node_name = convert_output_key(node_name) + node_in_main_graph = get_node_by_name(model, node_name_in_graph.split('|')[0]) + model_graph = node_in_main_graph.graph for stat, _ in list(stats.items()): if not isinstance(stat, Statistic) or not stat.kwargs.get('inplace_statistics', False): - nodes_names.append(node_name_in_graph) + if node_name_in_graph not in nodes_names: + nodes_names.append(node_name_in_graph) continue type_stat = stat.kwargs['type'] - add_output_node = getattr(self, f'insert_{type_stat}')(node, type_stat, node_name, **stat.kwargs) + add_output_node, op_name = getattr(self, f'insert_{type_stat}')(model_graph, + node, + type_stat, + node.name, + **stat.kwargs) if add_output_node: - nodes_names.append(add_output_node) + if node_name_in_graph not in nodes_names: + nodes_names.append(op_name) class_statistic = TensorStatistic if isinstance(stat, TensorStatistic) else TensorStatisticAxis - - del stats_layout[node_name][stat] fn = get_stats_function(ACTIVATIONS, type_stat, stat.kwargs.get('granularity'), 'compute_statistic') new_stat = class_statistic(fn, channel=stat.kwargs.get('channel', {}), inplace_statistics=False, granularity=stat.kwargs.get('granularity'), - type=type_stat) - stats_layout[node_name][new_stat] = new_stat + type=type_stat, + layer_stat_name=op_name) + else: + new_stat = deepcopy(stat) + new_stat.kwargs['layer_stat_name'] = op_name - stat_name = stat_aliases[algo_name][node_name][stat] - del stat_aliases[algo_name][node_name][stat] - stat_aliases[algo_name][node_name][new_stat] = stat_name + del stats_layout[node_name][stat] + stats_layout[node_name][new_stat] = new_stat - return model, nodes_names + stat_name = stat_aliases[algo_name][node_name][stat] + del stat_aliases[algo_name][node_name][stat] + stat_aliases[algo_name][node_name][new_stat] = stat_name - def insert_reduce(self, insert_op, node, granularity, type_stat, node_name, axis=1): + # add output if node in subgraph + if model_graph != node.graph: + if node_name_in_graph in nodes_names: + nodes_names.remove(node_name_in_graph) + + # Don't need adding extra output to the same node, but for another algo + if node_name_in_graph in output_to_node_names.values(): + result_name = next((result for result, node in output_to_node_names.items() + if node == node_name_in_graph)) + else: + model_graph.graph['additional_outputs'] = node_name_in_graph.split('|') + results = AddOutputRecursive().find_and_replace_pattern(model_graph) + assert len(results) == 1 + result_name = results[0].name + if node_name in stats_layout: + stats_layout[result_name] = stats_layout.pop(node_name) + stat_aliases[algo_name][result_name] = stat_aliases[algo_name].pop(node_name) + output_to_node_names[result_name] = node_name_in_graph + + return model, nodes_names, output_to_node_names + + def insert_reduce(self, model_graph, insert_op, node, granularity, type_stat, node_name, axis=1): axis_const = self.find_axis(node, granularity, axis) if isinstance(axis_const, str): - return node.name + return (True, node.name) reduce_op = create_op_node_with_second_input(node.graph, insert_op, int64_array(axis_const), dict(name=f'{type_stat}_{node_name}')) - + reduce_op['fullname'] = reset_node_fullname(node.fullname, reduce_op.name) + if node.graph != model_graph: + Op.create_data_node(reduce_op.graph, reduce_op, {'shape': [1]}) node.out_port(0).connect(reduce_op.in_port(0)) - self.insert_result(node, reduce_op, type_stat) - return None + return self.insert_result(model_graph, node, reduce_op, type_stat) - def insert_min(self, node, type_stat, node_name, **kwargs): - return self.insert_reduce(ReduceMin, node, kwargs.get('granularity'), type_stat, node_name) + def insert_min(self, model_graph, node, type_stat, node_name, **kwargs): + return self.insert_reduce(model_graph, ReduceMin, node, kwargs.get('granularity'), type_stat, node_name) - def insert_max(self, node, type_stat, node_name, **kwargs): - return self.insert_reduce(ReduceMax, node, kwargs.get('granularity'), type_stat, node_name) + def insert_max(self, model_graph, node, type_stat, node_name, **kwargs): + return self.insert_reduce(model_graph, ReduceMax, node, kwargs.get('granularity'), type_stat, node_name) - def insert_mean(self, node, type_stat, node_name, **kwargs): + def insert_mean(self, model_graph, node, type_stat, node_name, **kwargs): axis_channel = kwargs.get('channel', None).get(node.name, 1) - return self.insert_reduce(ReduceMean, node, kwargs.get('granularity'), type_stat, node_name, axis_channel) + return self.insert_reduce(model_graph, + ReduceMean, + node, + kwargs.get('granularity'), + type_stat, + node_name, + axis_channel) - def insert_abs_max(self, node, type_stat, node_name, **kwargs): + def insert_abs_max(self, model_graph, node, type_stat, node_name, **kwargs): axis_const = self.find_axis(node, kwargs.get('granularity')) if isinstance(axis_const, str): - return node.name - abs_node = Abs(node.graph, {"name": type_stat + node_name}).create_node() - abs_node.in_port(0).connect(node.out_port(0)) + return (True, node.name) + abs_node = Abs(node.graph, {"name": f'abs_{node_name}'}).create_node_with_data([node.out_node(0)]).in_node(0) max_op = create_op_node_with_second_input(node.graph, ReduceMax, int64_array(axis_const), - dict(name='abs_max_' + node_name)) + dict(name=f'{type_stat}_{node_name}')) + + if node.graph != model_graph: + Op.create_data_node(max_op.graph, max_op, {'shape': [1]}) + max_op['fullname'] = reset_node_fullname(node.fullname, max_op.name) abs_node.out_port(0).connect(max_op.in_port(0)) - self.insert_result(node, max_op, type_stat) - return None + return self.insert_result(model_graph, node, max_op, type_stat) @staticmethod - def insert_result(node, child_node, name): - res_op = Result(node.graph, {'name': f'Result_{name}_{node.name}'}).create_node() - child_node.out_port(0).connect(res_op.in_port(0)) + def insert_result(model_graph, node, child_node, name): + if node.graph != model_graph: + model_graph.graph['additional_outputs'] = child_node.fullname.split('|') + res_op = AddOutputRecursive().find_and_replace_pattern(model_graph) + ie_result_name = res_op[0].name + else: + ie_result_name = f'{name}_{node.name}' + res_op = Result(node.graph, {'name': f'Result_{ie_result_name}'}).create_node() + child_node.out_port(0).connect(res_op.in_port(0)) + return (False, ie_result_name) @staticmethod def find_axis(node, granularity, axis=1): diff --git a/tools/pot/tests/data/hardware_configs/cpu.json b/tools/pot/tests/data/hardware_configs/cpu.json index 8d79ae1048d..5415fe71fae 100755 --- a/tools/pot/tests/data/hardware_configs/cpu.json +++ b/tools/pot/tests/data/hardware_configs/cpu.json @@ -173,6 +173,13 @@ "weights": ["q8_w_sym", "q8_w_asym"] } }, + { + "type": "LSTMCell", + "quantization": { + "activations": "q8_a", + "weights": ["q8_w_sym", "q8_w_asym"] + } + }, { "type": "Power", "quantization": { diff --git a/tools/pot/tests/data/hardware_configs/reference/cpu_flatten.json b/tools/pot/tests/data/hardware_configs/reference/cpu_flatten.json index 4fd824a0cbd..718d578ef77 100644 --- a/tools/pot/tests/data/hardware_configs/reference/cpu_flatten.json +++ b/tools/pot/tests/data/hardware_configs/reference/cpu_flatten.json @@ -1 +1 @@ -[{"target_device": "CPU"}, {"type": "Convolution", "quantization": {"activations": [{"bits": 8, "mode": "symmetric", "granularity": "pertensor"}, {"bits": 8, "mode": "asymmetric", "granularity": "pertensor"}], "weights": [{"bits": 8, "mode": "symmetric", "level_low": -127, "level_high": 127, "granularity": "perchannel"}, {"bits": 8, "mode": "asymmetric", "granularity": "perchannel"}]}}, {"type": "DepthWiseConvolution", "quantization": {"activations": [{"bits": 8, "mode": "symmetric", "granularity": "perchannel"}, {"bits": 8, "mode": "asymmetric", "granularity": "perchannel"}], "weights": [{"bits": 8, "mode": "symmetric", "level_low": -127, "level_high": 127, "granularity": "perchannel"}, {"bits": 8, "mode": "asymmetric", "granularity": "perchannel"}]}}, {"type": "MatMul", "quantization": {"activations": [{"bits": 8, "mode": "symmetric", "granularity": "pertensor"}, {"bits": 8, "mode": "asymmetric", "granularity": "pertensor"}], "weights": [{"bits": 8, "mode": "symmetric", "level_low": -127, "level_high": 127, "granularity": "perchannel"}, {"bits": 8, "mode": "asymmetric", "granularity": "perchannel"}]}}, {"type": "Add", "quantization": {"activations": [{"bits": 8, "mode": "symmetric", "granularity": "pertensor"}, {"bits": 8, "mode": "asymmetric", "granularity": "pertensor"}], "weights": [{"bits": 8, "mode": "symmetric", "level_low": -127, "level_high": 127, "granularity": "perchannel"}, {"bits": 8, "mode": "asymmetric", "granularity": "perchannel"}]}}, {"type": "Multiply", "quantization": {"activations": [{"bits": 8, "mode": "symmetric", "granularity": "pertensor"}, {"bits": 8, "mode": "asymmetric", "granularity": "pertensor"}], "weights": [{"bits": 8, "mode": "symmetric", "level_low": -127, "level_high": 127, "granularity": "perchannel"}, {"bits": 8, "mode": "asymmetric", "granularity": "perchannel"}]}}, {"type": "Maximum", "quantization": {"activations": [{"bits": 8, "mode": "symmetric", "granularity": "pertensor"}, {"bits": 8, "mode": "asymmetric", "granularity": "pertensor"}], "weights": [{"bits": 8, "mode": "symmetric", "level_low": -127, "level_high": 127, "granularity": "perchannel"}, {"bits": 8, "mode": "asymmetric", "granularity": "perchannel"}]}}, {"type": "Less", "quantization": {"activations": [{"bits": 8, "mode": "symmetric", "granularity": "pertensor"}, {"bits": 8, "mode": "asymmetric", "granularity": "pertensor"}], "weights": [{"bits": 8, "mode": "symmetric", "level_low": -127, "level_high": 127, "granularity": "perchannel"}, {"bits": 8, "mode": "asymmetric", "granularity": "perchannel"}]}}, {"type": "LessEqual", "quantization": {"activations": [{"bits": 8, "mode": "symmetric", "granularity": "pertensor"}, {"bits": 8, "mode": "asymmetric", "granularity": "pertensor"}], "weights": [{"bits": 8, "mode": "symmetric", "level_low": -127, "level_high": 127, "granularity": "perchannel"}, {"bits": 8, "mode": "asymmetric", "granularity": "perchannel"}]}}, {"type": "Greater", "quantization": {"activations": [{"bits": 8, "mode": "symmetric", "granularity": "pertensor"}, {"bits": 8, "mode": "asymmetric", "granularity": "pertensor"}], "weights": [{"bits": 8, "mode": "symmetric", "level_low": -127, "level_high": 127, "granularity": "perchannel"}, {"bits": 8, "mode": "asymmetric", "granularity": "perchannel"}]}}, {"type": "GreaterEqual", "quantization": {"activations": [{"bits": 8, "mode": "symmetric", "granularity": "pertensor"}, {"bits": 8, "mode": "asymmetric", "granularity": "pertensor"}], "weights": [{"bits": 8, "mode": "symmetric", "level_low": -127, "level_high": 127, "granularity": "perchannel"}, {"bits": 8, "mode": "asymmetric", "granularity": "perchannel"}]}}, {"type": "Divide", "quantization": {"activations": [{"bits": 8, "mode": "symmetric", "granularity": "pertensor"}, {"bits": 8, "mode": "asymmetric", "granularity": "pertensor"}], "weights": [{"bits": 8, "mode": "symmetric", "level_low": -127, "level_high": 127, "granularity": "perchannel"}, {"bits": 8, "mode": "asymmetric", "granularity": "perchannel"}]}}, {"type": "Minimum", "quantization": {"activations": [{"bits": 8, "mode": "symmetric", "granularity": "pertensor"}, {"bits": 8, "mode": "asymmetric", "granularity": "pertensor"}], "weights": [{"bits": 8, "mode": "symmetric", "level_low": -127, "level_high": 127, "granularity": "perchannel"}, {"bits": 8, "mode": "asymmetric", "granularity": "perchannel"}]}}, {"type": "Equal", "quantization": {"activations": [{"bits": 8, "mode": "symmetric", "granularity": "pertensor"}, {"bits": 8, "mode": "asymmetric", "granularity": "pertensor"}], "weights": [{"bits": 8, "mode": "symmetric", "level_low": -127, "level_high": 127, "granularity": "perchannel"}, {"bits": 8, "mode": "asymmetric", "granularity": "perchannel"}]}}, {"type": "Subtract", "quantization": {"activations": [{"bits": 8, "mode": "symmetric", "granularity": "pertensor"}, {"bits": 8, "mode": "asymmetric", "granularity": "pertensor"}], "weights": [{"bits": 8, "mode": "symmetric", "level_low": -127, "level_high": 127, "granularity": "perchannel"}, {"bits": 8, "mode": "asymmetric", "granularity": "perchannel"}]}}, {"type": "NotEqual", "quantization": {"activations": [{"bits": 8, "mode": "symmetric", "granularity": "pertensor"}, {"bits": 8, "mode": "asymmetric", "granularity": "pertensor"}], "weights": [{"bits": 8, "mode": "symmetric", "level_low": -127, "level_high": 127, "granularity": "perchannel"}, {"bits": 8, "mode": "asymmetric", "granularity": "perchannel"}]}}, {"type": "FloorMod", "quantization": {"activations": [{"bits": 8, "mode": "symmetric", "granularity": "pertensor"}, {"bits": 8, "mode": "asymmetric", "granularity": "pertensor"}], "weights": [{"bits": 8, "mode": "symmetric", "level_low": -127, "level_high": 127, "granularity": "perchannel"}, {"bits": 8, "mode": "asymmetric", "granularity": "perchannel"}]}}, {"type": "LogicalOr", "quantization": {"activations": [{"bits": 8, "mode": "symmetric", "granularity": "pertensor"}, {"bits": 8, "mode": "asymmetric", "granularity": "pertensor"}], "weights": [{"bits": 8, "mode": "symmetric", "level_low": -127, "level_high": 127, "granularity": "perchannel"}, {"bits": 8, "mode": "asymmetric", "granularity": "perchannel"}]}}, {"type": "LogicalXor", "quantization": {"activations": [{"bits": 8, "mode": "symmetric", "granularity": "pertensor"}, {"bits": 8, "mode": "asymmetric", "granularity": "pertensor"}], "weights": [{"bits": 8, "mode": "symmetric", "level_low": -127, "level_high": 127, "granularity": "perchannel"}, {"bits": 8, "mode": "asymmetric", "granularity": "perchannel"}]}}, {"type": "LogicalAnd", "quantization": {"activations": [{"bits": 8, "mode": "symmetric", "granularity": "pertensor"}, {"bits": 8, "mode": "asymmetric", "granularity": "pertensor"}], "weights": [{"bits": 8, "mode": "symmetric", "level_low": -127, "level_high": 127, "granularity": "perchannel"}, {"bits": 8, "mode": "asymmetric", "granularity": "perchannel"}]}}, {"type": "LogicalNot", "quantization": {"activations": [{"bits": 8, "mode": "symmetric", "granularity": "pertensor"}, {"bits": 8, "mode": "asymmetric", "granularity": "pertensor"}], "weights": [{"bits": 8, "mode": "symmetric", "level_low": -127, "level_high": 127, "granularity": "perchannel"}, {"bits": 8, "mode": "asymmetric", "granularity": "perchannel"}]}}, {"type": "Power", "quantization": {"activations": [{"bits": 8, "mode": "symmetric", "granularity": "pertensor"}, {"bits": 8, "mode": "asymmetric", "granularity": "pertensor"}]}}, {"type": "AvgPool", "quantization": {"activations": [{"bits": 8, "mode": "symmetric", "granularity": "pertensor"}, {"bits": 8, "mode": "asymmetric", "granularity": "pertensor"}]}}, {"type": "NormalizeL2", "quantization": {"activations": [{"bits": 8, "mode": "symmetric", "granularity": "pertensor"}, {"bits": 8, "mode": "asymmetric", "granularity": "pertensor"}]}}, {"type": "ReduceMean", "quantization": {"activations": [{"bits": 8, "mode": "symmetric", "granularity": "pertensor"}, {"bits": 8, "mode": "asymmetric", "granularity": "pertensor"}]}}, {"type": "MaxPool"}, {"type": "ReduceMax"}, {"type": "Interpolate", "quantization": {"activations": [{"bits": 8, "mode": "symmetric", "granularity": "pertensor"}, {"bits": 8, "mode": "asymmetric", "granularity": "pertensor"}]}}, {"type": "MVN", "quantization": {"activations": [{"bits": 8, "mode": "symmetric", "granularity": "pertensor"}, {"bits": 8, "mode": "asymmetric", "granularity": "pertensor"}]}}, {"type": "Concat", "attributes": {"scales": "unified"}}, {"type": "Reshape"}, {"type": "Flatten"}, {"type": "Squeeze"}, {"type": "Unsqueeze"}, {"type": "Split"}, {"type": "VariadicSplit"}, {"type": "Crop"}, {"type": "Transpose"}, {"type": "Tile"}, {"type": "StridedSlice"}, {"type": "ShuffleChannels"}, {"type": "Broadcast"}, {"type": "Pad"}, {"type": "ConvertLike"}] \ No newline at end of file +[{"target_device": "CPU"}, {"type": "Convolution", "quantization": {"activations": [{"bits": 8, "mode": "symmetric", "granularity": "pertensor"}, {"bits": 8, "mode": "asymmetric", "granularity": "pertensor"}], "weights": [{"bits": 8, "mode": "symmetric", "level_low": -127, "level_high": 127, "granularity": "perchannel"}, {"bits": 8, "mode": "asymmetric", "granularity": "perchannel"}]}}, {"type": "DepthWiseConvolution", "quantization": {"activations": [{"bits": 8, "mode": "symmetric", "granularity": "perchannel"}, {"bits": 8, "mode": "asymmetric", "granularity": "perchannel"}], "weights": [{"bits": 8, "mode": "symmetric", "level_low": -127, "level_high": 127, "granularity": "perchannel"}, {"bits": 8, "mode": "asymmetric", "granularity": "perchannel"}]}}, {"type": "MatMul", "quantization": {"activations": [{"bits": 8, "mode": "symmetric", "granularity": "pertensor"}, {"bits": 8, "mode": "asymmetric", "granularity": "pertensor"}], "weights": [{"bits": 8, "mode": "symmetric", "level_low": -127, "level_high": 127, "granularity": "perchannel"}, {"bits": 8, "mode": "asymmetric", "granularity": "perchannel"}]}}, {"type": "Add", "quantization": {"activations": [{"bits": 8, "mode": "symmetric", "granularity": "pertensor"}, {"bits": 8, "mode": "asymmetric", "granularity": "pertensor"}], "weights": [{"bits": 8, "mode": "symmetric", "level_low": -127, "level_high": 127, "granularity": "perchannel"}, {"bits": 8, "mode": "asymmetric", "granularity": "perchannel"}]}}, {"type": "Multiply", "quantization": {"activations": [{"bits": 8, "mode": "symmetric", "granularity": "pertensor"}, {"bits": 8, "mode": "asymmetric", "granularity": "pertensor"}], "weights": [{"bits": 8, "mode": "symmetric", "level_low": -127, "level_high": 127, "granularity": "perchannel"}, {"bits": 8, "mode": "asymmetric", "granularity": "perchannel"}]}}, {"type": "Maximum", "quantization": {"activations": [{"bits": 8, "mode": "symmetric", "granularity": "pertensor"}, {"bits": 8, "mode": "asymmetric", "granularity": "pertensor"}], "weights": [{"bits": 8, "mode": "symmetric", "level_low": -127, "level_high": 127, "granularity": "perchannel"}, {"bits": 8, "mode": "asymmetric", "granularity": "perchannel"}]}}, {"type": "Less", "quantization": {"activations": [{"bits": 8, "mode": "symmetric", "granularity": "pertensor"}, {"bits": 8, "mode": "asymmetric", "granularity": "pertensor"}], "weights": [{"bits": 8, "mode": "symmetric", "level_low": -127, "level_high": 127, "granularity": "perchannel"}, {"bits": 8, "mode": "asymmetric", "granularity": "perchannel"}]}}, {"type": "LessEqual", "quantization": {"activations": [{"bits": 8, "mode": "symmetric", "granularity": "pertensor"}, {"bits": 8, "mode": "asymmetric", "granularity": "pertensor"}], "weights": [{"bits": 8, "mode": "symmetric", "level_low": -127, "level_high": 127, "granularity": "perchannel"}, {"bits": 8, "mode": "asymmetric", "granularity": "perchannel"}]}}, {"type": "Greater", "quantization": {"activations": [{"bits": 8, "mode": "symmetric", "granularity": "pertensor"}, {"bits": 8, "mode": "asymmetric", "granularity": "pertensor"}], "weights": [{"bits": 8, "mode": "symmetric", "level_low": -127, "level_high": 127, "granularity": "perchannel"}, {"bits": 8, "mode": "asymmetric", "granularity": "perchannel"}]}}, {"type": "GreaterEqual", "quantization": {"activations": [{"bits": 8, "mode": "symmetric", "granularity": "pertensor"}, {"bits": 8, "mode": "asymmetric", "granularity": "pertensor"}], "weights": [{"bits": 8, "mode": "symmetric", "level_low": -127, "level_high": 127, "granularity": "perchannel"}, {"bits": 8, "mode": "asymmetric", "granularity": "perchannel"}]}}, {"type": "Divide", "quantization": {"activations": [{"bits": 8, "mode": "symmetric", "granularity": "pertensor"}, {"bits": 8, "mode": "asymmetric", "granularity": "pertensor"}], "weights": [{"bits": 8, "mode": "symmetric", "level_low": -127, "level_high": 127, "granularity": "perchannel"}, {"bits": 8, "mode": "asymmetric", "granularity": "perchannel"}]}}, {"type": "Minimum", "quantization": {"activations": [{"bits": 8, "mode": "symmetric", "granularity": "pertensor"}, {"bits": 8, "mode": "asymmetric", "granularity": "pertensor"}], "weights": [{"bits": 8, "mode": "symmetric", "level_low": -127, "level_high": 127, "granularity": "perchannel"}, {"bits": 8, "mode": "asymmetric", "granularity": "perchannel"}]}}, {"type": "Equal", "quantization": {"activations": [{"bits": 8, "mode": "symmetric", "granularity": "pertensor"}, {"bits": 8, "mode": "asymmetric", "granularity": "pertensor"}], "weights": [{"bits": 8, "mode": "symmetric", "level_low": -127, "level_high": 127, "granularity": "perchannel"}, {"bits": 8, "mode": "asymmetric", "granularity": "perchannel"}]}}, {"type": "Subtract", "quantization": {"activations": [{"bits": 8, "mode": "symmetric", "granularity": "pertensor"}, {"bits": 8, "mode": "asymmetric", "granularity": "pertensor"}], "weights": [{"bits": 8, "mode": "symmetric", "level_low": -127, "level_high": 127, "granularity": "perchannel"}, {"bits": 8, "mode": "asymmetric", "granularity": "perchannel"}]}}, {"type": "NotEqual", "quantization": {"activations": [{"bits": 8, "mode": "symmetric", "granularity": "pertensor"}, {"bits": 8, "mode": "asymmetric", "granularity": "pertensor"}], "weights": [{"bits": 8, "mode": "symmetric", "level_low": -127, "level_high": 127, "granularity": "perchannel"}, {"bits": 8, "mode": "asymmetric", "granularity": "perchannel"}]}}, {"type": "FloorMod", "quantization": {"activations": [{"bits": 8, "mode": "symmetric", "granularity": "pertensor"}, {"bits": 8, "mode": "asymmetric", "granularity": "pertensor"}], "weights": [{"bits": 8, "mode": "symmetric", "level_low": -127, "level_high": 127, "granularity": "perchannel"}, {"bits": 8, "mode": "asymmetric", "granularity": "perchannel"}]}}, {"type": "LogicalOr", "quantization": {"activations": [{"bits": 8, "mode": "symmetric", "granularity": "pertensor"}, {"bits": 8, "mode": "asymmetric", "granularity": "pertensor"}], "weights": [{"bits": 8, "mode": "symmetric", "level_low": -127, "level_high": 127, "granularity": "perchannel"}, {"bits": 8, "mode": "asymmetric", "granularity": "perchannel"}]}}, {"type": "LogicalXor", "quantization": {"activations": [{"bits": 8, "mode": "symmetric", "granularity": "pertensor"}, {"bits": 8, "mode": "asymmetric", "granularity": "pertensor"}], "weights": [{"bits": 8, "mode": "symmetric", "level_low": -127, "level_high": 127, "granularity": "perchannel"}, {"bits": 8, "mode": "asymmetric", "granularity": "perchannel"}]}}, {"type": "LogicalAnd", "quantization": {"activations": [{"bits": 8, "mode": "symmetric", "granularity": "pertensor"}, {"bits": 8, "mode": "asymmetric", "granularity": "pertensor"}], "weights": [{"bits": 8, "mode": "symmetric", "level_low": -127, "level_high": 127, "granularity": "perchannel"}, {"bits": 8, "mode": "asymmetric", "granularity": "perchannel"}]}}, {"type": "LogicalNot", "quantization": {"activations": [{"bits": 8, "mode": "symmetric", "granularity": "pertensor"}, {"bits": 8, "mode": "asymmetric", "granularity": "pertensor"}], "weights": [{"bits": 8, "mode": "symmetric", "level_low": -127, "level_high": 127, "granularity": "perchannel"}, {"bits": 8, "mode": "asymmetric", "granularity": "perchannel"}]}}, {"type": "LSTMCell", "quantization": {"activations": [{"bits": 8, "mode": "symmetric", "granularity": "pertensor"}, {"bits": 8, "mode": "asymmetric", "granularity": "pertensor"}], "weights": [{"bits": 8, "mode": "symmetric", "level_low": -127, "level_high": 127, "granularity": "perchannel"}, {"bits": 8, "mode": "asymmetric", "granularity": "perchannel"}]}}, {"type": "Power", "quantization": {"activations": [{"bits": 8, "mode": "symmetric", "granularity": "pertensor"}, {"bits": 8, "mode": "asymmetric", "granularity": "pertensor"}]}}, {"type": "AvgPool", "quantization": {"activations": [{"bits": 8, "mode": "symmetric", "granularity": "pertensor"}, {"bits": 8, "mode": "asymmetric", "granularity": "pertensor"}]}}, {"type": "NormalizeL2", "quantization": {"activations": [{"bits": 8, "mode": "symmetric", "granularity": "pertensor"}, {"bits": 8, "mode": "asymmetric", "granularity": "pertensor"}]}}, {"type": "ReduceMean", "quantization": {"activations": [{"bits": 8, "mode": "symmetric", "granularity": "pertensor"}, {"bits": 8, "mode": "asymmetric", "granularity": "pertensor"}]}}, {"type": "MaxPool"}, {"type": "ReduceMax"}, {"type": "Interpolate", "quantization": {"activations": [{"bits": 8, "mode": "symmetric", "granularity": "pertensor"}, {"bits": 8, "mode": "asymmetric", "granularity": "pertensor"}]}}, {"type": "MVN", "quantization": {"activations": [{"bits": 8, "mode": "symmetric", "granularity": "pertensor"}, {"bits": 8, "mode": "asymmetric", "granularity": "pertensor"}]}}, {"type": "Concat", "attributes": {"scales": "unified"}}, {"type": "Reshape"}, {"type": "Flatten"}, {"type": "Squeeze"}, {"type": "Unsqueeze"}, {"type": "Split"}, {"type": "VariadicSplit"}, {"type": "Crop"}, {"type": "Transpose"}, {"type": "Tile"}, {"type": "StridedSlice"}, {"type": "ShuffleChannels"}, {"type": "Broadcast"}, {"type": "Pad"}, {"type": "ConvertLike"}] \ No newline at end of file diff --git a/tools/pot/tests/data/models/tensor_iterator_example/tensor_iterator_example.json b/tools/pot/tests/data/models/tensor_iterator_example/tensor_iterator_example.json new file mode 100644 index 00000000000..d075306e4dc --- /dev/null +++ b/tools/pot/tests/data/models/tensor_iterator_example/tensor_iterator_example.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:66bb19335e67bff48904f44c1aca979dccde693db87acaeea084f66ad141af36 +size 259 diff --git a/tools/pot/tests/data/models/tensor_iterator_example/tensor_iterator_example.pb b/tools/pot/tests/data/models/tensor_iterator_example/tensor_iterator_example.pb new file mode 100644 index 00000000000..7cacf91f28f --- /dev/null +++ b/tools/pot/tests/data/models/tensor_iterator_example/tensor_iterator_example.pb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4026069adcbce63e2cb892f20af75610df01fdb5a4a5cfb018e8f1c58b9b721b +size 1983799 diff --git a/tools/pot/tests/data/reference_models/tensor_iterator_example_tf.xml b/tools/pot/tests/data/reference_models/tensor_iterator_example_tf.xml new file mode 100644 index 00000000000..865815910ee --- /dev/null +++ b/tools/pot/tests/data/reference_models/tensor_iterator_example_tf.xml @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:81a8f061fbe4e248b0150151a1506b90ad1f6b66e9a37399d6e371fae215eb76 +size 23986 diff --git a/tools/pot/tests/test_graph.py b/tools/pot/tests/test_graph.py index 5ee601eb565..fd4654d1141 100755 --- a/tools/pot/tests/test_graph.py +++ b/tools/pot/tests/test_graph.py @@ -25,7 +25,8 @@ TEST_MODELS = [ ('densenet121_example', 'pytorch', 'ANY'), ('multiple_out_ports_net', 'tf', 'ANY'), ('lstm_example', 'pytorch', 'GNA'), - ('multiple_outputs_net_example', 'dldt', 'GNA') + ('multiple_outputs_net_example', 'dldt', 'GNA'), + # ('tensor_iterator_example', 'tf', 'ANY'), ] CASCADE_MAP = Dict({ diff --git a/tools/pot/tests/test_statistic_builder.py b/tools/pot/tests/test_statistic_builder.py index 80f7437ca12..297dfa511ab 100644 --- a/tools/pot/tests/test_statistic_builder.py +++ b/tools/pot/tests/test_statistic_builder.py @@ -101,7 +101,7 @@ def test_statistics_collector_subsets(tmp_path, models, model_name, model_framew algo.register_statistics(model, collector) statistic_graph_builder = StatisticGraphBuilder() act_stats_layout, stat_aliases = merge_stats_by_algo_names([algorithm.name], collector._layout_by_algo) - model_with_nodes, nodes_names = statistic_graph_builder.insert_statistic(model, act_stats_layout, stat_aliases) + model_with_nodes, nodes_names, _ = statistic_graph_builder.insert_statistic(model, act_stats_layout, stat_aliases) ir_name = f'{model_name}_stat_{type_max}_{type_min}' if type_min is not None \ else f'{model_name}_stat_mean' check_model(tmp_path, model_with_nodes, ir_name, model_framework)