From eef60050039e2710aa90c1fe5d0ee30e36aa9105 Mon Sep 17 00:00:00 2001 From: Maxim Andronov Date: Fri, 9 Jul 2021 17:39:18 +0300 Subject: [PATCH] restore the old behavior of the getShape() for edge (#8) --- .../src/mkldnn_plugin/mkldnn_edge.cpp | 86 ++++++++----------- .../skip_tests_config.cpp | 3 +- 2 files changed, 38 insertions(+), 51 deletions(-) diff --git a/inference-engine/src/mkldnn_plugin/mkldnn_edge.cpp b/inference-engine/src/mkldnn_plugin/mkldnn_edge.cpp index 4d1a0a3c94dbcd..5384017cbf3816 100644 --- a/inference-engine/src/mkldnn_plugin/mkldnn_edge.cpp +++ b/inference-engine/src/mkldnn_plugin/mkldnn_edge.cpp @@ -202,64 +202,52 @@ void MKLDNNEdge::changeStatus(MKLDNNEdge::Status state) { status = state; } +// TODO [DS]: remove while DynamicShapes migration +// TODO [DS]: How should we validate shape compatibility? +// TODO [DS]: Why do we allow uninitialized shape? const Shape& MKLDNNEdge::getShape() { -// if (!shape.getRank()) { -// Shape inShape; -// Shape outShape; -// auto childPtr = getChild(); -// auto parentPtr = getParent(); -// -// int inNum = getOutputNum(); -// if (inNum < 0) { -// IE_THROW() << "Error cannot find input data for " << child.lock()->getName() -// << " from " << parent.lock()->getName(); -// } -// if (inNum < childPtr->inputShapes.size()) { -// outShape = childPtr->inputShapes[inNum]; -// } -// -// int outNum = getInputNum(); -// if (outNum < 0) { -// IE_THROW() << "Error cannot find output data for " << parent.lock()->getName() -// << " to " << child.lock()->getName(); -// } -// if (outNum >= parentPtr->outputShapes.size()) -// outNum = 0; -// if (outNum < parentPtr->outputShapes.size()) { -// inShape = parentPtr->outputShapes[outNum]; -// } -// -// if (inShape.getRank() && outShape.getRank() && inShape.getRank() != outShape.getRank() && inShape.size() != outShape.size()) -// IE_THROW() << "Nodes " << getParent()->getName() << " and " << getChild()->getName() -// << " have incompatible dimensions!"; -// -// if (outShape.getRank() != 0) { -// shape = outShape; -// } else if (inShape.getRank() != 0) { -// shape = inShape; -// } else { -// shape = Shape(InferenceEngine::SizeVector({1})); -// } -// -// -// if (!(outShape.getRank() == 0 && inShape.getRank() == 0) && !shape.getRank()) -// IE_THROW() << "Cannot detect right dims for nodes " << getParent()->getName() -// << " and " << getChild()->getName(); -// } - - // TODO [DS]: How should we validate shape compatibility? - // TODO [DS]: Why do we allow uninitialized shape? if (!shape.getRank()) { + Shape inShape; + Shape outShape; auto childPtr = getChild(); + auto parentPtr = getParent(); int inNum = getOutputNum(); if (inNum < 0) { - IE_THROW() << "Error cannot find input data for " << getParent()->getName() - << " from " << childPtr->getName(); + IE_THROW() << "Error cannot find input data for " << child.lock()->getName() + << " from " << parent.lock()->getName(); } if (inNum < childPtr->inputShapes.size()) { - shape = childPtr->inputShapes[inNum]; + outShape = childPtr->inputShapes[inNum]; + } + + int outNum = getInputNum(); + if (outNum < 0) { + IE_THROW() << "Error cannot find output data for " << parent.lock()->getName() + << " to " << child.lock()->getName(); + } + if (outNum >= parentPtr->outputShapes.size()) + outNum = 0; + if (outNum < parentPtr->outputShapes.size()) { + inShape = parentPtr->outputShapes[outNum]; + } + + if (inShape.getRank() && outShape.getRank() && inShape.getRank() != outShape.getRank() && inShape.getElementsCount() != outShape.getElementsCount()) + IE_THROW() << "Nodes " << getParent()->getName() << " and " << getChild()->getName() + << " have incompatible dimensions!"; + + if (outShape.getRank() != 0) { + shape = outShape; + } else if (inShape.getRank() != 0) { + shape = inShape; + } else { + shape = Shape(InferenceEngine::SizeVector({1})); } + + + if (!(outShape.getRank() == 0 && inShape.getRank() == 0) && !shape.getRank()) + IE_THROW() << "Cannot detect right dims for nodes " << getParent()->getName() + << " and " << getChild()->getName(); } return shape; diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/skip_tests_config.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/skip_tests_config.cpp index 24948ed99d605b..31e3156ca791bd 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/skip_tests_config.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/skip_tests_config.cpp @@ -83,8 +83,7 @@ std::vector disabledTestPatterns() { R"(.*SetScale.*)", R"(.*GRUSequenceCPUTest.*)", // reorder BF16 R"(.*LSTMSequenceCPUTest.*)", // reorder BF16 - R"(.*RNNSequenceCPUTest.*)", // reorder BF16 - R"(.*ConvConcatSubgraphTest.*)" // inPlace + R"(.*RNNSequenceCPUTest.*)" // reorder BF16 }; #ifdef __APPLE__ // TODO: Issue 55717