blob: 8886ca2db51b74af6013f4afb7f613cc7319fd68 [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
Georgios Pinitasda816752021-07-02 09:22:14 +010053// Quantization Infomation DataSet
Manuel Bottini6a2b6e82019-02-25 13:50:11 +000054const auto ArithmeticSubtractionQuantizationInfoDataset = combine(combine(framework::dataset::make("QuantizationInfoIn1", { QuantizationInfo(10, 120) }),
55 framework::dataset::make("QuantizationInfoIn2", { QuantizationInfo(20, 110) })),
56 framework::dataset::make("QuantizationInfoOut", { QuantizationInfo(15, 125) }));
Michalis Spyrou6f58b372019-12-04 12:00:36 +000057const auto ArithmeticSubtractionQuantizationInfoSignedDataset = combine(combine(framework::dataset::make("QuantizationInfoIn1", { QuantizationInfo(0.5f, 10) }),
58 framework::dataset::make("QuantizationInfoIn2", { QuantizationInfo(0.5f, 20) })),
59 framework::dataset::make("QuantizationInfoOut", { QuantizationInfo(0.5f, 50) }));
Sheri Zhanga387e272021-06-29 17:34:06 +010060const auto ArithmeticSubtractionQuantizationInfoSignedInPlaceDataset = combine(combine(framework::dataset::make("QuantizationInfoIn1", { QuantizationInfo(0.8f, 10) }),
61 framework::dataset::make("QuantizationInfoIn2", { QuantizationInfo(0.8f, 10) })),
62 framework::dataset::make("QuantizationInfoOut", { QuantizationInfo(0.8f, 10) }));
Michele Di Giorgio9f2403f2020-03-27 10:23:44 +000063const auto ArithmeticSubtractionQuantizationInfoSymmetric = combine(combine(framework::dataset::make("QuantizationInfoIn1", { QuantizationInfo(0.3f, 0) }),
64 framework::dataset::make("QuantizationInfoIn2", { QuantizationInfo(0.7f, 0) })),
65 framework::dataset::make("QuantizationInfoOut", { QuantizationInfo(0.2f, 0) }));
Georgios Pinitasb2842be2020-06-22 21:27:14 +010066const auto InPlaceDataSet = framework::dataset::make("InPlace", { false, true });
67const auto OutOfPlaceDataSet = framework::dataset::make("InPlace", { false });
Sanghoon Lee72898fe2017-09-01 11:42:16 +010068} // namespace
69
70TEST_SUITE(NEON)
71TEST_SUITE(ArithmeticSubtraction)
72
Georgios Pinitascbf39c62018-09-10 15:07:45 +010073template <typename T>
74using NEArithmeticSubtractionFixture = ArithmeticSubtractionValidationFixture<Tensor, Accessor, NEArithmeticSubtraction, T>;
75
Ioan-Cristian Szabo397d58a2017-11-30 15:19:11 +000076// *INDENT-OFF*
77// clang-format off
Manuel Bottini6a2b6e82019-02-25 13:50:11 +000078DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(
Georgios Pinitasda816752021-07-02 09:22:14 +010079 framework::dataset::make("Input1Info", { TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32),
Georgios Pinitascbf39c62018-09-10 15:07:45 +010080 TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8), // Invalid data type combination
81 TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32), // Mismatching shapes
Manuel Bottini6a2b6e82019-02-25 13:50:11 +000082 TensorInfo(TensorShape(48U, 11U, 2U), 1, DataType::QASYMM8), // Mismatching types
83 TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QASYMM8), // Invalid convert policy
Georgios Pinitascbf39c62018-09-10 15:07:45 +010084 }),
Georgios Pinitasda816752021-07-02 09:22:14 +010085 framework::dataset::make("Input2Info",{ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32),
Georgios Pinitascbf39c62018-09-10 15:07:45 +010086 TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::S16),
87 TensorInfo(TensorShape(48U, 11U, 2U), 1, DataType::F32),
Manuel Bottini6a2b6e82019-02-25 13:50:11 +000088 TensorInfo(TensorShape(48U, 11U, 2U), 1, DataType::F32),
89 TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QASYMM8),
Georgios Pinitascbf39c62018-09-10 15:07:45 +010090 })),
Georgios Pinitasda816752021-07-02 09:22:14 +010091 framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32),
Georgios Pinitascbf39c62018-09-10 15:07:45 +010092 TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
93 TensorInfo(TensorShape(48U, 11U, 2U), 1, DataType::F32),
Manuel Bottini6a2b6e82019-02-25 13:50:11 +000094 TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QASYMM8),
SiCong Li903f8cc2020-08-27 10:17:10 +010095 TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QASYMM8),
Georgios Pinitascbf39c62018-09-10 15:07:45 +010096 })),
Georgios Pinitasda816752021-07-02 09:22:14 +010097 framework::dataset::make("ConvertPolicy",{ ConvertPolicy::SATURATE,
98 ConvertPolicy::SATURATE,
99 ConvertPolicy::WRAP,
100 ConvertPolicy::WRAP,
101 ConvertPolicy::WRAP,
Manuel Bottini6a2b6e82019-02-25 13:50:11 +0000102 })),
Georgios Pinitasda816752021-07-02 09:22:14 +0100103 framework::dataset::make("Expected", { true, false, false, false, false})),
Manuel Bottini6a2b6e82019-02-25 13:50:11 +0000104 input1_info, input2_info, output_info, policy, expected)
Ioan-Cristian Szabo397d58a2017-11-30 15:19:11 +0000105{
Manuel Bottini6a2b6e82019-02-25 13:50:11 +0000106 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 +0000107}
108// clang-format on
109// *INDENT-ON*
110
Georgios Pinitasb2842be2020-06-22 21:27:14 +0100111TEST_SUITE(InPlaceValidate)
112TEST_CASE(SingleTensor, framework::DatasetMode::ALL)
113{
114 const auto random_shape = TensorShape{ 9, 9 };
115 const auto single_tensor_info = TensorInfo{ random_shape, 1, DataType::F32 };
116
117 Status result = NEArithmeticSubtraction::validate(&single_tensor_info, &single_tensor_info, &single_tensor_info, ConvertPolicy::WRAP);
118 ARM_COMPUTE_EXPECT(bool(result) == true, framework::LogLevel::ERRORS);
119}
120
121TEST_CASE(ValidBroadCast, framework::DatasetMode::ALL)
122{
123 const auto larger_shape = TensorShape{ 27U, 13U, 2U };
124 const auto smaller_shape = TensorShape{ 1U, 13U, 2U };
125
126 const auto larger_tensor_info = TensorInfo{ larger_shape, 1, DataType::F32 };
127 const auto smaller_tensor_info = TensorInfo{ smaller_shape, 1, DataType::F32 };
128
129 Status result = NEArithmeticSubtraction::validate(&larger_tensor_info, &smaller_tensor_info, &larger_tensor_info, ConvertPolicy::WRAP);
130 ARM_COMPUTE_EXPECT(bool(result) == true, framework::LogLevel::ERRORS);
131}
132
133TEST_CASE(InvalidBroadcastOutput, framework::DatasetMode::ALL)
134{
135 const auto larger_shape = TensorShape{ 27U, 13U, 2U };
136 const auto smaller_shape = TensorShape{ 1U, 13U, 2U };
137
138 const auto larger_tensor_info = TensorInfo{ larger_shape, 1, DataType::F32 };
139 const auto smaller_tensor_info = TensorInfo{ smaller_shape, 1, DataType::F32 };
140
141 Status result = NEArithmeticSubtraction::validate(&larger_tensor_info, &smaller_tensor_info, &smaller_tensor_info, ConvertPolicy::WRAP);
142 ARM_COMPUTE_EXPECT(bool(result) == false, framework::LogLevel::ERRORS);
143}
144
145TEST_CASE(InvalidBroadcastBoth, framework::DatasetMode::ALL)
146{
147 const auto shape0 = TensorShape{ 9U, 9U };
148 const auto shape1 = TensorShape{ 9U, 1U, 2U };
149
150 const auto info0 = TensorInfo{ shape0, 1, DataType::F32 };
151 const auto info1 = TensorInfo{ shape1, 1, DataType::F32 };
152
153 Status result{};
154
155 result = NEArithmeticSubtraction::validate(&info0, &info1, &info0, ConvertPolicy::WRAP);
156 ARM_COMPUTE_EXPECT(bool(result) == false, framework::LogLevel::ERRORS);
157
158 result = NEArithmeticSubtraction::validate(&info0, &info1, &info1, ConvertPolicy::WRAP);
159 ARM_COMPUTE_EXPECT(bool(result) == false, framework::LogLevel::ERRORS);
160}
161TEST_SUITE_END() // InPlaceValidate
162
Sanghoon Lee72898fe2017-09-01 11:42:16 +0100163TEST_SUITE(U8)
Georgios Pinitasda816752021-07-02 09:22:14 +0100164FIXTURE_DATA_TEST_CASE(RunSmall, NEArithmeticSubtractionFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType",
165 DataType::U8)),
Georgios Pinitasb2842be2020-06-22 21:27:14 +0100166 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
167 OutOfPlaceDataSet))
Sanghoon Lee72898fe2017-09-01 11:42:16 +0100168{
169 // Validate output
170 validate(Accessor(_target), _reference);
171}
Georgios Pinitascbf39c62018-09-10 15:07:45 +0100172TEST_SUITE_END() // U8
Isabella Gottardib5908c22017-10-30 15:28:13 +0000173
Michalis Spyroueae65842020-06-15 20:23:59 +0100174using NEArithmeticSubtractionQASYMM8Fixture = ArithmeticSubtractionValidationQuantizedFixture<Tensor, Accessor, NEArithmeticSubtraction, uint8_t>;
175using NEArithmeticSubtractionQASYMM8SignedFixture = ArithmeticSubtractionValidationQuantizedFixture<Tensor, Accessor, NEArithmeticSubtraction, int8_t>;
176using NEArithmeticSubtractionQASYMM8SignedBroadcastFixture = ArithmeticSubtractionValidationQuantizedBroadcastFixture<Tensor, Accessor, NEArithmeticSubtraction, int8_t>;
177using NEArithmeticSubtractionQSYMM16Fixture = ArithmeticSubtractionValidationQuantizedFixture<Tensor, Accessor, NEArithmeticSubtraction, int16_t>;
Manuel Bottini6a2b6e82019-02-25 13:50:11 +0000178
179TEST_SUITE(Quantized)
180TEST_SUITE(QASYMM8)
Georgios Pinitasda816752021-07-02 09:22:14 +0100181FIXTURE_DATA_TEST_CASE(RunSmall, NEArithmeticSubtractionQASYMM8Fixture, framework::DatasetMode::ALL, combine(combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType",
182 DataType::QASYMM8)),
Michele Di Giorgio9f2403f2020-03-27 10:23:44 +0000183 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE })),
Georgios Pinitasb2842be2020-06-22 21:27:14 +0100184 ArithmeticSubtractionQuantizationInfoDataset),
Sheri Zhanga387e272021-06-29 17:34:06 +0100185 OutOfPlaceDataSet))
Manuel Bottini6a2b6e82019-02-25 13:50:11 +0000186{
187 // Validate output
Manuel Bottini8d04fa02019-03-08 14:00:40 +0000188 validate(Accessor(_target), _reference, tolerance_qasymm8);
Manuel Bottini6a2b6e82019-02-25 13:50:11 +0000189}
190TEST_SUITE_END() // QASYMM8
Michalis Spyrou6f58b372019-12-04 12:00:36 +0000191
192TEST_SUITE(QASYMM8_SIGNED)
Georgios Pinitasb2842be2020-06-22 21:27:14 +0100193FIXTURE_DATA_TEST_CASE(RunSmall, NEArithmeticSubtractionQASYMM8SignedFixture, framework::DatasetMode::ALL, combine(combine(combine(combine(
Georgios Pinitasda816752021-07-02 09:22:14 +0100194 datasets::SmallShapes(), framework::dataset::make("DataType", DataType::QASYMM8_SIGNED)),
Michele Di Giorgio9f2403f2020-03-27 10:23:44 +0000195 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE })),
Georgios Pinitasb2842be2020-06-22 21:27:14 +0100196 ArithmeticSubtractionQuantizationInfoSignedDataset),
Sheri Zhanga387e272021-06-29 17:34:06 +0100197 OutOfPlaceDataSet))
Michalis Spyrou6f58b372019-12-04 12:00:36 +0000198{
199 // Validate output
200 validate(Accessor(_target), _reference, tolerance_qasymm8);
201}
Georgios Pinitasb2842be2020-06-22 21:27:14 +0100202FIXTURE_DATA_TEST_CASE(RunSmallBroadcast, NEArithmeticSubtractionQASYMM8SignedBroadcastFixture, framework::DatasetMode::ALL, combine(combine(combine(combine(
Michalis Spyroueae65842020-06-15 20:23:59 +0100203 datasets::SmallShapesBroadcast(),
Georgios Pinitasda816752021-07-02 09:22:14 +0100204 framework::dataset::make("DataType", DataType::QASYMM8_SIGNED)),
Michalis Spyroueae65842020-06-15 20:23:59 +0100205 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE })),
Georgios Pinitasb2842be2020-06-22 21:27:14 +0100206 ArithmeticSubtractionQuantizationInfoSignedDataset),
207 OutOfPlaceDataSet))
Michalis Spyroueae65842020-06-15 20:23:59 +0100208{
209 // Validate output
210 validate(Accessor(_target), _reference, tolerance_qasymm8);
211}
Sheri Zhanga387e272021-06-29 17:34:06 +0100212FIXTURE_DATA_TEST_CASE(RunTinyBroadcastInPlace, NEArithmeticSubtractionQASYMM8SignedBroadcastFixture, framework::DatasetMode::ALL, combine(combine(combine(combine(
213 datasets::TinyShapesBroadcastInplace(),
214 framework::dataset::make("DataType", DataType::QASYMM8_SIGNED)),
215 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE })),
216 ArithmeticSubtractionQuantizationInfoSignedInPlaceDataset),
217 InPlaceDataSet))
218{
219 // Validate output
220 validate(Accessor(_target), _reference, tolerance_qasymm8);
221}
Michalis Spyrou6f58b372019-12-04 12:00:36 +0000222TEST_SUITE_END() // QASYMM8_SIGNED
Michele Di Giorgio9f2403f2020-03-27 10:23:44 +0000223
224TEST_SUITE(QSYMM16)
Georgios Pinitasb2842be2020-06-22 21:27:14 +0100225FIXTURE_DATA_TEST_CASE(RunSmall, NEArithmeticSubtractionQSYMM16Fixture, framework::DatasetMode::ALL, combine(combine(combine(combine(
Michele Di Giorgio9f2403f2020-03-27 10:23:44 +0000226 datasets::SmallShapes(),
Georgios Pinitasda816752021-07-02 09:22:14 +0100227 framework::dataset::make("DataType", DataType::QSYMM16)),
Michele Di Giorgio9f2403f2020-03-27 10:23:44 +0000228 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE })),
Georgios Pinitasb2842be2020-06-22 21:27:14 +0100229 ArithmeticSubtractionQuantizationInfoSymmetric),
230 OutOfPlaceDataSet))
Michele Di Giorgio9f2403f2020-03-27 10:23:44 +0000231{
232 // Validate output
233 validate(Accessor(_target), _reference, tolerance_qsymm16);
234}
235TEST_SUITE_END() // QSYMM16
Manuel Bottini6a2b6e82019-02-25 13:50:11 +0000236TEST_SUITE_END() // Quantized
237
Sanghoon Lee72898fe2017-09-01 11:42:16 +0100238TEST_SUITE(S16)
Georgios Pinitasda816752021-07-02 09:22:14 +0100239FIXTURE_DATA_TEST_CASE(RunSmall, NEArithmeticSubtractionFixture<int16_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType",
240 DataType::S16)),
Georgios Pinitasb2842be2020-06-22 21:27:14 +0100241 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
242 OutOfPlaceDataSet))
Sanghoon Lee72898fe2017-09-01 11:42:16 +0100243{
244 // Validate output
245 validate(Accessor(_target), _reference);
246}
247
Georgios Pinitasda816752021-07-02 09:22:14 +0100248FIXTURE_DATA_TEST_CASE(RunLarge, NEArithmeticSubtractionFixture<int16_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType",
249 DataType::S16)),
Georgios Pinitasb2842be2020-06-22 21:27:14 +0100250 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
251 OutOfPlaceDataSet))
Sanghoon Lee72898fe2017-09-01 11:42:16 +0100252{
253 // Validate output
254 validate(Accessor(_target), _reference);
255}
Georgios Pinitascbf39c62018-09-10 15:07:45 +0100256TEST_SUITE_END() // S16
Isabella Gottardib5908c22017-10-30 15:28:13 +0000257
SiCong Li903f8cc2020-08-27 10:17:10 +0100258TEST_SUITE(S32)
Georgios Pinitasda816752021-07-02 09:22:14 +0100259FIXTURE_DATA_TEST_CASE(RunSmall, NEArithmeticSubtractionFixture<int32_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType",
260 DataType::S32)),
SiCong Li903f8cc2020-08-27 10:17:10 +0100261 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
262 OutOfPlaceDataSet))
263{
264 // Validate output
265 validate(Accessor(_target), _reference);
266}
267
Georgios Pinitasda816752021-07-02 09:22:14 +0100268FIXTURE_DATA_TEST_CASE(RunLarge, NEArithmeticSubtractionFixture<int32_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType",
269 DataType::S32)),
SiCong Li903f8cc2020-08-27 10:17:10 +0100270 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
271 OutOfPlaceDataSet))
272{
273 // Validate output
274 validate(Accessor(_target), _reference);
275}
276TEST_SUITE_END() // S32
277
Sanghoon Lee72898fe2017-09-01 11:42:16 +0100278TEST_SUITE(Float)
Ioan-Cristian Szabo5edbd1c2017-11-13 13:34:08 +0000279#ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
Georgios Pinitascbf39c62018-09-10 15:07:45 +0100280TEST_SUITE(F16)
Georgios Pinitasda816752021-07-02 09:22:14 +0100281FIXTURE_DATA_TEST_CASE(RunSmall, NEArithmeticSubtractionFixture<half>, framework::DatasetMode::ALL, combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType",
282 DataType::F16)),
Georgios Pinitasb2842be2020-06-22 21:27:14 +0100283 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
284 OutOfPlaceDataSet))
Sanghoon Lee72898fe2017-09-01 11:42:16 +0100285{
286 // Validate output
287 validate(Accessor(_target), _reference);
288}
Georgios Pinitascbf39c62018-09-10 15:07:45 +0100289TEST_SUITE_END() // F16
290#endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */
Sanghoon Lee72898fe2017-09-01 11:42:16 +0100291
Georgios Pinitascbf39c62018-09-10 15:07:45 +0100292TEST_SUITE(F32)
Georgios Pinitasda816752021-07-02 09:22:14 +0100293FIXTURE_DATA_TEST_CASE(RunSmall, NEArithmeticSubtractionFixture<float>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType",
294 DataType::F32)),
Georgios Pinitasb2842be2020-06-22 21:27:14 +0100295 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
296 InPlaceDataSet))
Sanghoon Lee72898fe2017-09-01 11:42:16 +0100297{
298 // Validate output
299 validate(Accessor(_target), _reference);
300}
301
Georgios Pinitasda816752021-07-02 09:22:14 +0100302FIXTURE_DATA_TEST_CASE(RunLarge, NEArithmeticSubtractionFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType",
303 DataType::F32)),
Georgios Pinitasb2842be2020-06-22 21:27:14 +0100304 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
305 OutOfPlaceDataSet))
Sanghoon Lee72898fe2017-09-01 11:42:16 +0100306{
307 // Validate output
308 validate(Accessor(_target), _reference);
309}
Sanghoon Lee72898fe2017-09-01 11:42:16 +0100310
Georgios Pinitascbf39c62018-09-10 15:07:45 +0100311template <typename T>
312using NEArithmeticSubtractionBroadcastFixture = ArithmeticSubtractionBroadcastValidationFixture<Tensor, Accessor, NEArithmeticSubtraction, T>;
313
Georgios Pinitasb2842be2020-06-22 21:27:14 +0100314FIXTURE_DATA_TEST_CASE(RunSmallBroadcast, NEArithmeticSubtractionBroadcastFixture<float>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapesBroadcast(),
Georgios Pinitasda816752021-07-02 09:22:14 +0100315 framework::dataset::make("DataType", DataType::F32)),
Georgios Pinitasb2842be2020-06-22 21:27:14 +0100316 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
317 OutOfPlaceDataSet))
Georgios Pinitascbf39c62018-09-10 15:07:45 +0100318{
319 // Validate output
320 validate(Accessor(_target), _reference);
321}
322
Georgios Pinitasb2842be2020-06-22 21:27:14 +0100323FIXTURE_DATA_TEST_CASE(RunLargeBroadcast, NEArithmeticSubtractionBroadcastFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapesBroadcast(),
Georgios Pinitasda816752021-07-02 09:22:14 +0100324 framework::dataset::make("DataType", DataType::F32)),
Georgios Pinitasb2842be2020-06-22 21:27:14 +0100325 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
326 OutOfPlaceDataSet))
Georgios Pinitascbf39c62018-09-10 15:07:45 +0100327{
328 // Validate output
329 validate(Accessor(_target), _reference);
330}
331TEST_SUITE_END() // F32
332TEST_SUITE_END() // Float
333
334TEST_SUITE_END() // ArithmeticSubtraction
Sheri Zhangac6499a2021-02-10 15:32:38 +0000335TEST_SUITE_END() // Neon
Sanghoon Lee72898fe2017-09-01 11:42:16 +0100336} // namespace validation
337} // namespace test
338} // namespace arm_compute