blob: f468f6d5c6250ee12b031e52c2bfbb02754380a5 [file] [log] [blame]
Sanghoon Lee72898fe2017-09-01 11:42:16 +01001/*
Michele Di Giorgiod9eaf612020-07-08 11:12:57 +01002 * Copyright (c) 2017-2020 Arm Limited.
Sanghoon Lee72898fe2017-09-01 11:42:16 +01003 *
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,
Michalis Spyrou5c9f0c42019-01-16 14:48:48 +000021 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
Sanghoon Lee72898fe2017-09-01 11:42:16 +010022 * SOFTWARE.
23 */
24#include "arm_compute/core/Types.h"
25#include "arm_compute/runtime/NEON/functions/NEArithmeticSubtraction.h"
26#include "arm_compute/runtime/Tensor.h"
27#include "arm_compute/runtime/TensorAllocator.h"
28#include "tests/NEON/Accessor.h"
29#include "tests/PaddingCalculator.h"
30#include "tests/datasets/ConvertPolicyDataset.h"
31#include "tests/datasets/ShapeDatasets.h"
32#include "tests/framework/Asserts.h"
33#include "tests/framework/Macros.h"
34#include "tests/framework/datasets/Datasets.h"
35#include "tests/validation/Validation.h"
Georgios Pinitascbf39c62018-09-10 15:07:45 +010036#include "tests/validation/fixtures/ArithmeticOperationsFixture.h"
Sanghoon Lee72898fe2017-09-01 11:42:16 +010037
38namespace arm_compute
39{
40namespace test
41{
42namespace validation
43{
44namespace
45{
Manuel Bottini8d04fa02019-03-08 14:00:40 +000046#ifdef __aarch64__
Michele Di Giorgio9f2403f2020-03-27 10:23:44 +000047constexpr AbsoluteTolerance<float> tolerance_qasymm8(0); /**< Tolerance value for comparing reference's output against implementation's output for quantized data types */
48#else //__aarch64__
Manuel Bottini8d04fa02019-03-08 14:00:40 +000049constexpr AbsoluteTolerance<float> tolerance_qasymm8(1); /**< Tolerance value for comparing reference's output against implementation's output for quantized data types */
Michele Di Giorgio9f2403f2020-03-27 10:23:44 +000050#endif //__aarch64__
51constexpr AbsoluteTolerance<int16_t> tolerance_qsymm16(1); /**< Tolerance value for comparing reference's output against implementation's output for quantized data types */
Manuel Bottini8d04fa02019-03-08 14:00:40 +000052
Sanghoon Lee72898fe2017-09-01 11:42:16 +010053/** Input data sets **/
Manuel Bottini6a2b6e82019-02-25 13:50:11 +000054const auto ArithmeticSubtractionQASYMM8Dataset = combine(combine(framework::dataset::make("DataType", DataType::QASYMM8),
55 framework::dataset::make("DataType", DataType::QASYMM8)),
56 framework::dataset::make("DataType", DataType::QASYMM8));
57
Michalis Spyrou6f58b372019-12-04 12:00:36 +000058const auto ArithmeticSubtractionQASYMM8SIGNEDDataset = combine(combine(framework::dataset::make("DataType", DataType::QASYMM8_SIGNED),
59 framework::dataset::make("DataType", DataType::QASYMM8_SIGNED)),
60 framework::dataset::make("DataType", DataType::QASYMM8_SIGNED));
61
Michele Di Giorgio9f2403f2020-03-27 10:23:44 +000062const auto ArithmeticSubtractionQSYMM16Dataset = combine(combine(framework::dataset::make("DataType", DataType::QSYMM16),
63 framework::dataset::make("DataType", DataType::QSYMM16)),
64 framework::dataset::make("DataType", DataType::QSYMM16));
65
Manuel Bottini6a2b6e82019-02-25 13:50:11 +000066const auto ArithmeticSubtractionU8Dataset = combine(combine(framework::dataset::make("DataType", DataType::U8),
67 framework::dataset::make("DataType", DataType::U8)),
68 framework::dataset::make("DataType", DataType::U8));
69
70const auto ArithmeticSubtractionS16Dataset = combine(combine(framework::dataset::make("DataType", { DataType::U8, DataType::S16 }),
71 framework::dataset::make("DataType", DataType::S16)),
Sanghoon Lee72898fe2017-09-01 11:42:16 +010072 framework::dataset::make("DataType", DataType::S16));
Ioan-Cristian Szabo5edbd1c2017-11-13 13:34:08 +000073#ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
Manuel Bottini6a2b6e82019-02-25 13:50:11 +000074const auto ArithmeticSubtractionFP16Dataset = combine(combine(framework::dataset::make("DataType", DataType::F16),
75 framework::dataset::make("DataType", DataType::F16)),
Sanghoon Lee72898fe2017-09-01 11:42:16 +010076 framework::dataset::make("DataType", DataType::F16));
Ioan-Cristian Szabo5edbd1c2017-11-13 13:34:08 +000077#endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */
Manuel Bottini6a2b6e82019-02-25 13:50:11 +000078const auto ArithmeticSubtractionFP32Dataset = combine(combine(framework::dataset::make("DataType", DataType::F32),
79 framework::dataset::make("DataType", DataType::F32)),
Sanghoon Lee72898fe2017-09-01 11:42:16 +010080 framework::dataset::make("DataType", DataType::F32));
Manuel Bottini6a2b6e82019-02-25 13:50:11 +000081
82const auto ArithmeticSubtractionQuantizationInfoDataset = combine(combine(framework::dataset::make("QuantizationInfoIn1", { QuantizationInfo(10, 120) }),
83 framework::dataset::make("QuantizationInfoIn2", { QuantizationInfo(20, 110) })),
84 framework::dataset::make("QuantizationInfoOut", { QuantizationInfo(15, 125) }));
Michalis Spyrou6f58b372019-12-04 12:00:36 +000085const auto ArithmeticSubtractionQuantizationInfoSignedDataset = combine(combine(framework::dataset::make("QuantizationInfoIn1", { QuantizationInfo(0.5f, 10) }),
86 framework::dataset::make("QuantizationInfoIn2", { QuantizationInfo(0.5f, 20) })),
87 framework::dataset::make("QuantizationInfoOut", { QuantizationInfo(0.5f, 50) }));
Michele Di Giorgio9f2403f2020-03-27 10:23:44 +000088const auto ArithmeticSubtractionQuantizationInfoSymmetric = combine(combine(framework::dataset::make("QuantizationInfoIn1", { QuantizationInfo(0.3f, 0) }),
89 framework::dataset::make("QuantizationInfoIn2", { QuantizationInfo(0.7f, 0) })),
90 framework::dataset::make("QuantizationInfoOut", { QuantizationInfo(0.2f, 0) }));
Georgios Pinitasb2842be2020-06-22 21:27:14 +010091const auto InPlaceDataSet = framework::dataset::make("InPlace", { false, true });
92const auto OutOfPlaceDataSet = framework::dataset::make("InPlace", { false });
Sanghoon Lee72898fe2017-09-01 11:42:16 +010093} // namespace
94
95TEST_SUITE(NEON)
96TEST_SUITE(ArithmeticSubtraction)
97
Georgios Pinitascbf39c62018-09-10 15:07:45 +010098template <typename T>
99using NEArithmeticSubtractionFixture = ArithmeticSubtractionValidationFixture<Tensor, Accessor, NEArithmeticSubtraction, T>;
100
Ioan-Cristian Szabo397d58a2017-11-30 15:19:11 +0000101// *INDENT-OFF*
102// clang-format off
Manuel Bottini6a2b6e82019-02-25 13:50:11 +0000103DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(
Georgios Pinitascbf39c62018-09-10 15:07:45 +0100104 framework::dataset::make("Input1Info", { TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
105 TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
Georgios Pinitascbf39c62018-09-10 15:07:45 +0100106 TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8), // Invalid data type combination
107 TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32), // Mismatching shapes
Manuel Bottini6a2b6e82019-02-25 13:50:11 +0000108 TensorInfo(TensorShape(48U, 11U, 2U), 1, DataType::QASYMM8), // Mismatching types
109 TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QASYMM8), // Invalid convert policy
Georgios Pinitascbf39c62018-09-10 15:07:45 +0100110 }),
111 framework::dataset::make("Input2Info",{ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
112 TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
Georgios Pinitascbf39c62018-09-10 15:07:45 +0100113 TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::S16),
114 TensorInfo(TensorShape(48U, 11U, 2U), 1, DataType::F32),
Manuel Bottini6a2b6e82019-02-25 13:50:11 +0000115 TensorInfo(TensorShape(48U, 11U, 2U), 1, DataType::F32),
116 TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QASYMM8),
Georgios Pinitascbf39c62018-09-10 15:07:45 +0100117 })),
118 framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::S16),
119 TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
Georgios Pinitascbf39c62018-09-10 15:07:45 +0100120 TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
121 TensorInfo(TensorShape(48U, 11U, 2U), 1, DataType::F32),
Manuel Bottini6a2b6e82019-02-25 13:50:11 +0000122 TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QASYMM8),
Georgios Pinitascbf39c62018-09-10 15:07:45 +0100123 })),
Manuel Bottini6a2b6e82019-02-25 13:50:11 +0000124 framework::dataset::make("ConvertPolicy",{ ConvertPolicy::WRAP,
125 ConvertPolicy::SATURATE,
Manuel Bottini6a2b6e82019-02-25 13:50:11 +0000126 ConvertPolicy::SATURATE,
127 ConvertPolicy::WRAP,
128 ConvertPolicy::WRAP,
129 })),
Michalis Spyrou5f390912020-05-13 00:12:08 +0100130 framework::dataset::make("Expected", { true, true, false, false, false, false})),
Manuel Bottini6a2b6e82019-02-25 13:50:11 +0000131 input1_info, input2_info, output_info, policy, expected)
Ioan-Cristian Szabo397d58a2017-11-30 15:19:11 +0000132{
Manuel Bottini6a2b6e82019-02-25 13:50:11 +0000133 ARM_COMPUTE_EXPECT(bool(NEArithmeticSubtraction::validate(&input1_info.clone()->set_is_resizable(false), &input2_info.clone()->set_is_resizable(false), &output_info.clone()->set_is_resizable(false), policy)) == expected, framework::LogLevel::ERRORS);
Ioan-Cristian Szabo397d58a2017-11-30 15:19:11 +0000134}
135// clang-format on
136// *INDENT-ON*
137
Georgios Pinitasb2842be2020-06-22 21:27:14 +0100138TEST_SUITE(InPlaceValidate)
139TEST_CASE(SingleTensor, framework::DatasetMode::ALL)
140{
141 const auto random_shape = TensorShape{ 9, 9 };
142 const auto single_tensor_info = TensorInfo{ random_shape, 1, DataType::F32 };
143
144 Status result = NEArithmeticSubtraction::validate(&single_tensor_info, &single_tensor_info, &single_tensor_info, ConvertPolicy::WRAP);
145 ARM_COMPUTE_EXPECT(bool(result) == true, framework::LogLevel::ERRORS);
146}
147
148TEST_CASE(ValidBroadCast, framework::DatasetMode::ALL)
149{
150 const auto larger_shape = TensorShape{ 27U, 13U, 2U };
151 const auto smaller_shape = TensorShape{ 1U, 13U, 2U };
152
153 const auto larger_tensor_info = TensorInfo{ larger_shape, 1, DataType::F32 };
154 const auto smaller_tensor_info = TensorInfo{ smaller_shape, 1, DataType::F32 };
155
156 Status result = NEArithmeticSubtraction::validate(&larger_tensor_info, &smaller_tensor_info, &larger_tensor_info, ConvertPolicy::WRAP);
157 ARM_COMPUTE_EXPECT(bool(result) == true, framework::LogLevel::ERRORS);
158}
159
160TEST_CASE(InvalidBroadcastOutput, framework::DatasetMode::ALL)
161{
162 const auto larger_shape = TensorShape{ 27U, 13U, 2U };
163 const auto smaller_shape = TensorShape{ 1U, 13U, 2U };
164
165 const auto larger_tensor_info = TensorInfo{ larger_shape, 1, DataType::F32 };
166 const auto smaller_tensor_info = TensorInfo{ smaller_shape, 1, DataType::F32 };
167
168 Status result = NEArithmeticSubtraction::validate(&larger_tensor_info, &smaller_tensor_info, &smaller_tensor_info, ConvertPolicy::WRAP);
169 ARM_COMPUTE_EXPECT(bool(result) == false, framework::LogLevel::ERRORS);
170}
171
172TEST_CASE(InvalidBroadcastBoth, framework::DatasetMode::ALL)
173{
174 const auto shape0 = TensorShape{ 9U, 9U };
175 const auto shape1 = TensorShape{ 9U, 1U, 2U };
176
177 const auto info0 = TensorInfo{ shape0, 1, DataType::F32 };
178 const auto info1 = TensorInfo{ shape1, 1, DataType::F32 };
179
180 Status result{};
181
182 result = NEArithmeticSubtraction::validate(&info0, &info1, &info0, ConvertPolicy::WRAP);
183 ARM_COMPUTE_EXPECT(bool(result) == false, framework::LogLevel::ERRORS);
184
185 result = NEArithmeticSubtraction::validate(&info0, &info1, &info1, ConvertPolicy::WRAP);
186 ARM_COMPUTE_EXPECT(bool(result) == false, framework::LogLevel::ERRORS);
187}
188TEST_SUITE_END() // InPlaceValidate
189
Sanghoon Lee72898fe2017-09-01 11:42:16 +0100190TEST_SUITE(U8)
Georgios Pinitasb2842be2020-06-22 21:27:14 +0100191FIXTURE_DATA_TEST_CASE(RunSmall, NEArithmeticSubtractionFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), ArithmeticSubtractionU8Dataset),
192 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
193 OutOfPlaceDataSet))
Sanghoon Lee72898fe2017-09-01 11:42:16 +0100194{
195 // Validate output
196 validate(Accessor(_target), _reference);
197}
Georgios Pinitascbf39c62018-09-10 15:07:45 +0100198TEST_SUITE_END() // U8
Isabella Gottardib5908c22017-10-30 15:28:13 +0000199
Michalis Spyroueae65842020-06-15 20:23:59 +0100200using NEArithmeticSubtractionQASYMM8Fixture = ArithmeticSubtractionValidationQuantizedFixture<Tensor, Accessor, NEArithmeticSubtraction, uint8_t>;
201using NEArithmeticSubtractionQASYMM8SignedFixture = ArithmeticSubtractionValidationQuantizedFixture<Tensor, Accessor, NEArithmeticSubtraction, int8_t>;
202using NEArithmeticSubtractionQASYMM8SignedBroadcastFixture = ArithmeticSubtractionValidationQuantizedBroadcastFixture<Tensor, Accessor, NEArithmeticSubtraction, int8_t>;
203using NEArithmeticSubtractionQSYMM16Fixture = ArithmeticSubtractionValidationQuantizedFixture<Tensor, Accessor, NEArithmeticSubtraction, int16_t>;
Manuel Bottini6a2b6e82019-02-25 13:50:11 +0000204
205TEST_SUITE(Quantized)
206TEST_SUITE(QASYMM8)
Georgios Pinitasb2842be2020-06-22 21:27:14 +0100207FIXTURE_DATA_TEST_CASE(RunSmall, NEArithmeticSubtractionQASYMM8Fixture, framework::DatasetMode::ALL, combine(combine(combine(combine(datasets::SmallShapes(), ArithmeticSubtractionQASYMM8Dataset),
Michele Di Giorgio9f2403f2020-03-27 10:23:44 +0000208 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE })),
Georgios Pinitasb2842be2020-06-22 21:27:14 +0100209 ArithmeticSubtractionQuantizationInfoDataset),
210 InPlaceDataSet))
Manuel Bottini6a2b6e82019-02-25 13:50:11 +0000211{
212 // Validate output
Manuel Bottini8d04fa02019-03-08 14:00:40 +0000213 validate(Accessor(_target), _reference, tolerance_qasymm8);
Manuel Bottini6a2b6e82019-02-25 13:50:11 +0000214}
215TEST_SUITE_END() // QASYMM8
Michalis Spyrou6f58b372019-12-04 12:00:36 +0000216
217TEST_SUITE(QASYMM8_SIGNED)
Georgios Pinitasb2842be2020-06-22 21:27:14 +0100218FIXTURE_DATA_TEST_CASE(RunSmall, NEArithmeticSubtractionQASYMM8SignedFixture, framework::DatasetMode::ALL, combine(combine(combine(combine(
Michele Di Giorgio9f2403f2020-03-27 10:23:44 +0000219 datasets::SmallShapes(),
220 ArithmeticSubtractionQASYMM8SIGNEDDataset),
221 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE })),
Georgios Pinitasb2842be2020-06-22 21:27:14 +0100222 ArithmeticSubtractionQuantizationInfoSignedDataset),
223 InPlaceDataSet))
Michalis Spyrou6f58b372019-12-04 12:00:36 +0000224{
225 // Validate output
226 validate(Accessor(_target), _reference, tolerance_qasymm8);
227}
Michalis Spyroueae65842020-06-15 20:23:59 +0100228
Georgios Pinitasb2842be2020-06-22 21:27:14 +0100229FIXTURE_DATA_TEST_CASE(RunSmallBroadcast, NEArithmeticSubtractionQASYMM8SignedBroadcastFixture, framework::DatasetMode::ALL, combine(combine(combine(combine(
Michalis Spyroueae65842020-06-15 20:23:59 +0100230 datasets::SmallShapesBroadcast(),
231 ArithmeticSubtractionQASYMM8SIGNEDDataset),
232 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE })),
Georgios Pinitasb2842be2020-06-22 21:27:14 +0100233 ArithmeticSubtractionQuantizationInfoSignedDataset),
234 OutOfPlaceDataSet))
Michalis Spyroueae65842020-06-15 20:23:59 +0100235{
236 // Validate output
237 validate(Accessor(_target), _reference, tolerance_qasymm8);
238}
Michalis Spyrou6f58b372019-12-04 12:00:36 +0000239TEST_SUITE_END() // QASYMM8_SIGNED
Michele Di Giorgio9f2403f2020-03-27 10:23:44 +0000240
241TEST_SUITE(QSYMM16)
Georgios Pinitasb2842be2020-06-22 21:27:14 +0100242FIXTURE_DATA_TEST_CASE(RunSmall, NEArithmeticSubtractionQSYMM16Fixture, framework::DatasetMode::ALL, combine(combine(combine(combine(
Michele Di Giorgio9f2403f2020-03-27 10:23:44 +0000243 datasets::SmallShapes(),
244 ArithmeticSubtractionQSYMM16Dataset),
245 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE })),
Georgios Pinitasb2842be2020-06-22 21:27:14 +0100246 ArithmeticSubtractionQuantizationInfoSymmetric),
247 OutOfPlaceDataSet))
Michele Di Giorgio9f2403f2020-03-27 10:23:44 +0000248{
249 // Validate output
250 validate(Accessor(_target), _reference, tolerance_qsymm16);
251}
252TEST_SUITE_END() // QSYMM16
Manuel Bottini6a2b6e82019-02-25 13:50:11 +0000253TEST_SUITE_END() // Quantized
254
Sanghoon Lee72898fe2017-09-01 11:42:16 +0100255TEST_SUITE(S16)
Georgios Pinitasb2842be2020-06-22 21:27:14 +0100256FIXTURE_DATA_TEST_CASE(RunSmall, NEArithmeticSubtractionFixture<int16_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), ArithmeticSubtractionS16Dataset),
257 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
258 OutOfPlaceDataSet))
Sanghoon Lee72898fe2017-09-01 11:42:16 +0100259{
260 // Validate output
261 validate(Accessor(_target), _reference);
262}
263
Georgios Pinitasb2842be2020-06-22 21:27:14 +0100264FIXTURE_DATA_TEST_CASE(RunLarge, NEArithmeticSubtractionFixture<int16_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), ArithmeticSubtractionS16Dataset),
265 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
266 OutOfPlaceDataSet))
Sanghoon Lee72898fe2017-09-01 11:42:16 +0100267{
268 // Validate output
269 validate(Accessor(_target), _reference);
270}
Georgios Pinitascbf39c62018-09-10 15:07:45 +0100271TEST_SUITE_END() // S16
Isabella Gottardib5908c22017-10-30 15:28:13 +0000272
Sanghoon Lee72898fe2017-09-01 11:42:16 +0100273TEST_SUITE(Float)
Ioan-Cristian Szabo5edbd1c2017-11-13 13:34:08 +0000274#ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
Georgios Pinitascbf39c62018-09-10 15:07:45 +0100275TEST_SUITE(F16)
Georgios Pinitasb2842be2020-06-22 21:27:14 +0100276FIXTURE_DATA_TEST_CASE(RunSmall, NEArithmeticSubtractionFixture<half>, framework::DatasetMode::ALL, combine(combine(combine(datasets::SmallShapes(), ArithmeticSubtractionFP16Dataset),
277 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
278 OutOfPlaceDataSet))
Sanghoon Lee72898fe2017-09-01 11:42:16 +0100279{
280 // Validate output
281 validate(Accessor(_target), _reference);
282}
Georgios Pinitascbf39c62018-09-10 15:07:45 +0100283TEST_SUITE_END() // F16
284#endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */
Sanghoon Lee72898fe2017-09-01 11:42:16 +0100285
Georgios Pinitascbf39c62018-09-10 15:07:45 +0100286TEST_SUITE(F32)
Georgios Pinitasb2842be2020-06-22 21:27:14 +0100287FIXTURE_DATA_TEST_CASE(RunSmall, NEArithmeticSubtractionFixture<float>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), ArithmeticSubtractionFP32Dataset),
288 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
289 InPlaceDataSet))
Sanghoon Lee72898fe2017-09-01 11:42:16 +0100290{
291 // Validate output
292 validate(Accessor(_target), _reference);
293}
294
Georgios Pinitasb2842be2020-06-22 21:27:14 +0100295FIXTURE_DATA_TEST_CASE(RunLarge, NEArithmeticSubtractionFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), ArithmeticSubtractionFP32Dataset),
296 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
297 OutOfPlaceDataSet))
Sanghoon Lee72898fe2017-09-01 11:42:16 +0100298{
299 // Validate output
300 validate(Accessor(_target), _reference);
301}
Sanghoon Lee72898fe2017-09-01 11:42:16 +0100302
Georgios Pinitascbf39c62018-09-10 15:07:45 +0100303template <typename T>
304using NEArithmeticSubtractionBroadcastFixture = ArithmeticSubtractionBroadcastValidationFixture<Tensor, Accessor, NEArithmeticSubtraction, T>;
305
Georgios Pinitasb2842be2020-06-22 21:27:14 +0100306FIXTURE_DATA_TEST_CASE(RunSmallBroadcast, NEArithmeticSubtractionBroadcastFixture<float>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapesBroadcast(),
Georgios Pinitascbf39c62018-09-10 15:07:45 +0100307 ArithmeticSubtractionFP32Dataset),
Georgios Pinitasb2842be2020-06-22 21:27:14 +0100308 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
309 OutOfPlaceDataSet))
Georgios Pinitascbf39c62018-09-10 15:07:45 +0100310{
311 // Validate output
312 validate(Accessor(_target), _reference);
313}
314
Georgios Pinitasb2842be2020-06-22 21:27:14 +0100315FIXTURE_DATA_TEST_CASE(RunLargeBroadcast, NEArithmeticSubtractionBroadcastFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapesBroadcast(),
Georgios Pinitascbf39c62018-09-10 15:07:45 +0100316 ArithmeticSubtractionFP32Dataset),
Georgios Pinitasb2842be2020-06-22 21:27:14 +0100317 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
318 OutOfPlaceDataSet))
Georgios Pinitascbf39c62018-09-10 15:07:45 +0100319{
320 // Validate output
321 validate(Accessor(_target), _reference);
322}
323TEST_SUITE_END() // F32
324TEST_SUITE_END() // Float
325
326TEST_SUITE_END() // ArithmeticSubtraction
327TEST_SUITE_END() // NEON
Sanghoon Lee72898fe2017-09-01 11:42:16 +0100328} // namespace validation
329} // namespace test
330} // namespace arm_compute