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(Deserializer)
14 struct DivisionFixture : public ParserFlatbuffersSerializeFixture
16 explicit DivisionFixture(const std::string & inputShape1,
17 const std::string & inputShape2,
18 const std::string & outputShape,
19 const std::string & dataType)
27 layer_type: "InputLayer",
33 layerName: "InputLayer1",
37 connection: {sourceLayerIndex:0, outputSlotIndex:0 },
42 dimensions: )" + inputShape1 + R"(,
43 dataType: )" + dataType + R"(
49 layer_type: "InputLayer",
55 layerName: "InputLayer2",
59 connection: {sourceLayerIndex:0, outputSlotIndex:0 },
64 dimensions: )" + inputShape2 + R"(,
65 dataType: )" + dataType + R"(
71 layer_type: "DivisionLayer",
75 layerName: "DivisionLayer",
76 layerType: "Division",
80 connection: {sourceLayerIndex:0, outputSlotIndex:0 },
84 connection: {sourceLayerIndex:1, outputSlotIndex:0 },
90 dimensions: )" + outputShape + R"(,
91 dataType: )" + dataType + R"(
97 layer_type: "OutputLayer",
103 layerName: "OutputLayer",
107 connection: {sourceLayerIndex:2, outputSlotIndex:0 },
112 dimensions: )" + outputShape + R"(,
113 dataType: )" + dataType + R"(
125 struct SimpleDivisionFixture : DivisionFixture
127 SimpleDivisionFixture() : DivisionFixture("[ 2, 2 ]",
130 "QuantisedAsymm8") {}
133 struct SimpleDivisionFixture2 : DivisionFixture
135 SimpleDivisionFixture2() : DivisionFixture("[ 2, 2, 1, 1 ]",
141 BOOST_FIXTURE_TEST_CASE(DivisionQuantisedAsymm8, SimpleDivisionFixture)
143 RunTest<2, armnn::DataType::QAsymmU8>(
145 {{"InputLayer1", { 0, 5, 24, 21 }},
146 {"InputLayer2", { 4, 1, 6, 7 }}},
147 {{"OutputLayer", { 0, 5, 3, 3 }}});
150 BOOST_FIXTURE_TEST_CASE(DivisionFloat32, SimpleDivisionFixture2)
152 RunTest<4, armnn::DataType::Float32>(
154 {{"InputLayer1", { 100, 40, 226, 9 }},
155 {"InputLayer2", { 5, 8, 1, 3 }}},
156 {{"OutputLayer", { 20, 5, 226, 3 }}});
159 BOOST_AUTO_TEST_SUITE_END()