From 05a57ebd8ea27d65a796a9c49e5bede42740ccfe Mon Sep 17 00:00:00 2001 From: Maxim Shevtsov Date: Mon, 17 Aug 2020 20:17:30 +0300 Subject: [PATCH] fixed code and updated unit tests to accomodate auto-reshaping graphs, to unlock full validation (#1808) --- .../src/mkldnn_plugin/mkldnn_infer_request.cpp | 4 +++- inference-engine/src/mkldnn_plugin/mkldnn_plugin.cpp | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/inference-engine/src/mkldnn_plugin/mkldnn_infer_request.cpp b/inference-engine/src/mkldnn_plugin/mkldnn_infer_request.cpp index 57c3cc90643..4294d5502be 100644 --- a/inference-engine/src/mkldnn_plugin/mkldnn_infer_request.cpp +++ b/inference-engine/src/mkldnn_plugin/mkldnn_infer_request.cpp @@ -24,7 +24,9 @@ MKLDNNPlugin::MKLDNNInferRequest::MKLDNNInferRequest(InferenceEngine::InputsData if (execNetwork->_graphs.size() == 0) THROW_IE_EXCEPTION << "No graph was found"; - const int seq = (_networkInputs.cbegin()->second->getTensorDesc().getDims())[1]; + const int seq = execNetwork->_graphs.begin()->size() > 1 + ? _networkInputs.cbegin()->second->getTensorDesc().getDims()[1] + : 0; graph = execNetwork->_graphs.begin()->at(seq).get(); for (const auto& it : _networkInputs) { InferenceEngine::Blob::Ptr blob; diff --git a/inference-engine/src/mkldnn_plugin/mkldnn_plugin.cpp b/inference-engine/src/mkldnn_plugin/mkldnn_plugin.cpp index 17b01d9d03c..936ffd52bfb 100644 --- a/inference-engine/src/mkldnn_plugin/mkldnn_plugin.cpp +++ b/inference-engine/src/mkldnn_plugin/mkldnn_plugin.cpp @@ -162,7 +162,12 @@ Engine::LoadExeNetworkImpl(const InferenceEngine::ICNNNetwork &network, const st const InputsDataMap inputInfo = localNetwork.getInputsInfo(); ICNNNetwork::InputShapes shapes = localNetwork.getInputShapes(); ReshapedCNNNetworks reshapedNetworks; - int seq = shapes.at(inputInfo.cbegin()->first)[1]; + int seq = 0; + if (conf.dynamicSequence) { + if (shapes.at(inputInfo.cbegin()->first).size() < 2) + THROW_IE_EXCEPTION << "Auto-reshaping of the network with no sequence (first input is scalar or channels-only)!"; + seq = shapes.at(inputInfo.cbegin()->first)[1]; + } do { CNNNetwork clonedNetwork(cloneNetwork(network)); if (conf.dynamicSequence) {