Sanghoon Lee | 70f8291 | 2017-08-24 14:21:24 +0100 | [diff] [blame] | 1 | /* |
Michalis Spyrou | 8094325 | 2019-01-10 17:19:50 +0000 | [diff] [blame] | 2 | * Copyright (c) 2017-2019 ARM Limited. |
Sanghoon Lee | 70f8291 | 2017-08-24 14:21:24 +0100 | [diff] [blame] | 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, |
Sanghoon Lee | a7a5b7b | 2017-09-14 12:11:03 +0100 | [diff] [blame] | 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
Sanghoon Lee | 70f8291 | 2017-08-24 14:21:24 +0100 | [diff] [blame] | 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" |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 27 | #include "arm_compute/runtime/CL/functions/CLElementwiseOperations.h" |
Sanghoon Lee | 70f8291 | 2017-08-24 14:21:24 +0100 | [diff] [blame] | 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" |
Georgios Pinitas | cbf39c6 | 2018-09-10 15:07:45 +0100 | [diff] [blame] | 36 | #include "tests/validation/fixtures/ArithmeticOperationsFixture.h" |
Sanghoon Lee | 70f8291 | 2017-08-24 14:21:24 +0100 | [diff] [blame] | 37 | |
| 38 | namespace arm_compute |
| 39 | { |
| 40 | namespace test |
| 41 | { |
| 42 | namespace validation |
| 43 | { |
| 44 | namespace |
| 45 | { |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 46 | constexpr unsigned int num_elems_processed_per_iteration = 16; |
Sanghoon Lee | 70f8291 | 2017-08-24 14:21:24 +0100 | [diff] [blame] | 47 | /** Input data sets **/ |
| 48 | const auto ArithmeticAdditionU8Dataset = combine(combine(framework::dataset::make("DataType", DataType::U8), framework::dataset::make("DataType", DataType::U8)), framework::dataset::make("DataType", |
| 49 | DataType::U8)); |
Michele Di Giorgio | 4622ac1 | 2018-06-27 16:41:17 +0100 | [diff] [blame] | 50 | const auto ArithmeticAdditionQASYMM8Dataset = combine(combine(framework::dataset::make("DataType", DataType::QASYMM8), framework::dataset::make("DataType", DataType::QASYMM8)), |
| 51 | framework::dataset::make("DataType", |
| 52 | DataType::QASYMM8)); |
Michele Di Giorgio | 6997fc9 | 2019-06-18 10:23:22 +0100 | [diff] [blame] | 53 | const auto ArithmeticAdditionQSYMM16Dataset = combine(combine(framework::dataset::make("DataType", DataType::QSYMM16), framework::dataset::make("DataType", DataType::QSYMM16)), |
| 54 | framework::dataset::make("DataType", |
| 55 | DataType::QSYMM16)); |
Sanghoon Lee | 70f8291 | 2017-08-24 14:21:24 +0100 | [diff] [blame] | 56 | const auto ArithmeticAdditionS16Dataset = combine(combine(framework::dataset::make("DataType", { DataType::U8, DataType::S16 }), framework::dataset::make("DataType", DataType::S16)), |
| 57 | framework::dataset::make("DataType", DataType::S16)); |
Sanghoon Lee | 70f8291 | 2017-08-24 14:21:24 +0100 | [diff] [blame] | 58 | const auto ArithmeticAdditionFP16Dataset = combine(combine(framework::dataset::make("DataType", DataType::F16), framework::dataset::make("DataType", DataType::F16)), |
| 59 | framework::dataset::make("DataType", DataType::F16)); |
| 60 | const auto ArithmeticAdditionFP32Dataset = combine(combine(framework::dataset::make("DataType", DataType::F32), framework::dataset::make("DataType", DataType::F32)), |
| 61 | framework::dataset::make("DataType", DataType::F32)); |
| 62 | } // namespace |
| 63 | |
| 64 | TEST_SUITE(CL) |
| 65 | TEST_SUITE(ArithmeticAddition) |
| 66 | |
Georgios Pinitas | f9d3a0a | 2017-11-03 19:01:44 +0000 | [diff] [blame] | 67 | // *INDENT-OFF* |
| 68 | // clang-format off |
| 69 | DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip( |
Giorgio Arena | 7062382 | 2017-11-27 15:50:10 +0000 | [diff] [blame] | 70 | framework::dataset::make("Input1Info", { TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8), |
| 71 | TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8), |
| 72 | TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::U8), // Window shrink |
| 73 | TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8), // Invalid data type combination |
| 74 | TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32), // Mismatching shapes |
Georgios Pinitas | f9d3a0a | 2017-11-03 19:01:44 +0000 | [diff] [blame] | 75 | }), |
Giorgio Arena | 7062382 | 2017-11-27 15:50:10 +0000 | [diff] [blame] | 76 | framework::dataset::make("Input2Info",{ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8), |
| 77 | TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8), |
Georgios Pinitas | f9d3a0a | 2017-11-03 19:01:44 +0000 | [diff] [blame] | 78 | TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::U8), |
Giorgio Arena | 7062382 | 2017-11-27 15:50:10 +0000 | [diff] [blame] | 79 | TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::S16), |
| 80 | TensorInfo(TensorShape(48U, 11U, 2U), 1, DataType::F32), |
Georgios Pinitas | f9d3a0a | 2017-11-03 19:01:44 +0000 | [diff] [blame] | 81 | })), |
Giorgio Arena | 7062382 | 2017-11-27 15:50:10 +0000 | [diff] [blame] | 82 | framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::S16), |
| 83 | TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8), |
Georgios Pinitas | f9d3a0a | 2017-11-03 19:01:44 +0000 | [diff] [blame] | 84 | TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::U8), |
Giorgio Arena | 7062382 | 2017-11-27 15:50:10 +0000 | [diff] [blame] | 85 | TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8), |
| 86 | TensorInfo(TensorShape(48U, 11U, 2U), 1, DataType::F32), |
Georgios Pinitas | f9d3a0a | 2017-11-03 19:01:44 +0000 | [diff] [blame] | 87 | })), |
Vidhya Sudhan Loganathan | 0fc2545 | 2018-06-18 14:40:56 +0100 | [diff] [blame] | 88 | framework::dataset::make("Expected", { true, true, false, false, false})), |
Georgios Pinitas | f9d3a0a | 2017-11-03 19:01:44 +0000 | [diff] [blame] | 89 | input1_info, input2_info, output_info, expected) |
| 90 | { |
Giorgio Arena | 7062382 | 2017-11-27 15:50:10 +0000 | [diff] [blame] | 91 | ARM_COMPUTE_EXPECT(bool(CLArithmeticAddition::validate(&input1_info.clone()->set_is_resizable(false), &input2_info.clone()->set_is_resizable(false), &output_info.clone()->set_is_resizable(false), ConvertPolicy::WRAP)) == expected, framework::LogLevel::ERRORS); |
Georgios Pinitas | f9d3a0a | 2017-11-03 19:01:44 +0000 | [diff] [blame] | 92 | } |
| 93 | // clang-format on |
| 94 | // *INDENT-ON* |
| 95 | |
Sanghoon Lee | 70f8291 | 2017-08-24 14:21:24 +0100 | [diff] [blame] | 96 | template <typename T> |
| 97 | using CLArithmeticAdditionFixture = ArithmeticAdditionValidationFixture<CLTensor, CLAccessor, CLArithmeticAddition, T>; |
| 98 | |
Michele Di Giorgio | 6997fc9 | 2019-06-18 10:23:22 +0100 | [diff] [blame] | 99 | TEST_SUITE(Integer) |
Sanghoon Lee | 70f8291 | 2017-08-24 14:21:24 +0100 | [diff] [blame] | 100 | TEST_SUITE(U8) |
Michalis Spyrou | 8094325 | 2019-01-10 17:19:50 +0000 | [diff] [blame] | 101 | DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(datasets::SmallShapes(), framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })), |
Sanghoon Lee | 70f8291 | 2017-08-24 14:21:24 +0100 | [diff] [blame] | 102 | shape, policy) |
| 103 | { |
| 104 | // Create tensors |
| 105 | CLTensor ref_src1 = create_tensor<CLTensor>(shape, DataType::U8); |
| 106 | CLTensor ref_src2 = create_tensor<CLTensor>(shape, DataType::U8); |
| 107 | CLTensor dst = create_tensor<CLTensor>(shape, DataType::U8); |
| 108 | |
| 109 | // Create and Configure function |
| 110 | CLArithmeticAddition add; |
| 111 | add.configure(&ref_src1, &ref_src2, &dst, policy); |
| 112 | |
| 113 | // Validate valid region |
| 114 | const ValidRegion valid_region = shape_to_valid_region(shape); |
| 115 | validate(dst.info()->valid_region(), valid_region); |
| 116 | |
| 117 | // Validate padding |
Michele Di Giorgio | a1422fb | 2018-10-24 12:20:19 +0100 | [diff] [blame] | 118 | const PaddingSize padding = PaddingCalculator(shape.x(), num_elems_processed_per_iteration).required_padding(); |
Sanghoon Lee | 70f8291 | 2017-08-24 14:21:24 +0100 | [diff] [blame] | 119 | validate(ref_src1.info()->padding(), padding); |
| 120 | validate(ref_src2.info()->padding(), padding); |
| 121 | validate(dst.info()->padding(), padding); |
| 122 | } |
| 123 | |
| 124 | FIXTURE_DATA_TEST_CASE(RunSmall, CLArithmeticAdditionFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(datasets::SmallShapes(), ArithmeticAdditionU8Dataset), |
| 125 | framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP }))) |
| 126 | { |
| 127 | // Validate output |
| 128 | validate(CLAccessor(_target), _reference); |
| 129 | } |
Michele Di Giorgio | 6997fc9 | 2019-06-18 10:23:22 +0100 | [diff] [blame] | 130 | TEST_SUITE_END() // U8 |
Michele Di Giorgio | 4622ac1 | 2018-06-27 16:41:17 +0100 | [diff] [blame] | 131 | |
Sanghoon Lee | 70f8291 | 2017-08-24 14:21:24 +0100 | [diff] [blame] | 132 | TEST_SUITE(S16) |
Michalis Spyrou | 8094325 | 2019-01-10 17:19:50 +0000 | [diff] [blame] | 133 | DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType", { DataType::U8, DataType::S16 })), |
Sanghoon Lee | 70f8291 | 2017-08-24 14:21:24 +0100 | [diff] [blame] | 134 | framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })), |
| 135 | shape, data_type, policy) |
| 136 | { |
| 137 | // Create tensors |
| 138 | CLTensor ref_src1 = create_tensor<CLTensor>(shape, data_type); |
| 139 | CLTensor ref_src2 = create_tensor<CLTensor>(shape, DataType::S16); |
| 140 | CLTensor dst = create_tensor<CLTensor>(shape, DataType::S16); |
| 141 | |
| 142 | // Create and Configure function |
| 143 | CLArithmeticAddition add; |
| 144 | add.configure(&ref_src1, &ref_src2, &dst, policy); |
| 145 | |
| 146 | // Validate valid region |
| 147 | const ValidRegion valid_region = shape_to_valid_region(shape); |
| 148 | validate(dst.info()->valid_region(), valid_region); |
| 149 | |
| 150 | // Validate padding |
Michele Di Giorgio | a1422fb | 2018-10-24 12:20:19 +0100 | [diff] [blame] | 151 | const PaddingSize padding = PaddingCalculator(shape.x(), num_elems_processed_per_iteration).required_padding(); |
Sanghoon Lee | 70f8291 | 2017-08-24 14:21:24 +0100 | [diff] [blame] | 152 | validate(ref_src1.info()->padding(), padding); |
| 153 | validate(ref_src2.info()->padding(), padding); |
| 154 | validate(dst.info()->padding(), padding); |
| 155 | } |
| 156 | |
| 157 | FIXTURE_DATA_TEST_CASE(RunSmall, CLArithmeticAdditionFixture<int16_t>, framework::DatasetMode::PRECOMMIT, combine(combine(datasets::SmallShapes(), ArithmeticAdditionS16Dataset), |
| 158 | framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP }))) |
| 159 | { |
| 160 | // Validate output |
| 161 | validate(CLAccessor(_target), _reference); |
| 162 | } |
| 163 | |
| 164 | FIXTURE_DATA_TEST_CASE(RunLarge, CLArithmeticAdditionFixture<int16_t>, framework::DatasetMode::NIGHTLY, combine(combine(datasets::LargeShapes(), ArithmeticAdditionS16Dataset), |
| 165 | framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP }))) |
| 166 | { |
| 167 | // Validate output |
| 168 | validate(CLAccessor(_target), _reference); |
| 169 | } |
Michele Di Giorgio | 6997fc9 | 2019-06-18 10:23:22 +0100 | [diff] [blame] | 170 | TEST_SUITE_END() // S16 |
| 171 | TEST_SUITE_END() // Integer |
| 172 | |
| 173 | template <typename T> |
| 174 | using CLArithmeticAdditionQuantizedFixture = ArithmeticAdditionValidationQuantizedFixture<CLTensor, CLAccessor, CLArithmeticAddition, T>; |
| 175 | |
| 176 | TEST_SUITE(Quantized) |
| 177 | TEST_SUITE(QASYMM8) |
| 178 | DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(datasets::SmallShapes(), framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE })), |
| 179 | shape, policy) |
| 180 | { |
| 181 | // Create tensors |
| 182 | CLTensor ref_src1 = create_tensor<CLTensor>(shape, DataType::QASYMM8); |
| 183 | CLTensor ref_src2 = create_tensor<CLTensor>(shape, DataType::QASYMM8); |
| 184 | CLTensor dst = create_tensor<CLTensor>(shape, DataType::QASYMM8); |
| 185 | |
| 186 | // Create and Configure function |
| 187 | CLArithmeticAddition add; |
| 188 | add.configure(&ref_src1, &ref_src2, &dst, policy); |
| 189 | |
| 190 | // Validate valid region |
| 191 | const ValidRegion valid_region = shape_to_valid_region(shape); |
| 192 | validate(dst.info()->valid_region(), valid_region); |
| 193 | |
| 194 | // Validate padding |
| 195 | const PaddingSize padding = PaddingCalculator(shape.x(), num_elems_processed_per_iteration).required_padding(); |
| 196 | validate(ref_src1.info()->padding(), padding); |
| 197 | validate(ref_src2.info()->padding(), padding); |
| 198 | validate(dst.info()->padding(), padding); |
| 199 | } |
| 200 | |
| 201 | FIXTURE_DATA_TEST_CASE(RunSmall, CLArithmeticAdditionQuantizedFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(combine(combine(datasets::SmallShapes(), |
| 202 | ArithmeticAdditionQASYMM8Dataset), |
| 203 | framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE })), |
| 204 | framework::dataset::make("Src0QInfo", { QuantizationInfo(5.f / 255.f, 20) })), |
| 205 | framework::dataset::make("Src1QInfo", { QuantizationInfo(2.f / 255.f, 10) })), |
| 206 | framework::dataset::make("OutQInfo", { QuantizationInfo(1.f / 255.f, 5) }))) |
| 207 | { |
| 208 | // Validate output |
| 209 | validate(CLAccessor(_target), _reference); |
| 210 | } |
| 211 | TEST_SUITE_END() // QASYMM8 |
| 212 | TEST_SUITE(QSYMM16) |
| 213 | DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(datasets::SmallShapes(), framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE })), |
| 214 | shape, policy) |
| 215 | { |
| 216 | // Create tensors |
| 217 | CLTensor ref_src1 = create_tensor<CLTensor>(shape, DataType::QSYMM16); |
| 218 | CLTensor ref_src2 = create_tensor<CLTensor>(shape, DataType::QSYMM16); |
| 219 | CLTensor dst = create_tensor<CLTensor>(shape, DataType::QSYMM16); |
| 220 | |
| 221 | // Create and Configure function |
| 222 | CLArithmeticAddition add; |
| 223 | add.configure(&ref_src1, &ref_src2, &dst, policy); |
| 224 | |
| 225 | // Validate valid region |
| 226 | const ValidRegion valid_region = shape_to_valid_region(shape); |
| 227 | validate(dst.info()->valid_region(), valid_region); |
| 228 | |
| 229 | // Validate padding |
| 230 | const PaddingSize padding = PaddingCalculator(shape.x(), num_elems_processed_per_iteration).required_padding(); |
| 231 | validate(ref_src1.info()->padding(), padding); |
| 232 | validate(ref_src2.info()->padding(), padding); |
| 233 | validate(dst.info()->padding(), padding); |
| 234 | } |
| 235 | |
| 236 | FIXTURE_DATA_TEST_CASE(RunSmall, CLArithmeticAdditionQuantizedFixture<int16_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(combine(combine(datasets::SmallShapes(), |
| 237 | ArithmeticAdditionQSYMM16Dataset), |
| 238 | framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE })), |
| 239 | framework::dataset::make("Src0QInfo", { QuantizationInfo(1.f / 32768.f, 0), QuantizationInfo(5.f / 32768.f, 0) })), |
| 240 | framework::dataset::make("Src1QInfo", { QuantizationInfo(2.f / 32768.f, 0), QuantizationInfo(5.f / 32768.f, 0) })), |
| 241 | framework::dataset::make("OutQInfo", { QuantizationInfo(5.f / 32768.f, 0) }))) |
| 242 | { |
| 243 | // Validate output |
| 244 | validate(CLAccessor(_target), _reference); |
| 245 | } |
| 246 | TEST_SUITE_END() // QSYMM16 |
| 247 | TEST_SUITE_END() // Quantized |
Sanghoon Lee | 70f8291 | 2017-08-24 14:21:24 +0100 | [diff] [blame] | 248 | |
Sanghoon Lee | 70f8291 | 2017-08-24 14:21:24 +0100 | [diff] [blame] | 249 | TEST_SUITE(Float) |
| 250 | TEST_SUITE(FP16) |
Georgios Pinitas | 583137c | 2017-08-31 18:12:42 +0100 | [diff] [blame] | 251 | FIXTURE_DATA_TEST_CASE(RunSmall, CLArithmeticAdditionFixture<half>, framework::DatasetMode::ALL, combine(combine(datasets::SmallShapes(), ArithmeticAdditionFP16Dataset), |
| 252 | framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP }))) |
Sanghoon Lee | 70f8291 | 2017-08-24 14:21:24 +0100 | [diff] [blame] | 253 | { |
| 254 | // Validate output |
| 255 | validate(CLAccessor(_target), _reference); |
| 256 | } |
Michele Di Giorgio | 6997fc9 | 2019-06-18 10:23:22 +0100 | [diff] [blame] | 257 | TEST_SUITE_END() // FP16 |
Sanghoon Lee | 70f8291 | 2017-08-24 14:21:24 +0100 | [diff] [blame] | 258 | |
| 259 | TEST_SUITE(FP32) |
Michalis Spyrou | 8094325 | 2019-01-10 17:19:50 +0000 | [diff] [blame] | 260 | DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(datasets::SmallShapes(), framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })), |
Sanghoon Lee | 70f8291 | 2017-08-24 14:21:24 +0100 | [diff] [blame] | 261 | shape, policy) |
| 262 | { |
| 263 | // Create tensors |
| 264 | CLTensor ref_src1 = create_tensor<CLTensor>(shape, DataType::F32); |
| 265 | CLTensor ref_src2 = create_tensor<CLTensor>(shape, DataType::F32); |
| 266 | CLTensor dst = create_tensor<CLTensor>(shape, DataType::F32); |
| 267 | |
| 268 | // Create and Configure function |
| 269 | CLArithmeticAddition add; |
| 270 | add.configure(&ref_src1, &ref_src2, &dst, policy); |
| 271 | |
| 272 | // Validate valid region |
| 273 | const ValidRegion valid_region = shape_to_valid_region(shape); |
| 274 | validate(dst.info()->valid_region(), valid_region); |
| 275 | |
| 276 | // Validate padding |
Michele Di Giorgio | a1422fb | 2018-10-24 12:20:19 +0100 | [diff] [blame] | 277 | const PaddingSize padding = PaddingCalculator(shape.x(), num_elems_processed_per_iteration).required_padding(); |
Sanghoon Lee | 70f8291 | 2017-08-24 14:21:24 +0100 | [diff] [blame] | 278 | validate(ref_src1.info()->padding(), padding); |
| 279 | validate(ref_src2.info()->padding(), padding); |
| 280 | validate(dst.info()->padding(), padding); |
| 281 | } |
| 282 | |
| 283 | FIXTURE_DATA_TEST_CASE(RunSmall, CLArithmeticAdditionFixture<float>, framework::DatasetMode::PRECOMMIT, combine(combine(datasets::SmallShapes(), ArithmeticAdditionFP32Dataset), |
| 284 | framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP }))) |
| 285 | { |
| 286 | // Validate output |
| 287 | validate(CLAccessor(_target), _reference); |
| 288 | } |
| 289 | |
| 290 | FIXTURE_DATA_TEST_CASE(RunLarge, CLArithmeticAdditionFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(datasets::LargeShapes(), ArithmeticAdditionFP32Dataset), |
| 291 | framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP }))) |
| 292 | { |
| 293 | // Validate output |
| 294 | validate(CLAccessor(_target), _reference); |
| 295 | } |
Diego Lopez Recas | 0021d75 | 2017-12-18 14:42:56 +0000 | [diff] [blame] | 296 | |
| 297 | template <typename T> |
| 298 | using CLArithmeticAdditionBroadcastFixture = ArithmeticAdditionBroadcastValidationFixture<CLTensor, CLAccessor, CLArithmeticAddition, T>; |
| 299 | |
| 300 | FIXTURE_DATA_TEST_CASE(RunSmallBroadcast, CLArithmeticAdditionBroadcastFixture<float>, framework::DatasetMode::PRECOMMIT, combine(combine(datasets::SmallShapesBroadcast(), |
| 301 | ArithmeticAdditionFP32Dataset), |
| 302 | framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP }))) |
| 303 | { |
| 304 | // Validate output |
| 305 | validate(CLAccessor(_target), _reference); |
| 306 | } |
| 307 | |
| 308 | FIXTURE_DATA_TEST_CASE(RunLargeBroadcast, CLArithmeticAdditionBroadcastFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(datasets::LargeShapesBroadcast(), |
| 309 | ArithmeticAdditionFP32Dataset), |
| 310 | framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP }))) |
| 311 | { |
| 312 | // Validate output |
| 313 | validate(CLAccessor(_target), _reference); |
| 314 | } |
Michele Di Giorgio | 6997fc9 | 2019-06-18 10:23:22 +0100 | [diff] [blame] | 315 | TEST_SUITE_END() // FP32 |
| 316 | TEST_SUITE_END() // Float |
Sanghoon Lee | 70f8291 | 2017-08-24 14:21:24 +0100 | [diff] [blame] | 317 | |
Michele Di Giorgio | 6997fc9 | 2019-06-18 10:23:22 +0100 | [diff] [blame] | 318 | TEST_SUITE_END() // ArithmeticAddition |
| 319 | TEST_SUITE_END() // CL |
Sanghoon Lee | 70f8291 | 2017-08-24 14:21:24 +0100 | [diff] [blame] | 320 | } // namespace validation |
| 321 | } // namespace test |
| 322 | } // namespace arm_compute |