mirror of
https://github.com/opencv/opencv.git
synced 2025-06-25 13:41:25 +08:00
Merge pull request #19479 from ilyachur:remove_v0_multiply
* Switched to v1 Multiply * Apply changes only for new OV
This commit is contained in:
parent
7ab3a80d0a
commit
8fa013309e
@ -401,7 +401,11 @@ public:
|
|||||||
shape[1] = weights_.total();
|
shape[1] = weights_.total();
|
||||||
auto weight = std::make_shared<ngraph::op::Constant>(ngraph::element::f32, ngraph::Shape(shape), weights_.data);
|
auto weight = std::make_shared<ngraph::op::Constant>(ngraph::element::f32, ngraph::Shape(shape), weights_.data);
|
||||||
auto bias = std::make_shared<ngraph::op::Constant>(ngraph::element::f32, ngraph::Shape(shape), bias_.data);
|
auto bias = std::make_shared<ngraph::op::Constant>(ngraph::element::f32, ngraph::Shape(shape), bias_.data);
|
||||||
|
#if INF_ENGINE_VER_MAJOR_GT(INF_ENGINE_RELEASE_2021_2)
|
||||||
|
auto scale_node = std::make_shared<ngraph::op::v1::Multiply>(ieInpNode, weight, ngraph::op::AutoBroadcastType::NUMPY);
|
||||||
|
#else
|
||||||
auto scale_node = std::make_shared<ngraph::op::v0::Multiply>(ieInpNode, weight, ngraph::op::AutoBroadcastType::NUMPY);
|
auto scale_node = std::make_shared<ngraph::op::v0::Multiply>(ieInpNode, weight, ngraph::op::AutoBroadcastType::NUMPY);
|
||||||
|
#endif
|
||||||
auto scale_shift = std::make_shared<ngraph::op::v1::Add>(scale_node, bias, ngraph::op::AutoBroadcastType::NUMPY);
|
auto scale_shift = std::make_shared<ngraph::op::v1::Add>(scale_node, bias, ngraph::op::AutoBroadcastType::NUMPY);
|
||||||
return Ptr<BackendNode>(new InfEngineNgraphNode(scale_shift));
|
return Ptr<BackendNode>(new InfEngineNgraphNode(scale_shift));
|
||||||
}
|
}
|
||||||
|
@ -355,7 +355,11 @@ public:
|
|||||||
weight = std::make_shared<ngraph::op::Constant>(
|
weight = std::make_shared<ngraph::op::Constant>(
|
||||||
ngraph::element::f32, ngraph::Shape(shape), blobs[0].data);
|
ngraph::element::f32, ngraph::Shape(shape), blobs[0].data);
|
||||||
}
|
}
|
||||||
|
#if INF_ENGINE_VER_MAJOR_GT(INF_ENGINE_RELEASE_2021_2)
|
||||||
|
auto mul = std::make_shared<ngraph::op::v1::Multiply>(norm, weight, ngraph::op::AutoBroadcastType::NUMPY);
|
||||||
|
#else
|
||||||
auto mul = std::make_shared<ngraph::op::v0::Multiply>(norm, weight, ngraph::op::AutoBroadcastType::NUMPY);
|
auto mul = std::make_shared<ngraph::op::v0::Multiply>(norm, weight, ngraph::op::AutoBroadcastType::NUMPY);
|
||||||
|
#endif
|
||||||
return Ptr<BackendNode>(new InfEngineNgraphNode(mul));
|
return Ptr<BackendNode>(new InfEngineNgraphNode(mul));
|
||||||
}
|
}
|
||||||
#endif // HAVE_DNN_NGRAPH
|
#endif // HAVE_DNN_NGRAPH
|
||||||
|
@ -314,7 +314,11 @@ public:
|
|||||||
auto weight = blobs.empty() ? ieInpNode1 :
|
auto weight = blobs.empty() ? ieInpNode1 :
|
||||||
std::make_shared<ngraph::op::Constant>(ngraph::element::f32, ngraph::Shape(shape), blobs[0].data);
|
std::make_shared<ngraph::op::Constant>(ngraph::element::f32, ngraph::Shape(shape), blobs[0].data);
|
||||||
|
|
||||||
|
#if INF_ENGINE_VER_MAJOR_GT(INF_ENGINE_RELEASE_2021_2)
|
||||||
|
node = std::make_shared<ngraph::op::v1::Multiply>(node, weight, ngraph::op::AutoBroadcastType::NUMPY);
|
||||||
|
#else
|
||||||
node = std::make_shared<ngraph::op::v0::Multiply>(node, weight, ngraph::op::AutoBroadcastType::NUMPY);
|
node = std::make_shared<ngraph::op::v0::Multiply>(node, weight, ngraph::op::AutoBroadcastType::NUMPY);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
if (hasBias || !hasWeights)
|
if (hasBias || !hasWeights)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user