ArmNN
 21.11
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 81 of file DepthToSpaceTestImpl.cpp.

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

85 {
86  unsigned int inputShape[] = { 1, 1, 1, 8 };
87  unsigned int outputShape[] = { 1, 2, 2, 2 };
88 
89  // in:
90  // [[[[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]]]]
91  //
92  // out:
93  // [[[[1, 2, 3], [4, 5, 6]],
94  // [[7, 8, 9], [10, 11, 12]]]]
95 
96  std::vector<float> input = { 1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, 8.f };
97  std::vector<float> expectedOutput = input;
98 
100  desc.m_Parameters.m_DataLayout = dataLayout;
101  desc.m_Parameters.m_BlockSize = 2;
102 
103  armnn::TensorInfo inputInfo(4, inputShape, ArmnnType);
104  armnn::TensorInfo outputInfo(4, outputShape, ArmnnType);
105 
106  return DepthToSpaceTestImpl<T>(workloadFactory, memoryManager, inputInfo, outputInfo, input, expectedOutput, desc);
107 }
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 110 of file DepthToSpaceTestImpl.cpp.

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

114 {
115  unsigned int inputShape[] = { 1, 2, 2, 4 };
116  unsigned int outputShape[] = { 1, 4, 4, 1 };
117 
118  // in:
119  // [[[[1, 2, 3, 4],
120  // [5, 6, 7, 8]],
121  // [[9, 10, 11, 12],
122  // [13, 14, 15, 16]]]]
123  //
124  // out:
125  // [[[ [1], [2], [5], [6]],
126  // [ [3], [4], [7], [8]],
127  // [ [9], [10], [13], [14]],
128  // [ [11], [12], [15], [16]]]]
129 
130  std::vector<float> input =
131  {
132  1.f, 2.f, 3.f, 4.f,
133 
134  5.f, 6.f, 7.f, 8.f,
135 
136  9.f, 10.f, 11.f, 12.f,
137 
138  13.f, 14.f, 15.f, 16.f
139  };
140 
141  std::vector<float> expectedOutput
142  {
143  1.f, 2.f, 5.f, 6.f,
144  3.f, 4.f, 7.f, 8.f,
145  9.f, 10.f, 13.f, 14.f,
146  11.f, 12.f, 15.f, 16.f
147  };
148 
150  desc.m_Parameters.m_DataLayout = dataLayout;
151  desc.m_Parameters.m_BlockSize = 2;
152 
153  armnn::TensorInfo inputInfo(4, inputShape, ArmnnType);
154  armnn::TensorInfo outputInfo(4, outputShape, ArmnnType);
155 
156  return DepthToSpaceTestImpl<T>(workloadFactory, memoryManager, inputInfo, outputInfo, input, expectedOutput, desc);
157 }
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 160 of file DepthToSpaceTestImpl.cpp.

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

164 {
165  unsigned int inputShape[] = { 2, 1, 1, 4 };
166  unsigned int outputShape[] = { 2, 2, 2, 1 };
167 
168  std::vector<float> input =
169  {
170  1.f, 2.f, 3.f, 4.f, // batch 0
171  5.f, 6.f, 7.f, 8.f // batch 1
172  };
173 
174  std::vector<float> expectedOutput = input;
175 
177  desc.m_Parameters.m_DataLayout = dataLayout;
178  desc.m_Parameters.m_BlockSize = 2;
179 
180  armnn::TensorInfo inputInfo(4, inputShape, ArmnnType);
181  armnn::TensorInfo outputInfo(4, outputShape, ArmnnType);
182 
183  return DepthToSpaceTestImpl<T>(workloadFactory, memoryManager, inputInfo, outputInfo, input, expectedOutput, desc);
184 }
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 187 of file DepthToSpaceTestImpl.cpp.

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

191 {
192  unsigned int inputShape[] = { 2, 2, 2, 4 };
193  unsigned int outputShape[] = { 2, 4, 4, 1 };
194 
195  std::vector<float> input =
196  {
197  1.f, 2.f, 3.f, 4.f,
198 
199  5.f, 6.f, 7.f, 8.f,
200 
201  9.f, 10.f, 11.f, 12.f,
202 
203  13.f, 14.f, 15.f, 16.f,
204 
205 
206  17.f, 18.f, 19.f, 20.f,
207 
208  21.f, 22.f, 23.f, 24.f,
209 
210  25.f, 26.f, 27.f, 28.f,
211 
212  29.f, 30.f, 31.f, 32.f
213  };
214 
215  std::vector<float> expectedOutput
216  {
217  1.f, 2.f, 5.f, 6.f,
218  3.f, 4.f, 7.f, 8.f,
219  9.f, 10.f, 13.f, 14.f,
220  11.f, 12.f, 15.f, 16.f,
221 
222 
223  17.f, 18.f, 21.f, 22.f,
224  19.f, 20.f, 23.f, 24.f,
225  25.f, 26.f, 29.f, 30.f,
226  27.f, 28.f, 31.f, 32.f
227  };
228 
230  desc.m_Parameters.m_DataLayout = dataLayout;
231  desc.m_Parameters.m_BlockSize = 2;
232 
233  armnn::TensorInfo inputInfo(4, inputShape, ArmnnType);
234  armnn::TensorInfo outputInfo(4, outputShape, ArmnnType);
235 
236  return DepthToSpaceTestImpl<T>(workloadFactory, memoryManager, inputInfo, outputInfo, input, expectedOutput, desc);
237 }
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).