Sanghoon Lee | c8a85ba | 2017-11-29 11:23:14 +0000 | [diff] [blame] | 1 | /* |
Sanghoon Lee | c8d2316 | 2018-01-12 16:19:10 +0000 | [diff] [blame] | 2 | * Copyright (c) 2017-2018 ARM Limited. |
Sanghoon Lee | c8a85ba | 2017-11-29 11:23:14 +0000 | [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, |
| 21 | * OUT OF OR IN CONNECTION 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/NEON/functions/NEConvolution.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/BorderModeDataset.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/ConvolutionFixture.h" |
| 37 | |
| 38 | namespace arm_compute |
| 39 | { |
| 40 | namespace test |
| 41 | { |
| 42 | namespace validation |
| 43 | { |
| 44 | namespace |
| 45 | { |
Georgios Pinitas | acacc32 | 2017-12-13 12:48:44 +0000 | [diff] [blame] | 46 | /** Tolerance value for comparing reference's output against implementation |
| 47 | * |
| 48 | * This is due to the fact that NEON target performs multiplication with reciprocal of scale, |
| 49 | * while reference performs direct division with scale. |
| 50 | */ |
| 51 | constexpr AbsoluteTolerance<uint8_t> tolerance_u8(1); |
Sanghoon Lee | c8d2316 | 2018-01-12 16:19:10 +0000 | [diff] [blame] | 52 | constexpr AbsoluteTolerance<int16_t> tolerance_s16(1); |
Sanghoon Lee | c8a85ba | 2017-11-29 11:23:14 +0000 | [diff] [blame] | 53 | } // namespace |
| 54 | |
| 55 | TEST_SUITE(NEON) |
| 56 | TEST_SUITE(CustomConvolution) |
Sanghoon Lee | c0079e9 | 2018-01-29 17:28:49 +0000 | [diff] [blame] | 57 | TEST_SUITE(Square3x3) |
Sanghoon Lee | c8a85ba | 2017-11-29 11:23:14 +0000 | [diff] [blame] | 58 | |
Sanghoon Lee | c8d2316 | 2018-01-12 16:19:10 +0000 | [diff] [blame] | 59 | DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), framework::dataset::make("DataType", { DataType::U8, DataType::S16 })), |
Sanghoon Lee | d7ba539 | 2017-12-13 11:28:50 +0000 | [diff] [blame] | 60 | datasets::BorderModes()), |
| 61 | framework::dataset::make("filter_size", { 3 })), |
Sanghoon Lee | c8d2316 | 2018-01-12 16:19:10 +0000 | [diff] [blame] | 62 | shape, output_data_type, border_mode, filter_size) |
Sanghoon Lee | c8a85ba | 2017-11-29 11:23:14 +0000 | [diff] [blame] | 63 | { |
| 64 | // Create tensors |
Sanghoon Lee | c8d2316 | 2018-01-12 16:19:10 +0000 | [diff] [blame] | 65 | Tensor src = create_tensor<Tensor>(shape, DataType::U8); |
| 66 | Tensor dst = create_tensor<Tensor>(shape, output_data_type); |
Sanghoon Lee | c8a85ba | 2017-11-29 11:23:14 +0000 | [diff] [blame] | 67 | |
| 68 | // Create conv matrix |
Michalis Spyrou | 5ae9b69 | 2018-02-05 14:59:54 +0000 | [diff] [blame] | 69 | int16_t conv[9] = {}; |
Sanghoon Lee | c8a85ba | 2017-11-29 11:23:14 +0000 | [diff] [blame] | 70 | |
| 71 | ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 72 | ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 73 | |
| 74 | // Create and configure function |
| 75 | NEConvolution3x3 convolution; |
Sanghoon Lee | d7ba539 | 2017-12-13 11:28:50 +0000 | [diff] [blame] | 76 | convolution.configure(&src, &dst, conv, 0, border_mode); |
Sanghoon Lee | c8a85ba | 2017-11-29 11:23:14 +0000 | [diff] [blame] | 77 | |
| 78 | // Validate valid region |
Sanghoon Lee | d7ba539 | 2017-12-13 11:28:50 +0000 | [diff] [blame] | 79 | const ValidRegion dst_valid_region = shape_to_valid_region(shape, (border_mode == BorderMode::UNDEFINED), BorderSize(filter_size / 2)); |
Sanghoon Lee | c8a85ba | 2017-11-29 11:23:14 +0000 | [diff] [blame] | 80 | validate(dst.info()->valid_region(), dst_valid_region); |
| 81 | |
| 82 | // Validate padding |
| 83 | PaddingCalculator calculator(shape.x(), 8); |
| 84 | calculator.set_border_size(1); |
| 85 | calculator.set_border_mode(border_mode); |
| 86 | |
| 87 | const PaddingSize dst_padding = calculator.required_padding(); |
| 88 | |
| 89 | calculator.set_accessed_elements(16); |
| 90 | calculator.set_access_offset(-1); |
| 91 | |
| 92 | const PaddingSize src_padding = calculator.required_padding(); |
| 93 | |
| 94 | validate(src.info()->padding(), src_padding); |
| 95 | validate(dst.info()->padding(), dst_padding); |
| 96 | } |
| 97 | |
| 98 | template <typename T> |
Sanghoon Lee | d7ba539 | 2017-12-13 11:28:50 +0000 | [diff] [blame] | 99 | using NEConvolutionFixture = ConvolutionSquareValidationFixture<Tensor, Accessor, NEConvolution3x3, T>; |
Sanghoon Lee | c8a85ba | 2017-11-29 11:23:14 +0000 | [diff] [blame] | 100 | |
Sanghoon Lee | c0079e9 | 2018-01-29 17:28:49 +0000 | [diff] [blame] | 101 | TEST_SUITE(U8) |
Sanghoon Lee | d7ba539 | 2017-12-13 11:28:50 +0000 | [diff] [blame] | 102 | FIXTURE_DATA_TEST_CASE(RunSmall, NEConvolutionFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType", |
Sanghoon Lee | c8a85ba | 2017-11-29 11:23:14 +0000 | [diff] [blame] | 103 | DataType::U8)), |
Sanghoon Lee | d7ba539 | 2017-12-13 11:28:50 +0000 | [diff] [blame] | 104 | datasets::BorderModes()), |
| 105 | framework::dataset::make("filter_size", { 3 }))) |
Sanghoon Lee | c8a85ba | 2017-11-29 11:23:14 +0000 | [diff] [blame] | 106 | { |
| 107 | // Validate output |
Sanghoon Lee | d7ba539 | 2017-12-13 11:28:50 +0000 | [diff] [blame] | 108 | validate(Accessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)), tolerance_u8); |
Sanghoon Lee | c8a85ba | 2017-11-29 11:23:14 +0000 | [diff] [blame] | 109 | } |
| 110 | |
Sanghoon Lee | d7ba539 | 2017-12-13 11:28:50 +0000 | [diff] [blame] | 111 | FIXTURE_DATA_TEST_CASE(RunLarge, NEConvolutionFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType", |
Sanghoon Lee | c8a85ba | 2017-11-29 11:23:14 +0000 | [diff] [blame] | 112 | DataType::U8)), |
Sanghoon Lee | d7ba539 | 2017-12-13 11:28:50 +0000 | [diff] [blame] | 113 | datasets::BorderModes()), |
| 114 | framework::dataset::make("filter_size", { 3 }))) |
Sanghoon Lee | c8a85ba | 2017-11-29 11:23:14 +0000 | [diff] [blame] | 115 | { |
| 116 | // Validate output |
Sanghoon Lee | d7ba539 | 2017-12-13 11:28:50 +0000 | [diff] [blame] | 117 | validate(Accessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)), tolerance_u8); |
Sanghoon Lee | c8a85ba | 2017-11-29 11:23:14 +0000 | [diff] [blame] | 118 | } |
Sanghoon Lee | c8d2316 | 2018-01-12 16:19:10 +0000 | [diff] [blame] | 119 | TEST_SUITE_END() |
| 120 | |
Sanghoon Lee | c0079e9 | 2018-01-29 17:28:49 +0000 | [diff] [blame] | 121 | TEST_SUITE(S16) |
Sanghoon Lee | c8d2316 | 2018-01-12 16:19:10 +0000 | [diff] [blame] | 122 | FIXTURE_DATA_TEST_CASE(RunSmall, NEConvolutionFixture<int16_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType", |
| 123 | DataType::S16)), |
| 124 | datasets::BorderModes()), |
| 125 | framework::dataset::make("filter_size", { 3 }))) |
| 126 | { |
| 127 | // Validate output |
| 128 | validate(Accessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)), tolerance_s16); |
| 129 | } |
| 130 | |
| 131 | FIXTURE_DATA_TEST_CASE(RunLarge, NEConvolutionFixture<int16_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType", |
| 132 | DataType::S16)), |
| 133 | datasets::BorderModes()), |
| 134 | framework::dataset::make("filter_size", { 3 }))) |
| 135 | { |
| 136 | // Validate output |
| 137 | validate(Accessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)), tolerance_s16); |
| 138 | } |
| 139 | TEST_SUITE_END() |
Sanghoon Lee | c0079e9 | 2018-01-29 17:28:49 +0000 | [diff] [blame] | 140 | TEST_SUITE_END() /* Square3x3 */ |
Sanghoon Lee | c8a85ba | 2017-11-29 11:23:14 +0000 | [diff] [blame] | 141 | |
Sanghoon Lee | c0079e9 | 2018-01-29 17:28:49 +0000 | [diff] [blame] | 142 | TEST_SUITE(Square5x5) |
Sanghoon Lee | c8d2316 | 2018-01-12 16:19:10 +0000 | [diff] [blame] | 143 | DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), framework::dataset::make("DataType", { DataType::U8, DataType::S16 })), |
Sanghoon Lee | d7ba539 | 2017-12-13 11:28:50 +0000 | [diff] [blame] | 144 | datasets::BorderModes()), |
| 145 | framework::dataset::make("filter_size", { 5 })), |
Sanghoon Lee | c8d2316 | 2018-01-12 16:19:10 +0000 | [diff] [blame] | 146 | shape, output_data_type, border_mode, filter_size) |
Sanghoon Lee | c8a85ba | 2017-11-29 11:23:14 +0000 | [diff] [blame] | 147 | { |
| 148 | // Create tensors |
Sanghoon Lee | c8d2316 | 2018-01-12 16:19:10 +0000 | [diff] [blame] | 149 | Tensor src = create_tensor<Tensor>(shape, DataType::U8); |
| 150 | Tensor dst = create_tensor<Tensor>(shape, output_data_type); |
Sanghoon Lee | c8a85ba | 2017-11-29 11:23:14 +0000 | [diff] [blame] | 151 | |
| 152 | // Create conv matrix |
Michalis Spyrou | 5ae9b69 | 2018-02-05 14:59:54 +0000 | [diff] [blame] | 153 | int16_t conv[25] = {}; |
Sanghoon Lee | c8a85ba | 2017-11-29 11:23:14 +0000 | [diff] [blame] | 154 | |
| 155 | ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 156 | ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 157 | |
| 158 | // Create and configure function |
| 159 | NEConvolution5x5 convolution; |
Sanghoon Lee | d7ba539 | 2017-12-13 11:28:50 +0000 | [diff] [blame] | 160 | convolution.configure(&src, &dst, conv, 0, border_mode); |
Sanghoon Lee | c8a85ba | 2017-11-29 11:23:14 +0000 | [diff] [blame] | 161 | |
| 162 | // Validate valid region |
Sanghoon Lee | d7ba539 | 2017-12-13 11:28:50 +0000 | [diff] [blame] | 163 | const ValidRegion dst_valid_region = shape_to_valid_region(shape, (border_mode == BorderMode::UNDEFINED), BorderSize(filter_size / 2)); |
Sanghoon Lee | c8a85ba | 2017-11-29 11:23:14 +0000 | [diff] [blame] | 164 | validate(dst.info()->valid_region(), dst_valid_region); |
| 165 | |
| 166 | // Validate padding |
| 167 | PaddingCalculator calculator(shape.x(), 8); |
| 168 | calculator.set_border_size(2); |
| 169 | calculator.set_border_mode(border_mode); |
| 170 | |
| 171 | const PaddingSize dst_padding = calculator.required_padding(); |
| 172 | |
| 173 | calculator.set_accessed_elements(16); |
| 174 | calculator.set_access_offset(-2); |
| 175 | |
| 176 | const PaddingSize src_padding = calculator.required_padding(); |
| 177 | |
| 178 | validate(src.info()->padding(), src_padding); |
| 179 | validate(dst.info()->padding(), dst_padding); |
| 180 | } |
| 181 | |
| 182 | template <typename T> |
Sanghoon Lee | d7ba539 | 2017-12-13 11:28:50 +0000 | [diff] [blame] | 183 | using NEConvolutionFixture = ConvolutionSquareValidationFixture<Tensor, Accessor, NEConvolution5x5, T>; |
Sanghoon Lee | c8a85ba | 2017-11-29 11:23:14 +0000 | [diff] [blame] | 184 | |
Sanghoon Lee | c0079e9 | 2018-01-29 17:28:49 +0000 | [diff] [blame] | 185 | TEST_SUITE(U8) |
Sanghoon Lee | d7ba539 | 2017-12-13 11:28:50 +0000 | [diff] [blame] | 186 | FIXTURE_DATA_TEST_CASE(RunSmall, NEConvolutionFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType", |
Sanghoon Lee | c8a85ba | 2017-11-29 11:23:14 +0000 | [diff] [blame] | 187 | DataType::U8)), |
Sanghoon Lee | d7ba539 | 2017-12-13 11:28:50 +0000 | [diff] [blame] | 188 | datasets::BorderModes()), |
| 189 | framework::dataset::make("filter_size", { 5 }))) |
Sanghoon Lee | c8a85ba | 2017-11-29 11:23:14 +0000 | [diff] [blame] | 190 | { |
| 191 | // Validate output |
Sanghoon Lee | d7ba539 | 2017-12-13 11:28:50 +0000 | [diff] [blame] | 192 | validate(Accessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)), tolerance_u8); |
Sanghoon Lee | c8a85ba | 2017-11-29 11:23:14 +0000 | [diff] [blame] | 193 | } |
| 194 | |
Sanghoon Lee | d7ba539 | 2017-12-13 11:28:50 +0000 | [diff] [blame] | 195 | FIXTURE_DATA_TEST_CASE(RunLarge, NEConvolutionFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType", |
Sanghoon Lee | c8a85ba | 2017-11-29 11:23:14 +0000 | [diff] [blame] | 196 | DataType::U8)), |
Sanghoon Lee | d7ba539 | 2017-12-13 11:28:50 +0000 | [diff] [blame] | 197 | datasets::BorderModes()), |
| 198 | framework::dataset::make("filter_size", { 5 }))) |
Sanghoon Lee | c8a85ba | 2017-11-29 11:23:14 +0000 | [diff] [blame] | 199 | { |
| 200 | // Validate output |
Sanghoon Lee | d7ba539 | 2017-12-13 11:28:50 +0000 | [diff] [blame] | 201 | validate(Accessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)), tolerance_u8); |
Sanghoon Lee | c8a85ba | 2017-11-29 11:23:14 +0000 | [diff] [blame] | 202 | } |
Sanghoon Lee | c8d2316 | 2018-01-12 16:19:10 +0000 | [diff] [blame] | 203 | TEST_SUITE_END() |
| 204 | |
Sanghoon Lee | c0079e9 | 2018-01-29 17:28:49 +0000 | [diff] [blame] | 205 | TEST_SUITE(S16) |
Sanghoon Lee | c8d2316 | 2018-01-12 16:19:10 +0000 | [diff] [blame] | 206 | FIXTURE_DATA_TEST_CASE(RunSmall, NEConvolutionFixture<int16_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType", |
| 207 | DataType::S16)), |
| 208 | datasets::BorderModes()), |
| 209 | framework::dataset::make("filter_size", { 5 }))) |
| 210 | { |
| 211 | // Validate output |
| 212 | validate(Accessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)), tolerance_s16); |
| 213 | } |
| 214 | |
| 215 | FIXTURE_DATA_TEST_CASE(RunLarge, NEConvolutionFixture<int16_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType", |
| 216 | DataType::S16)), |
| 217 | datasets::BorderModes()), |
| 218 | framework::dataset::make("filter_size", { 5 }))) |
| 219 | { |
| 220 | // Validate output |
| 221 | validate(Accessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)), tolerance_s16); |
| 222 | } |
| 223 | TEST_SUITE_END() |
Sanghoon Lee | c0079e9 | 2018-01-29 17:28:49 +0000 | [diff] [blame] | 224 | TEST_SUITE_END() /* Square5x5 */ |
Sanghoon Lee | c8a85ba | 2017-11-29 11:23:14 +0000 | [diff] [blame] | 225 | |
Sanghoon Lee | c0079e9 | 2018-01-29 17:28:49 +0000 | [diff] [blame] | 226 | TEST_SUITE(Square7x7) |
Sanghoon Lee | c8d2316 | 2018-01-12 16:19:10 +0000 | [diff] [blame] | 227 | DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), framework::dataset::make("DataType", { DataType::U8, DataType::S16 })), |
Sanghoon Lee | d7ba539 | 2017-12-13 11:28:50 +0000 | [diff] [blame] | 228 | datasets::BorderModes()), |
| 229 | framework::dataset::make("filter_size", { 7 })), |
Sanghoon Lee | c8d2316 | 2018-01-12 16:19:10 +0000 | [diff] [blame] | 230 | shape, output_data_type, border_mode, filter_size) |
Sanghoon Lee | c8a85ba | 2017-11-29 11:23:14 +0000 | [diff] [blame] | 231 | { |
| 232 | // Create tensors |
Sanghoon Lee | c8d2316 | 2018-01-12 16:19:10 +0000 | [diff] [blame] | 233 | Tensor src = create_tensor<Tensor>(shape, DataType::U8); |
| 234 | Tensor dst = create_tensor<Tensor>(shape, output_data_type); |
Sanghoon Lee | c8a85ba | 2017-11-29 11:23:14 +0000 | [diff] [blame] | 235 | |
| 236 | // Create conv matrix |
Michalis Spyrou | 5ae9b69 | 2018-02-05 14:59:54 +0000 | [diff] [blame] | 237 | int16_t conv[49] = {}; |
Sanghoon Lee | c8a85ba | 2017-11-29 11:23:14 +0000 | [diff] [blame] | 238 | |
| 239 | ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 240 | ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 241 | |
| 242 | // Create and configure function |
| 243 | NEConvolution7x7 convolution; |
Sanghoon Lee | d7ba539 | 2017-12-13 11:28:50 +0000 | [diff] [blame] | 244 | convolution.configure(&src, &dst, conv, 0, border_mode); |
Sanghoon Lee | c8a85ba | 2017-11-29 11:23:14 +0000 | [diff] [blame] | 245 | |
| 246 | // Validate valid region |
Sanghoon Lee | d7ba539 | 2017-12-13 11:28:50 +0000 | [diff] [blame] | 247 | const ValidRegion dst_valid_region = shape_to_valid_region(shape, (border_mode == BorderMode::UNDEFINED), BorderSize(filter_size / 2)); |
Sanghoon Lee | c8a85ba | 2017-11-29 11:23:14 +0000 | [diff] [blame] | 248 | validate(dst.info()->valid_region(), dst_valid_region); |
| 249 | |
| 250 | // Validate padding |
| 251 | PaddingCalculator calculator(shape.x(), 8); |
| 252 | calculator.set_border_size(3); |
| 253 | calculator.set_border_mode(border_mode); |
| 254 | |
| 255 | const PaddingSize dst_padding = calculator.required_padding(); |
| 256 | |
| 257 | calculator.set_accessed_elements(16); |
| 258 | calculator.set_access_offset(-3); |
| 259 | |
| 260 | const PaddingSize src_padding = calculator.required_padding(); |
| 261 | |
| 262 | validate(src.info()->padding(), src_padding); |
| 263 | validate(dst.info()->padding(), dst_padding); |
| 264 | } |
| 265 | |
| 266 | template <typename T> |
Sanghoon Lee | d7ba539 | 2017-12-13 11:28:50 +0000 | [diff] [blame] | 267 | using NEConvolutionFixture = ConvolutionSquareValidationFixture<Tensor, Accessor, NEConvolution7x7, T>; |
Sanghoon Lee | c8a85ba | 2017-11-29 11:23:14 +0000 | [diff] [blame] | 268 | |
Sanghoon Lee | c0079e9 | 2018-01-29 17:28:49 +0000 | [diff] [blame] | 269 | TEST_SUITE(U8) |
Sanghoon Lee | d7ba539 | 2017-12-13 11:28:50 +0000 | [diff] [blame] | 270 | FIXTURE_DATA_TEST_CASE(RunSmall, NEConvolutionFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType", |
Sanghoon Lee | c8a85ba | 2017-11-29 11:23:14 +0000 | [diff] [blame] | 271 | DataType::U8)), |
Sanghoon Lee | d7ba539 | 2017-12-13 11:28:50 +0000 | [diff] [blame] | 272 | datasets::BorderModes()), |
| 273 | framework::dataset::make("filter_size", { 7 }))) |
Sanghoon Lee | c8a85ba | 2017-11-29 11:23:14 +0000 | [diff] [blame] | 274 | { |
| 275 | // Validate output |
Sanghoon Lee | d7ba539 | 2017-12-13 11:28:50 +0000 | [diff] [blame] | 276 | validate(Accessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)), tolerance_u8); |
Sanghoon Lee | c8a85ba | 2017-11-29 11:23:14 +0000 | [diff] [blame] | 277 | } |
| 278 | |
Sanghoon Lee | d7ba539 | 2017-12-13 11:28:50 +0000 | [diff] [blame] | 279 | FIXTURE_DATA_TEST_CASE(RunLarge, NEConvolutionFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType", |
Sanghoon Lee | c8a85ba | 2017-11-29 11:23:14 +0000 | [diff] [blame] | 280 | DataType::U8)), |
Sanghoon Lee | d7ba539 | 2017-12-13 11:28:50 +0000 | [diff] [blame] | 281 | datasets::BorderModes()), |
| 282 | framework::dataset::make("filter_size", { 7 }))) |
Sanghoon Lee | c8a85ba | 2017-11-29 11:23:14 +0000 | [diff] [blame] | 283 | { |
| 284 | // Validate output |
Sanghoon Lee | d7ba539 | 2017-12-13 11:28:50 +0000 | [diff] [blame] | 285 | validate(Accessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)), tolerance_u8); |
Sanghoon Lee | c8a85ba | 2017-11-29 11:23:14 +0000 | [diff] [blame] | 286 | } |
Sanghoon Lee | c8d2316 | 2018-01-12 16:19:10 +0000 | [diff] [blame] | 287 | TEST_SUITE_END() |
| 288 | |
Sanghoon Lee | c0079e9 | 2018-01-29 17:28:49 +0000 | [diff] [blame] | 289 | TEST_SUITE(S16) |
Sanghoon Lee | c8d2316 | 2018-01-12 16:19:10 +0000 | [diff] [blame] | 290 | FIXTURE_DATA_TEST_CASE(RunSmall, NEConvolutionFixture<int16_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType", |
| 291 | DataType::S16)), |
| 292 | datasets::BorderModes()), |
| 293 | framework::dataset::make("filter_size", { 7 }))) |
| 294 | { |
| 295 | // Validate output |
| 296 | validate(Accessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)), tolerance_s16); |
| 297 | } |
| 298 | |
| 299 | FIXTURE_DATA_TEST_CASE(RunLarge, NEConvolutionFixture<int16_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType", |
| 300 | DataType::S16)), |
| 301 | datasets::BorderModes()), |
| 302 | framework::dataset::make("filter_size", { 7 }))) |
| 303 | { |
| 304 | // Validate output |
| 305 | validate(Accessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)), tolerance_s16); |
| 306 | } |
| 307 | TEST_SUITE_END() |
Sanghoon Lee | c0079e9 | 2018-01-29 17:28:49 +0000 | [diff] [blame] | 308 | TEST_SUITE_END() /* Square7x7 */ |
Sanghoon Lee | c8a85ba | 2017-11-29 11:23:14 +0000 | [diff] [blame] | 309 | |
Sanghoon Lee | c0079e9 | 2018-01-29 17:28:49 +0000 | [diff] [blame] | 310 | TEST_SUITE(Square9x9) |
Sanghoon Lee | c8d2316 | 2018-01-12 16:19:10 +0000 | [diff] [blame] | 311 | DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), framework::dataset::make("DataType", { DataType::U8, DataType::S16 })), |
Sanghoon Lee | d7ba539 | 2017-12-13 11:28:50 +0000 | [diff] [blame] | 312 | datasets::BorderModes()), |
| 313 | framework::dataset::make("filter_size", { 9 })), |
Sanghoon Lee | c8d2316 | 2018-01-12 16:19:10 +0000 | [diff] [blame] | 314 | shape, output_data_type, border_mode, filter_size) |
Sanghoon Lee | c8a85ba | 2017-11-29 11:23:14 +0000 | [diff] [blame] | 315 | { |
| 316 | // Create tensors |
Sanghoon Lee | c8d2316 | 2018-01-12 16:19:10 +0000 | [diff] [blame] | 317 | Tensor src = create_tensor<Tensor>(shape, DataType::U8); |
| 318 | Tensor dst = create_tensor<Tensor>(shape, output_data_type); |
Sanghoon Lee | c8a85ba | 2017-11-29 11:23:14 +0000 | [diff] [blame] | 319 | |
| 320 | // Create conv matrix |
Michalis Spyrou | 5ae9b69 | 2018-02-05 14:59:54 +0000 | [diff] [blame] | 321 | int16_t conv[81] = {}; |
Sanghoon Lee | c8a85ba | 2017-11-29 11:23:14 +0000 | [diff] [blame] | 322 | |
| 323 | ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 324 | ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 325 | |
| 326 | // Create and configure function |
| 327 | NEConvolution9x9 convolution; |
Sanghoon Lee | d7ba539 | 2017-12-13 11:28:50 +0000 | [diff] [blame] | 328 | convolution.configure(&src, &dst, conv, 0, border_mode); |
Sanghoon Lee | c8a85ba | 2017-11-29 11:23:14 +0000 | [diff] [blame] | 329 | |
| 330 | // Validate valid region |
Sanghoon Lee | d7ba539 | 2017-12-13 11:28:50 +0000 | [diff] [blame] | 331 | const ValidRegion dst_valid_region = shape_to_valid_region(shape, (border_mode == BorderMode::UNDEFINED), BorderSize(filter_size / 2)); |
Sanghoon Lee | c8a85ba | 2017-11-29 11:23:14 +0000 | [diff] [blame] | 332 | validate(dst.info()->valid_region(), dst_valid_region); |
| 333 | |
| 334 | // Validate padding |
| 335 | PaddingCalculator calculator(shape.x(), 8); |
| 336 | calculator.set_border_size(4); |
| 337 | calculator.set_border_mode(border_mode); |
| 338 | |
| 339 | const PaddingSize dst_padding = calculator.required_padding(); |
| 340 | |
| 341 | calculator.set_accessed_elements(16); |
| 342 | calculator.set_access_offset(-4); |
| 343 | |
| 344 | const PaddingSize src_padding = calculator.required_padding(); |
| 345 | |
| 346 | validate(src.info()->padding(), src_padding); |
| 347 | validate(dst.info()->padding(), dst_padding); |
| 348 | } |
| 349 | |
| 350 | template <typename T> |
Sanghoon Lee | d7ba539 | 2017-12-13 11:28:50 +0000 | [diff] [blame] | 351 | using NEConvolutionFixture = ConvolutionSquareValidationFixture<Tensor, Accessor, NEConvolution9x9, T>; |
Sanghoon Lee | c8a85ba | 2017-11-29 11:23:14 +0000 | [diff] [blame] | 352 | |
Sanghoon Lee | c0079e9 | 2018-01-29 17:28:49 +0000 | [diff] [blame] | 353 | TEST_SUITE(U8) |
Sanghoon Lee | d7ba539 | 2017-12-13 11:28:50 +0000 | [diff] [blame] | 354 | FIXTURE_DATA_TEST_CASE(RunSmall, NEConvolutionFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType", |
Sanghoon Lee | c8a85ba | 2017-11-29 11:23:14 +0000 | [diff] [blame] | 355 | DataType::U8)), |
Sanghoon Lee | d7ba539 | 2017-12-13 11:28:50 +0000 | [diff] [blame] | 356 | datasets::BorderModes()), |
| 357 | framework::dataset::make("filter_size", { 9 }))) |
Sanghoon Lee | c8a85ba | 2017-11-29 11:23:14 +0000 | [diff] [blame] | 358 | { |
| 359 | // Validate output |
Sanghoon Lee | d7ba539 | 2017-12-13 11:28:50 +0000 | [diff] [blame] | 360 | validate(Accessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)), tolerance_u8); |
Sanghoon Lee | c8a85ba | 2017-11-29 11:23:14 +0000 | [diff] [blame] | 361 | } |
| 362 | |
Sanghoon Lee | d7ba539 | 2017-12-13 11:28:50 +0000 | [diff] [blame] | 363 | FIXTURE_DATA_TEST_CASE(RunLarge, NEConvolutionFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType", |
Sanghoon Lee | c8a85ba | 2017-11-29 11:23:14 +0000 | [diff] [blame] | 364 | DataType::U8)), |
Sanghoon Lee | d7ba539 | 2017-12-13 11:28:50 +0000 | [diff] [blame] | 365 | datasets::BorderModes()), |
| 366 | framework::dataset::make("filter_size", { 9 }))) |
Sanghoon Lee | c8a85ba | 2017-11-29 11:23:14 +0000 | [diff] [blame] | 367 | { |
| 368 | // Validate output |
Sanghoon Lee | d7ba539 | 2017-12-13 11:28:50 +0000 | [diff] [blame] | 369 | validate(Accessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)), tolerance_u8); |
Sanghoon Lee | c8a85ba | 2017-11-29 11:23:14 +0000 | [diff] [blame] | 370 | } |
Sanghoon Lee | c8d2316 | 2018-01-12 16:19:10 +0000 | [diff] [blame] | 371 | TEST_SUITE_END() |
| 372 | |
Sanghoon Lee | c0079e9 | 2018-01-29 17:28:49 +0000 | [diff] [blame] | 373 | TEST_SUITE(S16) |
Sanghoon Lee | c8d2316 | 2018-01-12 16:19:10 +0000 | [diff] [blame] | 374 | FIXTURE_DATA_TEST_CASE(RunSmall, NEConvolutionFixture<int16_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType", |
| 375 | DataType::S16)), |
| 376 | datasets::BorderModes()), |
| 377 | framework::dataset::make("filter_size", { 9 }))) |
| 378 | { |
| 379 | // Validate output |
| 380 | validate(Accessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)), tolerance_s16); |
| 381 | } |
| 382 | |
| 383 | FIXTURE_DATA_TEST_CASE(RunLarge, NEConvolutionFixture<int16_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType", |
| 384 | DataType::S16)), |
| 385 | datasets::BorderModes()), |
| 386 | framework::dataset::make("filter_size", { 9 }))) |
| 387 | { |
| 388 | // Validate output |
| 389 | validate(Accessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)), tolerance_s16); |
| 390 | } |
| 391 | TEST_SUITE_END() |
Sanghoon Lee | c0079e9 | 2018-01-29 17:28:49 +0000 | [diff] [blame] | 392 | TEST_SUITE_END() /* Square9x9 */ |
Sanghoon Lee | d7ba539 | 2017-12-13 11:28:50 +0000 | [diff] [blame] | 393 | |
Sanghoon Lee | c0079e9 | 2018-01-29 17:28:49 +0000 | [diff] [blame] | 394 | TEST_SUITE(Rectangle) |
Sanghoon Lee | d7ba539 | 2017-12-13 11:28:50 +0000 | [diff] [blame] | 395 | DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(combine(combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), framework::dataset::make("DataType", |
Sanghoon Lee | c8d2316 | 2018-01-12 16:19:10 +0000 | [diff] [blame] | 396 | { DataType::U8, DataType::S16 })), |
| 397 | datasets::BorderModes()), |
| 398 | framework::dataset::make("filter_width", { 3, 5, 7, 9 })), |
| 399 | framework::dataset::make("filter_height", { 3, 5, 7, 9 })), |
| 400 | shape, output_data_type, border_mode, filter_width, filter_height) |
Sanghoon Lee | d7ba539 | 2017-12-13 11:28:50 +0000 | [diff] [blame] | 401 | { |
| 402 | // Create tensors |
Sanghoon Lee | c8d2316 | 2018-01-12 16:19:10 +0000 | [diff] [blame] | 403 | Tensor src = create_tensor<Tensor>(shape, DataType::U8); |
| 404 | Tensor dst = create_tensor<Tensor>(shape, output_data_type); |
Sanghoon Lee | d7ba539 | 2017-12-13 11:28:50 +0000 | [diff] [blame] | 405 | |
| 406 | // Create conv matrix |
Michalis Spyrou | 5ae9b69 | 2018-02-05 14:59:54 +0000 | [diff] [blame] | 407 | std::vector<int16_t> conv(filter_height * filter_width); |
Sanghoon Lee | d7ba539 | 2017-12-13 11:28:50 +0000 | [diff] [blame] | 408 | |
| 409 | ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 410 | ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 411 | |
| 412 | // Create and configure function |
| 413 | NEConvolutionRectangle convolution; |
Michalis Spyrou | 5ae9b69 | 2018-02-05 14:59:54 +0000 | [diff] [blame] | 414 | convolution.configure(&src, &dst, conv.data(), filter_width, filter_height, 1, border_mode); |
Sanghoon Lee | d7ba539 | 2017-12-13 11:28:50 +0000 | [diff] [blame] | 415 | |
| 416 | // Validate valid region |
| 417 | const ValidRegion dst_valid_region = shape_to_valid_region(shape, (border_mode == BorderMode::UNDEFINED), BorderSize(filter_height / 2, filter_width / 2)); |
| 418 | validate(dst.info()->valid_region(), dst_valid_region); |
| 419 | |
| 420 | // Validate padding |
| 421 | PaddingCalculator calculator(shape.x(), 8); |
| 422 | calculator.set_border_size(filter_width / 2); |
| 423 | calculator.set_border_mode(border_mode); |
| 424 | |
| 425 | const PaddingSize dst_padding = calculator.required_padding(); |
| 426 | |
| 427 | calculator.set_accessed_elements(16); |
| 428 | calculator.set_access_offset(-(filter_width / 2)); |
| 429 | |
| 430 | const PaddingSize width_padding = calculator.required_padding(); |
| 431 | |
| 432 | calculator.set_border_size(filter_height / 2); |
| 433 | calculator.set_access_offset(-(filter_height / 2)); |
| 434 | const PaddingSize height_padding = calculator.required_padding(); |
| 435 | |
| 436 | validate(src.info()->padding(), width_padding, height_padding); |
| 437 | validate(dst.info()->padding(), dst_padding); |
| 438 | } |
| 439 | |
| 440 | template <typename T> |
| 441 | using NEConvolutionFixture = ConvolutionRectangleValidationFixture<Tensor, Accessor, NEConvolutionRectangle, T>; |
| 442 | |
Sanghoon Lee | c0079e9 | 2018-01-29 17:28:49 +0000 | [diff] [blame] | 443 | TEST_SUITE(U8) |
Sanghoon Lee | d7ba539 | 2017-12-13 11:28:50 +0000 | [diff] [blame] | 444 | FIXTURE_DATA_TEST_CASE(RunSmall, NEConvolutionFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType", |
| 445 | DataType::U8)), |
| 446 | datasets::BorderModes()), |
| 447 | framework::dataset::make("filter_width", { 3, 5, 7, 9 })), |
| 448 | framework::dataset::make("filter_height", { 3, 5, 7, 9 }))) |
| 449 | { |
| 450 | // Validate output |
| 451 | validate(Accessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)), tolerance_u8); |
| 452 | } |
| 453 | |
| 454 | FIXTURE_DATA_TEST_CASE(RunLarge, NEConvolutionFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType", |
| 455 | DataType::U8)), |
| 456 | datasets::BorderModes()), |
| 457 | framework::dataset::make("filter_width", { 3, 5, 7, 9 })), |
| 458 | framework::dataset::make("filter_height", { 3, 5, 7, 9 }))) |
| 459 | { |
| 460 | // Validate output |
| 461 | validate(Accessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)), tolerance_u8); |
| 462 | } |
| 463 | TEST_SUITE_END() |
Sanghoon Lee | c8d2316 | 2018-01-12 16:19:10 +0000 | [diff] [blame] | 464 | |
Sanghoon Lee | c0079e9 | 2018-01-29 17:28:49 +0000 | [diff] [blame] | 465 | TEST_SUITE(S16) |
Sanghoon Lee | c8d2316 | 2018-01-12 16:19:10 +0000 | [diff] [blame] | 466 | FIXTURE_DATA_TEST_CASE(RunSmall, NEConvolutionFixture<int16_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType", |
| 467 | DataType::S16)), |
| 468 | datasets::BorderModes()), |
| 469 | framework::dataset::make("filter_width", { 3, 5, 7, 9 })), |
| 470 | framework::dataset::make("filter_height", { 3, 5, 7, 9 }))) |
| 471 | { |
| 472 | // Validate output |
| 473 | validate(Accessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)), tolerance_s16); |
| 474 | } |
| 475 | |
| 476 | FIXTURE_DATA_TEST_CASE(RunLarge, NEConvolutionFixture<int16_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType", |
| 477 | DataType::S16)), |
| 478 | datasets::BorderModes()), |
| 479 | framework::dataset::make("filter_width", { 3, 5, 7, 9 })), |
| 480 | framework::dataset::make("filter_height", { 3, 5, 7, 9 }))) |
| 481 | { |
| 482 | // Validate output |
| 483 | validate(Accessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)), tolerance_s16); |
| 484 | } |
Sanghoon Lee | c8a85ba | 2017-11-29 11:23:14 +0000 | [diff] [blame] | 485 | TEST_SUITE_END() |
Sanghoon Lee | c0079e9 | 2018-01-29 17:28:49 +0000 | [diff] [blame] | 486 | TEST_SUITE_END() /* Rectangle */ |
Sanghoon Lee | c8d2316 | 2018-01-12 16:19:10 +0000 | [diff] [blame] | 487 | |
Sanghoon Lee | c0079e9 | 2018-01-29 17:28:49 +0000 | [diff] [blame] | 488 | TEST_SUITE(Separable5x5) |
Sanghoon Lee | c8d2316 | 2018-01-12 16:19:10 +0000 | [diff] [blame] | 489 | template <typename T> |
| 490 | using NEConvolutionFixture = ConvolutionSeparableValidationFixture<Tensor, Accessor, NEConvolution5x5, T>; |
| 491 | |
Sanghoon Lee | c0079e9 | 2018-01-29 17:28:49 +0000 | [diff] [blame] | 492 | TEST_SUITE(U8) |
Sanghoon Lee | c8d2316 | 2018-01-12 16:19:10 +0000 | [diff] [blame] | 493 | FIXTURE_DATA_TEST_CASE(RunSmall, NEConvolutionFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType", |
| 494 | DataType::U8)), |
| 495 | datasets::BorderModes()), |
| 496 | framework::dataset::make("filter_size", { 5 }))) |
| 497 | { |
| 498 | // Validate output |
| 499 | validate(Accessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)), tolerance_u8); |
| 500 | } |
| 501 | |
| 502 | FIXTURE_DATA_TEST_CASE(RunLarge, NEConvolutionFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType", |
| 503 | DataType::U8)), |
| 504 | datasets::BorderModes()), |
| 505 | framework::dataset::make("filter_size", { 5 }))) |
| 506 | { |
| 507 | // Validate output |
| 508 | validate(Accessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)), tolerance_u8); |
| 509 | } |
| 510 | TEST_SUITE_END() |
| 511 | |
Sanghoon Lee | c0079e9 | 2018-01-29 17:28:49 +0000 | [diff] [blame] | 512 | TEST_SUITE(S16) |
Sanghoon Lee | c8d2316 | 2018-01-12 16:19:10 +0000 | [diff] [blame] | 513 | FIXTURE_DATA_TEST_CASE(RunSmall, NEConvolutionFixture<int16_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType", |
| 514 | DataType::S16)), |
| 515 | datasets::BorderModes()), |
| 516 | framework::dataset::make("filter_size", { 5 }))) |
| 517 | { |
| 518 | // Validate output |
| 519 | validate(Accessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)), tolerance_s16); |
| 520 | } |
| 521 | |
| 522 | FIXTURE_DATA_TEST_CASE(RunLarge, NEConvolutionFixture<int16_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType", |
| 523 | DataType::S16)), |
| 524 | datasets::BorderModes()), |
| 525 | framework::dataset::make("filter_size", { 5 }))) |
| 526 | { |
| 527 | // Validate output |
| 528 | validate(Accessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)), tolerance_s16); |
| 529 | } |
| 530 | TEST_SUITE_END() |
Sanghoon Lee | c0079e9 | 2018-01-29 17:28:49 +0000 | [diff] [blame] | 531 | TEST_SUITE_END() /* Separable5x5 */ |
Sanghoon Lee | c8d2316 | 2018-01-12 16:19:10 +0000 | [diff] [blame] | 532 | |
Sanghoon Lee | c0079e9 | 2018-01-29 17:28:49 +0000 | [diff] [blame] | 533 | TEST_SUITE(Separable7x7) |
Sanghoon Lee | c8d2316 | 2018-01-12 16:19:10 +0000 | [diff] [blame] | 534 | template <typename T> |
| 535 | using NEConvolutionFixture = ConvolutionSeparableValidationFixture<Tensor, Accessor, NEConvolution7x7, T>; |
| 536 | |
Sanghoon Lee | c0079e9 | 2018-01-29 17:28:49 +0000 | [diff] [blame] | 537 | TEST_SUITE(U8) |
Sanghoon Lee | c8d2316 | 2018-01-12 16:19:10 +0000 | [diff] [blame] | 538 | FIXTURE_DATA_TEST_CASE(RunSmall, NEConvolutionFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType", |
| 539 | DataType::U8)), |
| 540 | datasets::BorderModes()), |
| 541 | framework::dataset::make("filter_size", { 7 }))) |
| 542 | { |
| 543 | // Validate output |
| 544 | validate(Accessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)), tolerance_u8); |
| 545 | } |
| 546 | |
| 547 | FIXTURE_DATA_TEST_CASE(RunLarge, NEConvolutionFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType", |
| 548 | DataType::U8)), |
| 549 | datasets::BorderModes()), |
| 550 | framework::dataset::make("filter_size", { 7 }))) |
| 551 | { |
| 552 | // Validate output |
| 553 | validate(Accessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)), tolerance_u8); |
| 554 | } |
| 555 | TEST_SUITE_END() |
| 556 | |
Sanghoon Lee | c0079e9 | 2018-01-29 17:28:49 +0000 | [diff] [blame] | 557 | TEST_SUITE(S16) |
Sanghoon Lee | c8d2316 | 2018-01-12 16:19:10 +0000 | [diff] [blame] | 558 | FIXTURE_DATA_TEST_CASE(RunSmall, NEConvolutionFixture<int16_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType", |
| 559 | DataType::S16)), |
| 560 | datasets::BorderModes()), |
| 561 | framework::dataset::make("filter_size", { 7 }))) |
| 562 | { |
| 563 | // Validate output |
| 564 | validate(Accessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)), tolerance_s16); |
| 565 | } |
| 566 | |
| 567 | FIXTURE_DATA_TEST_CASE(RunLarge, NEConvolutionFixture<int16_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType", |
| 568 | DataType::S16)), |
| 569 | datasets::BorderModes()), |
| 570 | framework::dataset::make("filter_size", { 7 }))) |
| 571 | { |
| 572 | // Validate output |
| 573 | validate(Accessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)), tolerance_s16); |
| 574 | } |
| 575 | TEST_SUITE_END() |
Sanghoon Lee | c0079e9 | 2018-01-29 17:28:49 +0000 | [diff] [blame] | 576 | TEST_SUITE_END() /* Separable7x7 */ |
Sanghoon Lee | c8d2316 | 2018-01-12 16:19:10 +0000 | [diff] [blame] | 577 | |
Sanghoon Lee | c0079e9 | 2018-01-29 17:28:49 +0000 | [diff] [blame] | 578 | TEST_SUITE(Separable9x9) |
Sanghoon Lee | c8d2316 | 2018-01-12 16:19:10 +0000 | [diff] [blame] | 579 | template <typename T> |
| 580 | using NEConvolutionFixture = ConvolutionSeparableValidationFixture<Tensor, Accessor, NEConvolution9x9, T>; |
| 581 | |
Sanghoon Lee | c0079e9 | 2018-01-29 17:28:49 +0000 | [diff] [blame] | 582 | TEST_SUITE(U8) |
Sanghoon Lee | c8d2316 | 2018-01-12 16:19:10 +0000 | [diff] [blame] | 583 | FIXTURE_DATA_TEST_CASE(RunSmall, NEConvolutionFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType", |
| 584 | DataType::U8)), |
| 585 | datasets::BorderModes()), |
| 586 | framework::dataset::make("filter_size", { 9 }))) |
| 587 | { |
| 588 | // Validate output |
| 589 | validate(Accessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)), tolerance_u8); |
| 590 | } |
| 591 | |
| 592 | FIXTURE_DATA_TEST_CASE(RunLarge, NEConvolutionFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType", |
| 593 | DataType::U8)), |
| 594 | datasets::BorderModes()), |
| 595 | framework::dataset::make("filter_size", { 9 }))) |
| 596 | { |
| 597 | // Validate output |
| 598 | validate(Accessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)), tolerance_u8); |
| 599 | } |
| 600 | TEST_SUITE_END() |
| 601 | |
Sanghoon Lee | c0079e9 | 2018-01-29 17:28:49 +0000 | [diff] [blame] | 602 | TEST_SUITE(S16) |
Sanghoon Lee | c8d2316 | 2018-01-12 16:19:10 +0000 | [diff] [blame] | 603 | FIXTURE_DATA_TEST_CASE(RunSmall, NEConvolutionFixture<int16_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType", |
| 604 | DataType::S16)), |
| 605 | datasets::BorderModes()), |
| 606 | framework::dataset::make("filter_size", { 9 }))) |
| 607 | { |
| 608 | // Validate output |
| 609 | validate(Accessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)), tolerance_s16); |
| 610 | } |
| 611 | |
| 612 | FIXTURE_DATA_TEST_CASE(RunLarge, NEConvolutionFixture<int16_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType", |
| 613 | DataType::S16)), |
| 614 | datasets::BorderModes()), |
| 615 | framework::dataset::make("filter_size", { 9 }))) |
| 616 | { |
| 617 | // Validate output |
| 618 | validate(Accessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(_height / 2, _width / 2)), tolerance_s16); |
| 619 | } |
| 620 | TEST_SUITE_END() |
Sanghoon Lee | c0079e9 | 2018-01-29 17:28:49 +0000 | [diff] [blame] | 621 | TEST_SUITE_END() /* Separable9x9 */ |
| 622 | |
Sanghoon Lee | c8d2316 | 2018-01-12 16:19:10 +0000 | [diff] [blame] | 623 | TEST_SUITE_END() /* Custom Convolution */ |
Sanghoon Lee | c8a85ba | 2017-11-29 11:23:14 +0000 | [diff] [blame] | 624 | TEST_SUITE_END() |
| 625 | } // namespace validation |
| 626 | } // namespace test |
| 627 | } // namespace arm_compute |