Skip to content

Commit 8fa0133

Browse files
authored
Merge pull request opencv#19479 from ilyachur:remove_v0_multiply
* Switched to v1 Multiply * Apply changes only for new OV
1 parent 7ab3a80 commit 8fa0133

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

modules/dnn/src/layers/batch_norm_layer.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,11 @@ class BatchNormLayerImpl CV_FINAL : public BatchNormLayer
401401
shape[1] = weights_.total();
402402
auto weight = std::make_shared<ngraph::op::Constant>(ngraph::element::f32, ngraph::Shape(shape), weights_.data);
403403
auto bias = std::make_shared<ngraph::op::Constant>(ngraph::element::f32, ngraph::Shape(shape), bias_.data);
404+
#if INF_ENGINE_VER_MAJOR_GT(INF_ENGINE_RELEASE_2021_2)
405+
auto scale_node = std::make_shared<ngraph::op::v1::Multiply>(ieInpNode, weight, ngraph::op::AutoBroadcastType::NUMPY);
406+
#else
404407
auto scale_node = std::make_shared<ngraph::op::v0::Multiply>(ieInpNode, weight, ngraph::op::AutoBroadcastType::NUMPY);
408+
#endif
405409
auto scale_shift = std::make_shared<ngraph::op::v1::Add>(scale_node, bias, ngraph::op::AutoBroadcastType::NUMPY);
406410
return Ptr<BackendNode>(new InfEngineNgraphNode(scale_shift));
407411
}

modules/dnn/src/layers/normalize_bbox_layer.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,11 @@ class NormalizeBBoxLayerImpl CV_FINAL : public NormalizeBBoxLayer
355355
weight = std::make_shared<ngraph::op::Constant>(
356356
ngraph::element::f32, ngraph::Shape(shape), blobs[0].data);
357357
}
358+
#if INF_ENGINE_VER_MAJOR_GT(INF_ENGINE_RELEASE_2021_2)
359+
auto mul = std::make_shared<ngraph::op::v1::Multiply>(norm, weight, ngraph::op::AutoBroadcastType::NUMPY);
360+
#else
358361
auto mul = std::make_shared<ngraph::op::v0::Multiply>(norm, weight, ngraph::op::AutoBroadcastType::NUMPY);
362+
#endif
359363
return Ptr<BackendNode>(new InfEngineNgraphNode(mul));
360364
}
361365
#endif // HAVE_DNN_NGRAPH

modules/dnn/src/layers/scale_layer.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,11 @@ class ScaleLayerImpl CV_FINAL : public ScaleLayer
314314
auto weight = blobs.empty() ? ieInpNode1 :
315315
std::make_shared<ngraph::op::Constant>(ngraph::element::f32, ngraph::Shape(shape), blobs[0].data);
316316

317+
#if INF_ENGINE_VER_MAJOR_GT(INF_ENGINE_RELEASE_2021_2)
318+
node = std::make_shared<ngraph::op::v1::Multiply>(node, weight, ngraph::op::AutoBroadcastType::NUMPY);
319+
#else
317320
node = std::make_shared<ngraph::op::v0::Multiply>(node, weight, ngraph::op::AutoBroadcastType::NUMPY);
321+
#endif
318322
}
319323
if (hasBias || !hasWeights)
320324
{

0 commit comments

Comments
 (0)