From 8d50f8f4b848547635a74e6fdec29f632748ebb1 Mon Sep 17 00:00:00 2001 From: Matteo Martincigh Date: Thu, 25 Oct 2018 15:39:33 +0100 Subject: IVGCVSW-2051 Added unit tests in the Android NN Driver for the new Mean layer * Added unit tests (in a new file test/1.1/Mean.cpp) * Refactored ArmnnDriverImpl to remove redundant tags in the log messages * Modified AddInputOperand to accept a quantized input tensor Change-Id: Ie037ce426777daab28b0501124e1cc8686ad6184 --- ArmnnDriverImpl.cpp | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) (limited to 'ArmnnDriverImpl.cpp') diff --git a/ArmnnDriverImpl.cpp b/ArmnnDriverImpl.cpp index 267574c1..a3c2e10f 100644 --- a/ArmnnDriverImpl.cpp +++ b/ArmnnDriverImpl.cpp @@ -120,14 +120,12 @@ Return ArmnnDriverImpl::prepareModel( if (!runtime) { - return FailPrepareModel(ErrorStatus::DEVICE_UNAVAILABLE, - "ArmnnDriverImpl::prepareModel: Device unavailable", cb); + return FailPrepareModel(ErrorStatus::DEVICE_UNAVAILABLE, "Device unavailable", cb); } if (!android::nn::validateModel(model)) { - return FailPrepareModel(ErrorStatus::INVALID_ARGUMENT, - "ArmnnDriverImpl::prepareModel: Invalid model passed as input", cb); + return FailPrepareModel(ErrorStatus::INVALID_ARGUMENT, "Invalid model passed as input", cb); } // Deliberately ignore any unsupported operations requested by the options - @@ -140,8 +138,7 @@ Return ArmnnDriverImpl::prepareModel( if (modelConverter.GetConversionResult() != ConversionResult::Success) { - FailPrepareModel(ErrorStatus::GENERAL_FAILURE, - "ArmnnDriverImpl::prepareModel: ModelToINetworkConverter failed", cb); + FailPrepareModel(ErrorStatus::GENERAL_FAILURE, "ModelToINetworkConverter failed", cb); return ErrorStatus::NONE; } @@ -162,7 +159,7 @@ Return ArmnnDriverImpl::prepareModel( catch (armnn::Exception &e) { stringstream message; - message << "ArmnnDriverImpl::prepareModel: armnn::Exception (" << e.what() << ") caught from optimize."; + message << "armnn::Exception (" << e.what() << ") caught from optimize."; FailPrepareModel(ErrorStatus::GENERAL_FAILURE, message.str(), cb); return ErrorStatus::NONE; } @@ -171,12 +168,12 @@ Return ArmnnDriverImpl::prepareModel( if (!optNet) { stringstream message; - message << "ArmnnDriverImpl::prepareModel: Invalid optimized network"; - for (const string& msg : errMessages) { + message << "Invalid optimized network"; + for (const string& msg : errMessages) + { message << "\n" << msg; } - FailPrepareModel(ErrorStatus::GENERAL_FAILURE, - message.str(), cb); + FailPrepareModel(ErrorStatus::GENERAL_FAILURE, message.str(), cb); return ErrorStatus::NONE; } @@ -190,14 +187,13 @@ Return ArmnnDriverImpl::prepareModel( { if (runtime->LoadNetwork(netId, move(optNet)) != armnn::Status::Success) { - return FailPrepareModel(ErrorStatus::GENERAL_FAILURE, - "ArmnnDriverImpl::prepareModel: Network could not be loaded", cb); + return FailPrepareModel(ErrorStatus::GENERAL_FAILURE, "Network could not be loaded", cb); } } catch (armnn::Exception& e) { stringstream message; - message << "ArmnnDriverImpl::prepareModel: armnn::Exception (" << e.what()<< ") caught from LoadNetwork."; + message << "armnn::Exception (" << e.what()<< ") caught from LoadNetwork."; FailPrepareModel(ErrorStatus::GENERAL_FAILURE, message.str(), cb); return ErrorStatus::NONE; } @@ -225,7 +221,7 @@ Return ArmnnDriverImpl::prepareModel( catch (const armnn::Exception& error) { ALOGE("ArmnnDriverImpl::prepareModel: Failed to save CL tuned parameters file '%s': %s", - options.GetClTunedParametersFile().c_str(), error.what()); + options.GetClTunedParametersFile().c_str(), error.what()); } } @@ -252,4 +248,4 @@ template class ArmnnDriverImpl; template class ArmnnDriverImpl; #endif -} // namespace armnn_driver \ No newline at end of file +} // namespace armnn_driver -- cgit v1.2.1