From 2fca665d5f02188b9c77bd3466f307fc805ef302 Mon Sep 17 00:00:00 2001 From: Xin Wang Date: Sat, 17 Apr 2021 07:01:34 +0800 Subject: [PATCH] Sort output info to keep the right order. (#148) --- .../src/base/layer_test_utils.cpp | 37 ++++++++++++++++++- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/inference-engine/tests/functional/shared_test_classes/src/base/layer_test_utils.cpp b/inference-engine/tests/functional/shared_test_classes/src/base/layer_test_utils.cpp index 5b6d6e8faa3253..c5f987b41f1f85 100644 --- a/inference-engine/tests/functional/shared_test_classes/src/base/layer_test_utils.cpp +++ b/inference-engine/tests/functional/shared_test_classes/src/base/layer_test_utils.cpp @@ -376,7 +376,23 @@ std::vector> LayerTestsCommon::CalculateRefs() { refInputsTypes[i] = FuncTestUtils::PrecisionUtils::convertIE2nGraphPrc(memory->getTensorDesc().getPrecision()); } - const auto &&outputsInfo = executableNetwork.GetOutputsInfo(); + auto mapInfo = executableNetwork.GetOutputsInfo(); + std::vector> outputsInfo(mapInfo.begin(), mapInfo.end()); + typedef std::pair pp; + struct { + bool operator()( + const pp a, + const pp b) const { + bool result = false; + if (a.first.length() < b.first.length()) { + result = true; + } else if (a.first.compare(b.first) < 0) { + result = true; + } + return result; + } + } reverseNameLess; + std::sort(outputsInfo.begin(), outputsInfo.end(), reverseNameLess); std::vector convertType; convertType.reserve(outputsInfo.size()); for (const auto &output : outputsInfo) { @@ -407,7 +423,24 @@ std::vector> LayerTestsCommon::CalculateRefs() { std::vector LayerTestsCommon::GetOutputs() { auto outputs = std::vector{}; - for (const auto &output : executableNetwork.GetOutputsInfo()) { + auto mapInfo = executableNetwork.GetOutputsInfo(); + std::vector> outputsInfo(mapInfo.begin(), mapInfo.end()); + typedef std::pair pp; + struct { + bool operator()( + const pp a, + const pp b) const { + bool result = false; + if (a.first.length() < b.first.length()) { + result = true; + } else if (a.first.compare(b.first) < 0) { + result = true; + } + return result; + } + } reverseNameLess; + std::sort(outputsInfo.begin(), outputsInfo.end(), reverseNameLess); + for (const auto &output : outputsInfo) { const auto &name = output.first; outputs.push_back(inferRequest.GetBlob(name)); }