ArmNN
 20.02
DepthToSpaceTestImpl.hpp File Reference

Go to the source code of this file.

Functions

template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult< T, 4 > DepthToSpaceTest1 (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager, armnn::DataLayout dataLayout)
 
template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult< T, 4 > DepthToSpaceTest2 (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager, armnn::DataLayout dataLayout)
 
template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult< T, 4 > DepthToSpaceTest3 (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager, armnn::DataLayout dataLayout)
 
template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult< T, 4 > DepthToSpaceTest4 (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager, armnn::DataLayout dataLayout)
 

Function Documentation

◆ DepthToSpaceTest1()

LayerTestResult<T, 4> DepthToSpaceTest1 ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager,
armnn::DataLayout  dataLayout 
)

Definition at line 77 of file DepthToSpaceTestImpl.cpp.

References SpaceToDepthDescriptor::m_BlockSize, SpaceToDepthDescriptor::m_DataLayout, and QueueDescriptorWithParameters< LayerDescriptor >::m_Parameters.

81 {
82  unsigned int inputShape[] = { 1, 1, 1, 8 };
83  unsigned int outputShape[] = { 1, 2, 2, 2 };
84 
85  // in:
86  // [[[[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]]]]
87  //
88  // out:
89  // [[[[1, 2, 3], [4, 5, 6]],
90  // [[7, 8, 9], [10, 11, 12]]]]
91 
92  std::vector<float> input = { 1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, 8.f };
93  std::vector<float> expectedOutput = input;
94 
96  desc.m_Parameters.m_DataLayout = dataLayout;
97  desc.m_Parameters.m_BlockSize = 2;
98 
99  armnn::TensorInfo inputInfo(4, inputShape, ArmnnType);
100  armnn::TensorInfo outputInfo(4, outputShape, ArmnnType);
101 
102  return DepthToSpaceTestImpl<T>(workloadFactory, memoryManager, inputInfo, outputInfo, input, expectedOutput, desc);
103 }
unsigned int m_BlockSize
Scalar specifying the input block size. It must be >= 1.
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).

◆ DepthToSpaceTest2()

LayerTestResult<T, 4> DepthToSpaceTest2 ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager,
armnn::DataLayout  dataLayout 
)

Definition at line 106 of file DepthToSpaceTestImpl.cpp.

References SpaceToDepthDescriptor::m_BlockSize, SpaceToDepthDescriptor::m_DataLayout, and QueueDescriptorWithParameters< LayerDescriptor >::m_Parameters.

110 {
111  unsigned int inputShape[] = { 1, 2, 2, 4 };
112  unsigned int outputShape[] = { 1, 4, 4, 1 };
113 
114  // in:
115  // [[[[1, 2, 3, 4],
116  // [5, 6, 7, 8]],
117  // [[9, 10, 11, 12],
118  // [13, 14, 15, 16]]]]
119  //
120  // out:
121  // [[[ [1], [2], [5], [6]],
122  // [ [3], [4], [7], [8]],
123  // [ [9], [10], [13], [14]],
124  // [ [11], [12], [15], [16]]]]
125 
126  std::vector<float> input =
127  {
128  1.f, 2.f, 3.f, 4.f,
129 
130  5.f, 6.f, 7.f, 8.f,
131 
132  9.f, 10.f, 11.f, 12.f,
133 
134  13.f, 14.f, 15.f, 16.f
135  };
136 
137  std::vector<float> expectedOutput
138  {
139  1.f, 2.f, 5.f, 6.f,
140  3.f, 4.f, 7.f, 8.f,
141  9.f, 10.f, 13.f, 14.f,
142  11.f, 12.f, 15.f, 16.f
143  };
144 
146  desc.m_Parameters.m_DataLayout = dataLayout;
147  desc.m_Parameters.m_BlockSize = 2;
148 
149  armnn::TensorInfo inputInfo(4, inputShape, ArmnnType);
150  armnn::TensorInfo outputInfo(4, outputShape, ArmnnType);
151 
152  return DepthToSpaceTestImpl<T>(workloadFactory, memoryManager, inputInfo, outputInfo, input, expectedOutput, desc);
153 }
unsigned int m_BlockSize
Scalar specifying the input block size. It must be >= 1.
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).

