Sanghoon Lee | 72898fe | 2017-09-01 11:42:16 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2017 ARM Limited. |
| 3 | * |
| 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 CONCLCTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 22 | * SOFTWARE. |
| 23 | */ |
| 24 | #include "arm_compute/core/Types.h" |
| 25 | #include "arm_compute/runtime/CL/CLTensor.h" |
| 26 | #include "arm_compute/runtime/CL/CLTensorAllocator.h" |
| 27 | #include "arm_compute/runtime/CL/functions/CLArithmeticSubtraction.h" |
| 28 | #include "tests/CL/CLAccessor.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" |
| 36 | #include "tests/validation/fixtures/ArithmeticSubtractionFixture.h" |
Sanghoon Lee | 72898fe | 2017-09-01 11:42:16 +0100 | [diff] [blame] | 37 | |
| 38 | namespace arm_compute |
| 39 | { |
| 40 | namespace test |
| 41 | { |
| 42 | namespace validation |
| 43 | { |
| 44 | namespace |
| 45 | { |
| 46 | /** Input data sets **/ |
| 47 | const auto ArithmeticSubtractionU8Dataset = combine(combine(framework::dataset::make("DataType", DataType::U8), framework::dataset::make("DataType", DataType::U8)), |
| 48 | framework::dataset::make("DataType", |
| 49 | DataType::U8)); |
Isabella Gottardi | b5908c2 | 2017-10-30 15:28:13 +0000 | [diff] [blame] | 50 | const auto ArithmeticSubtractionS16Dataset = combine(combine(framework::dataset::make("DataType", DataType::S16), framework::dataset::make("DataType", DataType::S16)), |
Sanghoon Lee | 72898fe | 2017-09-01 11:42:16 +0100 | [diff] [blame] | 51 | framework::dataset::make("DataType", DataType::S16)); |
Isabella Gottardi | b5908c2 | 2017-10-30 15:28:13 +0000 | [diff] [blame] | 52 | const auto ArithmeticSubtractionU8U8S16Dataset = combine(combine(framework::dataset::make("DataType", DataType::U8), framework::dataset::make("DataType", DataType::U8)), |
| 53 | framework::dataset::make("DataType", DataType::S16)); |
| 54 | const auto ArithmeticSubtractionS16U8S16Dataset = combine(combine(framework::dataset::make("DataType", DataType::S16), framework::dataset::make("DataType", DataType::U8)), |
| 55 | framework::dataset::make("DataType", DataType::S16)); |
| 56 | const auto ArithmeticSubtractionU8S16S16Dataset = combine(combine(framework::dataset::make("DataType", DataType::U8), framework::dataset::make("DataType", DataType::S16)), |
| 57 | framework::dataset::make("DataType", DataType::S16)); |
Sanghoon Lee | 72898fe | 2017-09-01 11:42:16 +0100 | [diff] [blame] | 58 | const auto ArithmeticSubtractionQS8Dataset = combine(combine(framework::dataset::make("DataType", DataType::QS8), framework::dataset::make("DataType", DataType::QS8)), |
| 59 | framework::dataset::make("DataType", DataType::QS8)); |
| 60 | const auto ArithmeticSubtractionQS16Dataset = combine(combine(framework::dataset::make("DataType", DataType::QS16), framework::dataset::make("DataType", DataType::QS16)), |
| 61 | framework::dataset::make("DataType", DataType::QS16)); |
| 62 | const auto ArithmeticSubtractionFP16Dataset = combine(combine(framework::dataset::make("DataType", DataType::F16), framework::dataset::make("DataType", DataType::F16)), |
| 63 | framework::dataset::make("DataType", DataType::F16)); |
| 64 | const auto ArithmeticSubtractionFP32Dataset = combine(combine(framework::dataset::make("DataType", DataType::F32), framework::dataset::make("DataType", DataType::F32)), |
| 65 | framework::dataset::make("DataType", DataType::F32)); |
| 66 | } // namespace |
| 67 | |
| 68 | TEST_SUITE(CL) |
| 69 | TEST_SUITE(ArithmeticSubtraction) |
| 70 | |
Georgios Pinitas | f9d3a0a | 2017-11-03 19:01:44 +0000 | [diff] [blame^] | 71 | // *INDENT-OFF* |
| 72 | // clang-format off |
| 73 | DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip( |
| 74 | framework::dataset::make("Input1Info", { TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::U8), |
| 75 | TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::U8), |
| 76 | TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::U8), // Invalid data type combination |
| 77 | TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Mismatching shapes |
| 78 | TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::QS8, 2), // Mismatching fixed point |
| 79 | TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::QS8, 2), |
| 80 | }), |
| 81 | framework::dataset::make("Input2Info",{ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::U8), |
| 82 | TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::U8), |
| 83 | TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::S16), |
| 84 | TensorInfo(TensorShape(30U, 11U, 2U), 1, DataType::F32), |
| 85 | TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::QS8, 3), |
| 86 | TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::QS8, 2), |
| 87 | })), |
| 88 | framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::S16), |
| 89 | TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::U8), |
| 90 | TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::U8), |
| 91 | TensorInfo(TensorShape(30U, 11U, 2U), 1, DataType::F32), |
| 92 | TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::QS8, 3), |
| 93 | TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::QS8, 2), |
| 94 | })), |
| 95 | framework::dataset::make("Expected", { false, false, true, true, true, false })), |
| 96 | input1_info, input2_info, output_info, expected) |
| 97 | { |
| 98 | ARM_COMPUTE_EXPECT(bool(CLArithmeticSubtraction::validate(&input1_info, &input2_info, &output_info, ConvertPolicy::WRAP)) == expected, framework::LogLevel::ERRORS); |
| 99 | } |
| 100 | // clang-format on |
| 101 | // *INDENT-ON* |
| 102 | |
Isabella Gottardi | b5908c2 | 2017-10-30 15:28:13 +0000 | [diff] [blame] | 103 | template <typename T1, typename T2 = T1, typename T3 = T1> |
| 104 | using CLArithmeticSubtractionFixture = ArithmeticSubtractionValidationFixture<CLTensor, CLAccessor, CLArithmeticSubtraction, T1, T2, T3>; |
Sanghoon Lee | 72898fe | 2017-09-01 11:42:16 +0100 | [diff] [blame] | 105 | |
| 106 | TEST_SUITE(U8) |
| 107 | DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(framework::dataset::concat(datasets::SmallShapes(), datasets::LargeShapes()), framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })), |
| 108 | shape, policy) |
| 109 | { |
| 110 | // Create tensors |
| 111 | CLTensor ref_src1 = create_tensor<CLTensor>(shape, DataType::U8); |
| 112 | CLTensor ref_src2 = create_tensor<CLTensor>(shape, DataType::U8); |
| 113 | CLTensor dst = create_tensor<CLTensor>(shape, DataType::U8); |
| 114 | |
| 115 | // Create and Configure function |
| 116 | CLArithmeticSubtraction sub; |
| 117 | sub.configure(&ref_src1, &ref_src2, &dst, policy); |
| 118 | |
| 119 | // Validate valid region |
| 120 | const ValidRegion valid_region = shape_to_valid_region(shape); |
| 121 | validate(dst.info()->valid_region(), valid_region); |
| 122 | |
| 123 | // Validate padding |
| 124 | const PaddingSize padding = PaddingCalculator(shape.x(), 16).required_padding(); |
| 125 | validate(ref_src1.info()->padding(), padding); |
| 126 | validate(ref_src2.info()->padding(), padding); |
| 127 | validate(dst.info()->padding(), padding); |
| 128 | } |
| 129 | |
Isabella Gottardi | b5908c2 | 2017-10-30 15:28:13 +0000 | [diff] [blame] | 130 | FIXTURE_DATA_TEST_CASE(RunSmall, CLArithmeticSubtractionFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(datasets::SmallShapes(), |
| 131 | ArithmeticSubtractionU8Dataset), |
Sanghoon Lee | 72898fe | 2017-09-01 11:42:16 +0100 | [diff] [blame] | 132 | framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP }))) |
| 133 | { |
| 134 | // Validate output |
| 135 | validate(CLAccessor(_target), _reference); |
| 136 | } |
| 137 | TEST_SUITE_END() |
| 138 | |
Isabella Gottardi | b5908c2 | 2017-10-30 15:28:13 +0000 | [diff] [blame] | 139 | template <typename T1, typename T2 = T1> |
| 140 | using CLArithmeticSubtractionToS16Fixture = CLArithmeticSubtractionFixture<T1, T2, int16_t>; |
| 141 | |
Sanghoon Lee | 72898fe | 2017-09-01 11:42:16 +0100 | [diff] [blame] | 142 | TEST_SUITE(S16) |
Isabella Gottardi | b5908c2 | 2017-10-30 15:28:13 +0000 | [diff] [blame] | 143 | DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(combine(framework::dataset::concat(datasets::SmallShapes(), datasets::LargeShapes()), |
| 144 | framework::dataset::make("DataType", { DataType::U8, DataType::S16 })), |
| 145 | framework::dataset::make("DataType", { DataType::U8, DataType::S16 })), |
Sanghoon Lee | 72898fe | 2017-09-01 11:42:16 +0100 | [diff] [blame] | 146 | framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })), |
Isabella Gottardi | b5908c2 | 2017-10-30 15:28:13 +0000 | [diff] [blame] | 147 | shape, data_type1, data_type2, policy) |
Sanghoon Lee | 72898fe | 2017-09-01 11:42:16 +0100 | [diff] [blame] | 148 | { |
| 149 | // Create tensors |
Isabella Gottardi | b5908c2 | 2017-10-30 15:28:13 +0000 | [diff] [blame] | 150 | CLTensor ref_src1 = create_tensor<CLTensor>(shape, data_type1); |
| 151 | CLTensor ref_src2 = create_tensor<CLTensor>(shape, data_type2); |
Sanghoon Lee | 72898fe | 2017-09-01 11:42:16 +0100 | [diff] [blame] | 152 | CLTensor dst = create_tensor<CLTensor>(shape, DataType::S16); |
| 153 | |
| 154 | // Create and Configure function |
| 155 | CLArithmeticSubtraction sub; |
| 156 | sub.configure(&ref_src1, &ref_src2, &dst, policy); |
| 157 | |
| 158 | // Validate valid region |
| 159 | const ValidRegion valid_region = shape_to_valid_region(shape); |
| 160 | validate(dst.info()->valid_region(), valid_region); |
| 161 | |
| 162 | // Validate padding |
| 163 | const PaddingSize padding = PaddingCalculator(shape.x(), 16).required_padding(); |
| 164 | validate(ref_src1.info()->padding(), padding); |
| 165 | validate(ref_src2.info()->padding(), padding); |
| 166 | validate(dst.info()->padding(), padding); |
| 167 | } |
Isabella Gottardi | b5908c2 | 2017-10-30 15:28:13 +0000 | [diff] [blame] | 168 | TEST_SUITE(S16_S16_S16) |
| 169 | FIXTURE_DATA_TEST_CASE(RunSmall, CLArithmeticSubtractionToS16Fixture<int16_t>, framework::DatasetMode::PRECOMMIT, combine(combine(datasets::SmallShapes(), ArithmeticSubtractionS16Dataset), |
| 170 | framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP }))) |
Sanghoon Lee | 72898fe | 2017-09-01 11:42:16 +0100 | [diff] [blame] | 171 | { |
| 172 | // Validate output |
| 173 | validate(CLAccessor(_target), _reference); |
| 174 | } |
| 175 | |
Isabella Gottardi | b5908c2 | 2017-10-30 15:28:13 +0000 | [diff] [blame] | 176 | FIXTURE_DATA_TEST_CASE(RunLarge, CLArithmeticSubtractionToS16Fixture<int16_t>, framework::DatasetMode::NIGHTLY, combine(combine(datasets::LargeShapes(), ArithmeticSubtractionS16Dataset), |
| 177 | framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP }))) |
Sanghoon Lee | 72898fe | 2017-09-01 11:42:16 +0100 | [diff] [blame] | 178 | { |
| 179 | // Validate output |
| 180 | validate(CLAccessor(_target), _reference); |
| 181 | } |
| 182 | TEST_SUITE_END() |
| 183 | |
Isabella Gottardi | b5908c2 | 2017-10-30 15:28:13 +0000 | [diff] [blame] | 184 | TEST_SUITE(U8_U8_S16) |
| 185 | FIXTURE_DATA_TEST_CASE(RunSmall, CLArithmeticSubtractionToS16Fixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(datasets::SmallShapes(), |
| 186 | ArithmeticSubtractionU8U8S16Dataset), |
| 187 | framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP }))) |
| 188 | { |
| 189 | // Validate output |
| 190 | validate(CLAccessor(_target), _reference); |
| 191 | } |
| 192 | |
| 193 | FIXTURE_DATA_TEST_CASE(RunLarge, CLArithmeticSubtractionToS16Fixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(combine(datasets::LargeShapes(), |
| 194 | ArithmeticSubtractionU8U8S16Dataset), |
| 195 | framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP }))) |
| 196 | { |
| 197 | // Validate output |
| 198 | validate(CLAccessor(_target), _reference); |
| 199 | } |
| 200 | TEST_SUITE_END() |
| 201 | |
| 202 | TEST_SUITE(S16_U8_S16) |
| 203 | using CLAriSubS16U8ToS16Fixture = CLArithmeticSubtractionToS16Fixture<int16_t, uint8_t>; |
| 204 | FIXTURE_DATA_TEST_CASE(RunSmall, CLAriSubS16U8ToS16Fixture, framework::DatasetMode::PRECOMMIT, combine(combine(datasets::SmallShapes(), |
| 205 | ArithmeticSubtractionS16U8S16Dataset), |
| 206 | framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP }))) |
| 207 | { |
| 208 | // Validate output |
| 209 | validate(CLAccessor(_target), _reference); |
| 210 | } |
| 211 | |
| 212 | FIXTURE_DATA_TEST_CASE(RunLarge, CLAriSubS16U8ToS16Fixture, framework::DatasetMode::NIGHTLY, combine(combine(datasets::LargeShapes(), |
| 213 | ArithmeticSubtractionS16U8S16Dataset), |
| 214 | framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP }))) |
| 215 | { |
| 216 | // Validate output |
| 217 | validate(CLAccessor(_target), _reference); |
| 218 | } |
| 219 | TEST_SUITE_END() |
| 220 | |
| 221 | TEST_SUITE(U8_S16_S16) |
| 222 | using CLAriSubU8S16ToS16Fixture = CLArithmeticSubtractionToS16Fixture<uint8_t, int16_t>; |
| 223 | FIXTURE_DATA_TEST_CASE(RunSmall, CLAriSubU8S16ToS16Fixture, framework::DatasetMode::PRECOMMIT, combine(combine(datasets::SmallShapes(), |
| 224 | ArithmeticSubtractionU8S16S16Dataset), |
| 225 | framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP }))) |
| 226 | { |
| 227 | // Validate output |
| 228 | validate(CLAccessor(_target), _reference); |
| 229 | } |
| 230 | |
| 231 | FIXTURE_DATA_TEST_CASE(RunLarge, CLAriSubU8S16ToS16Fixture, framework::DatasetMode::NIGHTLY, combine(combine(datasets::LargeShapes(), |
| 232 | ArithmeticSubtractionU8S16S16Dataset), |
| 233 | framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP }))) |
| 234 | { |
| 235 | // Validate output |
| 236 | validate(CLAccessor(_target), _reference); |
| 237 | } |
| 238 | TEST_SUITE_END() |
| 239 | TEST_SUITE_END() |
| 240 | |
| 241 | template <typename T1, typename T2 = T1, typename T3 = T1> |
| 242 | using CLArithmeticSubtractionFixedPointFixture = ArithmeticSubtractionValidationFixedPointFixture<CLTensor, CLAccessor, CLArithmeticSubtraction, T1, T2, T3>; |
Sanghoon Lee | 72898fe | 2017-09-01 11:42:16 +0100 | [diff] [blame] | 243 | |
| 244 | TEST_SUITE(Quantized) |
| 245 | TEST_SUITE(QS8) |
Isabella Gottardi | b5908c2 | 2017-10-30 15:28:13 +0000 | [diff] [blame] | 246 | FIXTURE_DATA_TEST_CASE(RunSmall, CLArithmeticSubtractionFixedPointFixture<int8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), |
| 247 | ArithmeticSubtractionQS8Dataset), |
Sanghoon Lee | 72898fe | 2017-09-01 11:42:16 +0100 | [diff] [blame] | 248 | framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })), |
| 249 | framework::dataset::make("FractionalBits", 1, 7))) |
| 250 | { |
| 251 | // Validate output |
| 252 | validate(CLAccessor(_target), _reference); |
| 253 | } |
| 254 | |
Isabella Gottardi | b5908c2 | 2017-10-30 15:28:13 +0000 | [diff] [blame] | 255 | FIXTURE_DATA_TEST_CASE(RunLarge, CLArithmeticSubtractionFixedPointFixture<int8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), |
| 256 | ArithmeticSubtractionQS8Dataset), |
Sanghoon Lee | 72898fe | 2017-09-01 11:42:16 +0100 | [diff] [blame] | 257 | framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })), |
| 258 | framework::dataset::make("FractionalBits", 1, 7))) |
| 259 | { |
| 260 | // Validate output |
| 261 | validate(CLAccessor(_target), _reference); |
| 262 | } |
| 263 | TEST_SUITE_END() |
| 264 | |
| 265 | TEST_SUITE(QS16) |
| 266 | FIXTURE_DATA_TEST_CASE(RunSmall, CLArithmeticSubtractionFixedPointFixture<int16_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), |
| 267 | ArithmeticSubtractionQS16Dataset), |
| 268 | framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })), |
| 269 | framework::dataset::make("FractionalBits", 1, 15))) |
| 270 | { |
| 271 | // Validate output |
| 272 | validate(CLAccessor(_target), _reference); |
| 273 | } |
| 274 | |
Isabella Gottardi | b5908c2 | 2017-10-30 15:28:13 +0000 | [diff] [blame] | 275 | FIXTURE_DATA_TEST_CASE(RunLarge, CLArithmeticSubtractionFixedPointFixture<int16_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), |
| 276 | ArithmeticSubtractionQS16Dataset), |
Sanghoon Lee | 72898fe | 2017-09-01 11:42:16 +0100 | [diff] [blame] | 277 | framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })), |
| 278 | framework::dataset::make("FractionalBits", 1, 15))) |
| 279 | { |
| 280 | // Validate output |
| 281 | validate(CLAccessor(_target), _reference); |
| 282 | } |
| 283 | TEST_SUITE_END() |
| 284 | TEST_SUITE_END() |
| 285 | |
| 286 | TEST_SUITE(Float) |
| 287 | TEST_SUITE(FP16) |
Georgios Pinitas | 583137c | 2017-08-31 18:12:42 +0100 | [diff] [blame] | 288 | FIXTURE_DATA_TEST_CASE(RunSmall, CLArithmeticSubtractionFixture<half>, framework::DatasetMode::ALL, combine(combine(datasets::SmallShapes(), ArithmeticSubtractionFP16Dataset), |
| 289 | framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP }))) |
Sanghoon Lee | 72898fe | 2017-09-01 11:42:16 +0100 | [diff] [blame] | 290 | { |
| 291 | // Validate output |
| 292 | validate(CLAccessor(_target), _reference); |
| 293 | } |
| 294 | TEST_SUITE_END() |
| 295 | |
| 296 | TEST_SUITE(FP32) |
| 297 | DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(framework::dataset::concat(datasets::SmallShapes(), datasets::LargeShapes()), framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })), |
| 298 | shape, policy) |
| 299 | { |
| 300 | // Create tensors |
| 301 | CLTensor ref_src1 = create_tensor<CLTensor>(shape, DataType::F32); |
| 302 | CLTensor ref_src2 = create_tensor<CLTensor>(shape, DataType::F32); |
| 303 | CLTensor dst = create_tensor<CLTensor>(shape, DataType::F32); |
| 304 | |
| 305 | // Create and Configure function |
| 306 | CLArithmeticSubtraction sub; |
| 307 | sub.configure(&ref_src1, &ref_src2, &dst, policy); |
| 308 | |
| 309 | // Validate valid region |
| 310 | const ValidRegion valid_region = shape_to_valid_region(shape); |
| 311 | validate(dst.info()->valid_region(), valid_region); |
| 312 | |
| 313 | // Validate padding |
| 314 | const PaddingSize padding = PaddingCalculator(shape.x(), 16).required_padding(); |
| 315 | validate(ref_src1.info()->padding(), padding); |
| 316 | validate(ref_src2.info()->padding(), padding); |
| 317 | validate(dst.info()->padding(), padding); |
| 318 | } |
| 319 | |
| 320 | FIXTURE_DATA_TEST_CASE(RunSmall, CLArithmeticSubtractionFixture<float>, framework::DatasetMode::PRECOMMIT, combine(combine(datasets::SmallShapes(), ArithmeticSubtractionFP32Dataset), |
| 321 | framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP }))) |
| 322 | { |
| 323 | // Validate output |
| 324 | validate(CLAccessor(_target), _reference); |
| 325 | } |
| 326 | |
| 327 | FIXTURE_DATA_TEST_CASE(RunLarge, CLArithmeticSubtractionFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(datasets::LargeShapes(), ArithmeticSubtractionFP32Dataset), |
| 328 | framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP }))) |
| 329 | { |
| 330 | // Validate output |
| 331 | validate(CLAccessor(_target), _reference); |
| 332 | } |
| 333 | TEST_SUITE_END() |
| 334 | TEST_SUITE_END() |
| 335 | |
| 336 | TEST_SUITE_END() |
| 337 | TEST_SUITE_END() |
| 338 | } // namespace validation |
| 339 | } // namespace test |
| 340 | } // namespace arm_compute |