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 "../Deserializer.hpp"
13 BOOST_AUTO_TEST_SUITE(Deserializer)
15 struct DivisionFixture : public ParserFlatbuffersSerializeFixture
17 explicit DivisionFixture(const std::string & inputShape1,
18 const std::string & inputShape2,
19 const std::string & outputShape,
20 const std::string & dataType)
28 layer_type: "InputLayer",
34 layerName: "InputLayer1",
38 connection: {sourceLayerIndex:0, outputSlotIndex:0 },
43 dimensions: )" + inputShape1 + R"(,
44 dataType: )" + dataType + R"(
50 layer_type: "InputLayer",
56 layerName: "InputLayer2",
60 connection: {sourceLayerIndex:0, outputSlotIndex:0 },
65 dimensions: )" + inputShape2 + R"(,
66 dataType: )" + dataType + R"(
72 layer_type: "DivisionLayer",
76 layerName: "DivisionLayer",
77 layerType: "Division",
81 connection: {sourceLayerIndex:0, outputSlotIndex:0 },
85 connection: {sourceLayerIndex:1, outputSlotIndex:0 },
91 dimensions: )" + outputShape + R"(,
92 dataType: )" + dataType + R"(
98 layer_type: "OutputLayer",
104 layerName: "OutputLayer",
108 connection: {sourceLayerIndex:2, outputSlotIndex:0 },
113 dimensions: )" + outputShape + R"(,
114 dataType: )" + dataType + R"(
126 struct SimpleDivisionFixture : DivisionFixture
128 SimpleDivisionFixture() : DivisionFixture("[ 2, 2 ]",
131 "QuantisedAsymm8") {}
134 struct SimpleDivisionFixture2 : DivisionFixture
136 SimpleDivisionFixture2() : DivisionFixture("[ 2, 2, 1, 1 ]",
142 BOOST_FIXTURE_TEST_CASE(DivisionQuantisedAsymm8, SimpleDivisionFixture)
144 RunTest<2, armnn::DataType::QAsymmU8>(
146 {{"InputLayer1", { 0, 5, 24, 21 }},
147 {"InputLayer2", { 4, 1, 6, 7 }}},
148 {{"OutputLayer", { 0, 5, 3, 3 }}});
151 BOOST_FIXTURE_TEST_CASE(DivisionFloat32, SimpleDivisionFixture2)
153 RunTest<4, armnn::DataType::Float32>(
155 {{"InputLayer1", { 100, 40, 226, 9 }},
156 {"InputLayer2", { 5, 8, 1, 3 }}},
157 {{"OutputLayer", { 20, 5, 226, 3 }}});
160 BOOST_AUTO_TEST_SUITE_END()