From e27983ccfc9f73e2ec69863dcc5d9812fba7f5ef Mon Sep 17 00:00:00 2001 From: Colm Donelan Date: Mon, 16 Jan 2023 16:45:08 +0000 Subject: IVGCVSW-7405 Improving error handling around creating directories. The -F execute network option creates a directory to print intermediate tensors but minor problems caused serious failures. This attempts to clean up the error handling. Signed-off-by: Colm Donelan Change-Id: Ia44c008919b1bee299b43a672235b1fcc25bf1bd --- src/armnn/Network.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src/armnn/Network.cpp') diff --git a/src/armnn/Network.cpp b/src/armnn/Network.cpp index 42388bfbd7..e81b87b382 100644 --- a/src/armnn/Network.cpp +++ b/src/armnn/Network.cpp @@ -1,5 +1,5 @@ // -// Copyright © 2017,2022 Arm Ltd and Contributors. All rights reserved. +// Copyright © 2017,2022,2023 Arm Ltd and Contributors. All rights reserved. // SPDX-License-Identifier: MIT // @@ -1731,8 +1731,17 @@ IOptimizedNetworkPtr Optimize(const Graph& inGraph, else if (options.m_DebugToFile) { // Setup the output file path - armnnUtils::Filesystem::CreateDirectory("/ArmNNIntermediateLayerOutputs"); - Optimizer::Pass(optGraph, MakeOptimizations(InsertDebugToFileLayer())); + try + { + auto result = armnnUtils::Filesystem::CreateDirectory("/ArmNNIntermediateLayerOutputs"); + ARMNN_LOG(info) << "Intermediate tensors will be written to: " << result; + Optimizer::Pass(optGraph, MakeOptimizations(InsertDebugToFileLayer())); + } + catch (const armnn::RuntimeException& e) + { + // If we cannot create the output directory then we'll issue a warning and continue. + ARMNN_LOG(warning) << "Unable to print intermediate layer outputs : " << e.what(); + } } // Calculate the compatibility strategies for tensor handles -- cgit v1.2.1