Any used to store standard types (#8946)
This commit is contained in:
1 parent
37e23cda8d
commit
576471cc27
64 files changed
+275
-329
No files matched your search
@@ -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<ngraph::VariantWrapper<std::string>>("CPU");
|
||||
op->get_rt_info()["affinity"] = "CPU";
|
||||
//! [part0]
|
||||
return 0;
|
||||
}
|
||||
@@ -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<ngraph::VariantWrapper<std::string>>(affinity);
|
||||
node->get_rt_info()["affinity"] = affinity;
|
||||
}
|
||||
|
||||
// load network with affinities set before
|
||||
|
||||
@@ -186,7 +186,7 @@ std::shared_ptr<ngraph::Function> 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<std::string>>(kvp.second);
|
||||
return_node->get_rt_info()[kvp.first] = kvp.second;
|
||||
return_node->set_friendly_name(node->getName());
|
||||
|
||||
return return_node;
|
||||
|
||||
@@ -162,8 +162,7 @@ MKLDNNNode::MKLDNNNode(const std::shared_ptr<ngraph::Node>& op, const mkldnn::en
|
||||
|
||||
const auto it = rtInfo.find("enforceBF16evenForGraphTail");
|
||||
if (it != rtInfo.end()) {
|
||||
if (const auto value = std::dynamic_pointer_cast<ov::RuntimeAttributeImpl<int64_t>>(it->second))
|
||||
enforceBF16evenForGraphTail = value->get();
|
||||
enforceBF16evenForGraphTail = it->second.as<bool>();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -67,7 +67,7 @@ namespace {
|
||||
ngraph::replace_node(transposeAfter, {reshape2->output(0)});
|
||||
}
|
||||
|
||||
sequenceOp->get_rt_info()["seqAxis"] = std::make_shared<ov::RuntimeAttributeWrapper<int64_t>>(seqAxis);
|
||||
sequenceOp->get_rt_info()["seqAxis"] = seqAxis;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -367,7 +367,7 @@ void MKLDNNRNN::initSeq(const std::shared_ptr<ngraph::Node>& op) {
|
||||
const auto rtInfo = op->get_rt_info();
|
||||
|
||||
if (rtInfo.count("seqAxis")) {
|
||||
nativeOrder = std::dynamic_pointer_cast<ov::RuntimeAttributeWrapper<int64_t>>(rtInfo.at("seqAxis"))->get() == 0;
|
||||
nativeOrder = rtInfo.at("seqAxis").as<int64_t>() == 0;
|
||||
}
|
||||
out_data_dims.erase(out_data_dims.begin() + 1);
|
||||
|
||||
|
||||
@@ -13,10 +13,9 @@ namespace MKLDNNPlugin {
|
||||
inline std::string getRTInfoValue(const std::map<std::string, ov::Any>& rtInfo, std::string paramName) {
|
||||
auto it = rtInfo.find(paramName);
|
||||
if (it != rtInfo.end()) {
|
||||
auto value = std::dynamic_pointer_cast<ov::RuntimeAttributeImpl<std::string>>(it->second);
|
||||
return value->get();
|
||||
return it->second.as<std::string>();
|
||||
} else {
|
||||
return "";
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ std::shared_ptr<ngraph::Function> 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<std::string>>(meta.second);
|
||||
node->get_rt_info()[meta.first] = meta.second;
|
||||
}
|
||||
|
||||
stageMetaIndexToNode[index] = node;
|
||||
|
||||
+1
-1
@@ -348,7 +348,7 @@ TEST(CNNNGraphImplTests, TestSaveAffinity) {
|
||||
auto param = std::make_shared<ngraph::op::Parameter>(type, shape);
|
||||
auto relu = std::make_shared<ngraph::op::Relu>(param);
|
||||
auto& rtInfo = relu->get_rt_info();
|
||||
rtInfo["affinity"] = std::make_shared<ngraph::VariantWrapper<std::string>> (testAffinity);
|
||||
rtInfo["affinity"] = testAffinity;
|
||||
relu->set_friendly_name("testReLU");
|
||||
auto result = std::make_shared<ngraph::op::Result>(relu);
|
||||
|
||||
|
||||
+13
-19
@@ -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<ov::Function>& f, int version_ref) {
|
||||
auto& rt_info = f->get_rt_info();
|
||||
ASSERT_TRUE(rt_info.count("version"));
|
||||
auto version = std::dynamic_pointer_cast<VariantWrapper<int64_t>>(rt_info.at("version"));
|
||||
ASSERT_NE(version, nullptr);
|
||||
ASSERT_EQ(version->get(), version_ref);
|
||||
ASSERT_TRUE(rt_info.at("version").is<int64_t>());
|
||||
ASSERT_EQ(rt_info.at("version").as<int64_t>(), version_ref);
|
||||
};
|
||||
check_version(f, 10);
|
||||
|
||||
@@ -285,9 +284,8 @@ TEST_F(RTInfoDeserialization, InputAndOutputV10) {
|
||||
auto check_version = [](const std::shared_ptr<ov::Function>& f, int ref_version) {
|
||||
auto& rt_info = f->get_rt_info();
|
||||
ASSERT_TRUE(rt_info.count("version"));
|
||||
auto version = std::dynamic_pointer_cast<VariantWrapper<int64_t>>(rt_info.at("version"));
|
||||
ASSERT_NE(version, nullptr);
|
||||
ASSERT_EQ(version->get(), ref_version);
|
||||
ASSERT_TRUE(rt_info.at("version").is<int64_t>());
|
||||
ASSERT_EQ(rt_info.at("version").as<int64_t>(), ref_version);
|
||||
};
|
||||
check_version(f, 10);
|
||||
|
||||
@@ -443,9 +441,8 @@ TEST_F(RTInfoDeserialization, NodeV11) {
|
||||
auto check_version = [](const std::shared_ptr<ov::Function>& f, int ref_version) {
|
||||
auto& rt_info = f->get_rt_info();
|
||||
ASSERT_TRUE(rt_info.count("version"));
|
||||
auto version = std::dynamic_pointer_cast<VariantWrapper<int64_t>>(rt_info.at("version"));
|
||||
ASSERT_NE(version, nullptr);
|
||||
EXPECT_EQ(version->get(), ref_version);
|
||||
ASSERT_TRUE(rt_info.at("version").is<int64_t>());
|
||||
ASSERT_EQ(rt_info.at("version").as<int64_t>(), ref_version);
|
||||
};
|
||||
check_version(f, 11);
|
||||
|
||||
@@ -709,9 +706,8 @@ TEST_F(RTInfoDeserialization, InputAndOutputV11) {
|
||||
auto check_version = [](const std::shared_ptr<ov::Function>& f, int ref_version) {
|
||||
auto& rt_info = f->get_rt_info();
|
||||
ASSERT_TRUE(rt_info.count("version"));
|
||||
auto version = std::dynamic_pointer_cast<VariantWrapper<int64_t>>(rt_info.at("version"));
|
||||
ASSERT_NE(version, nullptr);
|
||||
ASSERT_EQ(version->get(), ref_version);
|
||||
ASSERT_TRUE(rt_info.at("version").is<int64_t>());
|
||||
ASSERT_EQ(rt_info.at("version").as<int64_t>(), ref_version);
|
||||
};
|
||||
check_version(f, 11);
|
||||
|
||||
@@ -872,9 +868,8 @@ TEST_F(RTInfoDeserialization, IndexesInputAndOutputV11) {
|
||||
auto check_version = [](const std::shared_ptr<ov::Function>& f, int ref_version) {
|
||||
auto& rt_info = f->get_rt_info();
|
||||
ASSERT_TRUE(rt_info.count("version"));
|
||||
auto version = std::dynamic_pointer_cast<VariantWrapper<int64_t>>(rt_info.at("version"));
|
||||
ASSERT_NE(version, nullptr);
|
||||
ASSERT_EQ(version->get(), ref_version);
|
||||
ASSERT_TRUE(rt_info.at("version").is<int64_t>());
|
||||
ASSERT_EQ(rt_info.at("version").as<int64_t>(), ref_version);
|
||||
};
|
||||
check_version(f, 11);
|
||||
|
||||
@@ -965,9 +960,8 @@ TEST_F(RTInfoDeserialization, V11toV10WithoutRTInfo) {
|
||||
auto check_version = [](const std::shared_ptr<ov::Function>& f, int ref_version) {
|
||||
auto& rt_info = f->get_rt_info();
|
||||
ASSERT_TRUE(rt_info.count("version"));
|
||||
auto version = std::dynamic_pointer_cast<VariantWrapper<int64_t>>(rt_info.at("version"));
|
||||
ASSERT_NE(version, nullptr);
|
||||
ASSERT_EQ(version->get(), ref_version);
|
||||
ASSERT_TRUE(rt_info.at("version").is<int64_t>());
|
||||
ASSERT_EQ(rt_info.at("version").as<int64_t>(), ref_version);
|
||||
};
|
||||
InferenceEngine::Core core;
|
||||
auto cnn = core.ReadNetwork(model, InferenceEngine::Blob::CPtr());
|
||||
|
||||
+1
-1
@@ -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)
|
||||
|
||||
@@ -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<ngraph::VariantImpl<std::string>>(var);
|
||||
if (s_val->get() == "MemoryOutput")
|
||||
auto s_val = var.as<std::string>();
|
||||
if (s_val == "MemoryOutput")
|
||||
mem_w = node;
|
||||
if (s_val->get() == "MemoryInput")
|
||||
if (s_val == "MemoryInput")
|
||||
mem_r = node;
|
||||
}
|
||||
|
||||
|
||||
+2
-3
@@ -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<ngraph::VariantImpl<std::string>>(it->second);
|
||||
ASSERT_NE(nullptr, opType);
|
||||
auto opType = it->second.as<std::string>();
|
||||
|
||||
if (opType->get() == "Reorder") {
|
||||
if (opType == "Reorder") {
|
||||
numReorders++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<ngraph::VariantImpl<std::string>>(it->second);
|
||||
IE_ASSERT(nullptr != value);
|
||||
return value->get();
|
||||
return it->second.as<std::string>();
|
||||
};
|
||||
|
||||
if (getExecValue(ExecGraphInfoSerialization::LAYER_TYPE) == "Convolution") {
|
||||
|
||||
+1
-3
@@ -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<ngraph::VariantImpl<std::string>>(it->second);
|
||||
IE_ASSERT(nullptr != value);
|
||||
return value->get();
|
||||
return it->second.as<std::string>();
|
||||
};
|
||||
|
||||
if (getExecValue(ExecGraphInfoSerialization::LAYER_TYPE) == "Convolution") {
|
||||
|
||||
+1
-3
@@ -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<ngraph::VariantImpl<std::string>>(it->second);
|
||||
IE_ASSERT(nullptr != value);
|
||||
return value->get();
|
||||
return it->second.as<std::string>();
|
||||
};
|
||||
if (getExecValue(ExecGraphInfoSerialization::LAYER_TYPE) == "Transpose") {
|
||||
actualTransposeCount++;
|
||||
|
||||
@@ -138,17 +138,13 @@ void CPUTestsBase::CheckPluginRelatedResultsImpl(std::shared_ptr<const ov::Funct
|
||||
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<ngraph::VariantImpl<std::string>>(it->second);
|
||||
IE_ASSERT(nullptr != value);
|
||||
return value->get();
|
||||
return it->second.as<std::string>();
|
||||
};
|
||||
auto getExecValueOutputsLayout = [] (std::shared_ptr<ngraph::Node> 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<ngraph::VariantImpl<std::string>>(it->second);
|
||||
IE_ASSERT(nullptr != value);
|
||||
return value->get();
|
||||
return it->second.as<std::string>();
|
||||
};
|
||||
// skip policy
|
||||
auto should_be_skipped = [] (const ngraph::PartialShape &partialShape, cpu_memory_format_t fmt) {
|
||||
@@ -273,10 +269,10 @@ CPUTestsBase::makeCPUInfo(std::vector<cpu_memory_format_t> inFmts, std::vector<c
|
||||
ngraph::MKLDNNOutputMemoryFormats(fmts2str(outFmts, "cpu:"))});
|
||||
}
|
||||
if (!priority.empty()) {
|
||||
cpuInfo.insert({"PrimitivesPriority", std::make_shared<ngraph::VariantWrapper<std::string>>(impls2str(priority))});
|
||||
cpuInfo.insert({"PrimitivesPriority", impls2str(priority)});
|
||||
}
|
||||
|
||||
cpuInfo.insert({"enforceBF16evenForGraphTail", ov::make_runtime_attribute<int64_t>(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<ngraph::VariantImpl<std::string>>(it->second);
|
||||
IE_ASSERT(nullptr != value);
|
||||
return value->get();
|
||||
return it->second.as<std::string>();
|
||||
};
|
||||
if (getExecValue(ExecGraphInfoSerialization::LAYER_TYPE) == nodeType) {
|
||||
actualNodeCount++;
|
||||
|
||||
@@ -45,10 +45,7 @@ void CpuTestWithFusing::CheckFusingResults(std::shared_ptr<const ov::Function> 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<ngraph::VariantImpl<std::string>>(it->second);
|
||||
IE_ASSERT(nullptr != value);
|
||||
|
||||
return value->get();
|
||||
return it->second.as<std::string>();
|
||||
};
|
||||
|
||||
auto layerType = getExecValue("layerType", rtInfo);
|
||||
|
||||
+1
-1
@@ -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<ngraph::VariantWrapper<std::string>>(affinity);
|
||||
op->get_rt_info()["affinity"] = affinity;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-8
@@ -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<ngraph::VariantImpl<std::string>>(it->second);
|
||||
IE_ASSERT(nullptr != value);
|
||||
|
||||
return value->get();
|
||||
return it->second.as<std::string>();
|
||||
};
|
||||
|
||||
// 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<ngraph::VariantImpl<std::string>>(it->second);
|
||||
IE_ASSERT(nullptr != value);
|
||||
|
||||
return value->get();
|
||||
return it->second.as<std::string>();
|
||||
};
|
||||
|
||||
// At least one layer in the topology should be executed and have valid perf counter value
|
||||
|
||||
+2
-8
@@ -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<ngraph::VariantImpl<std::string>>(it->second);
|
||||
IE_ASSERT(nullptr != value);
|
||||
|
||||
return value->get();
|
||||
return it->second.as<std::string>();
|
||||
};
|
||||
|
||||
// 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<ngraph::VariantImpl<std::string>>(it->second);
|
||||
IE_ASSERT(nullptr != value);
|
||||
|
||||
return value->get();
|
||||
return it->second.as<std::string>();
|
||||
};
|
||||
|
||||
// At least one layer in the topology should be executed and have valid perf counter value
|
||||
|
||||
+2
-2
@@ -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<ngraph::VariantWrapper<std::string>>(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<ngraph::VariantWrapper<std::string>>(affinity);
|
||||
op->get_rt_info()["affinity"] = affinity;
|
||||
}
|
||||
auto exeNetwork = ie.compile_model(ksoNetwork, deviceName);
|
||||
} catch (const ov::Exception& ex) {
|
||||
|
||||
+2
-2
@@ -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<ngraph::VariantWrapper<std::string>>(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<ngraph::VariantWrapper<std::string>>(affinity);
|
||||
op->get_rt_info()["affinity"] = affinity;
|
||||
}
|
||||
InferenceEngine::ExecutableNetwork exeNetwork = ie.LoadNetwork(ksoCnnNetwork, deviceName);
|
||||
} catch (const InferenceEngine::Exception& ex) {
|
||||
|
||||
+2
-2
@@ -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<ngraph::VariantImpl<std::string>>(var);
|
||||
auto s_val = var.as<std::string>();
|
||||
|
||||
if (s_val->get() == "MemoryOutput") {
|
||||
if (s_val == "MemoryOutput") {
|
||||
assign_node_found = true;
|
||||
break;
|
||||
}
|
||||
|
||||
+1
-4
@@ -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<ngraph::VariantImpl<std::string>>(it->second);
|
||||
IE_ASSERT(nullptr != value);
|
||||
|
||||
return value->get();
|
||||
return it->second.as<std::string>();
|
||||
};
|
||||
|
||||
auto layerType = getExecValue("layerType");
|
||||
|
||||
+2
-4
@@ -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<ngraph::VariantWrapper<std::string>>(rtIter->second);
|
||||
|
||||
if (expectedPrc.second.name() != rtPrecisionPtr->get())
|
||||
if (expectedPrc.second.name() != rtIter->second.as<std::string>())
|
||||
FAIL() << "`" << expectedPrc.first << "' node runtime precision mismatch: actual = " <<
|
||||
rtPrecisionPtr->get() << ", expected = " << expectedPrc.second.name();
|
||||
rtIter->second.as<std::string>() << ", expected = " << expectedPrc.second.name();
|
||||
}
|
||||
|
||||
fnPtr.reset();
|
||||
|
||||
@@ -165,7 +165,7 @@ std::string HeteroSyntheticTest::SetUpAffinity() {
|
||||
} else {
|
||||
affinity = pluginParameters.at(1)._name;
|
||||
}
|
||||
node->get_rt_info()["affinity"] = std::make_shared<ngraph::VariantWrapper<std::string>>(affinity);
|
||||
node->get_rt_info()["affinity"] = affinity;
|
||||
affinities += "\t{\"" + node->get_friendly_name() + "\",\t\t\"" + affinity + "\"}\n";
|
||||
}
|
||||
}
|
||||
|
||||
+1
-3
@@ -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<ngraph::VariantImpl<std::string>>(it->second);
|
||||
ASSERT_NE(nullptr, variant);
|
||||
ASSERT_EQ(variant->get(), "add,conv");
|
||||
ASSERT_EQ(it->second.as<std::string>(), "add,conv");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+6
-12
@@ -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<ngraph::VariantWrapper<std::string>>(it->second);
|
||||
return rtPrecisionPtr->get();
|
||||
return it->second.as<std::string>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<ngraph::VariantWrapper<std::string>>(typeIt->second)->get();
|
||||
auto type = typeIt->second.as<std::string>();
|
||||
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<ngraph::VariantWrapper<std::string>>(it->second);
|
||||
return rtPrecisionPtr->get();
|
||||
return it->second.as<std::string>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<ngraph::VariantWrapper<std::string>>(typeIt->second)->get();
|
||||
const auto type = typeIt->second.as<std::string>();
|
||||
const auto& it = rtInfo.find("runtimePrecision");
|
||||
|
||||
const auto rtPrecisionPtr = ngraph::as_type_ptr<ngraph::VariantWrapper<std::string>>(it->second);
|
||||
std::cout << type << ": " << rtPrecisionPtr->get() << std::endl;
|
||||
const auto rtPrecisionPtr = it->second.as<std::string>();
|
||||
std::cout << type << ": " << rtPrecisionPtr << std::endl;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -128,7 +128,7 @@ std::shared_ptr<ngraph::Function> AddFunction::getOriginal(
|
||||
const auto add = std::make_shared<ngraph::opset1::Add>(dequantizationOp1, dequantizationOp2);
|
||||
add->set_friendly_name("output");
|
||||
auto& rtInfo = add->get_rt_info();
|
||||
rtInfo["Variant::std::string"] = std::make_shared<VariantWrapper<std::string>>("add");
|
||||
rtInfo["Variant::std::string"] = "add";
|
||||
|
||||
std::shared_ptr<Node> output = add;
|
||||
if (additional_output != nullptr) {
|
||||
@@ -308,7 +308,7 @@ std::shared_ptr<ngraph::Function> AddFunction::getReference(
|
||||
|
||||
NetworkHelper::setOutDataPrecisionForTypeRelaxed(add, dequantizationAfter.empty() ? precision : element::f32);
|
||||
auto& rtInfo = add->get_rt_info();
|
||||
rtInfo["Variant::std::string"] = std::make_shared<VariantWrapper<std::string>>("add");
|
||||
rtInfo["Variant::std::string"] = "add";
|
||||
|
||||
auto dequantizationStructureAfter = dequantizationAfter;
|
||||
dequantizationStructureAfter.multiply.outPrecision = precision;
|
||||
|
||||
@@ -64,7 +64,7 @@ std::shared_ptr<Node> makeDequantization(
|
||||
|
||||
auto& rt = subtractConstConvert->get_rt_info();
|
||||
for (const std::string& attribute : dequantizationOperations.subtract.convertAttributes) {
|
||||
rt[attribute] = std::make_shared<ngraph::VariantWrapper<std::string>>("");
|
||||
rt[attribute] = "";
|
||||
}
|
||||
|
||||
subtractConst = subtractConstConvert;
|
||||
@@ -105,7 +105,7 @@ std::shared_ptr<Node> 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<ngraph::VariantWrapper<std::string>>("");
|
||||
rt[attribute] = "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+22
-22
@@ -41,7 +41,7 @@ std::shared_ptr<ngraph::Function> 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<VariantWrapper<std::string>>("concat");
|
||||
rtInfo["Variant::std::string"] = "concat";
|
||||
|
||||
ngraph::ResultVector results{ std::make_shared<ngraph::opset1::Result>(concat) };
|
||||
std::shared_ptr<ngraph::Function> function = std::make_shared<ngraph::Function>(
|
||||
@@ -71,7 +71,7 @@ std::shared_ptr<ngraph::Function> ConcatFunction::getOriginal(
|
||||
concat->set_friendly_name("output");
|
||||
|
||||
auto& rtInfo = concat->get_rt_info();
|
||||
rtInfo["Variant::std::string"] = std::make_shared<VariantWrapper<std::string>>("concat");
|
||||
rtInfo["Variant::std::string"] = "concat";
|
||||
|
||||
ngraph::ResultVector results{ std::make_shared<ngraph::opset1::Result>(concat) };
|
||||
std::shared_ptr<ngraph::Function> function = std::make_shared<ngraph::Function>(
|
||||
@@ -101,7 +101,7 @@ std::shared_ptr<ngraph::Function> 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<VariantWrapper<std::string>>("concat");
|
||||
rtInfo["Variant::std::string"] = "concat";
|
||||
|
||||
const auto clamp = std::make_shared<ngraph::opset1::Clamp>(concat, 0.0, 6.0);
|
||||
clamp->set_friendly_name("111");
|
||||
@@ -139,7 +139,7 @@ std::shared_ptr<ngraph::Function> ConcatFunction::getOriginalWithNeighbors(
|
||||
concat1->set_friendly_name("concat1");
|
||||
|
||||
auto& rtInfo1 = concat1->get_rt_info();
|
||||
rtInfo1["Variant::std::string"] = std::make_shared<VariantWrapper<std::string>>("concat1");
|
||||
rtInfo1["Variant::std::string"] = "concat1";
|
||||
|
||||
ngraph::ParameterVector inputs{input1, input2};
|
||||
|
||||
@@ -173,7 +173,7 @@ std::shared_ptr<ngraph::Function> ConcatFunction::getOriginalWithNeighbors(
|
||||
1ull);
|
||||
concat2->set_friendly_name("concat2");
|
||||
auto& rtInfo2 = concat2->get_rt_info();
|
||||
rtInfo2["Variant::std::string"] = std::make_shared<VariantWrapper<std::string>>("concat2");
|
||||
rtInfo2["Variant::std::string"] = "concat2";
|
||||
results.push_back(std::make_shared<ngraph::opset1::Result>(concat1));
|
||||
results.push_back(std::make_shared<ngraph::opset1::Result>(concat2));
|
||||
} else if (neighborType == "convolution") {
|
||||
@@ -255,7 +255,7 @@ std::shared_ptr<ngraph::Function> ConcatFunction::getOriginalWithIntermediate(
|
||||
concat->set_friendly_name("concat");
|
||||
|
||||
auto& rtInfo = concat->get_rt_info();
|
||||
rtInfo["Variant::std::string"] = std::make_shared<VariantWrapper<std::string>>("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<ngraph::opset1::Convolution>(
|
||||
@@ -313,7 +313,7 @@ std::shared_ptr<ngraph::Function> ConcatFunction::getOriginalWithIntermediateAvg
|
||||
concat->set_friendly_name("concat");
|
||||
|
||||
auto& rtInfo = concat->get_rt_info();
|
||||
rtInfo["Variant::std::string"] = std::make_shared<VariantWrapper<std::string>>("concat");
|
||||
rtInfo["Variant::std::string"] = "concat";
|
||||
|
||||
std::shared_ptr<Node> parent2 = std::make_shared<ngraph::opset1::AvgPool>(
|
||||
intermediateOp,
|
||||
@@ -373,7 +373,7 @@ std::shared_ptr<ngraph::Function> ConcatFunction::getOriginalWithSplitedIntermed
|
||||
concat->set_friendly_name("output_1");
|
||||
|
||||
auto& rtInfo = concat->get_rt_info();
|
||||
rtInfo["Variant::std::string"] = std::make_shared<VariantWrapper<std::string>>("concat");
|
||||
rtInfo["Variant::std::string"] = "concat";
|
||||
|
||||
Output<Node> lastOutput = intermediateOp->output(1);
|
||||
if (addConvolution) {
|
||||
@@ -454,7 +454,7 @@ std::shared_ptr<ngraph::Function> ConcatFunction::getOriginalSelectionWithInterm
|
||||
concat->set_friendly_name("concat");
|
||||
|
||||
auto& rtInfo = concat->get_rt_info();
|
||||
rtInfo["Variant::std::string"] = std::make_shared<VariantWrapper<std::string>>("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<ngraph::opset1::Convolution>(
|
||||
@@ -698,7 +698,7 @@ std::shared_ptr<ngraph::Function> ConcatFunction::getOriginalWithIntermediateWit
|
||||
concat->set_friendly_name("concat");
|
||||
|
||||
auto& rtInfo = concat->get_rt_info();
|
||||
rtInfo["Variant::std::string"] = std::make_shared<VariantWrapper<std::string>>("concat");
|
||||
rtInfo["Variant::std::string"] = "concat";
|
||||
|
||||
const std::vector<size_t> kernel = { 3, 3 };
|
||||
const std::vector<size_t> stride = { 1, 1 };
|
||||
@@ -805,7 +805,7 @@ std::shared_ptr<ngraph::Function> 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<VariantWrapper<std::string>>("concat");
|
||||
rtInfo["Variant::std::string"] = "concat";
|
||||
|
||||
ngraph::ResultVector results{ std::make_shared<ngraph::opset1::Result>(concat) };
|
||||
std::shared_ptr<ngraph::Function> function = std::make_shared<ngraph::Function>(
|
||||
@@ -834,7 +834,7 @@ std::shared_ptr<ngraph::Function> ConcatFunction::getReference(
|
||||
const std::shared_ptr<ngraph::opset1::Concat> concat = std::make_shared<ngraph::op::TypeRelaxed<ngraph::opset1::Concat>>(
|
||||
ngraph::OutputVector{ fakeQuantize1->output(0), fakeQuantize2->output(0) }, 1);
|
||||
auto& rtInfo = concat->get_rt_info();
|
||||
rtInfo["Variant::std::string"] = std::make_shared<VariantWrapper<std::string>>("concat");
|
||||
rtInfo["Variant::std::string"] = "concat";
|
||||
|
||||
const std::shared_ptr<ngraph::Node> lastDequantization = makeDequantization(concat, dequantizationOperations);
|
||||
lastDequantization->set_friendly_name("output");
|
||||
@@ -920,7 +920,7 @@ std::shared_ptr<ngraph::Function> ConcatFunction::get(
|
||||
addAttributes({ concat }, concatAttributes);
|
||||
|
||||
auto& rtInfo = concat->get_rt_info();
|
||||
rtInfo["Variant::std::string"] = std::make_shared<VariantWrapper<std::string>>("concat");
|
||||
rtInfo["Variant::std::string"] = "concat";
|
||||
|
||||
const auto lastDequantization = makeDequantization(concat, dequantizationAfter);
|
||||
|
||||
@@ -1044,7 +1044,7 @@ std::shared_ptr<ngraph::Function> ConcatFunction::get(
|
||||
addAttributes({ parent }, concatAttributes);
|
||||
|
||||
auto& rtInfo = parent->get_rt_info();
|
||||
rtInfo["Variant::std::string"] = std::make_shared<VariantWrapper<std::string>>("concat");
|
||||
rtInfo["Variant::std::string"] = "concat";
|
||||
|
||||
parent = makeConvolution(parent, element::f32, false);
|
||||
|
||||
@@ -1109,7 +1109,7 @@ std::shared_ptr<ngraph::Function> ConcatFunction::getReferenceWithNeighbors(
|
||||
concat1->set_friendly_name("concat1");
|
||||
|
||||
auto& rtInfo1 = concat1->get_rt_info();
|
||||
rtInfo1["Variant::std::string"] = std::make_shared<VariantWrapper<std::string>>("concat1");
|
||||
rtInfo1["Variant::std::string"] = "concat1";
|
||||
|
||||
ngraph::ParameterVector inputs{input1, input2};
|
||||
std::shared_ptr<Node> mainBranch = concat1;
|
||||
@@ -1157,7 +1157,7 @@ std::shared_ptr<ngraph::Function> ConcatFunction::getReferenceWithNeighbors(
|
||||
1ull);
|
||||
concat2->set_friendly_name("concat2");
|
||||
auto& rtInfo2 = concat2->get_rt_info();
|
||||
rtInfo2["Variant::std::string"] = std::make_shared<VariantWrapper<std::string>>("concat2");
|
||||
rtInfo2["Variant::std::string"] = "concat2";
|
||||
|
||||
neighbor = concat2;
|
||||
} else if (neighborType == "convolution") {
|
||||
@@ -1270,7 +1270,7 @@ std::shared_ptr<ngraph::Function> ConcatFunction::getReferenceWithIntermediate(
|
||||
low_precision::NetworkHelper::setOutDataPrecision(concat, precisionAfterOperation);
|
||||
|
||||
auto& rtInfo = concat->get_rt_info();
|
||||
rtInfo["Variant::std::string"] = std::make_shared<VariantWrapper<std::string>>("concat");
|
||||
rtInfo["Variant::std::string"] = "concat";
|
||||
|
||||
const std::shared_ptr<ngraph::Node> lastDequantization1 = makeDequantization(concat, dequantizationAfter1);
|
||||
lastDequantization1->set_friendly_name("concat");
|
||||
@@ -1345,7 +1345,7 @@ std::shared_ptr<ngraph::Function> ConcatFunction::getReferenceWithIntermediateAv
|
||||
low_precision::NetworkHelper::setOutDataPrecision(concat, precisionAfterOperation);
|
||||
|
||||
auto& rtInfo = concat->get_rt_info();
|
||||
rtInfo["Variant::std::string"] = std::make_shared<VariantWrapper<std::string>>("concat");
|
||||
rtInfo["Variant::std::string"] = "concat";
|
||||
|
||||
const std::shared_ptr<ngraph::Node> parent1 = makeDequantization(concat, dequantizationAfter1);
|
||||
parent1->set_friendly_name("concat");
|
||||
@@ -1430,7 +1430,7 @@ std::shared_ptr<ngraph::Function> ConcatFunction::getReferenceWithSplitedInterme
|
||||
concat->set_friendly_name("concat");
|
||||
|
||||
auto& rtInfo = concat->get_rt_info();
|
||||
rtInfo["Variant::std::string"] = std::make_shared<VariantWrapper<std::string>>("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<ngraph::Function> ConcatFunction::getReferenceSelectionWithInter
|
||||
low_precision::NetworkHelper::setOutDataPrecision(concat, precisionAfterOperation);
|
||||
|
||||
auto& rtInfo = concat->get_rt_info();
|
||||
rtInfo["Variant::std::string"] = std::make_shared<VariantWrapper<std::string>>("concat");
|
||||
rtInfo["Variant::std::string"] = "concat";
|
||||
|
||||
const std::shared_ptr<ngraph::Node> lastDequantization1 = dequantizationOperations1.empty() ?
|
||||
concat :
|
||||
@@ -1812,7 +1812,7 @@ std::shared_ptr<ngraph::Function> ConcatFunction::getReferenceWithIntermediateWi
|
||||
ngraph::pass::low_precision::NetworkHelper::setOutDataPrecision(concat, precisionAfterOperation);
|
||||
|
||||
auto& rtInfo = concat->get_rt_info();
|
||||
rtInfo["Variant::std::string"] = std::make_shared<VariantWrapper<std::string>>("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<ngraph::Function> 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<VariantWrapper<std::string>>("concat");
|
||||
rtInfo["Variant::std::string"] = "concat";
|
||||
|
||||
const auto dequantization = makeDequantization(concat, dequantizationAfter);
|
||||
dequantization->set_friendly_name("output");
|
||||
|
||||
+2
-2
@@ -107,7 +107,7 @@ std::shared_ptr<ngraph::Function> ConvolutionFunction::getOriginal(
|
||||
std::vector<element::Type>{ netPrecision });
|
||||
convolution->set_friendly_name("output");
|
||||
auto& rtInfo = convolution->get_rt_info();
|
||||
rtInfo["Variant::std::string"] = std::make_shared<VariantWrapper<std::string>>("convolution");
|
||||
rtInfo["Variant::std::string"] = "convolution";
|
||||
|
||||
ngraph::ResultVector results{ std::make_shared<ngraph::opset1::Result>(convolution) };
|
||||
return std::make_shared<ngraph::Function>(results, ngraph::ParameterVector{ input }, "ConvolutionTransformation");
|
||||
@@ -305,7 +305,7 @@ std::shared_ptr<ngraph::Function> ConvolutionFunction::getReference(
|
||||
precisionAfterOperation);
|
||||
}
|
||||
auto& rtInfo = convolution->get_rt_info();
|
||||
rtInfo["Variant::std::string"] = std::make_shared<VariantWrapper<std::string>>("convolution");
|
||||
rtInfo["Variant::std::string"] = "convolution";
|
||||
|
||||
auto dequantizationStructure = dequantizationAfter;
|
||||
dequantizationStructure.multiply.outPrecision = netPrecision;
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ std::shared_ptr<ngraph::Function> ElementwiseWithMultiParentDequantizationFuncti
|
||||
const auto add = std::make_shared<ngraph::opset1::Add>(parent1, parent2);
|
||||
add->set_friendly_name("output");
|
||||
auto& rtInfo = add->get_rt_info();
|
||||
rtInfo["Variant::std::string"] = std::make_shared<VariantWrapper<std::string>>("add");
|
||||
rtInfo["Variant::std::string"] = "add";
|
||||
|
||||
ngraph::ResultVector results{ std::make_shared<ngraph::opset1::Result>(add) };
|
||||
ngraph::ParameterVector parameters = { input1_1, input1_2, input2_1, input2_2 };
|
||||
|
||||
+3
-3
@@ -38,7 +38,7 @@ std::shared_ptr<ngraph::Function> FakeQuantizeFunction::getOriginalWithMaxPool(
|
||||
|
||||
fakeQuantize->set_friendly_name("fakeQuantize");
|
||||
auto& rtInfo = fakeQuantize->get_rt_info();
|
||||
rtInfo["Variant::std::string"] = std::make_shared<VariantWrapper<std::string>>("fakeQuantize");
|
||||
rtInfo["Variant::std::string"] = "fakeQuantize";
|
||||
|
||||
ngraph::ResultVector results{ std::make_shared<ngraph::opset1::Result>(maxPool) };
|
||||
return std::make_shared<ngraph::Function>(results, ngraph::ParameterVector{ input }, "FakeQuantizeFunction");
|
||||
@@ -56,7 +56,7 @@ std::shared_ptr<ngraph::Function> 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<VariantWrapper<std::string>>("fakeQuantize");
|
||||
rtInfo["Variant::std::string"] = "fakeQuantize";
|
||||
|
||||
std::shared_ptr<Node> lastOperation = fakeQuantize;
|
||||
if (addNotPrecisionPreservedOperation) {
|
||||
@@ -90,7 +90,7 @@ std::shared_ptr<ngraph::Function> FakeQuantizeFunction::getReference(
|
||||
auto fakeQuantize = makeFakeQuantizeTypeRelaxed(input, ngraph::element::f32, fakeQuantizeOnData);
|
||||
|
||||
auto& rtInfo = fakeQuantize->get_rt_info();
|
||||
rtInfo["Variant::std::string"] = std::make_shared<VariantWrapper<std::string>>("fakeQuantize");
|
||||
rtInfo["Variant::std::string"] = "fakeQuantize";
|
||||
|
||||
std::shared_ptr<Node> lastOperation = fakeQuantize;
|
||||
if (addNotPrecisionPreservedOperation) {
|
||||
|
||||
@@ -192,7 +192,7 @@ std::shared_ptr<ngraph::Function> MatMulFunction::getOriginal(
|
||||
false);
|
||||
matMul->set_friendly_name("matMul");
|
||||
auto& rtInfo = matMul->get_rt_info();
|
||||
rtInfo["Variant::std::string"] = std::make_shared<VariantWrapper<std::string>>("matMul");
|
||||
rtInfo["Variant::std::string"] = "matMul";
|
||||
|
||||
const auto result = std::make_shared<ngraph::opset1::Result>(matMul);
|
||||
std::shared_ptr<ngraph::Function> function = std::make_shared<ngraph::Function>(
|
||||
@@ -281,7 +281,7 @@ std::shared_ptr<ngraph::Function> MatMulFunction::getReference(
|
||||
false);
|
||||
matMul->set_friendly_name("matMul");
|
||||
auto& rtInfo = matMul->get_rt_info();
|
||||
rtInfo["Variant::std::string"] = std::make_shared<VariantWrapper<std::string>>("matMul");
|
||||
rtInfo["Variant::std::string"] = "matMul";
|
||||
ngraph::pass::low_precision::NetworkHelper::setOutDataPrecision(matMul, precision);
|
||||
|
||||
const std::shared_ptr<ngraph::Node> lastDequantizationAfter = makeDequantization(matMul, resultDequantization);
|
||||
|
||||
+2
-2
@@ -33,7 +33,7 @@ namespace subgraph {
|
||||
std::vector<element::Type>{ element::f32, element::f32 },
|
||||
std::vector<element::Type>{});
|
||||
auto& rtInfo = targetOp->get_rt_info();
|
||||
rtInfo["Variant::std::string"] = std::make_shared<VariantWrapper<std::string>>("targetOp");
|
||||
rtInfo["Variant::std::string"] = "targetOp";
|
||||
|
||||
return std::make_shared<ngraph::Function>(
|
||||
ngraph::ResultVector{ std::make_shared<ngraph::opset1::Result>(targetOp) },
|
||||
@@ -63,7 +63,7 @@ namespace subgraph {
|
||||
std::vector<element::Type>{});
|
||||
ngraph::pass::low_precision::NetworkHelper::setOutDataPrecisionForTypeRelaxed(targetOp, precisionAfterOperation);
|
||||
auto& rtInfo = targetOp->get_rt_info();
|
||||
rtInfo["Variant::std::string"] = std::make_shared<VariantWrapper<std::string>>("targetOp");
|
||||
rtInfo["Variant::std::string"] = "targetOp";
|
||||
|
||||
const auto deqAfter = makeDequantization(targetOp, dequantizationAfter);
|
||||
|
||||
|
||||
+1
-1
@@ -71,7 +71,7 @@ std::shared_ptr<ngraph::Function> MultiplyFunction::get(
|
||||
std::vector<element::Type>{element::f32, element::f32},
|
||||
std::vector<element::Type>{precision});
|
||||
auto& rtInfo = multiply->get_rt_info();
|
||||
rtInfo["Variant::std::string"] = std::make_shared<VariantWrapper<std::string>>("multiply");
|
||||
rtInfo["Variant::std::string"] = "multiply";
|
||||
multiply->set_friendly_name("output");
|
||||
|
||||
ngraph::ResultVector results{ std::make_shared<ngraph::opset1::Result>(multiply) };
|
||||
|
||||
@@ -37,7 +37,7 @@ std::shared_ptr<ngraph::Function> MVNFunction::getOriginal(
|
||||
}
|
||||
mvn->set_friendly_name("output");
|
||||
auto& rtInfo = mvn->get_rt_info();
|
||||
rtInfo["Variant::std::string"] = std::make_shared<VariantWrapper<std::string>>("mvn");
|
||||
rtInfo["Variant::std::string"] = "mvn";
|
||||
|
||||
ngraph::ResultVector results{ std::make_shared<ngraph::opset1::Result>(mvn) };
|
||||
return std::make_shared<ngraph::Function>(results, ngraph::ParameterVector{ input }, "MVNFunction");
|
||||
@@ -90,7 +90,7 @@ std::shared_ptr<ngraph::Function> MVNFunction::getReference(
|
||||
dequantizationAfter.empty() ? precision : element::f32);
|
||||
}
|
||||
auto& rtInfo = mvn->get_rt_info();
|
||||
rtInfo["Variant::std::string"] = std::make_shared<VariantWrapper<std::string>>("mvn");
|
||||
rtInfo["Variant::std::string"] = "mvn";
|
||||
|
||||
auto deqAfterStructure = dequantizationAfter;
|
||||
deqAfterStructure.multiply.outPrecision = precision;
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ namespace subgraph {
|
||||
std::vector<element::Type>{ element::f32, element::f32 },
|
||||
std::vector<element::Type>{});
|
||||
auto& rtInfo = targetOp->get_rt_info();
|
||||
rtInfo["Variant::std::string"] = std::make_shared<VariantWrapper<std::string>>("targetOp");
|
||||
rtInfo["Variant::std::string"] = "targetOp";
|
||||
|
||||
return std::make_shared<ngraph::Function>(
|
||||
ngraph::ResultVector{ std::make_shared<ngraph::opset1::Result>(targetOp) },
|
||||
|
||||
+2
-2
@@ -79,7 +79,7 @@ std::shared_ptr<ngraph::Function> NormalizeL2Function::getOriginal(
|
||||
const auto normalizeL2 = std::make_shared<ngraph::opset1::NormalizeL2>(deq, axesNode, 1e-6, epsMode);
|
||||
normalizeL2->set_friendly_name("output");
|
||||
auto& rtInfo = normalizeL2->get_rt_info();
|
||||
rtInfo["Variant::std::string"] = std::make_shared<VariantWrapper<std::string>>("normalizeL2");
|
||||
rtInfo["Variant::std::string"] = "normalizeL2";
|
||||
|
||||
ngraph::ResultVector results = { std::make_shared<ngraph::opset1::Result>(normalizeL2) };
|
||||
const auto function = std::make_shared<ngraph::Function>(results, ngraph::ParameterVector{ input }, "NormalizeL2Transformation");
|
||||
@@ -113,7 +113,7 @@ std::shared_ptr<ngraph::Function> NormalizeL2Function::getReference(
|
||||
1e-6,
|
||||
epsMode);
|
||||
auto& rtInfo = normalizeL2->get_rt_info();
|
||||
rtInfo["Variant::std::string"] = std::make_shared<VariantWrapper<std::string>>("normalizeL2");
|
||||
rtInfo["Variant::std::string"] = "normalizeL2";
|
||||
|
||||
auto deqAfterStructure = dequantizationAfter;
|
||||
deqAfterStructure.multiply.outPrecision = precision;
|
||||
|
||||
+4
-4
@@ -89,7 +89,7 @@ std::shared_ptr<ngraph::Function> PrecisionPropagationFunction::getOriginalWithN
|
||||
concat1->set_friendly_name("concat1");
|
||||
|
||||
auto& rtInfo1 = concat1->get_rt_info();
|
||||
rtInfo1["Variant::std::string"] = std::make_shared<VariantWrapper<std::string>>("concat1");
|
||||
rtInfo1["Variant::std::string"] = "concat1";
|
||||
|
||||
const auto concat2 = std::make_shared<ngraph::opset1::Concat>(
|
||||
ngraph::OutputVector { parent2->output(0), parent3->output(0) },
|
||||
@@ -97,7 +97,7 @@ std::shared_ptr<ngraph::Function> PrecisionPropagationFunction::getOriginalWithN
|
||||
concat2->set_friendly_name("concat2");
|
||||
|
||||
auto& rtInfo2 = concat2->get_rt_info();
|
||||
rtInfo2["Variant::std::string"] = std::make_shared<VariantWrapper<std::string>>("concat2");
|
||||
rtInfo2["Variant::std::string"] = "concat2";
|
||||
|
||||
std::shared_ptr<ngraph::Node> result1 = concat1;
|
||||
std::shared_ptr<ngraph::Node> result2 = concat2;
|
||||
@@ -198,7 +198,7 @@ std::shared_ptr<ngraph::Function> PrecisionPropagationFunction::getReferenceWith
|
||||
concat1->set_friendly_name("concat1");
|
||||
|
||||
auto& rtInfo1 = concat1->get_rt_info();
|
||||
rtInfo1["Variant::std::string"] = std::make_shared<VariantWrapper<std::string>>("concat1");
|
||||
rtInfo1["Variant::std::string"] = "concat1";
|
||||
|
||||
const auto concat2 = std::make_shared<ngraph::opset1::Concat>(
|
||||
ngraph::OutputVector { deqBefore2, deqBefore3 },
|
||||
@@ -206,7 +206,7 @@ std::shared_ptr<ngraph::Function> PrecisionPropagationFunction::getReferenceWith
|
||||
concat2->set_friendly_name("concat2");
|
||||
|
||||
auto& rtInfo2 = concat2->get_rt_info();
|
||||
rtInfo2["Variant::std::string"] = std::make_shared<VariantWrapper<std::string>>("concat2");
|
||||
rtInfo2["Variant::std::string"] = "concat2";
|
||||
|
||||
std::shared_ptr<ngraph::Node> result1 = concat1;
|
||||
std::shared_ptr<ngraph::Node> result2 = concat2;
|
||||
|
||||
@@ -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<ngraph::VariantWrapper<std::string> > ("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<ngraph::VariantWrapper<std::string>>("testAffinity");
|
||||
op2["affinity"] = "testAffinity";
|
||||
|
||||
auto & op3 = net3.getFunction()->get_ops().front()->get_rt_info();
|
||||
op3["affinity"] = std::make_shared<ngraph::VariantWrapper<std::string>>("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<ngraph::VariantWrapper<std::string>>("hello");
|
||||
op1["someFutureKey"] = "hello";
|
||||
|
||||
auto & op2 = net2.getFunction()->get_ops().front()->get_rt_info();
|
||||
op2["someFutureKey"] = std::make_shared<ngraph::VariantWrapper<std::string>>("hello");
|
||||
op2["someFutureKey"] = "hello";
|
||||
|
||||
auto & op3 = net3.getFunction()->get_ops().front()->get_rt_info();
|
||||
op3["someFutureKey"] = std::make_shared<ngraph::VariantWrapper<std::string>>("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<ngraph::VariantWrapper<int64_t>>(42);
|
||||
op1["someFutureKey"] = int64_t(42);
|
||||
|
||||
auto & op2 = net2.getFunction()->get_ops().front()->get_rt_info();
|
||||
op2["someFutureKey"] = std::make_shared<ngraph::VariantWrapper<int64_t>>(42);
|
||||
op2["someFutureKey"] = int64_t(42);
|
||||
|
||||
auto & op3 = net3.getFunction()->get_ops().front()->get_rt_info();
|
||||
op3["someFutureKey"] = std::make_shared<ngraph::VariantWrapper<int64_t>>(43);
|
||||
op3["someFutureKey"] = int64_t(43);
|
||||
|
||||
ASSERT_EQ(NetworkCompilationContext::computeHash(net1, {}),
|
||||
NetworkCompilationContext::computeHash(net2, {}));
|
||||
|
||||
@@ -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<ngraph::VariantWrapper<int64_t>>(rt_info["keep_constants"])) {
|
||||
keep_constants = attr->get();
|
||||
}
|
||||
bool keep_constants = rt_info["keep_constants"].as<bool>();
|
||||
|
||||
// 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<ngraph::VariantImpl<std::string>>(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<std::string>(),
|
||||
details::convertPrecision(node->get_output_element_type(0))};
|
||||
rtInfo.erase(ExecGraphInfoSerialization::LAYER_TYPE);
|
||||
|
||||
auto res = std::make_shared<InferenceEngine::CNNLayer>(attrs);
|
||||
res->params = params;
|
||||
|
||||
for (const auto & kvp : rtInfo) {
|
||||
auto castedVariant = std::dynamic_pointer_cast<ngraph::VariantImpl<std::string>>(kvp.second);
|
||||
// skip RT info which holds fusedNames, etc
|
||||
if (castedVariant)
|
||||
res->params[kvp.first] = getStringValue(castedVariant);
|
||||
if (kvp.second.is<std::string>())
|
||||
res->params[kvp.first] = kvp.second.as<std::string>();
|
||||
}
|
||||
|
||||
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<ngraph::VariantWrapper<int64_t>>(rt_info["keep_constants"])) {
|
||||
keep_constants = attr->get();
|
||||
}
|
||||
bool keep_constants = rt_info["keep_constants"].as<bool>();
|
||||
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_ptr<const ::ngraph::Function
|
||||
|
||||
// TODO: remove this rt info when all blobs will be inputs
|
||||
auto &rt_info = layer->get_rt_info();
|
||||
rt_info["keep_constants"] = std::make_shared<::ngraph::VariantWrapper<int64_t>> (keep_constants);
|
||||
rt_info["keep_constants"] = keep_constants;
|
||||
|
||||
CNNLayerPtr cnnLayer = createCNNLayer(layer);
|
||||
|
||||
@@ -1921,7 +1907,7 @@ void convertFunctionToICNNNetwork(const std::shared_ptr<const ::ngraph::Function
|
||||
cnnLayer->params["PrimitivesPriority"] = primitivesPriority;
|
||||
}
|
||||
|
||||
// Copy runtime info attributes from Nodes to CNNLayers if they have VariantWrapper<std::string> 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<std::string>()) {
|
||||
auto str_attr = rt.second.as<std::string>();
|
||||
|
||||
@@ -45,7 +45,7 @@ private:
|
||||
typedef struct {} init_rt_result;
|
||||
|
||||
init_rt_result init_rt_info() {
|
||||
BaseNmsOp::get_rt_info()["opset"] = std::make_shared<ngraph::VariantWrapper<std::string>>("ie_internal_opset");
|
||||
BaseNmsOp::get_rt_info()["opset"] = "ie_internal_opset";
|
||||
return {};
|
||||
}
|
||||
|
||||
|
||||
@@ -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<ngraph::VariantWrapper<std::string>>("type_relaxed_opset");
|
||||
node.get_rt_info()["opset"] = "type_relaxed_opset";
|
||||
return {};
|
||||
}
|
||||
|
||||
|
||||
@@ -18,28 +18,77 @@ using ov::Node;
|
||||
using VariantTypeInfo = ov::DiscreteTypeInfo;
|
||||
|
||||
using Variant = ov::RuntimeAttribute;
|
||||
template <typename T>
|
||||
using VariantImpl = ov::RuntimeAttributeImpl<T>;
|
||||
|
||||
template <typename T>
|
||||
using VariantWrapper = ov::RuntimeAttributeWrapper<T>;
|
||||
template <typename VT>
|
||||
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 <typename VT>
|
||||
class OPENVINO_DEPRECATED("Please use ov::Any to store VT directly") VariantWrapper {};
|
||||
|
||||
OPENVINO_SUPPRESS_DEPRECATED_START
|
||||
extern template class OPENVINO_API VariantImpl<std::string>;
|
||||
extern template class OPENVINO_API VariantImpl<int64_t>;
|
||||
extern template class OPENVINO_API VariantImpl<bool>;
|
||||
|
||||
template <>
|
||||
class OPENVINO_API VariantWrapper<std::string> : public VariantImpl<std::string> {
|
||||
public:
|
||||
OPENVINO_RTTI("VariantWrapper<std::string>");
|
||||
VariantWrapper(const value_type& value) : VariantImpl<value_type>(value) {}
|
||||
std::string to_string() const override {
|
||||
return m_value;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
class OPENVINO_API VariantWrapper<int64_t> : public VariantImpl<int64_t> {
|
||||
public:
|
||||
OPENVINO_RTTI("VariantWrapper<int64_t>");
|
||||
VariantWrapper(const value_type& value) : VariantImpl<value_type>(value) {}
|
||||
std::string to_string() const override {
|
||||
return std::to_string(m_value);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
inline std::shared_ptr<Variant> make_variant(const T& p) {
|
||||
return ov::make_runtime_attribute(p);
|
||||
return std::static_pointer_cast<Variant>(std::make_shared<VariantWrapper<T>>(p));
|
||||
}
|
||||
|
||||
template <size_t N>
|
||||
inline std::shared_ptr<Variant> make_variant(const char (&s)[N]) {
|
||||
return ov::make_runtime_attribute(s);
|
||||
return std::static_pointer_cast<Variant>(std::make_shared<VariantWrapper<std::string>>(s));
|
||||
}
|
||||
|
||||
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
|
||||
template <size_t N>
|
||||
inline std::shared_ptr<Variant> make_variant(const wchar_t (&s)[N]) {
|
||||
return ov::make_runtime_attribute(s);
|
||||
return std::static_pointer_cast<Variant>(std::make_shared<VariantWrapper<std::wstring>>(s));
|
||||
}
|
||||
#endif
|
||||
|
||||
using ov::RTMap;
|
||||
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
} // namespace ngraph
|
||||
@@ -687,6 +687,7 @@ namespace util {
|
||||
template <>
|
||||
struct AsTypePtr<Any> {
|
||||
template <typename T>
|
||||
OPENVINO_DEPRECATED("Please use ov::Any::as() method")
|
||||
static std::shared_ptr<T> call(const Any& any) {
|
||||
try {
|
||||
return any.as<std::shared_ptr<T>>();
|
||||
@@ -699,10 +700,13 @@ struct AsTypePtr<Any> {
|
||||
|
||||
using RTMap = std::map<std::string, Any>;
|
||||
|
||||
using AnyVector = std::vector<ov::Any>;
|
||||
|
||||
} // namespace ov
|
||||
|
||||
namespace std {
|
||||
template <typename T>
|
||||
OPENVINO_DEPRECATED("Please use ov::Any::as() method")
|
||||
std::shared_ptr<T> dynamic_pointer_cast(const ::ov::Any& any) {
|
||||
try {
|
||||
return any.as<std::shared_ptr<T>>();
|
||||
@@ -712,6 +716,7 @@ std::shared_ptr<T> dynamic_pointer_cast(const ::ov::Any& any) {
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
OPENVINO_DEPRECATED("Please use ov::Any::as() method")
|
||||
std::shared_ptr<T> static_pointer_cast(const ::ov::Any& any) {
|
||||
return any.as<std::shared_ptr<T>>();
|
||||
}
|
||||
|
||||
@@ -40,73 +40,4 @@ public:
|
||||
};
|
||||
OPENVINO_API std::ostream& operator<<(std::ostream& os, const RuntimeAttribute& attrubute);
|
||||
|
||||
template <typename VT>
|
||||
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<std::string>;
|
||||
extern template class OPENVINO_API RuntimeAttributeImpl<int64_t>;
|
||||
extern template class OPENVINO_API RuntimeAttributeImpl<bool>;
|
||||
|
||||
template <typename VT>
|
||||
class RuntimeAttributeWrapper {};
|
||||
|
||||
template <>
|
||||
class OPENVINO_API RuntimeAttributeWrapper<std::string> : public RuntimeAttributeImpl<std::string> {
|
||||
public:
|
||||
OPENVINO_RTTI("RuntimeAttributeWrapper<std::string>");
|
||||
RuntimeAttributeWrapper(const value_type& value) : RuntimeAttributeImpl<value_type>(value) {}
|
||||
std::string to_string() const override {
|
||||
return m_value;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
class OPENVINO_API RuntimeAttributeWrapper<int64_t> : public RuntimeAttributeImpl<int64_t> {
|
||||
public:
|
||||
OPENVINO_RTTI("RuntimeAttributeWrapper<int64_t>");
|
||||
RuntimeAttributeWrapper(const value_type& value) : RuntimeAttributeImpl<value_type>(value) {}
|
||||
std::string to_string() const override {
|
||||
return std::to_string(m_value);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
inline std::shared_ptr<RuntimeAttribute> make_runtime_attribute(const T& p) {
|
||||
return std::static_pointer_cast<RuntimeAttribute>(std::make_shared<RuntimeAttributeWrapper<T>>(p));
|
||||
}
|
||||
|
||||
template <size_t N>
|
||||
inline std::shared_ptr<RuntimeAttribute> make_runtime_attribute(const char (&s)[N]) {
|
||||
return std::static_pointer_cast<RuntimeAttribute>(std::make_shared<RuntimeAttributeWrapper<std::string>>(s));
|
||||
}
|
||||
|
||||
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
|
||||
template <size_t N>
|
||||
inline std::shared_ptr<RuntimeAttribute> make_runtime_attribute(const wchar_t (&s)[N]) {
|
||||
return std::static_pointer_cast<RuntimeAttribute>(std::make_shared<RuntimeAttributeWrapper<std::wstring>>(s));
|
||||
}
|
||||
#endif
|
||||
|
||||
using RuntimeAttributeVector = std::vector<ov::Any>;
|
||||
} // namespace ov
|
||||
@@ -125,7 +125,9 @@ struct AsTypePtr<std::shared_ptr<In>> {
|
||||
/// Type, nullptr otherwise
|
||||
template <typename T, typename U>
|
||||
auto as_type_ptr(const U& value) -> decltype(::ov::util::AsTypePtr<U>::template call<T>(value)) {
|
||||
OPENVINO_SUPPRESS_DEPRECATED_START
|
||||
return ::ov::util::AsTypePtr<U>::template call<T>(value);
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
}
|
||||
} // namespace ov
|
||||
|
||||
|
||||
@@ -26,14 +26,16 @@ bool ngraph::pass::FixRtInfo::run_on_function(std::shared_ptr<ngraph::Function>
|
||||
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<std::shared_ptr<VariantWrapper<std::string>>>()) {
|
||||
rt_info.emplace(ov::PrimitivesPriority::get_type_info_static(),
|
||||
ov::PrimitivesPriority{
|
||||
it_info->second.as<std::shared_ptr<VariantWrapper<std::string>>>()->get()});
|
||||
if (it_info->second.is<std::shared_ptr<ngraph::VariantWrapper<std::string>>>()) {
|
||||
rt_info.emplace(
|
||||
ov::PrimitivesPriority::get_type_info_static(),
|
||||
ov::PrimitivesPriority{
|
||||
it_info->second.as<std::shared_ptr<ngraph::VariantWrapper<std::string>>>()->get()});
|
||||
} else if (it_info->second.is<ov::PrimitivesPriority>()) {
|
||||
rt_info.emplace(ov::PrimitivesPriority::get_type_info_static(),
|
||||
it_info->second.as<ov::PrimitivesPriority>());
|
||||
@@ -48,11 +50,12 @@ bool ngraph::pass::FixRtInfo::run_on_function(std::shared_ptr<ngraph::Function>
|
||||
{
|
||||
auto it_info = rt_info.find("affinity");
|
||||
if (it_info != rt_info.end()) {
|
||||
if (it_info->second.is<std::shared_ptr<VariantWrapper<std::string>>>()) {
|
||||
it_info->second = it_info->second.as<std::shared_ptr<VariantWrapper<std::string>>>()->get();
|
||||
if (it_info->second.is<std::shared_ptr<ngraph::VariantWrapper<std::string>>>()) {
|
||||
it_info->second = it_info->second.as<std::shared_ptr<ngraph::VariantWrapper<std::string>>>()->get();
|
||||
}
|
||||
}
|
||||
}
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -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<ov::RuntimeAttributeWrapper<int64_t>>(1);
|
||||
rt_info["UNROLL_TI"] = int64_t(1);
|
||||
|
||||
int64_t variable_id = 0;
|
||||
std::vector<std::shared_ptr<ngraph::op::Sink>> assigns;
|
||||
|
||||
@@ -558,8 +558,8 @@ std::string get_opset_name(const ngraph::Node* n, const std::map<std::string, ng
|
||||
// Try to find opset name from RT info
|
||||
auto opset_it = n->get_rt_info().find("opset");
|
||||
if (opset_it != n->get_rt_info().end()) {
|
||||
if (auto variant = std::dynamic_pointer_cast<ngraph::VariantImpl<std::string>>(opset_it->second)) {
|
||||
const std::string& opset_name = variant->get();
|
||||
if (opset_it->second.is<std::string>()) {
|
||||
const std::string& opset_name = opset_it->second.as<std::string>();
|
||||
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<std::string>& 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<ngraph::VariantImpl<std::string>>(param.second)) {
|
||||
if (param.second.is<std::string>()) {
|
||||
const std::string& name = param.first;
|
||||
const std::string& value = variant->get();
|
||||
const std::string& value = param.second.as<std::string>();
|
||||
|
||||
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<VariantWrapper<int64_t>>(rt_info.at("version"));
|
||||
version = version_var->get();
|
||||
version = rt_info.at("version").as<int64_t>();
|
||||
}
|
||||
|
||||
if (version != static_cast<int64_t>(ver) && ver != ov::pass::Serialize::Version::UNSPECIFIED)
|
||||
@@ -1167,8 +1166,7 @@ bool pass::StreamSerialize::run_on_function(std::shared_ptr<ngraph::Function> f)
|
||||
auto version = static_cast<int64_t>(m_version);
|
||||
auto& rt_info = f->get_rt_info();
|
||||
if (rt_info.count("version")) {
|
||||
auto version_var = std::dynamic_pointer_cast<VariantWrapper<int64_t>>(rt_info.at("version"));
|
||||
version = version_var->get();
|
||||
version = rt_info.at("version").as<int64_t>();
|
||||
}
|
||||
|
||||
if (version != static_cast<int64_t>(m_version) && m_version != Serialize::Version::UNSPECIFIED)
|
||||
|
||||
@@ -32,8 +32,4 @@ std::ostream& operator<<(std::ostream& os, const RuntimeAttribute& attrubute) {
|
||||
return os << attrubute.to_string();
|
||||
}
|
||||
|
||||
template class ov::RuntimeAttributeImpl<std::string>;
|
||||
template class ov::RuntimeAttributeImpl<int64_t>;
|
||||
template class ov::RuntimeAttributeImpl<bool>;
|
||||
|
||||
} // namespace ov
|
||||
@@ -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<std::string>;
|
||||
template class VariantImpl<int64_t>;
|
||||
template class VariantImpl<bool>;
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
} // namespace ngraph
|
||||
+37
-18
@@ -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 <ngraph/variant.hpp>
|
||||
#include <string>
|
||||
|
||||
#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<RuntimeAttributeImpl<int>>();
|
||||
return std::make_shared<ngraph::VariantImpl<int>>();
|
||||
};
|
||||
auto other_parameter = Any{get_impl()};
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
}
|
||||
|
||||
TEST_F(AnyTests, dynamicPointerCastToRuntimeAttribute) {
|
||||
Any p = std::make_shared<RuntimeAttributeWrapper<std::string>>("42");
|
||||
auto str_variant = std::dynamic_pointer_cast<RuntimeAttributeWrapper<std::string>>(p);
|
||||
TEST_F(AnyTests, dynamicPointerCastToVariantWrapper) {
|
||||
OPENVINO_SUPPRESS_DEPRECATED_START
|
||||
Any p = std::make_shared<ngraph::VariantWrapper<std::string>>("42");
|
||||
auto str_variant = std::dynamic_pointer_cast<ngraph::VariantWrapper<std::string>>(p);
|
||||
ASSERT_EQ("42", str_variant->get());
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
}
|
||||
|
||||
TEST_F(AnyTests, asTypePtrToRuntimeAttribute) {
|
||||
Any p = std::make_shared<RuntimeAttributeWrapper<std::string>>("42");
|
||||
auto str_variant = ov::as_type_ptr<RuntimeAttributeWrapper<std::string>>(p);
|
||||
TEST_F(AnyTests, asTypePtrToVariantWrapper) {
|
||||
OPENVINO_SUPPRESS_DEPRECATED_START
|
||||
Any p = std::make_shared<ngraph::VariantWrapper<std::string>>("42");
|
||||
auto str_variant = ov::as_type_ptr<ngraph::VariantWrapper<std::string>>(p);
|
||||
ASSERT_EQ("42", str_variant->get());
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
}
|
||||
|
||||
TEST_F(AnyTests, castToRuntimeAttribute) {
|
||||
TEST_F(AnyTests, castToVariantWrapper) {
|
||||
{
|
||||
Any p = std::make_shared<RuntimeAttributeWrapper<std::string>>("42");
|
||||
std::shared_ptr<RuntimeAttributeWrapper<std::string>> str_variant = p;
|
||||
OPENVINO_SUPPRESS_DEPRECATED_START
|
||||
Any p = std::make_shared<ngraph::VariantWrapper<std::string>>("42");
|
||||
std::shared_ptr<ngraph::VariantWrapper<std::string>> str_variant = p;
|
||||
ASSERT_EQ("42", str_variant->get());
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
}
|
||||
{
|
||||
Any p = std::make_shared<RuntimeAttributeWrapper<std::string>>("42");
|
||||
auto f = [](const std::shared_ptr<RuntimeAttributeWrapper<std::string>>& str_variant) {
|
||||
OPENVINO_SUPPRESS_DEPRECATED_START
|
||||
Any p = std::make_shared<ngraph::VariantWrapper<std::string>>("42");
|
||||
auto f = [](const std::shared_ptr<ngraph::VariantWrapper<std::string>>& str_variant) {
|
||||
ASSERT_EQ("42", str_variant->get());
|
||||
};
|
||||
f(p);
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
}
|
||||
{
|
||||
Any p = std::make_shared<RuntimeAttributeWrapper<std::string>>("42");
|
||||
auto f = [](std::shared_ptr<RuntimeAttributeWrapper<std::string>>& str_variant) {
|
||||
OPENVINO_SUPPRESS_DEPRECATED_START
|
||||
Any p = std::make_shared<ngraph::VariantWrapper<std::string>>("42");
|
||||
auto f = [](std::shared_ptr<ngraph::VariantWrapper<std::string>>& str_variant) {
|
||||
ASSERT_EQ("42", str_variant->get());
|
||||
};
|
||||
f(p);
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
}
|
||||
{
|
||||
std::shared_ptr<RuntimeAttribute> v = std::make_shared<RuntimeAttributeWrapper<std::string>>("42");
|
||||
OPENVINO_SUPPRESS_DEPRECATED_START
|
||||
std::shared_ptr<RuntimeAttribute> v = std::make_shared<ngraph::VariantWrapper<std::string>>("42");
|
||||
Any p = v;
|
||||
auto f = [](std::shared_ptr<RuntimeAttributeWrapper<std::string>>& str_variant) {
|
||||
auto f = [](std::shared_ptr<ngraph::VariantWrapper<std::string>>& str_variant) {
|
||||
ASSERT_NE(nullptr, str_variant);
|
||||
ASSERT_EQ("42", str_variant->get());
|
||||
};
|
||||
f(p);
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ inline std::shared_ptr<ov::Function> 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<ov::Function> 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)
|
||||
|
||||
@@ -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<VariantWrapper<int64_t>>(10);
|
||||
func->get_rt_info()["version"] = int64_t(10);
|
||||
}
|
||||
|
||||
bool CompareNodeVector(const std::vector<std::shared_ptr<ngraph::Node>>& 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<ngraph::VariantWrapper<int64_t>>(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<int64_t>();
|
||||
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<ngraph::VariantWrapper<std::string>>(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<ngraph::VariantWrapper<std::string>>(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<ngraph::VariantWrapper<std::string>>(itInfo->second)->get();
|
||||
auto value = itInfo->second.as<std::string>();
|
||||
ASSERT_TRUE(affinity.find(node->get_friendly_name()) != affinity.end());
|
||||
ASSERT_TRUE(affinity[node->get_friendly_name()] == value);
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -705,7 +705,7 @@ std::shared_ptr<ngraph::Node> XmlDeserializer::createNode(
|
||||
}
|
||||
const auto aw_data = dn.attribute("alt_width");
|
||||
if (aw_data) {
|
||||
rtInfo["alt_width"] = std::make_shared<::ngraph::VariantWrapper<std::string>>(aw_data.value());
|
||||
rtInfo["alt_width"] = aw_data.value();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -235,7 +235,7 @@ std::shared_ptr<Function> InputModelIR::InputModelIRImpl::convert() {
|
||||
ov::XmlDeserializer visitor(m_root, m_weights, m_opsets, m_extensions, variables, version);
|
||||
std::shared_ptr<ngraph::Function> function;
|
||||
visitor.on_attribute("net", function);
|
||||
function->get_rt_info()["version"] = std::make_shared<ngraph::VariantWrapper<int64_t>>(version);
|
||||
function->get_rt_info()["version"] = int64_t(version);
|
||||
ParsePreProcess(m_root, m_weights, function);
|
||||
|
||||
return function;
|
||||
|
||||
@@ -146,7 +146,7 @@ std::shared_ptr<IExecutableNetworkInternal> 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<ngraph::VariantWrapper<int64_t>>(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_ptr<IExecutableNetwor
|
||||
const auto& rt_info = function->get_rt_info();
|
||||
const auto it = rt_info.find("version");
|
||||
if (it != rt_info.end()) {
|
||||
auto ir_version_impl = std::dynamic_pointer_cast<ngraph::VariantWrapper<int64_t>>(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<int64_t>();
|
||||
// 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
|
||||
|
||||
@@ -299,9 +299,7 @@ CNNNetwork convert_to_cnnnetwork(std::shared_ptr<ngraph::Function>& function,
|
||||
using namespace ov::preprocess;
|
||||
PrePostProcessor prepost(function);
|
||||
|
||||
auto ir_version_impl = it->second.as<std::shared_ptr<ov::RuntimeAttributeWrapper<int64_t>>>();
|
||||
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<int64_t>();
|
||||
|
||||
if (ir_version == 10 && newAPI) {
|
||||
const auto inputs = function->inputs();
|
||||
@@ -345,7 +343,7 @@ CNNNetwork convert_to_cnnnetwork(std::shared_ptr<ngraph::Function>& function,
|
||||
function = prepost.build();
|
||||
|
||||
// Set version to 10
|
||||
rt_info["version"] = std::make_shared<ov::RuntimeAttributeWrapper<int64_t>>(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<ngraph::Function>& function,
|
||||
}
|
||||
|
||||
// Set version to 10
|
||||
rt_info["version"] = std::make_shared<ov::RuntimeAttributeWrapper<int64_t>>(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<char*>();
|
||||
std::shared_ptr<ngraph::runtime::AlignedBuffer> weights_buffer =
|
||||
|
||||
@@ -394,14 +394,12 @@ std::shared_ptr<ngraph::Function> Graph::GetExecGraphInfoByPrimitivesInfo(std::v
|
||||
info[ExecGraphInfoSerialization::PERF_COUNTER] = exec_time;
|
||||
|
||||
for (auto&& kvp : info) {
|
||||
auto variant = std::make_shared<::ngraph::VariantWrapper<std::string>>(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<std::string>>("Result");
|
||||
results.back()->get_rt_info()[ExecGraphInfoSerialization::LAYER_TYPE] = "Result";
|
||||
|
||||
nodes.push_back(return_node);
|
||||
node2layer[prim_info.original_id] = return_node;
|
||||
|
||||
Reference in new issue
Block a user