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 BatchNormalizationFixture : public ParserFlatbuffersSerializeFixture
17 explicit BatchNormalizationFixture(const std::string &inputShape,
18 const std::string &outputShape,
19 const std::string &meanShape,
20 const std::string &varianceShape,
21 const std::string &offsetShape,
22 const std::string &scaleShape,
23 const std::string &dataType,
24 const std::string &dataLayout)
32 layer_type: "InputLayer",
38 layerName: "InputLayer",
42 connection: {sourceLayerIndex:0, outputSlotIndex:0 },
47 dimensions: )" + inputShape + R"(,
48 dataType: ")" + dataType + R"(",
49 quantizationScale: 0.5,
58 layer_type: "BatchNormalizationLayer",
62 layerName: "BatchNormalizationLayer",
63 layerType: "BatchNormalization",
66 connection: {sourceLayerIndex:0, outputSlotIndex:0 },
71 dimensions: )" + outputShape + R"(,
72 dataType: ")" + dataType + R"("
78 dataLayout: ")" + dataLayout + R"("
82 dimensions: )" + meanShape + R"(,
83 dataType: ")" + dataType + R"("
92 dimensions: )" + varianceShape + R"(,
93 dataType: ")" + dataType + R"("
102 dimensions: )" + offsetShape + R"(,
103 dataType: ")" + dataType + R"("
112 dimensions: )" + scaleShape + R"(,
113 dataType: ")" + dataType + R"("
123 layer_type: "OutputLayer",
129 layerName: "OutputLayer",
133 connection: {sourceLayerIndex:1, outputSlotIndex:0 },
138 dimensions: )" + outputShape + R"(,
139 dataType: ")" + dataType + R"("
151 struct BatchNormFixture : BatchNormalizationFixture
153 BatchNormFixture():BatchNormalizationFixture("[ 1, 3, 3, 1 ]",
163 BOOST_FIXTURE_TEST_CASE(BatchNormalizationFloat32, BatchNormFixture)
165 RunTest<4, armnn::DataType::Float32>(0,
166 {{"InputLayer", { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f }}},
167 {{"OutputLayer",{ -2.8277204f, -2.12079024f, -1.4138602f,
168 -0.7069301f, 0.0f, 0.7069301f,
169 1.4138602f, 2.12079024f, 2.8277204f }}});
172 BOOST_AUTO_TEST_SUITE_END()