ArmNN
 21.02
ArgMinMaxTestImpl.hpp File Reference

Go to the source code of this file.

Functions

template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult< int32_t, 3 > ArgMaxSimpleTest (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory)
 
template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult< int32_t, 3 > ArgMinSimpleTest (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory)
 
template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult< int32_t, 3 > ArgMinChannelTest (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory)
 
template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult< int32_t, 3 > ArgMaxChannelTest (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory)
 
template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult< int32_t, 3 > ArgMaxHeightTest (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory)
 
template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult< int32_t, 3 > ArgMinWidthTest (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory)
 

Function Documentation

◆ ArgMaxChannelTest()

LayerTestResult<int32_t, 3> ArgMaxChannelTest ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager,
const armnn::ITensorHandleFactory tensorHandleFactory 
)

Definition at line 156 of file ArgMinMaxTestImpl.cpp.

References armnn::Max, TensorInfo::SetQuantizationOffset(), TensorInfo::SetQuantizationScale(), and armnn::Signed32.

160 {
161  const armnn::TensorShape inputShape{ 1, 3, 2, 4};
162  const armnn::TensorShape outputShape{ 1, 2, 4 };
163 
164  armnn::TensorInfo inputTensorInfo(inputShape, ArmnnType);
165 
166  if (armnn::IsQuantizedType<T>())
167  {
168  inputTensorInfo.SetQuantizationScale(1.0f);
169  inputTensorInfo.SetQuantizationOffset(0);
170  }
171 
172  armnn::TensorInfo outputTensorInfo(outputShape, armnn::DataType::Signed32);
173 
174  std::vector<float> inputValues({ 1.0f, 2.0f, 3.0f, 4.0f,
175  5.0f, 6.0f, 7.0f, 8.0f,
176 
177  10.0f, 20.0f, 30.0f, 40.0f,
178  50.0f, 60.0f, 70.0f, 80.0f,
179 
180  100.0f, 200.0f, 300.0f, 400.0f,
181  500.0f, 600.0f, 700.0f, 800.0f });
182  std::vector<int32_t> outputValues({ 2, 2, 2, 2,
183  2, 2, 2, 2 });
184 
185  return ArgMinMaxTestCommon<ArmnnType>(workloadFactory, memoryManager, tensorHandleFactory,
187  inputTensorInfo, outputTensorInfo,
188  inputValues, outputValues, 1);
189 }

◆ ArgMaxHeightTest()

LayerTestResult<int32_t, 3> ArgMaxHeightTest ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager,
const armnn::ITensorHandleFactory tensorHandleFactory 
)

Definition at line 192 of file ArgMinMaxTestImpl.cpp.

References armnn::Max, TensorInfo::SetQuantizationOffset(), TensorInfo::SetQuantizationScale(), and armnn::Signed32.

196 {
197  const armnn::TensorShape inputShape{ 1, 3, 2, 4};
198  const armnn::TensorShape outputShape{ 1, 3, 4 };
199 
200  armnn::TensorInfo inputTensorInfo(inputShape, ArmnnType);
201  armnn::TensorInfo outputTensorInfo(outputShape, armnn::DataType::Signed32);
202 
203  if (armnn::IsQuantizedType<T>())
204  {
205  inputTensorInfo.SetQuantizationScale(1.0f);
206  inputTensorInfo.SetQuantizationOffset(0);
207  }
208 
209  std::vector<float> inputValues({ 1.0f, 2.0f, 3.0f, 4.0f,
210  5.0f, 6.0f, 7.0f, 8.0f,
211 
212  10.0f, 20.0f, 30.0f, 40.0f,
213  50.0f, 60.0f, 70.0f, 80.0f,
214 
215  100.0f, 200.0f, 300.0f, 400.0f,
216  500.0f, 600.0f, 700.0f, 800.0f });
217  std::vector<int32_t> outputValues({ 1, 1, 1, 1,
218  1, 1, 1, 1,
219  1, 1, 1, 1 });
220 
221  return ArgMinMaxTestCommon<ArmnnType>(workloadFactory, memoryManager, tensorHandleFactory,
223  inputTensorInfo, outputTensorInfo,
224  inputValues, outputValues, 2);
225 }

◆ ArgMaxSimpleTest()

LayerTestResult<int32_t, 3> ArgMaxSimpleTest ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager,
const armnn::ITensorHandleFactory tensorHandleFactory 
)

Definition at line 64 of file ArgMinMaxTestImpl.cpp.

References armnn::Max, TensorInfo::SetQuantizationOffset(), TensorInfo::SetQuantizationScale(), and armnn::Signed32.

68 {
69  const armnn::TensorShape inputShape{ 1, 1, 1, 5 };
70  const armnn::TensorShape outputShape{ 1, 1, 1 };
71 
72  armnn::TensorInfo inputTensorInfo(inputShape, ArmnnType);
73 
74  if (armnn::IsQuantizedType<T>())
75  {
76  inputTensorInfo.SetQuantizationScale(1.0f);
77  inputTensorInfo.SetQuantizationOffset(0);
78  }
79 
80  armnn::TensorInfo outputTensorInfo(outputShape, armnn::DataType::Signed32);
81 
82  std::vector<float> inputValues({ 5.0f, 2.0f, 8.0f, 10.0f, 9.0f });
83  std::vector<int32_t> outputValues({ 3 });
84 
85  return ArgMinMaxTestCommon<ArmnnType>(workloadFactory, memoryManager, tensorHandleFactory,
87  inputTensorInfo, outputTensorInfo,
88  inputValues, outputValues, -1); // axis -1 === 3
89 }

