ArmNN
 22.05
DeserializeChannelShuffle.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2021 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
8 
9 #include <string>
10 
11 TEST_SUITE("Deserializer_ChannelShuffle")
12 {
13 struct ChannelShuffleFixture : public ParserFlatbuffersSerializeFixture
14 {
15  explicit ChannelShuffleFixture()
16  {
17  m_JsonString = R"(
18  {
19  layers: [
20  {
21  layer_type: "InputLayer",
22  layer: {
23  base: {
24  base: {
25  layerName: "InputLayer",
26  layerType: "Input",
27  inputSlots: [
28 
29  ],
30  outputSlots: [
31  {
32  tensorInfo: {
33  dimensions: [
34  3,
35  12
36  ],
37  dataType: "Float32",
38  quantizationScale: 0.0,
39  dimensionSpecificity: [
40  true,
41  true
42  ]
43  }
44  }
45  ]
46  }
47  }
48  }
49  },
50  {
51  layer_type: "ChannelShuffleLayer",
52  layer: {
53  base: {
54  index: 1,
55  layerName: "channelShuffle",
56  layerType: "ChannelShuffle",
57  inputSlots: [
58  {
59  connection: {
60  sourceLayerIndex: 0,
61  outputSlotIndex: 0
62  }
63  }
64  ],
65  outputSlots: [
66  {
67  tensorInfo: {
68  dimensions: [
69  3,
70  12
71  ],
72  dataType: "Float32",
73  quantizationScale: 0.0,
74  dimensionSpecificity: [
75  true,
76  true
77  ]
78  }
79  }
80  ]
81  },
82  descriptor: {
83  axis: 1,
84  numGroups: 3
85  }
86  }
87  },
88  {
89  layer_type: "OutputLayer",
90  layer: {
91  base: {
92  base: {
93  index: 2,
94  layerName: "OutputLayer",
95  layerType: "Output",
96  inputSlots: [
97  {
98  connection: {
99  sourceLayerIndex: 1,
100  outputSlotIndex: 0
101  }
102  }
103  ],
104  outputSlots: [
105 
106  ]
107  }
108  }
109  }
110  }
111  ],
112  inputIds: [
113  0
114  ],
115  outputIds: [
116  0
117  ],
118  featureVersions: {
119  bindingIdsScheme: 1,
120  weightsLayoutScheme: 1,
121  constantTensorsAsInputs: 1
122  }
123  }
124  )";
125  SetupSingleInputSingleOutput("InputLayer", "OutputLayer");
126  }
127 };
128 
129 struct SimpleChannelShuffleFixtureFloat32 : ChannelShuffleFixture
130 {
131  SimpleChannelShuffleFixtureFloat32() : ChannelShuffleFixture(){}
132 };
133 
134 TEST_CASE_FIXTURE(SimpleChannelShuffleFixtureFloat32, "ChannelShuffleFloat32")
135 {
136  RunTest<2, armnn::DataType::Float32>(0,
137  {{"InputLayer",
138  { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
139  12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
140  24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35}}},
141  {{"OutputLayer",
142  { 0, 4, 8, 1, 5, 9, 2, 6, 10, 3, 7, 11,
143  12, 16, 20, 13, 17, 21, 14, 18, 22, 15, 19, 23,
144  24, 28, 32, 25, 29, 33, 26, 30, 34, 27, 31, 35 }}});
145 }
146 }
void SetupSingleInputSingleOutput(const std::string &inputName, const std::string &outputName)
TEST_SUITE("Deserializer_ChannelShuffle")
TEST_CASE_FIXTURE(ClContextControlFixture, "CopyBetweenNeonAndGpu")