Laurent Carlier | 749294b | 2020-06-01 09:03:17 +0100 | [diff] [blame] | 1 | // |
surmeh01 | bceff2f | 2018-03-29 16:29:27 +0100 | [diff] [blame] | 2 | // Copyright © 2017 Arm Ltd. All rights reserved. |
David Beck | ecb56cd | 2018-09-05 12:52:57 +0100 | [diff] [blame] | 3 | // SPDX-License-Identifier: MIT |
surmeh01 | bceff2f | 2018-03-29 16:29:27 +0100 | [diff] [blame] | 4 | // |
| 5 | #include "../InferenceTest.hpp" |
| 6 | #include "../MnistDatabase.hpp" |
| 7 | #include "armnnTfParser/ITfParser.hpp" |
| 8 | |
| 9 | int main(int argc, char* argv[]) |
| 10 | { |
| 11 | armnn::TensorShape inputTensorShape({ 1, 784, 1, 1 }); |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 12 | |
| 13 | int retVal = EXIT_FAILURE; |
| 14 | try |
| 15 | { |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 16 | using DataType = float; |
| 17 | using DatabaseType = MnistDatabase; |
| 18 | using ParserType = armnnTfParser::ITfParser; |
| 19 | using ModelType = InferenceModel<ParserType, DataType>; |
| 20 | |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 21 | // Coverity fix: ClassifierInferenceTestMain() may throw uncaught exceptions. |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 22 | retVal = armnn::test::ClassifierInferenceTestMain<DatabaseType, ParserType>( |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 23 | argc, argv, "simple_mnist_tf.prototxt", false, |
| 24 | "Placeholder", "Softmax", { 0, 1, 2, 3, 4 }, |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 25 | [](const char* dataDir, const ModelType&) { |
| 26 | return DatabaseType(dataDir, true); |
| 27 | }, |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 28 | &inputTensorShape); |
| 29 | } |
| 30 | catch (const std::exception& e) |
| 31 | { |
| 32 | // Coverity fix: BOOST_LOG_TRIVIAL (typically used to report errors) may throw an |
| 33 | // exception of type std::length_error. |
| 34 | // Using stderr instead in this context as there is no point in nesting try-catch blocks here. |
| 35 | std::cerr << "WARNING: TfMnist-Armnn: An error has occurred when running " |
| 36 | "the classifier inference tests: " << e.what() << std::endl; |
| 37 | } |
| 38 | return retVal; |
surmeh01 | bceff2f | 2018-03-29 16:29:27 +0100 | [diff] [blame] | 39 | } |