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