diff --git a/docs/snippets/HETERO0.cpp b/docs/snippets/HETERO0.cpp index d05993229a5..5436cce18d4 100644 --- a/docs/snippets/HETERO0.cpp +++ b/docs/snippets/HETERO0.cpp @@ -8,7 +8,7 @@ auto network = core.ReadNetwork("sample.xml"); auto function = network.getFunction(); //! [part0] for (auto && op : function->get_ops()) - op->get_rt_info()["affinity"] = std::make_shared>("CPU"); + op->get_rt_info()["affinity"] = "CPU"; //! [part0] return 0; } diff --git a/docs/snippets/HETERO1.cpp b/docs/snippets/HETERO1.cpp index 7f5616f5846..6166a779119 100644 --- a/docs/snippets/HETERO1.cpp +++ b/docs/snippets/HETERO1.cpp @@ -24,7 +24,7 @@ res.supportedLayersMap["layerName"] = "CPU"; for (auto&& node : function->get_ops()) { auto& affinity = res.supportedLayersMap[node->get_friendly_name()]; // Store affinity mapping using node runtime information - node->get_rt_info()["affinity"] = std::make_shared>(affinity); + node->get_rt_info()["affinity"] = affinity; } // load network with affinities set before diff --git a/inference-engine/src/mkldnn_plugin/mkldnn_graph_dumper.cpp b/inference-engine/src/mkldnn_plugin/mkldnn_graph_dumper.cpp index aae2495bb2a..974dea727da 100644 --- a/inference-engine/src/mkldnn_plugin/mkldnn_graph_dumper.cpp +++ b/inference-engine/src/mkldnn_plugin/mkldnn_graph_dumper.cpp @@ -186,7 +186,7 @@ std::shared_ptr dump_graph_as_ie_ngraph_net(const MKLDNNGraph } for (auto && kvp : meta_data) - return_node->get_rt_info()[kvp.first] = std::make_shared<::ov::RuntimeAttributeWrapper>(kvp.second); + return_node->get_rt_info()[kvp.first] = kvp.second; return_node->set_friendly_name(node->getName()); return return_node; diff --git a/inference-engine/src/mkldnn_plugin/mkldnn_node.cpp b/inference-engine/src/mkldnn_plugin/mkldnn_node.cpp index 03b2156e183..55703b16384 100644 --- a/inference-engine/src/mkldnn_plugin/mkldnn_node.cpp +++ b/inference-engine/src/mkldnn_plugin/mkldnn_node.cpp @@ -162,8 +162,7 @@ MKLDNNNode::MKLDNNNode(const std::shared_ptr& op, const mkldnn::en const auto it = rtInfo.find("enforceBF16evenForGraphTail"); if (it != rtInfo.end()) { - if (const auto value = std::dynamic_pointer_cast>(it->second)) - enforceBF16evenForGraphTail = value->get(); + enforceBF16evenForGraphTail = it->second.as(); } } diff --git a/inference-engine/src/mkldnn_plugin/ngraph_transformations/rnn_sequences_optimization.cpp b/inference-engine/src/mkldnn_plugin/ngraph_transformations/rnn_sequences_optimization.cpp index 8a6c9fbbe8e..869df73be6d 100644 --- a/inference-engine/src/mkldnn_plugin/ngraph_transformations/rnn_sequences_optimization.cpp +++ b/inference-engine/src/mkldnn_plugin/ngraph_transformations/rnn_sequences_optimization.cpp @@ -67,7 +67,7 @@ namespace { ngraph::replace_node(transposeAfter, {reshape2->output(0)}); } - sequenceOp->get_rt_info()["seqAxis"] = std::make_shared>(seqAxis); + sequenceOp->get_rt_info()["seqAxis"] = seqAxis; return true; } diff --git a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_rnn.cpp b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_rnn.cpp index 76e20434d1e..85d7e0083d3 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_rnn.cpp +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_rnn.cpp @@ -367,7 +367,7 @@ void MKLDNNRNN::initSeq(const std::shared_ptr& op) { const auto rtInfo = op->get_rt_info(); if (rtInfo.count("seqAxis")) { - nativeOrder = std::dynamic_pointer_cast>(rtInfo.at("seqAxis"))->get() == 0; + nativeOrder = rtInfo.at("seqAxis").as() == 0; } out_data_dims.erase(out_data_dims.begin() + 1); diff --git a/inference-engine/src/mkldnn_plugin/utils/ngraph_utils.hpp b/inference-engine/src/mkldnn_plugin/utils/ngraph_utils.hpp index fe27efb885d..1a534d37567 100644 --- a/inference-engine/src/mkldnn_plugin/utils/ngraph_utils.hpp +++ b/inference-engine/src/mkldnn_plugin/utils/ngraph_utils.hpp @@ -13,10 +13,9 @@ namespace MKLDNNPlugin { 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); - return value->get(); + return it->second.as(); } else { - return ""; + return {}; } } diff --git a/inference-engine/src/vpu/graph_transformer/src/utils/runtime_graph.cpp b/inference-engine/src/vpu/graph_transformer/src/utils/runtime_graph.cpp index 73934b614d4..0a652adb9ad 100644 --- a/inference-engine/src/vpu/graph_transformer/src/utils/runtime_graph.cpp +++ b/inference-engine/src/vpu/graph_transformer/src/utils/runtime_graph.cpp @@ -90,7 +90,7 @@ std::shared_ptr buildRuntimeGraph(GraphMetaInfo& graphMetaInfo node->set_friendly_name(stageMeta.stageName); const auto metaData = extractMeta(stageMeta); for (const auto& meta : metaData) { - node->get_rt_info()[meta.first] = std::make_shared<::ngraph::VariantWrapper>(meta.second); + node->get_rt_info()[meta.first] = meta.second; } stageMetaIndexToNode[index] = node; diff --git a/inference-engine/tests/functional/inference_engine/cnn_network/cnn_ngraph_impl_tests.cpp b/inference-engine/tests/functional/inference_engine/cnn_network/cnn_ngraph_impl_tests.cpp index eaa3c1a048d..c39e232c991 100644 --- a/inference-engine/tests/functional/inference_engine/cnn_network/cnn_ngraph_impl_tests.cpp +++ b/inference-engine/tests/functional/inference_engine/cnn_network/cnn_ngraph_impl_tests.cpp @@ -348,7 +348,7 @@ TEST(CNNNGraphImplTests, TestSaveAffinity) { auto param = std::make_shared(type, shape); auto relu = std::make_shared(param); auto& rtInfo = relu->get_rt_info(); - rtInfo["affinity"] = std::make_shared> (testAffinity); + rtInfo["affinity"] = testAffinity; relu->set_friendly_name("testReLU"); auto result = std::make_shared(relu); diff --git a/inference-engine/tests/functional/inference_engine/ir_serialization/rt_info_deserialization.cpp b/inference-engine/tests/functional/inference_engine/ir_serialization/rt_info_deserialization.cpp index c8c14c7b7d7..ac47bee0692 100644 --- a/inference-engine/tests/functional/inference_engine/ir_serialization/rt_info_deserialization.cpp +++ b/inference-engine/tests/functional/inference_engine/ir_serialization/rt_info_deserialization.cpp @@ -40,7 +40,7 @@ protected: ov::frontend::FrontEnd::Ptr FE; ov::frontend::InputModel::Ptr inputModel; - ov::RuntimeAttributeVector params{&modelStream}; + ov::AnyVector params{&modelStream}; FE = manager.load_by_model(params); if (FE) @@ -131,9 +131,8 @@ TEST_F(RTInfoDeserialization, NodeV10) { auto check_version = [](const std::shared_ptr& f, int version_ref) { auto& rt_info = f->get_rt_info(); ASSERT_TRUE(rt_info.count("version")); - auto version = std::dynamic_pointer_cast>(rt_info.at("version")); - ASSERT_NE(version, nullptr); - ASSERT_EQ(version->get(), version_ref); + ASSERT_TRUE(rt_info.at("version").is()); + ASSERT_EQ(rt_info.at("version").as(), version_ref); }; check_version(f, 10); @@ -285,9 +284,8 @@ TEST_F(RTInfoDeserialization, InputAndOutputV10) { auto check_version = [](const std::shared_ptr& f, int ref_version) { auto& rt_info = f->get_rt_info(); ASSERT_TRUE(rt_info.count("version")); - auto version = std::dynamic_pointer_cast>(rt_info.at("version")); - ASSERT_NE(version, nullptr); - ASSERT_EQ(version->get(), ref_version); + ASSERT_TRUE(rt_info.at("version").is()); + ASSERT_EQ(rt_info.at("version").as(), ref_version); }; check_version(f, 10); @@ -443,9 +441,8 @@ TEST_F(RTInfoDeserialization, NodeV11) { auto check_version = [](const std::shared_ptr& f, int ref_version) { auto& rt_info = f->get_rt_info(); ASSERT_TRUE(rt_info.count("version")); - auto version = std::dynamic_pointer_cast>(rt_info.at("version")); - ASSERT_NE(version, nullptr); - EXPECT_EQ(version->get(), ref_version); + ASSERT_TRUE(rt_info.at("version").is()); + ASSERT_EQ(rt_info.at("version").as(), ref_version); }; check_version(f, 11); @@ -709,9 +706,8 @@ TEST_F(RTInfoDeserialization, InputAndOutputV11) { auto check_version = [](const std::shared_ptr& f, int ref_version) { auto& rt_info = f->get_rt_info(); ASSERT_TRUE(rt_info.count("version")); - auto version = std::dynamic_pointer_cast>(rt_info.at("version")); - ASSERT_NE(version, nullptr); - ASSERT_EQ(version->get(), ref_version); + ASSERT_TRUE(rt_info.at("version").is()); + ASSERT_EQ(rt_info.at("version").as(), ref_version); }; check_version(f, 11); @@ -872,9 +868,8 @@ TEST_F(RTInfoDeserialization, IndexesInputAndOutputV11) { auto check_version = [](const std::shared_ptr& f, int ref_version) { auto& rt_info = f->get_rt_info(); ASSERT_TRUE(rt_info.count("version")); - auto version = std::dynamic_pointer_cast>(rt_info.at("version")); - ASSERT_NE(version, nullptr); - ASSERT_EQ(version->get(), ref_version); + ASSERT_TRUE(rt_info.at("version").is()); + ASSERT_EQ(rt_info.at("version").as(), ref_version); }; check_version(f, 11); @@ -965,9 +960,8 @@ TEST_F(RTInfoDeserialization, V11toV10WithoutRTInfo) { auto check_version = [](const std::shared_ptr& f, int ref_version) { auto& rt_info = f->get_rt_info(); ASSERT_TRUE(rt_info.count("version")); - auto version = std::dynamic_pointer_cast>(rt_info.at("version")); - ASSERT_NE(version, nullptr); - ASSERT_EQ(version->get(), ref_version); + ASSERT_TRUE(rt_info.at("version").is()); + ASSERT_EQ(rt_info.at("version").as(), ref_version); }; InferenceEngine::Core core; auto cnn = core.ReadNetwork(model, InferenceEngine::Blob::CPtr()); diff --git a/inference-engine/tests/functional/inference_engine/ir_serialization/rt_info_serialization.cpp b/inference-engine/tests/functional/inference_engine/ir_serialization/rt_info_serialization.cpp index e3cf7db8ae9..d72ad3b4a1a 100644 --- a/inference-engine/tests/functional/inference_engine/ir_serialization/rt_info_serialization.cpp +++ b/inference-engine/tests/functional/inference_engine/ir_serialization/rt_info_serialization.cpp @@ -34,7 +34,7 @@ protected: ov::frontend::FrontEnd::Ptr FE; ov::frontend::InputModel::Ptr inputModel; - ov::RuntimeAttributeVector params{model_path, weights_path}; + ov::AnyVector params{model_path, weights_path}; FE = manager.load_by_model(params); if (FE) diff --git a/inference-engine/tests/functional/plugin/cpu/bfloat16/memory_conv.cpp b/inference-engine/tests/functional/plugin/cpu/bfloat16/memory_conv.cpp index e4d7fa1ea38..e53dc92c5f3 100644 --- a/inference-engine/tests/functional/plugin/cpu/bfloat16/memory_conv.cpp +++ b/inference-engine/tests/functional/plugin/cpu/bfloat16/memory_conv.cpp @@ -91,10 +91,10 @@ TEST_P(MemoryConv, CheckTypeConversion) { for (auto &node : exec_ops) { auto var = node->get_rt_info()["layerType"]; - auto s_val = std::dynamic_pointer_cast>(var); - if (s_val->get() == "MemoryOutput") + auto s_val = var.as(); + if (s_val == "MemoryOutput") mem_w = node; - if (s_val->get() == "MemoryInput") + if (s_val == "MemoryInput") mem_r = node; } diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/behavior/executable_network/exec_graph_info.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/behavior/executable_network/exec_graph_info.cpp index 40c3b360af3..0279a60c118 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/behavior/executable_network/exec_graph_info.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/behavior/executable_network/exec_graph_info.cpp @@ -33,10 +33,9 @@ for (const auto & op : function->get_ops()) { const auto & rtInfo = op->get_rt_info(); auto it = rtInfo.find(ExecGraphInfoSerialization::LAYER_TYPE); ASSERT_NE(rtInfo.end(), it); -auto opType = std::dynamic_pointer_cast>(it->second); -ASSERT_NE(nullptr, opType); +auto opType = it->second.as(); -if (opType->get() == "Reorder") { +if (opType == "Reorder") { numReorders++; } } diff --git a/inference-engine/tests/functional/plugin/cpu/single_layer_tests/convolution.cpp b/inference-engine/tests/functional/plugin/cpu/single_layer_tests/convolution.cpp index 52d303d44aa..201710bc73e 100755 --- a/inference-engine/tests/functional/plugin/cpu/single_layer_tests/convolution.cpp +++ b/inference-engine/tests/functional/plugin/cpu/single_layer_tests/convolution.cpp @@ -99,9 +99,7 @@ protected: auto getExecValue = [&rtInfo](const std::string & paramName) -> std::string { auto it = rtInfo.find(paramName); IE_ASSERT(rtInfo.end() != it); - auto value = std::dynamic_pointer_cast>(it->second); - IE_ASSERT(nullptr != value); - return value->get(); + return it->second.as(); }; if (getExecValue(ExecGraphInfoSerialization::LAYER_TYPE) == "Convolution") { diff --git a/inference-engine/tests/functional/plugin/cpu/single_layer_tests/group_convolution.cpp b/inference-engine/tests/functional/plugin/cpu/single_layer_tests/group_convolution.cpp index f5e7942646e..cf68d024acf 100644 --- a/inference-engine/tests/functional/plugin/cpu/single_layer_tests/group_convolution.cpp +++ b/inference-engine/tests/functional/plugin/cpu/single_layer_tests/group_convolution.cpp @@ -100,9 +100,7 @@ protected: auto getExecValue = [&rtInfo](const std::string & paramName) -> std::string { auto it = rtInfo.find(paramName); IE_ASSERT(rtInfo.end() != it); - auto value = std::dynamic_pointer_cast>(it->second); - IE_ASSERT(nullptr != value); - return value->get(); + return it->second.as(); }; if (getExecValue(ExecGraphInfoSerialization::LAYER_TYPE) == "Convolution") { diff --git a/inference-engine/tests/functional/plugin/cpu/subgraph_tests/src/fuse_transpose_reorder.cpp b/inference-engine/tests/functional/plugin/cpu/subgraph_tests/src/fuse_transpose_reorder.cpp index 3f8eab0dd93..86f4649d98c 100644 --- a/inference-engine/tests/functional/plugin/cpu/subgraph_tests/src/fuse_transpose_reorder.cpp +++ b/inference-engine/tests/functional/plugin/cpu/subgraph_tests/src/fuse_transpose_reorder.cpp @@ -31,9 +31,7 @@ void FuseTransposeAndReorderTest::CheckTransposeCount(size_t expectedTransposeCo auto getExecValue = [&rtInfo](const std::string & paramName) -> std::string { auto it = rtInfo.find(paramName); IE_ASSERT(rtInfo.end() != it); - auto value = std::dynamic_pointer_cast>(it->second); - IE_ASSERT(nullptr != value); - return value->get(); + return it->second.as(); }; if (getExecValue(ExecGraphInfoSerialization::LAYER_TYPE) == "Transpose") { actualTransposeCount++; 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 005f1702029..f3252277101 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 @@ -138,17 +138,13 @@ void CPUTestsBase::CheckPluginRelatedResultsImpl(std::shared_ptr std::string { auto it = rtInfo.find(paramName); IE_ASSERT(rtInfo.end() != it); - auto value = std::dynamic_pointer_cast>(it->second); - IE_ASSERT(nullptr != value); - return value->get(); + return it->second.as(); }; auto getExecValueOutputsLayout = [] (std::shared_ptr node) -> std::string { auto rtInfo = node->get_rt_info(); auto it = rtInfo.find(ExecGraphInfoSerialization::OUTPUT_LAYOUTS); IE_ASSERT(rtInfo.end() != it); - auto value = std::dynamic_pointer_cast>(it->second); - IE_ASSERT(nullptr != value); - return value->get(); + return it->second.as(); }; // skip policy auto should_be_skipped = [] (const ngraph::PartialShape &partialShape, cpu_memory_format_t fmt) { @@ -273,10 +269,10 @@ CPUTestsBase::makeCPUInfo(std::vector inFmts, std::vector>(impls2str(priority))}); + cpuInfo.insert({"PrimitivesPriority", impls2str(priority)}); } - cpuInfo.insert({"enforceBF16evenForGraphTail", ov::make_runtime_attribute(true)}); + cpuInfo.insert({"enforceBF16evenForGraphTail", true}); return cpuInfo; } @@ -337,9 +333,7 @@ void CheckNodeOfTypeCount(InferenceEngine::ExecutableNetwork &execNet, std::stri auto getExecValue = [&rtInfo](const std::string & paramName) -> std::string { auto it = rtInfo.find(paramName); IE_ASSERT(rtInfo.end() != it); - auto value = std::dynamic_pointer_cast>(it->second); - IE_ASSERT(nullptr != value); - return value->get(); + return it->second.as(); }; if (getExecValue(ExecGraphInfoSerialization::LAYER_TYPE) == nodeType) { actualNodeCount++; diff --git a/inference-engine/tests/functional/plugin/cpu/test_utils/fusing_test_utils.cpp b/inference-engine/tests/functional/plugin/cpu/test_utils/fusing_test_utils.cpp index 501863e8b29..bc1d3e37435 100644 --- a/inference-engine/tests/functional/plugin/cpu/test_utils/fusing_test_utils.cpp +++ b/inference-engine/tests/functional/plugin/cpu/test_utils/fusing_test_utils.cpp @@ -45,10 +45,7 @@ void CpuTestWithFusing::CheckFusingResults(std::shared_ptr f auto getExecValue = [](const std::string ¶mName, const ngraph::Node::RTMap& rtInfo) -> std::string { auto it = rtInfo.find(paramName); IE_ASSERT(rtInfo.end() != it); - auto value = std::dynamic_pointer_cast>(it->second); - IE_ASSERT(nullptr != value); - - return value->get(); + return it->second.as(); }; auto layerType = getExecValue("layerType", rtInfo); diff --git a/inference-engine/tests/functional/plugin/shared/include/base/ov_behavior_test_utils.hpp b/inference-engine/tests/functional/plugin/shared/include/base/ov_behavior_test_utils.hpp index e5d693e13d5..60266dd036b 100644 --- a/inference-engine/tests/functional/plugin/shared/include/base/ov_behavior_test_utils.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/base/ov_behavior_test_utils.hpp @@ -105,7 +105,7 @@ public: auto it = deviceMapping.find(op->get_friendly_name()); if (it != deviceMapping.end()) { std::string affinity = it->second; - op->get_rt_info()["affinity"] = std::make_shared>(affinity); + op->get_rt_info()["affinity"] = affinity; } } } diff --git a/inference-engine/tests/functional/plugin/shared/include/behavior/executable_network/exec_network_base.hpp b/inference-engine/tests/functional/plugin/shared/include/behavior/executable_network/exec_network_base.hpp index 5b6e2970bc8..29796844f2c 100644 --- a/inference-engine/tests/functional/plugin/shared/include/behavior/executable_network/exec_network_base.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/behavior/executable_network/exec_network_base.hpp @@ -181,10 +181,7 @@ TEST_P(ExecutableNetworkBaseTest, CheckExecGraphInfoBeforeExecution) { auto getExecValue = [&rtInfo](const std::string & paramName) -> std::string { auto it = rtInfo.find(paramName); IE_ASSERT(rtInfo.end() != it); - auto value = std::dynamic_pointer_cast>(it->second); - IE_ASSERT(nullptr != value); - - return value->get(); + return it->second.as(); }; // Each layer from the execGraphInfo network must have PM data option set @@ -235,10 +232,7 @@ TEST_P(ExecutableNetworkBaseTest, CheckExecGraphInfoAfterExecution) { auto getExecValue = [&rtInfo](const std::string & paramName) -> std::string { auto it = rtInfo.find(paramName); IE_ASSERT(rtInfo.end() != it); - auto value = std::dynamic_pointer_cast>(it->second); - IE_ASSERT(nullptr != value); - - return value->get(); + return it->second.as(); }; // At least one layer in the topology should be executed and have valid perf counter value diff --git a/inference-engine/tests/functional/plugin/shared/include/behavior/ov_executable_network/exec_network_base.hpp b/inference-engine/tests/functional/plugin/shared/include/behavior/ov_executable_network/exec_network_base.hpp index f2ce4e89b10..ea0c037a885 100644 --- a/inference-engine/tests/functional/plugin/shared/include/behavior/ov_executable_network/exec_network_base.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/behavior/ov_executable_network/exec_network_base.hpp @@ -220,10 +220,7 @@ TEST_P(OVExecutableNetworkBaseTest, CheckExecGraphInfoBeforeExecution) { auto getExecValue = [&rtInfo](const std::string& paramName) -> std::string { auto it = rtInfo.find(paramName); IE_ASSERT(rtInfo.end() != it); - auto value = std::dynamic_pointer_cast>(it->second); - IE_ASSERT(nullptr != value); - - return value->get(); + return it->second.as(); }; // Each layer from the execGraphInfo network must have PM data option set @@ -274,10 +271,7 @@ TEST_P(OVExecutableNetworkBaseTest, CheckExecGraphInfoAfterExecution) { auto getExecValue = [&rtInfo](const std::string& paramName) -> std::string { auto it = rtInfo.find(paramName); IE_ASSERT(rtInfo.end() != it); - auto value = std::dynamic_pointer_cast>(it->second); - IE_ASSERT(nullptr != value); - - return value->get(); + return it->second.as(); }; // At least one layer in the topology should be executed and have valid perf counter value 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 6b301c27a68..90dab44222b 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 @@ -424,7 +424,7 @@ TEST_P(OVClassNetworkTestP, SetAffinityWithConstantBranches) { } for (const auto& op : func->get_ops()) { std::string affinity = rl_map[op->get_friendly_name()]; - op->get_rt_info()["affinity"] = std::make_shared>(affinity); + op->get_rt_info()["affinity"] = affinity; } auto exeNetwork = ie.compile_model(ksoNetwork, deviceName); } catch (const InferenceEngine::NotImplemented& ex) { @@ -446,7 +446,7 @@ TEST_P(OVClassNetworkTestP, SetAffinityWithKSO) { } for (const auto& op : func->get_ops()) { std::string affinity = rl_map[op->get_friendly_name()]; - op->get_rt_info()["affinity"] = std::make_shared>(affinity); + op->get_rt_info()["affinity"] = affinity; } auto exeNetwork = ie.compile_model(ksoNetwork, deviceName); } catch (const ov::Exception& ex) { diff --git a/inference-engine/tests/functional/plugin/shared/include/behavior/plugin/core_integration.hpp b/inference-engine/tests/functional/plugin/shared/include/behavior/plugin/core_integration.hpp index 3cb94ab5125..42bab2d5299 100644 --- a/inference-engine/tests/functional/plugin/shared/include/behavior/plugin/core_integration.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/behavior/plugin/core_integration.hpp @@ -469,7 +469,7 @@ TEST_P(IEClassNetworkTestP, SetAffinityWithConstantBranches) { } for (const auto & op : net.getFunction()->get_ops()) { std::string affinity = rl_map[op->get_friendly_name()]; - op->get_rt_info()["affinity"] = std::make_shared>(affinity); + op->get_rt_info()["affinity"] = affinity; } InferenceEngine::ExecutableNetwork exeNetwork = ie.LoadNetwork(ksoCnnNetwork, deviceName); } catch (const InferenceEngine::NotImplemented & ex) { @@ -492,7 +492,7 @@ TEST_P(IEClassNetworkTestP, SetAffinityWithKSO) { } for (const auto & op : ksoCnnNetwork.getFunction()->get_ops()) { std::string affinity = rl_map[op->get_friendly_name()]; - op->get_rt_info()["affinity"] = std::make_shared>(affinity); + op->get_rt_info()["affinity"] = affinity; } InferenceEngine::ExecutableNetwork exeNetwork = ie.LoadNetwork(ksoCnnNetwork, deviceName); } catch (const InferenceEngine::Exception& ex) { diff --git a/inference-engine/tests/functional/plugin/shared/src/execution_graph_tests/keep_assign.cpp b/inference-engine/tests/functional/plugin/shared/src/execution_graph_tests/keep_assign.cpp index 037d28e6cb5..3e9d3563f5c 100644 --- a/inference-engine/tests/functional/plugin/shared/src/execution_graph_tests/keep_assign.cpp +++ b/inference-engine/tests/functional/plugin/shared/src/execution_graph_tests/keep_assign.cpp @@ -59,9 +59,9 @@ TEST_P(ExecGraphKeepAssignNode, KeepAssignNode) { bool assign_node_found; for (auto &node : exec_ops) { auto var = node->get_rt_info()["layerType"]; - auto s_val = std::dynamic_pointer_cast>(var); + auto s_val = var.as(); - if (s_val->get() == "MemoryOutput") { + if (s_val == "MemoryOutput") { assign_node_found = true; break; } diff --git a/inference-engine/tests/functional/plugin/shared/src/execution_graph_tests/num_inputs_fusing_bin_conv.cpp b/inference-engine/tests/functional/plugin/shared/src/execution_graph_tests/num_inputs_fusing_bin_conv.cpp index 4ebf3d78883..ce82cb05ad6 100644 --- a/inference-engine/tests/functional/plugin/shared/src/execution_graph_tests/num_inputs_fusing_bin_conv.cpp +++ b/inference-engine/tests/functional/plugin/shared/src/execution_graph_tests/num_inputs_fusing_bin_conv.cpp @@ -64,10 +64,7 @@ TEST_P(ExecGraphInputsFusingBinConv, CheckNumInputsInBinConvFusingWithConv) { auto getExecValue = [&rtInfo](const std::string & paramName) -> std::string { auto it = rtInfo.find(paramName); IE_ASSERT(rtInfo.end() != it); - auto value = std::dynamic_pointer_cast>(it->second); - IE_ASSERT(nullptr != value); - - return value->get(); + return it->second.as(); }; auto layerType = getExecValue("layerType"); diff --git a/inference-engine/tests/functional/plugin/shared/src/execution_graph_tests/runtime_precision.cpp b/inference-engine/tests/functional/plugin/shared/src/execution_graph_tests/runtime_precision.cpp index 607d6217e7e..0e50955bef5 100644 --- a/inference-engine/tests/functional/plugin/shared/src/execution_graph_tests/runtime_precision.cpp +++ b/inference-engine/tests/functional/plugin/shared/src/execution_graph_tests/runtime_precision.cpp @@ -123,11 +123,9 @@ TEST_P(ExecGraphRuntimePrecision, CheckRuntimePrecision) { if (rtIter == rtInfo.end()) FAIL() << "Runtime precision is not found for node: " << opIter->get()->get_friendly_name(); - const auto rtPrecisionPtr = ngraph::as_type_ptr>(rtIter->second); - - if (expectedPrc.second.name() != rtPrecisionPtr->get()) + if (expectedPrc.second.name() != rtIter->second.as()) FAIL() << "`" << expectedPrc.first << "' node runtime precision mismatch: actual = " << - rtPrecisionPtr->get() << ", expected = " << expectedPrc.second.name(); + rtIter->second.as() << ", expected = " << expectedPrc.second.name(); } fnPtr.reset(); diff --git a/inference-engine/tests/functional/plugin/shared/src/hetero/synthetic.cpp b/inference-engine/tests/functional/plugin/shared/src/hetero/synthetic.cpp index 05550bdbc94..070889ca225 100644 --- a/inference-engine/tests/functional/plugin/shared/src/hetero/synthetic.cpp +++ b/inference-engine/tests/functional/plugin/shared/src/hetero/synthetic.cpp @@ -165,7 +165,7 @@ std::string HeteroSyntheticTest::SetUpAffinity() { } else { affinity = pluginParameters.at(1)._name; } - node->get_rt_info()["affinity"] = std::make_shared>(affinity); + node->get_rt_info()["affinity"] = affinity; affinities += "\t{\"" + node->get_friendly_name() + "\",\t\t\"" + affinity + "\"}\n"; } } diff --git a/inference-engine/tests/functional/plugin/shared/src/ngraph_conversion_tests/conv_bias_fusion.cpp b/inference-engine/tests/functional/plugin/shared/src/ngraph_conversion_tests/conv_bias_fusion.cpp index b168ae1a8f3..ba689e56bed 100644 --- a/inference-engine/tests/functional/plugin/shared/src/ngraph_conversion_tests/conv_bias_fusion.cpp +++ b/inference-engine/tests/functional/plugin/shared/src/ngraph_conversion_tests/conv_bias_fusion.cpp @@ -51,9 +51,7 @@ TEST_P(ConvBiasFusion, ConvBiasFusion) { auto rtInfo = op->get_rt_info(); auto it = rtInfo.find("originalLayersNames"); ASSERT_NE(rtInfo.end(), it); - auto variant = std::dynamic_pointer_cast>(it->second); - ASSERT_NE(nullptr, variant); - ASSERT_EQ(variant->get(), "add,conv"); + ASSERT_EQ(it->second.as(), "add,conv"); break; } } diff --git a/inference-engine/tests/functional/shared_test_classes/src/base/layer_test_utils.cpp b/inference-engine/tests/functional/shared_test_classes/src/base/layer_test_utils.cpp index de9ecc7dece..484a03418e1 100644 --- a/inference-engine/tests/functional/shared_test_classes/src/base/layer_test_utils.cpp +++ b/inference-engine/tests/functional/shared_test_classes/src/base/layer_test_utils.cpp @@ -481,11 +481,8 @@ std::string LayerTestsCommon::getRuntimePrecision(const std::string& layerName) if (name == layerName) { const auto& rtInfo = op->get_rt_info(); const auto& it = rtInfo.find("runtimePrecision"); - IE_ASSERT(it != rtInfo.end()) << "Runtime precision is not found for node: " << name; - - const auto rtPrecisionPtr = ngraph::as_type_ptr>(it->second); - return rtPrecisionPtr->get(); + return it->second.as(); } } @@ -502,14 +499,11 @@ std::string LayerTestsCommon::getRuntimePrecisionByType(const std::string& layer IE_ASSERT(typeIt != rtInfo.end()) << "Layer is not found for type: " << layerType; - const auto type = ngraph::as_type_ptr>(typeIt->second)->get(); + auto type = typeIt->second.as(); if (type == layerType) { const auto& it = rtInfo.find("runtimePrecision"); - IE_ASSERT(it != rtInfo.end()) << "Runtime precision is not found for node: " << type; - - const auto rtPrecisionPtr = ngraph::as_type_ptr>(it->second); - return rtPrecisionPtr->get(); + return it->second.as(); } } @@ -525,11 +519,11 @@ void LayerTestsCommon::showRuntimePrecisions() { const auto& rtInfo = op->get_rt_info(); const auto& typeIt = rtInfo.find("layerType"); - const auto type = ngraph::as_type_ptr>(typeIt->second)->get(); + const auto type = typeIt->second.as(); const auto& it = rtInfo.find("runtimePrecision"); - const auto rtPrecisionPtr = ngraph::as_type_ptr>(it->second); - std::cout << type << ": " << rtPrecisionPtr->get() << std::endl; + const auto rtPrecisionPtr = it->second.as(); + std::cout << type << ": " << rtPrecisionPtr << std::endl; } } #endif diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/add_function.cpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/add_function.cpp index 430b34f35df..634fc3bb962 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/add_function.cpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/add_function.cpp @@ -128,7 +128,7 @@ std::shared_ptr AddFunction::getOriginal( const auto add = std::make_shared(dequantizationOp1, dequantizationOp2); add->set_friendly_name("output"); auto& rtInfo = add->get_rt_info(); - rtInfo["Variant::std::string"] = std::make_shared>("add"); + rtInfo["Variant::std::string"] = "add"; std::shared_ptr output = add; if (additional_output != nullptr) { @@ -308,7 +308,7 @@ std::shared_ptr AddFunction::getReference( NetworkHelper::setOutDataPrecisionForTypeRelaxed(add, dequantizationAfter.empty() ? precision : element::f32); auto& rtInfo = add->get_rt_info(); - rtInfo["Variant::std::string"] = std::make_shared>("add"); + rtInfo["Variant::std::string"] = "add"; auto dequantizationStructureAfter = dequantizationAfter; dequantizationStructureAfter.multiply.outPrecision = precision; diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/common/builders.cpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/common/builders.cpp index 3c11cefbd63..4500e739bd1 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/common/builders.cpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/common/builders.cpp @@ -64,7 +64,7 @@ std::shared_ptr makeDequantization( auto& rt = subtractConstConvert->get_rt_info(); for (const std::string& attribute : dequantizationOperations.subtract.convertAttributes) { - rt[attribute] = std::make_shared>(""); + rt[attribute] = ""; } subtractConst = subtractConstConvert; @@ -105,7 +105,7 @@ std::shared_ptr makeDequantization( if (!dequantizationOperations.subtract.attributes.empty()) { auto& rt = subtract->get_rt_info(); for (const std::string& attribute : dequantizationOperations.subtract.attributes) { - rt[attribute] = std::make_shared>(""); + rt[attribute] = ""; } } diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/concat_function.cpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/concat_function.cpp index 9e5d914db09..04bff8b7ffc 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/concat_function.cpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/concat_function.cpp @@ -41,7 +41,7 @@ std::shared_ptr ConcatFunction::getOriginal( ngraph::OutputVector{ fakeQuantize1->output(0), fakeQuantize2->output(0) }, 1); concat->set_friendly_name("output"); auto& rtInfo = concat->get_rt_info(); - rtInfo["Variant::std::string"] = std::make_shared>("concat"); + rtInfo["Variant::std::string"] = "concat"; ngraph::ResultVector results{ std::make_shared(concat) }; std::shared_ptr function = std::make_shared( @@ -71,7 +71,7 @@ std::shared_ptr ConcatFunction::getOriginal( concat->set_friendly_name("output"); auto& rtInfo = concat->get_rt_info(); - rtInfo["Variant::std::string"] = std::make_shared>("concat"); + rtInfo["Variant::std::string"] = "concat"; ngraph::ResultVector results{ std::make_shared(concat) }; std::shared_ptr function = std::make_shared( @@ -101,7 +101,7 @@ std::shared_ptr ConcatFunction::getOriginalWithChildAndOutput( ngraph::OutputVector{ fakeQuantize1->output(0), fakeQuantize2->output(0) }, 1); concat->set_friendly_name("110"); auto& rtInfo = concat->get_rt_info(); - rtInfo["Variant::std::string"] = std::make_shared>("concat"); + rtInfo["Variant::std::string"] = "concat"; const auto clamp = std::make_shared(concat, 0.0, 6.0); clamp->set_friendly_name("111"); @@ -139,7 +139,7 @@ std::shared_ptr ConcatFunction::getOriginalWithNeighbors( concat1->set_friendly_name("concat1"); auto& rtInfo1 = concat1->get_rt_info(); - rtInfo1["Variant::std::string"] = std::make_shared>("concat1"); + rtInfo1["Variant::std::string"] = "concat1"; ngraph::ParameterVector inputs{input1, input2}; @@ -173,7 +173,7 @@ std::shared_ptr ConcatFunction::getOriginalWithNeighbors( 1ull); concat2->set_friendly_name("concat2"); auto& rtInfo2 = concat2->get_rt_info(); - rtInfo2["Variant::std::string"] = std::make_shared>("concat2"); + rtInfo2["Variant::std::string"] = "concat2"; results.push_back(std::make_shared(concat1)); results.push_back(std::make_shared(concat2)); } else if (neighborType == "convolution") { @@ -255,7 +255,7 @@ std::shared_ptr ConcatFunction::getOriginalWithIntermediate( concat->set_friendly_name("concat"); auto& rtInfo = concat->get_rt_info(); - rtInfo["Variant::std::string"] = std::make_shared>("concat"); + rtInfo["Variant::std::string"] = "concat"; auto weights = ngraph::opset1::Constant::create(precision, ngraph::Shape{ channels, channels, 1, 1 }, { 1 }); auto convolution = std::make_shared( @@ -313,7 +313,7 @@ std::shared_ptr ConcatFunction::getOriginalWithIntermediateAvg concat->set_friendly_name("concat"); auto& rtInfo = concat->get_rt_info(); - rtInfo["Variant::std::string"] = std::make_shared>("concat"); + rtInfo["Variant::std::string"] = "concat"; std::shared_ptr parent2 = std::make_shared( intermediateOp, @@ -373,7 +373,7 @@ std::shared_ptr ConcatFunction::getOriginalWithSplitedIntermed concat->set_friendly_name("output_1"); auto& rtInfo = concat->get_rt_info(); - rtInfo["Variant::std::string"] = std::make_shared>("concat"); + rtInfo["Variant::std::string"] = "concat"; Output lastOutput = intermediateOp->output(1); if (addConvolution) { @@ -454,7 +454,7 @@ std::shared_ptr ConcatFunction::getOriginalSelectionWithInterm concat->set_friendly_name("concat"); auto& rtInfo = concat->get_rt_info(); - rtInfo["Variant::std::string"] = std::make_shared>("concat"); + rtInfo["Variant::std::string"] = "concat"; auto weights = ngraph::opset1::Constant::create(precision, ngraph::Shape{ inputShape[1], inputShape[1], 1, 1 }, { 1 }); auto convolution = std::make_shared( @@ -698,7 +698,7 @@ std::shared_ptr ConcatFunction::getOriginalWithIntermediateWit concat->set_friendly_name("concat"); auto& rtInfo = concat->get_rt_info(); - rtInfo["Variant::std::string"] = std::make_shared>("concat"); + rtInfo["Variant::std::string"] = "concat"; const std::vector kernel = { 3, 3 }; const std::vector stride = { 1, 1 }; @@ -805,7 +805,7 @@ std::shared_ptr ConcatFunction::getOriginalWithIntermediateRes ngraph::OutputVector{ reshape1->output(0), reshape2->output(0) }, 1); concat->set_friendly_name("output"); auto& rtInfo = concat->get_rt_info(); - rtInfo["Variant::std::string"] = std::make_shared>("concat"); + rtInfo["Variant::std::string"] = "concat"; ngraph::ResultVector results{ std::make_shared(concat) }; std::shared_ptr function = std::make_shared( @@ -834,7 +834,7 @@ std::shared_ptr ConcatFunction::getReference( const std::shared_ptr concat = std::make_shared>( ngraph::OutputVector{ fakeQuantize1->output(0), fakeQuantize2->output(0) }, 1); auto& rtInfo = concat->get_rt_info(); - rtInfo["Variant::std::string"] = std::make_shared>("concat"); + rtInfo["Variant::std::string"] = "concat"; const std::shared_ptr lastDequantization = makeDequantization(concat, dequantizationOperations); lastDequantization->set_friendly_name("output"); @@ -920,7 +920,7 @@ std::shared_ptr ConcatFunction::get( addAttributes({ concat }, concatAttributes); auto& rtInfo = concat->get_rt_info(); - rtInfo["Variant::std::string"] = std::make_shared>("concat"); + rtInfo["Variant::std::string"] = "concat"; const auto lastDequantization = makeDequantization(concat, dequantizationAfter); @@ -1044,7 +1044,7 @@ std::shared_ptr ConcatFunction::get( addAttributes({ parent }, concatAttributes); auto& rtInfo = parent->get_rt_info(); - rtInfo["Variant::std::string"] = std::make_shared>("concat"); + rtInfo["Variant::std::string"] = "concat"; parent = makeConvolution(parent, element::f32, false); @@ -1109,7 +1109,7 @@ std::shared_ptr ConcatFunction::getReferenceWithNeighbors( concat1->set_friendly_name("concat1"); auto& rtInfo1 = concat1->get_rt_info(); - rtInfo1["Variant::std::string"] = std::make_shared>("concat1"); + rtInfo1["Variant::std::string"] = "concat1"; ngraph::ParameterVector inputs{input1, input2}; std::shared_ptr mainBranch = concat1; @@ -1157,7 +1157,7 @@ std::shared_ptr ConcatFunction::getReferenceWithNeighbors( 1ull); concat2->set_friendly_name("concat2"); auto& rtInfo2 = concat2->get_rt_info(); - rtInfo2["Variant::std::string"] = std::make_shared>("concat2"); + rtInfo2["Variant::std::string"] = "concat2"; neighbor = concat2; } else if (neighborType == "convolution") { @@ -1270,7 +1270,7 @@ std::shared_ptr ConcatFunction::getReferenceWithIntermediate( low_precision::NetworkHelper::setOutDataPrecision(concat, precisionAfterOperation); auto& rtInfo = concat->get_rt_info(); - rtInfo["Variant::std::string"] = std::make_shared>("concat"); + rtInfo["Variant::std::string"] = "concat"; const std::shared_ptr lastDequantization1 = makeDequantization(concat, dequantizationAfter1); lastDequantization1->set_friendly_name("concat"); @@ -1345,7 +1345,7 @@ std::shared_ptr ConcatFunction::getReferenceWithIntermediateAv low_precision::NetworkHelper::setOutDataPrecision(concat, precisionAfterOperation); auto& rtInfo = concat->get_rt_info(); - rtInfo["Variant::std::string"] = std::make_shared>("concat"); + rtInfo["Variant::std::string"] = "concat"; const std::shared_ptr parent1 = makeDequantization(concat, dequantizationAfter1); parent1->set_friendly_name("concat"); @@ -1430,7 +1430,7 @@ std::shared_ptr ConcatFunction::getReferenceWithSplitedInterme concat->set_friendly_name("concat"); auto& rtInfo = concat->get_rt_info(); - rtInfo["Variant::std::string"] = std::make_shared>("concat"); + rtInfo["Variant::std::string"] = "concat"; const auto lastDequantization1 = makeDequantization(concat, dequantizationOperations1); const auto lastDequantization2 = makeDequantization(intermediateOp->output(1), dequantizationOperations2); @@ -1532,7 +1532,7 @@ std::shared_ptr ConcatFunction::getReferenceSelectionWithInter low_precision::NetworkHelper::setOutDataPrecision(concat, precisionAfterOperation); auto& rtInfo = concat->get_rt_info(); - rtInfo["Variant::std::string"] = std::make_shared>("concat"); + rtInfo["Variant::std::string"] = "concat"; const std::shared_ptr lastDequantization1 = dequantizationOperations1.empty() ? concat : @@ -1812,7 +1812,7 @@ std::shared_ptr ConcatFunction::getReferenceWithIntermediateWi ngraph::pass::low_precision::NetworkHelper::setOutDataPrecision(concat, precisionAfterOperation); auto& rtInfo = concat->get_rt_info(); - rtInfo["Variant::std::string"] = std::make_shared>("concat"); + rtInfo["Variant::std::string"] = "concat"; const auto deqAfter = makeDequantization(concat->output(0), dequantizationAfter); deqAfter->set_friendly_name("concat"); @@ -1938,7 +1938,7 @@ std::shared_ptr ConcatFunction::getReferenceWithIntermediateRe ngraph::OutputVector{ reshape1->output(0), reshape2->output(0) }, 1); concat->set_friendly_name("output_original"); auto& rtInfo = concat->get_rt_info(); - rtInfo["Variant::std::string"] = std::make_shared>("concat"); + rtInfo["Variant::std::string"] = "concat"; const auto dequantization = makeDequantization(concat, dequantizationAfter); dequantization->set_friendly_name("output"); diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/convolution_function.cpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/convolution_function.cpp index e5606d9647b..f38fd05805f 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/convolution_function.cpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/convolution_function.cpp @@ -107,7 +107,7 @@ std::shared_ptr ConvolutionFunction::getOriginal( std::vector{ netPrecision }); convolution->set_friendly_name("output"); auto& rtInfo = convolution->get_rt_info(); - rtInfo["Variant::std::string"] = std::make_shared>("convolution"); + rtInfo["Variant::std::string"] = "convolution"; ngraph::ResultVector results{ std::make_shared(convolution) }; return std::make_shared(results, ngraph::ParameterVector{ input }, "ConvolutionTransformation"); @@ -305,7 +305,7 @@ std::shared_ptr ConvolutionFunction::getReference( precisionAfterOperation); } auto& rtInfo = convolution->get_rt_info(); - rtInfo["Variant::std::string"] = std::make_shared>("convolution"); + rtInfo["Variant::std::string"] = "convolution"; auto dequantizationStructure = dequantizationAfter; dequantizationStructure.multiply.outPrecision = netPrecision; diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/elementwise_with_multi_parent_dequantization_function.cpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/elementwise_with_multi_parent_dequantization_function.cpp index 5479e585f27..28646ad19b3 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/elementwise_with_multi_parent_dequantization_function.cpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/elementwise_with_multi_parent_dequantization_function.cpp @@ -48,7 +48,7 @@ std::shared_ptr ElementwiseWithMultiParentDequantizationFuncti const auto add = std::make_shared(parent1, parent2); add->set_friendly_name("output"); auto& rtInfo = add->get_rt_info(); - rtInfo["Variant::std::string"] = std::make_shared>("add"); + rtInfo["Variant::std::string"] = "add"; ngraph::ResultVector results{ std::make_shared(add) }; ngraph::ParameterVector parameters = { input1_1, input1_2, input2_1, input2_2 }; diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/fake_quantize_function.cpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/fake_quantize_function.cpp index a0441772afb..84160a17aa1 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/fake_quantize_function.cpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/fake_quantize_function.cpp @@ -38,7 +38,7 @@ std::shared_ptr FakeQuantizeFunction::getOriginalWithMaxPool( fakeQuantize->set_friendly_name("fakeQuantize"); auto& rtInfo = fakeQuantize->get_rt_info(); - rtInfo["Variant::std::string"] = std::make_shared>("fakeQuantize"); + rtInfo["Variant::std::string"] = "fakeQuantize"; ngraph::ResultVector results{ std::make_shared(maxPool) }; return std::make_shared(results, ngraph::ParameterVector{ input }, "FakeQuantizeFunction"); @@ -56,7 +56,7 @@ std::shared_ptr FakeQuantizeFunction::getOriginal( const auto fakeQuantize = makeFakeQuantize(input, ngraph::element::f32, fakeQuantizeOnData); fakeQuantize->set_friendly_name("fakeQuantize"); auto& rtInfo = fakeQuantize->get_rt_info(); - rtInfo["Variant::std::string"] = std::make_shared>("fakeQuantize"); + rtInfo["Variant::std::string"] = "fakeQuantize"; std::shared_ptr lastOperation = fakeQuantize; if (addNotPrecisionPreservedOperation) { @@ -90,7 +90,7 @@ std::shared_ptr FakeQuantizeFunction::getReference( auto fakeQuantize = makeFakeQuantizeTypeRelaxed(input, ngraph::element::f32, fakeQuantizeOnData); auto& rtInfo = fakeQuantize->get_rt_info(); - rtInfo["Variant::std::string"] = std::make_shared>("fakeQuantize"); + rtInfo["Variant::std::string"] = "fakeQuantize"; std::shared_ptr lastOperation = fakeQuantize; if (addNotPrecisionPreservedOperation) { diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/mat_mul_function.cpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/mat_mul_function.cpp index a1004ad01c9..7f94df02955 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/mat_mul_function.cpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/mat_mul_function.cpp @@ -192,7 +192,7 @@ std::shared_ptr MatMulFunction::getOriginal( false); matMul->set_friendly_name("matMul"); auto& rtInfo = matMul->get_rt_info(); - rtInfo["Variant::std::string"] = std::make_shared>("matMul"); + rtInfo["Variant::std::string"] = "matMul"; const auto result = std::make_shared(matMul); std::shared_ptr function = std::make_shared( @@ -281,7 +281,7 @@ std::shared_ptr MatMulFunction::getReference( false); matMul->set_friendly_name("matMul"); auto& rtInfo = matMul->get_rt_info(); - rtInfo["Variant::std::string"] = std::make_shared>("matMul"); + rtInfo["Variant::std::string"] = "matMul"; ngraph::pass::low_precision::NetworkHelper::setOutDataPrecision(matMul, precision); const std::shared_ptr lastDequantizationAfter = makeDequantization(matMul, resultDequantization); diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/move_dequantization_after_function.cpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/move_dequantization_after_function.cpp index 3714287294f..13a79ad4b94 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/move_dequantization_after_function.cpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/move_dequantization_after_function.cpp @@ -33,7 +33,7 @@ namespace subgraph { std::vector{ element::f32, element::f32 }, std::vector{}); auto& rtInfo = targetOp->get_rt_info(); - rtInfo["Variant::std::string"] = std::make_shared>("targetOp"); + rtInfo["Variant::std::string"] = "targetOp"; return std::make_shared( ngraph::ResultVector{ std::make_shared(targetOp) }, @@ -63,7 +63,7 @@ namespace subgraph { std::vector{}); ngraph::pass::low_precision::NetworkHelper::setOutDataPrecisionForTypeRelaxed(targetOp, precisionAfterOperation); auto& rtInfo = targetOp->get_rt_info(); - rtInfo["Variant::std::string"] = std::make_shared>("targetOp"); + rtInfo["Variant::std::string"] = "targetOp"; const auto deqAfter = makeDequantization(targetOp, dequantizationAfter); diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/multiply_function.cpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/multiply_function.cpp index 7d15347dd01..714a7ab1cdf 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/multiply_function.cpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/multiply_function.cpp @@ -71,7 +71,7 @@ std::shared_ptr MultiplyFunction::get( std::vector{element::f32, element::f32}, std::vector{precision}); auto& rtInfo = multiply->get_rt_info(); - rtInfo["Variant::std::string"] = std::make_shared>("multiply"); + rtInfo["Variant::std::string"] = "multiply"; multiply->set_friendly_name("output"); ngraph::ResultVector results{ std::make_shared(multiply) }; diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/mvn_function.cpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/mvn_function.cpp index b18ce655711..a83e5ba984d 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/mvn_function.cpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/mvn_function.cpp @@ -37,7 +37,7 @@ std::shared_ptr MVNFunction::getOriginal( } mvn->set_friendly_name("output"); auto& rtInfo = mvn->get_rt_info(); - rtInfo["Variant::std::string"] = std::make_shared>("mvn"); + rtInfo["Variant::std::string"] = "mvn"; ngraph::ResultVector results{ std::make_shared(mvn) }; return std::make_shared(results, ngraph::ParameterVector{ input }, "MVNFunction"); @@ -90,7 +90,7 @@ std::shared_ptr MVNFunction::getReference( dequantizationAfter.empty() ? precision : element::f32); } auto& rtInfo = mvn->get_rt_info(); - rtInfo["Variant::std::string"] = std::make_shared>("mvn"); + rtInfo["Variant::std::string"] = "mvn"; auto deqAfterStructure = dequantizationAfter; deqAfterStructure.multiply.outPrecision = precision; diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/normalize_dequantization_function.cpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/normalize_dequantization_function.cpp index 343bb6da0d5..09a2e4ab10e 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/normalize_dequantization_function.cpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/normalize_dequantization_function.cpp @@ -32,7 +32,7 @@ namespace subgraph { std::vector{ element::f32, element::f32 }, std::vector{}); auto& rtInfo = targetOp->get_rt_info(); - rtInfo["Variant::std::string"] = std::make_shared>("targetOp"); + rtInfo["Variant::std::string"] = "targetOp"; return std::make_shared( ngraph::ResultVector{ std::make_shared(targetOp) }, diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/normalize_l2_function.cpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/normalize_l2_function.cpp index 699e8ccb08e..54969eb0be2 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/normalize_l2_function.cpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/normalize_l2_function.cpp @@ -79,7 +79,7 @@ std::shared_ptr NormalizeL2Function::getOriginal( const auto normalizeL2 = std::make_shared(deq, axesNode, 1e-6, epsMode); normalizeL2->set_friendly_name("output"); auto& rtInfo = normalizeL2->get_rt_info(); - rtInfo["Variant::std::string"] = std::make_shared>("normalizeL2"); + rtInfo["Variant::std::string"] = "normalizeL2"; ngraph::ResultVector results = { std::make_shared(normalizeL2) }; const auto function = std::make_shared(results, ngraph::ParameterVector{ input }, "NormalizeL2Transformation"); @@ -113,7 +113,7 @@ std::shared_ptr NormalizeL2Function::getReference( 1e-6, epsMode); auto& rtInfo = normalizeL2->get_rt_info(); - rtInfo["Variant::std::string"] = std::make_shared>("normalizeL2"); + rtInfo["Variant::std::string"] = "normalizeL2"; auto deqAfterStructure = dequantizationAfter; deqAfterStructure.multiply.outPrecision = precision; diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/precision_propagation_function.cpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/precision_propagation_function.cpp index 1f1f9c66993..f767bf1f9a9 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/precision_propagation_function.cpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/precision_propagation_function.cpp @@ -89,7 +89,7 @@ std::shared_ptr PrecisionPropagationFunction::getOriginalWithN concat1->set_friendly_name("concat1"); auto& rtInfo1 = concat1->get_rt_info(); - rtInfo1["Variant::std::string"] = std::make_shared>("concat1"); + rtInfo1["Variant::std::string"] = "concat1"; const auto concat2 = std::make_shared( ngraph::OutputVector { parent2->output(0), parent3->output(0) }, @@ -97,7 +97,7 @@ std::shared_ptr PrecisionPropagationFunction::getOriginalWithN concat2->set_friendly_name("concat2"); auto& rtInfo2 = concat2->get_rt_info(); - rtInfo2["Variant::std::string"] = std::make_shared>("concat2"); + rtInfo2["Variant::std::string"] = "concat2"; std::shared_ptr result1 = concat1; std::shared_ptr result2 = concat2; @@ -198,7 +198,7 @@ std::shared_ptr PrecisionPropagationFunction::getReferenceWith concat1->set_friendly_name("concat1"); auto& rtInfo1 = concat1->get_rt_info(); - rtInfo1["Variant::std::string"] = std::make_shared>("concat1"); + rtInfo1["Variant::std::string"] = "concat1"; const auto concat2 = std::make_shared( ngraph::OutputVector { deqBefore2, deqBefore3 }, @@ -206,7 +206,7 @@ std::shared_ptr PrecisionPropagationFunction::getReferenceWith concat2->set_friendly_name("concat2"); auto& rtInfo2 = concat2->get_rt_info(); - rtInfo2["Variant::std::string"] = std::make_shared>("concat2"); + rtInfo2["Variant::std::string"] = "concat2"; std::shared_ptr result1 = concat1; std::shared_ptr result2 = concat2; diff --git a/inference-engine/tests/unit/inference_engine/ie_compilation_context_test.cpp b/inference-engine/tests/unit/inference_engine/ie_compilation_context_test.cpp index d3f49772975..5ef4855be74 100644 --- a/inference-engine/tests/unit/inference_engine/ie_compilation_context_test.cpp +++ b/inference-engine/tests/unit/inference_engine/ie_compilation_context_test.cpp @@ -220,7 +220,7 @@ TEST(NetworkContext_CNNNetwork, HashWithPrimitivesPriority) { op2[ov::PrimitivesPriority::get_type_info_static()] = ov::PrimitivesPriority("testPriority"); auto & op3 = net3.getFunction()->get_ops().front()->get_rt_info(); - op3["PrimitivesPriority"] = std::make_shared > ("testPriority"); + op3["PrimitivesPriority"] = "testPriority"; ASSERT_NE(NetworkCompilationContext::computeHash(net1, {}), NetworkCompilationContext::computeHash(net2, {})); @@ -254,10 +254,10 @@ TEST(NetworkContext_CNNNetwork, HashWithAffinity) { auto net2 = createNetwork(); auto net3 = createNetwork(); auto & op2 = net2.getFunction()->get_ops().front()->get_rt_info(); - op2["affinity"] = std::make_shared>("testAffinity"); + op2["affinity"] = "testAffinity"; auto & op3 = net3.getFunction()->get_ops().front()->get_rt_info(); - op3["affinity"] = std::make_shared>("testAffinity"); + op3["affinity"] = "testAffinity"; ASSERT_NE(NetworkCompilationContext::computeHash(net1, {}), NetworkCompilationContext::computeHash(net2, {})); @@ -272,13 +272,13 @@ TEST(NetworkContext_CNNNetwork, HashWithFutureRt_string) { auto net3 = createNetwork(); auto & op1 = net1.getFunction()->get_ops().front()->get_rt_info(); - op1["someFutureKey"] = std::make_shared>("hello"); + op1["someFutureKey"] = "hello"; auto & op2 = net2.getFunction()->get_ops().front()->get_rt_info(); - op2["someFutureKey"] = std::make_shared>("hello"); + op2["someFutureKey"] = "hello"; auto & op3 = net3.getFunction()->get_ops().front()->get_rt_info(); - op3["someFutureKey"] = std::make_shared>("olleh"); + op3["someFutureKey"] = "olleh"; ASSERT_EQ(NetworkCompilationContext::computeHash(net1, {}), NetworkCompilationContext::computeHash(net2, {})); @@ -293,13 +293,13 @@ TEST(NetworkContext_CNNNetwork, HashWithFutureRt_int64) { auto net3 = createNetwork(); auto & op1 = net1.getFunction()->get_ops().front()->get_rt_info(); - op1["someFutureKey"] = std::make_shared>(42); + op1["someFutureKey"] = int64_t(42); auto & op2 = net2.getFunction()->get_ops().front()->get_rt_info(); - op2["someFutureKey"] = std::make_shared>(42); + op2["someFutureKey"] = int64_t(42); auto & op3 = net3.getFunction()->get_ops().front()->get_rt_info(); - op3["someFutureKey"] = std::make_shared>(43); + op3["someFutureKey"] = int64_t(43); ASSERT_EQ(NetworkCompilationContext::computeHash(net1, {}), NetworkCompilationContext::computeHash(net2, {})); diff --git a/src/common/legacy/src/convert_function_to_cnn_network.cpp b/src/common/legacy/src/convert_function_to_cnn_network.cpp index b07678f3783..515a7ebd858 100644 --- a/src/common/legacy/src/convert_function_to_cnn_network.cpp +++ b/src/common/legacy/src/convert_function_to_cnn_network.cpp @@ -1453,10 +1453,7 @@ CNNLayerCreator::CNNLayerCreator(const std::shared_ptr<::ngraph::Node>& node): n res->params = params; auto && rt_info = node->get_rt_info(); - bool keep_constants(false); - if (auto attr = std::dynamic_pointer_cast>(rt_info["keep_constants"])) { - keep_constants = attr->get(); - } + bool keep_constants = rt_info["keep_constants"].as(); // Restore output and kernel size auto shape = node->get_input_shape(1); @@ -1619,25 +1616,17 @@ CNNLayerCreator::CNNLayerCreator(const std::shared_ptr<::ngraph::Node>& node): n << " attribute is set in " << node->get_friendly_name() << " node"; } - auto getStringValue = [] (const ov::Any& variant) { - auto castedVariant = std::dynamic_pointer_cast>(variant); - IE_ASSERT(castedVariant != nullptr); - return castedVariant->get(); - }; - LayerParams attrs = {node->get_friendly_name(), - getStringValue(rtInfo[ExecGraphInfoSerialization::LAYER_TYPE]), - details::convertPrecision(node->get_output_element_type(0))}; + rtInfo[ExecGraphInfoSerialization::LAYER_TYPE].as(), + details::convertPrecision(node->get_output_element_type(0))}; rtInfo.erase(ExecGraphInfoSerialization::LAYER_TYPE); auto res = std::make_shared(attrs); res->params = params; for (const auto & kvp : rtInfo) { - auto castedVariant = std::dynamic_pointer_cast>(kvp.second); - // skip RT info which holds fusedNames, etc - if (castedVariant) - res->params[kvp.first] = getStringValue(castedVariant); + if (kvp.second.is()) + res->params[kvp.first] = kvp.second.as(); } return res; @@ -1669,10 +1658,7 @@ CNNLayerCreator::CNNLayerCreator(const std::shared_ptr<::ngraph::Node>& node): n res->params = params; auto & rt_info = node->get_rt_info(); - bool keep_constants(false); - if (auto attr = std::dynamic_pointer_cast>(rt_info["keep_constants"])) { - keep_constants = attr->get(); - } + bool keep_constants = rt_info["keep_constants"].as(); const auto weightsNode = node->input_value(1).get_node_shared_ptr(); if (!keep_constants && InferenceEngine::details::addBlob(weightsNode, res, InferenceEngine::details::weights)) { const auto biasNode = node->input_value(2).get_node_shared_ptr(); @@ -1906,7 +1892,7 @@ void convertFunctionToICNNNetwork(const std::shared_ptrget_rt_info(); - rt_info["keep_constants"] = std::make_shared<::ngraph::VariantWrapper> (keep_constants); + rt_info["keep_constants"] = keep_constants; CNNLayerPtr cnnLayer = createCNNLayer(layer); @@ -1921,7 +1907,7 @@ void convertFunctionToICNNNetwork(const std::shared_ptrparams["PrimitivesPriority"] = primitivesPriority; } - // Copy runtime info attributes from Nodes to CNNLayers if they have VariantWrapper type + // Copy runtime info attributes from Nodes to CNNLayers if they have std::string type for (const auto &rt : rt_info) { if (rt.second.is()) { auto str_attr = rt.second.as(); diff --git a/src/common/transformations/include/ngraph_ops/nms_static_shape_ie.hpp b/src/common/transformations/include/ngraph_ops/nms_static_shape_ie.hpp index 1328110266c..930226b0802 100644 --- a/src/common/transformations/include/ngraph_ops/nms_static_shape_ie.hpp +++ b/src/common/transformations/include/ngraph_ops/nms_static_shape_ie.hpp @@ -45,7 +45,7 @@ private: typedef struct {} init_rt_result; init_rt_result init_rt_info() { - BaseNmsOp::get_rt_info()["opset"] = std::make_shared>("ie_internal_opset"); + BaseNmsOp::get_rt_info()["opset"] = "ie_internal_opset"; return {}; } diff --git a/src/common/transformations/include/ngraph_ops/type_relaxed.hpp b/src/common/transformations/include/ngraph_ops/type_relaxed.hpp index 2c331f3fb46..9f41b99abf3 100644 --- a/src/common/transformations/include/ngraph_ops/type_relaxed.hpp +++ b/src/common/transformations/include/ngraph_ops/type_relaxed.hpp @@ -136,7 +136,7 @@ protected: typedef struct {} init_rt_result; init_rt_result init_rt_info(Node &node) const { - node.get_rt_info()["opset"] = std::make_shared>("type_relaxed_opset"); + node.get_rt_info()["opset"] = "type_relaxed_opset"; return {}; } diff --git a/src/core/include/ngraph/variant.hpp b/src/core/include/ngraph/variant.hpp index df8716d69f4..0b9ed47afda 100644 --- a/src/core/include/ngraph/variant.hpp +++ b/src/core/include/ngraph/variant.hpp @@ -18,28 +18,77 @@ using ov::Node; using VariantTypeInfo = ov::DiscreteTypeInfo; using Variant = ov::RuntimeAttribute; -template -using VariantImpl = ov::RuntimeAttributeImpl; -template -using VariantWrapper = ov::RuntimeAttributeWrapper; +template +class OPENVINO_DEPRECATED("Please use ov::Any to store VT directly") VariantImpl : public Variant { +public: + OPENVINO_RTTI(typeid(VT).name()); + using value_type = VT; + + VariantImpl() = default; + + VariantImpl(const value_type& value) : m_value(value) {} + + const value_type& get() const { + return m_value; + } + value_type& get() { + return m_value; + } + void set(const value_type& value) { + m_value = value; + } + +protected: + value_type m_value; +}; + +template +class OPENVINO_DEPRECATED("Please use ov::Any to store VT directly") VariantWrapper {}; + +OPENVINO_SUPPRESS_DEPRECATED_START +extern template class OPENVINO_API VariantImpl; +extern template class OPENVINO_API VariantImpl; +extern template class OPENVINO_API VariantImpl; + +template <> +class OPENVINO_API VariantWrapper : public VariantImpl { +public: + OPENVINO_RTTI("VariantWrapper"); + VariantWrapper(const value_type& value) : VariantImpl(value) {} + std::string to_string() const override { + return m_value; + } +}; + +template <> +class OPENVINO_API VariantWrapper : public VariantImpl { +public: + OPENVINO_RTTI("VariantWrapper"); + VariantWrapper(const value_type& value) : VariantImpl(value) {} + std::string to_string() const override { + return std::to_string(m_value); + } +}; template inline std::shared_ptr make_variant(const T& p) { - return ov::make_runtime_attribute(p); + return std::static_pointer_cast(std::make_shared>(p)); } template inline std::shared_ptr make_variant(const char (&s)[N]) { - return ov::make_runtime_attribute(s); + return std::static_pointer_cast(std::make_shared>(s)); } #if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32) template inline std::shared_ptr make_variant(const wchar_t (&s)[N]) { - return ov::make_runtime_attribute(s); + return std::static_pointer_cast(std::make_shared>(s)); } #endif using ov::RTMap; + +OPENVINO_SUPPRESS_DEPRECATED_END } // namespace ngraph diff --git a/src/core/include/openvino/core/any.hpp b/src/core/include/openvino/core/any.hpp index 01010add718..acae4721dbb 100644 --- a/src/core/include/openvino/core/any.hpp +++ b/src/core/include/openvino/core/any.hpp @@ -687,6 +687,7 @@ namespace util { template <> struct AsTypePtr { template + OPENVINO_DEPRECATED("Please use ov::Any::as() method") static std::shared_ptr call(const Any& any) { try { return any.as>(); @@ -699,10 +700,13 @@ struct AsTypePtr { using RTMap = std::map; +using AnyVector = std::vector; + } // namespace ov namespace std { template +OPENVINO_DEPRECATED("Please use ov::Any::as() method") std::shared_ptr dynamic_pointer_cast(const ::ov::Any& any) { try { return any.as>(); @@ -712,6 +716,7 @@ std::shared_ptr dynamic_pointer_cast(const ::ov::Any& any) { } template +OPENVINO_DEPRECATED("Please use ov::Any::as() method") std::shared_ptr static_pointer_cast(const ::ov::Any& any) { return any.as>(); } diff --git a/src/core/include/openvino/core/runtime_attribute.hpp b/src/core/include/openvino/core/runtime_attribute.hpp index d9a9de0047d..6e9af4b6809 100644 --- a/src/core/include/openvino/core/runtime_attribute.hpp +++ b/src/core/include/openvino/core/runtime_attribute.hpp @@ -40,73 +40,4 @@ public: }; OPENVINO_API std::ostream& operator<<(std::ostream& os, const RuntimeAttribute& attrubute); -template -class RuntimeAttributeImpl : public RuntimeAttribute { -public: - OPENVINO_RTTI(typeid(VT).name()); - using value_type = VT; - - RuntimeAttributeImpl() = default; - - RuntimeAttributeImpl(const value_type& value) : m_value(value) {} - - const value_type& get() const { - return m_value; - } - value_type& get() { - return m_value; - } - void set(const value_type& value) { - m_value = value; - } - -protected: - value_type m_value; -}; - -extern template class OPENVINO_API RuntimeAttributeImpl; -extern template class OPENVINO_API RuntimeAttributeImpl; -extern template class OPENVINO_API RuntimeAttributeImpl; - -template -class RuntimeAttributeWrapper {}; - -template <> -class OPENVINO_API RuntimeAttributeWrapper : public RuntimeAttributeImpl { -public: - OPENVINO_RTTI("RuntimeAttributeWrapper"); - RuntimeAttributeWrapper(const value_type& value) : RuntimeAttributeImpl(value) {} - std::string to_string() const override { - return m_value; - } -}; - -template <> -class OPENVINO_API RuntimeAttributeWrapper : public RuntimeAttributeImpl { -public: - OPENVINO_RTTI("RuntimeAttributeWrapper"); - RuntimeAttributeWrapper(const value_type& value) : RuntimeAttributeImpl(value) {} - std::string to_string() const override { - return std::to_string(m_value); - } -}; - -template -inline std::shared_ptr make_runtime_attribute(const T& p) { - return std::static_pointer_cast(std::make_shared>(p)); -} - -template -inline std::shared_ptr make_runtime_attribute(const char (&s)[N]) { - return std::static_pointer_cast(std::make_shared>(s)); -} - -#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32) -template -inline std::shared_ptr make_runtime_attribute(const wchar_t (&s)[N]) { - return std::static_pointer_cast(std::make_shared>(s)); -} -#endif - -using RuntimeAttributeVector = std::vector; } // namespace ov diff --git a/src/core/include/openvino/core/type.hpp b/src/core/include/openvino/core/type.hpp index 6b89f4c5f03..2df5ad02a86 100644 --- a/src/core/include/openvino/core/type.hpp +++ b/src/core/include/openvino/core/type.hpp @@ -125,7 +125,9 @@ struct AsTypePtr> { /// Type, nullptr otherwise template auto as_type_ptr(const U& value) -> decltype(::ov::util::AsTypePtr::template call(value)) { + OPENVINO_SUPPRESS_DEPRECATED_START return ::ov::util::AsTypePtr::template call(value); + OPENVINO_SUPPRESS_DEPRECATED_END } } // namespace ov diff --git a/src/core/src/pass/fix_rt_info.cpp b/src/core/src/pass/fix_rt_info.cpp index 87ea78b7967..a51ef146429 100644 --- a/src/core/src/pass/fix_rt_info.cpp +++ b/src/core/src/pass/fix_rt_info.cpp @@ -26,14 +26,16 @@ bool ngraph::pass::FixRtInfo::run_on_function(std::shared_ptr run_on_function(sub_graph); } } + OPENVINO_SUPPRESS_DEPRECATED_START auto& rt_info = node->get_rt_info(); { auto it_info = rt_info.find("PrimitivesPriority"); if (it_info != rt_info.end()) { - if (it_info->second.is>>()) { - rt_info.emplace(ov::PrimitivesPriority::get_type_info_static(), - ov::PrimitivesPriority{ - it_info->second.as>>()->get()}); + if (it_info->second.is>>()) { + rt_info.emplace( + ov::PrimitivesPriority::get_type_info_static(), + ov::PrimitivesPriority{ + it_info->second.as>>()->get()}); } else if (it_info->second.is()) { rt_info.emplace(ov::PrimitivesPriority::get_type_info_static(), it_info->second.as()); @@ -48,11 +50,12 @@ bool ngraph::pass::FixRtInfo::run_on_function(std::shared_ptr { auto it_info = rt_info.find("affinity"); if (it_info != rt_info.end()) { - if (it_info->second.is>>()) { - it_info->second = it_info->second.as>>()->get(); + if (it_info->second.is>>()) { + it_info->second = it_info->second.as>>()->get(); } } } + OPENVINO_SUPPRESS_DEPRECATED_END } return false; } diff --git a/src/core/src/pass/low_latency.cpp b/src/core/src/pass/low_latency.cpp index 6cc86ed0b81..a9d871a38d5 100644 --- a/src/core/src/pass/low_latency.cpp +++ b/src/core/src/pass/low_latency.cpp @@ -44,7 +44,7 @@ ngraph::pass::LowLatency::LowLatency() { } // Mark the TI layer to be unrolled. Enable unconditional ti unrolling for all plugins. auto& rt_info = sub_graph_op->get_rt_info(); - rt_info["UNROLL_TI"] = std::make_shared>(1); + rt_info["UNROLL_TI"] = int64_t(1); int64_t variable_id = 0; std::vector> assigns; diff --git a/src/core/src/pass/serialize.cpp b/src/core/src/pass/serialize.cpp index e95b7000702..11d18c76e70 100644 --- a/src/core/src/pass/serialize.cpp +++ b/src/core/src/pass/serialize.cpp @@ -558,8 +558,8 @@ std::string get_opset_name(const ngraph::Node* n, const std::mapget_rt_info().find("opset"); if (opset_it != n->get_rt_info().end()) { - if (auto variant = std::dynamic_pointer_cast>(opset_it->second)) { - const std::string& opset_name = variant->get(); + if (opset_it->second.is()) { + const std::string& opset_name = opset_it->second.as(); if (custom_opsets.find(opset_name) != custom_opsets.end()) { return opset_name; } @@ -662,9 +662,9 @@ std::string get_node_unique_name(std::unordered_set& unique_names, void visit_exec_graph_node(pugi::xml_node& layer, const ngraph::Node* n) { auto data = layer.child("data"); for (const auto& param : n->get_rt_info()) { - if (auto variant = std::dynamic_pointer_cast>(param.second)) { + if (param.second.is()) { const std::string& name = param.first; - const std::string& value = variant->get(); + const std::string& value = param.second.as(); if (name == "layerType") { layer.attribute("type").set_value(value.c_str()); @@ -1043,8 +1043,7 @@ void serializeFunc(std::ostream& xml_file, auto& rt_info = f->get_rt_info(); if (rt_info.count("version")) { - auto version_var = std::dynamic_pointer_cast>(rt_info.at("version")); - version = version_var->get(); + version = rt_info.at("version").as(); } if (version != static_cast(ver) && ver != ov::pass::Serialize::Version::UNSPECIFIED) @@ -1167,8 +1166,7 @@ bool pass::StreamSerialize::run_on_function(std::shared_ptr f) auto version = static_cast(m_version); auto& rt_info = f->get_rt_info(); if (rt_info.count("version")) { - auto version_var = std::dynamic_pointer_cast>(rt_info.at("version")); - version = version_var->get(); + version = rt_info.at("version").as(); } if (version != static_cast(m_version) && m_version != Serialize::Version::UNSPECIFIED) diff --git a/src/core/src/runtime_attribute.cpp b/src/core/src/runtime_attribute.cpp index f639c0c6017..c60251cbdca 100644 --- a/src/core/src/runtime_attribute.cpp +++ b/src/core/src/runtime_attribute.cpp @@ -32,8 +32,4 @@ std::ostream& operator<<(std::ostream& os, const RuntimeAttribute& attrubute) { return os << attrubute.to_string(); } -template class ov::RuntimeAttributeImpl; -template class ov::RuntimeAttributeImpl; -template class ov::RuntimeAttributeImpl; - } // namespace ov \ No newline at end of file diff --git a/src/core/src/varaint.cpp b/src/core/src/varaint.cpp new file mode 100644 index 00000000000..7b29120f337 --- /dev/null +++ b/src/core/src/varaint.cpp @@ -0,0 +1,13 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "ngraph/variant.hpp" + +namespace ngraph { +OPENVINO_SUPPRESS_DEPRECATED_START +template class VariantImpl; +template class VariantImpl; +template class VariantImpl; +OPENVINO_SUPPRESS_DEPRECATED_END +} // namespace ngraph \ No newline at end of file diff --git a/src/core/tests/any.cpp b/src/core/tests/any.cpp index 00747e0b868..d2b6185d7ae 100644 --- a/src/core/tests/any.cpp +++ b/src/core/tests/any.cpp @@ -2,8 +2,13 @@ // SPDX-License-Identifier: Apache-2.0 // -#include "openvino/core/any.hpp" +#include "openvino/core/deprecated.hpp" +OPENVINO_SUPPRESS_DEPRECATED_START +#include "openvino/core/any.hpp" +OPENVINO_SUPPRESS_DEPRECATED_END + +#include #include #include "gtest/gtest.h" @@ -407,54 +412,68 @@ TEST_F(AnyTests, PrintToMapOfAnysDoesNothing) { ASSERT_EQ(stream.str(), std::string{}); } -TEST_F(AnyTests, constructFromRuntimeAttributeImpl) { +TEST_F(AnyTests, constructFromVariantImpl) { + OPENVINO_SUPPRESS_DEPRECATED_START auto parameter = Any{4}; auto get_impl = [&] { - return std::make_shared>(); + return std::make_shared>(); }; auto other_parameter = Any{get_impl()}; + OPENVINO_SUPPRESS_DEPRECATED_END } -TEST_F(AnyTests, dynamicPointerCastToRuntimeAttribute) { - Any p = std::make_shared>("42"); - auto str_variant = std::dynamic_pointer_cast>(p); +TEST_F(AnyTests, dynamicPointerCastToVariantWrapper) { + OPENVINO_SUPPRESS_DEPRECATED_START + Any p = std::make_shared>("42"); + auto str_variant = std::dynamic_pointer_cast>(p); ASSERT_EQ("42", str_variant->get()); + OPENVINO_SUPPRESS_DEPRECATED_END } -TEST_F(AnyTests, asTypePtrToRuntimeAttribute) { - Any p = std::make_shared>("42"); - auto str_variant = ov::as_type_ptr>(p); +TEST_F(AnyTests, asTypePtrToVariantWrapper) { + OPENVINO_SUPPRESS_DEPRECATED_START + Any p = std::make_shared>("42"); + auto str_variant = ov::as_type_ptr>(p); ASSERT_EQ("42", str_variant->get()); + OPENVINO_SUPPRESS_DEPRECATED_END } -TEST_F(AnyTests, castToRuntimeAttribute) { +TEST_F(AnyTests, castToVariantWrapper) { { - Any p = std::make_shared>("42"); - std::shared_ptr> str_variant = p; + OPENVINO_SUPPRESS_DEPRECATED_START + Any p = std::make_shared>("42"); + std::shared_ptr> str_variant = p; ASSERT_EQ("42", str_variant->get()); + OPENVINO_SUPPRESS_DEPRECATED_END } { - Any p = std::make_shared>("42"); - auto f = [](const std::shared_ptr>& str_variant) { + OPENVINO_SUPPRESS_DEPRECATED_START + Any p = std::make_shared>("42"); + auto f = [](const std::shared_ptr>& str_variant) { ASSERT_EQ("42", str_variant->get()); }; f(p); + OPENVINO_SUPPRESS_DEPRECATED_END } { - Any p = std::make_shared>("42"); - auto f = [](std::shared_ptr>& str_variant) { + OPENVINO_SUPPRESS_DEPRECATED_START + Any p = std::make_shared>("42"); + auto f = [](std::shared_ptr>& str_variant) { ASSERT_EQ("42", str_variant->get()); }; f(p); + OPENVINO_SUPPRESS_DEPRECATED_END } { - std::shared_ptr v = std::make_shared>("42"); + OPENVINO_SUPPRESS_DEPRECATED_START + std::shared_ptr v = std::make_shared>("42"); Any p = v; - auto f = [](std::shared_ptr>& str_variant) { + auto f = [](std::shared_ptr>& str_variant) { ASSERT_NE(nullptr, str_variant); ASSERT_EQ("42", str_variant->get()); }; f(p); + OPENVINO_SUPPRESS_DEPRECATED_END } } diff --git a/src/core/tests/pass/serialization/read_ir.hpp b/src/core/tests/pass/serialization/read_ir.hpp index e28d39e1e5a..42738236112 100644 --- a/src/core/tests/pass/serialization/read_ir.hpp +++ b/src/core/tests/pass/serialization/read_ir.hpp @@ -16,7 +16,7 @@ inline std::shared_ptr readModel(const std::string& model_path, co ov::frontend::FrontEnd::Ptr FE; ov::frontend::InputModel::Ptr inputModel; - ov::RuntimeAttributeVector params{model_path}; + ov::AnyVector params{model_path}; if (!weights_path.empty()) params.emplace_back(weights_path); @@ -37,7 +37,7 @@ inline std::shared_ptr readModel(const std::string& model) { std::istringstream modelStringStream(model); std::istream& modelStream = modelStringStream; - ov::RuntimeAttributeVector params{&modelStream}; + ov::AnyVector params{&modelStream}; FE = manager.load_by_model(params); if (FE) diff --git a/src/core/tests/util.cpp b/src/core/tests/util.cpp index c9fe94cdd4b..f64eb341c27 100644 --- a/src/core/tests/util.cpp +++ b/src/core/tests/util.cpp @@ -183,7 +183,7 @@ public: nodes.push_back(A); nodes.push_back(B); nodes.push_back(C); - func->get_rt_info()["version"] = std::make_shared>(10); + func->get_rt_info()["version"] = int64_t(10); } bool CompareNodeVector(const std::vector>& orig, @@ -237,9 +237,8 @@ TEST_F(CloneTest, clone_function_full) { ASSERT_TRUE(CompareNodeVector(func->get_ops(), cloned_func->get_ops(), node_map)); ASSERT_EQ(cloned_func->get_rt_info().size(), func->get_rt_info().size()); ASSERT_TRUE(cloned_func->get_rt_info().count("version")); - auto ver = std::dynamic_pointer_cast>(cloned_func->get_rt_info().at("version")); - ASSERT_NE(nullptr, ver); - ASSERT_EQ(10, ver->get()); + auto ver = cloned_func->get_rt_info().at("version").as(); + ASSERT_EQ(10, ver); } TEST(graph_util, clone_multiple_results) { @@ -317,12 +316,12 @@ TEST(graph_util, clone_rt_info) { for (auto&& node : original_f->get_ordered_ops()) { auto& nodeInfo = node->get_rt_info(); - nodeInfo["affinity"] = std::make_shared>(testAffinity); + nodeInfo["affinity"] = testAffinity; affinity[node->get_friendly_name()] = testAffinity; for (auto&& output : node->outputs()) { auto& outputInfo = output.get_rt_info(); - outputInfo["affinity"] = std::make_shared>(testAffinity); + outputInfo["affinity"] = testAffinity; } } @@ -332,7 +331,7 @@ TEST(graph_util, clone_rt_info) { auto& nodeInfo = node->get_rt_info(); auto itInfo = nodeInfo.find("affinity"); ASSERT_TRUE(itInfo != nodeInfo.end()); - auto value = ngraph::as_type_ptr>(itInfo->second)->get(); + auto value = itInfo->second.as(); ASSERT_TRUE(affinity.find(node->get_friendly_name()) != affinity.end()); ASSERT_TRUE(affinity[node->get_friendly_name()] == value); diff --git a/src/frontends/common/include/common/frontend.hpp b/src/frontends/common/include/common/frontend.hpp index 58ad1d66f64..ff24e48e6e5 100644 --- a/src/frontends/common/include/common/frontend.hpp +++ b/src/frontends/common/include/common/frontend.hpp @@ -51,7 +51,7 @@ public: return load_impl({ov::Any{vars}...}); } - inline InputModel::Ptr load(const ov::RuntimeAttributeVector& vars) const { + inline InputModel::Ptr load(const ov::AnyVector& vars) const { return load_impl(vars); } diff --git a/src/frontends/ir/src/ir_deserializer.cpp b/src/frontends/ir/src/ir_deserializer.cpp index b4d1c687260..df559183034 100644 --- a/src/frontends/ir/src/ir_deserializer.cpp +++ b/src/frontends/ir/src/ir_deserializer.cpp @@ -705,7 +705,7 @@ std::shared_ptr XmlDeserializer::createNode( } const auto aw_data = dn.attribute("alt_width"); if (aw_data) { - rtInfo["alt_width"] = std::make_shared<::ngraph::VariantWrapper>(aw_data.value()); + rtInfo["alt_width"] = aw_data.value(); } } diff --git a/src/frontends/ir/src/model.cpp b/src/frontends/ir/src/model.cpp index 270218219b6..341cb6ea54a 100644 --- a/src/frontends/ir/src/model.cpp +++ b/src/frontends/ir/src/model.cpp @@ -235,7 +235,7 @@ std::shared_ptr InputModelIR::InputModelIRImpl::convert() { ov::XmlDeserializer visitor(m_root, m_weights, m_opsets, m_extensions, variables, version); std::shared_ptr function; visitor.on_attribute("net", function); - function->get_rt_info()["version"] = std::make_shared>(version); + function->get_rt_info()["version"] = int64_t(version); ParsePreProcess(m_root, m_weights, function); return function; diff --git a/src/inference/src/cpp_interfaces/interface/ie_iplugin_internal.cpp b/src/inference/src/cpp_interfaces/interface/ie_iplugin_internal.cpp index 0ffa5e1e1b2..c299ddc752e 100644 --- a/src/inference/src/cpp_interfaces/interface/ie_iplugin_internal.cpp +++ b/src/inference/src/cpp_interfaces/interface/ie_iplugin_internal.cpp @@ -146,7 +146,7 @@ std::shared_ptr IInferencePlugin::LoadNetwork( if (function && GetCore() && !GetCore()->isNewAPI()) { auto& rt_info = function->get_rt_info(); if (rt_info.find("version") == rt_info.end()) { - rt_info["version"] = std::make_shared>(10); + rt_info["version"] = int64_t(10); // re-create `network` with new patched `function` using namespace InferenceEngine; @@ -296,9 +296,7 @@ void IInferencePlugin::SetExeNetworkInfo(const std::shared_ptrget_rt_info(); const auto it = rt_info.find("version"); if (it != rt_info.end()) { - auto ir_version_impl = std::dynamic_pointer_cast>(it->second); - OPENVINO_ASSERT(ir_version_impl != nullptr, "Failed to extract IR version from 'version' attribute"); - const int64_t ir_version = ir_version_impl->get(); + const int64_t ir_version = it->second.as(); // here we decide whether we need to add operation_names as tensor names for // getInputs / getOutputs. Since these functions are designed to be used in new API only // always need to add operation names for IR v10 diff --git a/src/inference/src/ie_network_reader.cpp b/src/inference/src/ie_network_reader.cpp index 1fe8b67d8fa..8c465adbfc3 100644 --- a/src/inference/src/ie_network_reader.cpp +++ b/src/inference/src/ie_network_reader.cpp @@ -299,9 +299,7 @@ CNNNetwork convert_to_cnnnetwork(std::shared_ptr& function, using namespace ov::preprocess; PrePostProcessor prepost(function); - auto ir_version_impl = it->second.as>>(); - OPENVINO_ASSERT(ir_version_impl != nullptr, "Failed to extract IR version from 'version' attribute"); - const int64_t ir_version = ir_version_impl->get(); + const int64_t ir_version = it->second.as(); if (ir_version == 10 && newAPI) { const auto inputs = function->inputs(); @@ -345,7 +343,7 @@ CNNNetwork convert_to_cnnnetwork(std::shared_ptr& function, function = prepost.build(); // Set version to 10 - rt_info["version"] = std::make_shared>(10); + rt_info["version"] = int64_t(10); } else if (ir_version == 11 && !newAPI) { const std::string& old_api_map_key_order = ov::OldApiMapOrder::get_type_info_static(); const std::string& old_api_map_key_type = ov::OldApiMapElementType::get_type_info_static(); @@ -388,7 +386,7 @@ CNNNetwork convert_to_cnnnetwork(std::shared_ptr& function, } // Set version to 10 - rt_info["version"] = std::make_shared>(10); + rt_info["version"] = int64_t(10); function = prepost.build(); } @@ -451,7 +449,7 @@ CNNNetwork details::ReadNetwork(const std::string& modelPath, ov::frontend::FrontEnd::Ptr FE; ov::frontend::InputModel::Ptr inputModel; - ov::RuntimeAttributeVector params{model_path}; + ov::AnyVector params{model_path}; if (!binPath.empty()) { #if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32) @@ -517,7 +515,7 @@ CNNNetwork details::ReadNetwork(const std::string& model, ov::frontend::FrontEnd::Ptr FE; ov::frontend::InputModel::Ptr inputModel; - ov::RuntimeAttributeVector params{&modelStream}; + ov::AnyVector params{&modelStream}; if (weights) { char* data = weights->cbuffer().as(); std::shared_ptr weights_buffer = diff --git a/src/plugins/intel_gpu/src/plugin/graph.cpp b/src/plugins/intel_gpu/src/plugin/graph.cpp index 4b67bae7082..fa366e1faff 100644 --- a/src/plugins/intel_gpu/src/plugin/graph.cpp +++ b/src/plugins/intel_gpu/src/plugin/graph.cpp @@ -394,14 +394,12 @@ std::shared_ptr Graph::GetExecGraphInfoByPrimitivesInfo(std::v info[ExecGraphInfoSerialization::PERF_COUNTER] = exec_time; for (auto&& kvp : info) { - auto variant = std::make_shared<::ngraph::VariantWrapper>(kvp.second); - return_node->get_rt_info()[kvp.first] = variant; + return_node->get_rt_info()[kvp.first] = kvp.second; if (is_output) - results.back()->get_rt_info()[kvp.first] = variant; + results.back()->get_rt_info()[kvp.first] = kvp.second; } if (is_output) - results.back()->get_rt_info()[ExecGraphInfoSerialization::LAYER_TYPE] = - std::make_shared<::ngraph::VariantWrapper>("Result"); + results.back()->get_rt_info()[ExecGraphInfoSerialization::LAYER_TYPE] = "Result"; nodes.push_back(return_node); node2layer[prim_info.original_id] = return_node;