From de68d7d0c56ec309fe7cf6bd4b7e8aa407a4e985 Mon Sep 17 00:00:00 2001 From: Keith Davis Date: Wed, 3 Nov 2021 11:02:29 +0000 Subject: IVGCVSW-6517 Delegate Json output is invalid Change-Id: Iee9720a9df6f2f0d8e00313e1972f3a3df33cb15 Signed-off-by: Keith Davis --- src/armnn/JsonPrinter.cpp | 5 +---- src/armnn/ProfilingDetails.hpp | 19 ++++++++++++++----- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/armnn/JsonPrinter.cpp b/src/armnn/JsonPrinter.cpp index 4be956b90b..f771cb1786 100644 --- a/src/armnn/JsonPrinter.cpp +++ b/src/armnn/JsonPrinter.cpp @@ -48,9 +48,8 @@ void JsonPrinter::PrintJsonChildObject(const JsonChildObject& object, size_t& id // Add details opening DecrementNumberOfTabs(); PrintTabs(); - m_OutputStream << std::quoted("Graph") << ":[{"; + m_OutputStream << std::quoted("Graph") << ":["; PrintNewLine(); - IncrementNumberOfTabs(); // Fill details body for (std::string stringLine : object.m_LayerDetailsList) @@ -61,9 +60,7 @@ void JsonPrinter::PrintJsonChildObject(const JsonChildObject& object, size_t& id } // Close out details - DecrementNumberOfTabs(); PrintTabs(); - object.IsDetailsOnlyEnabled() ? m_OutputStream << "]" : m_OutputStream << "],"; PrintNewLine(); diff --git a/src/armnn/ProfilingDetails.hpp b/src/armnn/ProfilingDetails.hpp index 1bed395486..774565fd93 100644 --- a/src/armnn/ProfilingDetails.hpp +++ b/src/armnn/ProfilingDetails.hpp @@ -22,7 +22,7 @@ class ProfilingDetails : public JsonUtils { public: /// Constructor - ProfilingDetails() : JsonUtils(m_ProfilingDetails), m_DetailsExist(false) + ProfilingDetails() : JsonUtils(m_ProfilingDetails), m_DetailsExist(false), m_PrintSeparator(false) {} /// Destructor @@ -43,9 +43,11 @@ public: PrintNewLine(); } - m_ProfilingDetails << std::quoted("Name") << ": " << std::quoted(workloadName) << " "; PrintHeader(); - + PrintTabs(); + m_ProfilingDetails << std::quoted("Name") << ": " << std::quoted(workloadName); + PrintSeparator(); + PrintNewLine(); PrintTabs(); m_ProfilingDetails << std::quoted("GUID") << ": " << std::quoted(std::to_string(guid)); PrintSeparator(); @@ -76,17 +78,23 @@ public: } ParameterStringifyFunction extractParams = [this](const std::string& name, const std::string& value) { + if (m_PrintSeparator) + { + PrintSeparator(); + PrintNewLine(); + } PrintTabs(); m_ProfilingDetails << std::quoted(name) << " : " << std::quoted(value); - if (name != "DataLayout") PrintSeparator(); - PrintNewLine(); + m_PrintSeparator = true; }; StringifyLayerParameters::Serialize(extractParams, desc); + PrintNewLine(); PrintFooter(); m_DetailsExist = true; + m_PrintSeparator = false; } /// Get the ProfilingDetails @@ -158,6 +166,7 @@ private: /// Stores ProfilingDetails std::ostringstream m_ProfilingDetails; bool m_DetailsExist; + bool m_PrintSeparator; }; -- cgit v1.2.1