ArmNN
 21.02
DeserializeFill.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #include <boost/test/unit_test.hpp>
9 
10 #include <string>
11 
12 BOOST_AUTO_TEST_SUITE(Deserializer)
13 
14 struct FillFixture : public ParserFlatbuffersSerializeFixture
15 {
16  explicit FillFixture()
17  {
18  m_JsonString = R"(
19  {
20  layers: [
21  {
22  layer_type: "InputLayer",
23  layer: {
24  base: {
25  base: {
26  layerName: "InputLayer",
27  layerType: "Input",
28  inputSlots: [
29 
30  ],
31  outputSlots: [
32  {
33  tensorInfo: {
34  dimensions: [
35  4
36  ],
37  dataType: "Signed32",
38  quantizationScale: 0.0
39  }
40  }
41  ]
42  }
43  }
44  }
45  },
46  {
47  layer_type: "FillLayer",
48  layer: {
49  base: {
50  index: 1,
51  layerName: "FillLayer",
52  layerType: "Fill",
53  inputSlots: [
54  {
55  connection: {
56  sourceLayerIndex: 0,
57  outputSlotIndex: 0
58  }
59  }
60  ],
61  outputSlots: [
62  {
63  tensorInfo: {
64  dimensions: [
65  1,
66  3,
67  3,
68  1
69  ],
70  dataType: "Float32",
71  quantizationScale: 0.0
72  }
73  }
74  ]
75  },
76  descriptor: {
77  value: 1.0
78  }
79  }
80  },
81  {
82  layer_type: "OutputLayer",
83  layer: {
84  base: {
85  base: {
86  index: 2,
87  layerName: "OutputLayer",
88  layerType: "Output",
89  inputSlots: [
90  {
91  connection: {
92  sourceLayerIndex: 1,
93  outputSlotIndex: 0
94  }
95  }
96  ],
97  outputSlots: [
98 
99  ]
100  }
101  }
102  }
103  }
104  ],
105  inputIds: [
106  0
107  ],
108  outputIds: [
109  0
110  ],
111  featureVersions: {
112  bindingIdsScheme: 1
113  }
114  }
115  )";
116  Setup();
117  }
118 };
119 
120 
121 struct SimpleFillFixture : FillFixture
122 {
123  SimpleFillFixture() : FillFixture() {}
124 };
125 
126 BOOST_FIXTURE_TEST_CASE(Fill, SimpleFillFixture)
127 {
128  RunTest<4, armnn::DataType::Signed32, armnn::DataType::Float32>(
129  0,
130  {{"InputLayer", { 1, 3, 3, 1 }}},
131  {{"OutputLayer",{ 1, 1, 1, 1, 1, 1, 1, 1, 1}}});
132 }
133 
BOOST_AUTO_TEST_SUITE(TensorflowLiteParser)
void Fill(Encoder< float > &output, const TensorShape &desiredOutputShape, const float value)
Creates a tensor and fills it with a scalar value.
Definition: Fill.cpp:13
BOOST_FIXTURE_TEST_CASE(Fill, SimpleFillFixture)
BOOST_AUTO_TEST_SUITE_END()