blob: 7a368934454e05d426a65be5e94be84424434749 [file] [log] [blame]
Sanghoon Lee72898fe2017-09-01 11:42:16 +01001/*
Sheri Zhangac6499a2021-02-10 15:32:38 +00002 * Copyright (c) 2017-2021 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));
SiCong Li903f8cc2020-08-27 10:17:10 +010073
74const auto ArithmeticSubtractionS32Dataset = combine(combine(framework::dataset::make("DataType", DataType::S32),
75 framework::dataset::make("DataType", DataType::S32)),
76 framework::dataset::make("DataType", DataType::S32));
Ioan-Cristian Szabo5edbd1c2017-11-13 13:34:08 +000077#ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
Manuel Bottini6a2b6e82019-02-25 13:50:11 +000078const auto ArithmeticSubtractionFP16Dataset = combine(combine(framework::dataset::make("DataType", DataType::F16),
79 framework::dataset::make("DataType", DataType::F16)),
Sanghoon Lee72898fe2017-09-01 11:42:16 +010080 framework::dataset::make("DataType", DataType::F16));
Ioan-Cristian Szabo5edbd1c2017-11-13 13:34:08 +000081#endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */
Manuel Bottini6a2b6e82019-02-25 13:50:11 +000082const auto ArithmeticSubtractionFP32Dataset = combine(combine(framework::dataset::make("DataType", DataType::F32),
83 framework::dataset::make("DataType", DataType::F32)),
Sanghoon Lee72898fe2017-09-01 11:42:16 +010084 framework::dataset::make("DataType", DataType::F32));
Manuel Bottini6a2b6e82019-02-25 13:50:11 +000085
86const auto ArithmeticSubtractionQuantizationInfoDataset = combine(combine(framework::dataset::make("QuantizationInfoIn1", { QuantizationInfo(10, 120) }),
87 framework::dataset::make("QuantizationInfoIn2", { QuantizationInfo(20, 110) })),
88 framework::dataset::make("QuantizationInfoOut", { QuantizationInfo(15, 125) }));
Michalis Spyrou6f58b372019-12-04 12:00:36 +000089const auto ArithmeticSubtractionQuantizationInfoSignedDataset = combine(combine(framework::dataset::make("QuantizationInfoIn1", { QuantizationInfo(0.5f, 10) }),
90 framework::dataset::make("QuantizationInfoIn2", { QuantizationInfo(0.5f, 20) })),
91 framework::dataset::make("QuantizationInfoOut", { QuantizationInfo(0.5f, 50) }));
Michele Di Giorgio9f2403f2020-03-27 10:23:44 +000092const auto ArithmeticSubtractionQuantizationInfoSymmetric = combine(combine(framework::dataset::make("QuantizationInfoIn1", { QuantizationInfo(0.3f, 0) }),
93 framework::dataset::make("QuantizationInfoIn2", { QuantizationInfo(0.7f, 0) })),
94 framework::dataset::make("QuantizationInfoOut", { QuantizationInfo(0.2f, 0) }));
Georgios Pinitasb2842be2020-06-22 21:27:14 +010095const auto InPlaceDataSet = framework::dataset::make("InPlace", { false, true });
96const auto OutOfPlaceDataSet = framework::dataset::make("InPlace", { false });
Sanghoon Lee72898fe2017-09-01 11:42:16 +010097} // namespace
98
99TEST_SUITE(NEON)
100TEST_SUITE(ArithmeticSubtraction)
101
Georgios Pinitascbf39c62018-09-10 15:07:45 +0100102template <typename T>
103using NEArithmeticSubtractionFixture = ArithmeticSubtractionValidationFixture<Tensor, Accessor, NEArithmeticSubtraction, T>;
104
Ioan-Cristian Szabo397d58a2017-11-30 15:19:11 +0000105// *INDENT-OFF*
106// clang-format off
Manuel Bottini6a2b6e82019-02-25 13:50:11 +0000107DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(
Georgios Pinitascbf39c62018-09-10 15:07:45 +0100108 framework::dataset::make("Input1Info", { TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
109 TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
Georgios Pinitascbf39c62018-09-10 15:07:45 +0100110 TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8), // Invalid data type combination
111 TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32), // Mismatching shapes
Manuel Bottini6a2b6e82019-02-25 13:50:11 +0000112 TensorInfo(TensorShape(48U, 11U, 2U), 1, DataType::QASYMM8), // Mismatching types
113 TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QASYMM8), // Invalid convert policy
Georgios Pinitascbf39c62018-09-10 15:07:45 +0100114 }),
115 framework::dataset::make("Input2Info",{ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
116 TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
Georgios Pinitascbf39c62018-09-10 15:07:45 +0100117 TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::S16),
118 TensorInfo(TensorShape(48U, 11U, 2U), 1, DataType::F32),
Manuel Bottini6a2b6e82019-02-25 13:50:11 +0000119 TensorInfo(TensorShape(48U, 11U, 2U), 1, DataType::F32),
120 TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QASYMM8),
Georgios Pinitascbf39c62018-09-10 15:07:45 +0100121 })),
122 framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::S16),
123 TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
Georgios Pinitascbf39c62018-09-10 15:07:45 +0100124 TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
125 TensorInfo(TensorShape(48U, 11U, 2U), 1, DataType::F32),
Manuel Bottini6a2b6e82019-02-25 13:50:11 +0000126 TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QASYMM8),
SiCong Li903f8cc2020-08-27 10:17:10 +0100127 TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QASYMM8),
Georgios Pinitascbf39c62018-09-10 15:07:45 +0100128 })),
Manuel Bottini6a2b6e82019-02-25 13:50:11 +0000129 framework::dataset::make("ConvertPolicy",{ ConvertPolicy::WRAP,
130 ConvertPolicy::SATURATE,
Manuel Bottini6a2b6e82019-02-25 13:50:11 +0000131 ConvertPolicy::SATURATE,
132 ConvertPolicy::WRAP,
133 ConvertPolicy::WRAP,
SiCong Li903f8cc2020-08-27 10:17:10 +0100134 ConvertPolicy::WRAP,
Manuel Bottini6a2b6e82019-02-25 13:50:11 +0000135 })),
Michalis Spyrou5f390912020-05-13 00:12:08 +0100136 framework::dataset::make("Expected", { true, true, false, false, false, false})),
Manuel Bottini6a2b6e82019-02-25 13:50:11 +0000137 input1_info, input2_info, output_info, policy, expected)
Ioan-Cristian Szabo397d58a2017-11-30 15:19:11 +0000138{
Manuel Bottini6a2b6e82019-02-25 13:50:11 +0000139 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 +0000140}
141// clang-format on
142// *INDENT-ON*
143
Georgios Pinitasb2842be2020-06-22 21:27:14 +0100144TEST_SUITE(InPlaceValidate)
145TEST_CASE(SingleTensor, framework::DatasetMode::ALL)
146{
147 const auto random_shape = TensorShape{ 9, 9 };
148 const auto single_tensor_info = TensorInfo{ random_shape, 1, DataType::F32 };
149
150 Status result = NEArithmeticSubtraction::validate(&single_tensor_info, &single_tensor_info, &single_tensor_info, ConvertPolicy::WRAP);
151 ARM_COMPUTE_EXPECT(bool(result) == true, framework::LogLevel::ERRORS);
152}
153
154TEST_CASE(ValidBroadCast, framework::DatasetMode::ALL)
155{
156 const auto larger_shape = TensorShape{ 27U, 13U, 2U };
157 const auto smaller_shape = TensorShape{ 1U, 13U, 2U };
158
159 const auto larger_tensor_info = TensorInfo{ larger_shape, 1, DataType::F32 };
160 const auto smaller_tensor_info = TensorInfo{ smaller_shape, 1, DataType::F32 };
161
162 Status result = NEArithmeticSubtraction::validate(&larger_tensor_info, &smaller_tensor_info, &larger_tensor_info, ConvertPolicy::WRAP);
163 ARM_COMPUTE_EXPECT(bool(result) == true, framework::LogLevel::ERRORS);
164}
165
166TEST_CASE(InvalidBroadcastOutput, framework::DatasetMode::ALL)
167{
168 const auto larger_shape = TensorShape{ 27U, 13U, 2U };
169 const auto smaller_shape = TensorShape{ 1U, 13U, 2U };
170
171 const auto larger_tensor_info = TensorInfo{ larger_shape, 1, DataType::F32 };
172 const auto smaller_tensor_info = TensorInfo{ smaller_shape, 1, DataType::F32 };
173
174 Status result = NEArithmeticSubtraction::validate(&larger_tensor_info, &smaller_tensor_info, &smaller_tensor_info, ConvertPolicy::WRAP);
175 ARM_COMPUTE_EXPECT(bool(result) == false, framework::LogLevel::ERRORS);
176}
177
178TEST_CASE(InvalidBroadcastBoth, framework::DatasetMode::ALL)
179{
180 const auto shape0 = TensorShape{ 9U, 9U };
181 const auto shape1 = TensorShape{ 9U, 1U, 2U };
182
183 const auto info0 = TensorInfo{ shape0, 1, DataType::F32 };
184 const auto info1 = TensorInfo{ shape1, 1, DataType::F32 };
185
186 Status result{};
187
188 result = NEArithmeticSubtraction::validate(&info0, &info1, &info0, ConvertPolicy::WRAP);
189 ARM_COMPUTE_EXPECT(bool(result) == false, framework::LogLevel::ERRORS);
190
191 result = NEArithmeticSubtraction::validate(&info0, &info1, &info1, ConvertPolicy::WRAP);
192 ARM_COMPUTE_EXPECT(bool(result) == false, framework::LogLevel::ERRORS);
193}
194TEST_SUITE_END() // InPlaceValidate
195
Sanghoon Lee72898fe2017-09-01 11:42:16 +0100196TEST_SUITE(U8)
Georgios Pinitasb2842be2020-06-22 21:27:14 +0100197FIXTURE_DATA_TEST_CASE(RunSmall, NEArithmeticSubtractionFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), ArithmeticSubtractionU8Dataset),
198 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
199 OutOfPlaceDataSet))
Sanghoon Lee72898fe2017-09-01 11:42:16 +0100200{
201 // Validate output
202 validate(Accessor(_target), _reference);
203}
Georgios Pinitascbf39c62018-09-10 15:07:45 +0100204TEST_SUITE_END() // U8
Isabella Gottardib5908c22017-10-30 15:28:13 +0000205
Michalis Spyroueae65842020-06-15 20:23:59 +0100206using NEArithmeticSubtractionQASYMM8Fixture = ArithmeticSubtractionValidationQuantizedFixture<Tensor, Accessor, NEArithmeticSubtraction, uint8_t>;
207using NEArithmeticSubtractionQASYMM8SignedFixture = ArithmeticSubtractionValidationQuantizedFixture<Tensor, Accessor, NEArithmeticSubtraction, int8_t>;
208using NEArithmeticSubtractionQASYMM8SignedBroadcastFixture = ArithmeticSubtractionValidationQuantizedBroadcastFixture<Tensor, Accessor, NEArithmeticSubtraction, int8_t>;
209using NEArithmeticSubtractionQSYMM16Fixture = ArithmeticSubtractionValidationQuantizedFixture<Tensor, Accessor, NEArithmeticSubtraction, int16_t>;
Manuel Bottini6a2b6e82019-02-25 13:50:11 +0000210
211TEST_SUITE(Quantized)
212TEST_SUITE(QASYMM8)
Georgios Pinitasb2842be2020-06-22 21:27:14 +0100213FIXTURE_DATA_TEST_CASE(RunSmall, NEArithmeticSubtractionQASYMM8Fixture, framework::DatasetMode::ALL, combine(combine(combine(combine(datasets::SmallShapes(), ArithmeticSubtractionQASYMM8Dataset),
Michele Di Giorgio9f2403f2020-03-27 10:23:44 +0000214 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE })),
Georgios Pinitasb2842be2020-06-22 21:27:14 +0100215 ArithmeticSubtractionQuantizationInfoDataset),
216 InPlaceDataSet))
Manuel Bottini6a2b6e82019-02-25 13:50:11 +0000217{
218 // Validate output
Manuel Bottini8d04fa02019-03-08 14:00:40 +0000219 validate(Accessor(_target), _reference, tolerance_qasymm8);
Manuel Bottini6a2b6e82019-02-25 13:50:11 +0000220}
221TEST_SUITE_END() // QASYMM8
Michalis Spyrou6f58b372019-12-04 12:00:36 +0000222
223TEST_SUITE(QASYMM8_SIGNED)
Georgios Pinitasb2842be2020-06-22 21:27:14 +0100224FIXTURE_DATA_TEST_CASE(RunSmall, NEArithmeticSubtractionQASYMM8SignedFixture, framework::DatasetMode::ALL, combine(combine(combine(combine(
Michele Di Giorgio9f2403f2020-03-27 10:23:44 +0000225 datasets::SmallShapes(),
226 ArithmeticSubtractionQASYMM8SIGNEDDataset),
227 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE })),
Georgios Pinitasb2842be2020-06-22 21:27:14 +0100228 ArithmeticSubtractionQuantizationInfoSignedDataset),
229 InPlaceDataSet))
Michalis Spyrou6f58b372019-12-04 12:00:36 +0000230{
231 // Validate output
232 validate(Accessor(_target), _reference, tolerance_qasymm8);
233}
Michalis Spyroueae65842020-06-15 20:23:59 +0100234
Georgios Pinitasb2842be2020-06-22 21:27:14 +0100235FIXTURE_DATA_TEST_CASE(RunSmallBroadcast, NEArithmeticSubtractionQASYMM8SignedBroadcastFixture, framework::DatasetMode::ALL, combine(combine(combine(combine(
Michalis Spyroueae65842020-06-15 20:23:59 +0100236 datasets::SmallShapesBroadcast(),
237 ArithmeticSubtractionQASYMM8SIGNEDDataset),
238 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE })),
Georgios Pinitasb2842be2020-06-22 21:27:14 +0100239 ArithmeticSubtractionQuantizationInfoSignedDataset),
240 OutOfPlaceDataSet))
Michalis Spyroueae65842020-06-15 20:23:59 +0100241{
242 // Validate output
243 validate(Accessor(_target), _reference, tolerance_qasymm8);
244}
Michalis Spyrou6f58b372019-12-04 12:00:36 +0000245TEST_SUITE_END() // QASYMM8_SIGNED
Michele Di Giorgio9f2403f2020-03-27 10:23:44 +0000246
247TEST_SUITE(QSYMM16)
Georgios Pinitasb2842be2020-06-22 21:27:14 +0100248FIXTURE_DATA_TEST_CASE(RunSmall, NEArithmeticSubtractionQSYMM16Fixture, framework::DatasetMode::ALL, combine(combine(combine(combine(
Michele Di Giorgio9f2403f2020-03-27 10:23:44 +0000249 datasets::SmallShapes(),
250 ArithmeticSubtractionQSYMM16Dataset),
251 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE })),
Georgios Pinitasb2842be2020-06-22 21:27:14 +0100252 ArithmeticSubtractionQuantizationInfoSymmetric),
253 OutOfPlaceDataSet))
Michele Di Giorgio9f2403f2020-03-27 10:23:44 +0000254{
255 // Validate output
256 validate(Accessor(_target), _reference, tolerance_qsymm16);
257}
258TEST_SUITE_END() // QSYMM16
Manuel Bottini6a2b6e82019-02-25 13:50:11 +0000259TEST_SUITE_END() // Quantized
260
Sanghoon Lee72898fe2017-09-01 11:42:16 +0100261TEST_SUITE(S16)
Georgios Pinitasb2842be2020-06-22 21:27:14 +0100262FIXTURE_DATA_TEST_CASE(RunSmall, NEArithmeticSubtractionFixture<int16_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), ArithmeticSubtractionS16Dataset),
263 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
264 OutOfPlaceDataSet))
Sanghoon Lee72898fe2017-09-01 11:42:16 +0100265{
266 // Validate output
267 validate(Accessor(_target), _reference);
268}
269
Georgios Pinitasb2842be2020-06-22 21:27:14 +0100270FIXTURE_DATA_TEST_CASE(RunLarge, NEArithmeticSubtractionFixture<int16_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), ArithmeticSubtractionS16Dataset),
271 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
272 OutOfPlaceDataSet))
Sanghoon Lee72898fe2017-09-01 11:42:16 +0100273{
274 // Validate output
275 validate(Accessor(_target), _reference);
276}
Georgios Pinitascbf39c62018-09-10 15:07:45 +0100277TEST_SUITE_END() // S16
Isabella Gottardib5908c22017-10-30 15:28:13 +0000278
SiCong Li903f8cc2020-08-27 10:17:10 +0100279TEST_SUITE(S32)
280FIXTURE_DATA_TEST_CASE(RunSmall, NEArithmeticSubtractionFixture<int32_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), ArithmeticSubtractionS32Dataset),
281 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
282 OutOfPlaceDataSet))
283{
284 // Validate output
285 validate(Accessor(_target), _reference);
286}
287
288FIXTURE_DATA_TEST_CASE(RunLarge, NEArithmeticSubtractionFixture<int32_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), ArithmeticSubtractionS32Dataset),
289 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
290 OutOfPlaceDataSet))
291{
292 // Validate output
293 validate(Accessor(_target), _reference);
294}
295TEST_SUITE_END() // S32
296
Sanghoon Lee72898fe2017-09-01 11:42:16 +0100297TEST_SUITE(Float)
Ioan-Cristian Szabo5edbd1c2017-11-13 13:34:08 +0000298#ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
Georgios Pinitascbf39c62018-09-10 15:07:45 +0100299TEST_SUITE(F16)
Georgios Pinitasb2842be2020-06-22 21:27:14 +0100300FIXTURE_DATA_TEST_CASE(RunSmall, NEArithmeticSubtractionFixture<half>, framework::DatasetMode::ALL, combine(combine(combine(datasets::SmallShapes(), ArithmeticSubtractionFP16Dataset),
301 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
302 OutOfPlaceDataSet))
Sanghoon Lee72898fe2017-09-01 11:42:16 +0100303{
304 // Validate output
305 validate(Accessor(_target), _reference);
306}
Georgios Pinitascbf39c62018-09-10 15:07:45 +0100307TEST_SUITE_END() // F16
308#endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */
Sanghoon Lee72898fe2017-09-01 11:42:16 +0100309
Georgios Pinitascbf39c62018-09-10 15:07:45 +0100310TEST_SUITE(F32)
Georgios Pinitasb2842be2020-06-22 21:27:14 +0100311FIXTURE_DATA_TEST_CASE(RunSmall, NEArithmeticSubtractionFixture<float>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), ArithmeticSubtractionFP32Dataset),
312 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
313 InPlaceDataSet))
Sanghoon Lee72898fe2017-09-01 11:42:16 +0100314{
315 // Validate output
316 validate(Accessor(_target), _reference);
317}
318
Georgios Pinitasb2842be2020-06-22 21:27:14 +0100319FIXTURE_DATA_TEST_CASE(RunLarge, NEArithmeticSubtractionFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), ArithmeticSubtractionFP32Dataset),
320 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
321 OutOfPlaceDataSet))
Sanghoon Lee72898fe2017-09-01 11:42:16 +0100322{
323 // Validate output
324 validate(Accessor(_target), _reference);
325}
Sanghoon Lee72898fe2017-09-01 11:42:16 +0100326
Georgios Pinitascbf39c62018-09-10 15:07:45 +0100327template <typename T>
328using NEArithmeticSubtractionBroadcastFixture = ArithmeticSubtractionBroadcastValidationFixture<Tensor, Accessor, NEArithmeticSubtraction, T>;
329
Georgios Pinitasb2842be2020-06-22 21:27:14 +0100330FIXTURE_DATA_TEST_CASE(RunSmallBroadcast, NEArithmeticSubtractionBroadcastFixture<float>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapesBroadcast(),
Georgios Pinitascbf39c62018-09-10 15:07:45 +0100331 ArithmeticSubtractionFP32Dataset),
Georgios Pinitasb2842be2020-06-22 21:27:14 +0100332 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
333 OutOfPlaceDataSet))
Georgios Pinitascbf39c62018-09-10 15:07:45 +0100334{
335 // Validate output
336 validate(Accessor(_target), _reference);
337}
338
Georgios Pinitasb2842be2020-06-22 21:27:14 +0100339FIXTURE_DATA_TEST_CASE(RunLargeBroadcast, NEArithmeticSubtractionBroadcastFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapesBroadcast(),
Georgios Pinitascbf39c62018-09-10 15:07:45 +0100340 ArithmeticSubtractionFP32Dataset),
Georgios Pinitasb2842be2020-06-22 21:27:14 +0100341 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
342 OutOfPlaceDataSet))
Georgios Pinitascbf39c62018-09-10 15:07:45 +0100343{
344 // Validate output
345 validate(Accessor(_target), _reference);
346}
347TEST_SUITE_END() // F32
348TEST_SUITE_END() // Float
349
350TEST_SUITE_END() // ArithmeticSubtraction
Sheri Zhangac6499a2021-02-10 15:32:38 +0000351TEST_SUITE_END() // Neon
Sanghoon Lee72898fe2017-09-01 11:42:16 +0100352} // namespace validation
353} // namespace test
354} // namespace arm_compute