ArmNN
 21.11
DeserializeSpaceToBatchNd.cpp File Reference

Go to the source code of this file.

Functions

 TEST_SUITE ("Deserializer_SpaceToBatchND")
 

Function Documentation

◆ TEST_SUITE()

TEST_SUITE ( "Deserializer_SpaceToBatchND"  )

Definition at line 11 of file DeserializeSpaceToBatchNd.cpp.

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

12 {
13 struct SpaceToBatchNdFixture : public ParserFlatbuffersSerializeFixture
14 {
15  explicit SpaceToBatchNdFixture(const std::string &inputShape,
16  const std::string &blockShape,
17  const std::string &padList,
18  const std::string &dataLayout,
19  const std::string &outputShape,
20  const std::string &dataType)
21  {
22  m_JsonString = R"(
23  {
24  inputIds: [0],
25  outputIds: [2],
26  layers: [
27  {
28  layer_type: "InputLayer",
29  layer: {
30  base: {
31  layerBindingId: 0,
32  base: {
33  index: 0,
34  layerName: "InputLayer",
35  layerType: "Input",
36  inputSlots: [{
37  index: 0,
38  connection: {sourceLayerIndex:0, outputSlotIndex:0 },
39  }],
40  outputSlots: [{
41  index: 0,
42  tensorInfo: {
43  dimensions: )" + inputShape + R"(,
44  dataType: )" + dataType + R"(
45  }
46  }]
47  }
48  }
49  }
50  },
51  {
52  layer_type: "SpaceToBatchNdLayer",
53  layer: {
54  base: {
55  index: 1,
56  layerName: "SpaceToBatchNdLayer",
57  layerType: "SpaceToBatchNd",
58  inputSlots: [{
59  index: 0,
60  connection: {sourceLayerIndex:0, outputSlotIndex:0 },
61  }],
62  outputSlots: [{
63  index: 0,
64  tensorInfo: {
65  dimensions: )" + outputShape + R"(,
66  dataType: )" + dataType + R"(
67  }
68  }]
69  },
70  descriptor: {
71  blockShape: )" + blockShape + R"(,
72  padList: )" + padList + R"(,
73  dataLayout: )" + dataLayout + R"(,
74  }
75  }
76  },
77  {
78  layer_type: "OutputLayer",
79  layer: {
80  base:{
81  layerBindingId: 2,
82  base: {
83  index: 2,
84  layerName: "OutputLayer",
85  layerType: "Output",
86  inputSlots: [{
87  index: 0,
88  connection: {sourceLayerIndex:1, outputSlotIndex:0 },
89  }],
90  outputSlots: [{
91  index: 0,
92  tensorInfo: {
93  dimensions: )" + outputShape + R"(,
94  dataType: )" + dataType + R"(
95  },
96  }],
97  }
98  }
99  },
100  }
101  ]
102  }
103  )";
104  SetupSingleInputSingleOutput("InputLayer", "OutputLayer");
105  }
106 };
107 
108 struct SimpleSpaceToBatchNdFixture : SpaceToBatchNdFixture
109 {
110  SimpleSpaceToBatchNdFixture() : SpaceToBatchNdFixture("[ 2, 1, 2, 4 ]",
111  "[ 2, 2 ]",
112  "[ 0, 0, 2, 0 ]",
113  "NCHW",
114  "[ 8, 1, 1, 3 ]",
115  "Float32") {}
116 };
117 
118 TEST_CASE_FIXTURE(SimpleSpaceToBatchNdFixture, "SimpleBatchToSpaceNdFloat32")
119 {
120  RunTest<4, armnn::DataType::Float32>(0,
121  {
122  1.0f, 2.0f, 3.0f, 4.0f,
123  5.0f, 6.0f, 7.0f, 8.0f,
124  9.0f, 10.0f, 11.0f, 12.0f,
125  13.0f, 14.0f, 15.0f, 16.0f
126  },
127  {
128  0.0f, 1.0f, 3.0f,
129  0.0f, 9.0f, 11.0f,
130  0.0f, 2.0f, 4.0f,
131  0.0f, 10.0f, 12.0f,
132  0.0f, 5.0f, 7.0f,
133  0.0f, 13.0f, 15.0f,
134  0.0f, 6.0f, 8.0f,
135  0.0f, 14.0f, 16.0f
136  });
137 }
138 
139 }
void SetupSingleInputSingleOutput(const std::string &inputName, const std::string &outputName)
TEST_CASE_FIXTURE(ClContextControlFixture, "CopyBetweenNeonAndGpu")