Skip to content

Commit 5b5c42d

Browse files
committed
Merge pull request opencv#18027 from dkurt:dnn_backport_ngraph
2 parents 161890d + 246de2b commit 5b5c42d

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

modules/dnn/src/ie_ngraph.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,12 @@ class NgraphCustomOp: public ngraph::op::Op {
109109
}
110110
}
111111

112+
#if INF_ENGINE_VER_MAJOR_GE(INF_ENGINE_RELEASE_2020_4)
113+
std::shared_ptr<ngraph::Node> clone_with_new_inputs(const ngraph::OutputVector& new_args) const override
114+
{
115+
return std::make_shared<NgraphCustomOp>(new_args, params);
116+
}
117+
#else
112118
std::shared_ptr<ngraph::Node> copy_with_new_args(const ngraph::NodeVector& new_args) const override
113119
{
114120
#if INF_ENGINE_VER_MAJOR_GE(INF_ENGINE_RELEASE_2020_3)
@@ -117,6 +123,7 @@ class NgraphCustomOp: public ngraph::op::Op {
117123
return std::make_shared<NgraphCustomOp>(new_args, params);
118124
#endif
119125
}
126+
#endif
120127

121128
bool visit_attributes(ngraph::AttributeVisitor& visitor) override
122129
{
@@ -380,7 +387,11 @@ void InfEngineNgraphNet::setNodePtr(std::shared_ptr<ngraph::Node>* ptr) {
380387

381388
void InfEngineNgraphNet::release() {
382389
for (auto& node : components.back()) {
390+
#if INF_ENGINE_VER_MAJOR_GT(INF_ENGINE_RELEASE_2020_4)
391+
if (!(ngraph::op::is_parameter(node) || ngraph::op::is_output(node) || ngraph::op::is_constant(node)) ) {
392+
#else
383393
if (!(node->is_parameter() || node->is_output() || node->is_constant()) ) {
394+
#endif
384395
auto it = all_nodes.find(node->get_friendly_name());
385396
if (it != all_nodes.end()) {
386397
unconnectedNodes.erase(*(it->second));
@@ -447,11 +458,19 @@ void InfEngineNgraphNet::createNet(Target targetId) {
447458
ngraph::ResultVector outputs;
448459
ngraph::ParameterVector inps;
449460
for (auto& node : components.back()) {
461+
#if INF_ENGINE_VER_MAJOR_GT(INF_ENGINE_RELEASE_2020_4)
462+
if (ngraph::op::is_parameter(node)) {
463+
#else
450464
if (node->is_parameter()) {
465+
#endif
451466
auto parameter = std::dynamic_pointer_cast<ngraph::op::Parameter>(node);
452467
inps.push_back(parameter);
453468
}
469+
#if INF_ENGINE_VER_MAJOR_GT(INF_ENGINE_RELEASE_2020_4)
470+
else if (ngraph::op::is_output(node)) {
471+
#else
454472
else if (node->is_output()) {
473+
#endif
455474
auto result = std::dynamic_pointer_cast<ngraph::op::Result>(node);
456475
outputs.push_back(result);
457476
}

0 commit comments

Comments
 (0)