blob: 9b40d34d2b6f6d56c0e0397448a4ccfb98543477 [file] [log] [blame]
Michalis Spyroue9362622018-11-23 17:41:37 +00001/*
Ramy Elgammal14d7b532023-01-30 04:56:47 +00002 * Copyright (c) 2018-2021, 2023 Arm Limited.
Michalis Spyroue9362622018-11-23 17:41:37 +00003 *
4 * SPDX-License-Identifier: MIT
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in all
14 * copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 */
24#ifndef ARM_COMPUTE_TEST_ELEMENTWISE_UNARY_FIXTURE
25#define ARM_COMPUTE_TEST_ELEMENTWISE_UNARY_FIXTURE
26
Viet-Hoa Dofd472f02023-03-15 14:05:06 +000027#include "arm_compute/core/QuantizationInfo.h"
Michalis Spyroue9362622018-11-23 17:41:37 +000028#include "arm_compute/core/TensorShape.h"
29#include "arm_compute/core/Types.h"
Viet-Hoa Dofd472f02023-03-15 14:05:06 +000030#include "arm_compute/core/Utils.h"
Michalis Spyroue9362622018-11-23 17:41:37 +000031#include "tests/AssetsLibrary.h"
32#include "tests/Globals.h"
33#include "tests/IAccessor.h"
34#include "tests/framework/Asserts.h"
35#include "tests/framework/Fixture.h"
Jakub Sujakee301b32021-06-04 09:46:08 +010036#include "tests/validation/reference/ElementwiseUnary.h"
Michalis Spyroue9362622018-11-23 17:41:37 +000037
Viet-Hoa Dofd472f02023-03-15 14:05:06 +000038#include <tuple>
39#include <limits>
40#include <type_traits>
41#include <vector>
42
Michalis Spyroue9362622018-11-23 17:41:37 +000043namespace arm_compute
44{
45namespace test
46{
47namespace validation
48{
49template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
50class ElementWiseUnaryValidationFixture : public framework::Fixture
51{
52public:
53 template <typename...>
Ramy Elgammal14d7b532023-01-30 04:56:47 +000054 void setup(TensorShape input_shape, DataType input_data_type, bool in_place, ElementWiseUnary op,
55 bool use_dynamic_shape = false, QuantizationInfo qinfo = QuantizationInfo(), QuantizationInfo qinfo_out = QuantizationInfo())
Michalis Spyroue9362622018-11-23 17:41:37 +000056 {
Sang-Hoon Park668ccdc2021-02-03 10:32:59 +000057 _op = op;
Ramy Elgammal14d7b532023-01-30 04:56:47 +000058 _target = compute_target(input_shape, input_data_type, in_place, qinfo, qinfo_out);
59 _reference = compute_reference(input_shape, input_data_type, qinfo, qinfo_out);
Sang-Hoon Park668ccdc2021-02-03 10:32:59 +000060 _use_dynamic_shape = use_dynamic_shape;
Michalis Spyroue9362622018-11-23 17:41:37 +000061 }
62
63protected:
64 template <typename U>
Usama Ariff6e475c2019-05-10 12:06:28 +010065 void fill(U &&tensor, int i, DataType data_type)
Michalis Spyroue9362622018-11-23 17:41:37 +000066 {
Giorgio Arena4bdd1772020-12-17 16:47:07 +000067 using FloatType = typename std::conditional < std::is_same<T, half>::value || std::is_floating_point<T>::value, T, float >::type;
Giorgio Arena33b103b2021-01-08 10:37:15 +000068 using FloatDistributionType = typename std::conditional<std::is_same<T, half>::value, arm_compute::utils::uniform_real_distribution_16bit<T>, std::uniform_real_distribution<FloatType>>::type;
Giorgio Arena4bdd1772020-12-17 16:47:07 +000069
Michalis Spyroue9362622018-11-23 17:41:37 +000070 switch(_op)
71 {
72 case ElementWiseUnary::EXP:
73 {
Viet-Hoa Dofd472f02023-03-15 14:05:06 +000074 switch(data_type)
75 {
76 case DataType::F32:
77 {
78 FloatDistributionType distribution{ FloatType(-86.63f), FloatType(88.36f) };
79 library->fill(tensor, distribution, i);
80 break;
81 }
82
83 case DataType::F16:
84 {
85 FloatDistributionType distribution{ FloatType(-9.00f), FloatType(10.73f) };
86 library->fill(tensor, distribution, i);
87 break;
88 }
89
90 case DataType::QASYMM8:
91 case DataType::QASYMM8_SIGNED:
92 library->fill_tensor_uniform(tensor, i);
93 break;
94
95 default:
96 ARM_COMPUTE_ERROR("Not implemented");
97 }
98
Michalis Spyroue9362622018-11-23 17:41:37 +000099 break;
100 }
101 case ElementWiseUnary::RSQRT:
Usama Arifc255aa72019-05-13 16:26:29 +0100102 case ElementWiseUnary::LOG:
103 {
Viet-Hoa Dofd472f02023-03-15 14:05:06 +0000104 // For floating-point data type, the chosen input range is all positive numbers
105 // (i.e. positive and negative zeros are excluded).
106 switch(data_type)
107 {
108 case DataType::F32:
109 {
110 FloatDistributionType distribution{ std::numeric_limits<float>::min(), std::numeric_limits<float>::max() };
111 library->fill(tensor, distribution, i);
112 break;
113 }
114
115 case DataType::F16:
116 {
117 FloatDistributionType distribution{ FloatType(0.00006103515625f), FloatType(65504.0f) };
118 library->fill(tensor, distribution, i);
119 break;
120 }
121
122 case DataType::QASYMM8:
123 case DataType::QASYMM8_SIGNED:
124 library->fill_tensor_uniform(tensor, i);
125 break;
126
127 default:
128 ARM_COMPUTE_ERROR("Not implemented");
129 }
130
Usama Arifc255aa72019-05-13 16:26:29 +0100131 break;
132 }
Michalis Spyrou0af44182019-05-17 14:04:47 +0100133 case ElementWiseUnary::SIN:
134 {
Viet-Hoa Dofd472f02023-03-15 14:05:06 +0000135 switch(data_type)
136 {
137 case DataType::F32:
138 case DataType::F16:
139 {
140 FloatDistributionType distribution{ FloatType(-100.0f), FloatType(100.0f) };
141 library->fill(tensor, distribution, i);
142 break;
143 }
144
145 case DataType::S32:
146 {
147 std::uniform_int_distribution<int32_t> distribution(std::numeric_limits<int32_t>::lowest(), std::numeric_limits<int32_t>::max());
148 library->fill(tensor, distribution, i);
149 break;
150 }
151
152 case DataType::QASYMM8:
153 case DataType::QASYMM8_SIGNED:
154 library->fill_tensor_uniform(tensor, i);
155 break;
156
157 default:
158 ARM_COMPUTE_ERROR("Not implemented");
159 }
160
Michalis Spyrou0af44182019-05-17 14:04:47 +0100161 break;
162 }
Viet-Hoa Dofd472f02023-03-15 14:05:06 +0000163 case ElementWiseUnary::ABS:
164 case ElementWiseUnary::NEG:
Usama Arif0a5a57a2019-05-23 14:20:33 +0100165 case ElementWiseUnary::ROUND:
166 {
Viet-Hoa Dofd472f02023-03-15 14:05:06 +0000167 switch(data_type)
168 {
169 case DataType::F32:
170 {
171 FloatDistributionType distribution{ std::numeric_limits<float>::lowest() / 2, std::numeric_limits<float>::max() / 2 };
172 library->fill(tensor, distribution, i);
173 break;
174 }
175
176 case DataType::F16:
177 {
178 FloatDistributionType distribution{ FloatType(-65504.0f), FloatType(65504.0f) };
179 library->fill(tensor, distribution, i);
180 break;
181 }
182
183 case DataType::S32:
184 {
185 std::uniform_int_distribution<int32_t> distribution(std::numeric_limits<int32_t>::lowest(), std::numeric_limits<int32_t>::max());
186 library->fill(tensor, distribution, i);
187 break;
188 }
189
190 case DataType::QASYMM8:
191 case DataType::QASYMM8_SIGNED:
192 library->fill_tensor_uniform(tensor, i);
193 break;
194
195 default:
196 ARM_COMPUTE_ERROR("Not implemented");
197 }
198
Usama Arif0a5a57a2019-05-23 14:20:33 +0100199 break;
200 }
Michalis Spyroue9362622018-11-23 17:41:37 +0000201 default:
202 ARM_COMPUTE_ERROR("Not implemented");
203 }
204 }
205
Ramy Elgammal14d7b532023-01-30 04:56:47 +0000206 TensorType compute_target(const TensorShape &shape, DataType data_type, bool in_place, QuantizationInfo qinfo, QuantizationInfo qinfo_out)
Michalis Spyroue9362622018-11-23 17:41:37 +0000207 {
208 // Create tensors
Ramy Elgammal14d7b532023-01-30 04:56:47 +0000209 TensorType src = create_tensor<TensorType>(shape, data_type, 1, qinfo);
210 TensorType dst = create_tensor<TensorType>(shape, data_type, 1, qinfo_out);
Manuel Bottini80feed52020-06-03 13:20:41 +0100211 TensorType *actual_dst = in_place ? &src : &dst;
212
Sang-Hoon Park668ccdc2021-02-03 10:32:59 +0000213 // if _use_dynamic_shape is true, this fixture will test scenario for dynamic shapes.
214 // - At configure time, all input tensors are marked as dynamic using set_tensor_dynamic()
215 // - After configure, tensors are marked as static for run using set_tensor_static()
216 // - The tensors with static shape are given to run()
217 if(_use_dynamic_shape)
218 {
219 set_tensor_dynamic(src);
220 }
221
Michalis Spyroue9362622018-11-23 17:41:37 +0000222 // Create and configure function
223 FunctionType elwiseunary_layer;
Manuel Bottini80feed52020-06-03 13:20:41 +0100224 elwiseunary_layer.configure(&src, actual_dst);
Michalis Spyroue9362622018-11-23 17:41:37 +0000225
Sang-Hoon Park668ccdc2021-02-03 10:32:59 +0000226 if(_use_dynamic_shape)
227 {
228 set_tensor_static(src);
229 }
230
Michele Di Giorgio4fc10b32021-04-30 18:30:41 +0100231 ARM_COMPUTE_ASSERT(src.info()->is_resizable());
Michalis Spyroue9362622018-11-23 17:41:37 +0000232 src.allocator()->allocate();
Michele Di Giorgio4fc10b32021-04-30 18:30:41 +0100233 ARM_COMPUTE_ASSERT(!src.info()->is_resizable());
Manuel Bottini80feed52020-06-03 13:20:41 +0100234 if(!in_place)
235 {
Michele Di Giorgio4fc10b32021-04-30 18:30:41 +0100236 ARM_COMPUTE_ASSERT(dst.info()->is_resizable());
Manuel Bottini80feed52020-06-03 13:20:41 +0100237 dst.allocator()->allocate();
Michele Di Giorgio4fc10b32021-04-30 18:30:41 +0100238 ARM_COMPUTE_ASSERT(!dst.info()->is_resizable());
Manuel Bottini80feed52020-06-03 13:20:41 +0100239 }
Michalis Spyroue9362622018-11-23 17:41:37 +0000240
241 // Fill tensors
Usama Ariff6e475c2019-05-10 12:06:28 +0100242 fill(AccessorType(src), 0, data_type);
Michalis Spyroue9362622018-11-23 17:41:37 +0000243
244 // Compute function
245 elwiseunary_layer.run();
246
Manuel Bottini80feed52020-06-03 13:20:41 +0100247 if(in_place)
248 {
249 return src;
250 }
251 else
252 {
253 return dst;
254 }
Michalis Spyroue9362622018-11-23 17:41:37 +0000255 }
256
Ramy Elgammal14d7b532023-01-30 04:56:47 +0000257 SimpleTensor<T> compute_reference(const TensorShape &shape, DataType data_type, QuantizationInfo qinfo, QuantizationInfo qinfo_out)
Michalis Spyroue9362622018-11-23 17:41:37 +0000258 {
259 // Create reference
Ramy Elgammal14d7b532023-01-30 04:56:47 +0000260 SimpleTensor<T> src{ shape, data_type, 1, qinfo };
261 SimpleTensor<T> dst{ shape, data_type, 1, qinfo_out };
Michalis Spyroue9362622018-11-23 17:41:37 +0000262
263 // Fill reference
Usama Ariff6e475c2019-05-10 12:06:28 +0100264 fill(src, 0, data_type);
Michalis Spyroue9362622018-11-23 17:41:37 +0000265
Ramy Elgammal14d7b532023-01-30 04:56:47 +0000266 return reference::elementwise_unary<T>(src, dst, _op);
Michalis Spyroue9362622018-11-23 17:41:37 +0000267 }
268
269 TensorType _target{};
270 SimpleTensor<T> _reference{};
271 ElementWiseUnary _op{};
Sang-Hoon Park668ccdc2021-02-03 10:32:59 +0000272 bool _use_dynamic_shape{ false };
Viet-Hoa Dofd472f02023-03-15 14:05:06 +0000273 QuantizationInfo _input_qinfo{};
274 QuantizationInfo _output_qinfo{};
Michalis Spyroue9362622018-11-23 17:41:37 +0000275};
Ramy Elgammal14d7b532023-01-30 04:56:47 +0000276template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
277class RsqrtQuantizedValidationFixture : public ElementWiseUnaryValidationFixture<TensorType, AccessorType, FunctionType, T>
278{
279public:
280 template <typename...>
281 void setup(const TensorShape &shape, DataType data_type, QuantizationInfo qinfo, QuantizationInfo qinfo_out)
282 {
283 ElementWiseUnaryValidationFixture<TensorType, AccessorType, FunctionType, T>::setup(shape, data_type, false, ElementWiseUnary::RSQRT, false, qinfo, qinfo_out);
284 }
285};
Michalis Spyroue9362622018-11-23 17:41:37 +0000286
287template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
288class RsqrtValidationFixture : public ElementWiseUnaryValidationFixture<TensorType, AccessorType, FunctionType, T>
289{
290public:
291 template <typename...>
292 void setup(const TensorShape &shape, DataType data_type)
293 {
Manuel Bottini80feed52020-06-03 13:20:41 +0100294 ElementWiseUnaryValidationFixture<TensorType, AccessorType, FunctionType, T>::setup(shape, data_type, false, ElementWiseUnary::RSQRT);
Michalis Spyroue9362622018-11-23 17:41:37 +0000295 }
296};
297
298template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
Sang-Hoon Park668ccdc2021-02-03 10:32:59 +0000299class RsqrtDynamicShapeValidationFixture : public ElementWiseUnaryValidationFixture<TensorType, AccessorType, FunctionType, T>
300{
301public:
302 template <typename...>
303 void setup(const TensorShape &shape, DataType data_type)
304 {
305 ElementWiseUnaryValidationFixture<TensorType, AccessorType, FunctionType, T>::setup(shape, data_type, false, ElementWiseUnary::RSQRT, true);
306 }
307};
308
309template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
Michalis Spyroue9362622018-11-23 17:41:37 +0000310class ExpValidationFixture : public ElementWiseUnaryValidationFixture<TensorType, AccessorType, FunctionType, T>
311{
312public:
313 template <typename...>
314 void setup(const TensorShape &shape, DataType data_type)
315 {
Manuel Bottini80feed52020-06-03 13:20:41 +0100316 ElementWiseUnaryValidationFixture<TensorType, AccessorType, FunctionType, T>::setup(shape, data_type, false, ElementWiseUnary::EXP);
Michalis Spyroue9362622018-11-23 17:41:37 +0000317 }
318};
Usama Ariff6e475c2019-05-10 12:06:28 +0100319
320template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
Viet-Hoa Dofd472f02023-03-15 14:05:06 +0000321class ExpQuantizedValidationFixture : public ElementWiseUnaryValidationFixture<TensorType, AccessorType, FunctionType, T>
322{
323public:
324 template <typename...>
325 void setup(const TensorShape &shape, DataType data_type, QuantizationInfo iq, QuantizationInfo oq)
326 {
327 ElementWiseUnaryValidationFixture<TensorType, AccessorType, FunctionType, T>::setup(shape, data_type, false, ElementWiseUnary::EXP, false, iq, oq);
328 }
329};
330
331template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
Usama Ariff6e475c2019-05-10 12:06:28 +0100332class NegValidationFixture : public ElementWiseUnaryValidationFixture<TensorType, AccessorType, FunctionType, T>
333{
334public:
335 template <typename...>
336 void setup(const TensorShape &shape, DataType data_type)
337 {
Manuel Bottini80feed52020-06-03 13:20:41 +0100338 ElementWiseUnaryValidationFixture<TensorType, AccessorType, FunctionType, T>::setup(shape, data_type, false, ElementWiseUnary::NEG);
339 }
340};
341
342template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
Viet-Hoa Dofd472f02023-03-15 14:05:06 +0000343class NegQuantizedValidationFixture : public ElementWiseUnaryValidationFixture<TensorType, AccessorType, FunctionType, T>
344{
345public:
346 template <typename...>
347 void setup(const TensorShape &shape, DataType data_type, QuantizationInfo iq, QuantizationInfo oq)
348 {
349 ElementWiseUnaryValidationFixture<TensorType, AccessorType, FunctionType, T>::setup(shape, data_type, false, ElementWiseUnary::NEG, false, iq, oq);
350 }
351};
352
353template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
Manuel Bottini80feed52020-06-03 13:20:41 +0100354class NegValidationInPlaceFixture : public ElementWiseUnaryValidationFixture<TensorType, AccessorType, FunctionType, T>
355{
356public:
357 template <typename...>
358 void setup(const TensorShape &shape, DataType data_type, bool in_place)
359 {
360 ElementWiseUnaryValidationFixture<TensorType, AccessorType, FunctionType, T>::setup(shape, data_type, in_place, ElementWiseUnary::NEG);
Usama Ariff6e475c2019-05-10 12:06:28 +0100361 }
362};
Usama Arifc255aa72019-05-13 16:26:29 +0100363
364template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
Viet-Hoa Dofd472f02023-03-15 14:05:06 +0000365class NegQuantizedValidationInPlaceFixture : public ElementWiseUnaryValidationFixture<TensorType, AccessorType, FunctionType, T>
366{
367public:
368 template <typename...>
369 void setup(const TensorShape &shape, DataType data_type, bool in_place, QuantizationInfo iq, QuantizationInfo oq)
370 {
371 ElementWiseUnaryValidationFixture<TensorType, AccessorType, FunctionType, T>::setup(shape, data_type, in_place, ElementWiseUnary::NEG, false, iq, oq);
372 }
373};
374
375template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
Usama Arifc255aa72019-05-13 16:26:29 +0100376class LogValidationFixture : public ElementWiseUnaryValidationFixture<TensorType, AccessorType, FunctionType, T>
377{
378public:
379 template <typename...>
380 void setup(const TensorShape &shape, DataType data_type)
381 {
Manuel Bottini80feed52020-06-03 13:20:41 +0100382 ElementWiseUnaryValidationFixture<TensorType, AccessorType, FunctionType, T>::setup(shape, data_type, false, ElementWiseUnary::LOG);
Usama Arifc255aa72019-05-13 16:26:29 +0100383 }
384};
Manuel Bottini6ac59922019-05-15 14:06:02 +0100385
386template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
Viet-Hoa Dofd472f02023-03-15 14:05:06 +0000387class LogQuantizedValidationFixture : public ElementWiseUnaryValidationFixture<TensorType, AccessorType, FunctionType, T>
388{
389public:
390 template <typename...>
391 void setup(const TensorShape &shape, DataType data_type, QuantizationInfo iq, QuantizationInfo oq)
392 {
393 ElementWiseUnaryValidationFixture<TensorType, AccessorType, FunctionType, T>::setup(shape, data_type, false, ElementWiseUnary::LOG, false, iq, oq);
394 }
395};
396
397template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
Manuel Bottini6ac59922019-05-15 14:06:02 +0100398class AbsValidationFixture : public ElementWiseUnaryValidationFixture<TensorType, AccessorType, FunctionType, T>
399{
400public:
401 template <typename...>
402 void setup(const TensorShape &shape, DataType data_type)
403 {
Manuel Bottini80feed52020-06-03 13:20:41 +0100404 ElementWiseUnaryValidationFixture<TensorType, AccessorType, FunctionType, T>::setup(shape, data_type, false, ElementWiseUnary::ABS);
Manuel Bottini6ac59922019-05-15 14:06:02 +0100405 }
406};
Michalis Spyrou0af44182019-05-17 14:04:47 +0100407
408template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
Viet-Hoa Dofd472f02023-03-15 14:05:06 +0000409class AbsQuantizedValidationFixture : public ElementWiseUnaryValidationFixture<TensorType, AccessorType, FunctionType, T>
410{
411public:
412 template <typename...>
413 void setup(const TensorShape &shape, DataType data_type, QuantizationInfo iq, QuantizationInfo oq)
414 {
415 ElementWiseUnaryValidationFixture<TensorType, AccessorType, FunctionType, T>::setup(shape, data_type, false, ElementWiseUnary::ABS, false, iq, oq);
416 }
417};
418
419template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
Michalis Spyrou0af44182019-05-17 14:04:47 +0100420class SinValidationFixture : public ElementWiseUnaryValidationFixture<TensorType, AccessorType, FunctionType, T>
421{
422public:
423 template <typename...>
424 void setup(const TensorShape &shape, DataType data_type)
425 {
Manuel Bottini80feed52020-06-03 13:20:41 +0100426 ElementWiseUnaryValidationFixture<TensorType, AccessorType, FunctionType, T>::setup(shape, data_type, false, ElementWiseUnary::SIN);
Michalis Spyrou0af44182019-05-17 14:04:47 +0100427 }
428};
Usama Arif0a5a57a2019-05-23 14:20:33 +0100429
430template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
Viet-Hoa Dofd472f02023-03-15 14:05:06 +0000431class SinQuantizedValidationFixture : public ElementWiseUnaryValidationFixture<TensorType, AccessorType, FunctionType, T>
432{
433public:
434 template <typename...>
435 void setup(const TensorShape &shape, DataType data_type, QuantizationInfo iq, QuantizationInfo oq)
436 {
437 ElementWiseUnaryValidationFixture<TensorType, AccessorType, FunctionType, T>::setup(shape, data_type, false, ElementWiseUnary::SIN, false, iq, oq);
438 }
439};
440
441template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
Usama Arif0a5a57a2019-05-23 14:20:33 +0100442class RoundValidationFixture : public ElementWiseUnaryValidationFixture<TensorType, AccessorType, FunctionType, T>
443{
444public:
445 template <typename...>
446 void setup(const TensorShape &shape, DataType data_type)
447 {
Manuel Bottini80feed52020-06-03 13:20:41 +0100448 ElementWiseUnaryValidationFixture<TensorType, AccessorType, FunctionType, T>::setup(shape, data_type, false, ElementWiseUnary::ROUND);
Usama Arif0a5a57a2019-05-23 14:20:33 +0100449 }
450};
Viet-Hoa Dofd472f02023-03-15 14:05:06 +0000451
452template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
453class RoundQuantizedValidationFixture : public ElementWiseUnaryValidationFixture<TensorType, AccessorType, FunctionType, T>
454{
455public:
456 template <typename...>
457 void setup(const TensorShape &shape, DataType data_type, QuantizationInfo iq, QuantizationInfo oq)
458 {
459 ElementWiseUnaryValidationFixture<TensorType, AccessorType, FunctionType, T>::setup(shape, data_type, false, ElementWiseUnary::ROUND, false, iq, oq);
460 }
461};
Michalis Spyroue9362622018-11-23 17:41:37 +0000462} // namespace validation
463} // namespace test
464} // namespace arm_compute
465#endif /* ARM_COMPUTE_TEST_ELEMENTWISE_UNARY_FIXTURE */