◆ DepthToSpaceTest3()

LayerTestResult<T, 4> DepthToSpaceTest3 ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager,
armnn::DataLayout  dataLayout 
)

Definition at line 156 of file DepthToSpaceTestImpl.cpp.

References SpaceToDepthDescriptor::m_BlockSize, SpaceToDepthDescriptor::m_DataLayout, and QueueDescriptorWithParameters< LayerDescriptor >::m_Parameters.

160 {
161  unsigned int inputShape[] = { 2, 1, 1, 4 };
162  unsigned int outputShape[] = { 2, 2, 2, 1 };
163 
164  std::vector<float> input =
165  {
166  1.f, 2.f, 3.f, 4.f, // batch 0
167  5.f, 6.f, 7.f, 8.f // batch 1
168  };
169 
170  std::vector<float> expectedOutput = input;
171 
173  desc.m_Parameters.m_DataLayout = dataLayout;
174  desc.m_Parameters.m_BlockSize = 2;
175 
176  armnn::TensorInfo inputInfo(4, inputShape, ArmnnType);
177  armnn::TensorInfo outputInfo(4, outputShape, ArmnnType);
178 
179  return DepthToSpaceTestImpl<T>(workloadFactory, memoryManager, inputInfo, outputInfo, input, expectedOutput, desc);
180 }
unsigned int m_BlockSize
Scalar specifying the input block size. It must be >= 1.
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).

◆ DepthToSpaceTest4()

LayerTestResult<T, 4> DepthToSpaceTest4 ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager,
armnn::DataLayout  dataLayout 
)

Definition at line 183 of file DepthToSpaceTestImpl.cpp.

References SpaceToDepthDescriptor::m_BlockSize, SpaceToDepthDescriptor::m_DataLayout, and QueueDescriptorWithParameters< LayerDescriptor >::m_Parameters.

187 {
188  unsigned int inputShape[] = { 2, 2, 2, 4 };
189  unsigned int outputShape[] = { 2, 4, 4, 1 };
190 
191  std::vector<float> input =
192  {
193  1.f, 2.f, 3.f, 4.f,
194 
195  5.f, 6.f, 7.f, 8.f,
196 
197  9.f, 10.f, 11.f, 12.f,
198 
199  13.f, 14.f, 15.f, 16.f,
200 
201 
202  17.f, 18.f, 19.f, 20.f,
203 
204  21.f, 22.f, 23.f, 24.f,
205 
206  25.f, 26.f, 27.f, 28.f,
207 
208  29.f, 30.f, 31.f, 32.f
209  };
210 
211  std::vector<float> expectedOutput
212  {
213  1.f, 2.f, 5.f, 6.f,
214  3.f, 4.f, 7.f, 8.f,
215  9.f, 10.f, 13.f, 14.f,
216  11.f, 12.f, 15.f, 16.f,
217 
218 
219  17.f, 18.f, 21.f, 22.f,
220  19.f, 20.f, 23.f, 24.f,
221  25.f, 26.f, 29.f, 30.f,
222  27.f, 28.f, 31.f, 32.f
223  };
224 
226  desc.m_Parameters.m_DataLayout = dataLayout;
227  desc.m_Parameters.m_BlockSize = 2;
228 
229  armnn::TensorInfo inputInfo(4, inputShape, ArmnnType);
230  armnn::TensorInfo outputInfo(4, outputShape, ArmnnType);
231 
232  return DepthToSpaceTestImpl<T>(workloadFactory, memoryManager, inputInfo, outputInfo, input, expectedOutput, desc);
233 }
unsigned int m_BlockSize
Scalar specifying the input block size. It must be >= 1.
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).