From 12f2bb72dae967e95672e50ad85ee8f7dc8905db Mon Sep 17 00:00:00 2001 From: Ilya Lavrenov Date: Thu, 27 May 2021 16:14:07 +0300 Subject: [PATCH] Updates on deprecated stuff (#5838) * Removed cloneFunction from ngraph CNNNetwork impl * Removed custom clone * Localize deprecation suppressions * Removed Jira tickets * Fixed MYRIAD tests compilation on Windows --- .../cnn_network_ngraph_impl.cpp | 20 ++----------------- .../cnn_network_ngraph_impl.hpp | 5 ++--- .../src/legacy_api/src/ie_util_internal.cpp | 19 ++++++------------ .../include/vpu/model/stage.hpp | 4 ++++ .../include/vpu/stage_builder.hpp | 4 ++++ .../functional/plugin/myriad/CMakeLists.txt | 2 -- .../conversions/dynamic_shape_resolver.cpp | 6 ++++++ .../behavior/config.cpp | 2 ++ .../behavior/infer_request_config.cpp | 2 ++ .../layer_transformation.hpp | 4 ---- .../tests/unit/vpu/CMakeLists.txt | 2 -- .../vpu/frontend_tests/dsr_parsing_tests.cpp | 2 ++ .../split_large_kernel_conv_tests.cpp | 2 ++ .../tests_deprecated/behavior/CMakeLists.txt | 2 -- .../behavior/shared_tests/CMakeLists.txt | 2 -- .../behavior/vpu/CMakeLists.txt | 3 ++- .../functional/CMakeLists.txt | 4 ++-- .../functional/shared_tests/CMakeLists.txt | 2 -- .../tools/vpu/vpu_perfcheck/CMakeLists.txt | 2 -- 19 files changed, 36 insertions(+), 53 deletions(-) diff --git a/inference-engine/src/inference_engine/cnn_network_ngraph_impl.cpp b/inference-engine/src/inference_engine/cnn_network_ngraph_impl.cpp index f5721c7ae71a8c..1252c1b856aff4 100644 --- a/inference-engine/src/inference_engine/cnn_network_ngraph_impl.cpp +++ b/inference-engine/src/inference_engine/cnn_network_ngraph_impl.cpp @@ -41,18 +41,6 @@ using details::CNNNetworkNGraphImpl; using InferenceEngine::details::CNNNetworkNGraphImpl; using ngraph::Function; -static std::shared_ptr copyFunction(const std::shared_ptr& func, - bool constFolding) { - OV_ITT_SCOPED_TASK(itt::domains::IE, "copyFunction"); - - auto specialized_function = ngraph::clone_function(*func); - - if (constFolding) { - ngraph::pass::ConstantFolding().run_on_function(specialized_function); - } - return specialized_function; -} - void CNNNetworkNGraphImpl::createDataForResult(const ::ngraph::Output<::ngraph::Node>& output, const std::string& outName, DataPtr& ptr) { const auto isCompatible = [](size_t size, const Layout& l) -> bool { @@ -172,7 +160,7 @@ CNNNetworkNGraphImpl::CNNNetworkNGraphImpl(const CNNNetwork& network) { IE_THROW() << "Cannot create CNNNetwork with nGraph from legacy network format!"; } - _ngraph_function = copyFunction(network.getFunction(), false); + _ngraph_function = ngraph::clone_function(*network.getFunction()); validateFunctionNames(); InputsDataMap inputs = network.getInputsInfo(); OutputsDataMap outputs = network.getOutputsInfo(); @@ -314,10 +302,6 @@ size_t CNNNetworkNGraphImpl::getBatchSize() const noexcept { return 1; } -std::shared_ptr CNNNetworkNGraphImpl::cloneFunction(bool constFolding) const { - return copyFunction(_ngraph_function, constFolding); -} - void CNNNetworkNGraphImpl::reshape() { reshape({}); } @@ -398,7 +382,7 @@ CNNNetworkNGraphImpl::reshape(const std::map& if (outputs_are_static) { specialized_ngraph_function = _ngraph_function; } else { - specialized_ngraph_function = cloneFunction(false); + specialized_ngraph_function = ngraph::clone_function(*_ngraph_function); { OV_ITT_SCOPED_TASK(itt::domains::IE, "CNNNetworkNGraphImpl::ConvertToLegacy"); ::ngraph::pass::Manager manager; diff --git a/inference-engine/src/inference_engine/cnn_network_ngraph_impl.hpp b/inference-engine/src/inference_engine/cnn_network_ngraph_impl.hpp index f9129cb1f6b877..db0d1d9ab49f23 100644 --- a/inference-engine/src/inference_engine/cnn_network_ngraph_impl.hpp +++ b/inference-engine/src/inference_engine/cnn_network_ngraph_impl.hpp @@ -3,7 +3,7 @@ // /** - * @brief A file containing ngraph implementation of public ICNNNetwork interface + * @brief A file containing ngraph implementation of public CNNNetwork wrapper * @file cnn_network_ngraph_impl.hpp */ @@ -36,7 +36,7 @@ namespace details { IE_SUPPRESS_DEPRECATED_START /** - * @brief Ngraph-based implementation of the ICNNNetwork interface. + * @brief Ngraph-based implementation of the CNNNetwork. */ class INFERENCE_ENGINE_API_CLASS(CNNNetworkNGraphImpl) final : public ICNNNetwork { public: @@ -84,7 +84,6 @@ class INFERENCE_ENGINE_API_CLASS(CNNNetworkNGraphImpl) final : public ICNNNetwor // used by convertFunctionToICNNNetwork from legacy library std::map _data; protected: - virtual std::shared_ptr<::ngraph::Function> cloneFunction(bool constFolding = false) const; std::shared_ptr<::ngraph::Function> _ngraph_function; private: diff --git a/inference-engine/src/legacy_api/src/ie_util_internal.cpp b/inference-engine/src/legacy_api/src/ie_util_internal.cpp index 5249f20f20250e..755d4719568178 100644 --- a/inference-engine/src/legacy_api/src/ie_util_internal.cpp +++ b/inference-engine/src/legacy_api/src/ie_util_internal.cpp @@ -15,6 +15,7 @@ #include "caseless.hpp" #include "precision_utils.h" #include "cnn_network_ngraph_impl.hpp" +#include "ie_ngraph_utils.hpp" #include "legacy/ie_util_internal.hpp" #include "legacy/cnn_network_impl.hpp" @@ -150,26 +151,18 @@ CNNLayerPtr clonelayer(const CNNLayer& source) { CNNNetwork cloneNetwork(const CNNNetwork& network) { OV_ITT_SCOPE(FIRST_INFERENCE, itt::domains::IELegacy_LT, "cloneNetwork"); - IE_SUPPRESS_DEPRECATED_START if (network.getFunction()) { - return CNNNetwork(std::make_shared(network)); + return InferenceEngine::details::cloneNetwork(network); } - return CNNNetwork(cloneNet(network)); + IE_SUPPRESS_DEPRECATED_START + return CNNNetwork(InferenceEngine::cloneNet(network)); IE_SUPPRESS_DEPRECATED_END } -details::CNNNetworkImplPtr cloneNet(const CNNNetwork& origin_network) { +details::CNNNetworkImplPtr cloneNet(const CNNNetwork& network) { OV_ITT_SCOPED_TASK(itt::domains::IELegacy, "cloneNet(CNNNetwork)"); - IE_SUPPRESS_DEPRECATED_START - std::shared_ptr clonedNetwork; - // Call conversion only on the copy of nGraph function - if (origin_network.getFunction()) { - // Copy and call conversion - clonedNetwork = std::make_shared(cloneNetwork(origin_network)); - } - const CNNNetwork network = clonedNetwork ? CNNNetwork(clonedNetwork) : origin_network; - IE_SUPPRESS_DEPRECATED_END + IE_ASSERT(network.getFunction() == nullptr); std::vector layers; details::CNNNetworkIterator i(network); diff --git a/inference-engine/src/vpu/graph_transformer/include/vpu/model/stage.hpp b/inference-engine/src/vpu/graph_transformer/include/vpu/model/stage.hpp index 7d0f7dd4659840..433c3b9f77da0f 100644 --- a/inference-engine/src/vpu/graph_transformer/include/vpu/model/stage.hpp +++ b/inference-engine/src/vpu/graph_transformer/include/vpu/model/stage.hpp @@ -400,7 +400,9 @@ class StageNode : // Bindings with IE // + IE_SUPPRESS_DEPRECATED_START VPU_MODEL_ATTRIBUTE(ie::CNNLayerPtr, origLayer, nullptr) + IE_SUPPRESS_DEPRECATED_END // // Edges @@ -573,7 +575,9 @@ class StageNode : // inline std::string origLayerName() const { + IE_SUPPRESS_DEPRECATED_START return _origLayer != nullptr ? _origLayer->name : std::string(); + IE_SUPPRESS_DEPRECATED_END } // diff --git a/inference-engine/src/vpu/graph_transformer/include/vpu/stage_builder.hpp b/inference-engine/src/vpu/graph_transformer/include/vpu/stage_builder.hpp index a77a20a8accbf9..82579f0cfe2f02 100644 --- a/inference-engine/src/vpu/graph_transformer/include/vpu/stage_builder.hpp +++ b/inference-engine/src/vpu/graph_transformer/include/vpu/stage_builder.hpp @@ -14,6 +14,8 @@ namespace vpu { +IE_SUPPRESS_DEPRECATED_START + class StageBuilder final { public: using Ptr = std::shared_ptr; @@ -359,4 +361,6 @@ class StageBuilder final { int32_t blankIndex); }; +IE_SUPPRESS_DEPRECATED_END + } // namespace vpu diff --git a/inference-engine/tests/functional/plugin/myriad/CMakeLists.txt b/inference-engine/tests/functional/plugin/myriad/CMakeLists.txt index 34f1bb8ac11646..6a5b0f90e90f05 100644 --- a/inference-engine/tests/functional/plugin/myriad/CMakeLists.txt +++ b/inference-engine/tests/functional/plugin/myriad/CMakeLists.txt @@ -4,8 +4,6 @@ set(TARGET_NAME myriadFuncTests) -disable_deprecated_warnings() - addIeTargetTest( NAME ${TARGET_NAME} ROOT ${CMAKE_CURRENT_SOURCE_DIR} diff --git a/inference-engine/tests/functional/plugin/myriad/ngraph/conversions/dynamic_shape_resolver.cpp b/inference-engine/tests/functional/plugin/myriad/ngraph/conversions/dynamic_shape_resolver.cpp index 25fc4c85ccace2..5487dcfefbcdd0 100644 --- a/inference-engine/tests/functional/plugin/myriad/ngraph/conversions/dynamic_shape_resolver.cpp +++ b/inference-engine/tests/functional/plugin/myriad/ngraph/conversions/dynamic_shape_resolver.cpp @@ -36,15 +36,19 @@ class DynamicShapeResolverTests : public CommonTestUtils::TestsCommon { } protected: + IE_SUPPRESS_DEPRECATED_START InferenceEngine::CNNLayerPtr getDynamicShapeResolverLayer() const { return CommonTestUtils::getLayerByName(cnnNetwork, s_FriendlyName); } + IE_SUPPRESS_DEPRECATED_END InferenceEngine::CNNNetwork cnnNetwork; private: void triggerConversionToCNNNetwork() { + IE_SUPPRESS_DEPRECATED_START cnnNetwork = InferenceEngine::CNNNetwork( std::make_shared(cnnNetwork)); + IE_SUPPRESS_DEPRECATED_END } static const char s_FriendlyName[]; @@ -57,10 +61,12 @@ TEST_F(DynamicShapeResolverTests, smoke_NGraphFunctionCanBeConvertedToCNNNetwork ASSERT_EQ(cnnNetwork.layerCount(), cnnNetwork.getInputsInfo().size() + 1); ASSERT_EQ(cnnNetwork.getOutputsInfo().size(), 1); + IE_SUPPRESS_DEPRECATED_START const auto dynamicShapeResolver = getDynamicShapeResolverLayer(); ASSERT_EQ(dynamicShapeResolver->type, "DynamicShapeResolver"); ASSERT_EQ(dynamicShapeResolver->insData.size(), 2); ASSERT_EQ(dynamicShapeResolver->outData.size(), 1); + IE_SUPPRESS_DEPRECATED_END } } // namespace diff --git a/inference-engine/tests/functional/plugin/myriad/shared_tests_instances/behavior/config.cpp b/inference-engine/tests/functional/plugin/myriad/shared_tests_instances/behavior/config.cpp index a5015b4a3210b1..d02a5086d14dbd 100644 --- a/inference-engine/tests/functional/plugin/myriad/shared_tests_instances/behavior/config.cpp +++ b/inference-engine/tests/functional/plugin/myriad/shared_tests_instances/behavior/config.cpp @@ -7,6 +7,8 @@ #include "vpu/private_plugin_config.hpp" #include "behavior/config.hpp" +IE_SUPPRESS_DEPRECATED_START + using namespace BehaviorTestsDefinitions; namespace { const std::vector netPrecisions = { diff --git a/inference-engine/tests/functional/plugin/myriad/shared_tests_instances/behavior/infer_request_config.cpp b/inference-engine/tests/functional/plugin/myriad/shared_tests_instances/behavior/infer_request_config.cpp index a9085f57e09764..b6db5ac6c586b2 100644 --- a/inference-engine/tests/functional/plugin/myriad/shared_tests_instances/behavior/infer_request_config.cpp +++ b/inference-engine/tests/functional/plugin/myriad/shared_tests_instances/behavior/infer_request_config.cpp @@ -9,6 +9,8 @@ #include "vpu/private_plugin_config.hpp" #include "vpu/myriad_config.hpp" +IE_SUPPRESS_DEPRECATED_START + using namespace BehaviorTestsDefinitions; namespace { const std::vector netPrecisions = { diff --git a/inference-engine/tests/functional/shared_test_classes/include/shared_test_classes/base/low_precision_transformations/layer_transformation.hpp b/inference-engine/tests/functional/shared_test_classes/include/shared_test_classes/base/low_precision_transformations/layer_transformation.hpp index f5cef5abc3e73e..298c03f4e304fa 100644 --- a/inference-engine/tests/functional/shared_test_classes/include/shared_test_classes/base/low_precision_transformations/layer_transformation.hpp +++ b/inference-engine/tests/functional/shared_test_classes/include/shared_test_classes/base/low_precision_transformations/layer_transformation.hpp @@ -24,8 +24,6 @@ class LayerTransformationParamsNGraphFactory { class LayerTransformationParamsFactory : public LayerTransformationParamsNGraphFactory { }; -IE_SUPPRESS_DEPRECATED_START - class LayerTransformation : virtual public LayerTestsUtils::LayerTestsCommon { protected: LayerTransformation(); @@ -64,8 +62,6 @@ class LayerTransformation : virtual public LayerTestsUtils::LayerTestsCommon { const ngraph::pass::low_precision::LayerTransformation::Params& params); }; -IE_SUPPRESS_DEPRECATED_END - typedef std::tuple< InferenceEngine::Precision, InferenceEngine::SizeVector, diff --git a/inference-engine/tests/unit/vpu/CMakeLists.txt b/inference-engine/tests/unit/vpu/CMakeLists.txt index 685bcbacc0bdc3..fcb9f567bbfd62 100644 --- a/inference-engine/tests/unit/vpu/CMakeLists.txt +++ b/inference-engine/tests/unit/vpu/CMakeLists.txt @@ -4,8 +4,6 @@ set(TARGET_NAME vpuUnitTests) -disable_deprecated_warnings() - include(${XLINK_DIR}/XLink.cmake) addIeTargetTest( diff --git a/inference-engine/tests/unit/vpu/frontend_tests/dsr_parsing_tests.cpp b/inference-engine/tests/unit/vpu/frontend_tests/dsr_parsing_tests.cpp index dbcf4587ef3792..87b3f0d54ebfe5 100644 --- a/inference-engine/tests/unit/vpu/frontend_tests/dsr_parsing_tests.cpp +++ b/inference-engine/tests/unit/vpu/frontend_tests/dsr_parsing_tests.cpp @@ -10,6 +10,8 @@ #include "ngraph/ngraph.hpp" #include "ngraph/opsets/opset3.hpp" +IE_SUPPRESS_DEPRECATED_START + namespace vpu { namespace ie = InferenceEngine; diff --git a/inference-engine/tests/unit/vpu/middleend_tests/passes_tests/split_large_kernel_conv_tests.cpp b/inference-engine/tests/unit/vpu/middleend_tests/passes_tests/split_large_kernel_conv_tests.cpp index 37eb621c8a98af..e68ac6386be4ae 100644 --- a/inference-engine/tests/unit/vpu/middleend_tests/passes_tests/split_large_kernel_conv_tests.cpp +++ b/inference-engine/tests/unit/vpu/middleend_tests/passes_tests/split_large_kernel_conv_tests.cpp @@ -8,6 +8,8 @@ using namespace vpu; +IE_SUPPRESS_DEPRECATED_START + class VPU_SplitLargeKernelConvTest : public GraphTransformerTest { protected: PassSet pipeline; diff --git a/inference-engine/tests_deprecated/behavior/CMakeLists.txt b/inference-engine/tests_deprecated/behavior/CMakeLists.txt index 0cdfeb9f891387..4d812054f4058a 100644 --- a/inference-engine/tests_deprecated/behavior/CMakeLists.txt +++ b/inference-engine/tests_deprecated/behavior/CMakeLists.txt @@ -4,8 +4,6 @@ add_subdirectory(shared_tests) -disable_deprecated_warnings() - if (ENABLE_HDDL OR ENABLE_MYRIAD) add_subdirectory(vpu) endif() diff --git a/inference-engine/tests_deprecated/behavior/shared_tests/CMakeLists.txt b/inference-engine/tests_deprecated/behavior/shared_tests/CMakeLists.txt index 8c272673b06283..ba4d2e7d80f049 100644 --- a/inference-engine/tests_deprecated/behavior/shared_tests/CMakeLists.txt +++ b/inference-engine/tests_deprecated/behavior/shared_tests/CMakeLists.txt @@ -4,8 +4,6 @@ set(TARGET_NAME IEBehaviorSharedTests) -disable_deprecated_warnings() - file(GLOB_RECURSE SHARED_TESTS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp) diff --git a/inference-engine/tests_deprecated/behavior/vpu/CMakeLists.txt b/inference-engine/tests_deprecated/behavior/vpu/CMakeLists.txt index 0bf133402c7f6b..1ad61350dbdb55 100644 --- a/inference-engine/tests_deprecated/behavior/vpu/CMakeLists.txt +++ b/inference-engine/tests_deprecated/behavior/vpu/CMakeLists.txt @@ -2,8 +2,9 @@ # SPDX-License-Identifier: Apache-2.0 # -function(enable_vpu TARGET_NAME FLAG_NAME PLUGIN_NAME) +disable_deprecated_warnings() +function(enable_vpu TARGET_NAME FLAG_NAME PLUGIN_NAME) # Common tests for HDDL MYRIAD KMB file(GLOB_RECURSE TEST_INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/shared_tests_instances/*.hpp) diff --git a/inference-engine/tests_deprecated/functional/CMakeLists.txt b/inference-engine/tests_deprecated/functional/CMakeLists.txt index e5da58a7236389..74ee457d2837b5 100644 --- a/inference-engine/tests_deprecated/functional/CMakeLists.txt +++ b/inference-engine/tests_deprecated/functional/CMakeLists.txt @@ -2,10 +2,10 @@ # SPDX-License-Identifier: Apache-2.0 # -add_subdirectory(shared_tests) - disable_deprecated_warnings() +add_subdirectory(shared_tests) + if (ENABLE_MYRIAD) add_subdirectory(vpu) endif() diff --git a/inference-engine/tests_deprecated/functional/shared_tests/CMakeLists.txt b/inference-engine/tests_deprecated/functional/shared_tests/CMakeLists.txt index a5ec4ed85abb3c..835a5a7d12428d 100644 --- a/inference-engine/tests_deprecated/functional/shared_tests/CMakeLists.txt +++ b/inference-engine/tests_deprecated/functional/shared_tests/CMakeLists.txt @@ -4,8 +4,6 @@ set(TARGET_NAME IESharedTests) -disable_deprecated_warnings() - list(APPEND SHARED_LIBRARIES ${NGRAPH_LIBRARIES} commonTestUtils diff --git a/inference-engine/tools/vpu/vpu_perfcheck/CMakeLists.txt b/inference-engine/tools/vpu/vpu_perfcheck/CMakeLists.txt index 80edff53921268..eaa65dc188072e 100644 --- a/inference-engine/tools/vpu/vpu_perfcheck/CMakeLists.txt +++ b/inference-engine/tools/vpu/vpu_perfcheck/CMakeLists.txt @@ -2,8 +2,6 @@ # SPDX-License-Identifier: Apache-2.0 # -disable_deprecated_warnings() - function(add_perfcheck_target TARGET_NAME PLUGIN_NAME) file(GLOB SOURCES *.cpp)