blob: 088282a18aaa868e7a6787bb8554c8c5242a1c26 [file] [log] [blame]
Mike Kelly8c1701a2019-02-11 17:01:27 +00001//
Teresa Charlin52664732020-06-29 16:27:03 +01002// Copyright © 2017 Arm Ltd and Contributors. All rights reserved.
Mike Kelly8c1701a2019-02-11 17:01:27 +00003// SPDX-License-Identifier: MIT
4//
5
Mike Kelly8c1701a2019-02-11 17:01:27 +00006#include "../Serializer.hpp"
Aron Virginas-Tarfc413c02019-02-13 15:41:52 +00007
Matthew Benthamff130e22020-01-17 11:47:42 +00008#include <armnn/Descriptors.hpp>
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00009#include <armnn/INetwork.hpp>
Matthew Benthamff130e22020-01-17 11:47:42 +000010#include <armnn/TypesUtils.hpp>
11#include <armnn/LstmParams.hpp>
12#include <armnn/QuantizedLstmParams.hpp>
Derek Lamberti0028d1b2019-02-20 13:57:42 +000013#include <armnnDeserializer/IDeserializer.hpp>
Aron Virginas-Tarfc413c02019-02-13 15:41:52 +000014
Aron Virginas-Tarc04125f2019-02-19 16:31:08 +000015#include <random>
Aron Virginas-Tarfc413c02019-02-13 15:41:52 +000016#include <vector>
17
Mike Kelly8c1701a2019-02-11 17:01:27 +000018#include <boost/test/unit_test.hpp>
Aron Virginas-Tarfc413c02019-02-13 15:41:52 +000019
Derek Lamberti0028d1b2019-02-20 13:57:42 +000020using armnnDeserializer::IDeserializer;
Mike Kelly8c1701a2019-02-11 17:01:27 +000021
Saoirse Stewart3166c3e2019-02-18 15:24:53 +000022namespace
23{
24
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +010025#define DECLARE_LAYER_VERIFIER_CLASS(name) \
26class name##LayerVerifier : public LayerVerifierBase \
27{ \
28public: \
29 name##LayerVerifier(const std::string& layerName, \
30 const std::vector<armnn::TensorInfo>& inputInfos, \
31 const std::vector<armnn::TensorInfo>& outputInfos) \
32 : LayerVerifierBase(layerName, inputInfos, outputInfos) {} \
33\
34 void Visit##name##Layer(const armnn::IConnectableLayer* layer, const char* name) override \
35 { \
36 VerifyNameAndConnections(layer, name); \
37 } \
38};
39
40#define DECLARE_LAYER_VERIFIER_CLASS_WITH_DESCRIPTOR(name) \
41class name##LayerVerifier : public LayerVerifierBaseWithDescriptor<armnn::name##Descriptor> \
42{ \
43public: \
44 name##LayerVerifier(const std::string& layerName, \
45 const std::vector<armnn::TensorInfo>& inputInfos, \
46 const std::vector<armnn::TensorInfo>& outputInfos, \
47 const armnn::name##Descriptor& descriptor) \
48 : LayerVerifierBaseWithDescriptor<armnn::name##Descriptor>( \
49 layerName, inputInfos, outputInfos, descriptor) {} \
50\
51 void Visit##name##Layer(const armnn::IConnectableLayer* layer, \
52 const armnn::name##Descriptor& descriptor, \
53 const char* name) override \
54 { \
55 VerifyNameAndConnections(layer, name); \
56 VerifyDescriptor(descriptor); \
57 } \
58};
59
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +000060struct DefaultLayerVerifierPolicy
61{
Derek Lamberti859f9ce2019-12-10 22:05:21 +000062 static void Apply(const std::string)
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +000063 {
64 BOOST_TEST_MESSAGE("Unexpected layer found in network");
65 BOOST_TEST(false);
66 }
67};
68
69class LayerVerifierBase : public armnn::LayerVisitorBase<DefaultLayerVerifierPolicy>
70{
71public:
72 LayerVerifierBase(const std::string& layerName,
73 const std::vector<armnn::TensorInfo>& inputInfos,
74 const std::vector<armnn::TensorInfo>& outputInfos)
75 : m_LayerName(layerName)
76 , m_InputTensorInfos(inputInfos)
77 , m_OutputTensorInfos(outputInfos) {}
78
79 void VisitInputLayer(const armnn::IConnectableLayer*, armnn::LayerBindingId, const char*) override {}
80
Derek Lamberti859f9ce2019-12-10 22:05:21 +000081 void VisitOutputLayer(const armnn::IConnectableLayer*, armnn::LayerBindingId, const char*) override {}
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +000082
83protected:
84 void VerifyNameAndConnections(const armnn::IConnectableLayer* layer, const char* name)
85 {
86 BOOST_TEST(name == m_LayerName.c_str());
87
88 BOOST_TEST(layer->GetNumInputSlots() == m_InputTensorInfos.size());
89 BOOST_TEST(layer->GetNumOutputSlots() == m_OutputTensorInfos.size());
90
91 for (unsigned int i = 0; i < m_InputTensorInfos.size(); i++)
92 {
93 const armnn::IOutputSlot* connectedOutput = layer->GetInputSlot(i).GetConnection();
94 BOOST_CHECK(connectedOutput);
95
96 const armnn::TensorInfo& connectedInfo = connectedOutput->GetTensorInfo();
97 BOOST_TEST(connectedInfo.GetShape() == m_InputTensorInfos[i].GetShape());
98 BOOST_TEST(
99 GetDataTypeName(connectedInfo.GetDataType()) == GetDataTypeName(m_InputTensorInfos[i].GetDataType()));
Nattapat Chaimanowonge4294fd2019-03-28 09:56:53 +0000100
101 BOOST_TEST(connectedInfo.GetQuantizationScale() == m_InputTensorInfos[i].GetQuantizationScale());
102 BOOST_TEST(connectedInfo.GetQuantizationOffset() == m_InputTensorInfos[i].GetQuantizationOffset());
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000103 }
104
105 for (unsigned int i = 0; i < m_OutputTensorInfos.size(); i++)
106 {
107 const armnn::TensorInfo& outputInfo = layer->GetOutputSlot(i).GetTensorInfo();
108 BOOST_TEST(outputInfo.GetShape() == m_OutputTensorInfos[i].GetShape());
109 BOOST_TEST(
110 GetDataTypeName(outputInfo.GetDataType()) == GetDataTypeName(m_OutputTensorInfos[i].GetDataType()));
Nattapat Chaimanowonge4294fd2019-03-28 09:56:53 +0000111
112 BOOST_TEST(outputInfo.GetQuantizationScale() == m_OutputTensorInfos[i].GetQuantizationScale());
113 BOOST_TEST(outputInfo.GetQuantizationOffset() == m_OutputTensorInfos[i].GetQuantizationOffset());
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000114 }
115 }
116
Jan Eilers5b01a892019-07-23 09:47:43 +0100117 void VerifyConstTensors(const std::string& tensorName,
118 const armnn::ConstTensor* expectedPtr,
119 const armnn::ConstTensor* actualPtr)
120 {
121 if (expectedPtr == nullptr)
122 {
123 BOOST_CHECK_MESSAGE(actualPtr == nullptr, tensorName + " should not exist");
124 }
125 else
126 {
127 BOOST_CHECK_MESSAGE(actualPtr != nullptr, tensorName + " should have been set");
128 if (actualPtr != nullptr)
129 {
130 const armnn::TensorInfo& expectedInfo = expectedPtr->GetInfo();
131 const armnn::TensorInfo& actualInfo = actualPtr->GetInfo();
132
133 BOOST_CHECK_MESSAGE(expectedInfo.GetShape() == actualInfo.GetShape(),
134 tensorName + " shapes don't match");
135 BOOST_CHECK_MESSAGE(
136 GetDataTypeName(expectedInfo.GetDataType()) == GetDataTypeName(actualInfo.GetDataType()),
137 tensorName + " data types don't match");
138
139 BOOST_CHECK_MESSAGE(expectedPtr->GetNumBytes() == actualPtr->GetNumBytes(),
140 tensorName + " (GetNumBytes) data sizes do not match");
141 if (expectedPtr->GetNumBytes() == actualPtr->GetNumBytes())
142 {
143 //check the data is identical
144 const char* expectedData = static_cast<const char*>(expectedPtr->GetMemoryArea());
145 const char* actualData = static_cast<const char*>(actualPtr->GetMemoryArea());
146 bool same = true;
147 for (unsigned int i = 0; i < expectedPtr->GetNumBytes(); ++i)
148 {
149 same = expectedData[i] == actualData[i];
150 if (!same)
151 {
152 break;
153 }
154 }
155 BOOST_CHECK_MESSAGE(same, tensorName + " data does not match");
156 }
157 }
158 }
159 }
160
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000161private:
162 std::string m_LayerName;
163 std::vector<armnn::TensorInfo> m_InputTensorInfos;
164 std::vector<armnn::TensorInfo> m_OutputTensorInfos;
165};
166
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100167template<typename Descriptor>
168class LayerVerifierBaseWithDescriptor : public LayerVerifierBase
169{
170public:
171 LayerVerifierBaseWithDescriptor(const std::string& layerName,
172 const std::vector<armnn::TensorInfo>& inputInfos,
173 const std::vector<armnn::TensorInfo>& outputInfos,
174 const Descriptor& descriptor)
175 : LayerVerifierBase(layerName, inputInfos, outputInfos)
176 , m_Descriptor(descriptor) {}
177
178protected:
179 void VerifyDescriptor(const Descriptor& descriptor)
180 {
181 BOOST_CHECK(descriptor == m_Descriptor);
182 }
183
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100184 Descriptor m_Descriptor;
185};
186
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000187template<typename T>
188void CompareConstTensorData(const void* data1, const void* data2, unsigned int numElements)
189{
190 T typedData1 = static_cast<T>(data1);
191 T typedData2 = static_cast<T>(data2);
192 BOOST_CHECK(typedData1);
193 BOOST_CHECK(typedData2);
194
195 for (unsigned int i = 0; i < numElements; i++)
196 {
197 BOOST_TEST(typedData1[i] == typedData2[i]);
198 }
199}
200
201void CompareConstTensor(const armnn::ConstTensor& tensor1, const armnn::ConstTensor& tensor2)
202{
203 BOOST_TEST(tensor1.GetShape() == tensor2.GetShape());
204 BOOST_TEST(GetDataTypeName(tensor1.GetDataType()) == GetDataTypeName(tensor2.GetDataType()));
205
206 switch (tensor1.GetDataType())
207 {
208 case armnn::DataType::Float32:
209 CompareConstTensorData<const float*>(
210 tensor1.GetMemoryArea(), tensor2.GetMemoryArea(), tensor1.GetNumElements());
211 break;
Derek Lambertif90c56d2020-01-10 17:14:08 +0000212 case armnn::DataType::QAsymmU8:
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000213 case armnn::DataType::Boolean:
214 CompareConstTensorData<const uint8_t*>(
215 tensor1.GetMemoryArea(), tensor2.GetMemoryArea(), tensor1.GetNumElements());
216 break;
Sadik Armagan1a84fe32020-03-27 15:56:57 +0000217 case armnn::DataType::QSymmS8:
218 CompareConstTensorData<const int8_t*>(
219 tensor1.GetMemoryArea(), tensor2.GetMemoryArea(), tensor1.GetNumElements());
220 break;
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000221 case armnn::DataType::Signed32:
222 CompareConstTensorData<const int32_t*>(
223 tensor1.GetMemoryArea(), tensor2.GetMemoryArea(), tensor1.GetNumElements());
224 break;
225 default:
226 // Note that Float16 is not yet implemented
227 BOOST_TEST_MESSAGE("Unexpected datatype");
228 BOOST_TEST(false);
229 }
230}
231
Saoirse Stewart3166c3e2019-02-18 15:24:53 +0000232armnn::INetworkPtr DeserializeNetwork(const std::string& serializerString)
233{
234 std::vector<std::uint8_t> const serializerVector{serializerString.begin(), serializerString.end()};
Derek Lamberti0028d1b2019-02-20 13:57:42 +0000235 return IDeserializer::Create()->CreateNetworkFromBinary(serializerVector);
Saoirse Stewart3166c3e2019-02-18 15:24:53 +0000236}
237
238std::string SerializeNetwork(const armnn::INetwork& network)
239{
240 armnnSerializer::Serializer serializer;
241 serializer.Serialize(network);
242
243 std::stringstream stream;
244 serializer.SaveSerializedToStream(stream);
245
246 std::string serializerString{stream.str()};
247 return serializerString;
248}
249
Aron Virginas-Tarc04125f2019-02-19 16:31:08 +0000250template<typename DataType>
251static std::vector<DataType> GenerateRandomData(size_t size)
252{
253 constexpr bool isIntegerType = std::is_integral<DataType>::value;
254 using Distribution =
255 typename std::conditional<isIntegerType,
256 std::uniform_int_distribution<DataType>,
257 std::uniform_real_distribution<DataType>>::type;
258
259 static constexpr DataType lowerLimit = std::numeric_limits<DataType>::min();
260 static constexpr DataType upperLimit = std::numeric_limits<DataType>::max();
261
262 static Distribution distribution(lowerLimit, upperLimit);
263 static std::default_random_engine generator;
264
265 std::vector<DataType> randomData(size);
266 std::generate(randomData.begin(), randomData.end(), []() { return distribution(generator); });
267
268 return randomData;
269}
270
Saoirse Stewart3166c3e2019-02-18 15:24:53 +0000271} // anonymous namespace
272
273BOOST_AUTO_TEST_SUITE(SerializerTests)
Aron Virginas-Tarfc413c02019-02-13 15:41:52 +0000274
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000275BOOST_AUTO_TEST_CASE(SerializeAddition)
Mike Kelly8c1701a2019-02-11 17:01:27 +0000276{
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100277 DECLARE_LAYER_VERIFIER_CLASS(Addition)
Éanna Ó Catháin633f8592019-02-25 16:26:29 +0000278
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000279 const std::string layerName("addition");
280 const armnn::TensorInfo tensorInfo({1, 2, 3}, armnn::DataType::Float32);
281
Mike Kelly8c1701a2019-02-11 17:01:27 +0000282 armnn::INetworkPtr network = armnn::INetwork::Create();
283 armnn::IConnectableLayer* const inputLayer0 = network->AddInputLayer(0);
284 armnn::IConnectableLayer* const inputLayer1 = network->AddInputLayer(1);
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000285 armnn::IConnectableLayer* const additionLayer = network->AddAdditionLayer(layerName.c_str());
286 armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(0);
Mike Kelly8c1701a2019-02-11 17:01:27 +0000287
Éanna Ó Catháin633f8592019-02-25 16:26:29 +0000288 inputLayer0->GetOutputSlot(0).Connect(additionLayer->GetInputSlot(0));
289 inputLayer1->GetOutputSlot(0).Connect(additionLayer->GetInputSlot(1));
Éanna Ó Catháin633f8592019-02-25 16:26:29 +0000290 additionLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
Mike Kelly8c1701a2019-02-11 17:01:27 +0000291
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000292 inputLayer0->GetOutputSlot(0).SetTensorInfo(tensorInfo);
293 inputLayer1->GetOutputSlot(0).SetTensorInfo(tensorInfo);
294 additionLayer->GetOutputSlot(0).SetTensorInfo(tensorInfo);
Jim Flynn3091b062019-02-15 14:45:04 +0000295
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000296 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
Éanna Ó Catháin633f8592019-02-25 16:26:29 +0000297 BOOST_CHECK(deserializedNetwork);
298
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000299 AdditionLayerVerifier verifier(layerName, {tensorInfo, tensorInfo}, {tensorInfo});
300 deserializedNetwork->Accept(verifier);
301}
Jim Flynnac25a1b2019-02-28 10:40:49 +0000302
Narumol Prangnawarat0cfcf232019-09-09 17:16:24 +0100303BOOST_AUTO_TEST_CASE(SerializeArgMinMax)
304{
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100305 DECLARE_LAYER_VERIFIER_CLASS_WITH_DESCRIPTOR(ArgMinMax)
Narumol Prangnawarat0cfcf232019-09-09 17:16:24 +0100306
307 const std::string layerName("argminmax");
308 const armnn::TensorInfo inputInfo({1, 2, 3}, armnn::DataType::Float32);
309 const armnn::TensorInfo outputInfo({1, 3}, armnn::DataType::Signed32);
310
311 armnn::ArgMinMaxDescriptor descriptor;
312 descriptor.m_Function = armnn::ArgMinMaxFunction::Max;
313 descriptor.m_Axis = 1;
314
315 armnn::INetworkPtr network = armnn::INetwork::Create();
316 armnn::IConnectableLayer* const inputLayer = network->AddInputLayer(0);
317 armnn::IConnectableLayer* const argMinMaxLayer = network->AddArgMinMaxLayer(descriptor, layerName.c_str());
318 armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(0);
319
320 inputLayer->GetOutputSlot(0).Connect(argMinMaxLayer->GetInputSlot(0));
321 argMinMaxLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
322
323 inputLayer->GetOutputSlot(0).SetTensorInfo(inputInfo);
324 argMinMaxLayer->GetOutputSlot(0).SetTensorInfo(outputInfo);
325
326 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
327 BOOST_CHECK(deserializedNetwork);
328
329 ArgMinMaxLayerVerifier verifier(layerName, {inputInfo}, {outputInfo}, descriptor);
330 deserializedNetwork->Accept(verifier);
331}
332
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000333BOOST_AUTO_TEST_CASE(SerializeBatchNormalization)
334{
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100335 using Descriptor = armnn::BatchNormalizationDescriptor;
336 class BatchNormalizationLayerVerifier : public LayerVerifierBaseWithDescriptor<Descriptor>
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000337 {
338 public:
339 BatchNormalizationLayerVerifier(const std::string& layerName,
340 const std::vector<armnn::TensorInfo>& inputInfos,
341 const std::vector<armnn::TensorInfo>& outputInfos,
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100342 const Descriptor& descriptor,
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000343 const armnn::ConstTensor& mean,
344 const armnn::ConstTensor& variance,
345 const armnn::ConstTensor& beta,
346 const armnn::ConstTensor& gamma)
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100347 : LayerVerifierBaseWithDescriptor<Descriptor>(layerName, inputInfos, outputInfos, descriptor)
348 , m_Mean(mean)
349 , m_Variance(variance)
350 , m_Beta(beta)
351 , m_Gamma(gamma) {}
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000352
353 void VisitBatchNormalizationLayer(const armnn::IConnectableLayer* layer,
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100354 const Descriptor& descriptor,
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000355 const armnn::ConstTensor& mean,
356 const armnn::ConstTensor& variance,
357 const armnn::ConstTensor& beta,
358 const armnn::ConstTensor& gamma,
359 const char* name) override
360 {
361 VerifyNameAndConnections(layer, name);
362 VerifyDescriptor(descriptor);
363
364 CompareConstTensor(mean, m_Mean);
365 CompareConstTensor(variance, m_Variance);
366 CompareConstTensor(beta, m_Beta);
367 CompareConstTensor(gamma, m_Gamma);
368 }
369
370 private:
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000371 armnn::ConstTensor m_Mean;
372 armnn::ConstTensor m_Variance;
373 armnn::ConstTensor m_Beta;
374 armnn::ConstTensor m_Gamma;
375 };
376
377 const std::string layerName("batchNormalization");
378 const armnn::TensorInfo inputInfo ({ 1, 3, 3, 1 }, armnn::DataType::Float32);
379 const armnn::TensorInfo outputInfo({ 1, 3, 3, 1 }, armnn::DataType::Float32);
380
381 const armnn::TensorInfo meanInfo({1}, armnn::DataType::Float32);
382 const armnn::TensorInfo varianceInfo({1}, armnn::DataType::Float32);
383 const armnn::TensorInfo betaInfo({1}, armnn::DataType::Float32);
384 const armnn::TensorInfo gammaInfo({1}, armnn::DataType::Float32);
385
386 armnn::BatchNormalizationDescriptor descriptor;
387 descriptor.m_Eps = 0.0010000000475f;
388 descriptor.m_DataLayout = armnn::DataLayout::NHWC;
389
390 std::vector<float> meanData({5.0});
391 std::vector<float> varianceData({2.0});
392 std::vector<float> betaData({1.0});
393 std::vector<float> gammaData({0.0});
394
395 armnn::ConstTensor mean(meanInfo, meanData);
396 armnn::ConstTensor variance(varianceInfo, varianceData);
397 armnn::ConstTensor beta(betaInfo, betaData);
398 armnn::ConstTensor gamma(gammaInfo, gammaData);
399
400 armnn::INetworkPtr network = armnn::INetwork::Create();
401 armnn::IConnectableLayer* const inputLayer = network->AddInputLayer(0);
402 armnn::IConnectableLayer* const batchNormalizationLayer =
403 network->AddBatchNormalizationLayer(descriptor, mean, variance, beta, gamma, layerName.c_str());
404 armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(0);
405
406 inputLayer->GetOutputSlot(0).Connect(batchNormalizationLayer->GetInputSlot(0));
407 batchNormalizationLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
408
409 inputLayer->GetOutputSlot(0).SetTensorInfo(inputInfo);
410 batchNormalizationLayer->GetOutputSlot(0).SetTensorInfo(outputInfo);
411
412 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
413 BOOST_CHECK(deserializedNetwork);
414
415 BatchNormalizationLayerVerifier verifier(
416 layerName, {inputInfo}, {outputInfo}, descriptor, mean, variance, beta, gamma);
417 deserializedNetwork->Accept(verifier);
418}
419
420BOOST_AUTO_TEST_CASE(SerializeBatchToSpaceNd)
421{
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100422 DECLARE_LAYER_VERIFIER_CLASS_WITH_DESCRIPTOR(BatchToSpaceNd)
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000423
424 const std::string layerName("spaceToBatchNd");
425 const armnn::TensorInfo inputInfo({4, 1, 2, 2}, armnn::DataType::Float32);
426 const armnn::TensorInfo outputInfo({1, 1, 4, 4}, armnn::DataType::Float32);
427
428 armnn::BatchToSpaceNdDescriptor desc;
429 desc.m_DataLayout = armnn::DataLayout::NCHW;
430 desc.m_BlockShape = {2, 2};
431 desc.m_Crops = {{0, 0}, {0, 0}};
432
433 armnn::INetworkPtr network = armnn::INetwork::Create();
434 armnn::IConnectableLayer* const inputLayer = network->AddInputLayer(0);
435 armnn::IConnectableLayer* const batchToSpaceNdLayer = network->AddBatchToSpaceNdLayer(desc, layerName.c_str());
436 armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(0);
437
438 inputLayer->GetOutputSlot(0).Connect(batchToSpaceNdLayer->GetInputSlot(0));
439 batchToSpaceNdLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
440
441 inputLayer->GetOutputSlot(0).SetTensorInfo(inputInfo);
442 batchToSpaceNdLayer->GetOutputSlot(0).SetTensorInfo(outputInfo);
443
444 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
445 BOOST_CHECK(deserializedNetwork);
446
447 BatchToSpaceNdLayerVerifier verifier(layerName, {inputInfo}, {outputInfo}, desc);
448 deserializedNetwork->Accept(verifier);
Mike Kelly8c1701a2019-02-11 17:01:27 +0000449}
450
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100451BOOST_AUTO_TEST_CASE(SerializeComparison)
452{
453 DECLARE_LAYER_VERIFIER_CLASS_WITH_DESCRIPTOR(Comparison)
454
455 const std::string layerName("comparison");
456
457 const armnn::TensorShape shape{2, 1, 2, 4};
458
459 const armnn::TensorInfo inputInfo = armnn::TensorInfo(shape, armnn::DataType::Float32);
460 const armnn::TensorInfo outputInfo = armnn::TensorInfo(shape, armnn::DataType::Boolean);
461
462 armnn::ComparisonDescriptor descriptor(armnn::ComparisonOperation::NotEqual);
463
464 armnn::INetworkPtr network = armnn::INetwork::Create();
465 armnn::IConnectableLayer* const inputLayer0 = network->AddInputLayer(0);
466 armnn::IConnectableLayer* const inputLayer1 = network->AddInputLayer(1);
467 armnn::IConnectableLayer* const comparisonLayer = network->AddComparisonLayer(descriptor, layerName.c_str());
468 armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(0);
469
470 inputLayer0->GetOutputSlot(0).Connect(comparisonLayer->GetInputSlot(0));
471 inputLayer1->GetOutputSlot(0).Connect(comparisonLayer->GetInputSlot(1));
472 comparisonLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
473
474 inputLayer0->GetOutputSlot(0).SetTensorInfo(inputInfo);
475 inputLayer1->GetOutputSlot(0).SetTensorInfo(inputInfo);
476 comparisonLayer->GetOutputSlot(0).SetTensorInfo(outputInfo);
477
478 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
479 BOOST_CHECK(deserializedNetwork);
480
481 ComparisonLayerVerifier verifier(layerName, { inputInfo, inputInfo }, { outputInfo }, descriptor);
482 deserializedNetwork->Accept(verifier);
483}
484
Conor Kennedy76277882019-02-26 08:29:54 +0000485BOOST_AUTO_TEST_CASE(SerializeConstant)
486{
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000487 class ConstantLayerVerifier : public LayerVerifierBase
Conor Kennedy76277882019-02-26 08:29:54 +0000488 {
489 public:
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000490 ConstantLayerVerifier(const std::string& layerName,
491 const std::vector<armnn::TensorInfo>& inputInfos,
492 const std::vector<armnn::TensorInfo>& outputInfos,
493 const armnn::ConstTensor& layerInput)
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100494 : LayerVerifierBase(layerName, inputInfos, outputInfos)
495 , m_LayerInput(layerInput) {}
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000496
497 void VisitConstantLayer(const armnn::IConnectableLayer* layer,
498 const armnn::ConstTensor& input,
499 const char* name) override
Conor Kennedy76277882019-02-26 08:29:54 +0000500 {
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000501 VerifyNameAndConnections(layer, name);
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000502 CompareConstTensor(input, m_LayerInput);
Conor Kennedy76277882019-02-26 08:29:54 +0000503 }
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000504
Derek Lamberti859f9ce2019-12-10 22:05:21 +0000505 void VisitAdditionLayer(const armnn::IConnectableLayer*, const char*) override {}
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000506
507 private:
508 armnn::ConstTensor m_LayerInput;
Conor Kennedy76277882019-02-26 08:29:54 +0000509 };
510
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000511 const std::string layerName("constant");
512 const armnn::TensorInfo info({ 2, 3 }, armnn::DataType::Float32);
Conor Kennedy76277882019-02-26 08:29:54 +0000513
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000514 std::vector<float> constantData = GenerateRandomData<float>(info.GetNumElements());
515 armnn::ConstTensor constTensor(info, constantData);
Conor Kennedy76277882019-02-26 08:29:54 +0000516
Matteo Martincighf81edaa2019-03-04 14:34:30 +0000517 armnn::INetworkPtr network(armnn::INetwork::Create());
Matteo Martincighf81edaa2019-03-04 14:34:30 +0000518 armnn::IConnectableLayer* input = network->AddInputLayer(0);
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000519 armnn::IConnectableLayer* constant = network->AddConstantLayer(constTensor, layerName.c_str());
Matteo Martincighf81edaa2019-03-04 14:34:30 +0000520 armnn::IConnectableLayer* add = network->AddAdditionLayer();
521 armnn::IConnectableLayer* output = network->AddOutputLayer(0);
Conor Kennedy76277882019-02-26 08:29:54 +0000522
523 input->GetOutputSlot(0).Connect(add->GetInputSlot(0));
524 constant->GetOutputSlot(0).Connect(add->GetInputSlot(1));
525 add->GetOutputSlot(0).Connect(output->GetInputSlot(0));
526
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000527 input->GetOutputSlot(0).SetTensorInfo(info);
528 constant->GetOutputSlot(0).SetTensorInfo(info);
529 add->GetOutputSlot(0).SetTensorInfo(info);
Conor Kennedy76277882019-02-26 08:29:54 +0000530
Matteo Martincighf81edaa2019-03-04 14:34:30 +0000531 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
Conor Kennedy76277882019-02-26 08:29:54 +0000532 BOOST_CHECK(deserializedNetwork);
533
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000534 ConstantLayerVerifier verifier(layerName, {}, {info}, constTensor);
535 deserializedNetwork->Accept(verifier);
Conor Kennedy76277882019-02-26 08:29:54 +0000536}
537
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000538BOOST_AUTO_TEST_CASE(SerializeConvolution2d)
Finn Williamsdd2ba7e2019-03-01 11:51:52 +0000539{
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100540 using Descriptor = armnn::Convolution2dDescriptor;
541 class Convolution2dLayerVerifier : public LayerVerifierBaseWithDescriptor<Descriptor>
Finn Williamsdd2ba7e2019-03-01 11:51:52 +0000542 {
543 public:
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000544 Convolution2dLayerVerifier(const std::string& layerName,
545 const std::vector<armnn::TensorInfo>& inputInfos,
546 const std::vector<armnn::TensorInfo>& outputInfos,
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100547 const Descriptor& descriptor,
Aron Virginas-Tar5e1b0cf2019-06-21 14:20:11 +0100548 const armnn::ConstTensor& weights,
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100549 const armnn::Optional<armnn::ConstTensor>& biases)
550 : LayerVerifierBaseWithDescriptor<Descriptor>(layerName, inputInfos, outputInfos, descriptor)
551 , m_Weights(weights)
552 , m_Biases(biases) {}
Finn Williamsdd2ba7e2019-03-01 11:51:52 +0000553
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000554 void VisitConvolution2dLayer(const armnn::IConnectableLayer* layer,
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100555 const Descriptor& descriptor,
Aron Virginas-Tar5e1b0cf2019-06-21 14:20:11 +0100556 const armnn::ConstTensor& weights,
557 const armnn::Optional<armnn::ConstTensor>& biases,
Éanna Ó Catháin633f8592019-02-25 16:26:29 +0000558 const char* name) override
559 {
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000560 VerifyNameAndConnections(layer, name);
561 VerifyDescriptor(descriptor);
562
Aron Virginas-Tar5e1b0cf2019-06-21 14:20:11 +0100563 // check weights
564 CompareConstTensor(weights, m_Weights);
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000565
Aron Virginas-Tar5e1b0cf2019-06-21 14:20:11 +0100566 // check biases
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100567 BOOST_CHECK(biases.has_value() == descriptor.m_BiasEnabled);
Aron Virginas-Tar5e1b0cf2019-06-21 14:20:11 +0100568 BOOST_CHECK(biases.has_value() == m_Biases.has_value());
569
570 if (biases.has_value() && m_Biases.has_value())
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000571 {
Aron Virginas-Tar5e1b0cf2019-06-21 14:20:11 +0100572 CompareConstTensor(biases.value(), m_Biases.value());
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000573 }
Éanna Ó Catháin633f8592019-02-25 16:26:29 +0000574 }
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000575
576 private:
Aron Virginas-Tar5e1b0cf2019-06-21 14:20:11 +0100577 armnn::ConstTensor m_Weights;
578 armnn::Optional<armnn::ConstTensor> m_Biases;
Éanna Ó Catháin633f8592019-02-25 16:26:29 +0000579 };
580
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000581 const std::string layerName("convolution2d");
582 const armnn::TensorInfo inputInfo ({ 1, 5, 5, 1 }, armnn::DataType::Float32);
583 const armnn::TensorInfo outputInfo({ 1, 3, 3, 1 }, armnn::DataType::Float32);
Saoirse Stewart263829c2019-02-19 15:54:14 +0000584
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000585 const armnn::TensorInfo weightsInfo({ 1, 3, 3, 1 }, armnn::DataType::Float32);
586 const armnn::TensorInfo biasesInfo ({ 1 }, armnn::DataType::Float32);
Aron Virginas-Tarc04125f2019-02-19 16:31:08 +0000587
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000588 std::vector<float> weightsData = GenerateRandomData<float>(weightsInfo.GetNumElements());
589 armnn::ConstTensor weights(weightsInfo, weightsData);
590
591 std::vector<float> biasesData = GenerateRandomData<float>(biasesInfo.GetNumElements());
592 armnn::ConstTensor biases(biasesInfo, biasesData);
Aron Virginas-Tarc04125f2019-02-19 16:31:08 +0000593
594 armnn::Convolution2dDescriptor descriptor;
595 descriptor.m_PadLeft = 1;
596 descriptor.m_PadRight = 1;
597 descriptor.m_PadTop = 1;
598 descriptor.m_PadBottom = 1;
599 descriptor.m_StrideX = 2;
600 descriptor.m_StrideY = 2;
Aron Virginas-Tar5e1b0cf2019-06-21 14:20:11 +0100601 descriptor.m_DilationX = 2;
602 descriptor.m_DilationY = 2;
Aron Virginas-Tarc04125f2019-02-19 16:31:08 +0000603 descriptor.m_BiasEnabled = true;
604 descriptor.m_DataLayout = armnn::DataLayout::NHWC;
605
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000606 armnn::INetworkPtr network = armnn::INetwork::Create();
607 armnn::IConnectableLayer* const inputLayer = network->AddInputLayer(0);
Aron Virginas-Tarc04125f2019-02-19 16:31:08 +0000608 armnn::IConnectableLayer* const convLayer =
Matteo Martincighfc598e12019-05-14 10:36:13 +0100609 network->AddConvolution2dLayer(descriptor,
610 weights,
611 armnn::Optional<armnn::ConstTensor>(biases),
612 layerName.c_str());
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000613 armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(0);
Aron Virginas-Tarc04125f2019-02-19 16:31:08 +0000614
615 inputLayer->GetOutputSlot(0).Connect(convLayer->GetInputSlot(0));
Aron Virginas-Tarc04125f2019-02-19 16:31:08 +0000616 convLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000617
618 inputLayer->GetOutputSlot(0).SetTensorInfo(inputInfo);
Aron Virginas-Tarc04125f2019-02-19 16:31:08 +0000619 convLayer->GetOutputSlot(0).SetTensorInfo(outputInfo);
620
621 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
622 BOOST_CHECK(deserializedNetwork);
623
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000624 Convolution2dLayerVerifier verifier(layerName, {inputInfo}, {outputInfo}, descriptor, weights, biases);
625 deserializedNetwork->Accept(verifier);
Aron Virginas-Tarc04125f2019-02-19 16:31:08 +0000626}
627
Sadik Armagan1a84fe32020-03-27 15:56:57 +0000628BOOST_AUTO_TEST_CASE(SerializeConvolution2dWithPerAxisParams)
629{
630 using Descriptor = armnn::Convolution2dDescriptor;
631 class Convolution2dLayerVerifier : public LayerVerifierBaseWithDescriptor<Descriptor>
632 {
633 public:
634 Convolution2dLayerVerifier(const std::string& layerName,
635 const std::vector<armnn::TensorInfo>& inputInfos,
636 const std::vector<armnn::TensorInfo>& outputInfos,
637 const Descriptor& descriptor,
638 const armnn::ConstTensor& weights,
639 const armnn::Optional<armnn::ConstTensor>& biases)
640 : LayerVerifierBaseWithDescriptor<Descriptor>(layerName, inputInfos, outputInfos, descriptor)
641 , m_Weights(weights)
642 , m_Biases(biases) {}
643
644 void VisitConvolution2dLayer(const armnn::IConnectableLayer* layer,
645 const Descriptor& descriptor,
646 const armnn::ConstTensor& weights,
647 const armnn::Optional<armnn::ConstTensor>& biases,
648 const char* name) override
649 {
650 VerifyNameAndConnections(layer, name);
651 VerifyDescriptor(descriptor);
652
653 // check weights
654 CompareConstTensor(weights, m_Weights);
655
656 // check biases
657 BOOST_CHECK(biases.has_value() == descriptor.m_BiasEnabled);
658 BOOST_CHECK(biases.has_value() == m_Biases.has_value());
659
660 if (biases.has_value() && m_Biases.has_value())
661 {
662 CompareConstTensor(biases.value(), m_Biases.value());
663 }
664 }
665
666 private:
667 armnn::ConstTensor m_Weights;
668 armnn::Optional<armnn::ConstTensor> m_Biases;
669 };
670
671 using namespace armnn;
672
673 const std::string layerName("convolution2dWithPerAxis");
674 const TensorInfo inputInfo ({ 1, 3, 1, 2 }, DataType::QAsymmU8, 0.55f, 128);
675 const TensorInfo outputInfo({ 1, 3, 1, 3 }, DataType::QAsymmU8, 0.75f, 128);
676
677 const std::vector<float> quantScales{ 0.75f, 0.65f, 0.85f };
678 constexpr unsigned int quantDimension = 0;
679
680 const TensorInfo kernelInfo({ 3, 1, 1, 2 }, DataType::QSymmS8, quantScales, quantDimension);
681
682 const std::vector<float> biasQuantScales{ 0.25f, 0.50f, 0.75f };
683 const TensorInfo biasInfo({ 3 }, DataType::Signed32, biasQuantScales, quantDimension);
684
685 std::vector<int8_t> kernelData = GenerateRandomData<int8_t>(kernelInfo.GetNumElements());
686 armnn::ConstTensor weights(kernelInfo, kernelData);
687 std::vector<int32_t> biasData = GenerateRandomData<int32_t>(biasInfo.GetNumElements());
688 armnn::ConstTensor biases(biasInfo, biasData);
689
690 Convolution2dDescriptor descriptor;
691 descriptor.m_StrideX = 1;
692 descriptor.m_StrideY = 1;
693 descriptor.m_PadLeft = 0;
694 descriptor.m_PadRight = 0;
695 descriptor.m_PadTop = 0;
696 descriptor.m_PadBottom = 0;
697 descriptor.m_BiasEnabled = true;
698 descriptor.m_DataLayout = armnn::DataLayout::NHWC;
699
700 armnn::INetworkPtr network = armnn::INetwork::Create();
701 armnn::IConnectableLayer* const inputLayer = network->AddInputLayer(0);
702 armnn::IConnectableLayer* const convLayer =
703 network->AddConvolution2dLayer(descriptor,
704 weights,
705 armnn::Optional<armnn::ConstTensor>(biases),
706 layerName.c_str());
707 armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(0);
708
709 inputLayer->GetOutputSlot(0).Connect(convLayer->GetInputSlot(0));
710 convLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
711
712 inputLayer->GetOutputSlot(0).SetTensorInfo(inputInfo);
713 convLayer->GetOutputSlot(0).SetTensorInfo(outputInfo);
714
715 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
716 BOOST_CHECK(deserializedNetwork);
717
718 Convolution2dLayerVerifier verifier(layerName, {inputInfo}, {outputInfo}, descriptor, weights, biases);
719 deserializedNetwork->Accept(verifier);
720}
721
Aron Virginas-Tarda9d2d32019-09-20 10:42:02 +0100722BOOST_AUTO_TEST_CASE(SerializeDepthToSpace)
723{
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100724 DECLARE_LAYER_VERIFIER_CLASS_WITH_DESCRIPTOR(DepthToSpace)
Aron Virginas-Tarda9d2d32019-09-20 10:42:02 +0100725
726 const std::string layerName("depthToSpace");
727
728 const armnn::TensorInfo inputInfo ({ 1, 8, 4, 12 }, armnn::DataType::Float32);
729 const armnn::TensorInfo outputInfo({ 1, 16, 8, 3 }, armnn::DataType::Float32);
730
731 armnn::DepthToSpaceDescriptor desc;
732 desc.m_BlockSize = 2;
733 desc.m_DataLayout = armnn::DataLayout::NHWC;
734
735 armnn::INetworkPtr network = armnn::INetwork::Create();
736 armnn::IConnectableLayer* const inputLayer = network->AddInputLayer(0);
737 armnn::IConnectableLayer* const depthToSpaceLayer = network->AddDepthToSpaceLayer(desc, layerName.c_str());
738 armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(0);
739
740 inputLayer->GetOutputSlot(0).Connect(depthToSpaceLayer->GetInputSlot(0));
741 depthToSpaceLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
742
743 inputLayer->GetOutputSlot(0).SetTensorInfo(inputInfo);
744 depthToSpaceLayer->GetOutputSlot(0).SetTensorInfo(outputInfo);
745
746 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
747 BOOST_CHECK(deserializedNetwork);
748
749 DepthToSpaceLayerVerifier verifier(layerName, {inputInfo}, {outputInfo}, desc);
750 deserializedNetwork->Accept(verifier);
751}
752
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000753BOOST_AUTO_TEST_CASE(SerializeDepthwiseConvolution2d)
Conor Kennedy79ffdf52019-03-01 14:24:54 +0000754{
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100755 using Descriptor = armnn::DepthwiseConvolution2dDescriptor;
756 class DepthwiseConvolution2dLayerVerifier : public LayerVerifierBaseWithDescriptor<Descriptor>
Conor Kennedy79ffdf52019-03-01 14:24:54 +0000757 {
758 public:
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000759 DepthwiseConvolution2dLayerVerifier(const std::string& layerName,
760 const std::vector<armnn::TensorInfo>& inputInfos,
761 const std::vector<armnn::TensorInfo>& outputInfos,
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100762 const Descriptor& descriptor,
Aron Virginas-Tar5e1b0cf2019-06-21 14:20:11 +0100763 const armnn::ConstTensor& weights,
764 const armnn::Optional<armnn::ConstTensor>& biases) :
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100765 LayerVerifierBaseWithDescriptor<Descriptor>(layerName, inputInfos, outputInfos, descriptor),
Aron Virginas-Tar5e1b0cf2019-06-21 14:20:11 +0100766 m_Weights(weights),
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100767 m_Biases(biases) {}
Conor Kennedy79ffdf52019-03-01 14:24:54 +0000768
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000769 void VisitDepthwiseConvolution2dLayer(const armnn::IConnectableLayer* layer,
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100770 const Descriptor& descriptor,
Aron Virginas-Tar5e1b0cf2019-06-21 14:20:11 +0100771 const armnn::ConstTensor& weights,
772 const armnn::Optional<armnn::ConstTensor>& biases,
Éanna Ó Catháin633f8592019-02-25 16:26:29 +0000773 const char* name) override
774 {
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000775 VerifyNameAndConnections(layer, name);
776 VerifyDescriptor(descriptor);
777
Aron Virginas-Tar5e1b0cf2019-06-21 14:20:11 +0100778 // check weights
779 CompareConstTensor(weights, m_Weights);
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000780
Aron Virginas-Tar5e1b0cf2019-06-21 14:20:11 +0100781 // check biases
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100782 BOOST_CHECK(biases.has_value() == descriptor.m_BiasEnabled);
Aron Virginas-Tar5e1b0cf2019-06-21 14:20:11 +0100783 BOOST_CHECK(biases.has_value() == m_Biases.has_value());
784
785 if (biases.has_value() && m_Biases.has_value())
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000786 {
Aron Virginas-Tar5e1b0cf2019-06-21 14:20:11 +0100787 CompareConstTensor(biases.value(), m_Biases.value());
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000788 }
Éanna Ó Catháin633f8592019-02-25 16:26:29 +0000789 }
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000790
791 private:
Aron Virginas-Tar5e1b0cf2019-06-21 14:20:11 +0100792 armnn::ConstTensor m_Weights;
793 armnn::Optional<armnn::ConstTensor> m_Biases;
Éanna Ó Catháin633f8592019-02-25 16:26:29 +0000794 };
795
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000796 const std::string layerName("depwiseConvolution2d");
797 const armnn::TensorInfo inputInfo ({ 1, 5, 5, 3 }, armnn::DataType::Float32);
798 const armnn::TensorInfo outputInfo({ 1, 3, 3, 3 }, armnn::DataType::Float32);
Aron Virginas-Tarc04125f2019-02-19 16:31:08 +0000799
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000800 const armnn::TensorInfo weightsInfo({ 1, 3, 3, 3 }, armnn::DataType::Float32);
801 const armnn::TensorInfo biasesInfo ({ 3 }, armnn::DataType::Float32);
Aron Virginas-Tarc04125f2019-02-19 16:31:08 +0000802
803 std::vector<float> weightsData = GenerateRandomData<float>(weightsInfo.GetNumElements());
804 armnn::ConstTensor weights(weightsInfo, weightsData);
805
806 std::vector<int32_t> biasesData = GenerateRandomData<int32_t>(biasesInfo.GetNumElements());
807 armnn::ConstTensor biases(biasesInfo, biasesData);
808
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000809 armnn::DepthwiseConvolution2dDescriptor descriptor;
Aron Virginas-Tar5e1b0cf2019-06-21 14:20:11 +0100810 descriptor.m_PadLeft = 1;
811 descriptor.m_PadRight = 1;
812 descriptor.m_PadTop = 1;
813 descriptor.m_PadBottom = 1;
814 descriptor.m_StrideX = 2;
815 descriptor.m_StrideY = 2;
816 descriptor.m_DilationX = 2;
817 descriptor.m_DilationY = 2;
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000818 descriptor.m_BiasEnabled = true;
819 descriptor.m_DataLayout = armnn::DataLayout::NHWC;
820
Aron Virginas-Tarc04125f2019-02-19 16:31:08 +0000821 armnn::INetworkPtr network = armnn::INetwork::Create();
822 armnn::IConnectableLayer* const inputLayer = network->AddInputLayer(0);
823 armnn::IConnectableLayer* const depthwiseConvLayer =
Matteo Martincighfc598e12019-05-14 10:36:13 +0100824 network->AddDepthwiseConvolution2dLayer(descriptor,
825 weights,
826 armnn::Optional<armnn::ConstTensor>(biases),
827 layerName.c_str());
Aron Virginas-Tarc04125f2019-02-19 16:31:08 +0000828 armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(0);
829
830 inputLayer->GetOutputSlot(0).Connect(depthwiseConvLayer->GetInputSlot(0));
Aron Virginas-Tarc04125f2019-02-19 16:31:08 +0000831 depthwiseConvLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000832
833 inputLayer->GetOutputSlot(0).SetTensorInfo(inputInfo);
Aron Virginas-Tarc04125f2019-02-19 16:31:08 +0000834 depthwiseConvLayer->GetOutputSlot(0).SetTensorInfo(outputInfo);
835
836 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
837 BOOST_CHECK(deserializedNetwork);
838
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000839 DepthwiseConvolution2dLayerVerifier verifier(layerName, {inputInfo}, {outputInfo}, descriptor, weights, biases);
840 deserializedNetwork->Accept(verifier);
Jim Flynn18ce3382019-03-08 11:08:30 +0000841}
842
Sadik Armagan1a84fe32020-03-27 15:56:57 +0000843BOOST_AUTO_TEST_CASE(SerializeDepthwiseConvolution2dWithPerAxisParams)
844{
845 using Descriptor = armnn::DepthwiseConvolution2dDescriptor;
846 class DepthwiseConvolution2dLayerVerifier : public LayerVerifierBaseWithDescriptor<Descriptor>
847 {
848 public:
849 DepthwiseConvolution2dLayerVerifier(const std::string& layerName,
850 const std::vector<armnn::TensorInfo>& inputInfos,
851 const std::vector<armnn::TensorInfo>& outputInfos,
852 const Descriptor& descriptor,
853 const armnn::ConstTensor& weights,
854 const armnn::Optional<armnn::ConstTensor>& biases) :
855 LayerVerifierBaseWithDescriptor<Descriptor>(layerName, inputInfos, outputInfos, descriptor),
856 m_Weights(weights),
857 m_Biases(biases) {}
858
859 void VisitDepthwiseConvolution2dLayer(const armnn::IConnectableLayer* layer,
860 const Descriptor& descriptor,
861 const armnn::ConstTensor& weights,
862 const armnn::Optional<armnn::ConstTensor>& biases,
863 const char* name) override
864 {
865 VerifyNameAndConnections(layer, name);
866 VerifyDescriptor(descriptor);
867
868 // check weights
869 CompareConstTensor(weights, m_Weights);
870
871 // check biases
872 BOOST_CHECK(biases.has_value() == descriptor.m_BiasEnabled);
873 BOOST_CHECK(biases.has_value() == m_Biases.has_value());
874
875 if (biases.has_value() && m_Biases.has_value())
876 {
877 CompareConstTensor(biases.value(), m_Biases.value());
878 }
879 }
880
881 private:
882 armnn::ConstTensor m_Weights;
883 armnn::Optional<armnn::ConstTensor> m_Biases;
884 };
885
886 using namespace armnn;
887
888 const std::string layerName("depwiseConvolution2dWithPerAxis");
889 const TensorInfo inputInfo ({ 1, 3, 3, 2 }, DataType::QAsymmU8, 0.55f, 128);
890 const TensorInfo outputInfo({ 1, 2, 2, 4 }, DataType::QAsymmU8, 0.75f, 128);
891
892 const std::vector<float> quantScales{ 0.75f, 0.80f, 0.90f, 0.95f };
893 const unsigned int quantDimension = 0;
894 TensorInfo kernelInfo({ 2, 2, 2, 2 }, DataType::QSymmS8, quantScales, quantDimension);
895
896 const std::vector<float> biasQuantScales{ 0.25f, 0.35f, 0.45f, 0.55f };
897 constexpr unsigned int biasQuantDimension = 0;
898 TensorInfo biasInfo({ 4 }, DataType::Signed32, biasQuantScales, biasQuantDimension);
899
900 std::vector<int8_t> kernelData = GenerateRandomData<int8_t>(kernelInfo.GetNumElements());
901 armnn::ConstTensor weights(kernelInfo, kernelData);
902 std::vector<int32_t> biasData = GenerateRandomData<int32_t>(biasInfo.GetNumElements());
903 armnn::ConstTensor biases(biasInfo, biasData);
904
905 DepthwiseConvolution2dDescriptor descriptor;
906 descriptor.m_StrideX = 1;
907 descriptor.m_StrideY = 1;
908 descriptor.m_PadLeft = 0;
909 descriptor.m_PadRight = 0;
910 descriptor.m_PadTop = 0;
911 descriptor.m_PadBottom = 0;
912 descriptor.m_DilationX = 1;
913 descriptor.m_DilationY = 1;
914 descriptor.m_BiasEnabled = true;
915 descriptor.m_DataLayout = armnn::DataLayout::NHWC;
916
917 armnn::INetworkPtr network = armnn::INetwork::Create();
918 armnn::IConnectableLayer* const inputLayer = network->AddInputLayer(0);
919 armnn::IConnectableLayer* const depthwiseConvLayer =
920 network->AddDepthwiseConvolution2dLayer(descriptor,
921 weights,
922 armnn::Optional<armnn::ConstTensor>(biases),
923 layerName.c_str());
924 armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(0);
925
926 inputLayer->GetOutputSlot(0).Connect(depthwiseConvLayer->GetInputSlot(0));
927 depthwiseConvLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
928
929 inputLayer->GetOutputSlot(0).SetTensorInfo(inputInfo);
930 depthwiseConvLayer->GetOutputSlot(0).SetTensorInfo(outputInfo);
931
932 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
933 BOOST_CHECK(deserializedNetwork);
934
935 DepthwiseConvolution2dLayerVerifier verifier(layerName, {inputInfo}, {outputInfo}, descriptor, weights, biases);
936 deserializedNetwork->Accept(verifier);
937}
938
Nattapat Chaimanowonge4294fd2019-03-28 09:56:53 +0000939BOOST_AUTO_TEST_CASE(SerializeDequantize)
940{
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100941 DECLARE_LAYER_VERIFIER_CLASS(Dequantize)
Nattapat Chaimanowonge4294fd2019-03-28 09:56:53 +0000942
943 const std::string layerName("dequantize");
Derek Lambertif90c56d2020-01-10 17:14:08 +0000944 const armnn::TensorInfo inputInfo({ 1, 5, 2, 3 }, armnn::DataType::QAsymmU8, 0.5f, 1);
Nattapat Chaimanowonge4294fd2019-03-28 09:56:53 +0000945 const armnn::TensorInfo outputInfo({ 1, 5, 2, 3 }, armnn::DataType::Float32);
946
947 armnn::INetworkPtr network = armnn::INetwork::Create();
948 armnn::IConnectableLayer* const inputLayer = network->AddInputLayer(0);
949 armnn::IConnectableLayer* const dequantizeLayer = network->AddDequantizeLayer(layerName.c_str());
950 armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(0);
951
952 inputLayer->GetOutputSlot(0).Connect(dequantizeLayer->GetInputSlot(0));
953 dequantizeLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
954
955 inputLayer->GetOutputSlot(0).SetTensorInfo(inputInfo);
956 dequantizeLayer->GetOutputSlot(0).SetTensorInfo(outputInfo);
957
958 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
959 BOOST_CHECK(deserializedNetwork);
960
961 DequantizeLayerVerifier verifier(layerName, {inputInfo}, {outputInfo});
962 deserializedNetwork->Accept(verifier);
963}
964
Nattapat Chaimanowong3e14a9d2019-03-18 12:37:06 +0000965BOOST_AUTO_TEST_CASE(SerializeDeserializeDetectionPostProcess)
966{
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100967 using Descriptor = armnn::DetectionPostProcessDescriptor;
968 class DetectionPostProcessLayerVerifier : public LayerVerifierBaseWithDescriptor<Descriptor>
Nattapat Chaimanowong3e14a9d2019-03-18 12:37:06 +0000969 {
970 public:
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000971 DetectionPostProcessLayerVerifier(const std::string& layerName,
972 const std::vector<armnn::TensorInfo>& inputInfos,
973 const std::vector<armnn::TensorInfo>& outputInfos,
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100974 const Descriptor& descriptor,
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000975 const armnn::ConstTensor& anchors)
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100976 : LayerVerifierBaseWithDescriptor<Descriptor>(layerName, inputInfos, outputInfos, descriptor)
977 , m_Anchors(anchors) {}
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000978
Nattapat Chaimanowong3e14a9d2019-03-18 12:37:06 +0000979 void VisitDetectionPostProcessLayer(const armnn::IConnectableLayer* layer,
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100980 const Descriptor& descriptor,
Nattapat Chaimanowong3e14a9d2019-03-18 12:37:06 +0000981 const armnn::ConstTensor& anchors,
982 const char* name) override
983 {
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000984 VerifyNameAndConnections(layer, name);
985 VerifyDescriptor(descriptor);
986
987 CompareConstTensor(anchors, m_Anchors);
Nattapat Chaimanowong3e14a9d2019-03-18 12:37:06 +0000988 }
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000989
990 private:
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000991 armnn::ConstTensor m_Anchors;
Nattapat Chaimanowong3e14a9d2019-03-18 12:37:06 +0000992 };
993
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000994 const std::string layerName("detectionPostProcess");
995
996 const std::vector<armnn::TensorInfo> inputInfos({
Nattapat Chaimanowong3e14a9d2019-03-18 12:37:06 +0000997 armnn::TensorInfo({ 1, 6, 4 }, armnn::DataType::Float32),
998 armnn::TensorInfo({ 1, 6, 3}, armnn::DataType::Float32)
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +0000999 });
Nattapat Chaimanowong3e14a9d2019-03-18 12:37:06 +00001000
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00001001 const std::vector<armnn::TensorInfo> outputInfos({
Nattapat Chaimanowong3e14a9d2019-03-18 12:37:06 +00001002 armnn::TensorInfo({ 1, 3, 4 }, armnn::DataType::Float32),
1003 armnn::TensorInfo({ 1, 3 }, armnn::DataType::Float32),
1004 armnn::TensorInfo({ 1, 3 }, armnn::DataType::Float32),
1005 armnn::TensorInfo({ 1 }, armnn::DataType::Float32)
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00001006 });
Nattapat Chaimanowong3e14a9d2019-03-18 12:37:06 +00001007
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00001008 armnn::DetectionPostProcessDescriptor descriptor;
1009 descriptor.m_UseRegularNms = true;
1010 descriptor.m_MaxDetections = 3;
1011 descriptor.m_MaxClassesPerDetection = 1;
1012 descriptor.m_DetectionsPerClass =1;
1013 descriptor.m_NmsScoreThreshold = 0.0;
1014 descriptor.m_NmsIouThreshold = 0.5;
1015 descriptor.m_NumClasses = 2;
1016 descriptor.m_ScaleY = 10.0;
1017 descriptor.m_ScaleX = 10.0;
1018 descriptor.m_ScaleH = 5.0;
1019 descriptor.m_ScaleW = 5.0;
Nattapat Chaimanowong3e14a9d2019-03-18 12:37:06 +00001020
1021 const armnn::TensorInfo anchorsInfo({ 6, 4 }, armnn::DataType::Float32);
1022 const std::vector<float> anchorsData({
1023 0.5f, 0.5f, 1.0f, 1.0f,
1024 0.5f, 0.5f, 1.0f, 1.0f,
1025 0.5f, 0.5f, 1.0f, 1.0f,
1026 0.5f, 10.5f, 1.0f, 1.0f,
1027 0.5f, 10.5f, 1.0f, 1.0f,
1028 0.5f, 100.5f, 1.0f, 1.0f
1029 });
1030 armnn::ConstTensor anchors(anchorsInfo, anchorsData);
1031
1032 armnn::INetworkPtr network = armnn::INetwork::Create();
Nattapat Chaimanowong3e14a9d2019-03-18 12:37:06 +00001033 armnn::IConnectableLayer* const detectionLayer =
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00001034 network->AddDetectionPostProcessLayer(descriptor, anchors, layerName.c_str());
Nattapat Chaimanowong3e14a9d2019-03-18 12:37:06 +00001035
1036 for (unsigned int i = 0; i < 2; i++)
1037 {
1038 armnn::IConnectableLayer* const inputLayer = network->AddInputLayer(static_cast<int>(i));
1039 inputLayer->GetOutputSlot(0).Connect(detectionLayer->GetInputSlot(i));
1040 inputLayer->GetOutputSlot(0).SetTensorInfo(inputInfos[i]);
1041 }
1042
1043 for (unsigned int i = 0; i < 4; i++)
1044 {
1045 armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(static_cast<int>(i));
1046 detectionLayer->GetOutputSlot(i).Connect(outputLayer->GetInputSlot(0));
1047 detectionLayer->GetOutputSlot(i).SetTensorInfo(outputInfos[i]);
1048 }
1049
1050 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
1051 BOOST_CHECK(deserializedNetwork);
1052
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00001053 DetectionPostProcessLayerVerifier verifier(layerName, inputInfos, outputInfos, descriptor, anchors);
1054 deserializedNetwork->Accept(verifier);
1055}
Nattapat Chaimanowong3e14a9d2019-03-18 12:37:06 +00001056
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00001057BOOST_AUTO_TEST_CASE(SerializeDivision)
1058{
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +01001059 DECLARE_LAYER_VERIFIER_CLASS(Division)
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00001060
1061 const std::string layerName("division");
1062 const armnn::TensorInfo info({ 1, 5, 2, 3 }, armnn::DataType::Float32);
1063
1064 armnn::INetworkPtr network = armnn::INetwork::Create();
1065 armnn::IConnectableLayer* const inputLayer0 = network->AddInputLayer(0);
1066 armnn::IConnectableLayer* const inputLayer1 = network->AddInputLayer(1);
1067 armnn::IConnectableLayer* const divisionLayer = network->AddDivisionLayer(layerName.c_str());
1068 armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(0);
1069
1070 inputLayer0->GetOutputSlot(0).Connect(divisionLayer->GetInputSlot(0));
1071 inputLayer1->GetOutputSlot(0).Connect(divisionLayer->GetInputSlot(1));
1072 divisionLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
1073
1074 inputLayer0->GetOutputSlot(0).SetTensorInfo(info);
1075 inputLayer1->GetOutputSlot(0).SetTensorInfo(info);
1076 divisionLayer->GetOutputSlot(0).SetTensorInfo(info);
1077
1078 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
1079 BOOST_CHECK(deserializedNetwork);
1080
1081 DivisionLayerVerifier verifier(layerName, {info, info}, {info});
1082 deserializedNetwork->Accept(verifier);
1083}
1084
Aron Virginas-Tar6d2e6592019-10-22 11:44:47 +01001085class EqualLayerVerifier : public LayerVerifierBase
1086{
1087public:
1088 EqualLayerVerifier(const std::string& layerName,
1089 const std::vector<armnn::TensorInfo>& inputInfos,
1090 const std::vector<armnn::TensorInfo>& outputInfos)
1091 : LayerVerifierBase(layerName, inputInfos, outputInfos) {}
1092
1093 void VisitComparisonLayer(const armnn::IConnectableLayer* layer,
1094 const armnn::ComparisonDescriptor& descriptor,
1095 const char* name) override
1096 {
1097 VerifyNameAndConnections(layer, name);
1098 BOOST_CHECK(descriptor.m_Operation == armnn::ComparisonOperation::Equal);
1099 }
1100
Derek Lamberti859f9ce2019-12-10 22:05:21 +00001101 void VisitEqualLayer(const armnn::IConnectableLayer*, const char*) override
Aron Virginas-Tar6d2e6592019-10-22 11:44:47 +01001102 {
1103 throw armnn::Exception("EqualLayer should have translated to ComparisonLayer");
1104 }
1105};
1106
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +01001107// NOTE: Until the deprecated AddEqualLayer disappears this test checks that calling
1108// AddEqualLayer places a ComparisonLayer into the serialized format and that
1109// when this deserialises we have a ComparisonLayer
1110BOOST_AUTO_TEST_CASE(SerializeEqual)
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00001111{
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +01001112 const std::string layerName("equal");
1113
1114 const armnn::TensorShape shape{2, 1, 2, 4};
1115
1116 const armnn::TensorInfo inputInfo = armnn::TensorInfo(shape, armnn::DataType::Float32);
1117 const armnn::TensorInfo outputInfo = armnn::TensorInfo(shape, armnn::DataType::Boolean);
1118
1119 armnn::INetworkPtr network = armnn::INetwork::Create();
1120 armnn::IConnectableLayer* const inputLayer0 = network->AddInputLayer(0);
1121 armnn::IConnectableLayer* const inputLayer1 = network->AddInputLayer(1);
1122 ARMNN_NO_DEPRECATE_WARN_BEGIN
1123 armnn::IConnectableLayer* const equalLayer = network->AddEqualLayer(layerName.c_str());
1124 ARMNN_NO_DEPRECATE_WARN_END
1125 armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(0);
1126
1127 inputLayer0->GetOutputSlot(0).Connect(equalLayer->GetInputSlot(0));
1128 inputLayer1->GetOutputSlot(0).Connect(equalLayer->GetInputSlot(1));
1129 equalLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
1130
1131 inputLayer0->GetOutputSlot(0).SetTensorInfo(inputInfo);
1132 inputLayer1->GetOutputSlot(0).SetTensorInfo(inputInfo);
1133 equalLayer->GetOutputSlot(0).SetTensorInfo(outputInfo);
1134
1135 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
1136 BOOST_CHECK(deserializedNetwork);
1137
1138 EqualLayerVerifier verifier(layerName, { inputInfo, inputInfo }, { outputInfo });
1139 deserializedNetwork->Accept(verifier);
1140}
1141
Aron Virginas-Tar6d2e6592019-10-22 11:44:47 +01001142BOOST_AUTO_TEST_CASE(EnsureEqualBackwardCompatibility)
1143{
1144 // The hex data below is a flat buffer containing a simple network with two inputs,
1145 // an EqualLayer (now deprecated) and an output
1146 //
1147 // This test verifies that we can still deserialize this old-style model by replacing
1148 // the EqualLayer with an equivalent ComparisonLayer
1149 const std::vector<uint8_t> equalModel =
1150 {
1151 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x0A, 0x00,
1152 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
1153 0xCC, 0x01, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x02, 0x00,
1154 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
1155 0x60, 0xFE, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x0B, 0x04, 0x00, 0x00, 0x00, 0xFE, 0xFE, 0xFF, 0xFF, 0x04, 0x00,
1156 0x00, 0x00, 0x06, 0xFF, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x00, 0xEA, 0xFE, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00,
1157 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00,
1158 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1159 0x64, 0xFF, 0xFF, 0xFF, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB4, 0xFE, 0xFF, 0xFF, 0x00, 0x00,
1160 0x00, 0x13, 0x04, 0x00, 0x00, 0x00, 0x52, 0xFF, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x00, 0x36, 0xFF, 0xFF, 0xFF,
1161 0x02, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x1C, 0x00,
1162 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x65, 0x71, 0x75, 0x61, 0x6C, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
1163 0x5C, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x34, 0xFF,
1164 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x00, 0x92, 0xFE, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x04, 0x08, 0x00, 0x00, 0x00,
1165 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00,
1166 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x10, 0x00, 0x04, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00,
1167 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x00, 0x00,
1168 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0E, 0x00,
1169 0x07, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00,
1170 0x06, 0x00, 0x08, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0E, 0x00,
1171 0x04, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
1172 0x0E, 0x00, 0x18, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x10, 0x00, 0x14, 0x00, 0x0E, 0x00, 0x00, 0x00,
1173 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00,
1174 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
1175 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00,
1176 0x00, 0x00, 0x66, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1177 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00,
1178 0x00, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x07, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09,
1179 0x04, 0x00, 0x00, 0x00, 0xF6, 0xFF, 0xFF, 0xFF, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x0A, 0x00,
1180 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x14, 0x00, 0x00, 0x00,
1181 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x10, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00,
1182 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1183 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0A, 0x00, 0x00, 0x00,
1184 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x08, 0x00,
1185 0x07, 0x00, 0x0C, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
1186 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
1187 0x04, 0x00, 0x00, 0x00
1188 };
1189
1190 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(std::string(equalModel.begin(), equalModel.end()));
1191 BOOST_CHECK(deserializedNetwork);
1192
1193 const armnn::TensorShape shape{ 2, 1, 2, 4 };
1194
1195 const armnn::TensorInfo inputInfo = armnn::TensorInfo(shape, armnn::DataType::Float32);
1196 const armnn::TensorInfo outputInfo = armnn::TensorInfo(shape, armnn::DataType::Boolean);
1197
1198 EqualLayerVerifier verifier("equal", { inputInfo, inputInfo }, { outputInfo });
1199 deserializedNetwork->Accept(verifier);
1200}
1201
Keith Davis300ad562020-06-04 16:34:23 +01001202BOOST_AUTO_TEST_CASE(SerializeFill)
1203{
1204 DECLARE_LAYER_VERIFIER_CLASS_WITH_DESCRIPTOR(Fill)
1205
1206 const std::string layerName("fill");
1207 const armnn::TensorInfo inputInfo({4}, armnn::DataType::Float32);
1208 const armnn::TensorInfo outputInfo({1, 3, 3, 1}, armnn::DataType::Float32);
1209
1210 armnn::FillDescriptor descriptor(1.0f);
1211
1212 armnn::INetworkPtr network = armnn::INetwork::Create();
1213 armnn::IConnectableLayer* const inputLayer = network->AddInputLayer(0);
1214 armnn::IConnectableLayer* const fillLayer = network->AddFillLayer(descriptor, layerName.c_str());
1215 armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(0);
1216
1217 inputLayer->GetOutputSlot(0).Connect(fillLayer->GetInputSlot(0));
1218 fillLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
1219
1220 inputLayer->GetOutputSlot(0).SetTensorInfo(inputInfo);
1221 fillLayer->GetOutputSlot(0).SetTensorInfo(outputInfo);
1222
1223 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
1224 BOOST_CHECK(deserializedNetwork);
1225
1226 FillLayerVerifier verifier(layerName, {inputInfo}, {outputInfo}, descriptor);
1227
1228 deserializedNetwork->Accept(verifier);
1229}
1230
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +01001231BOOST_AUTO_TEST_CASE(SerializeFloor)
1232{
1233 DECLARE_LAYER_VERIFIER_CLASS(Floor)
1234
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00001235 const std::string layerName("floor");
1236 const armnn::TensorInfo info({4,4}, armnn::DataType::Float32);
1237
1238 armnn::INetworkPtr network = armnn::INetwork::Create();
1239 armnn::IConnectableLayer* const inputLayer = network->AddInputLayer(0);
1240 armnn::IConnectableLayer* const floorLayer = network->AddFloorLayer(layerName.c_str());
1241 armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(0);
1242
1243 inputLayer->GetOutputSlot(0).Connect(floorLayer->GetInputSlot(0));
1244 floorLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
1245
1246 inputLayer->GetOutputSlot(0).SetTensorInfo(info);
1247 floorLayer->GetOutputSlot(0).SetTensorInfo(info);
1248
1249 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
1250 BOOST_CHECK(deserializedNetwork);
1251
1252 FloorLayerVerifier verifier(layerName, {info}, {info});
1253 deserializedNetwork->Accept(verifier);
1254}
1255
1256BOOST_AUTO_TEST_CASE(SerializeFullyConnected)
1257{
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +01001258 using Descriptor = armnn::FullyConnectedDescriptor;
1259 class FullyConnectedLayerVerifier : public LayerVerifierBaseWithDescriptor<Descriptor>
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00001260 {
1261 public:
1262 FullyConnectedLayerVerifier(const std::string& layerName,
1263 const std::vector<armnn::TensorInfo>& inputInfos,
1264 const std::vector<armnn::TensorInfo>& outputInfos,
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +01001265 const Descriptor& descriptor,
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00001266 const armnn::ConstTensor& weight,
1267 const armnn::Optional<armnn::ConstTensor>& bias)
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +01001268 : LayerVerifierBaseWithDescriptor<Descriptor>(layerName, inputInfos, outputInfos, descriptor)
1269 , m_Weight(weight)
1270 , m_Bias(bias) {}
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00001271
1272 void VisitFullyConnectedLayer(const armnn::IConnectableLayer* layer,
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +01001273 const Descriptor& descriptor,
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00001274 const armnn::ConstTensor& weight,
1275 const armnn::Optional<armnn::ConstTensor>& bias,
1276 const char* name) override
1277 {
1278 VerifyNameAndConnections(layer, name);
1279 VerifyDescriptor(descriptor);
1280
1281 CompareConstTensor(weight, m_Weight);
1282
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +01001283 BOOST_TEST(bias.has_value() == descriptor.m_BiasEnabled);
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00001284 BOOST_TEST(bias.has_value() == m_Bias.has_value());
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +01001285
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00001286 if (bias.has_value() && m_Bias.has_value())
1287 {
1288 CompareConstTensor(bias.value(), m_Bias.value());
1289 }
1290 }
1291
1292 private:
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00001293 armnn::ConstTensor m_Weight;
1294 armnn::Optional<armnn::ConstTensor> m_Bias;
1295 };
1296
1297 const std::string layerName("fullyConnected");
1298 const armnn::TensorInfo inputInfo ({ 2, 5, 1, 1 }, armnn::DataType::Float32);
1299 const armnn::TensorInfo outputInfo({ 2, 3 }, armnn::DataType::Float32);
1300
1301 const armnn::TensorInfo weightsInfo({ 5, 3 }, armnn::DataType::Float32);
1302 const armnn::TensorInfo biasesInfo ({ 3 }, armnn::DataType::Float32);
1303 std::vector<float> weightsData = GenerateRandomData<float>(weightsInfo.GetNumElements());
1304 std::vector<float> biasesData = GenerateRandomData<float>(biasesInfo.GetNumElements());
1305 armnn::ConstTensor weights(weightsInfo, weightsData);
1306 armnn::ConstTensor biases(biasesInfo, biasesData);
1307
1308 armnn::FullyConnectedDescriptor descriptor;
1309 descriptor.m_BiasEnabled = true;
1310 descriptor.m_TransposeWeightMatrix = false;
1311
1312 armnn::INetworkPtr network = armnn::INetwork::Create();
1313 armnn::IConnectableLayer* const inputLayer = network->AddInputLayer(0);
1314 armnn::IConnectableLayer* const fullyConnectedLayer =
Matteo Martincighfc598e12019-05-14 10:36:13 +01001315 network->AddFullyConnectedLayer(descriptor,
1316 weights,
1317 armnn::Optional<armnn::ConstTensor>(biases),
1318 layerName.c_str());
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00001319 armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(0);
1320
1321 inputLayer->GetOutputSlot(0).Connect(fullyConnectedLayer->GetInputSlot(0));
1322 fullyConnectedLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
1323
1324 inputLayer->GetOutputSlot(0).SetTensorInfo(inputInfo);
1325 fullyConnectedLayer->GetOutputSlot(0).SetTensorInfo(outputInfo);
1326
1327 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
1328 BOOST_CHECK(deserializedNetwork);
1329
1330 FullyConnectedLayerVerifier verifier(layerName, {inputInfo}, {outputInfo}, descriptor, weights, biases);
1331 deserializedNetwork->Accept(verifier);
1332}
1333
1334BOOST_AUTO_TEST_CASE(SerializeGather)
1335{
Teresa Charlin52664732020-06-29 16:27:03 +01001336 using GatherDescriptor = armnn::GatherDescriptor;
1337 class GatherLayerVerifier : public LayerVerifierBaseWithDescriptor<GatherDescriptor>
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00001338 {
1339 public:
1340 GatherLayerVerifier(const std::string& layerName,
1341 const std::vector<armnn::TensorInfo>& inputInfos,
Teresa Charlin52664732020-06-29 16:27:03 +01001342 const std::vector<armnn::TensorInfo>& outputInfos,
1343 const GatherDescriptor& descriptor)
1344 : LayerVerifierBaseWithDescriptor<GatherDescriptor>(layerName, inputInfos, outputInfos, descriptor) {}
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00001345
Teresa Charlin52664732020-06-29 16:27:03 +01001346 void VisitGatherLayer(const armnn::IConnectableLayer* layer,
1347 const GatherDescriptor& descriptor,
1348 const char *name) override
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00001349 {
1350 VerifyNameAndConnections(layer, name);
Teresa Charlin52664732020-06-29 16:27:03 +01001351 BOOST_CHECK(descriptor.m_Axis == m_Descriptor.m_Axis);
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00001352 }
1353
Derek Lamberti859f9ce2019-12-10 22:05:21 +00001354 void VisitConstantLayer(const armnn::IConnectableLayer*,
1355 const armnn::ConstTensor&,
1356 const char*) override {}
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00001357 };
1358
1359 const std::string layerName("gather");
Derek Lambertif90c56d2020-01-10 17:14:08 +00001360 armnn::TensorInfo paramsInfo({ 8 }, armnn::DataType::QAsymmU8);
1361 armnn::TensorInfo outputInfo({ 3 }, armnn::DataType::QAsymmU8);
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00001362 const armnn::TensorInfo indicesInfo({ 3 }, armnn::DataType::Signed32);
Teresa Charlin52664732020-06-29 16:27:03 +01001363 GatherDescriptor descriptor;
1364 descriptor.m_Axis = 1;
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00001365
1366 paramsInfo.SetQuantizationScale(1.0f);
1367 paramsInfo.SetQuantizationOffset(0);
1368 outputInfo.SetQuantizationScale(1.0f);
1369 outputInfo.SetQuantizationOffset(0);
1370
1371 const std::vector<int32_t>& indicesData = {7, 6, 5};
1372
1373 armnn::INetworkPtr network = armnn::INetwork::Create();
1374 armnn::IConnectableLayer *const inputLayer = network->AddInputLayer(0);
1375 armnn::IConnectableLayer *const constantLayer =
1376 network->AddConstantLayer(armnn::ConstTensor(indicesInfo, indicesData));
Teresa Charlin52664732020-06-29 16:27:03 +01001377 armnn::IConnectableLayer *const gatherLayer = network->AddGatherLayer(descriptor, layerName.c_str());
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00001378 armnn::IConnectableLayer *const outputLayer = network->AddOutputLayer(0);
1379
1380 inputLayer->GetOutputSlot(0).Connect(gatherLayer->GetInputSlot(0));
1381 constantLayer->GetOutputSlot(0).Connect(gatherLayer->GetInputSlot(1));
1382 gatherLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
1383
1384 inputLayer->GetOutputSlot(0).SetTensorInfo(paramsInfo);
1385 constantLayer->GetOutputSlot(0).SetTensorInfo(indicesInfo);
1386 gatherLayer->GetOutputSlot(0).SetTensorInfo(outputInfo);
1387
1388 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
1389 BOOST_CHECK(deserializedNetwork);
1390
Teresa Charlin52664732020-06-29 16:27:03 +01001391 GatherLayerVerifier verifier(layerName, {paramsInfo, indicesInfo}, {outputInfo}, descriptor);
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00001392 deserializedNetwork->Accept(verifier);
1393}
1394
Aron Virginas-Tar6d2e6592019-10-22 11:44:47 +01001395class GreaterLayerVerifier : public LayerVerifierBase
1396{
1397public:
1398 GreaterLayerVerifier(const std::string& layerName,
1399 const std::vector<armnn::TensorInfo>& inputInfos,
1400 const std::vector<armnn::TensorInfo>& outputInfos)
1401 : LayerVerifierBase(layerName, inputInfos, outputInfos) {}
1402
1403 void VisitComparisonLayer(const armnn::IConnectableLayer* layer,
1404 const armnn::ComparisonDescriptor& descriptor,
1405 const char* name) override
1406 {
1407 VerifyNameAndConnections(layer, name);
1408 BOOST_CHECK(descriptor.m_Operation == armnn::ComparisonOperation::Greater);
1409 }
1410
Derek Lamberti859f9ce2019-12-10 22:05:21 +00001411 void VisitGreaterLayer(const armnn::IConnectableLayer*, const char*) override
Aron Virginas-Tar6d2e6592019-10-22 11:44:47 +01001412 {
1413 throw armnn::Exception("GreaterLayer should have translated to ComparisonLayer");
1414 }
1415};
1416
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +01001417// NOTE: Until the deprecated AddGreaterLayer disappears this test checks that calling
1418// AddGreaterLayer places a ComparisonLayer into the serialized format and that
1419// when this deserialises we have a ComparisonLayer
1420BOOST_AUTO_TEST_CASE(SerializeGreater)
Aron Virginas-Tar781ced92019-10-03 11:15:39 +01001421{
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +01001422 const std::string layerName("greater");
1423
1424 const armnn::TensorShape shape{2, 1, 2, 4};
1425
1426 const armnn::TensorInfo inputInfo = armnn::TensorInfo(shape, armnn::DataType::Float32);
1427 const armnn::TensorInfo outputInfo = armnn::TensorInfo(shape, armnn::DataType::Boolean);
1428
1429 armnn::INetworkPtr network = armnn::INetwork::Create();
1430 armnn::IConnectableLayer* const inputLayer0 = network->AddInputLayer(0);
1431 armnn::IConnectableLayer* const inputLayer1 = network->AddInputLayer(1);
1432 ARMNN_NO_DEPRECATE_WARN_BEGIN
1433 armnn::IConnectableLayer* const equalLayer = network->AddGreaterLayer(layerName.c_str());
1434 ARMNN_NO_DEPRECATE_WARN_END
1435 armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(0);
1436
1437 inputLayer0->GetOutputSlot(0).Connect(equalLayer->GetInputSlot(0));
1438 inputLayer1->GetOutputSlot(0).Connect(equalLayer->GetInputSlot(1));
1439 equalLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
1440
1441 inputLayer0->GetOutputSlot(0).SetTensorInfo(inputInfo);
1442 inputLayer1->GetOutputSlot(0).SetTensorInfo(inputInfo);
1443 equalLayer->GetOutputSlot(0).SetTensorInfo(outputInfo);
1444
1445 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
1446 BOOST_CHECK(deserializedNetwork);
1447
1448 GreaterLayerVerifier verifier(layerName, { inputInfo, inputInfo }, { outputInfo });
1449 deserializedNetwork->Accept(verifier);
1450}
1451
Aron Virginas-Tar6d2e6592019-10-22 11:44:47 +01001452BOOST_AUTO_TEST_CASE(EnsureGreaterBackwardCompatibility)
1453{
1454 // The hex data below is a flat buffer containing a simple network with two inputs,
1455 // an GreaterLayer (now deprecated) and an output
1456 //
1457 // This test verifies that we can still deserialize this old-style model by replacing
1458 // the GreaterLayer with an equivalent ComparisonLayer
1459 const std::vector<uint8_t> greaterModel =
1460 {
1461 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x0A, 0x00,
1462 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
1463 0xCC, 0x01, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x02, 0x00,
1464 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
1465 0x60, 0xFE, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x0B, 0x04, 0x00, 0x00, 0x00, 0xFE, 0xFE, 0xFF, 0xFF, 0x04, 0x00,
1466 0x00, 0x00, 0x06, 0xFF, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x00, 0xEA, 0xFE, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00,
1467 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00,
1468 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1469 0x64, 0xFF, 0xFF, 0xFF, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB4, 0xFE, 0xFF, 0xFF, 0x00, 0x00,
1470 0x00, 0x19, 0x04, 0x00, 0x00, 0x00, 0x52, 0xFF, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x00, 0x36, 0xFF, 0xFF, 0xFF,
1471 0x02, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x1C, 0x00,
1472 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x67, 0x72, 0x65, 0x61, 0x74, 0x65, 0x72, 0x00, 0x02, 0x00, 0x00, 0x00,
1473 0x5C, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x34, 0xFF,
1474 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x00, 0x92, 0xFE, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x04, 0x08, 0x00, 0x00, 0x00,
1475 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00,
1476 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x10, 0x00, 0x04, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00,
1477 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x00, 0x00,
1478 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0E, 0x00,
1479 0x07, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00,
1480 0x06, 0x00, 0x08, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0E, 0x00,
1481 0x04, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
1482 0x0E, 0x00, 0x18, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x10, 0x00, 0x14, 0x00, 0x0E, 0x00, 0x00, 0x00,
1483 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00,
1484 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
1485 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00,
1486 0x00, 0x00, 0x66, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1487 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00,
1488 0x00, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x07, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09,
1489 0x04, 0x00, 0x00, 0x00, 0xF6, 0xFF, 0xFF, 0xFF, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x0A, 0x00,
1490 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x14, 0x00, 0x00, 0x00,
1491 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x10, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00,
1492 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1493 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0A, 0x00, 0x00, 0x00,
1494 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x08, 0x00,
1495 0x07, 0x00, 0x0C, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
1496 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
1497 0x02, 0x00, 0x00, 0x00
1498 };
1499
1500 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(std::string(greaterModel.begin(), greaterModel.end()));
1501 BOOST_CHECK(deserializedNetwork);
1502
1503 const armnn::TensorShape shape{ 1, 2, 2, 2 };
1504
1505 const armnn::TensorInfo inputInfo = armnn::TensorInfo(shape, armnn::DataType::Float32);
1506 const armnn::TensorInfo outputInfo = armnn::TensorInfo(shape, armnn::DataType::Boolean);
1507
1508 GreaterLayerVerifier verifier("greater", { inputInfo, inputInfo }, { outputInfo });
1509 deserializedNetwork->Accept(verifier);
1510}
1511
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +01001512BOOST_AUTO_TEST_CASE(SerializeInstanceNormalization)
1513{
1514 DECLARE_LAYER_VERIFIER_CLASS_WITH_DESCRIPTOR(InstanceNormalization)
1515
Aron Virginas-Tar781ced92019-10-03 11:15:39 +01001516 const std::string layerName("instanceNormalization");
1517 const armnn::TensorInfo info({ 1, 2, 1, 5 }, armnn::DataType::Float32);
1518
1519 armnn::InstanceNormalizationDescriptor descriptor;
1520 descriptor.m_Gamma = 1.1f;
1521 descriptor.m_Beta = 0.1f;
1522 descriptor.m_Eps = 0.0001f;
1523 descriptor.m_DataLayout = armnn::DataLayout::NHWC;
1524
1525 armnn::INetworkPtr network = armnn::INetwork::Create();
1526 armnn::IConnectableLayer* const inputLayer = network->AddInputLayer(0);
1527 armnn::IConnectableLayer* const instanceNormLayer =
1528 network->AddInstanceNormalizationLayer(descriptor, layerName.c_str());
1529 armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(0);
1530
1531 inputLayer->GetOutputSlot(0).Connect(instanceNormLayer->GetInputSlot(0));
1532 instanceNormLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
1533
1534 inputLayer->GetOutputSlot(0).SetTensorInfo(info);
1535 instanceNormLayer->GetOutputSlot(0).SetTensorInfo(info);
1536
1537 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
1538 BOOST_CHECK(deserializedNetwork);
1539
1540 InstanceNormalizationLayerVerifier verifier(layerName, {info}, {info}, descriptor);
1541 deserializedNetwork->Accept(verifier);
1542}
1543
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +01001544DECLARE_LAYER_VERIFIER_CLASS_WITH_DESCRIPTOR(L2Normalization)
Ferran Balaguer0dcffec2019-06-18 16:25:06 +01001545
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00001546BOOST_AUTO_TEST_CASE(SerializeL2Normalization)
1547{
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00001548 const std::string l2NormLayerName("l2Normalization");
1549 const armnn::TensorInfo info({1, 2, 1, 5}, armnn::DataType::Float32);
1550
1551 armnn::L2NormalizationDescriptor desc;
1552 desc.m_DataLayout = armnn::DataLayout::NCHW;
Ferran Balaguer0dcffec2019-06-18 16:25:06 +01001553 desc.m_Eps = 0.0001f;
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00001554
1555 armnn::INetworkPtr network = armnn::INetwork::Create();
1556 armnn::IConnectableLayer* const inputLayer0 = network->AddInputLayer(0);
1557 armnn::IConnectableLayer* const l2NormLayer = network->AddL2NormalizationLayer(desc, l2NormLayerName.c_str());
1558 armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(0);
1559
1560 inputLayer0->GetOutputSlot(0).Connect(l2NormLayer->GetInputSlot(0));
1561 l2NormLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
1562
1563 inputLayer0->GetOutputSlot(0).SetTensorInfo(info);
1564 l2NormLayer->GetOutputSlot(0).SetTensorInfo(info);
1565
1566 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
1567 BOOST_CHECK(deserializedNetwork);
1568
1569 L2NormalizationLayerVerifier verifier(l2NormLayerName, {info}, {info}, desc);
1570 deserializedNetwork->Accept(verifier);
1571}
1572
Ferran Balaguer0dcffec2019-06-18 16:25:06 +01001573BOOST_AUTO_TEST_CASE(EnsureL2NormalizationBackwardCompatibility)
1574{
Aron Virginas-Tar6e0d9622019-10-22 16:24:48 +01001575 // The hex data below is a flat buffer containing a simple network with one input
Ferran Balaguer0dcffec2019-06-18 16:25:06 +01001576 // a L2Normalization layer and an output layer with dimensions as per the tensor infos below.
1577 //
1578 // This test verifies that we can still read back these old style
1579 // models without the normalization epsilon value.
Aron Virginas-Tar6e0d9622019-10-22 16:24:48 +01001580 const std::vector<uint8_t> l2NormalizationModel =
Ferran Balaguer0dcffec2019-06-18 16:25:06 +01001581 {
Aron Virginas-Tar6e0d9622019-10-22 16:24:48 +01001582 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x0A, 0x00,
1583 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
1584 0x3C, 0x01, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
1585 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xE8, 0xFE, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x0B,
1586 0x04, 0x00, 0x00, 0x00, 0xD6, 0xFE, 0xFF, 0xFF, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x08, 0x00,
1587 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x9E, 0xFF, 0xFF, 0xFF, 0x02, 0x00, 0x00, 0x00,
1588 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00,
1589 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1590 0x4C, 0xFF, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0xFF, 0xFF, 0xFF, 0x00, 0x00,
1591 0x00, 0x20, 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x04, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00,
1592 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x06, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
1593 0x0E, 0x00, 0x18, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x10, 0x00, 0x14, 0x00, 0x0E, 0x00, 0x00, 0x00,
1594 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x20, 0x00,
1595 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x6C, 0x32, 0x4E, 0x6F, 0x72, 0x6D, 0x61, 0x6C, 0x69, 0x7A, 0x61, 0x74,
1596 0x69, 0x6F, 0x6E, 0x00, 0x01, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0C, 0x00,
1597 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
1598 0x52, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00,
1599 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
1600 0x08, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1601 0x00, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x07, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09,
1602 0x04, 0x00, 0x00, 0x00, 0xF6, 0xFF, 0xFF, 0xFF, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x0A, 0x00,
1603 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x14, 0x00, 0x00, 0x00,
1604 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x10, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00,
1605 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1606 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0A, 0x00, 0x00, 0x00,
1607 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x08, 0x00,
1608 0x07, 0x00, 0x0C, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
1609 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
1610 0x05, 0x00, 0x00, 0x00, 0x00
1611 };
1612
1613 armnn::INetworkPtr deserializedNetwork =
1614 DeserializeNetwork(std::string(l2NormalizationModel.begin(), l2NormalizationModel.end()));
Ferran Balaguer0dcffec2019-06-18 16:25:06 +01001615 BOOST_CHECK(deserializedNetwork);
Aron Virginas-Tar6e0d9622019-10-22 16:24:48 +01001616
Ferran Balaguer0dcffec2019-06-18 16:25:06 +01001617 const std::string layerName("l2Normalization");
1618 const armnn::TensorInfo inputInfo = armnn::TensorInfo({1, 2, 1, 5}, armnn::DataType::Float32);
1619
1620 armnn::L2NormalizationDescriptor desc;
1621 desc.m_DataLayout = armnn::DataLayout::NCHW;
Aron Virginas-Tar6e0d9622019-10-22 16:24:48 +01001622 // Since this variable does not exist in the l2NormalizationModel dump, the default value will be loaded
Ferran Balaguer0dcffec2019-06-18 16:25:06 +01001623 desc.m_Eps = 1e-12f;
1624
1625 L2NormalizationLayerVerifier verifier(layerName, {inputInfo}, {inputInfo}, desc);
1626 deserializedNetwork->Accept(verifier);
1627}
1628
Sadik Armagan26257852019-10-14 13:00:47 +01001629BOOST_AUTO_TEST_CASE(SerializeLogSoftmax)
1630{
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +01001631 DECLARE_LAYER_VERIFIER_CLASS_WITH_DESCRIPTOR(LogSoftmax)
Sadik Armagan26257852019-10-14 13:00:47 +01001632
1633 const std::string layerName("log_softmax");
1634 const armnn::TensorInfo info({1, 10}, armnn::DataType::Float32);
1635
1636 armnn::LogSoftmaxDescriptor descriptor;
1637 descriptor.m_Beta = 1.0f;
1638 descriptor.m_Axis = -1;
1639
1640 armnn::INetworkPtr network = armnn::INetwork::Create();
1641 armnn::IConnectableLayer* const inputLayer = network->AddInputLayer(0);
1642 armnn::IConnectableLayer* const logSoftmaxLayer = network->AddLogSoftmaxLayer(descriptor, layerName.c_str());
1643 armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(0);
1644
1645 inputLayer->GetOutputSlot(0).Connect(logSoftmaxLayer->GetInputSlot(0));
1646 logSoftmaxLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
1647
1648 inputLayer->GetOutputSlot(0).SetTensorInfo(info);
1649 logSoftmaxLayer->GetOutputSlot(0).SetTensorInfo(info);
1650
1651 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
1652 BOOST_CHECK(deserializedNetwork);
1653
1654 LogSoftmaxLayerVerifier verifier(layerName, {info}, {info}, descriptor);
1655 deserializedNetwork->Accept(verifier);
1656}
1657
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00001658BOOST_AUTO_TEST_CASE(SerializeMaximum)
1659{
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +01001660 DECLARE_LAYER_VERIFIER_CLASS(Maximum)
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00001661
1662 const std::string layerName("maximum");
1663 const armnn::TensorInfo info({ 1, 2, 2, 3 }, armnn::DataType::Float32);
1664
1665 armnn::INetworkPtr network = armnn::INetwork::Create();
1666 armnn::IConnectableLayer* const inputLayer0 = network->AddInputLayer(0);
1667 armnn::IConnectableLayer* const inputLayer1 = network->AddInputLayer(1);
1668 armnn::IConnectableLayer* const maximumLayer = network->AddMaximumLayer(layerName.c_str());
1669 armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(0);
1670
1671 inputLayer0->GetOutputSlot(0).Connect(maximumLayer->GetInputSlot(0));
1672 inputLayer1->GetOutputSlot(0).Connect(maximumLayer->GetInputSlot(1));
1673 maximumLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
1674
1675 inputLayer0->GetOutputSlot(0).SetTensorInfo(info);
1676 inputLayer1->GetOutputSlot(0).SetTensorInfo(info);
1677 maximumLayer->GetOutputSlot(0).SetTensorInfo(info);
1678
1679 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
1680 BOOST_CHECK(deserializedNetwork);
1681
1682 MaximumLayerVerifier verifier(layerName, {info, info}, {info});
1683 deserializedNetwork->Accept(verifier);
1684}
1685
1686BOOST_AUTO_TEST_CASE(SerializeMean)
1687{
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +01001688 DECLARE_LAYER_VERIFIER_CLASS_WITH_DESCRIPTOR(Mean)
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00001689
1690 const std::string layerName("mean");
1691 const armnn::TensorInfo inputInfo({1, 1, 3, 2}, armnn::DataType::Float32);
1692 const armnn::TensorInfo outputInfo({1, 1, 1, 2}, armnn::DataType::Float32);
1693
1694 armnn::MeanDescriptor descriptor;
1695 descriptor.m_Axis = { 2 };
1696 descriptor.m_KeepDims = true;
1697
1698 armnn::INetworkPtr network = armnn::INetwork::Create();
1699 armnn::IConnectableLayer* const inputLayer = network->AddInputLayer(0);
1700 armnn::IConnectableLayer* const meanLayer = network->AddMeanLayer(descriptor, layerName.c_str());
1701 armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(0);
1702
1703 inputLayer->GetOutputSlot(0).Connect(meanLayer->GetInputSlot(0));
1704 meanLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
1705
1706 inputLayer->GetOutputSlot(0).SetTensorInfo(inputInfo);
1707 meanLayer->GetOutputSlot(0).SetTensorInfo(outputInfo);
1708
1709 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
1710 BOOST_CHECK(deserializedNetwork);
1711
1712 MeanLayerVerifier verifier(layerName, {inputInfo}, {outputInfo}, descriptor);
1713 deserializedNetwork->Accept(verifier);
1714}
1715
Nattapat Chaimanowong1f886302019-04-05 13:37:19 +01001716BOOST_AUTO_TEST_CASE(SerializeMerge)
1717{
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +01001718 DECLARE_LAYER_VERIFIER_CLASS(Merge)
Nattapat Chaimanowong1f886302019-04-05 13:37:19 +01001719
1720 const std::string layerName("merge");
1721 const armnn::TensorInfo info({ 1, 2, 2, 3 }, armnn::DataType::Float32);
1722
1723 armnn::INetworkPtr network = armnn::INetwork::Create();
1724 armnn::IConnectableLayer* const inputLayer0 = network->AddInputLayer(0);
1725 armnn::IConnectableLayer* const inputLayer1 = network->AddInputLayer(1);
1726 armnn::IConnectableLayer* const mergeLayer = network->AddMergeLayer(layerName.c_str());
1727 armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(0);
1728
1729 inputLayer0->GetOutputSlot(0).Connect(mergeLayer->GetInputSlot(0));
1730 inputLayer1->GetOutputSlot(0).Connect(mergeLayer->GetInputSlot(1));
1731 mergeLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
1732
1733 inputLayer0->GetOutputSlot(0).SetTensorInfo(info);
1734 inputLayer1->GetOutputSlot(0).SetTensorInfo(info);
1735 mergeLayer->GetOutputSlot(0).SetTensorInfo(info);
1736
1737 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
1738 BOOST_CHECK(deserializedNetwork);
1739
1740 MergeLayerVerifier verifier(layerName, {info, info}, {info});
1741 deserializedNetwork->Accept(verifier);
1742}
1743
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +01001744class MergerLayerVerifier : public LayerVerifierBaseWithDescriptor<armnn::OriginsDescriptor>
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00001745{
Jim Flynn5fa83932019-05-09 15:35:43 +01001746public:
1747 MergerLayerVerifier(const std::string& layerName,
1748 const std::vector<armnn::TensorInfo>& inputInfos,
1749 const std::vector<armnn::TensorInfo>& outputInfos,
1750 const armnn::OriginsDescriptor& descriptor)
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +01001751 : LayerVerifierBaseWithDescriptor<armnn::OriginsDescriptor>(layerName, inputInfos, outputInfos, descriptor) {}
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00001752
Derek Lamberti859f9ce2019-12-10 22:05:21 +00001753 void VisitMergerLayer(const armnn::IConnectableLayer*,
1754 const armnn::OriginsDescriptor&,
1755 const char*) override
Jim Flynn5fa83932019-05-09 15:35:43 +01001756 {
Jim Flynne242f2d2019-05-22 14:24:13 +01001757 throw armnn::Exception("MergerLayer should have translated to ConcatLayer");
1758 }
1759
1760 void VisitConcatLayer(const armnn::IConnectableLayer* layer,
1761 const armnn::OriginsDescriptor& descriptor,
1762 const char* name) override
1763 {
Jim Flynn5fa83932019-05-09 15:35:43 +01001764 VerifyNameAndConnections(layer, name);
1765 VerifyDescriptor(descriptor);
1766 }
Jim Flynn5fa83932019-05-09 15:35:43 +01001767};
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00001768
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +01001769// NOTE: Until the deprecated AddMergerLayer disappears this test checks that calling
Jim Flynne242f2d2019-05-22 14:24:13 +01001770// AddMergerLayer places a ConcatLayer into the serialized format and that
1771// when this deserialises we have a ConcatLayer
Jim Flynn5fa83932019-05-09 15:35:43 +01001772BOOST_AUTO_TEST_CASE(SerializeMerger)
1773{
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00001774 const std::string layerName("merger");
1775 const armnn::TensorInfo inputInfo = armnn::TensorInfo({2, 3, 2, 2}, armnn::DataType::Float32);
1776 const armnn::TensorInfo outputInfo = armnn::TensorInfo({4, 3, 2, 2}, armnn::DataType::Float32);
1777
1778 const std::vector<armnn::TensorShape> shapes({inputInfo.GetShape(), inputInfo.GetShape()});
1779
1780 armnn::OriginsDescriptor descriptor =
Jim Flynn825af452019-05-20 12:49:28 +01001781 armnn::CreateDescriptorForConcatenation(shapes.begin(), shapes.end(), 0);
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00001782
1783 armnn::INetworkPtr network = armnn::INetwork::Create();
1784 armnn::IConnectableLayer* const inputLayerOne = network->AddInputLayer(0);
1785 armnn::IConnectableLayer* const inputLayerTwo = network->AddInputLayer(1);
Jim Flynn906f9462019-05-10 13:55:21 +01001786 ARMNN_NO_DEPRECATE_WARN_BEGIN
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00001787 armnn::IConnectableLayer* const mergerLayer = network->AddMergerLayer(descriptor, layerName.c_str());
Jim Flynn906f9462019-05-10 13:55:21 +01001788 ARMNN_NO_DEPRECATE_WARN_END
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00001789 armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(0);
1790
1791 inputLayerOne->GetOutputSlot(0).Connect(mergerLayer->GetInputSlot(0));
1792 inputLayerTwo->GetOutputSlot(0).Connect(mergerLayer->GetInputSlot(1));
1793 mergerLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
1794
1795 inputLayerOne->GetOutputSlot(0).SetTensorInfo(inputInfo);
1796 inputLayerTwo->GetOutputSlot(0).SetTensorInfo(inputInfo);
1797 mergerLayer->GetOutputSlot(0).SetTensorInfo(outputInfo);
1798
Jim Flynn5fa83932019-05-09 15:35:43 +01001799 std::string mergerLayerNetwork = SerializeNetwork(*network);
1800 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(mergerLayerNetwork);
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00001801 BOOST_CHECK(deserializedNetwork);
1802
1803 MergerLayerVerifier verifier(layerName, {inputInfo, inputInfo}, {outputInfo}, descriptor);
1804 deserializedNetwork->Accept(verifier);
1805}
1806
Jim Flynn5fa83932019-05-09 15:35:43 +01001807BOOST_AUTO_TEST_CASE(EnsureMergerLayerBackwardCompatibility)
1808{
Aron Virginas-Tar6e0d9622019-10-22 16:24:48 +01001809 // The hex data below is a flat buffer containing a simple network with two inputs
Jim Flynne242f2d2019-05-22 14:24:13 +01001810 // a merger layer (now deprecated) and an output layer with dimensions as per the tensor infos below.
1811 //
1812 // This test verifies that we can still read back these old style
Jim Flynn5fa83932019-05-09 15:35:43 +01001813 // models replacing the MergerLayers with ConcatLayers with the same parameters.
Aron Virginas-Tar6e0d9622019-10-22 16:24:48 +01001814 const std::vector<uint8_t> mergerModel =
Jim Flynn5fa83932019-05-09 15:35:43 +01001815 {
Aron Virginas-Tar6e0d9622019-10-22 16:24:48 +01001816 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x0A, 0x00,
1817 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
1818 0x38, 0x02, 0x00, 0x00, 0x8C, 0x01, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x02, 0x00,
1819 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
1820 0xF4, 0xFD, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x0B, 0x04, 0x00, 0x00, 0x00, 0x92, 0xFE, 0xFF, 0xFF, 0x04, 0x00,
1821 0x00, 0x00, 0x9A, 0xFE, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x00, 0x7E, 0xFE, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00,
1822 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00,
1823 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1824 0xF8, 0xFE, 0xFF, 0xFF, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0xFE, 0xFF, 0xFF, 0x00, 0x00,
1825 0x00, 0x1F, 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x04, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00,
1826 0x68, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x08, 0x00,
1827 0x0C, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
1828 0x02, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x22, 0xFF, 0xFF, 0xFF, 0x04, 0x00,
1829 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1830 0x00, 0x00, 0x00, 0x00, 0x3E, 0xFF, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
1831 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0xFF, 0xFF, 0xFF,
1832 0x02, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x1C, 0x00,
1833 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x6D, 0x65, 0x72, 0x67, 0x65, 0x72, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
1834 0x5C, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x34, 0xFF,
1835 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x00, 0x92, 0xFE, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00,
1836 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00,
1837 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x10, 0x00, 0x04, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00,
1838 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x00, 0x00,
1839 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0E, 0x00,
1840 0x07, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00,
1841 0x06, 0x00, 0x08, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0E, 0x00,
1842 0x04, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
1843 0x0E, 0x00, 0x18, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x10, 0x00, 0x14, 0x00, 0x0E, 0x00, 0x00, 0x00,
1844 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00,
1845 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
1846 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00,
1847 0x00, 0x00, 0x66, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1848 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00,
1849 0x00, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x07, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09,
1850 0x04, 0x00, 0x00, 0x00, 0xF6, 0xFF, 0xFF, 0xFF, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x0A, 0x00,
1851 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x14, 0x00, 0x00, 0x00,
1852 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x10, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00,
1853 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1854 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0A, 0x00, 0x00, 0x00,
1855 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x08, 0x00,
1856 0x07, 0x00, 0x0C, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
1857 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
1858 0x02, 0x00, 0x00, 0x00
1859 };
1860
1861 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(std::string(mergerModel.begin(), mergerModel.end()));
Jim Flynn5fa83932019-05-09 15:35:43 +01001862 BOOST_CHECK(deserializedNetwork);
Aron Virginas-Tar6e0d9622019-10-22 16:24:48 +01001863
1864 const armnn::TensorInfo inputInfo = armnn::TensorInfo({ 2, 3, 2, 2 }, armnn::DataType::Float32);
1865 const armnn::TensorInfo outputInfo = armnn::TensorInfo({ 4, 3, 2, 2 }, armnn::DataType::Float32);
Jim Flynn5fa83932019-05-09 15:35:43 +01001866
1867 const std::vector<armnn::TensorShape> shapes({inputInfo.GetShape(), inputInfo.GetShape()});
1868
1869 armnn::OriginsDescriptor descriptor =
Jim Flynn825af452019-05-20 12:49:28 +01001870 armnn::CreateDescriptorForConcatenation(shapes.begin(), shapes.end(), 0);
Jim Flynn5fa83932019-05-09 15:35:43 +01001871
Aron Virginas-Tar6e0d9622019-10-22 16:24:48 +01001872 MergerLayerVerifier verifier("merger", { inputInfo, inputInfo }, { outputInfo }, descriptor);
Jim Flynn5fa83932019-05-09 15:35:43 +01001873 deserializedNetwork->Accept(verifier);
1874}
1875
Jim Flynne242f2d2019-05-22 14:24:13 +01001876BOOST_AUTO_TEST_CASE(SerializeConcat)
1877{
1878 const std::string layerName("concat");
1879 const armnn::TensorInfo inputInfo = armnn::TensorInfo({2, 3, 2, 2}, armnn::DataType::Float32);
1880 const armnn::TensorInfo outputInfo = armnn::TensorInfo({4, 3, 2, 2}, armnn::DataType::Float32);
1881
1882 const std::vector<armnn::TensorShape> shapes({inputInfo.GetShape(), inputInfo.GetShape()});
1883
1884 armnn::OriginsDescriptor descriptor =
1885 armnn::CreateDescriptorForConcatenation(shapes.begin(), shapes.end(), 0);
1886
1887 armnn::INetworkPtr network = armnn::INetwork::Create();
1888 armnn::IConnectableLayer* const inputLayerOne = network->AddInputLayer(0);
1889 armnn::IConnectableLayer* const inputLayerTwo = network->AddInputLayer(1);
1890 armnn::IConnectableLayer* const concatLayer = network->AddConcatLayer(descriptor, layerName.c_str());
1891 armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(0);
1892
1893 inputLayerOne->GetOutputSlot(0).Connect(concatLayer->GetInputSlot(0));
1894 inputLayerTwo->GetOutputSlot(0).Connect(concatLayer->GetInputSlot(1));
1895 concatLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
1896
1897 inputLayerOne->GetOutputSlot(0).SetTensorInfo(inputInfo);
1898 inputLayerTwo->GetOutputSlot(0).SetTensorInfo(inputInfo);
1899 concatLayer->GetOutputSlot(0).SetTensorInfo(outputInfo);
1900
1901 std::string concatLayerNetwork = SerializeNetwork(*network);
1902 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(concatLayerNetwork);
1903 BOOST_CHECK(deserializedNetwork);
1904
1905 // NOTE: using the MergerLayerVerifier to ensure that it is a concat layer and not a
1906 // merger layer that gets placed into the graph.
1907 MergerLayerVerifier verifier(layerName, {inputInfo, inputInfo}, {outputInfo}, descriptor);
1908 deserializedNetwork->Accept(verifier);
1909}
1910
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00001911BOOST_AUTO_TEST_CASE(SerializeMinimum)
1912{
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +01001913 DECLARE_LAYER_VERIFIER_CLASS(Minimum)
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00001914
1915 const std::string layerName("minimum");
1916 const armnn::TensorInfo info({ 1, 2, 2, 3 }, armnn::DataType::Float32);
1917
1918 armnn::INetworkPtr network = armnn::INetwork::Create();
1919 armnn::IConnectableLayer* const inputLayer0 = network->AddInputLayer(0);
1920 armnn::IConnectableLayer* const inputLayer1 = network->AddInputLayer(1);
1921 armnn::IConnectableLayer* const minimumLayer = network->AddMinimumLayer(layerName.c_str());
1922 armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(0);
1923
1924 inputLayer0->GetOutputSlot(0).Connect(minimumLayer->GetInputSlot(0));
1925 inputLayer1->GetOutputSlot(0).Connect(minimumLayer->GetInputSlot(1));
1926 minimumLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
1927
1928 inputLayer0->GetOutputSlot(0).SetTensorInfo(info);
1929 inputLayer1->GetOutputSlot(0).SetTensorInfo(info);
1930 minimumLayer->GetOutputSlot(0).SetTensorInfo(info);
1931
1932 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
1933 BOOST_CHECK(deserializedNetwork);
1934
1935 MinimumLayerVerifier verifier(layerName, {info, info}, {info});
1936 deserializedNetwork->Accept(verifier);
1937}
1938
1939BOOST_AUTO_TEST_CASE(SerializeMultiplication)
1940{
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +01001941 DECLARE_LAYER_VERIFIER_CLASS(Multiplication)
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00001942
1943 const std::string layerName("multiplication");
1944 const armnn::TensorInfo info({ 1, 5, 2, 3 }, armnn::DataType::Float32);
1945
1946 armnn::INetworkPtr network = armnn::INetwork::Create();
1947 armnn::IConnectableLayer* const inputLayer0 = network->AddInputLayer(0);
1948 armnn::IConnectableLayer* const inputLayer1 = network->AddInputLayer(1);
1949 armnn::IConnectableLayer* const multiplicationLayer = network->AddMultiplicationLayer(layerName.c_str());
1950 armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(0);
1951
1952 inputLayer0->GetOutputSlot(0).Connect(multiplicationLayer->GetInputSlot(0));
1953 inputLayer1->GetOutputSlot(0).Connect(multiplicationLayer->GetInputSlot(1));
1954 multiplicationLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
1955
1956 inputLayer0->GetOutputSlot(0).SetTensorInfo(info);
1957 inputLayer1->GetOutputSlot(0).SetTensorInfo(info);
1958 multiplicationLayer->GetOutputSlot(0).SetTensorInfo(info);
1959
1960 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
1961 BOOST_CHECK(deserializedNetwork);
1962
1963 MultiplicationLayerVerifier verifier(layerName, {info, info}, {info});
1964 deserializedNetwork->Accept(verifier);
1965}
1966
Ellen Norris-Thompson51982472019-06-19 11:46:21 +01001967BOOST_AUTO_TEST_CASE(SerializePrelu)
1968{
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +01001969 DECLARE_LAYER_VERIFIER_CLASS(Prelu)
Ellen Norris-Thompson51982472019-06-19 11:46:21 +01001970
1971 const std::string layerName("prelu");
1972
1973 armnn::TensorInfo inputTensorInfo ({ 4, 1, 2 }, armnn::DataType::Float32);
1974 armnn::TensorInfo alphaTensorInfo ({ 5, 4, 3, 1 }, armnn::DataType::Float32);
1975 armnn::TensorInfo outputTensorInfo({ 5, 4, 3, 2 }, armnn::DataType::Float32);
1976
1977 armnn::INetworkPtr network = armnn::INetwork::Create();
1978 armnn::IConnectableLayer* const inputLayer = network->AddInputLayer(0);
1979 armnn::IConnectableLayer* const alphaLayer = network->AddInputLayer(1);
1980 armnn::IConnectableLayer* const preluLayer = network->AddPreluLayer(layerName.c_str());
1981 armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(0);
1982
1983 inputLayer->GetOutputSlot(0).Connect(preluLayer->GetInputSlot(0));
1984 alphaLayer->GetOutputSlot(0).Connect(preluLayer->GetInputSlot(1));
1985 preluLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
1986
1987 inputLayer->GetOutputSlot(0).SetTensorInfo(inputTensorInfo);
1988 alphaLayer->GetOutputSlot(0).SetTensorInfo(alphaTensorInfo);
1989 preluLayer->GetOutputSlot(0).SetTensorInfo(outputTensorInfo);
1990
1991 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
1992 BOOST_CHECK(deserializedNetwork);
1993
1994 PreluLayerVerifier verifier(layerName, {inputTensorInfo, alphaTensorInfo}, {outputTensorInfo});
1995 deserializedNetwork->Accept(verifier);
1996}
1997
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00001998BOOST_AUTO_TEST_CASE(SerializeNormalization)
1999{
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +01002000 DECLARE_LAYER_VERIFIER_CLASS_WITH_DESCRIPTOR(Normalization)
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00002001
2002 const std::string layerName("normalization");
2003 const armnn::TensorInfo info({2, 1, 2, 2}, armnn::DataType::Float32);
2004
2005 armnn::NormalizationDescriptor desc;
2006 desc.m_DataLayout = armnn::DataLayout::NCHW;
2007 desc.m_NormSize = 3;
2008 desc.m_Alpha = 1;
2009 desc.m_Beta = 1;
2010 desc.m_K = 1;
2011
2012 armnn::INetworkPtr network = armnn::INetwork::Create();
2013 armnn::IConnectableLayer* const inputLayer = network->AddInputLayer(0);
2014 armnn::IConnectableLayer* const normalizationLayer = network->AddNormalizationLayer(desc, layerName.c_str());
2015 armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(0);
2016
2017 inputLayer->GetOutputSlot(0).Connect(normalizationLayer->GetInputSlot(0));
2018 normalizationLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
2019
2020 inputLayer->GetOutputSlot(0).SetTensorInfo(info);
2021 normalizationLayer->GetOutputSlot(0).SetTensorInfo(info);
2022
2023 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
2024 BOOST_CHECK(deserializedNetwork);
2025
2026 NormalizationLayerVerifier verifier(layerName, {info}, {info}, desc);
2027 deserializedNetwork->Accept(verifier);
2028}
2029
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +01002030DECLARE_LAYER_VERIFIER_CLASS_WITH_DESCRIPTOR(Pad)
Jim Flynn965c7c62019-06-24 14:32:41 +01002031
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00002032BOOST_AUTO_TEST_CASE(SerializePad)
2033{
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00002034 const std::string layerName("pad");
2035 const armnn::TensorInfo inputTensorInfo = armnn::TensorInfo({1, 2, 3, 4}, armnn::DataType::Float32);
2036 const armnn::TensorInfo outputTensorInfo = armnn::TensorInfo({1, 3, 5, 7}, armnn::DataType::Float32);
2037
2038 armnn::PadDescriptor desc({{0, 0}, {1, 0}, {1, 1}, {1, 2}});
2039
2040 armnn::INetworkPtr network = armnn::INetwork::Create();
2041 armnn::IConnectableLayer* const inputLayer = network->AddInputLayer(0);
2042 armnn::IConnectableLayer* const padLayer = network->AddPadLayer(desc, layerName.c_str());
2043 armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(0);
2044
2045 inputLayer->GetOutputSlot(0).Connect(padLayer->GetInputSlot(0));
2046 padLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
2047
2048 inputLayer->GetOutputSlot(0).SetTensorInfo(inputTensorInfo);
2049 padLayer->GetOutputSlot(0).SetTensorInfo(outputTensorInfo);
2050
2051 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
2052 BOOST_CHECK(deserializedNetwork);
2053
2054 PadLayerVerifier verifier(layerName, {inputTensorInfo}, {outputTensorInfo}, desc);
2055 deserializedNetwork->Accept(verifier);
2056}
2057
Aron Virginas-Tar6e0d9622019-10-22 16:24:48 +01002058BOOST_AUTO_TEST_CASE(EnsurePadBackwardCompatibility)
Jim Flynn965c7c62019-06-24 14:32:41 +01002059{
2060 // The PadDescriptor is being extended with a float PadValue (so a value other than 0
2061 // can be used to pad the tensor.
2062 //
2063 // This test contains a binary representation of a simple input->pad->output network
2064 // prior to this change to test that the descriptor has been updated in a backward
2065 // compatible way with respect to Deserialization of older binary dumps
Aron Virginas-Tar6e0d9622019-10-22 16:24:48 +01002066 const std::vector<uint8_t> padModel =
Jim Flynn965c7c62019-06-24 14:32:41 +01002067 {
Aron Virginas-Tar6e0d9622019-10-22 16:24:48 +01002068 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x0A, 0x00,
2069 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
2070 0x54, 0x01, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
2071 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xD0, 0xFE, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x0B,
2072 0x04, 0x00, 0x00, 0x00, 0x96, 0xFF, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x00, 0x9E, 0xFF, 0xFF, 0xFF, 0x04, 0x00,
2073 0x00, 0x00, 0x72, 0xFF, 0xFF, 0xFF, 0x02, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
2074 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
2075 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2C, 0xFF, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00,
2076 0x00, 0x00, 0x00, 0x00, 0x24, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x16, 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00,
2077 0x0E, 0x00, 0x04, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x4C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00,
2078 0x00, 0x00, 0x06, 0x00, 0x08, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00,
2079 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2080 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
2081 0x0E, 0x00, 0x18, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x10, 0x00, 0x14, 0x00, 0x0E, 0x00, 0x00, 0x00,
2082 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x14, 0x00,
2083 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x70, 0x61, 0x64, 0x00, 0x01, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00,
2084 0x01, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x08, 0x00,
2085 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x52, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00,
2086 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0x00,
2087 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00,
2088 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x07, 0x00, 0x08, 0x00, 0x08, 0x00,
2089 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xF6, 0xFF, 0xFF, 0xFF, 0x0C, 0x00, 0x00, 0x00,
2090 0x00, 0x00, 0x06, 0x00, 0x0A, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00,
2091 0x0E, 0x00, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x10, 0x00, 0x0E, 0x00, 0x00, 0x00,
2092 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
2093 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00,
2094 0x08, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
2095 0x0A, 0x00, 0x10, 0x00, 0x08, 0x00, 0x07, 0x00, 0x0C, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
2096 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00,
2097 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00
2098 };
2099
2100 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(std::string(padModel.begin(), padModel.end()));
Jim Flynn965c7c62019-06-24 14:32:41 +01002101 BOOST_CHECK(deserializedNetwork);
2102
Aron Virginas-Tar6e0d9622019-10-22 16:24:48 +01002103 const armnn::TensorInfo inputInfo = armnn::TensorInfo({ 1, 2, 3, 4 }, armnn::DataType::Float32);
2104 const armnn::TensorInfo outputInfo = armnn::TensorInfo({ 1, 3, 5, 7 }, armnn::DataType::Float32);
Jim Flynn965c7c62019-06-24 14:32:41 +01002105
Aron Virginas-Tar6e0d9622019-10-22 16:24:48 +01002106 armnn::PadDescriptor descriptor({{ 0, 0 }, { 1, 0 }, { 1, 1 }, { 1, 2 }});
Jim Flynn965c7c62019-06-24 14:32:41 +01002107
Aron Virginas-Tar6e0d9622019-10-22 16:24:48 +01002108 PadLayerVerifier verifier("pad", { inputInfo }, { outputInfo }, descriptor);
Jim Flynn965c7c62019-06-24 14:32:41 +01002109 deserializedNetwork->Accept(verifier);
2110}
2111
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00002112BOOST_AUTO_TEST_CASE(SerializePermute)
2113{
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +01002114 DECLARE_LAYER_VERIFIER_CLASS_WITH_DESCRIPTOR(Permute)
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00002115
2116 const std::string layerName("permute");
2117 const armnn::TensorInfo inputTensorInfo({4, 3, 2, 1}, armnn::DataType::Float32);
2118 const armnn::TensorInfo outputTensorInfo({1, 2, 3, 4}, armnn::DataType::Float32);
2119
2120 armnn::PermuteDescriptor descriptor(armnn::PermutationVector({3, 2, 1, 0}));
2121
2122 armnn::INetworkPtr network = armnn::INetwork::Create();
2123 armnn::IConnectableLayer* const inputLayer = network->AddInputLayer(0);
2124 armnn::IConnectableLayer* const permuteLayer = network->AddPermuteLayer(descriptor, layerName.c_str());
2125 armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(0);
2126
2127 inputLayer->GetOutputSlot(0).Connect(permuteLayer->GetInputSlot(0));
2128 permuteLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
2129
2130 inputLayer->GetOutputSlot(0).SetTensorInfo(inputTensorInfo);
2131 permuteLayer->GetOutputSlot(0).SetTensorInfo(outputTensorInfo);
2132
2133 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
2134 BOOST_CHECK(deserializedNetwork);
2135
2136 PermuteLayerVerifier verifier(layerName, {inputTensorInfo}, {outputTensorInfo}, descriptor);
2137 deserializedNetwork->Accept(verifier);
2138}
2139
2140BOOST_AUTO_TEST_CASE(SerializePooling2d)
2141{
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +01002142 DECLARE_LAYER_VERIFIER_CLASS_WITH_DESCRIPTOR(Pooling2d)
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00002143
2144 const std::string layerName("pooling2d");
2145 const armnn::TensorInfo inputInfo({1, 2, 2, 1}, armnn::DataType::Float32);
2146 const armnn::TensorInfo outputInfo({1, 1, 1, 1}, armnn::DataType::Float32);
2147
2148 armnn::Pooling2dDescriptor desc;
2149 desc.m_DataLayout = armnn::DataLayout::NHWC;
2150 desc.m_PadTop = 0;
2151 desc.m_PadBottom = 0;
2152 desc.m_PadLeft = 0;
2153 desc.m_PadRight = 0;
2154 desc.m_PoolType = armnn::PoolingAlgorithm::Average;
2155 desc.m_OutputShapeRounding = armnn::OutputShapeRounding::Floor;
2156 desc.m_PaddingMethod = armnn::PaddingMethod::Exclude;
2157 desc.m_PoolHeight = 2;
2158 desc.m_PoolWidth = 2;
2159 desc.m_StrideX = 2;
2160 desc.m_StrideY = 2;
2161
2162 armnn::INetworkPtr network = armnn::INetwork::Create();
2163 armnn::IConnectableLayer* const inputLayer = network->AddInputLayer(0);
2164 armnn::IConnectableLayer* const pooling2dLayer = network->AddPooling2dLayer(desc, layerName.c_str());
2165 armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(0);
2166
2167 inputLayer->GetOutputSlot(0).Connect(pooling2dLayer->GetInputSlot(0));
2168 pooling2dLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
2169
2170 inputLayer->GetOutputSlot(0).SetTensorInfo(inputInfo);
2171 pooling2dLayer->GetOutputSlot(0).SetTensorInfo(outputInfo);
2172
2173 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
2174 BOOST_CHECK(deserializedNetwork);
2175
2176 Pooling2dLayerVerifier verifier(layerName, {inputInfo}, {outputInfo}, desc);
2177 deserializedNetwork->Accept(verifier);
2178}
2179
Derek Lamberti87acb272019-03-27 16:51:31 +00002180BOOST_AUTO_TEST_CASE(SerializeQuantize)
2181{
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +01002182 DECLARE_LAYER_VERIFIER_CLASS(Quantize)
Derek Lamberti87acb272019-03-27 16:51:31 +00002183
2184 const std::string layerName("quantize");
2185 const armnn::TensorInfo info({ 1, 2, 2, 3 }, armnn::DataType::Float32);
2186
2187 armnn::INetworkPtr network = armnn::INetwork::Create();
2188 armnn::IConnectableLayer* const inputLayer = network->AddInputLayer(0);
2189 armnn::IConnectableLayer* const quantizeLayer = network->AddQuantizeLayer(layerName.c_str());
2190 armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(0);
2191
2192 inputLayer->GetOutputSlot(0).Connect(quantizeLayer->GetInputSlot(0));
2193 quantizeLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
2194
2195 inputLayer->GetOutputSlot(0).SetTensorInfo(info);
2196 quantizeLayer->GetOutputSlot(0).SetTensorInfo(info);
2197
2198 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
2199 BOOST_CHECK(deserializedNetwork);
2200
2201 QuantizeLayerVerifier verifier(layerName, {info}, {info});
2202 deserializedNetwork->Accept(verifier);
2203}
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +01002204
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00002205BOOST_AUTO_TEST_CASE(SerializeReshape)
2206{
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +01002207 DECLARE_LAYER_VERIFIER_CLASS_WITH_DESCRIPTOR(Reshape)
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00002208
2209 const std::string layerName("reshape");
2210 const armnn::TensorInfo inputInfo({1, 9}, armnn::DataType::Float32);
2211 const armnn::TensorInfo outputInfo({3, 3}, armnn::DataType::Float32);
2212
2213 armnn::ReshapeDescriptor descriptor({3, 3});
2214
2215 armnn::INetworkPtr network = armnn::INetwork::Create();
2216 armnn::IConnectableLayer* const inputLayer = network->AddInputLayer(0);
2217 armnn::IConnectableLayer* const reshapeLayer = network->AddReshapeLayer(descriptor, layerName.c_str());
2218 armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(0);
2219
2220 inputLayer->GetOutputSlot(0).Connect(reshapeLayer->GetInputSlot(0));
2221 reshapeLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
2222
2223 inputLayer->GetOutputSlot(0).SetTensorInfo(inputInfo);
2224 reshapeLayer->GetOutputSlot(0).SetTensorInfo(outputInfo);
2225
2226 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
2227 BOOST_CHECK(deserializedNetwork);
2228
2229 ReshapeLayerVerifier verifier(layerName, {inputInfo}, {outputInfo}, descriptor);
2230 deserializedNetwork->Accept(verifier);
2231}
2232
FinnWilliamsArm6fb339a2019-06-28 15:07:10 +01002233BOOST_AUTO_TEST_CASE(SerializeResize)
2234{
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +01002235 DECLARE_LAYER_VERIFIER_CLASS_WITH_DESCRIPTOR(Resize)
FinnWilliamsArm6fb339a2019-06-28 15:07:10 +01002236
2237 const std::string layerName("resize");
Aron Virginas-Tarfe414cf2019-10-31 14:35:58 +00002238 const armnn::TensorInfo inputInfo = armnn::TensorInfo({1, 3, 5, 5}, armnn::DataType::Float32);
FinnWilliamsArm6fb339a2019-06-28 15:07:10 +01002239 const armnn::TensorInfo outputInfo = armnn::TensorInfo({1, 3, 2, 4}, armnn::DataType::Float32);
2240
2241 armnn::ResizeDescriptor desc;
Aron Virginas-Tar169d2f12019-07-01 19:01:44 +01002242 desc.m_TargetWidth = 4;
FinnWilliamsArm6fb339a2019-06-28 15:07:10 +01002243 desc.m_TargetHeight = 2;
Aron Virginas-Tar169d2f12019-07-01 19:01:44 +01002244 desc.m_Method = armnn::ResizeMethod::NearestNeighbor;
David Monahan4a0c9b92020-05-30 09:48:39 +01002245 desc.m_AlignCorners = true;
2246 desc.m_HalfPixelCenters = true;
FinnWilliamsArm6fb339a2019-06-28 15:07:10 +01002247
2248 armnn::INetworkPtr network = armnn::INetwork::Create();
2249 armnn::IConnectableLayer* const inputLayer = network->AddInputLayer(0);
2250 armnn::IConnectableLayer* const resizeLayer = network->AddResizeLayer(desc, layerName.c_str());
2251 armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(0);
2252
2253 inputLayer->GetOutputSlot(0).Connect(resizeLayer->GetInputSlot(0));
2254 resizeLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
2255
2256 inputLayer->GetOutputSlot(0).SetTensorInfo(inputInfo);
2257 resizeLayer->GetOutputSlot(0).SetTensorInfo(outputInfo);
2258
2259 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
2260 BOOST_CHECK(deserializedNetwork);
2261
2262 ResizeLayerVerifier verifier(layerName, {inputInfo}, {outputInfo}, desc);
2263 deserializedNetwork->Accept(verifier);
2264}
2265
Aron Virginas-Tarfe414cf2019-10-31 14:35:58 +00002266class ResizeBilinearLayerVerifier : public LayerVerifierBaseWithDescriptor<armnn::ResizeBilinearDescriptor>
2267{
2268public:
2269 ResizeBilinearLayerVerifier(const std::string& layerName,
2270 const std::vector<armnn::TensorInfo>& inputInfos,
2271 const std::vector<armnn::TensorInfo>& outputInfos,
2272 const armnn::ResizeBilinearDescriptor& descriptor)
2273 : LayerVerifierBaseWithDescriptor<armnn::ResizeBilinearDescriptor>(
2274 layerName, inputInfos, outputInfos, descriptor) {}
2275
2276 void VisitResizeLayer(const armnn::IConnectableLayer* layer,
2277 const armnn::ResizeDescriptor& descriptor,
2278 const char* name) override
2279 {
2280 VerifyNameAndConnections(layer, name);
2281
David Monahan4a0c9b92020-05-30 09:48:39 +01002282 BOOST_CHECK(descriptor.m_Method == armnn::ResizeMethod::Bilinear);
2283 BOOST_CHECK(descriptor.m_TargetWidth == m_Descriptor.m_TargetWidth);
2284 BOOST_CHECK(descriptor.m_TargetHeight == m_Descriptor.m_TargetHeight);
2285 BOOST_CHECK(descriptor.m_DataLayout == m_Descriptor.m_DataLayout);
2286 BOOST_CHECK(descriptor.m_AlignCorners == m_Descriptor.m_AlignCorners);
2287 BOOST_CHECK(descriptor.m_HalfPixelCenters == m_Descriptor.m_HalfPixelCenters);
Aron Virginas-Tarfe414cf2019-10-31 14:35:58 +00002288 }
2289
2290 void VisitResizeBilinearLayer(const armnn::IConnectableLayer*,
2291 const armnn::ResizeBilinearDescriptor&,
2292 const char*) override
2293 {
2294 throw armnn::Exception("ResizeBilinearLayer should have translated to ResizeLayer");
2295 }
2296};
2297
2298// NOTE: Until the deprecated AddResizeBilinearLayer disappears this test checks that
2299// calling AddResizeBilinearLayer places a ResizeLayer into the serialized format
2300// and that when this deserialises we have a ResizeLayer
2301BOOST_AUTO_TEST_CASE(SerializeResizeBilinear)
2302{
2303 const std::string layerName("resizeBilinear");
2304 const armnn::TensorInfo inputInfo = armnn::TensorInfo({1, 3, 5, 5}, armnn::DataType::Float32);
2305 const armnn::TensorInfo outputInfo = armnn::TensorInfo({1, 3, 2, 4}, armnn::DataType::Float32);
2306
2307 armnn::ResizeBilinearDescriptor desc;
2308 desc.m_TargetWidth = 4u;
2309 desc.m_TargetHeight = 2u;
David Monahan4a0c9b92020-05-30 09:48:39 +01002310 desc.m_AlignCorners = true;
2311 desc.m_HalfPixelCenters = true;
Aron Virginas-Tarfe414cf2019-10-31 14:35:58 +00002312
2313 armnn::INetworkPtr network = armnn::INetwork::Create();
2314 armnn::IConnectableLayer* const inputLayer = network->AddInputLayer(0);
2315 ARMNN_NO_DEPRECATE_WARN_BEGIN
2316 armnn::IConnectableLayer* const resizeLayer = network->AddResizeBilinearLayer(desc, layerName.c_str());
2317 ARMNN_NO_DEPRECATE_WARN_END
2318 armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(0);
2319
2320 inputLayer->GetOutputSlot(0).Connect(resizeLayer->GetInputSlot(0));
2321 resizeLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
2322
2323 inputLayer->GetOutputSlot(0).SetTensorInfo(inputInfo);
2324 resizeLayer->GetOutputSlot(0).SetTensorInfo(outputInfo);
2325
2326 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
2327 BOOST_CHECK(deserializedNetwork);
2328
2329 ResizeBilinearLayerVerifier verifier(layerName, {inputInfo}, {outputInfo}, desc);
2330 deserializedNetwork->Accept(verifier);
2331}
2332
2333BOOST_AUTO_TEST_CASE(EnsureResizeBilinearBackwardCompatibility)
2334{
2335 // The hex data below is a flat buffer containing a simple network with an input,
2336 // a ResizeBilinearLayer (now deprecated) and an output
2337 //
2338 // This test verifies that we can still deserialize this old-style model by replacing
2339 // the ResizeBilinearLayer with an equivalent ResizeLayer
2340 const std::vector<uint8_t> resizeBilinearModel =
2341 {
2342 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x0A, 0x00,
2343 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
2344 0x50, 0x01, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
2345 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xD4, 0xFE, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x0B,
2346 0x04, 0x00, 0x00, 0x00, 0xC2, 0xFE, 0xFF, 0xFF, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x08, 0x00,
2347 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x8A, 0xFF, 0xFF, 0xFF, 0x02, 0x00, 0x00, 0x00,
2348 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00,
2349 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2350 0x38, 0xFF, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0xFF, 0xFF, 0xFF, 0x00, 0x00,
2351 0x00, 0x1A, 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0E, 0x00, 0x04, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00,
2352 0x34, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x12, 0x00, 0x08, 0x00, 0x0C, 0x00,
2353 0x07, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
2354 0x00, 0x00, 0x0E, 0x00, 0x18, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x10, 0x00, 0x14, 0x00, 0x0E, 0x00,
2355 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00,
2356 0x20, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x72, 0x65, 0x73, 0x69, 0x7A, 0x65, 0x42, 0x69, 0x6C, 0x69,
2357 0x6E, 0x65, 0x61, 0x72, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
2358 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00,
2359 0x00, 0x00, 0x52, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2360 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00,
2361 0x00, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2362 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x07, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
2363 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xF6, 0xFF, 0xFF, 0xFF, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00,
2364 0x0A, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x14, 0x00,
2365 0x00, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x10, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
2366 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2367 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0A, 0x00,
2368 0x00, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00,
2369 0x08, 0x00, 0x07, 0x00, 0x0C, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00,
2370 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0x00,
2371 0x00, 0x00, 0x05, 0x00, 0x00, 0x00
2372 };
2373
2374 armnn::INetworkPtr deserializedNetwork =
2375 DeserializeNetwork(std::string(resizeBilinearModel.begin(), resizeBilinearModel.end()));
2376 BOOST_CHECK(deserializedNetwork);
2377
2378 const armnn::TensorInfo inputInfo = armnn::TensorInfo({1, 3, 5, 5}, armnn::DataType::Float32);
2379 const armnn::TensorInfo outputInfo = armnn::TensorInfo({1, 3, 2, 4}, armnn::DataType::Float32);
2380
2381 armnn::ResizeBilinearDescriptor descriptor;
2382 descriptor.m_TargetWidth = 4u;
2383 descriptor.m_TargetHeight = 2u;
2384
2385 ResizeBilinearLayerVerifier verifier("resizeBilinear", { inputInfo }, { outputInfo }, descriptor);
2386 deserializedNetwork->Accept(verifier);
2387}
2388
Aron Virginas-Tar2fda80b2019-09-18 13:36:52 +01002389BOOST_AUTO_TEST_CASE(SerializeSlice)
2390{
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +01002391 DECLARE_LAYER_VERIFIER_CLASS_WITH_DESCRIPTOR(Slice)
Aron Virginas-Tar2fda80b2019-09-18 13:36:52 +01002392
2393 const std::string layerName{"slice"};
2394
2395 const armnn::TensorInfo inputInfo = armnn::TensorInfo({3, 2, 3, 1}, armnn::DataType::Float32);
2396 const armnn::TensorInfo outputInfo = armnn::TensorInfo({2, 2, 2, 1}, armnn::DataType::Float32);
2397
2398 armnn::SliceDescriptor descriptor({ 0, 0, 1, 0}, {2, 2, 2, 1});
2399
2400 armnn::INetworkPtr network = armnn::INetwork::Create();
2401
2402 armnn::IConnectableLayer* const inputLayer = network->AddInputLayer(0);
2403 armnn::IConnectableLayer* const sliceLayer = network->AddSliceLayer(descriptor, layerName.c_str());
2404 armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(0);
2405
2406 inputLayer->GetOutputSlot(0).Connect(sliceLayer->GetInputSlot(0));
2407 sliceLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
2408
2409 inputLayer->GetOutputSlot(0).SetTensorInfo(inputInfo);
2410 sliceLayer->GetOutputSlot(0).SetTensorInfo(outputInfo);
2411
2412 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
2413 BOOST_CHECK(deserializedNetwork);
2414
2415 SliceLayerVerifier verifier(layerName, {inputInfo}, {outputInfo}, descriptor);
2416 deserializedNetwork->Accept(verifier);
2417}
2418
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00002419BOOST_AUTO_TEST_CASE(SerializeSoftmax)
2420{
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +01002421 DECLARE_LAYER_VERIFIER_CLASS_WITH_DESCRIPTOR(Softmax)
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00002422
2423 const std::string layerName("softmax");
2424 const armnn::TensorInfo info({1, 10}, armnn::DataType::Float32);
2425
2426 armnn::SoftmaxDescriptor descriptor;
2427 descriptor.m_Beta = 1.0f;
2428
2429 armnn::INetworkPtr network = armnn::INetwork::Create();
2430 armnn::IConnectableLayer* const inputLayer = network->AddInputLayer(0);
2431 armnn::IConnectableLayer* const softmaxLayer = network->AddSoftmaxLayer(descriptor, layerName.c_str());
2432 armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(0);
2433
2434 inputLayer->GetOutputSlot(0).Connect(softmaxLayer->GetInputSlot(0));
2435 softmaxLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
2436
2437 inputLayer->GetOutputSlot(0).SetTensorInfo(info);
2438 softmaxLayer->GetOutputSlot(0).SetTensorInfo(info);
2439
2440 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
2441 BOOST_CHECK(deserializedNetwork);
2442
2443 SoftmaxLayerVerifier verifier(layerName, {info}, {info}, descriptor);
2444 deserializedNetwork->Accept(verifier);
2445}
2446
2447BOOST_AUTO_TEST_CASE(SerializeSpaceToBatchNd)
2448{
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +01002449 DECLARE_LAYER_VERIFIER_CLASS_WITH_DESCRIPTOR(SpaceToBatchNd)
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00002450
2451 const std::string layerName("spaceToBatchNd");
2452 const armnn::TensorInfo inputInfo({2, 1, 2, 4}, armnn::DataType::Float32);
2453 const armnn::TensorInfo outputInfo({8, 1, 1, 3}, armnn::DataType::Float32);
2454
2455 armnn::SpaceToBatchNdDescriptor desc;
2456 desc.m_DataLayout = armnn::DataLayout::NCHW;
2457 desc.m_BlockShape = {2, 2};
2458 desc.m_PadList = {{0, 0}, {2, 0}};
2459
2460 armnn::INetworkPtr network = armnn::INetwork::Create();
2461 armnn::IConnectableLayer* const inputLayer = network->AddInputLayer(0);
2462 armnn::IConnectableLayer* const spaceToBatchNdLayer = network->AddSpaceToBatchNdLayer(desc, layerName.c_str());
2463 armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(0);
2464
2465 inputLayer->GetOutputSlot(0).Connect(spaceToBatchNdLayer->GetInputSlot(0));
2466 spaceToBatchNdLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
2467
2468 inputLayer->GetOutputSlot(0).SetTensorInfo(inputInfo);
2469 spaceToBatchNdLayer->GetOutputSlot(0).SetTensorInfo(outputInfo);
2470
2471 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
2472 BOOST_CHECK(deserializedNetwork);
2473
2474 SpaceToBatchNdLayerVerifier verifier(layerName, {inputInfo}, {outputInfo}, desc);
2475 deserializedNetwork->Accept(verifier);
2476}
2477
Aron Virginas-Taraa067142019-06-11 16:01:44 +01002478BOOST_AUTO_TEST_CASE(SerializeSpaceToDepth)
2479{
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +01002480 DECLARE_LAYER_VERIFIER_CLASS_WITH_DESCRIPTOR(SpaceToDepth)
Aron Virginas-Taraa067142019-06-11 16:01:44 +01002481
2482 const std::string layerName("spaceToDepth");
2483
2484 const armnn::TensorInfo inputInfo ({ 1, 16, 8, 3 }, armnn::DataType::Float32);
2485 const armnn::TensorInfo outputInfo({ 1, 8, 4, 12 }, armnn::DataType::Float32);
2486
2487 armnn::SpaceToDepthDescriptor desc;
2488 desc.m_BlockSize = 2;
2489 desc.m_DataLayout = armnn::DataLayout::NHWC;
2490
2491 armnn::INetworkPtr network = armnn::INetwork::Create();
2492 armnn::IConnectableLayer* const inputLayer = network->AddInputLayer(0);
2493 armnn::IConnectableLayer* const spaceToDepthLayer = network->AddSpaceToDepthLayer(desc, layerName.c_str());
2494 armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(0);
2495
2496 inputLayer->GetOutputSlot(0).Connect(spaceToDepthLayer->GetInputSlot(0));
2497 spaceToDepthLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
2498
2499 inputLayer->GetOutputSlot(0).SetTensorInfo(inputInfo);
2500 spaceToDepthLayer->GetOutputSlot(0).SetTensorInfo(outputInfo);
2501
2502 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
2503 BOOST_CHECK(deserializedNetwork);
2504
2505 SpaceToDepthLayerVerifier verifier(layerName, {inputInfo}, {outputInfo}, desc);
2506 deserializedNetwork->Accept(verifier);
2507}
2508
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00002509BOOST_AUTO_TEST_CASE(SerializeSplitter)
2510{
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +01002511 DECLARE_LAYER_VERIFIER_CLASS_WITH_DESCRIPTOR(Splitter)
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00002512
2513 const unsigned int numViews = 3;
2514 const unsigned int numDimensions = 4;
2515 const unsigned int inputShape[] = {1, 18, 4, 4};
2516 const unsigned int outputShape[] = {1, 6, 4, 4};
2517
2518 // This is modelled on how the caffe parser sets up a splitter layer to partition an input along dimension one.
2519 unsigned int splitterDimSizes[4] = {static_cast<unsigned int>(inputShape[0]),
2520 static_cast<unsigned int>(inputShape[1]),
2521 static_cast<unsigned int>(inputShape[2]),
2522 static_cast<unsigned int>(inputShape[3])};
2523 splitterDimSizes[1] /= numViews;
2524 armnn::ViewsDescriptor desc(numViews, numDimensions);
2525
2526 for (unsigned int g = 0; g < numViews; ++g)
2527 {
2528 desc.SetViewOriginCoord(g, 1, splitterDimSizes[1] * g);
2529
2530 for (unsigned int dimIdx=0; dimIdx < 4; dimIdx++)
2531 {
2532 desc.SetViewSize(g, dimIdx, splitterDimSizes[dimIdx]);
2533 }
2534 }
2535
2536 const std::string layerName("splitter");
2537 const armnn::TensorInfo inputInfo(numDimensions, inputShape, armnn::DataType::Float32);
2538 const armnn::TensorInfo outputInfo(numDimensions, outputShape, armnn::DataType::Float32);
2539
2540 armnn::INetworkPtr network = armnn::INetwork::Create();
2541 armnn::IConnectableLayer* const inputLayer = network->AddInputLayer(0);
2542 armnn::IConnectableLayer* const splitterLayer = network->AddSplitterLayer(desc, layerName.c_str());
2543 armnn::IConnectableLayer* const outputLayer0 = network->AddOutputLayer(0);
2544 armnn::IConnectableLayer* const outputLayer1 = network->AddOutputLayer(1);
2545 armnn::IConnectableLayer* const outputLayer2 = network->AddOutputLayer(2);
2546
2547 inputLayer->GetOutputSlot(0).Connect(splitterLayer->GetInputSlot(0));
2548 splitterLayer->GetOutputSlot(0).Connect(outputLayer0->GetInputSlot(0));
2549 splitterLayer->GetOutputSlot(1).Connect(outputLayer1->GetInputSlot(0));
2550 splitterLayer->GetOutputSlot(2).Connect(outputLayer2->GetInputSlot(0));
2551
2552 inputLayer->GetOutputSlot(0).SetTensorInfo(inputInfo);
2553 splitterLayer->GetOutputSlot(0).SetTensorInfo(outputInfo);
2554 splitterLayer->GetOutputSlot(1).SetTensorInfo(outputInfo);
2555 splitterLayer->GetOutputSlot(2).SetTensorInfo(outputInfo);
2556
2557 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
2558 BOOST_CHECK(deserializedNetwork);
2559
2560 SplitterLayerVerifier verifier(layerName, {inputInfo}, {outputInfo, outputInfo, outputInfo}, desc);
2561 deserializedNetwork->Accept(verifier);
2562}
2563
Matthew Jacksonb5433ee2019-07-11 15:54:20 +01002564BOOST_AUTO_TEST_CASE(SerializeStack)
2565{
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +01002566 DECLARE_LAYER_VERIFIER_CLASS_WITH_DESCRIPTOR(Stack)
Matthew Jacksonb5433ee2019-07-11 15:54:20 +01002567
2568 const std::string layerName("stack");
2569
2570 armnn::TensorInfo inputTensorInfo ({4, 3, 5}, armnn::DataType::Float32);
2571 armnn::TensorInfo outputTensorInfo({4, 3, 2, 5}, armnn::DataType::Float32);
2572
2573 armnn::StackDescriptor descriptor(2, 2, {4, 3, 5});
2574
2575 armnn::INetworkPtr network = armnn::INetwork::Create();
2576 armnn::IConnectableLayer* const inputLayer1 = network->AddInputLayer(0);
2577 armnn::IConnectableLayer* const inputLayer2 = network->AddInputLayer(1);
2578 armnn::IConnectableLayer* const stackLayer = network->AddStackLayer(descriptor, layerName.c_str());
2579 armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(0);
2580
2581 inputLayer1->GetOutputSlot(0).Connect(stackLayer->GetInputSlot(0));
2582 inputLayer2->GetOutputSlot(0).Connect(stackLayer->GetInputSlot(1));
2583 stackLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
2584
2585 inputLayer1->GetOutputSlot(0).SetTensorInfo(inputTensorInfo);
2586 inputLayer2->GetOutputSlot(0).SetTensorInfo(inputTensorInfo);
2587 stackLayer->GetOutputSlot(0).SetTensorInfo(outputTensorInfo);
2588
2589 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
2590 BOOST_CHECK(deserializedNetwork);
2591
2592 StackLayerVerifier verifier(layerName, {inputTensorInfo, inputTensorInfo}, {outputTensorInfo}, descriptor);
2593 deserializedNetwork->Accept(verifier);
2594}
2595
Aron Virginas-Tar85121a22019-10-23 10:41:35 +01002596BOOST_AUTO_TEST_CASE(SerializeStandIn)
2597{
2598 DECLARE_LAYER_VERIFIER_CLASS_WITH_DESCRIPTOR(StandIn)
2599
2600 const std::string layerName("standIn");
2601
2602 armnn::TensorInfo tensorInfo({ 1u }, armnn::DataType::Float32);
2603 armnn::StandInDescriptor descriptor(2u, 2u);
2604
2605 armnn::INetworkPtr network = armnn::INetwork::Create();
2606 armnn::IConnectableLayer* const inputLayer0 = network->AddInputLayer(0);
2607 armnn::IConnectableLayer* const inputLayer1 = network->AddInputLayer(1);
2608 armnn::IConnectableLayer* const standInLayer = network->AddStandInLayer(descriptor, layerName.c_str());
2609 armnn::IConnectableLayer* const outputLayer0 = network->AddOutputLayer(0);
2610 armnn::IConnectableLayer* const outputLayer1 = network->AddOutputLayer(1);
2611
2612 inputLayer0->GetOutputSlot(0).Connect(standInLayer->GetInputSlot(0));
2613 inputLayer0->GetOutputSlot(0).SetTensorInfo(tensorInfo);
2614
2615 inputLayer1->GetOutputSlot(0).Connect(standInLayer->GetInputSlot(1));
2616 inputLayer1->GetOutputSlot(0).SetTensorInfo(tensorInfo);
2617
2618 standInLayer->GetOutputSlot(0).Connect(outputLayer0->GetInputSlot(0));
2619 standInLayer->GetOutputSlot(0).SetTensorInfo(tensorInfo);
2620
2621 standInLayer->GetOutputSlot(1).Connect(outputLayer1->GetInputSlot(0));
2622 standInLayer->GetOutputSlot(1).SetTensorInfo(tensorInfo);
2623
2624 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
2625 BOOST_CHECK(deserializedNetwork);
2626
2627 StandInLayerVerifier verifier(layerName, { tensorInfo, tensorInfo }, { tensorInfo, tensorInfo }, descriptor);
2628 deserializedNetwork->Accept(verifier);
2629}
2630
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00002631BOOST_AUTO_TEST_CASE(SerializeStridedSlice)
2632{
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +01002633 DECLARE_LAYER_VERIFIER_CLASS_WITH_DESCRIPTOR(StridedSlice)
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00002634
2635 const std::string layerName("stridedSlice");
2636 const armnn::TensorInfo inputInfo = armnn::TensorInfo({3, 2, 3, 1}, armnn::DataType::Float32);
2637 const armnn::TensorInfo outputInfo = armnn::TensorInfo({3, 1}, armnn::DataType::Float32);
2638
2639 armnn::StridedSliceDescriptor desc({0, 0, 1, 0}, {1, 1, 1, 1}, {1, 1, 1, 1});
2640 desc.m_EndMask = (1 << 4) - 1;
2641 desc.m_ShrinkAxisMask = (1 << 1) | (1 << 2);
2642 desc.m_DataLayout = armnn::DataLayout::NCHW;
2643
2644 armnn::INetworkPtr network = armnn::INetwork::Create();
2645 armnn::IConnectableLayer* const inputLayer = network->AddInputLayer(0);
2646 armnn::IConnectableLayer* const stridedSliceLayer = network->AddStridedSliceLayer(desc, layerName.c_str());
2647 armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(0);
2648
2649 inputLayer->GetOutputSlot(0).Connect(stridedSliceLayer->GetInputSlot(0));
2650 stridedSliceLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
2651
2652 inputLayer->GetOutputSlot(0).SetTensorInfo(inputInfo);
2653 stridedSliceLayer->GetOutputSlot(0).SetTensorInfo(outputInfo);
2654
2655 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
2656 BOOST_CHECK(deserializedNetwork);
2657
2658 StridedSliceLayerVerifier verifier(layerName, {inputInfo}, {outputInfo}, desc);
2659 deserializedNetwork->Accept(verifier);
2660}
2661
2662BOOST_AUTO_TEST_CASE(SerializeSubtraction)
2663{
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +01002664 DECLARE_LAYER_VERIFIER_CLASS(Subtraction)
Nattapat Chaimanowong03acd682019-03-20 11:19:52 +00002665
2666 const std::string layerName("subtraction");
2667 const armnn::TensorInfo info({ 1, 4 }, armnn::DataType::Float32);
2668
2669 armnn::INetworkPtr network = armnn::INetwork::Create();
2670 armnn::IConnectableLayer* const inputLayer0 = network->AddInputLayer(0);
2671 armnn::IConnectableLayer* const inputLayer1 = network->AddInputLayer(1);
2672 armnn::IConnectableLayer* const subtractionLayer = network->AddSubtractionLayer(layerName.c_str());
2673 armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(0);
2674
2675 inputLayer0->GetOutputSlot(0).Connect(subtractionLayer->GetInputSlot(0));
2676 inputLayer1->GetOutputSlot(0).Connect(subtractionLayer->GetInputSlot(1));
2677 subtractionLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
2678
2679 inputLayer0->GetOutputSlot(0).SetTensorInfo(info);
2680 inputLayer1->GetOutputSlot(0).SetTensorInfo(info);
2681 subtractionLayer->GetOutputSlot(0).SetTensorInfo(info);
2682
2683 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
2684 BOOST_CHECK(deserializedNetwork);
2685
2686 SubtractionLayerVerifier verifier(layerName, {info, info}, {info});
2687 deserializedNetwork->Accept(verifier);
Nattapat Chaimanowong3e14a9d2019-03-18 12:37:06 +00002688}
2689
Sadik Armaganeff363d2019-04-05 15:25:46 +01002690BOOST_AUTO_TEST_CASE(SerializeSwitch)
2691{
2692 class SwitchLayerVerifier : public LayerVerifierBase
2693 {
2694 public:
2695 SwitchLayerVerifier(const std::string& layerName,
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +01002696 const std::vector<armnn::TensorInfo>& inputInfos,
2697 const std::vector<armnn::TensorInfo>& outputInfos)
Sadik Armaganeff363d2019-04-05 15:25:46 +01002698 : LayerVerifierBase(layerName, inputInfos, outputInfos) {}
2699
2700 void VisitSwitchLayer(const armnn::IConnectableLayer* layer, const char* name) override
2701 {
2702 VerifyNameAndConnections(layer, name);
2703 }
2704
Derek Lamberti859f9ce2019-12-10 22:05:21 +00002705 void VisitConstantLayer(const armnn::IConnectableLayer*,
2706 const armnn::ConstTensor&,
2707 const char*) override {}
Sadik Armaganeff363d2019-04-05 15:25:46 +01002708 };
2709
2710 const std::string layerName("switch");
2711 const armnn::TensorInfo info({ 1, 4 }, armnn::DataType::Float32);
2712
2713 std::vector<float> constantData = GenerateRandomData<float>(info.GetNumElements());
2714 armnn::ConstTensor constTensor(info, constantData);
2715
2716 armnn::INetworkPtr network = armnn::INetwork::Create();
2717 armnn::IConnectableLayer* const inputLayer = network->AddInputLayer(0);
2718 armnn::IConnectableLayer* const constantLayer = network->AddConstantLayer(constTensor, "constant");
2719 armnn::IConnectableLayer* const switchLayer = network->AddSwitchLayer(layerName.c_str());
2720 armnn::IConnectableLayer* const trueOutputLayer = network->AddOutputLayer(0);
2721 armnn::IConnectableLayer* const falseOutputLayer = network->AddOutputLayer(1);
2722
2723 inputLayer->GetOutputSlot(0).Connect(switchLayer->GetInputSlot(0));
2724 constantLayer->GetOutputSlot(0).Connect(switchLayer->GetInputSlot(1));
2725 switchLayer->GetOutputSlot(0).Connect(trueOutputLayer->GetInputSlot(0));
2726 switchLayer->GetOutputSlot(1).Connect(falseOutputLayer->GetInputSlot(0));
2727
2728 inputLayer->GetOutputSlot(0).SetTensorInfo(info);
2729 constantLayer->GetOutputSlot(0).SetTensorInfo(info);
2730 switchLayer->GetOutputSlot(0).SetTensorInfo(info);
2731 switchLayer->GetOutputSlot(1).SetTensorInfo(info);
2732
2733 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
2734 BOOST_CHECK(deserializedNetwork);
2735
2736 SwitchLayerVerifier verifier(layerName, {info, info}, {info, info});
2737 deserializedNetwork->Accept(verifier);
2738}
2739
Mike Kellyc9ea45a2020-02-28 18:11:58 +00002740BOOST_AUTO_TEST_CASE(SerializeTranspose)
2741{
2742 DECLARE_LAYER_VERIFIER_CLASS_WITH_DESCRIPTOR(Transpose)
2743
2744 const std::string layerName("transpose");
2745 const armnn::TensorInfo inputTensorInfo({4, 3, 2, 1}, armnn::DataType::Float32);
2746 const armnn::TensorInfo outputTensorInfo({1, 2, 3, 4}, armnn::DataType::Float32);
2747
2748 armnn::TransposeDescriptor descriptor(armnn::PermutationVector({3, 2, 1, 0}));
2749
2750 armnn::INetworkPtr network = armnn::INetwork::Create();
2751 armnn::IConnectableLayer* const inputLayer = network->AddInputLayer(0);
2752 armnn::IConnectableLayer* const transposeLayer = network->AddTransposeLayer(descriptor, layerName.c_str());
2753 armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(0);
2754
2755 inputLayer->GetOutputSlot(0).Connect(transposeLayer->GetInputSlot(0));
2756 transposeLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
2757
2758 inputLayer->GetOutputSlot(0).SetTensorInfo(inputTensorInfo);
2759 transposeLayer->GetOutputSlot(0).SetTensorInfo(outputTensorInfo);
2760
2761 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
2762 BOOST_CHECK(deserializedNetwork);
2763
2764 TransposeLayerVerifier verifier(layerName, {inputTensorInfo}, {outputTensorInfo}, descriptor);
2765 deserializedNetwork->Accept(verifier);
2766}
2767
Aron Virginas-Tarcb549302019-06-21 13:53:38 +01002768BOOST_AUTO_TEST_CASE(SerializeTransposeConvolution2d)
2769{
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +01002770 using Descriptor = armnn::TransposeConvolution2dDescriptor;
2771 class TransposeConvolution2dLayerVerifier : public LayerVerifierBaseWithDescriptor<Descriptor>
Aron Virginas-Tarcb549302019-06-21 13:53:38 +01002772 {
2773 public:
2774 TransposeConvolution2dLayerVerifier(const std::string& layerName,
2775 const std::vector<armnn::TensorInfo>& inputInfos,
2776 const std::vector<armnn::TensorInfo>& outputInfos,
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +01002777 const Descriptor& descriptor,
Aron Virginas-Tarcb549302019-06-21 13:53:38 +01002778 const armnn::ConstTensor& weights,
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +01002779 const armnn::Optional<armnn::ConstTensor>& biases)
2780 : LayerVerifierBaseWithDescriptor<Descriptor>(layerName, inputInfos, outputInfos, descriptor)
2781 , m_Weights(weights)
2782 , m_Biases(biases)
Aron Virginas-Tarcb549302019-06-21 13:53:38 +01002783 {}
2784
2785 void VisitTransposeConvolution2dLayer(const armnn::IConnectableLayer* layer,
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +01002786 const Descriptor& descriptor,
Aron Virginas-Tarcb549302019-06-21 13:53:38 +01002787 const armnn::ConstTensor& weights,
2788 const armnn::Optional<armnn::ConstTensor>& biases,
2789 const char* name) override
2790 {
2791 VerifyNameAndConnections(layer, name);
2792 VerifyDescriptor(descriptor);
2793
2794 // check weights
2795 CompareConstTensor(weights, m_Weights);
2796
2797 // check biases
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +01002798 BOOST_CHECK(biases.has_value() == descriptor.m_BiasEnabled);
Aron Virginas-Tarcb549302019-06-21 13:53:38 +01002799 BOOST_CHECK(biases.has_value() == m_Biases.has_value());
2800
2801 if (biases.has_value() && m_Biases.has_value())
2802 {
2803 CompareConstTensor(biases.value(), m_Biases.value());
2804 }
2805 }
2806
2807 private:
Aron Virginas-Tarcb549302019-06-21 13:53:38 +01002808 armnn::ConstTensor m_Weights;
2809 armnn::Optional<armnn::ConstTensor> m_Biases;
2810 };
2811
2812 const std::string layerName("transposeConvolution2d");
2813 const armnn::TensorInfo inputInfo ({ 1, 7, 7, 1 }, armnn::DataType::Float32);
2814 const armnn::TensorInfo outputInfo({ 1, 9, 9, 1 }, armnn::DataType::Float32);
2815
2816 const armnn::TensorInfo weightsInfo({ 1, 3, 3, 1 }, armnn::DataType::Float32);
2817 const armnn::TensorInfo biasesInfo ({ 1 }, armnn::DataType::Float32);
2818
2819 std::vector<float> weightsData = GenerateRandomData<float>(weightsInfo.GetNumElements());
2820 armnn::ConstTensor weights(weightsInfo, weightsData);
2821
2822 std::vector<float> biasesData = GenerateRandomData<float>(biasesInfo.GetNumElements());
2823 armnn::ConstTensor biases(biasesInfo, biasesData);
2824
2825 armnn::TransposeConvolution2dDescriptor descriptor;
2826 descriptor.m_PadLeft = 1;
2827 descriptor.m_PadRight = 1;
2828 descriptor.m_PadTop = 1;
2829 descriptor.m_PadBottom = 1;
2830 descriptor.m_StrideX = 1;
2831 descriptor.m_StrideY = 1;
2832 descriptor.m_BiasEnabled = true;
2833 descriptor.m_DataLayout = armnn::DataLayout::NHWC;
2834
2835 armnn::INetworkPtr network = armnn::INetwork::Create();
2836 armnn::IConnectableLayer* const inputLayer = network->AddInputLayer(0);
2837 armnn::IConnectableLayer* const convLayer =
2838 network->AddTransposeConvolution2dLayer(descriptor,
2839 weights,
2840 armnn::Optional<armnn::ConstTensor>(biases),
2841 layerName.c_str());
2842 armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(0);
2843
2844 inputLayer->GetOutputSlot(0).Connect(convLayer->GetInputSlot(0));
2845 convLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
2846
2847 inputLayer->GetOutputSlot(0).SetTensorInfo(inputInfo);
2848 convLayer->GetOutputSlot(0).SetTensorInfo(outputInfo);
2849
2850 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
2851 BOOST_CHECK(deserializedNetwork);
2852
2853 TransposeConvolution2dLayerVerifier verifier(layerName, {inputInfo}, {outputInfo}, descriptor, weights, biases);
2854 deserializedNetwork->Accept(verifier);
2855}
2856
Sadik Armagandb059fd2019-03-20 12:28:32 +00002857BOOST_AUTO_TEST_CASE(SerializeDeserializeNonLinearNetwork)
2858{
2859 class ConstantLayerVerifier : public LayerVerifierBase
2860 {
2861 public:
2862 ConstantLayerVerifier(const std::string& layerName,
2863 const std::vector<armnn::TensorInfo>& inputInfos,
2864 const std::vector<armnn::TensorInfo>& outputInfos,
2865 const armnn::ConstTensor& layerInput)
2866 : LayerVerifierBase(layerName, inputInfos, outputInfos)
2867 , m_LayerInput(layerInput) {}
2868
2869 void VisitConstantLayer(const armnn::IConnectableLayer* layer,
2870 const armnn::ConstTensor& input,
2871 const char* name) override
2872 {
2873 VerifyNameAndConnections(layer, name);
Sadik Armagandb059fd2019-03-20 12:28:32 +00002874 CompareConstTensor(input, m_LayerInput);
2875 }
2876
Derek Lamberti859f9ce2019-12-10 22:05:21 +00002877 void VisitAdditionLayer(const armnn::IConnectableLayer*, const char*) override {}
Sadik Armagandb059fd2019-03-20 12:28:32 +00002878
2879 private:
2880 armnn::ConstTensor m_LayerInput;
2881 };
2882
2883 const std::string layerName("constant");
2884 const armnn::TensorInfo info({ 2, 3 }, armnn::DataType::Float32);
2885
2886 std::vector<float> constantData = GenerateRandomData<float>(info.GetNumElements());
2887 armnn::ConstTensor constTensor(info, constantData);
2888
2889 armnn::INetworkPtr network(armnn::INetwork::Create());
2890 armnn::IConnectableLayer* input = network->AddInputLayer(0);
2891 armnn::IConnectableLayer* add = network->AddAdditionLayer();
2892 armnn::IConnectableLayer* constant = network->AddConstantLayer(constTensor, layerName.c_str());
2893 armnn::IConnectableLayer* output = network->AddOutputLayer(0);
2894
2895 input->GetOutputSlot(0).Connect(add->GetInputSlot(0));
2896 constant->GetOutputSlot(0).Connect(add->GetInputSlot(1));
2897 add->GetOutputSlot(0).Connect(output->GetInputSlot(0));
2898
2899 input->GetOutputSlot(0).SetTensorInfo(info);
2900 constant->GetOutputSlot(0).SetTensorInfo(info);
2901 add->GetOutputSlot(0).SetTensorInfo(info);
2902
2903 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
2904 BOOST_CHECK(deserializedNetwork);
2905
2906 ConstantLayerVerifier verifier(layerName, {}, {info}, constTensor);
2907 deserializedNetwork->Accept(verifier);
2908}
2909
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +01002910class VerifyLstmLayer : public LayerVerifierBaseWithDescriptor<armnn::LstmDescriptor>
Jim Flynn11af3752019-03-19 17:22:29 +00002911{
2912public:
2913 VerifyLstmLayer(const std::string& layerName,
2914 const std::vector<armnn::TensorInfo>& inputInfos,
2915 const std::vector<armnn::TensorInfo>& outputInfos,
2916 const armnn::LstmDescriptor& descriptor,
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +01002917 const armnn::LstmInputParams& inputParams)
2918 : LayerVerifierBaseWithDescriptor<armnn::LstmDescriptor>(layerName, inputInfos, outputInfos, descriptor)
2919 , m_InputParams(inputParams) {}
2920
Jim Flynn11af3752019-03-19 17:22:29 +00002921 void VisitLstmLayer(const armnn::IConnectableLayer* layer,
2922 const armnn::LstmDescriptor& descriptor,
2923 const armnn::LstmInputParams& params,
2924 const char* name)
2925 {
2926 VerifyNameAndConnections(layer, name);
2927 VerifyDescriptor(descriptor);
2928 VerifyInputParameters(params);
2929 }
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +01002930
Jim Flynn11af3752019-03-19 17:22:29 +00002931protected:
Jim Flynn11af3752019-03-19 17:22:29 +00002932 void VerifyInputParameters(const armnn::LstmInputParams& params)
2933 {
2934 VerifyConstTensors(
2935 "m_InputToInputWeights", m_InputParams.m_InputToInputWeights, params.m_InputToInputWeights);
2936 VerifyConstTensors(
2937 "m_InputToForgetWeights", m_InputParams.m_InputToForgetWeights, params.m_InputToForgetWeights);
2938 VerifyConstTensors(
2939 "m_InputToCellWeights", m_InputParams.m_InputToCellWeights, params.m_InputToCellWeights);
2940 VerifyConstTensors(
2941 "m_InputToOutputWeights", m_InputParams.m_InputToOutputWeights, params.m_InputToOutputWeights);
2942 VerifyConstTensors(
2943 "m_RecurrentToInputWeights", m_InputParams.m_RecurrentToInputWeights, params.m_RecurrentToInputWeights);
2944 VerifyConstTensors(
2945 "m_RecurrentToForgetWeights", m_InputParams.m_RecurrentToForgetWeights, params.m_RecurrentToForgetWeights);
2946 VerifyConstTensors(
2947 "m_RecurrentToCellWeights", m_InputParams.m_RecurrentToCellWeights, params.m_RecurrentToCellWeights);
2948 VerifyConstTensors(
2949 "m_RecurrentToOutputWeights", m_InputParams.m_RecurrentToOutputWeights, params.m_RecurrentToOutputWeights);
2950 VerifyConstTensors(
2951 "m_CellToInputWeights", m_InputParams.m_CellToInputWeights, params.m_CellToInputWeights);
2952 VerifyConstTensors(
2953 "m_CellToForgetWeights", m_InputParams.m_CellToForgetWeights, params.m_CellToForgetWeights);
2954 VerifyConstTensors(
2955 "m_CellToOutputWeights", m_InputParams.m_CellToOutputWeights, params.m_CellToOutputWeights);
2956 VerifyConstTensors(
2957 "m_InputGateBias", m_InputParams.m_InputGateBias, params.m_InputGateBias);
2958 VerifyConstTensors(
2959 "m_ForgetGateBias", m_InputParams.m_ForgetGateBias, params.m_ForgetGateBias);
2960 VerifyConstTensors(
2961 "m_CellBias", m_InputParams.m_CellBias, params.m_CellBias);
2962 VerifyConstTensors(
2963 "m_OutputGateBias", m_InputParams.m_OutputGateBias, params.m_OutputGateBias);
2964 VerifyConstTensors(
2965 "m_ProjectionWeights", m_InputParams.m_ProjectionWeights, params.m_ProjectionWeights);
2966 VerifyConstTensors(
2967 "m_ProjectionBias", m_InputParams.m_ProjectionBias, params.m_ProjectionBias);
Jan Eilersf8c62972019-07-17 11:07:49 +01002968 VerifyConstTensors(
2969 "m_InputLayerNormWeights", m_InputParams.m_InputLayerNormWeights, params.m_InputLayerNormWeights);
2970 VerifyConstTensors(
2971 "m_ForgetLayerNormWeights", m_InputParams.m_ForgetLayerNormWeights, params.m_ForgetLayerNormWeights);
2972 VerifyConstTensors(
2973 "m_CellLayerNormWeights", m_InputParams.m_CellLayerNormWeights, params.m_CellLayerNormWeights);
2974 VerifyConstTensors(
2975 "m_OutputLayerNormWeights", m_InputParams.m_OutputLayerNormWeights, params.m_OutputLayerNormWeights);
Jim Flynn11af3752019-03-19 17:22:29 +00002976 }
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +01002977
Jim Flynn11af3752019-03-19 17:22:29 +00002978private:
Jim Flynn11af3752019-03-19 17:22:29 +00002979 armnn::LstmInputParams m_InputParams;
2980};
2981
2982BOOST_AUTO_TEST_CASE(SerializeDeserializeLstmCifgPeepholeNoProjection)
2983{
2984 armnn::LstmDescriptor descriptor;
2985 descriptor.m_ActivationFunc = 4;
2986 descriptor.m_ClippingThresProj = 0.0f;
2987 descriptor.m_ClippingThresCell = 0.0f;
2988 descriptor.m_CifgEnabled = true; // if this is true then we DON'T need to set the OptCifgParams
2989 descriptor.m_ProjectionEnabled = false;
2990 descriptor.m_PeepholeEnabled = true;
2991
2992 const uint32_t batchSize = 1;
2993 const uint32_t inputSize = 2;
2994 const uint32_t numUnits = 4;
2995 const uint32_t outputSize = numUnits;
2996
2997 armnn::TensorInfo inputWeightsInfo1({numUnits, inputSize}, armnn::DataType::Float32);
2998 std::vector<float> inputToForgetWeightsData = GenerateRandomData<float>(inputWeightsInfo1.GetNumElements());
2999 armnn::ConstTensor inputToForgetWeights(inputWeightsInfo1, inputToForgetWeightsData);
3000
3001 std::vector<float> inputToCellWeightsData = GenerateRandomData<float>(inputWeightsInfo1.GetNumElements());
3002 armnn::ConstTensor inputToCellWeights(inputWeightsInfo1, inputToCellWeightsData);
3003
3004 std::vector<float> inputToOutputWeightsData = GenerateRandomData<float>(inputWeightsInfo1.GetNumElements());
3005 armnn::ConstTensor inputToOutputWeights(inputWeightsInfo1, inputToOutputWeightsData);
3006
3007 armnn::TensorInfo inputWeightsInfo2({numUnits, outputSize}, armnn::DataType::Float32);
3008 std::vector<float> recurrentToForgetWeightsData = GenerateRandomData<float>(inputWeightsInfo2.GetNumElements());
3009 armnn::ConstTensor recurrentToForgetWeights(inputWeightsInfo2, recurrentToForgetWeightsData);
3010
3011 std::vector<float> recurrentToCellWeightsData = GenerateRandomData<float>(inputWeightsInfo2.GetNumElements());
3012 armnn::ConstTensor recurrentToCellWeights(inputWeightsInfo2, recurrentToCellWeightsData);
3013
3014 std::vector<float> recurrentToOutputWeightsData = GenerateRandomData<float>(inputWeightsInfo2.GetNumElements());
3015 armnn::ConstTensor recurrentToOutputWeights(inputWeightsInfo2, recurrentToOutputWeightsData);
3016
3017 armnn::TensorInfo inputWeightsInfo3({numUnits}, armnn::DataType::Float32);
3018 std::vector<float> cellToForgetWeightsData = GenerateRandomData<float>(inputWeightsInfo3.GetNumElements());
3019 armnn::ConstTensor cellToForgetWeights(inputWeightsInfo3, cellToForgetWeightsData);
3020
3021 std::vector<float> cellToOutputWeightsData = GenerateRandomData<float>(inputWeightsInfo3.GetNumElements());
3022 armnn::ConstTensor cellToOutputWeights(inputWeightsInfo3, cellToOutputWeightsData);
3023
3024 std::vector<float> forgetGateBiasData(numUnits, 1.0f);
3025 armnn::ConstTensor forgetGateBias(inputWeightsInfo3, forgetGateBiasData);
3026
3027 std::vector<float> cellBiasData(numUnits, 0.0f);
3028 armnn::ConstTensor cellBias(inputWeightsInfo3, cellBiasData);
3029
3030 std::vector<float> outputGateBiasData(numUnits, 0.0f);
3031 armnn::ConstTensor outputGateBias(inputWeightsInfo3, outputGateBiasData);
3032
3033 armnn::LstmInputParams params;
3034 params.m_InputToForgetWeights = &inputToForgetWeights;
3035 params.m_InputToCellWeights = &inputToCellWeights;
3036 params.m_InputToOutputWeights = &inputToOutputWeights;
3037 params.m_RecurrentToForgetWeights = &recurrentToForgetWeights;
3038 params.m_RecurrentToCellWeights = &recurrentToCellWeights;
3039 params.m_RecurrentToOutputWeights = &recurrentToOutputWeights;
3040 params.m_ForgetGateBias = &forgetGateBias;
3041 params.m_CellBias = &cellBias;
3042 params.m_OutputGateBias = &outputGateBias;
3043 params.m_CellToForgetWeights = &cellToForgetWeights;
3044 params.m_CellToOutputWeights = &cellToOutputWeights;
3045
3046 armnn::INetworkPtr network = armnn::INetwork::Create();
3047 armnn::IConnectableLayer* const inputLayer = network->AddInputLayer(0);
3048 armnn::IConnectableLayer* const cellStateIn = network->AddInputLayer(1);
3049 armnn::IConnectableLayer* const outputStateIn = network->AddInputLayer(2);
3050 const std::string layerName("lstm");
3051 armnn::IConnectableLayer* const lstmLayer = network->AddLstmLayer(descriptor, params, layerName.c_str());
3052 armnn::IConnectableLayer* const scratchBuffer = network->AddOutputLayer(0);
3053 armnn::IConnectableLayer* const outputStateOut = network->AddOutputLayer(1);
3054 armnn::IConnectableLayer* const cellStateOut = network->AddOutputLayer(2);
3055 armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(3);
3056
3057 // connect up
3058 armnn::TensorInfo inputTensorInfo({ batchSize, inputSize }, armnn::DataType::Float32);
3059 armnn::TensorInfo cellStateTensorInfo({ batchSize, numUnits}, armnn::DataType::Float32);
3060 armnn::TensorInfo outputStateTensorInfo({ batchSize, outputSize }, armnn::DataType::Float32);
3061 armnn::TensorInfo lstmTensorInfoScratchBuff({ batchSize, numUnits * 3 }, armnn::DataType::Float32);
3062
3063 inputLayer->GetOutputSlot(0).Connect(lstmLayer->GetInputSlot(0));
3064 inputLayer->GetOutputSlot(0).SetTensorInfo(inputTensorInfo);
3065
3066 outputStateIn->GetOutputSlot(0).Connect(lstmLayer->GetInputSlot(1));
3067 outputStateIn->GetOutputSlot(0).SetTensorInfo(outputStateTensorInfo);
3068
3069 cellStateIn->GetOutputSlot(0).Connect(lstmLayer->GetInputSlot(2));
3070 cellStateIn->GetOutputSlot(0).SetTensorInfo(cellStateTensorInfo);
3071
3072 lstmLayer->GetOutputSlot(0).Connect(scratchBuffer->GetInputSlot(0));
3073 lstmLayer->GetOutputSlot(0).SetTensorInfo(lstmTensorInfoScratchBuff);
3074
3075 lstmLayer->GetOutputSlot(1).Connect(outputStateOut->GetInputSlot(0));
3076 lstmLayer->GetOutputSlot(1).SetTensorInfo(outputStateTensorInfo);
3077
3078 lstmLayer->GetOutputSlot(2).Connect(cellStateOut->GetInputSlot(0));
3079 lstmLayer->GetOutputSlot(2).SetTensorInfo(cellStateTensorInfo);
3080
3081 lstmLayer->GetOutputSlot(3).Connect(outputLayer->GetInputSlot(0));
3082 lstmLayer->GetOutputSlot(3).SetTensorInfo(outputStateTensorInfo);
3083
3084 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
3085 BOOST_CHECK(deserializedNetwork);
3086
3087 VerifyLstmLayer checker(
3088 layerName,
3089 {inputTensorInfo, outputStateTensorInfo, cellStateTensorInfo},
3090 {lstmTensorInfoScratchBuff, outputStateTensorInfo, cellStateTensorInfo, outputStateTensorInfo},
3091 descriptor,
3092 params);
3093 deserializedNetwork->Accept(checker);
3094}
3095
3096BOOST_AUTO_TEST_CASE(SerializeDeserializeLstmNoCifgWithPeepholeAndProjection)
3097{
3098 armnn::LstmDescriptor descriptor;
3099 descriptor.m_ActivationFunc = 4;
3100 descriptor.m_ClippingThresProj = 0.0f;
3101 descriptor.m_ClippingThresCell = 0.0f;
3102 descriptor.m_CifgEnabled = false; // if this is true then we DON'T need to set the OptCifgParams
3103 descriptor.m_ProjectionEnabled = true;
3104 descriptor.m_PeepholeEnabled = true;
3105
3106 const uint32_t batchSize = 2;
3107 const uint32_t inputSize = 5;
3108 const uint32_t numUnits = 20;
3109 const uint32_t outputSize = 16;
3110
3111 armnn::TensorInfo tensorInfo20x5({numUnits, inputSize}, armnn::DataType::Float32);
3112 std::vector<float> inputToInputWeightsData = GenerateRandomData<float>(tensorInfo20x5.GetNumElements());
3113 armnn::ConstTensor inputToInputWeights(tensorInfo20x5, inputToInputWeightsData);
3114
3115 std::vector<float> inputToForgetWeightsData = GenerateRandomData<float>(tensorInfo20x5.GetNumElements());
3116 armnn::ConstTensor inputToForgetWeights(tensorInfo20x5, inputToForgetWeightsData);
3117
3118 std::vector<float> inputToCellWeightsData = GenerateRandomData<float>(tensorInfo20x5.GetNumElements());
3119 armnn::ConstTensor inputToCellWeights(tensorInfo20x5, inputToCellWeightsData);
3120
3121 std::vector<float> inputToOutputWeightsData = GenerateRandomData<float>(tensorInfo20x5.GetNumElements());
3122 armnn::ConstTensor inputToOutputWeights(tensorInfo20x5, inputToOutputWeightsData);
3123
3124 armnn::TensorInfo tensorInfo20({numUnits}, armnn::DataType::Float32);
3125 std::vector<float> inputGateBiasData = GenerateRandomData<float>(tensorInfo20.GetNumElements());
3126 armnn::ConstTensor inputGateBias(tensorInfo20, inputGateBiasData);
3127
3128 std::vector<float> forgetGateBiasData = GenerateRandomData<float>(tensorInfo20.GetNumElements());
3129 armnn::ConstTensor forgetGateBias(tensorInfo20, forgetGateBiasData);
3130
3131 std::vector<float> cellBiasData = GenerateRandomData<float>(tensorInfo20.GetNumElements());
3132 armnn::ConstTensor cellBias(tensorInfo20, cellBiasData);
3133
3134 std::vector<float> outputGateBiasData = GenerateRandomData<float>(tensorInfo20.GetNumElements());
3135 armnn::ConstTensor outputGateBias(tensorInfo20, outputGateBiasData);
3136
3137 armnn::TensorInfo tensorInfo20x16({numUnits, outputSize}, armnn::DataType::Float32);
3138 std::vector<float> recurrentToInputWeightsData = GenerateRandomData<float>(tensorInfo20x16.GetNumElements());
3139 armnn::ConstTensor recurrentToInputWeights(tensorInfo20x16, recurrentToInputWeightsData);
3140
3141 std::vector<float> recurrentToForgetWeightsData = GenerateRandomData<float>(tensorInfo20x16.GetNumElements());
3142 armnn::ConstTensor recurrentToForgetWeights(tensorInfo20x16, recurrentToForgetWeightsData);
3143
3144 std::vector<float> recurrentToCellWeightsData = GenerateRandomData<float>(tensorInfo20x16.GetNumElements());
3145 armnn::ConstTensor recurrentToCellWeights(tensorInfo20x16, recurrentToCellWeightsData);
3146
3147 std::vector<float> recurrentToOutputWeightsData = GenerateRandomData<float>(tensorInfo20x16.GetNumElements());
3148 armnn::ConstTensor recurrentToOutputWeights(tensorInfo20x16, recurrentToOutputWeightsData);
3149
3150 std::vector<float> cellToInputWeightsData = GenerateRandomData<float>(tensorInfo20.GetNumElements());
3151 armnn::ConstTensor cellToInputWeights(tensorInfo20, cellToInputWeightsData);
3152
3153 std::vector<float> cellToForgetWeightsData = GenerateRandomData<float>(tensorInfo20.GetNumElements());
3154 armnn::ConstTensor cellToForgetWeights(tensorInfo20, cellToForgetWeightsData);
3155
3156 std::vector<float> cellToOutputWeightsData = GenerateRandomData<float>(tensorInfo20.GetNumElements());
3157 armnn::ConstTensor cellToOutputWeights(tensorInfo20, cellToOutputWeightsData);
3158
3159 armnn::TensorInfo tensorInfo16x20({outputSize, numUnits}, armnn::DataType::Float32);
3160 std::vector<float> projectionWeightsData = GenerateRandomData<float>(tensorInfo16x20.GetNumElements());
3161 armnn::ConstTensor projectionWeights(tensorInfo16x20, projectionWeightsData);
3162
3163 armnn::TensorInfo tensorInfo16({outputSize}, armnn::DataType::Float32);
3164 std::vector<float> projectionBiasData(outputSize, 0.f);
3165 armnn::ConstTensor projectionBias(tensorInfo16, projectionBiasData);
3166
3167 armnn::LstmInputParams params;
3168 params.m_InputToForgetWeights = &inputToForgetWeights;
3169 params.m_InputToCellWeights = &inputToCellWeights;
3170 params.m_InputToOutputWeights = &inputToOutputWeights;
3171 params.m_RecurrentToForgetWeights = &recurrentToForgetWeights;
3172 params.m_RecurrentToCellWeights = &recurrentToCellWeights;
3173 params.m_RecurrentToOutputWeights = &recurrentToOutputWeights;
3174 params.m_ForgetGateBias = &forgetGateBias;
3175 params.m_CellBias = &cellBias;
3176 params.m_OutputGateBias = &outputGateBias;
3177
3178 // additional params because: descriptor.m_CifgEnabled = false
3179 params.m_InputToInputWeights = &inputToInputWeights;
3180 params.m_RecurrentToInputWeights = &recurrentToInputWeights;
3181 params.m_CellToInputWeights = &cellToInputWeights;
3182 params.m_InputGateBias = &inputGateBias;
3183
3184 // additional params because: descriptor.m_ProjectionEnabled = true
3185 params.m_ProjectionWeights = &projectionWeights;
3186 params.m_ProjectionBias = &projectionBias;
3187
3188 // additional params because: descriptor.m_PeepholeEnabled = true
3189 params.m_CellToForgetWeights = &cellToForgetWeights;
3190 params.m_CellToOutputWeights = &cellToOutputWeights;
3191
3192 armnn::INetworkPtr network = armnn::INetwork::Create();
3193 armnn::IConnectableLayer* const inputLayer = network->AddInputLayer(0);
3194 armnn::IConnectableLayer* const cellStateIn = network->AddInputLayer(1);
3195 armnn::IConnectableLayer* const outputStateIn = network->AddInputLayer(2);
3196 const std::string layerName("lstm");
3197 armnn::IConnectableLayer* const lstmLayer = network->AddLstmLayer(descriptor, params, layerName.c_str());
3198 armnn::IConnectableLayer* const scratchBuffer = network->AddOutputLayer(0);
3199 armnn::IConnectableLayer* const outputStateOut = network->AddOutputLayer(1);
3200 armnn::IConnectableLayer* const cellStateOut = network->AddOutputLayer(2);
3201 armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(3);
3202
3203 // connect up
3204 armnn::TensorInfo inputTensorInfo({ batchSize, inputSize }, armnn::DataType::Float32);
3205 armnn::TensorInfo cellStateTensorInfo({ batchSize, numUnits}, armnn::DataType::Float32);
3206 armnn::TensorInfo outputStateTensorInfo({ batchSize, outputSize }, armnn::DataType::Float32);
3207 armnn::TensorInfo lstmTensorInfoScratchBuff({ batchSize, numUnits * 4 }, armnn::DataType::Float32);
3208
3209 inputLayer->GetOutputSlot(0).Connect(lstmLayer->GetInputSlot(0));
3210 inputLayer->GetOutputSlot(0).SetTensorInfo(inputTensorInfo);
3211
3212 outputStateIn->GetOutputSlot(0).Connect(lstmLayer->GetInputSlot(1));
3213 outputStateIn->GetOutputSlot(0).SetTensorInfo(outputStateTensorInfo);
3214
3215 cellStateIn->GetOutputSlot(0).Connect(lstmLayer->GetInputSlot(2));
3216 cellStateIn->GetOutputSlot(0).SetTensorInfo(cellStateTensorInfo);
3217
3218 lstmLayer->GetOutputSlot(0).Connect(scratchBuffer->GetInputSlot(0));
3219 lstmLayer->GetOutputSlot(0).SetTensorInfo(lstmTensorInfoScratchBuff);
3220
3221 lstmLayer->GetOutputSlot(1).Connect(outputStateOut->GetInputSlot(0));
3222 lstmLayer->GetOutputSlot(1).SetTensorInfo(outputStateTensorInfo);
3223
3224 lstmLayer->GetOutputSlot(2).Connect(cellStateOut->GetInputSlot(0));
3225 lstmLayer->GetOutputSlot(2).SetTensorInfo(cellStateTensorInfo);
3226
3227 lstmLayer->GetOutputSlot(3).Connect(outputLayer->GetInputSlot(0));
3228 lstmLayer->GetOutputSlot(3).SetTensorInfo(outputStateTensorInfo);
3229
3230 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
3231 BOOST_CHECK(deserializedNetwork);
3232
3233 VerifyLstmLayer checker(
3234 layerName,
3235 {inputTensorInfo, outputStateTensorInfo, cellStateTensorInfo},
3236 {lstmTensorInfoScratchBuff, outputStateTensorInfo, cellStateTensorInfo, outputStateTensorInfo},
3237 descriptor,
3238 params);
3239 deserializedNetwork->Accept(checker);
3240}
3241
Jan Eilersf8c62972019-07-17 11:07:49 +01003242BOOST_AUTO_TEST_CASE(SerializeDeserializeLstmNoCifgWithPeepholeWithProjectionWithLayerNorm)
3243{
3244 armnn::LstmDescriptor descriptor;
3245 descriptor.m_ActivationFunc = 4;
3246 descriptor.m_ClippingThresProj = 0.0f;
3247 descriptor.m_ClippingThresCell = 0.0f;
3248 descriptor.m_CifgEnabled = false; // if this is true then we DON'T need to set the OptCifgParams
3249 descriptor.m_ProjectionEnabled = true;
3250 descriptor.m_PeepholeEnabled = true;
3251 descriptor.m_LayerNormEnabled = true;
3252
3253 const uint32_t batchSize = 2;
3254 const uint32_t inputSize = 5;
3255 const uint32_t numUnits = 20;
3256 const uint32_t outputSize = 16;
3257
3258 armnn::TensorInfo tensorInfo20x5({numUnits, inputSize}, armnn::DataType::Float32);
3259 std::vector<float> inputToInputWeightsData = GenerateRandomData<float>(tensorInfo20x5.GetNumElements());
3260 armnn::ConstTensor inputToInputWeights(tensorInfo20x5, inputToInputWeightsData);
3261
3262 std::vector<float> inputToForgetWeightsData = GenerateRandomData<float>(tensorInfo20x5.GetNumElements());
3263 armnn::ConstTensor inputToForgetWeights(tensorInfo20x5, inputToForgetWeightsData);
3264
3265 std::vector<float> inputToCellWeightsData = GenerateRandomData<float>(tensorInfo20x5.GetNumElements());
3266 armnn::ConstTensor inputToCellWeights(tensorInfo20x5, inputToCellWeightsData);
3267
3268 std::vector<float> inputToOutputWeightsData = GenerateRandomData<float>(tensorInfo20x5.GetNumElements());
3269 armnn::ConstTensor inputToOutputWeights(tensorInfo20x5, inputToOutputWeightsData);
3270
3271 armnn::TensorInfo tensorInfo20({numUnits}, armnn::DataType::Float32);
3272 std::vector<float> inputGateBiasData = GenerateRandomData<float>(tensorInfo20.GetNumElements());
3273 armnn::ConstTensor inputGateBias(tensorInfo20, inputGateBiasData);
3274
3275 std::vector<float> forgetGateBiasData = GenerateRandomData<float>(tensorInfo20.GetNumElements());
3276 armnn::ConstTensor forgetGateBias(tensorInfo20, forgetGateBiasData);
3277
3278 std::vector<float> cellBiasData = GenerateRandomData<float>(tensorInfo20.GetNumElements());
3279 armnn::ConstTensor cellBias(tensorInfo20, cellBiasData);
3280
3281 std::vector<float> outputGateBiasData = GenerateRandomData<float>(tensorInfo20.GetNumElements());
3282 armnn::ConstTensor outputGateBias(tensorInfo20, outputGateBiasData);
3283
3284 armnn::TensorInfo tensorInfo20x16({numUnits, outputSize}, armnn::DataType::Float32);
3285 std::vector<float> recurrentToInputWeightsData = GenerateRandomData<float>(tensorInfo20x16.GetNumElements());
3286 armnn::ConstTensor recurrentToInputWeights(tensorInfo20x16, recurrentToInputWeightsData);
3287
3288 std::vector<float> recurrentToForgetWeightsData = GenerateRandomData<float>(tensorInfo20x16.GetNumElements());
3289 armnn::ConstTensor recurrentToForgetWeights(tensorInfo20x16, recurrentToForgetWeightsData);
3290
3291 std::vector<float> recurrentToCellWeightsData = GenerateRandomData<float>(tensorInfo20x16.GetNumElements());
3292 armnn::ConstTensor recurrentToCellWeights(tensorInfo20x16, recurrentToCellWeightsData);
3293
3294 std::vector<float> recurrentToOutputWeightsData = GenerateRandomData<float>(tensorInfo20x16.GetNumElements());
3295 armnn::ConstTensor recurrentToOutputWeights(tensorInfo20x16, recurrentToOutputWeightsData);
3296
3297 std::vector<float> cellToInputWeightsData = GenerateRandomData<float>(tensorInfo20.GetNumElements());
3298 armnn::ConstTensor cellToInputWeights(tensorInfo20, cellToInputWeightsData);
3299
3300 std::vector<float> cellToForgetWeightsData = GenerateRandomData<float>(tensorInfo20.GetNumElements());
3301 armnn::ConstTensor cellToForgetWeights(tensorInfo20, cellToForgetWeightsData);
3302
3303 std::vector<float> cellToOutputWeightsData = GenerateRandomData<float>(tensorInfo20.GetNumElements());
3304 armnn::ConstTensor cellToOutputWeights(tensorInfo20, cellToOutputWeightsData);
3305
3306 armnn::TensorInfo tensorInfo16x20({outputSize, numUnits}, armnn::DataType::Float32);
3307 std::vector<float> projectionWeightsData = GenerateRandomData<float>(tensorInfo16x20.GetNumElements());
3308 armnn::ConstTensor projectionWeights(tensorInfo16x20, projectionWeightsData);
3309
3310 armnn::TensorInfo tensorInfo16({outputSize}, armnn::DataType::Float32);
3311 std::vector<float> projectionBiasData(outputSize, 0.f);
3312 armnn::ConstTensor projectionBias(tensorInfo16, projectionBiasData);
3313
3314 std::vector<float> inputLayerNormWeightsData = GenerateRandomData<float>(tensorInfo20.GetNumElements());
3315 armnn::ConstTensor inputLayerNormWeights(tensorInfo20, forgetGateBiasData);
3316
3317 std::vector<float> forgetLayerNormWeightsData = GenerateRandomData<float>(tensorInfo20.GetNumElements());
3318 armnn::ConstTensor forgetLayerNormWeights(tensorInfo20, forgetGateBiasData);
3319
3320 std::vector<float> cellLayerNormWeightsData = GenerateRandomData<float>(tensorInfo20.GetNumElements());
3321 armnn::ConstTensor cellLayerNormWeights(tensorInfo20, forgetGateBiasData);
3322
3323 std::vector<float> outLayerNormWeightsData = GenerateRandomData<float>(tensorInfo20.GetNumElements());
3324 armnn::ConstTensor outLayerNormWeights(tensorInfo20, forgetGateBiasData);
3325
3326 armnn::LstmInputParams params;
3327 params.m_InputToForgetWeights = &inputToForgetWeights;
3328 params.m_InputToCellWeights = &inputToCellWeights;
3329 params.m_InputToOutputWeights = &inputToOutputWeights;
3330 params.m_RecurrentToForgetWeights = &recurrentToForgetWeights;
3331 params.m_RecurrentToCellWeights = &recurrentToCellWeights;
3332 params.m_RecurrentToOutputWeights = &recurrentToOutputWeights;
3333 params.m_ForgetGateBias = &forgetGateBias;
3334 params.m_CellBias = &cellBias;
3335 params.m_OutputGateBias = &outputGateBias;
3336
3337 // additional params because: descriptor.m_CifgEnabled = false
3338 params.m_InputToInputWeights = &inputToInputWeights;
3339 params.m_RecurrentToInputWeights = &recurrentToInputWeights;
3340 params.m_CellToInputWeights = &cellToInputWeights;
3341 params.m_InputGateBias = &inputGateBias;
3342
3343 // additional params because: descriptor.m_ProjectionEnabled = true
3344 params.m_ProjectionWeights = &projectionWeights;
3345 params.m_ProjectionBias = &projectionBias;
3346
3347 // additional params because: descriptor.m_PeepholeEnabled = true
3348 params.m_CellToForgetWeights = &cellToForgetWeights;
3349 params.m_CellToOutputWeights = &cellToOutputWeights;
3350
3351 // additional params because: despriptor.m_LayerNormEnabled = true
3352 params.m_InputLayerNormWeights = &inputLayerNormWeights;
3353 params.m_ForgetLayerNormWeights = &forgetLayerNormWeights;
3354 params.m_CellLayerNormWeights = &cellLayerNormWeights;
3355 params.m_OutputLayerNormWeights = &outLayerNormWeights;
3356
3357 armnn::INetworkPtr network = armnn::INetwork::Create();
3358 armnn::IConnectableLayer* const inputLayer = network->AddInputLayer(0);
3359 armnn::IConnectableLayer* const cellStateIn = network->AddInputLayer(1);
3360 armnn::IConnectableLayer* const outputStateIn = network->AddInputLayer(2);
3361 const std::string layerName("lstm");
3362 armnn::IConnectableLayer* const lstmLayer = network->AddLstmLayer(descriptor, params, layerName.c_str());
3363 armnn::IConnectableLayer* const scratchBuffer = network->AddOutputLayer(0);
3364 armnn::IConnectableLayer* const outputStateOut = network->AddOutputLayer(1);
3365 armnn::IConnectableLayer* const cellStateOut = network->AddOutputLayer(2);
3366 armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(3);
3367
3368 // connect up
3369 armnn::TensorInfo inputTensorInfo({ batchSize, inputSize }, armnn::DataType::Float32);
3370 armnn::TensorInfo cellStateTensorInfo({ batchSize, numUnits}, armnn::DataType::Float32);
3371 armnn::TensorInfo outputStateTensorInfo({ batchSize, outputSize }, armnn::DataType::Float32);
3372 armnn::TensorInfo lstmTensorInfoScratchBuff({ batchSize, numUnits * 4 }, armnn::DataType::Float32);
3373
3374 inputLayer->GetOutputSlot(0).Connect(lstmLayer->GetInputSlot(0));
3375 inputLayer->GetOutputSlot(0).SetTensorInfo(inputTensorInfo);
3376
3377 outputStateIn->GetOutputSlot(0).Connect(lstmLayer->GetInputSlot(1));
3378 outputStateIn->GetOutputSlot(0).SetTensorInfo(outputStateTensorInfo);
3379
3380 cellStateIn->GetOutputSlot(0).Connect(lstmLayer->GetInputSlot(2));
3381 cellStateIn->GetOutputSlot(0).SetTensorInfo(cellStateTensorInfo);
3382
3383 lstmLayer->GetOutputSlot(0).Connect(scratchBuffer->GetInputSlot(0));
3384 lstmLayer->GetOutputSlot(0).SetTensorInfo(lstmTensorInfoScratchBuff);
3385
3386 lstmLayer->GetOutputSlot(1).Connect(outputStateOut->GetInputSlot(0));
3387 lstmLayer->GetOutputSlot(1).SetTensorInfo(outputStateTensorInfo);
3388
3389 lstmLayer->GetOutputSlot(2).Connect(cellStateOut->GetInputSlot(0));
3390 lstmLayer->GetOutputSlot(2).SetTensorInfo(cellStateTensorInfo);
3391
3392 lstmLayer->GetOutputSlot(3).Connect(outputLayer->GetInputSlot(0));
3393 lstmLayer->GetOutputSlot(3).SetTensorInfo(outputStateTensorInfo);
3394
3395 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
3396 BOOST_CHECK(deserializedNetwork);
3397
3398 VerifyLstmLayer checker(
3399 layerName,
3400 {inputTensorInfo, outputStateTensorInfo, cellStateTensorInfo},
3401 {lstmTensorInfoScratchBuff, outputStateTensorInfo, cellStateTensorInfo, outputStateTensorInfo},
3402 descriptor,
3403 params);
3404 deserializedNetwork->Accept(checker);
3405}
3406
3407BOOST_AUTO_TEST_CASE(EnsureLstmLayersBackwardCompatibility)
3408{
Aron Virginas-Tar6e0d9622019-10-22 16:24:48 +01003409 // The hex data below is a flat buffer containing a lstm layer with no Cifg, with peephole and projection
3410 // enabled. That data was obtained before additional layer normalization parameters where added to the
3411 // lstm serializer. That way it can be tested if a lstm model with the old parameter configuration can
3412 // still be loaded
3413 const std::vector<uint8_t> lstmNoCifgWithPeepholeAndProjectionModel =
Jan Eilersf8c62972019-07-17 11:07:49 +01003414 {
Aron Virginas-Tar6e0d9622019-10-22 16:24:48 +01003415 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x0A, 0x00,
3416 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x2C, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
3417 0xDC, 0x29, 0x00, 0x00, 0x38, 0x29, 0x00, 0x00, 0xB4, 0x28, 0x00, 0x00, 0x94, 0x01, 0x00, 0x00, 0x3C, 0x01,
3418 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
3419 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00,
3420 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x70, 0xD6, 0xFF, 0xFF,
3421 0x00, 0x00, 0x00, 0x0B, 0x04, 0x00, 0x00, 0x00, 0x06, 0xD7, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x00, 0x88, 0xD7,
3422 0xFF, 0xFF, 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xF6, 0xD6, 0xFF, 0xFF, 0x07, 0x00, 0x00, 0x00,
3423 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00,
3424 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3425 0xE8, 0xD7, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xC8, 0xD6, 0xFF, 0xFF, 0x00, 0x00,
3426 0x00, 0x0B, 0x04, 0x00, 0x00, 0x00, 0x5E, 0xD7, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x00, 0xE0, 0xD7, 0xFF, 0xFF,
3427 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x4E, 0xD7, 0xFF, 0xFF, 0x06, 0x00, 0x00, 0x00, 0x10, 0x00,
3428 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3429 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0xD8,
3430 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x20, 0xD7, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x0B,
3431 0x04, 0x00, 0x00, 0x00, 0xB6, 0xD7, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x00, 0x38, 0xD8, 0xFF, 0xFF, 0x08, 0x00,
3432 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xA6, 0xD7, 0xFF, 0xFF, 0x05, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
3433 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3434 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x98, 0xD8, 0xFF, 0xFF,
3435 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x78, 0xD7, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x0B, 0x04, 0x00,
3436 0x00, 0x00, 0x0E, 0xD8, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x00, 0x16, 0xD8, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x00,
3437 0xFA, 0xD7, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00,
3438 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
3439 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xEC, 0xD8, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
3440 0x00, 0x00, 0x6C, 0xD8, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x23, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00,
3441 0x12, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x0A, 0x00, 0x00, 0x00, 0xE0, 0x25, 0x00, 0x00, 0xD0, 0x25,
3442 0x00, 0x00, 0x2C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x00, 0x48, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00,
3443 0x10, 0x00, 0x14, 0x00, 0x18, 0x00, 0x1C, 0x00, 0x20, 0x00, 0x24, 0x00, 0x28, 0x00, 0x2C, 0x00, 0x30, 0x00,
3444 0x34, 0x00, 0x38, 0x00, 0x3C, 0x00, 0x40, 0x00, 0x44, 0x00, 0x26, 0x00, 0x00, 0x00, 0xC4, 0x23, 0x00, 0x00,
3445 0xF8, 0x21, 0x00, 0x00, 0x2C, 0x20, 0x00, 0x00, 0xF0, 0x1A, 0x00, 0x00, 0xB4, 0x15, 0x00, 0x00, 0x78, 0x10,
3446 0x00, 0x00, 0xF0, 0x0F, 0x00, 0x00, 0x68, 0x0F, 0x00, 0x00, 0xE0, 0x0E, 0x00, 0x00, 0x14, 0x0D, 0x00, 0x00,
3447 0xD8, 0x07, 0x00, 0x00, 0x50, 0x07, 0x00, 0x00, 0xC8, 0x06, 0x00, 0x00, 0x8C, 0x01, 0x00, 0x00, 0x14, 0x01,
3448 0x00, 0x00, 0x8C, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xEE, 0xD7, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x03,
3449 0x64, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xFE, 0xD8, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x00, 0x14, 0x00,
3450 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3451 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3452 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3453 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3454 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5A, 0xD8, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01,
3455 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x72, 0xD8,
3456 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x03, 0x64, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x82, 0xD9, 0xFF, 0xFF,
3457 0x04, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3458 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3459 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3460 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3461 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDE, 0xD8,
3462 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
3463 0x14, 0x00, 0x00, 0x00, 0xF6, 0xD8, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x03, 0x54, 0x00, 0x00, 0x00, 0x04, 0x00,
3464 0x00, 0x00, 0x06, 0xDA, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3465 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3466 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3467 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3468 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, 0xD9, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00,
3469 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x6A, 0xD9, 0xFF, 0xFF, 0x00, 0x00,
3470 0x00, 0x03, 0x14, 0x05, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x7A, 0xDA, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x00,
3471 0x40, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3472 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3473 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3474 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3475 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3476 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3477 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3478 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3479 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3480 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3481 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3482 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3483 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3484 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3485 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3486 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3487 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3488 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3489 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3490 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3491 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3492 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3493 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3494 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3495 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3496 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3497 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3498 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3499 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3500 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3501 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3502 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3503 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3504 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3505 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3506 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3507 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3508 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3509 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3510 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3511 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3512 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3513 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3514 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3515 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3516 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3517 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3518 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3519 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3520 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3521 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3522 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3523 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3524 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3525 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3526 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3527 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3528 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3529 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3530 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3531 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3532 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3533 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3534 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3535 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3536 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3537 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3538 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3539 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3540 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3541 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3542 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, 0xDE, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00,
3543 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xA2, 0xDE,
3544 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x03, 0x64, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xB2, 0xDF, 0xFF, 0xFF,
3545 0x04, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3546 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3547 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3548 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3549 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0xDF,
3550 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
3551 0x14, 0x00, 0x00, 0x00, 0x26, 0xDF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x03, 0x64, 0x00, 0x00, 0x00, 0x04, 0x00,
3552 0x00, 0x00, 0x36, 0xE0, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3553 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3554 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3555 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3556 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3557 0x00, 0x00, 0x00, 0x00, 0x92, 0xDF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
3558 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xAA, 0xDF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x03,
3559 0x14, 0x05, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xBA, 0xE0, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x00, 0x40, 0x01,
3560 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3561 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3562 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3563 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3564 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3565 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3566 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3567 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3568 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3569 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3570 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3571 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3572 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3573 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3574 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3575 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3576 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3577 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3578 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3579 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3580 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3581 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3582 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3583 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3584 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3585 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3586 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3587 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3588 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3589 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3590 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3591 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3592 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3593 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3594 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3595 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3596 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3597 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3598 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3599 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3600 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3601 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3602 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3603 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3604 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3605 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3606 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3607 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3608 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3609 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3610 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3611 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3612 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3613 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3614 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3615 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3616 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3617 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3618 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3619 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3620 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3621 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3622 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3623 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3624 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3625 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3626 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3627 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3628 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3629 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3630 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3631 0x00, 0x00, 0x00, 0x00, 0xC6, 0xE4, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
3632 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0xE2, 0xE4, 0xFF, 0xFF,
3633 0x00, 0x00, 0x00, 0x03, 0xA4, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xF2, 0xE5, 0xFF, 0xFF, 0x04, 0x00,
3634 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3635 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3636 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3637 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3638 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3639 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3640 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3641 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3642 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3643 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3644 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3645 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3646 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3647 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3648 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3649 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3650 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3651 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3652 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3653 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3654 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3655 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3656 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8E, 0xE6, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01,
3657 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x05, 0x00,
3658 0x00, 0x00, 0xAA, 0xE6, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x03, 0x64, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
3659 0xBA, 0xE7, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3660 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3661 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3662 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3663 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3664 0x00, 0x00, 0x16, 0xE7, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3665 0x01, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x2E, 0xE7, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x03, 0x64, 0x00,
3666 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x3E, 0xE8, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
3667 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3668 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3669 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3670 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3671 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9A, 0xE7, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00,
3672 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xB2, 0xE7, 0xFF, 0xFF,
3673 0x00, 0x00, 0x00, 0x03, 0x64, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xC2, 0xE8, 0xFF, 0xFF, 0x04, 0x00,
3674 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3675 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3676 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3677 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3678 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0xE8, 0xFF, 0xFF,
3679 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x14, 0x00,
3680 0x00, 0x00, 0x36, 0xE8, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x03, 0x14, 0x05, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
3681 0x46, 0xE9, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3682 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3683 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3684 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3685 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3686 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3687 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3688 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3689 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3690 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3691 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3692 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3693 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3694 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3695 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3696 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3697 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3698 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3699 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3700 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3701 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3702 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3703 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3704 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3705 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3706 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3707 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3708 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3709 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3710 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3711 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3712 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3713 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3714 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3715 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3716 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3717 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3718 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3719 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3720 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3721 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3722 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3723 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3724 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3725 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3726 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3727 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3728 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3729 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3730 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3731 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3732 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3733 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3734 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3735 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3736 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3737 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3738 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3739 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3740 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3741 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3742 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3743 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3744 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3745 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3746 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3747 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3748 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3749 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3750 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3751 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3752 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, 0xED, 0xFF, 0xFF,
3753 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x14, 0x00,
3754 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x6E, 0xED, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x03, 0x14, 0x05, 0x00, 0x00,
3755 0x04, 0x00, 0x00, 0x00, 0x7E, 0xEE, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0x00, 0x00,
3756 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3757 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3758 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3759 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3760 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3761 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3762 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3763 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3764 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3765 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3766 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3767 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3768 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3769 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3770 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3771 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3772 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3773 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3774 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3775 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3776 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3777 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3778 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3779 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3780 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3781 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3782 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3783 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3784 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3785 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3786 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3787 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3788 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3789 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3790 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3791 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3792 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3793 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3794 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3795 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3796 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3797 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3798 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3799 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3800 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3801 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3802 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3803 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3804 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3805 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3806 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3807 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3808 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3809 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3810 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3811 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3812 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3813 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3814 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3815 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3816 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3817 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3818 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3819 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3820 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3821 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3822 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3823 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3824 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3825 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3826 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3827 0x8A, 0xF2, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00,
3828 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0xA6, 0xF2, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x03,
3829 0x14, 0x05, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xB6, 0xF3, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x00, 0x40, 0x01,
3830 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3831 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3832 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3833 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3834 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3835 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3836 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3837 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3838 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3839 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3840 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3841 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3842 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3843 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3844 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3845 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3846 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3847 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3848 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3849 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3850 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3851 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3852 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3853 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3854 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3855 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3856 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3857 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3858 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3859 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3860 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3861 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3862 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3863 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3864 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3865 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3866 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3867 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3868 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3869 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3870 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3871 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3872 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3873 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3874 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3875 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3876 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3877 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3878 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3879 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3880 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3881 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3882 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3883 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3884 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3885 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3886 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3887 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3888 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3889 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3890 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3891 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3892 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3893 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3894 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3895 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3896 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3897 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3898 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3899 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3900 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3901 0x00, 0x00, 0x00, 0x00, 0xC2, 0xF7, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
3902 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0xDE, 0xF7, 0xFF, 0xFF,
3903 0x00, 0x00, 0x00, 0x03, 0xA4, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xEE, 0xF8, 0xFF, 0xFF, 0x04, 0x00,
3904 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3905 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3906 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3907 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3908 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3909 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3910 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3911 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3912 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3913 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3914 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3915 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3916 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3917 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3918 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3919 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3920 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3921 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3922 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3923 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3924 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3925 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3926 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8A, 0xF9, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01,
3927 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x05, 0x00,
3928 0x00, 0x00, 0xA6, 0xF9, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x03, 0xA4, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
3929 0xB6, 0xFA, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3930 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3931 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3932 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3933 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3934 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3935 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3936 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3937 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3938 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3939 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3940 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3941 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3942 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3943 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3944 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3945 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3946 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3947 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3948 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3949 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3950 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3951 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, 0xFB,
3952 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
3953 0x14, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x6E, 0xFB, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x03, 0xA4, 0x01,
3954 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x7E, 0xFC, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00,
3955 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3956 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3957 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3958 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3959 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3960 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3961 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3962 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3963 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3964 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3965 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3966 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3967 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3968 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3969 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3970 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3971 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3972 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3973 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3974 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3975 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3976 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3977 0x00, 0x00, 0x00, 0x00, 0x1A, 0xFD, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
3978 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x10, 0x00, 0x0C, 0x00,
3979 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x07, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
3980 0x01, 0x01, 0x04, 0x00, 0x00, 0x00, 0x2E, 0xFE, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
3981 0x22, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6C, 0x73,
3982 0x74, 0x6D, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xEC, 0x00, 0x00, 0x00, 0xD0, 0x00, 0x00, 0x00,
3983 0xB4, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00, 0x5C, 0x00, 0x00, 0x00, 0x30, 0x00,
3984 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x14, 0xFF, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
3985 0xA6, 0xFD, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00,
3986 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x3C, 0xFF, 0xFF, 0xFF, 0x02, 0x00, 0x00, 0x00,
3987 0x04, 0x00, 0x00, 0x00, 0xCE, 0xFD, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
3988 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x64, 0xFF, 0xFF, 0xFF,
3989 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xF6, 0xFD, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00,
3990 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
3991 0xB4, 0xFE, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x00, 0x1A, 0xFE, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00,
3992 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00,
3993 0xF0, 0xFF, 0xFF, 0xFF, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00,
3994 0x10, 0x00, 0x04, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
3995 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
3996 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE8, 0xFE, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00,
3997 0x7E, 0xFF, 0xFF, 0xFF, 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x04, 0x00, 0x08, 0x00, 0x08, 0x00,
3998 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x76, 0xFF, 0xFF, 0xFF, 0x02, 0x00, 0x00, 0x00,
3999 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
4000 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
4001 0x68, 0xFF, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x00, 0xCE, 0xFE, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00,
4002 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
4003 0x08, 0x00, 0x0E, 0x00, 0x07, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x0C, 0x00,
4004 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x08, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00,
4005 0x08, 0x00, 0x0E, 0x00, 0x04, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x01, 0x00,
4006 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x18, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x10, 0x00, 0x14, 0x00,
4007 0x0E, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00,
4008 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4009 0x01, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x08, 0x00,
4010 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6E, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00,
4011 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x08, 0x00,
4012 0x0C, 0x00, 0x07, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00,
4013 0xF6, 0xFF, 0xFF, 0xFF, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x0A, 0x00, 0x04, 0x00, 0x06, 0x00,
4014 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x08, 0x00,
4015 0x0C, 0x00, 0x10, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00,
4016 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4017 0x01, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x04, 0x00, 0x08, 0x00,
4018 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x08, 0x00, 0x07, 0x00, 0x0C, 0x00,
4019 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00,
4020 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00
4021 };
4022
4023 armnn::INetworkPtr deserializedNetwork =
4024 DeserializeNetwork(std::string(lstmNoCifgWithPeepholeAndProjectionModel.begin(),
4025 lstmNoCifgWithPeepholeAndProjectionModel.end()));
4026
Jan Eilersf8c62972019-07-17 11:07:49 +01004027 BOOST_CHECK(deserializedNetwork);
4028
4029 // generating the same model parameters which where used to serialize the model (Layer norm is not specified)
4030 armnn::LstmDescriptor descriptor;
Aron Virginas-Tar6e0d9622019-10-22 16:24:48 +01004031 descriptor.m_ActivationFunc = 4;
Jan Eilersf8c62972019-07-17 11:07:49 +01004032 descriptor.m_ClippingThresProj = 0.0f;
4033 descriptor.m_ClippingThresCell = 0.0f;
Aron Virginas-Tar6e0d9622019-10-22 16:24:48 +01004034 descriptor.m_CifgEnabled = false;
Jan Eilersf8c62972019-07-17 11:07:49 +01004035 descriptor.m_ProjectionEnabled = true;
Aron Virginas-Tar6e0d9622019-10-22 16:24:48 +01004036 descriptor.m_PeepholeEnabled = true;
Jan Eilersf8c62972019-07-17 11:07:49 +01004037
Aron Virginas-Tar6e0d9622019-10-22 16:24:48 +01004038 const uint32_t batchSize = 2u;
4039 const uint32_t inputSize = 5u;
4040 const uint32_t numUnits = 20u;
4041 const uint32_t outputSize = 16u;
Jan Eilersf8c62972019-07-17 11:07:49 +01004042
4043 armnn::TensorInfo tensorInfo20x5({numUnits, inputSize}, armnn::DataType::Float32);
4044 std::vector<float> inputToInputWeightsData(tensorInfo20x5.GetNumElements(), 0.0f);
4045 armnn::ConstTensor inputToInputWeights(tensorInfo20x5, inputToInputWeightsData);
4046
4047 std::vector<float> inputToForgetWeightsData(tensorInfo20x5.GetNumElements(), 0.0f);
4048 armnn::ConstTensor inputToForgetWeights(tensorInfo20x5, inputToForgetWeightsData);
4049
4050 std::vector<float> inputToCellWeightsData(tensorInfo20x5.GetNumElements(), 0.0f);
4051 armnn::ConstTensor inputToCellWeights(tensorInfo20x5, inputToCellWeightsData);
4052
4053 std::vector<float> inputToOutputWeightsData(tensorInfo20x5.GetNumElements(), 0.0f);
4054 armnn::ConstTensor inputToOutputWeights(tensorInfo20x5, inputToOutputWeightsData);
4055
4056 armnn::TensorInfo tensorInfo20({numUnits}, armnn::DataType::Float32);
4057 std::vector<float> inputGateBiasData(tensorInfo20.GetNumElements(), 0.0f);
4058 armnn::ConstTensor inputGateBias(tensorInfo20, inputGateBiasData);
4059
4060 std::vector<float> forgetGateBiasData(tensorInfo20.GetNumElements(), 0.0f);
4061 armnn::ConstTensor forgetGateBias(tensorInfo20, forgetGateBiasData);
4062
4063 std::vector<float> cellBiasData(tensorInfo20.GetNumElements(), 0.0f);
4064 armnn::ConstTensor cellBias(tensorInfo20, cellBiasData);
4065
4066 std::vector<float> outputGateBiasData(tensorInfo20.GetNumElements(), 0.0f);
4067 armnn::ConstTensor outputGateBias(tensorInfo20, outputGateBiasData);
4068
4069 armnn::TensorInfo tensorInfo20x16({numUnits, outputSize}, armnn::DataType::Float32);
4070 std::vector<float> recurrentToInputWeightsData(tensorInfo20x16.GetNumElements(), 0.0f);
4071 armnn::ConstTensor recurrentToInputWeights(tensorInfo20x16, recurrentToInputWeightsData);
4072
4073 std::vector<float> recurrentToForgetWeightsData(tensorInfo20x16.GetNumElements(), 0.0f);
4074 armnn::ConstTensor recurrentToForgetWeights(tensorInfo20x16, recurrentToForgetWeightsData);
4075
4076 std::vector<float> recurrentToCellWeightsData(tensorInfo20x16.GetNumElements(), 0.0f);
4077 armnn::ConstTensor recurrentToCellWeights(tensorInfo20x16, recurrentToCellWeightsData);
4078
4079 std::vector<float> recurrentToOutputWeightsData(tensorInfo20x16.GetNumElements(), 0.0f);
4080 armnn::ConstTensor recurrentToOutputWeights(tensorInfo20x16, recurrentToOutputWeightsData);
4081
4082 std::vector<float> cellToInputWeightsData(tensorInfo20.GetNumElements(), 0.0f);
4083 armnn::ConstTensor cellToInputWeights(tensorInfo20, cellToInputWeightsData);
4084
4085 std::vector<float> cellToForgetWeightsData(tensorInfo20.GetNumElements(), 0.0f);
4086 armnn::ConstTensor cellToForgetWeights(tensorInfo20, cellToForgetWeightsData);
4087
4088 std::vector<float> cellToOutputWeightsData(tensorInfo20.GetNumElements(), 0.0f);
4089 armnn::ConstTensor cellToOutputWeights(tensorInfo20, cellToOutputWeightsData);
4090
4091 armnn::TensorInfo tensorInfo16x20({outputSize, numUnits}, armnn::DataType::Float32);
4092 std::vector<float> projectionWeightsData(tensorInfo16x20.GetNumElements(), 0.0f);
4093 armnn::ConstTensor projectionWeights(tensorInfo16x20, projectionWeightsData);
4094
4095 armnn::TensorInfo tensorInfo16({outputSize}, armnn::DataType::Float32);
4096 std::vector<float> projectionBiasData(outputSize, 0.0f);
4097 armnn::ConstTensor projectionBias(tensorInfo16, projectionBiasData);
4098
4099 armnn::LstmInputParams params;
Aron Virginas-Tar6e0d9622019-10-22 16:24:48 +01004100 params.m_InputToForgetWeights = &inputToForgetWeights;
4101 params.m_InputToCellWeights = &inputToCellWeights;
4102 params.m_InputToOutputWeights = &inputToOutputWeights;
Jan Eilersf8c62972019-07-17 11:07:49 +01004103 params.m_RecurrentToForgetWeights = &recurrentToForgetWeights;
Aron Virginas-Tar6e0d9622019-10-22 16:24:48 +01004104 params.m_RecurrentToCellWeights = &recurrentToCellWeights;
Jan Eilersf8c62972019-07-17 11:07:49 +01004105 params.m_RecurrentToOutputWeights = &recurrentToOutputWeights;
Aron Virginas-Tar6e0d9622019-10-22 16:24:48 +01004106 params.m_ForgetGateBias = &forgetGateBias;
4107 params.m_CellBias = &cellBias;
4108 params.m_OutputGateBias = &outputGateBias;
Jan Eilersf8c62972019-07-17 11:07:49 +01004109
4110 // additional params because: descriptor.m_CifgEnabled = false
Aron Virginas-Tar6e0d9622019-10-22 16:24:48 +01004111 params.m_InputToInputWeights = &inputToInputWeights;
4112 params.m_RecurrentToInputWeights = &recurrentToInputWeights;
4113 params.m_CellToInputWeights = &cellToInputWeights;
4114 params.m_InputGateBias = &inputGateBias;
Jan Eilersf8c62972019-07-17 11:07:49 +01004115
4116 // additional params because: descriptor.m_ProjectionEnabled = true
Aron Virginas-Tar6e0d9622019-10-22 16:24:48 +01004117 params.m_ProjectionWeights = &projectionWeights;
4118 params.m_ProjectionBias = &projectionBias;
Jan Eilersf8c62972019-07-17 11:07:49 +01004119
4120 // additional params because: descriptor.m_PeepholeEnabled = true
Aron Virginas-Tar6e0d9622019-10-22 16:24:48 +01004121 params.m_CellToForgetWeights = &cellToForgetWeights;
4122 params.m_CellToOutputWeights = &cellToOutputWeights;
Jan Eilersf8c62972019-07-17 11:07:49 +01004123
4124 const std::string layerName("lstm");
4125 armnn::TensorInfo inputTensorInfo({ batchSize, inputSize }, armnn::DataType::Float32);
4126 armnn::TensorInfo cellStateTensorInfo({ batchSize, numUnits}, armnn::DataType::Float32);
4127 armnn::TensorInfo outputStateTensorInfo({ batchSize, outputSize }, armnn::DataType::Float32);
4128 armnn::TensorInfo lstmTensorInfoScratchBuff({ batchSize, numUnits * 4 }, armnn::DataType::Float32);
4129
Jan Eilersf8c62972019-07-17 11:07:49 +01004130 VerifyLstmLayer checker(
4131 layerName,
4132 {inputTensorInfo, outputStateTensorInfo, cellStateTensorInfo},
4133 {lstmTensorInfoScratchBuff, outputStateTensorInfo, cellStateTensorInfo, outputStateTensorInfo},
4134 descriptor,
4135 params);
4136 deserializedNetwork->Accept(checker);
4137}
Jan Eilers5b01a892019-07-23 09:47:43 +01004138class VerifyQuantizedLstmLayer : public LayerVerifierBase
4139{
4140
4141public:
4142 VerifyQuantizedLstmLayer(const std::string& layerName,
4143 const std::vector<armnn::TensorInfo>& inputInfos,
4144 const std::vector<armnn::TensorInfo>& outputInfos,
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +01004145 const armnn::QuantizedLstmInputParams& inputParams)
4146 : LayerVerifierBase(layerName, inputInfos, outputInfos), m_InputParams(inputParams) {}
Jan Eilers5b01a892019-07-23 09:47:43 +01004147
4148 void VisitQuantizedLstmLayer(const armnn::IConnectableLayer* layer,
4149 const armnn::QuantizedLstmInputParams& params,
4150 const char* name)
4151 {
4152 VerifyNameAndConnections(layer, name);
4153 VerifyInputParameters(params);
4154 }
4155
4156protected:
4157 void VerifyInputParameters(const armnn::QuantizedLstmInputParams& params)
4158 {
4159 VerifyConstTensors("m_InputToInputWeights",
alanhsu567886324fc2019-10-25 23:44:16 +08004160 m_InputParams.m_InputToInputWeights, params.m_InputToInputWeights);
Jan Eilers5b01a892019-07-23 09:47:43 +01004161 VerifyConstTensors("m_InputToForgetWeights",
alanhsu567886324fc2019-10-25 23:44:16 +08004162 m_InputParams.m_InputToForgetWeights, params.m_InputToForgetWeights);
Jan Eilers5b01a892019-07-23 09:47:43 +01004163 VerifyConstTensors("m_InputToCellWeights",
alanhsu567886324fc2019-10-25 23:44:16 +08004164 m_InputParams.m_InputToCellWeights, params.m_InputToCellWeights);
Jan Eilers5b01a892019-07-23 09:47:43 +01004165 VerifyConstTensors("m_InputToOutputWeights",
alanhsu567886324fc2019-10-25 23:44:16 +08004166 m_InputParams.m_InputToOutputWeights, params.m_InputToOutputWeights);
Jan Eilers5b01a892019-07-23 09:47:43 +01004167 VerifyConstTensors("m_RecurrentToInputWeights",
alanhsu567886324fc2019-10-25 23:44:16 +08004168 m_InputParams.m_RecurrentToInputWeights, params.m_RecurrentToInputWeights);
Jan Eilers5b01a892019-07-23 09:47:43 +01004169 VerifyConstTensors("m_RecurrentToForgetWeights",
alanhsu567886324fc2019-10-25 23:44:16 +08004170 m_InputParams.m_RecurrentToForgetWeights, params.m_RecurrentToForgetWeights);
Jan Eilers5b01a892019-07-23 09:47:43 +01004171 VerifyConstTensors("m_RecurrentToCellWeights",
alanhsu567886324fc2019-10-25 23:44:16 +08004172 m_InputParams.m_RecurrentToCellWeights, params.m_RecurrentToCellWeights);
Jan Eilers5b01a892019-07-23 09:47:43 +01004173 VerifyConstTensors("m_RecurrentToOutputWeights",
alanhsu567886324fc2019-10-25 23:44:16 +08004174 m_InputParams.m_RecurrentToOutputWeights, params.m_RecurrentToOutputWeights);
Jan Eilers5b01a892019-07-23 09:47:43 +01004175 VerifyConstTensors("m_InputGateBias",
alanhsu567886324fc2019-10-25 23:44:16 +08004176 m_InputParams.m_InputGateBias, params.m_InputGateBias);
Jan Eilers5b01a892019-07-23 09:47:43 +01004177 VerifyConstTensors("m_ForgetGateBias",
alanhsu567886324fc2019-10-25 23:44:16 +08004178 m_InputParams.m_ForgetGateBias, params.m_ForgetGateBias);
Jan Eilers5b01a892019-07-23 09:47:43 +01004179 VerifyConstTensors("m_CellBias",
alanhsu567886324fc2019-10-25 23:44:16 +08004180 m_InputParams.m_CellBias, params.m_CellBias);
Jan Eilers5b01a892019-07-23 09:47:43 +01004181 VerifyConstTensors("m_OutputGateBias",
alanhsu567886324fc2019-10-25 23:44:16 +08004182 m_InputParams.m_OutputGateBias, params.m_OutputGateBias);
Jan Eilers5b01a892019-07-23 09:47:43 +01004183 }
4184
4185private:
4186 armnn::QuantizedLstmInputParams m_InputParams;
4187};
4188
4189BOOST_AUTO_TEST_CASE(SerializeDeserializeQuantizedLstm)
4190{
4191 const uint32_t batchSize = 1;
4192 const uint32_t inputSize = 2;
4193 const uint32_t numUnits = 4;
4194 const uint32_t outputSize = numUnits;
4195
alanhsu567886324fc2019-10-25 23:44:16 +08004196 // Scale/Offset for input/output, cellState In/Out, weights, bias
4197 float inputOutputScale = 0.0078125f;
4198 int32_t inputOutputOffset = 128;
Jan Eilers5b01a892019-07-23 09:47:43 +01004199
alanhsu567886324fc2019-10-25 23:44:16 +08004200 float cellStateScale = 0.00048828125f;
4201 int32_t cellStateOffset = 0;
Jan Eilers5b01a892019-07-23 09:47:43 +01004202
alanhsu567886324fc2019-10-25 23:44:16 +08004203 float weightsScale = 0.00408021f;
4204 int32_t weightsOffset = 100;
Jan Eilers5b01a892019-07-23 09:47:43 +01004205
alanhsu567886324fc2019-10-25 23:44:16 +08004206 float biasScale = 3.1876640625e-05f;
4207 int32_t biasOffset = 0;
Jan Eilers5b01a892019-07-23 09:47:43 +01004208
alanhsu567886324fc2019-10-25 23:44:16 +08004209 // The shape of weight data is {outputSize, inputSize} = {4, 2}
4210 armnn::TensorShape inputToInputWeightsShape = {4, 2};
4211 std::vector<uint8_t> inputToInputWeightsData = {1, 2, 3, 4, 5, 6, 7, 8};
4212 armnn::TensorInfo inputToInputWeightsInfo(inputToInputWeightsShape,
Derek Lambertif90c56d2020-01-10 17:14:08 +00004213 armnn::DataType::QAsymmU8,
alanhsu567886324fc2019-10-25 23:44:16 +08004214 weightsScale,
4215 weightsOffset);
4216 armnn::ConstTensor inputToInputWeights(inputToInputWeightsInfo, inputToInputWeightsData);
Jan Eilers5b01a892019-07-23 09:47:43 +01004217
alanhsu567886324fc2019-10-25 23:44:16 +08004218 armnn::TensorShape inputToForgetWeightsShape = {4, 2};
4219 std::vector<uint8_t> inputToForgetWeightsData = {1, 2, 3, 4, 5, 6, 7, 8};
4220 armnn::TensorInfo inputToForgetWeightsInfo(inputToForgetWeightsShape,
Derek Lambertif90c56d2020-01-10 17:14:08 +00004221 armnn::DataType::QAsymmU8,
alanhsu567886324fc2019-10-25 23:44:16 +08004222 weightsScale,
4223 weightsOffset);
4224 armnn::ConstTensor inputToForgetWeights(inputToForgetWeightsInfo, inputToForgetWeightsData);
Jan Eilers5b01a892019-07-23 09:47:43 +01004225
alanhsu567886324fc2019-10-25 23:44:16 +08004226 armnn::TensorShape inputToCellWeightsShape = {4, 2};
4227 std::vector<uint8_t> inputToCellWeightsData = {1, 2, 3, 4, 5, 6, 7, 8};
4228 armnn::TensorInfo inputToCellWeightsInfo(inputToCellWeightsShape,
Derek Lambertif90c56d2020-01-10 17:14:08 +00004229 armnn::DataType::QAsymmU8,
alanhsu567886324fc2019-10-25 23:44:16 +08004230 weightsScale,
4231 weightsOffset);
4232 armnn::ConstTensor inputToCellWeights(inputToCellWeightsInfo, inputToCellWeightsData);
Jan Eilers5b01a892019-07-23 09:47:43 +01004233
alanhsu567886324fc2019-10-25 23:44:16 +08004234 armnn::TensorShape inputToOutputWeightsShape = {4, 2};
4235 std::vector<uint8_t> inputToOutputWeightsData = {1, 2, 3, 4, 5, 6, 7, 8};
4236 armnn::TensorInfo inputToOutputWeightsInfo(inputToOutputWeightsShape,
Derek Lambertif90c56d2020-01-10 17:14:08 +00004237 armnn::DataType::QAsymmU8,
alanhsu567886324fc2019-10-25 23:44:16 +08004238 weightsScale,
4239 weightsOffset);
4240 armnn::ConstTensor inputToOutputWeights(inputToOutputWeightsInfo, inputToOutputWeightsData);
Jan Eilers5b01a892019-07-23 09:47:43 +01004241
alanhsu567886324fc2019-10-25 23:44:16 +08004242 // The shape of recurrent weight data is {outputSize, outputSize} = {4, 4}
4243 armnn::TensorShape recurrentToInputWeightsShape = {4, 4};
4244 std::vector<uint8_t> recurrentToInputWeightsData = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16};
4245 armnn::TensorInfo recurrentToInputWeightsInfo(recurrentToInputWeightsShape,
Derek Lambertif90c56d2020-01-10 17:14:08 +00004246 armnn::DataType::QAsymmU8,
alanhsu567886324fc2019-10-25 23:44:16 +08004247 weightsScale,
4248 weightsOffset);
4249 armnn::ConstTensor recurrentToInputWeights(recurrentToInputWeightsInfo, recurrentToInputWeightsData);
Jan Eilers5b01a892019-07-23 09:47:43 +01004250
alanhsu567886324fc2019-10-25 23:44:16 +08004251 armnn::TensorShape recurrentToForgetWeightsShape = {4, 4};
4252 std::vector<uint8_t> recurrentToForgetWeightsData = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16};
4253 armnn::TensorInfo recurrentToForgetWeightsInfo(recurrentToForgetWeightsShape,
Derek Lambertif90c56d2020-01-10 17:14:08 +00004254 armnn::DataType::QAsymmU8,
alanhsu567886324fc2019-10-25 23:44:16 +08004255 weightsScale,
4256 weightsOffset);
4257 armnn::ConstTensor recurrentToForgetWeights(recurrentToForgetWeightsInfo, recurrentToForgetWeightsData);
Jan Eilers5b01a892019-07-23 09:47:43 +01004258
alanhsu567886324fc2019-10-25 23:44:16 +08004259 armnn::TensorShape recurrentToCellWeightsShape = {4, 4};
4260 std::vector<uint8_t> recurrentToCellWeightsData = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16};
4261 armnn::TensorInfo recurrentToCellWeightsInfo(recurrentToCellWeightsShape,
Derek Lambertif90c56d2020-01-10 17:14:08 +00004262 armnn::DataType::QAsymmU8,
alanhsu567886324fc2019-10-25 23:44:16 +08004263 weightsScale,
4264 weightsOffset);
4265 armnn::ConstTensor recurrentToCellWeights(recurrentToCellWeightsInfo, recurrentToCellWeightsData);
Jan Eilers5b01a892019-07-23 09:47:43 +01004266
alanhsu567886324fc2019-10-25 23:44:16 +08004267 armnn::TensorShape recurrentToOutputWeightsShape = {4, 4};
4268 std::vector<uint8_t> recurrentToOutputWeightsData = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16};
4269 armnn::TensorInfo recurrentToOutputWeightsInfo(recurrentToOutputWeightsShape,
Derek Lambertif90c56d2020-01-10 17:14:08 +00004270 armnn::DataType::QAsymmU8,
alanhsu567886324fc2019-10-25 23:44:16 +08004271 weightsScale,
4272 weightsOffset);
4273 armnn::ConstTensor recurrentToOutputWeights(recurrentToOutputWeightsInfo, recurrentToOutputWeightsData);
Jan Eilers5b01a892019-07-23 09:47:43 +01004274
alanhsu567886324fc2019-10-25 23:44:16 +08004275 // The shape of bias data is {outputSize} = {4}
4276 armnn::TensorShape inputGateBiasShape = {4};
4277 std::vector<int32_t> inputGateBiasData = {1, 2, 3, 4};
4278 armnn::TensorInfo inputGateBiasInfo(inputGateBiasShape,
4279 armnn::DataType::Signed32,
4280 biasScale,
4281 biasOffset);
4282 armnn::ConstTensor inputGateBias(inputGateBiasInfo, inputGateBiasData);
4283
4284 armnn::TensorShape forgetGateBiasShape = {4};
4285 std::vector<int32_t> forgetGateBiasData = {1, 2, 3, 4};
4286 armnn::TensorInfo forgetGateBiasInfo(forgetGateBiasShape,
4287 armnn::DataType::Signed32,
4288 biasScale,
4289 biasOffset);
4290 armnn::ConstTensor forgetGateBias(forgetGateBiasInfo, forgetGateBiasData);
4291
4292 armnn::TensorShape cellBiasShape = {4};
4293 std::vector<int32_t> cellBiasData = {1, 2, 3, 4};
4294 armnn::TensorInfo cellBiasInfo(cellBiasShape,
4295 armnn::DataType::Signed32,
4296 biasScale,
4297 biasOffset);
4298 armnn::ConstTensor cellBias(cellBiasInfo, cellBiasData);
4299
4300 armnn::TensorShape outputGateBiasShape = {4};
4301 std::vector<int32_t> outputGateBiasData = {1, 2, 3, 4};
4302 armnn::TensorInfo outputGateBiasInfo(outputGateBiasShape,
4303 armnn::DataType::Signed32,
4304 biasScale,
4305 biasOffset);
4306 armnn::ConstTensor outputGateBias(outputGateBiasInfo, outputGateBiasData);
Jan Eilers5b01a892019-07-23 09:47:43 +01004307
4308 armnn::QuantizedLstmInputParams params;
4309 params.m_InputToInputWeights = &inputToInputWeights;
4310 params.m_InputToForgetWeights = &inputToForgetWeights;
4311 params.m_InputToCellWeights = &inputToCellWeights;
4312 params.m_InputToOutputWeights = &inputToOutputWeights;
4313 params.m_RecurrentToInputWeights = &recurrentToInputWeights;
4314 params.m_RecurrentToForgetWeights = &recurrentToForgetWeights;
4315 params.m_RecurrentToCellWeights = &recurrentToCellWeights;
4316 params.m_RecurrentToOutputWeights = &recurrentToOutputWeights;
4317 params.m_InputGateBias = &inputGateBias;
4318 params.m_ForgetGateBias = &forgetGateBias;
4319 params.m_CellBias = &cellBias;
4320 params.m_OutputGateBias = &outputGateBias;
4321
4322 armnn::INetworkPtr network = armnn::INetwork::Create();
alanhsu567886324fc2019-10-25 23:44:16 +08004323 armnn::IConnectableLayer* const inputLayer = network->AddInputLayer(0);
Jan Eilers5b01a892019-07-23 09:47:43 +01004324 armnn::IConnectableLayer* const cellStateIn = network->AddInputLayer(1);
4325 armnn::IConnectableLayer* const outputStateIn = network->AddInputLayer(2);
4326 const std::string layerName("QuantizedLstm");
4327 armnn::IConnectableLayer* const quantizedLstmLayer = network->AddQuantizedLstmLayer(params, layerName.c_str());
alanhsu567886324fc2019-10-25 23:44:16 +08004328 armnn::IConnectableLayer* const cellStateOut = network->AddOutputLayer(0);
4329 armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(1);
Jan Eilers5b01a892019-07-23 09:47:43 +01004330
alanhsu567886324fc2019-10-25 23:44:16 +08004331 // Connect up
4332 armnn::TensorInfo inputTensorInfo({ batchSize, inputSize },
Derek Lambertif90c56d2020-01-10 17:14:08 +00004333 armnn::DataType::QAsymmU8,
alanhsu567886324fc2019-10-25 23:44:16 +08004334 inputOutputScale,
4335 inputOutputOffset);
4336 armnn::TensorInfo cellStateTensorInfo({ batchSize, numUnits },
Derek Lambertif90c56d2020-01-10 17:14:08 +00004337 armnn::DataType::QSymmS16,
alanhsu567886324fc2019-10-25 23:44:16 +08004338 cellStateScale,
4339 cellStateOffset);
4340 armnn::TensorInfo outputStateTensorInfo({ batchSize, outputSize },
Derek Lambertif90c56d2020-01-10 17:14:08 +00004341 armnn::DataType::QAsymmU8,
alanhsu567886324fc2019-10-25 23:44:16 +08004342 inputOutputScale,
4343 inputOutputOffset);
Jan Eilers5b01a892019-07-23 09:47:43 +01004344
4345 inputLayer->GetOutputSlot(0).Connect(quantizedLstmLayer->GetInputSlot(0));
4346 inputLayer->GetOutputSlot(0).SetTensorInfo(inputTensorInfo);
4347
4348 cellStateIn->GetOutputSlot(0).Connect(quantizedLstmLayer->GetInputSlot(1));
4349 cellStateIn->GetOutputSlot(0).SetTensorInfo(cellStateTensorInfo);
4350
4351 outputStateIn->GetOutputSlot(0).Connect(quantizedLstmLayer->GetInputSlot(2));
4352 outputStateIn->GetOutputSlot(0).SetTensorInfo(outputStateTensorInfo);
4353
4354 quantizedLstmLayer->GetOutputSlot(0).Connect(cellStateOut->GetInputSlot(0));
4355 quantizedLstmLayer->GetOutputSlot(0).SetTensorInfo(cellStateTensorInfo);
4356
4357 quantizedLstmLayer->GetOutputSlot(1).Connect(outputLayer->GetInputSlot(0));
4358 quantizedLstmLayer->GetOutputSlot(1).SetTensorInfo(outputStateTensorInfo);
4359
4360 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
4361 BOOST_CHECK(deserializedNetwork);
4362
alanhsu567886324fc2019-10-25 23:44:16 +08004363 VerifyQuantizedLstmLayer checker(layerName,
4364 {inputTensorInfo, cellStateTensorInfo, outputStateTensorInfo},
4365 {cellStateTensorInfo, outputStateTensorInfo},
4366 params);
Jan Eilers5b01a892019-07-23 09:47:43 +01004367
4368 deserializedNetwork->Accept(checker);
4369}
4370
James Conroy8d333182020-05-13 10:27:58 +01004371class VerifyQLstmLayer : public LayerVerifierBaseWithDescriptor<armnn::QLstmDescriptor>
4372{
4373public:
4374 VerifyQLstmLayer(const std::string& layerName,
4375 const std::vector<armnn::TensorInfo>& inputInfos,
4376 const std::vector<armnn::TensorInfo>& outputInfos,
4377 const armnn::QLstmDescriptor& descriptor,
4378 const armnn::LstmInputParams& inputParams)
4379 : LayerVerifierBaseWithDescriptor<armnn::QLstmDescriptor>(layerName, inputInfos, outputInfos, descriptor)
4380 , m_InputParams(inputParams) {}
4381
4382 void VisitQLstmLayer(const armnn::IConnectableLayer* layer,
4383 const armnn::QLstmDescriptor& descriptor,
4384 const armnn::LstmInputParams& params,
4385 const char* name)
4386 {
4387 VerifyNameAndConnections(layer, name);
4388 VerifyDescriptor(descriptor);
4389 VerifyInputParameters(params);
4390 }
4391
4392protected:
4393 void VerifyInputParameters(const armnn::LstmInputParams& params)
4394 {
4395 VerifyConstTensors(
4396 "m_InputToInputWeights", m_InputParams.m_InputToInputWeights, params.m_InputToInputWeights);
4397 VerifyConstTensors(
4398 "m_InputToForgetWeights", m_InputParams.m_InputToForgetWeights, params.m_InputToForgetWeights);
4399 VerifyConstTensors(
4400 "m_InputToCellWeights", m_InputParams.m_InputToCellWeights, params.m_InputToCellWeights);
4401 VerifyConstTensors(
4402 "m_InputToOutputWeights", m_InputParams.m_InputToOutputWeights, params.m_InputToOutputWeights);
4403 VerifyConstTensors(
4404 "m_RecurrentToInputWeights", m_InputParams.m_RecurrentToInputWeights, params.m_RecurrentToInputWeights);
4405 VerifyConstTensors(
4406 "m_RecurrentToForgetWeights", m_InputParams.m_RecurrentToForgetWeights, params.m_RecurrentToForgetWeights);
4407 VerifyConstTensors(
4408 "m_RecurrentToCellWeights", m_InputParams.m_RecurrentToCellWeights, params.m_RecurrentToCellWeights);
4409 VerifyConstTensors(
4410 "m_RecurrentToOutputWeights", m_InputParams.m_RecurrentToOutputWeights, params.m_RecurrentToOutputWeights);
4411 VerifyConstTensors(
4412 "m_CellToInputWeights", m_InputParams.m_CellToInputWeights, params.m_CellToInputWeights);
4413 VerifyConstTensors(
4414 "m_CellToForgetWeights", m_InputParams.m_CellToForgetWeights, params.m_CellToForgetWeights);
4415 VerifyConstTensors(
4416 "m_CellToOutputWeights", m_InputParams.m_CellToOutputWeights, params.m_CellToOutputWeights);
4417 VerifyConstTensors(
4418 "m_InputGateBias", m_InputParams.m_InputGateBias, params.m_InputGateBias);
4419 VerifyConstTensors(
4420 "m_ForgetGateBias", m_InputParams.m_ForgetGateBias, params.m_ForgetGateBias);
4421 VerifyConstTensors(
4422 "m_CellBias", m_InputParams.m_CellBias, params.m_CellBias);
4423 VerifyConstTensors(
4424 "m_OutputGateBias", m_InputParams.m_OutputGateBias, params.m_OutputGateBias);
4425 VerifyConstTensors(
4426 "m_ProjectionWeights", m_InputParams.m_ProjectionWeights, params.m_ProjectionWeights);
4427 VerifyConstTensors(
4428 "m_ProjectionBias", m_InputParams.m_ProjectionBias, params.m_ProjectionBias);
4429 VerifyConstTensors(
4430 "m_InputLayerNormWeights", m_InputParams.m_InputLayerNormWeights, params.m_InputLayerNormWeights);
4431 VerifyConstTensors(
4432 "m_ForgetLayerNormWeights", m_InputParams.m_ForgetLayerNormWeights, params.m_ForgetLayerNormWeights);
4433 VerifyConstTensors(
4434 "m_CellLayerNormWeights", m_InputParams.m_CellLayerNormWeights, params.m_CellLayerNormWeights);
4435 VerifyConstTensors(
4436 "m_OutputLayerNormWeights", m_InputParams.m_OutputLayerNormWeights, params.m_OutputLayerNormWeights);
4437 }
4438
4439private:
4440 armnn::LstmInputParams m_InputParams;
4441};
4442
4443BOOST_AUTO_TEST_CASE(SerializeDeserializeQLstmBasic)
4444{
4445 armnn::QLstmDescriptor descriptor;
4446
4447 descriptor.m_CifgEnabled = true;
4448 descriptor.m_ProjectionEnabled = false;
4449 descriptor.m_PeepholeEnabled = false;
4450 descriptor.m_LayerNormEnabled = false;
4451
4452 descriptor.m_CellClip = 0.0f;
4453 descriptor.m_ProjectionClip = 0.0f;
4454
4455 descriptor.m_InputIntermediateScale = 0.00001f;
4456 descriptor.m_ForgetIntermediateScale = 0.00001f;
4457 descriptor.m_CellIntermediateScale = 0.00001f;
4458 descriptor.m_OutputIntermediateScale = 0.00001f;
4459
4460 descriptor.m_HiddenStateScale = 0.07f;
4461 descriptor.m_HiddenStateZeroPoint = 0;
4462
4463 const unsigned int numBatches = 2;
4464 const unsigned int inputSize = 5;
4465 const unsigned int outputSize = 4;
4466 const unsigned int numUnits = 4;
4467
4468 // Scale/Offset quantization info
4469 float inputScale = 0.0078f;
4470 int32_t inputOffset = 0;
4471
4472 float outputScale = 0.0078f;
4473 int32_t outputOffset = 0;
4474
4475 float cellStateScale = 3.5002e-05f;
4476 int32_t cellStateOffset = 0;
4477
4478 float weightsScale = 0.007f;
4479 int32_t weightsOffset = 0;
4480
4481 float biasScale = 3.5002e-05f / 1024;
4482 int32_t biasOffset = 0;
4483
4484 // Weights and bias tensor and quantization info
4485 armnn::TensorInfo inputWeightsInfo({numUnits, inputSize},
4486 armnn::DataType::QSymmS8,
4487 weightsScale,
4488 weightsOffset);
4489
4490 armnn::TensorInfo recurrentWeightsInfo({numUnits, outputSize},
4491 armnn::DataType::QSymmS8,
4492 weightsScale,
4493 weightsOffset);
4494
4495 armnn::TensorInfo biasInfo({numUnits}, armnn::DataType::Signed32, biasScale, biasOffset);
4496
4497 std::vector<int8_t> inputToForgetWeightsData = GenerateRandomData<int8_t>(inputWeightsInfo.GetNumElements());
4498 std::vector<int8_t> inputToCellWeightsData = GenerateRandomData<int8_t>(inputWeightsInfo.GetNumElements());
4499 std::vector<int8_t> inputToOutputWeightsData = GenerateRandomData<int8_t>(inputWeightsInfo.GetNumElements());
4500
4501 armnn::ConstTensor inputToForgetWeights(inputWeightsInfo, inputToForgetWeightsData);
4502 armnn::ConstTensor inputToCellWeights(inputWeightsInfo, inputToCellWeightsData);
4503 armnn::ConstTensor inputToOutputWeights(inputWeightsInfo, inputToOutputWeightsData);
4504
4505 std::vector<int8_t> recurrentToForgetWeightsData =
4506 GenerateRandomData<int8_t>(recurrentWeightsInfo.GetNumElements());
4507 std::vector<int8_t> recurrentToCellWeightsData =
4508 GenerateRandomData<int8_t>(recurrentWeightsInfo.GetNumElements());
4509 std::vector<int8_t> recurrentToOutputWeightsData =
4510 GenerateRandomData<int8_t>(recurrentWeightsInfo.GetNumElements());
4511
4512 armnn::ConstTensor recurrentToForgetWeights(recurrentWeightsInfo, recurrentToForgetWeightsData);
4513 armnn::ConstTensor recurrentToCellWeights(recurrentWeightsInfo, recurrentToCellWeightsData);
4514 armnn::ConstTensor recurrentToOutputWeights(recurrentWeightsInfo, recurrentToOutputWeightsData);
4515
4516 std::vector<int32_t> forgetGateBiasData(numUnits, 1);
4517 std::vector<int32_t> cellBiasData(numUnits, 0);
4518 std::vector<int32_t> outputGateBiasData(numUnits, 0);
4519
4520 armnn::ConstTensor forgetGateBias(biasInfo, forgetGateBiasData);
4521 armnn::ConstTensor cellBias(biasInfo, cellBiasData);
4522 armnn::ConstTensor outputGateBias(biasInfo, outputGateBiasData);
4523
4524 // Set up params
4525 armnn::LstmInputParams params;
4526 params.m_InputToForgetWeights = &inputToForgetWeights;
4527 params.m_InputToCellWeights = &inputToCellWeights;
4528 params.m_InputToOutputWeights = &inputToOutputWeights;
4529
4530 params.m_RecurrentToForgetWeights = &recurrentToForgetWeights;
4531 params.m_RecurrentToCellWeights = &recurrentToCellWeights;
4532 params.m_RecurrentToOutputWeights = &recurrentToOutputWeights;
4533
4534 params.m_ForgetGateBias = &forgetGateBias;
4535 params.m_CellBias = &cellBias;
4536 params.m_OutputGateBias = &outputGateBias;
4537
4538 // Create network
4539 armnn::INetworkPtr network = armnn::INetwork::Create();
4540 const std::string layerName("qLstm");
4541
4542 armnn::IConnectableLayer* const input = network->AddInputLayer(0);
4543 armnn::IConnectableLayer* const outputStateIn = network->AddInputLayer(1);
4544 armnn::IConnectableLayer* const cellStateIn = network->AddInputLayer(2);
4545
4546 armnn::IConnectableLayer* const qLstmLayer = network->AddQLstmLayer(descriptor, params, layerName.c_str());
4547
4548 armnn::IConnectableLayer* const outputStateOut = network->AddOutputLayer(0);
4549 armnn::IConnectableLayer* const cellStateOut = network->AddOutputLayer(1);
4550 armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(2);
4551
4552 // Input/Output tensor info
4553 armnn::TensorInfo inputInfo({numBatches , inputSize},
4554 armnn::DataType::QAsymmS8,
4555 inputScale,
4556 inputOffset);
4557
4558 armnn::TensorInfo cellStateInfo({numBatches , numUnits},
4559 armnn::DataType::QSymmS16,
4560 cellStateScale,
4561 cellStateOffset);
4562
4563 armnn::TensorInfo outputStateInfo({numBatches , outputSize},
4564 armnn::DataType::QAsymmS8,
4565 outputScale,
4566 outputOffset);
4567
4568 // Connect input/output slots
4569 input->GetOutputSlot(0).Connect(qLstmLayer->GetInputSlot(0));
4570 input->GetOutputSlot(0).SetTensorInfo(inputInfo);
4571
4572 outputStateIn->GetOutputSlot(0).Connect(qLstmLayer->GetInputSlot(1));
4573 outputStateIn->GetOutputSlot(0).SetTensorInfo(cellStateInfo);
4574
4575 cellStateIn->GetOutputSlot(0).Connect(qLstmLayer->GetInputSlot(2));
4576 cellStateIn->GetOutputSlot(0).SetTensorInfo(outputStateInfo);
4577
4578 qLstmLayer->GetOutputSlot(0).Connect(outputStateOut->GetInputSlot(0));
4579 qLstmLayer->GetOutputSlot(0).SetTensorInfo(outputStateInfo);
4580
4581 qLstmLayer->GetOutputSlot(1).Connect(cellStateOut->GetInputSlot(0));
4582 qLstmLayer->GetOutputSlot(1).SetTensorInfo(cellStateInfo);
4583
4584 qLstmLayer->GetOutputSlot(2).Connect(outputLayer->GetInputSlot(0));
4585 qLstmLayer->GetOutputSlot(2).SetTensorInfo(outputStateInfo);
4586
4587 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
4588 BOOST_CHECK(deserializedNetwork);
4589
4590 VerifyQLstmLayer checker(layerName,
4591 {inputInfo, cellStateInfo, outputStateInfo},
4592 {outputStateInfo, cellStateInfo, outputStateInfo},
4593 descriptor,
4594 params);
4595
4596 deserializedNetwork->Accept(checker);
4597}
4598
4599BOOST_AUTO_TEST_CASE(SerializeDeserializeQLstmCifgLayerNorm)
4600{
4601 armnn::QLstmDescriptor descriptor;
4602
4603 // CIFG params are used when CIFG is disabled
4604 descriptor.m_CifgEnabled = true;
4605 descriptor.m_ProjectionEnabled = false;
4606 descriptor.m_PeepholeEnabled = false;
4607 descriptor.m_LayerNormEnabled = true;
4608
4609 descriptor.m_CellClip = 0.0f;
4610 descriptor.m_ProjectionClip = 0.0f;
4611
4612 descriptor.m_InputIntermediateScale = 0.00001f;
4613 descriptor.m_ForgetIntermediateScale = 0.00001f;
4614 descriptor.m_CellIntermediateScale = 0.00001f;
4615 descriptor.m_OutputIntermediateScale = 0.00001f;
4616
4617 descriptor.m_HiddenStateScale = 0.07f;
4618 descriptor.m_HiddenStateZeroPoint = 0;
4619
4620 const unsigned int numBatches = 2;
4621 const unsigned int inputSize = 5;
4622 const unsigned int outputSize = 4;
4623 const unsigned int numUnits = 4;
4624
4625 // Scale/Offset quantization info
4626 float inputScale = 0.0078f;
4627 int32_t inputOffset = 0;
4628
4629 float outputScale = 0.0078f;
4630 int32_t outputOffset = 0;
4631
4632 float cellStateScale = 3.5002e-05f;
4633 int32_t cellStateOffset = 0;
4634
4635 float weightsScale = 0.007f;
4636 int32_t weightsOffset = 0;
4637
4638 float layerNormScale = 3.5002e-05f;
4639 int32_t layerNormOffset = 0;
4640
4641 float biasScale = layerNormScale / 1024;
4642 int32_t biasOffset = 0;
4643
4644 // Weights and bias tensor and quantization info
4645 armnn::TensorInfo inputWeightsInfo({numUnits, inputSize},
4646 armnn::DataType::QSymmS8,
4647 weightsScale,
4648 weightsOffset);
4649
4650 armnn::TensorInfo recurrentWeightsInfo({numUnits, outputSize},
4651 armnn::DataType::QSymmS8,
4652 weightsScale,
4653 weightsOffset);
4654
4655 armnn::TensorInfo biasInfo({numUnits},
4656 armnn::DataType::Signed32,
4657 biasScale,
4658 biasOffset);
4659
4660 armnn::TensorInfo layerNormWeightsInfo({numUnits},
4661 armnn::DataType::QSymmS16,
4662 layerNormScale,
4663 layerNormOffset);
4664
4665 // Mandatory params
4666 std::vector<int8_t> inputToForgetWeightsData = GenerateRandomData<int8_t>(inputWeightsInfo.GetNumElements());
4667 std::vector<int8_t> inputToCellWeightsData = GenerateRandomData<int8_t>(inputWeightsInfo.GetNumElements());
4668 std::vector<int8_t> inputToOutputWeightsData = GenerateRandomData<int8_t>(inputWeightsInfo.GetNumElements());
4669
4670 armnn::ConstTensor inputToForgetWeights(inputWeightsInfo, inputToForgetWeightsData);
4671 armnn::ConstTensor inputToCellWeights(inputWeightsInfo, inputToCellWeightsData);
4672 armnn::ConstTensor inputToOutputWeights(inputWeightsInfo, inputToOutputWeightsData);
4673
4674 std::vector<int8_t> recurrentToForgetWeightsData =
4675 GenerateRandomData<int8_t>(recurrentWeightsInfo.GetNumElements());
4676 std::vector<int8_t> recurrentToCellWeightsData =
4677 GenerateRandomData<int8_t>(recurrentWeightsInfo.GetNumElements());
4678 std::vector<int8_t> recurrentToOutputWeightsData =
4679 GenerateRandomData<int8_t>(recurrentWeightsInfo.GetNumElements());
4680
4681 armnn::ConstTensor recurrentToForgetWeights(recurrentWeightsInfo, recurrentToForgetWeightsData);
4682 armnn::ConstTensor recurrentToCellWeights(recurrentWeightsInfo, recurrentToCellWeightsData);
4683 armnn::ConstTensor recurrentToOutputWeights(recurrentWeightsInfo, recurrentToOutputWeightsData);
4684
4685 std::vector<int32_t> forgetGateBiasData(numUnits, 1);
4686 std::vector<int32_t> cellBiasData(numUnits, 0);
4687 std::vector<int32_t> outputGateBiasData(numUnits, 0);
4688
4689 armnn::ConstTensor forgetGateBias(biasInfo, forgetGateBiasData);
4690 armnn::ConstTensor cellBias(biasInfo, cellBiasData);
4691 armnn::ConstTensor outputGateBias(biasInfo, outputGateBiasData);
4692
4693 // Layer Norm
4694 std::vector<int16_t> forgetLayerNormWeightsData =
4695 GenerateRandomData<int16_t>(layerNormWeightsInfo.GetNumElements());
4696 std::vector<int16_t> cellLayerNormWeightsData =
4697 GenerateRandomData<int16_t>(layerNormWeightsInfo.GetNumElements());
4698 std::vector<int16_t> outputLayerNormWeightsData =
4699 GenerateRandomData<int16_t>(layerNormWeightsInfo.GetNumElements());
4700
4701 armnn::ConstTensor forgetLayerNormWeights(layerNormWeightsInfo, forgetLayerNormWeightsData);
4702 armnn::ConstTensor cellLayerNormWeights(layerNormWeightsInfo, cellLayerNormWeightsData);
4703 armnn::ConstTensor outputLayerNormWeights(layerNormWeightsInfo, outputLayerNormWeightsData);
4704
4705 // Set up params
4706 armnn::LstmInputParams params;
4707
4708 // Mandatory params
4709 params.m_InputToForgetWeights = &inputToForgetWeights;
4710 params.m_InputToCellWeights = &inputToCellWeights;
4711 params.m_InputToOutputWeights = &inputToOutputWeights;
4712
4713 params.m_RecurrentToForgetWeights = &recurrentToForgetWeights;
4714 params.m_RecurrentToCellWeights = &recurrentToCellWeights;
4715 params.m_RecurrentToOutputWeights = &recurrentToOutputWeights;
4716
4717 params.m_ForgetGateBias = &forgetGateBias;
4718 params.m_CellBias = &cellBias;
4719 params.m_OutputGateBias = &outputGateBias;
4720
4721 // Layer Norm
4722 params.m_ForgetLayerNormWeights = &forgetLayerNormWeights;
4723 params.m_CellLayerNormWeights = &cellLayerNormWeights;
4724 params.m_OutputLayerNormWeights = &outputLayerNormWeights;
4725
4726 // Create network
4727 armnn::INetworkPtr network = armnn::INetwork::Create();
4728 const std::string layerName("qLstm");
4729
4730 armnn::IConnectableLayer* const input = network->AddInputLayer(0);
4731 armnn::IConnectableLayer* const outputStateIn = network->AddInputLayer(1);
4732 armnn::IConnectableLayer* const cellStateIn = network->AddInputLayer(2);
4733
4734 armnn::IConnectableLayer* const qLstmLayer = network->AddQLstmLayer(descriptor, params, layerName.c_str());
4735
4736 armnn::IConnectableLayer* const outputStateOut = network->AddOutputLayer(0);
4737 armnn::IConnectableLayer* const cellStateOut = network->AddOutputLayer(1);
4738 armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(2);
4739
4740 // Input/Output tensor info
4741 armnn::TensorInfo inputInfo({numBatches , inputSize},
4742 armnn::DataType::QAsymmS8,
4743 inputScale,
4744 inputOffset);
4745
4746 armnn::TensorInfo cellStateInfo({numBatches , numUnits},
4747 armnn::DataType::QSymmS16,
4748 cellStateScale,
4749 cellStateOffset);
4750
4751 armnn::TensorInfo outputStateInfo({numBatches , outputSize},
4752 armnn::DataType::QAsymmS8,
4753 outputScale,
4754 outputOffset);
4755
4756 // Connect input/output slots
4757 input->GetOutputSlot(0).Connect(qLstmLayer->GetInputSlot(0));
4758 input->GetOutputSlot(0).SetTensorInfo(inputInfo);
4759
4760 outputStateIn->GetOutputSlot(0).Connect(qLstmLayer->GetInputSlot(1));
4761 outputStateIn->GetOutputSlot(0).SetTensorInfo(cellStateInfo);
4762
4763 cellStateIn->GetOutputSlot(0).Connect(qLstmLayer->GetInputSlot(2));
4764 cellStateIn->GetOutputSlot(0).SetTensorInfo(outputStateInfo);
4765
4766 qLstmLayer->GetOutputSlot(0).Connect(outputStateOut->GetInputSlot(0));
4767 qLstmLayer->GetOutputSlot(0).SetTensorInfo(outputStateInfo);
4768
4769 qLstmLayer->GetOutputSlot(1).Connect(cellStateOut->GetInputSlot(0));
4770 qLstmLayer->GetOutputSlot(1).SetTensorInfo(cellStateInfo);
4771
4772 qLstmLayer->GetOutputSlot(2).Connect(outputLayer->GetInputSlot(0));
4773 qLstmLayer->GetOutputSlot(2).SetTensorInfo(outputStateInfo);
4774
4775 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
4776 BOOST_CHECK(deserializedNetwork);
4777
4778 VerifyQLstmLayer checker(layerName,
4779 {inputInfo, cellStateInfo, outputStateInfo},
4780 {outputStateInfo, cellStateInfo, outputStateInfo},
4781 descriptor,
4782 params);
4783
4784 deserializedNetwork->Accept(checker);
4785}
4786
4787BOOST_AUTO_TEST_CASE(SerializeDeserializeQLstmAdvanced)
4788{
4789 armnn::QLstmDescriptor descriptor;
4790
4791 descriptor.m_CifgEnabled = false;
4792 descriptor.m_ProjectionEnabled = true;
4793 descriptor.m_PeepholeEnabled = true;
4794 descriptor.m_LayerNormEnabled = true;
4795
4796 descriptor.m_CellClip = 0.1f;
4797 descriptor.m_ProjectionClip = 0.1f;
4798
4799 descriptor.m_InputIntermediateScale = 0.00001f;
4800 descriptor.m_ForgetIntermediateScale = 0.00001f;
4801 descriptor.m_CellIntermediateScale = 0.00001f;
4802 descriptor.m_OutputIntermediateScale = 0.00001f;
4803
4804 descriptor.m_HiddenStateScale = 0.07f;
4805 descriptor.m_HiddenStateZeroPoint = 0;
4806
4807 const unsigned int numBatches = 2;
4808 const unsigned int inputSize = 5;
4809 const unsigned int outputSize = 4;
4810 const unsigned int numUnits = 4;
4811
4812 // Scale/Offset quantization info
4813 float inputScale = 0.0078f;
4814 int32_t inputOffset = 0;
4815
4816 float outputScale = 0.0078f;
4817 int32_t outputOffset = 0;
4818
4819 float cellStateScale = 3.5002e-05f;
4820 int32_t cellStateOffset = 0;
4821
4822 float weightsScale = 0.007f;
4823 int32_t weightsOffset = 0;
4824
4825 float layerNormScale = 3.5002e-05f;
4826 int32_t layerNormOffset = 0;
4827
4828 float biasScale = layerNormScale / 1024;
4829 int32_t biasOffset = 0;
4830
4831 // Weights and bias tensor and quantization info
4832 armnn::TensorInfo inputWeightsInfo({numUnits, inputSize},
4833 armnn::DataType::QSymmS8,
4834 weightsScale,
4835 weightsOffset);
4836
4837 armnn::TensorInfo recurrentWeightsInfo({numUnits, outputSize},
4838 armnn::DataType::QSymmS8,
4839 weightsScale,
4840 weightsOffset);
4841
4842 armnn::TensorInfo biasInfo({numUnits},
4843 armnn::DataType::Signed32,
4844 biasScale,
4845 biasOffset);
4846
4847 armnn::TensorInfo peepholeWeightsInfo({numUnits},
4848 armnn::DataType::QSymmS16,
4849 weightsScale,
4850 weightsOffset);
4851
4852 armnn::TensorInfo layerNormWeightsInfo({numUnits},
4853 armnn::DataType::QSymmS16,
4854 layerNormScale,
4855 layerNormOffset);
4856
4857 armnn::TensorInfo projectionWeightsInfo({outputSize, numUnits},
4858 armnn::DataType::QSymmS8,
4859 weightsScale,
4860 weightsOffset);
4861
4862 // Mandatory params
4863 std::vector<int8_t> inputToForgetWeightsData = GenerateRandomData<int8_t>(inputWeightsInfo.GetNumElements());
4864 std::vector<int8_t> inputToCellWeightsData = GenerateRandomData<int8_t>(inputWeightsInfo.GetNumElements());
4865 std::vector<int8_t> inputToOutputWeightsData = GenerateRandomData<int8_t>(inputWeightsInfo.GetNumElements());
4866
4867 armnn::ConstTensor inputToForgetWeights(inputWeightsInfo, inputToForgetWeightsData);
4868 armnn::ConstTensor inputToCellWeights(inputWeightsInfo, inputToCellWeightsData);
4869 armnn::ConstTensor inputToOutputWeights(inputWeightsInfo, inputToOutputWeightsData);
4870
4871 std::vector<int8_t> recurrentToForgetWeightsData =
4872 GenerateRandomData<int8_t>(recurrentWeightsInfo.GetNumElements());
4873 std::vector<int8_t> recurrentToCellWeightsData =
4874 GenerateRandomData<int8_t>(recurrentWeightsInfo.GetNumElements());
4875 std::vector<int8_t> recurrentToOutputWeightsData =
4876 GenerateRandomData<int8_t>(recurrentWeightsInfo.GetNumElements());
4877
4878 armnn::ConstTensor recurrentToForgetWeights(recurrentWeightsInfo, recurrentToForgetWeightsData);
4879 armnn::ConstTensor recurrentToCellWeights(recurrentWeightsInfo, recurrentToCellWeightsData);
4880 armnn::ConstTensor recurrentToOutputWeights(recurrentWeightsInfo, recurrentToOutputWeightsData);
4881
4882 std::vector<int32_t> forgetGateBiasData(numUnits, 1);
4883 std::vector<int32_t> cellBiasData(numUnits, 0);
4884 std::vector<int32_t> outputGateBiasData(numUnits, 0);
4885
4886 armnn::ConstTensor forgetGateBias(biasInfo, forgetGateBiasData);
4887 armnn::ConstTensor cellBias(biasInfo, cellBiasData);
4888 armnn::ConstTensor outputGateBias(biasInfo, outputGateBiasData);
4889
4890 // CIFG
4891 std::vector<int8_t> inputToInputWeightsData = GenerateRandomData<int8_t>(inputWeightsInfo.GetNumElements());
4892 std::vector<int8_t> recurrentToInputWeightsData =
4893 GenerateRandomData<int8_t>(recurrentWeightsInfo.GetNumElements());
4894 std::vector<int32_t> inputGateBiasData(numUnits, 1);
4895
4896 armnn::ConstTensor inputToInputWeights(inputWeightsInfo, inputToInputWeightsData);
4897 armnn::ConstTensor recurrentToInputWeights(recurrentWeightsInfo, recurrentToInputWeightsData);
4898 armnn::ConstTensor inputGateBias(biasInfo, inputGateBiasData);
4899
4900 // Peephole
4901 std::vector<int16_t> cellToInputWeightsData = GenerateRandomData<int16_t>(peepholeWeightsInfo.GetNumElements());
4902 std::vector<int16_t> cellToForgetWeightsData = GenerateRandomData<int16_t>(peepholeWeightsInfo.GetNumElements());
4903 std::vector<int16_t> cellToOutputWeightsData = GenerateRandomData<int16_t>(peepholeWeightsInfo.GetNumElements());
4904
4905 armnn::ConstTensor cellToInputWeights(peepholeWeightsInfo, cellToInputWeightsData);
4906 armnn::ConstTensor cellToForgetWeights(peepholeWeightsInfo, cellToForgetWeightsData);
4907 armnn::ConstTensor cellToOutputWeights(peepholeWeightsInfo, cellToOutputWeightsData);
4908
4909 // Projection
4910 std::vector<int8_t> projectionWeightsData = GenerateRandomData<int8_t>(projectionWeightsInfo.GetNumElements());
4911 std::vector<int32_t> projectionBiasData(outputSize, 1);
4912
4913 armnn::ConstTensor projectionWeights(projectionWeightsInfo, projectionWeightsData);
4914 armnn::ConstTensor projectionBias(biasInfo, projectionBiasData);
4915
4916 // Layer Norm
4917 std::vector<int16_t> inputLayerNormWeightsData =
4918 GenerateRandomData<int16_t>(layerNormWeightsInfo.GetNumElements());
4919 std::vector<int16_t> forgetLayerNormWeightsData =
4920 GenerateRandomData<int16_t>(layerNormWeightsInfo.GetNumElements());
4921 std::vector<int16_t> cellLayerNormWeightsData =
4922 GenerateRandomData<int16_t>(layerNormWeightsInfo.GetNumElements());
4923 std::vector<int16_t> outputLayerNormWeightsData =
4924 GenerateRandomData<int16_t>(layerNormWeightsInfo.GetNumElements());
4925
4926 armnn::ConstTensor inputLayerNormWeights(layerNormWeightsInfo, inputLayerNormWeightsData);
4927 armnn::ConstTensor forgetLayerNormWeights(layerNormWeightsInfo, forgetLayerNormWeightsData);
4928 armnn::ConstTensor cellLayerNormWeights(layerNormWeightsInfo, cellLayerNormWeightsData);
4929 armnn::ConstTensor outputLayerNormWeights(layerNormWeightsInfo, outputLayerNormWeightsData);
4930
4931 // Set up params
4932 armnn::LstmInputParams params;
4933
4934 // Mandatory params
4935 params.m_InputToForgetWeights = &inputToForgetWeights;
4936 params.m_InputToCellWeights = &inputToCellWeights;
4937 params.m_InputToOutputWeights = &inputToOutputWeights;
4938
4939 params.m_RecurrentToForgetWeights = &recurrentToForgetWeights;
4940 params.m_RecurrentToCellWeights = &recurrentToCellWeights;
4941 params.m_RecurrentToOutputWeights = &recurrentToOutputWeights;
4942
4943 params.m_ForgetGateBias = &forgetGateBias;
4944 params.m_CellBias = &cellBias;
4945 params.m_OutputGateBias = &outputGateBias;
4946
4947 // CIFG
4948 params.m_InputToInputWeights = &inputToInputWeights;
4949 params.m_RecurrentToInputWeights = &recurrentToInputWeights;
4950 params.m_InputGateBias = &inputGateBias;
4951
4952 // Peephole
4953 params.m_CellToInputWeights = &cellToInputWeights;
4954 params.m_CellToForgetWeights = &cellToForgetWeights;
4955 params.m_CellToOutputWeights = &cellToOutputWeights;
4956
4957 // Projection
4958 params.m_ProjectionWeights = &projectionWeights;
4959 params.m_ProjectionBias = &projectionBias;
4960
4961 // Layer Norm
4962 params.m_InputLayerNormWeights = &inputLayerNormWeights;
4963 params.m_ForgetLayerNormWeights = &forgetLayerNormWeights;
4964 params.m_CellLayerNormWeights = &cellLayerNormWeights;
4965 params.m_OutputLayerNormWeights = &outputLayerNormWeights;
4966
4967 // Create network
4968 armnn::INetworkPtr network = armnn::INetwork::Create();
4969 const std::string layerName("qLstm");
4970
4971 armnn::IConnectableLayer* const input = network->AddInputLayer(0);
4972 armnn::IConnectableLayer* const outputStateIn = network->AddInputLayer(1);
4973 armnn::IConnectableLayer* const cellStateIn = network->AddInputLayer(2);
4974
4975 armnn::IConnectableLayer* const qLstmLayer = network->AddQLstmLayer(descriptor, params, layerName.c_str());
4976
4977 armnn::IConnectableLayer* const outputStateOut = network->AddOutputLayer(0);
4978 armnn::IConnectableLayer* const cellStateOut = network->AddOutputLayer(1);
4979 armnn::IConnectableLayer* const outputLayer = network->AddOutputLayer(2);
4980
4981 // Input/Output tensor info
4982 armnn::TensorInfo inputInfo({numBatches , inputSize},
4983 armnn::DataType::QAsymmS8,
4984 inputScale,
4985 inputOffset);
4986
4987 armnn::TensorInfo cellStateInfo({numBatches , numUnits},
4988 armnn::DataType::QSymmS16,
4989 cellStateScale,
4990 cellStateOffset);
4991
4992 armnn::TensorInfo outputStateInfo({numBatches , outputSize},
4993 armnn::DataType::QAsymmS8,
4994 outputScale,
4995 outputOffset);
4996
4997 // Connect input/output slots
4998 input->GetOutputSlot(0).Connect(qLstmLayer->GetInputSlot(0));
4999 input->GetOutputSlot(0).SetTensorInfo(inputInfo);
5000
5001 outputStateIn->GetOutputSlot(0).Connect(qLstmLayer->GetInputSlot(1));
5002 outputStateIn->GetOutputSlot(0).SetTensorInfo(cellStateInfo);
5003
5004 cellStateIn->GetOutputSlot(0).Connect(qLstmLayer->GetInputSlot(2));
5005 cellStateIn->GetOutputSlot(0).SetTensorInfo(outputStateInfo);
5006
5007 qLstmLayer->GetOutputSlot(0).Connect(outputStateOut->GetInputSlot(0));
5008 qLstmLayer->GetOutputSlot(0).SetTensorInfo(outputStateInfo);
5009
5010 qLstmLayer->GetOutputSlot(1).Connect(cellStateOut->GetInputSlot(0));
5011 qLstmLayer->GetOutputSlot(1).SetTensorInfo(cellStateInfo);
5012
5013 qLstmLayer->GetOutputSlot(2).Connect(outputLayer->GetInputSlot(0));
5014 qLstmLayer->GetOutputSlot(2).SetTensorInfo(outputStateInfo);
5015
5016 armnn::INetworkPtr deserializedNetwork = DeserializeNetwork(SerializeNetwork(*network));
5017 BOOST_CHECK(deserializedNetwork);
5018
5019 VerifyQLstmLayer checker(layerName,
5020 {inputInfo, cellStateInfo, outputStateInfo},
5021 {outputStateInfo, cellStateInfo, outputStateInfo},
5022 descriptor,
5023 params);
5024
5025 deserializedNetwork->Accept(checker);
5026}
5027
Nattapat Chaimanowong30b00202019-02-20 17:31:34 +00005028BOOST_AUTO_TEST_SUITE_END()