aboutsummaryrefslogtreecommitdiff
path: root/tests/TfInceptionV3-Armnn
diff options
context:
space:
mode:
authorsurmeh01 <surabhi.mehta@arm.com>2018-05-18 16:31:43 +0100
committertelsoa01 <telmo.soares@arm.com>2018-05-23 13:09:07 +0100
commit3537c2ca7ebf31c1673b9ec2bb0c17b0406bbae0 (patch)
tree5950603ad78ec3fe56fb31ddc7f4d52a19f5bc60 /tests/TfInceptionV3-Armnn
parentbceff2fb3fc68bb0aa88b886900c34b77340c826 (diff)
downloadarmnn-3537c2ca7ebf31c1673b9ec2bb0c17b0406bbae0.tar.gz
Release 18.05
Diffstat (limited to 'tests/TfInceptionV3-Armnn')
-rw-r--r--tests/TfInceptionV3-Armnn/TfInceptionV3-Armnn.cpp39
1 files changed, 28 insertions, 11 deletions
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> 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<MobileNetDatabase, armnnTfParser::ITfParser>(
- 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> 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<MobileNetDatabase, armnnTfParser::ITfParser>(
+ 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;
}