2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
6 #include <boost/test/unit_test.hpp>
7 #include "ParserFlatbuffersSerializeFixture.hpp"
8 #include <armnnDeserializer/IDeserializer.hpp>
12 BOOST_AUTO_TEST_SUITE(DeserializeParser)
14 struct ConstantAddFixture : public ParserFlatbuffersSerializeFixture
16 explicit ConstantAddFixture(const std::string & shape,
17 const std::string & constTensorDatatype,
18 const std::string & constData,
19 const std::string & dataType)
27 layer_type: "InputLayer",
33 layerName: "InputLayer1",
37 connection: {sourceLayerIndex:0, outputSlotIndex:0 },
42 dimensions: )" + shape + R"(,
43 dataType: )" + dataType + R"(
49 layer_type: "ConstantLayer",
53 layerName: "ConstantLayer",
54 layerType: "Constant",
58 dimensions: )" + shape + R"(,
59 dataType: )" + dataType + R"(,
64 connection: {sourceLayerIndex:0, outputSlotIndex:0 },
69 dimensions: )" + shape + R"(,
70 dataType: )" + dataType + R"(
72 data_type: )" + constTensorDatatype + R"(,
74 data: )" + constData + R"(,
79 layer_type: "AdditionLayer",
83 layerName: "AdditionLayer",
84 layerType: "Addition",
88 connection: {sourceLayerIndex:0, outputSlotIndex:0 },
92 connection: {sourceLayerIndex:1, outputSlotIndex:0 },
98 dimensions: )" + shape + R"(,
99 dataType: )" + dataType + R"(
105 layer_type: "OutputLayer",
111 layerName: "OutputLayer",
115 connection: {sourceLayerIndex:2, outputSlotIndex:0 },
120 dimensions: )" + shape + R"(,
121 dataType: )" + dataType + R"(
128 SetupSingleInputSingleOutput("InputLayer1", "OutputLayer");
132 struct SimpleConstantAddFixture : ConstantAddFixture
134 SimpleConstantAddFixture()
135 : ConstantAddFixture("[ 2, 3 ]", // shape
136 "ByteData", // constDataType
137 "[ 1, 2, 3, 4, 5, 6 ]", // constData
138 "QuantisedAsymm8") // datatype
143 BOOST_FIXTURE_TEST_CASE(SimpleConstantAddQuantisedAsymm8, SimpleConstantAddFixture)
145 RunTest<2, armnn::DataType::QAsymmU8>(
147 { 1, 2, 3, 4, 5, 6 },
148 { 2, 4, 6, 8, 10, 12 });
151 BOOST_AUTO_TEST_SUITE_END()