ArmNN
 22.05.01
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 83 of file DepthToSpaceTestImpl.cpp.

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

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

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

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

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

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

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

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