ArmNN
 22.08
DeserializeReduceSum.cpp File Reference
#include "ParserFlatbuffersSerializeFixture.hpp"
#include "../Deserializer.hpp"
#include <string>

Go to the source code of this file.

Functions

 TEST_SUITE ("Deserializer_ReduceSum")
 

Function Documentation

◆ TEST_SUITE()

TEST_SUITE ( "Deserializer_ReduceSum"  )

Definition at line 11 of file DeserializeReduceSum.cpp.

References ParserFlatbuffersSerializeFixture::Setup(), and TEST_CASE_FIXTURE().

12 {
13 struct ReduceSumFixture : public ParserFlatbuffersSerializeFixture
14 {
15  explicit ReduceSumFixture(const std::string& inputShape,
16  const std::string& outputShape,
17  const std::string& axis,
18  const std::string& dataType)
19  {
20  m_JsonString = R"(
21  {
22  inputIds: [0],
23  outputIds: [2],
24  layers: [
25  {
26  layer_type: "InputLayer",
27  layer: {
28  base: {
29  layerBindingId: 0,
30  base: {
31  index: 0,
32  layerName: "InputLayer",
33  layerType: "Input",
34  inputSlots: [{
35  index: 0,
36  connection: {sourceLayerIndex:0, outputSlotIndex:0 },
37  }],
38  outputSlots: [{
39  index: 0,
40  tensorInfo: {
41  dimensions: )" + inputShape + R"(,
42  dataType: )" + dataType + R"(
43  }
44  }]
45  }
46  }
47  }
48  },
49  {
50  layer_type: "ReduceLayer",
51  layer: {
52  base: {
53  index: 1,
54  layerName: "ReduceSumLayer",
55  layerType: "Reduce",
56  inputSlots: [{
57  index: 0,
58  connection: {sourceLayerIndex:0, outputSlotIndex:0 },
59  }],
60  outputSlots: [{
61  index: 0,
62  tensorInfo: {
63  dimensions: )" + outputShape + R"(,
64  dataType: )" + dataType + R"(
65  }
66  }]
67  },
68  descriptor: {
69  axis: )" + axis + R"(,
70  keepDims: true,
71  reduceOperation: Sum
72  }
73  }
74  },
75  {
76  layer_type: "OutputLayer",
77  layer: {
78  base:{
79  layerBindingId: 2,
80  base: {
81  index: 2,
82  layerName: "OutputLayer",
83  layerType: "Output",
84  inputSlots: [{
85  index: 0,
86  connection: {sourceLayerIndex:1, outputSlotIndex:0 },
87  }],
88  outputSlots: [{
89  index: 0,
90  tensorInfo: {
91  dimensions: )" + outputShape + R"(,
92  dataType: )" + dataType + R"(
93  },
94  }],
95  }
96  }
97  },
98  }
99  ]
100  }
101  )";
102  Setup();
103  }
104 };
105 
106 struct SimpleReduceSumFixture : ReduceSumFixture
107 {
108  SimpleReduceSumFixture()
109  : ReduceSumFixture("[ 1, 1, 3, 2 ]", // inputShape
110  "[ 1, 1, 1, 2 ]", // outputShape
111  "[ 2 ]", // axis
112  "Float32") // dataType
113  {}
114 };
115 
116 TEST_CASE_FIXTURE(SimpleReduceSumFixture, "SimpleReduceSum")
117 {
118  RunTest<4, armnn::DataType::Float32>(
119  0,
120  {{"InputLayer", { 1.0f, 1.0f, 2.0f, 2.0f, 3.0f, 3.0f }}},
121  {{"OutputLayer", { 6.0f, 6.0f }}});
122 }
123 
124 }
TEST_CASE_FIXTURE(ClContextControlFixture, "CopyBetweenNeonAndGpu")