ArmNN
 21.02
TfLiteParser.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2020 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #include <boost/test/unit_test.hpp>
8 #include "../TfLiteParser.hpp"
9 
10 BOOST_AUTO_TEST_SUITE(TensorflowLiteParser)
11 
12 BOOST_AUTO_TEST_CASE(ParseEmptyBinaryData)
13 {
14  ITfLiteParser::TfLiteParserOptions options;
15  ITfLiteParserPtr m_Parser(ITfLiteParser::Create(armnn::Optional<ITfLiteParser::TfLiteParserOptions>(options)));
16  // Should throw armnn::ParseException: Buffer doesn't conform to the expected Tensorflow Lite flatbuffers format.
17  BOOST_CHECK_THROW(m_Parser->CreateNetworkFromBinary({0}), armnn::ParseException);
18 }
19 
20 struct NoInputBindingsFixture : public ParserFlatbuffersFixture
21 {
22  explicit NoInputBindingsFixture()
23  {
24  m_JsonString = R"(
25  {
26  "version": 3,
27  "operator_codes": [ { "builtin_code": "CONV_2D" } ],
28  "subgraphs": [ { } ]
29  }
30  )";
31  SetupSingleInputSingleOutput("inputTensor", "outputTensor");
32  }
33 };
34 
35 BOOST_FIXTURE_TEST_CASE( ParseBadInputBindings, NoInputBindingsFixture )
36 {
37  // Should throw armnn::ParseException: No input binding found for subgraph:0 and name:inputTensor.
38  BOOST_CHECK_THROW( (RunTest<4, armnn::DataType::QAsymmU8>(0, { }, { 0 })), armnn::ParseException);
39 }
40 
BOOST_AUTO_TEST_SUITE(TensorflowLiteParser)
BOOST_AUTO_TEST_CASE(ParseEmptyBinaryData)
std::unique_ptr< ITfLiteParser, void(*)(ITfLiteParser *parser)> ITfLiteParserPtr
BOOST_FIXTURE_TEST_CASE(ParseBadInputBindings, NoInputBindingsFixture)
BOOST_AUTO_TEST_SUITE_END()
void SetupSingleInputSingleOutput(const std::string &inputName, const std::string &outputName)