ArmNN
 22.05.01
DeserializeSlice.cpp File Reference

Go to the source code of this file.

Functions

 TEST_SUITE ("Deserializer_Slice")
 

Function Documentation

◆ TEST_SUITE()

TEST_SUITE ( "Deserializer_Slice"  )

Definition at line 12 of file DeserializeSlice.cpp.

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

13 {
14 struct SliceFixture : public ParserFlatbuffersSerializeFixture
15 {
16  explicit SliceFixture(const std::string& inputShape,
17  const std::string& outputShape,
18  const std::string& begin,
19  const std::string& size,
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: "SliceLayer",
53  layer: {
54  base: {
55  index: 1,
56  layerName: "SliceLayer",
57  layerType: "Slice",
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  begin: )" + begin + R"(,
72  size: )" + size + R"(,
73  }
74  }
75  },
76  {
77  layer_type: "OutputLayer",
78  layer: {
79  base:{
80  layerBindingId: 2,
81  base: {
82  index: 2,
83  layerName: "OutputLayer",
84  layerType: "Output",
85  inputSlots: [{
86  index: 0,
87  connection: {sourceLayerIndex:1, outputSlotIndex:0 },
88  }],
89  outputSlots: [{
90  index: 0,
91  tensorInfo: {
92  dimensions: )" + outputShape + R"(,
93  dataType: )" + dataType + R"(
94  },
95  }],
96  }
97  }
98  },
99  }
100  ]
101  }
102  )";
103  SetupSingleInputSingleOutput("InputLayer", "OutputLayer");
104  }
105 };
106 
107 struct SimpleSliceFixture : SliceFixture
108 {
109  SimpleSliceFixture() : SliceFixture("[ 3, 2, 3, 5 ]", // input shape
110  "[ 2, 1, 2, 3 ]", // output shape
111  "[ 1, 0, 1, 2 ]", // begin
112  "[ 2, 1, 2, 3 ]", // size
113  "Float32") {} // data type
114 };
115 
116 TEST_CASE_FIXTURE(SimpleSliceFixture, "SimpleSliceFloat32")
117 {
118  RunTest<4, armnn::DataType::Float32>(
119  0,
120  {
121  0.f, 1.f, 2.f, 3.f, 4.f,
122  5.f, 6.f, 7.f, 8.f, 9.f,
123  10.f, 11.f, 12.f, 13.f, 14.f,
124 
125  15.f, 16.f, 17.f, 18.f, 19.f,
126  20.f, 21.f, 22.f, 23.f, 24.f,
127  25.f, 26.f, 27.f, 28.f, 29.f,
128 
129 
130  30.f, 31.f, 32.f, 33.f, 34.f,
131  35.f, 36.f, 37.f, 38.f, 39.f,
132  40.f, 41.f, 42.f, 43.f, 44.f,
133 
134  45.f, 46.f, 47.f, 48.f, 49.f,
135  50.f, 51.f, 52.f, 53.f, 54.f,
136  55.f, 56.f, 57.f, 58.f, 59.f,
137 
138 
139  60.f, 61.f, 62.f, 63.f, 64.f,
140  65.f, 66.f, 67.f, 68.f, 69.f,
141  70.f, 71.f, 72.f, 73.f, 74.f,
142 
143  75.f, 76.f, 77.f, 78.f, 79.f,
144  80.f, 81.f, 82.f, 83.f, 84.f,
145  85.f, 86.f, 87.f, 88.f, 89.f
146  },
147  {
148  37.f, 38.f, 39.f,
149  42.f, 43.f, 44.f,
150 
151  67.f, 68.f, 69.f,
152  72.f, 73.f, 74.f
153  });
154 }
155 
156 }
void SetupSingleInputSingleOutput(const std::string &inputName, const std::string &outputName)
TEST_CASE_FIXTURE(ClContextControlFixture, "CopyBetweenNeonAndGpu")