From 3537c2ca7ebf31c1673b9ec2bb0c17b0406bbae0 Mon Sep 17 00:00:00 2001 From: surmeh01 Date: Fri, 18 May 2018 16:31:43 +0100 Subject: Release 18.05 --- tests/TfInceptionV3-Armnn/TfInceptionV3-Armnn.cpp | 39 ++++++++++++++++------- 1 file changed, 28 insertions(+), 11 deletions(-) (limited to 'tests/TfInceptionV3-Armnn/TfInceptionV3-Armnn.cpp') diff --git a/tests/TfInceptionV3-Armnn/TfInceptionV3-Armnn.cpp b/tests/TfInceptionV3-Armnn/TfInceptionV3-Armnn.cpp index 94878ae4ce..441b07c9c9 100644 --- a/tests/TfInceptionV3-Armnn/TfInceptionV3-Armnn.cpp +++ b/tests/TfInceptionV3-Armnn/TfInceptionV3-Armnn.cpp @@ -8,16 +8,33 @@ int main(int argc, char* argv[]) { - std::vector imageSet = + int retVal = EXIT_FAILURE; + try { - { "Dog.jpg", 208 }, - { "Cat.jpg", 283 }, - { "shark.jpg", 3 }, - }; - armnn::TensorShape inputTensorShape({ 1, 299, 299, 3 }); - return armnn::test::ClassifierInferenceTestMain( - argc, argv, "inception_v3_2016_08_28_frozen_transformed.pb", true, - "input", "InceptionV3/Predictions/Reshape_1", { 0, 1, 2, }, - [&imageSet](const char* dataDir) { return MobileNetDatabase(dataDir, 299, 299, imageSet); }, - &inputTensorShape); + // Coverity fix: The following code may throw an exception of type std::length_error. + std::vector imageSet = + { + { "Dog.jpg", 208 }, + { "Cat.jpg", 283 }, + { "shark.jpg", 3 }, + }; + + armnn::TensorShape inputTensorShape({ 1, 299, 299, 3 }); + + // Coverity fix: InferenceTestMain() may throw uncaught exceptions. + retVal = armnn::test::ClassifierInferenceTestMain( + argc, argv, "inception_v3_2016_08_28_frozen_transformed.pb", true, + "input", "InceptionV3/Predictions/Reshape_1", { 0, 1, 2, }, + [&imageSet](const char* dataDir) { return MobileNetDatabase(dataDir, 299, 299, imageSet); }, + &inputTensorShape); + } + catch (const std::exception& e) + { + // Coverity fix: BOOST_LOG_TRIVIAL (typically used to report errors) may throw an + // exception of type std::length_error. + // Using stderr instead in this context as there is no point in nesting try-catch blocks here. + std::cerr << "WARNING: TfInceptionV3-Armnn: An error has occurred when running " + "the classifier inference tests: " << e.what() << std::endl; + } + return retVal; } -- cgit v1.2.1