◆ ArgMinChannelTest()

LayerTestResult<int32_t, 3> ArgMinChannelTest ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager,
const armnn::ITensorHandleFactory tensorHandleFactory 
)

Definition at line 120 of file ArgMinMaxTestImpl.cpp.

References armnn::Min, TensorInfo::SetQuantizationOffset(), TensorInfo::SetQuantizationScale(), and armnn::Signed32.

124 {
125  const armnn::TensorShape inputShape{ 1, 3, 2, 4};
126  const armnn::TensorShape outputShape{ 1, 2, 4 };
127 
128  armnn::TensorInfo inputTensorInfo(inputShape, ArmnnType);
129 
130  if (armnn::IsQuantizedType<T>())
131  {
132  inputTensorInfo.SetQuantizationScale(1.0f);
133  inputTensorInfo.SetQuantizationOffset(0);
134  }
135 
136  armnn::TensorInfo outputTensorInfo(outputShape, armnn::DataType::Signed32);
137 
138  std::vector<float> inputValues({ 1.0f, 2.0f, 3.0f, 4.0f,
139  5.0f, 6.0f, 7.0f, 8.0f,
140 
141  10.0f, 20.0f, 30.0f, 40.0f,
142  50.0f, 60.0f, 70.0f, 80.0f,
143 
144  100.0f, 200.0f, 300.0f, 400.0f,
145  500.0f, 600.0f, 700.0f, 800.0f });
146  std::vector<int32_t> outputValues({ 0, 0, 0, 0,
147  0, 0, 0, 0 });
148 
149  return ArgMinMaxTestCommon<ArmnnType>(workloadFactory, memoryManager, tensorHandleFactory,
151  inputTensorInfo, outputTensorInfo,
152  inputValues, outputValues, 1);
153 }

◆ ArgMinSimpleTest()

LayerTestResult<int32_t, 3> ArgMinSimpleTest ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager,
const armnn::ITensorHandleFactory tensorHandleFactory 
)

Definition at line 92 of file ArgMinMaxTestImpl.cpp.

References armnn::Min, TensorInfo::SetQuantizationOffset(), TensorInfo::SetQuantizationScale(), and armnn::Signed32.

96 {
97  const armnn::TensorShape inputShape{ 1, 1, 1, 5 };
98  const armnn::TensorShape outputShape{ 1, 1, 1 };
99 
100  armnn::TensorInfo inputTensorInfo(inputShape, ArmnnType);
101 
102  if (armnn::IsQuantizedType<T>())
103  {
104  inputTensorInfo.SetQuantizationScale(1.0f);
105  inputTensorInfo.SetQuantizationOffset(0);
106  }
107 
108  armnn::TensorInfo outputTensorInfo(outputShape, armnn::DataType::Signed32);
109 
110  std::vector<float> inputValues({ 5.0f, 2.0f, 8.0f, 10.0f, 9.0f });
111  std::vector<int32_t> outputValues({ 1 });
112 
113  return ArgMinMaxTestCommon<ArmnnType>(workloadFactory, memoryManager, tensorHandleFactory,
115  inputTensorInfo, outputTensorInfo,
116  inputValues, outputValues, 3);
117 }

◆ ArgMinWidthTest()

LayerTestResult<int32_t, 3> ArgMinWidthTest ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager,
const armnn::ITensorHandleFactory tensorHandleFactory 
)

Definition at line 228 of file ArgMinMaxTestImpl.cpp.

References armnn::Min, TensorInfo::SetQuantizationOffset(), TensorInfo::SetQuantizationScale(), and armnn::Signed32.

232 {
233  const armnn::TensorShape inputShape{ 1, 3, 2, 4};
234  const armnn::TensorShape outputShape{ 1, 3, 2 };
235 
236  armnn::TensorInfo inputTensorInfo(inputShape, ArmnnType);
237  armnn::TensorInfo outputTensorInfo(outputShape, armnn::DataType::Signed32);
238 
239  if (armnn::IsQuantizedType<T>())
240  {
241  inputTensorInfo.SetQuantizationScale(1.0f);
242  inputTensorInfo.SetQuantizationOffset(0);
243  }
244 
245  std::vector<float> inputValues({ 1.0f, 2.0f, 3.0f, 4.0f,
246  5.0f, 6.0f, 7.0f, 8.0f,
247 
248  10.0f, 20.0f, 30.0f, 40.0f,
249  50.0f, 60.0f, 70.0f, 80.0f,
250 
251  100.0f, 200.0f, 300.0f, 400.0f,
252  500.0f, 600.0f, 700.0f, 800.0f });
253  std::vector<int32_t> outputValues({ 0, 0,
254  0, 0,
255  0, 0 });
256 
257  return ArgMinMaxTestCommon<ArmnnType>(workloadFactory, memoryManager, tensorHandleFactory,
259  inputTensorInfo, outputTensorInfo,
260  inputValues, outputValues, 3);
261 }