From a4c91b3aed1e4669013f5d50e90c758996082a6c Mon Sep 17 00:00:00 2001 From: Colm Donelan Date: Wed, 10 Aug 2022 16:29:08 +0100 Subject: IVGCVSW-7106 Additional fix models with multiple input and output tensors. * The previous fix for IVGCVSW-7106 introduced a problem around operators with multiple inputs and outputs: addSeparator was being applied to all tensors in the list not just the last one. Signed-off-by: Colm Donelan Change-Id: I0325d9abcb7fb512f834c61686c698bbfc29a3be --- src/armnn/ProfilingDetails.hpp | 3 ++- src/armnn/test/ProfilerTests.cpp | 29 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/armnn/ProfilingDetails.hpp b/src/armnn/ProfilingDetails.hpp index e1f357b3f3..64fceaf476 100644 --- a/src/armnn/ProfilingDetails.hpp +++ b/src/armnn/ProfilingDetails.hpp @@ -169,7 +169,8 @@ private: // Close out the scope PrintNewLine(); PrintFooter(); - if (addSeparator) + // For the last element we will consider the value of addSeparator. + if ((i < infos.size() - 1) || (addSeparator)) { PrintSeparator(); PrintNewLine(); diff --git a/src/armnn/test/ProfilerTests.cpp b/src/armnn/test/ProfilerTests.cpp index 6bccd5c97f..82fff2bc7c 100644 --- a/src/armnn/test/ProfilerTests.cpp +++ b/src/armnn/test/ProfilerTests.cpp @@ -170,6 +170,35 @@ TEST_CASE("LayerWorkloadConstructorWithWorkloadInfoInputAndOutputTensorNoParamet REQUIRE(result.find("Num Dims\": \"5\"\n\t}\n}") != std::string::npos); } +TEST_CASE("LayerWorkloadConstructorWithWorkloadInfoMultipleInputAndMultipleOutputTensorNoParameters") +{ + // Calling AddDetailsToString with a descriptor that contains multiple input and output tensors. This is + // specifically looking at the usage of "addSeparator" parameter in PrintInfos. + armnn::ProfilingDetails classOnTest; + armnn::ArgMinMaxDescriptor descriptor; + armnn::WorkloadInfo workloadInfo; + arm::pipe::ProfilingGuid guid; + armnn::TensorInfo inputTensorInfo = + armnnUtils::GetTensorInfo(1, 1, 1, 1, armnn::DataLayout::NCHW, armnn::DataType::Float32); + // Add two inputs. + workloadInfo.m_InputTensorInfos.push_back(inputTensorInfo); + workloadInfo.m_InputTensorInfos.push_back(inputTensorInfo); + + // We'll make the output tensrinfo have 5 dimensions to make errors easier to detect. + armnn::TensorInfo outputTensorInfo = + armnnUtils::GetTensorInfo(1, 1, 1, 1, 1, armnn::DataLayout::NCDHW, armnn::DataType::Float32); + // and two outputs. + workloadInfo.m_OutputTensorInfos.push_back(outputTensorInfo); + workloadInfo.m_OutputTensorInfos.push_back(outputTensorInfo); + + classOnTest.AddDetailsToString("NeonArgMinMaxWorkload_Construct", descriptor, workloadInfo, guid); + std::string result = classOnTest.GetProfilingDetails(); + // Look for the piece in the middle between Input 0 and Input 1: + REQUIRE(result.find("Dims\": \"4\"\n\t},\n\t\"Input 1\": {\n\t\t\"Shape\": \"[1,1,1,1]\"") != std::string::npos); + // Look for the piece in the middle between Output 0and Output 1: + REQUIRE(result.find("Dims\": \"5\"\n\t},\n\t\"Output 1\": {\n\t\t\"Shape\": \"[1,1,1,1,1]\"") != std::string::npos); +} + TEST_CASE("ProfilingMacros") { // Get a reference to the profiler manager. -- cgit v1.2.1