ArmNN
 21.08
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 157 of file ArgMinMaxTestImpl.cpp.

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

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

◆ ArgMaxHeightTest()

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

Definition at line 193 of file ArgMinMaxTestImpl.cpp.

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

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

◆ ArgMaxSimpleTest()

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

Definition at line 65 of file ArgMinMaxTestImpl.cpp.

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

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

◆ ArgMinChannelTest()

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

Definition at line 121 of file ArgMinMaxTestImpl.cpp.

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

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

◆ ArgMinSimpleTest()

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

Definition at line 93 of file ArgMinMaxTestImpl.cpp.

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

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

◆ ArgMinWidthTest()

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

Definition at line 229 of file ArgMinMaxTestImpl.cpp.

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

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