Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 1 | /* |
Georgios Pinitas | c7b183a | 2020-03-06 18:12:09 +0000 | [diff] [blame] | 2 | * Copyright (c) 2017-2020 ARM Limited. |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +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, |
| 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/NEConvolutionLayer.h" |
Isabella Gottardi | 6acc6ad | 2018-02-02 17:19:18 +0000 | [diff] [blame] | 26 | #include "arm_compute/runtime/NEON/functions/NEGEMMConvolutionLayer.h" |
Georgios Pinitas | 9fb1159 | 2018-04-26 20:34:58 +0100 | [diff] [blame] | 27 | #include "arm_compute/runtime/NEON/functions/NEWinogradConvolutionLayer.h" |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 28 | #include "arm_compute/runtime/Tensor.h" |
| 29 | #include "arm_compute/runtime/TensorAllocator.h" |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 30 | #include "tests/NEON/Accessor.h" |
| 31 | #include "tests/PaddingCalculator.h" |
Moritz Pflanzer | a09de0c | 2017-09-01 20:41:12 +0100 | [diff] [blame] | 32 | #include "tests/datasets/LargeConvolutionLayerDataset.h" |
| 33 | #include "tests/datasets/SmallConvolutionLayerDataset.h" |
Anthony Barbier | 1c0d0ff | 2018-01-31 13:05:09 +0000 | [diff] [blame] | 34 | #include "tests/datasets/TinyConvolutionLayerDataset.h" |
Moritz Pflanzer | a09de0c | 2017-09-01 20:41:12 +0100 | [diff] [blame] | 35 | #include "tests/framework/Asserts.h" |
| 36 | #include "tests/framework/Macros.h" |
| 37 | #include "tests/framework/datasets/Datasets.h" |
| 38 | #include "tests/validation/Validation.h" |
| 39 | #include "tests/validation/fixtures/ConvolutionLayerFixture.h" |
Georgios Pinitas | 9fb1159 | 2018-04-26 20:34:58 +0100 | [diff] [blame] | 40 | #include "tests/validation/fixtures/WinogradConvolutionLayerFixture.h" |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 41 | |
| 42 | namespace arm_compute |
| 43 | { |
| 44 | namespace test |
| 45 | { |
| 46 | namespace validation |
| 47 | { |
| 48 | namespace |
| 49 | { |
Pablo Tello | af7e600 | 2018-10-08 15:53:14 +0100 | [diff] [blame] | 50 | const RelativeTolerance<float> rel_tolerance_f32(0.01f); /**< Relative tolerance for FP32 types */ |
| 51 | const RelativeTolerance<float> rel_tolerance_winograd_3x3_f32(0.05f); /**< Relative tolerance for FP32 types */ |
| 52 | const AbsoluteTolerance<float> abs_tolerance_f32(0.002f); /**< Absolute tolerance for FP32 types */ |
| 53 | const AbsoluteTolerance<float> abs_tolerance_1xN_f32(0.0041f); /**< Absolute tolerance for FP32 types */ |
Pablo Tello | 952aeb1 | 2018-09-12 09:47:25 +0100 | [diff] [blame] | 54 | |
Ioan-Cristian Szabo | 5edbd1c | 2017-11-13 13:34:08 +0000 | [diff] [blame] | 55 | #ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC |
Gian Marco Iodice | 41acb76 | 2018-08-23 10:25:06 +0100 | [diff] [blame] | 56 | const RelativeTolerance<half_float::half> rel_tolerance_f16(half_float::half(0.2f)); /**< Relative tolerance value for FP16 types */ |
| 57 | const AbsoluteTolerance<float> abs_tolerance_f16(0.2f); /**< Absolute tolerance for FP16 types */ |
| 58 | constexpr float tolerance_num = 0.07f; /**< Tolerance number for the FP16 implementation */ |
| 59 | #endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */ |
| 60 | constexpr AbsoluteTolerance<float> tolerance_qasymm8(0.0); /**< Tolerance value for comparing reference's output against implementation's output for quantized data types */ |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 61 | |
| 62 | /** CNN data types */ |
| 63 | const auto CNNDataTypes = framework::dataset::make("DataType", |
| 64 | { |
Ioan-Cristian Szabo | 5edbd1c | 2017-11-13 13:34:08 +0000 | [diff] [blame] | 65 | #ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 66 | DataType::F16, |
Ioan-Cristian Szabo | 5edbd1c | 2017-11-13 13:34:08 +0000 | [diff] [blame] | 67 | #endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */ |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 68 | DataType::F32, |
Isabella Gottardi | e6630e4 | 2018-01-18 15:50:39 +0000 | [diff] [blame] | 69 | DataType::QASYMM8, |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 70 | }); |
Isabella Gottardi | 3f217ec | 2018-02-12 14:59:19 +0000 | [diff] [blame] | 71 | const auto ActivationFunctionsDataset = framework::dataset::make("ActivationInfo", |
| 72 | { |
| 73 | ActivationLayerInfo(), |
| 74 | ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU), |
| 75 | ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::BOUNDED_RELU, 0.5f) |
| 76 | }); |
Georgios Pinitas | dbdea0d | 2019-10-16 19:21:40 +0100 | [diff] [blame] | 77 | |
| 78 | const auto QuantizationData = framework::dataset::make("QuantizationInfo", |
| 79 | { |
| 80 | QuantizationInfo(0.5f, 10), |
| 81 | QuantizationInfo(0.3f, 3), |
| 82 | QuantizationInfo(1.f, 10), |
Michele Di Giorgio | f29d1b7 | 2019-10-29 10:58:13 +0000 | [diff] [blame] | 83 | QuantizationInfo(1.1f, 10), |
Georgios Pinitas | dbdea0d | 2019-10-16 19:21:40 +0100 | [diff] [blame] | 84 | }); |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 85 | } // namespace |
| 86 | |
| 87 | TEST_SUITE(NEON) |
Isabella Gottardi | 6acc6ad | 2018-02-02 17:19:18 +0000 | [diff] [blame] | 88 | TEST_SUITE(ConvolutionLayer) |
Michalis Spyrou | aeebe4a | 2019-01-09 14:21:03 +0000 | [diff] [blame] | 89 | |
| 90 | // *INDENT-OFF* |
| 91 | // clang-format off |
Giorgio Arena | a3221e6 | 2018-05-03 15:57:48 +0100 | [diff] [blame] | 92 | DATA_TEST_CASE(ValidateConvolutionMethod, framework::DatasetMode::ALL, zip(zip(zip(zip(zip( |
Michalis Spyrou | aeebe4a | 2019-01-09 14:21:03 +0000 | [diff] [blame] | 93 | framework::dataset::make("InputInfo", { TensorInfo(TensorShape(18U, 18U, 32U), 1, DataType::F32), |
| 94 | TensorInfo(TensorShape(23U, 27U, 32U, 4U), 1, DataType::F32), |
| 95 | TensorInfo(TensorShape(3U, 3U, 2U, 1U), 1, DataType::F32), |
| 96 | TensorInfo(TensorShape(33U, 27U, 7U, 4U), 1, DataType::F32) |
| 97 | }), |
| 98 | framework::dataset::make("WeightsInfo", { TensorInfo(TensorShape(3U, 3U, 32U, 21U), 1, DataType::F32), |
| 99 | TensorInfo(TensorShape(5U, 5U, 32U, 21U), 1, DataType::F32), |
| 100 | TensorInfo(TensorShape(3U, 3U, 5U, 21U), 1, DataType::F32), |
| 101 | TensorInfo(TensorShape(5U, 5U, 7U, 16U), 1, DataType::F16) |
| 102 | })), |
| 103 | framework::dataset::make("OutputInfo", { TensorInfo(TensorShape(16U, 16U, 21U), 1, DataType::F32), |
| 104 | TensorInfo(TensorShape(19U, 23U, 21U, 4U), 1, DataType::F32), |
| 105 | TensorInfo(TensorShape(11U, 25U, 21U), 1, DataType::F32), |
| 106 | TensorInfo(TensorShape(11U, 12U, 16U, 4U), 1, DataType::F32) |
| 107 | })), |
| 108 | framework::dataset::make("ConvInfo", { PadStrideInfo(1, 1, 0, 0), |
| 109 | PadStrideInfo(1, 1, 0, 0), |
| 110 | PadStrideInfo(2, 1, 0, 0), |
| 111 | PadStrideInfo(3, 2, 1, 0) |
| 112 | })), |
| 113 | framework::dataset::make("FastMath", { true, |
| 114 | true, |
| 115 | false, |
| 116 | false |
| 117 | })), |
Giorgio Arena | a3221e6 | 2018-05-03 15:57:48 +0100 | [diff] [blame] | 118 | framework::dataset::make("Expected", { ConvolutionMethod::WINOGRAD, ConvolutionMethod::WINOGRAD, ConvolutionMethod::GEMM, ConvolutionMethod::GEMM })), |
| 119 | input_info, weights_info, output_info, conv_info, fast_math, expected) |
Isabella Gottardi | 6acc6ad | 2018-02-02 17:19:18 +0000 | [diff] [blame] | 120 | { |
Giorgio Arena | a3221e6 | 2018-05-03 15:57:48 +0100 | [diff] [blame] | 121 | ConvolutionMethod is_valid = NEConvolutionLayer::get_convolution_method(&input_info.clone()->set_is_resizable(true), |
| 122 | &weights_info.clone()->set_is_resizable(true), |
| 123 | &output_info.clone()->set_is_resizable(true), conv_info, WeightsInfo(), Size2D(1U, 1U), ActivationLayerInfo(), fast_math); |
Isabella Gottardi | 6acc6ad | 2018-02-02 17:19:18 +0000 | [diff] [blame] | 124 | ARM_COMPUTE_EXPECT(is_valid == expected, framework::LogLevel::ERRORS); |
| 125 | } |
Michalis Spyrou | aeebe4a | 2019-01-09 14:21:03 +0000 | [diff] [blame] | 126 | // clang-format on |
| 127 | // *INDENT-ON* |
| 128 | TEST_SUITE_END() // ConvolutionLayer |
Isabella Gottardi | 6acc6ad | 2018-02-02 17:19:18 +0000 | [diff] [blame] | 129 | |
Pablo Tello | 8951933 | 2017-11-17 11:52:36 +0000 | [diff] [blame] | 130 | TEST_SUITE(WinogradLayer) |
| 131 | template <typename T> |
Giorgio Arena | a3221e6 | 2018-05-03 15:57:48 +0100 | [diff] [blame] | 132 | using NEWinogradConvolutionLayerFixture = WinogradConvolutionLayerFastMathValidationFixture<Tensor, Accessor, NEWinogradConvolutionLayer, T>; |
Pablo Tello | 8951933 | 2017-11-17 11:52:36 +0000 | [diff] [blame] | 133 | |
Andrew Mundy | 4d9379a | 2018-03-15 16:47:03 +0000 | [diff] [blame] | 134 | template <typename T> |
Vidhya Sudhan Loganathan | a25d16c | 2018-11-16 11:33:12 +0000 | [diff] [blame] | 135 | using NEWinogradConvolutionLayerNoBiasFixture = WinogradConvolutionLayerFastMathValidationFixture<Tensor, Accessor, NEWinogradConvolutionLayer, T, T, false>; |
Andrew Mundy | 4d9379a | 2018-03-15 16:47:03 +0000 | [diff] [blame] | 136 | |
Pablo Tello | 8951933 | 2017-11-17 11:52:36 +0000 | [diff] [blame] | 137 | TEST_SUITE(FP32) |
Pablo Tello | 7282d56 | 2018-06-14 15:35:49 +0100 | [diff] [blame] | 138 | |
Pablo Tello | bda6e4b | 2018-08-22 11:40:33 +0100 | [diff] [blame] | 139 | TEST_SUITE(Conv1x3) |
Isabella Gottardi | 3f217ec | 2018-02-12 14:59:19 +0000 | [diff] [blame] | 140 | FIXTURE_DATA_TEST_CASE(RunSmall, NEWinogradConvolutionLayerFixture<float>, framework::DatasetMode::PRECOMMIT, |
Pablo Tello | bda6e4b | 2018-08-22 11:40:33 +0100 | [diff] [blame] | 141 | combine(combine(combine(datasets::SmallWinogradConvolutionLayer1x3Dataset(), |
| 142 | framework::dataset::make("DataType", { DataType::F32 })), |
| 143 | ActivationFunctionsDataset), |
| 144 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
| 145 | { |
| 146 | // Validate output |
| 147 | validate(Accessor(_target), _reference, abs_tolerance_f32); |
| 148 | } |
| 149 | FIXTURE_DATA_TEST_CASE(RunLarge, NEWinogradConvolutionLayerFixture<float>, framework::DatasetMode::NIGHTLY, |
| 150 | combine(combine(combine(datasets::LargeWinogradConvolutionLayer1x3Dataset(), |
| 151 | framework::dataset::make("DataType", { DataType::F32 })), |
| 152 | ActivationFunctionsDataset), |
| 153 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
| 154 | { |
| 155 | // Validate output |
Pablo Tello | 952aeb1 | 2018-09-12 09:47:25 +0100 | [diff] [blame] | 156 | validate(Accessor(_target), _reference, abs_tolerance_1xN_f32); |
Pablo Tello | bda6e4b | 2018-08-22 11:40:33 +0100 | [diff] [blame] | 157 | } |
| 158 | |
| 159 | TEST_SUITE_END() // Conv1x3 |
| 160 | |
| 161 | TEST_SUITE(Conv3x1) |
| 162 | FIXTURE_DATA_TEST_CASE(RunSmall, NEWinogradConvolutionLayerFixture<float>, framework::DatasetMode::PRECOMMIT, |
| 163 | combine(combine(combine(datasets::SmallWinogradConvolutionLayer3x1Dataset(), |
| 164 | framework::dataset::make("DataType", { DataType::F32 })), |
| 165 | ActivationFunctionsDataset), |
| 166 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
| 167 | { |
| 168 | // Validate output |
| 169 | validate(Accessor(_target), _reference, abs_tolerance_f32); |
| 170 | } |
| 171 | FIXTURE_DATA_TEST_CASE(RunLarge, NEWinogradConvolutionLayerFixture<float>, framework::DatasetMode::NIGHTLY, |
| 172 | combine(combine(combine(datasets::LargeWinogradConvolutionLayer3x1Dataset(), |
| 173 | framework::dataset::make("DataType", { DataType::F32 })), |
| 174 | ActivationFunctionsDataset), |
| 175 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
| 176 | { |
| 177 | // Validate output |
Pablo Tello | 952aeb1 | 2018-09-12 09:47:25 +0100 | [diff] [blame] | 178 | validate(Accessor(_target), _reference, abs_tolerance_1xN_f32); |
Pablo Tello | bda6e4b | 2018-08-22 11:40:33 +0100 | [diff] [blame] | 179 | } |
| 180 | |
| 181 | TEST_SUITE_END() // Conv3x1 |
| 182 | |
Pablo Tello | 000d33a | 2018-09-03 16:59:20 +0100 | [diff] [blame] | 183 | TEST_SUITE(Conv1x5) |
| 184 | FIXTURE_DATA_TEST_CASE(RunSmall, NEWinogradConvolutionLayerFixture<float>, framework::DatasetMode::PRECOMMIT, |
| 185 | combine(combine(combine(datasets::SmallWinogradConvolutionLayer1x5Dataset(), |
| 186 | framework::dataset::make("DataType", { DataType::F32 })), |
| 187 | ActivationFunctionsDataset), |
| 188 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
| 189 | { |
| 190 | // Validate output |
| 191 | validate(Accessor(_target), _reference, abs_tolerance_f32); |
| 192 | } |
| 193 | FIXTURE_DATA_TEST_CASE(RunLarge, NEWinogradConvolutionLayerFixture<float>, framework::DatasetMode::NIGHTLY, |
| 194 | combine(combine(combine(datasets::LargeWinogradConvolutionLayer1x5Dataset(), |
| 195 | framework::dataset::make("DataType", { DataType::F32 })), |
| 196 | ActivationFunctionsDataset), |
| 197 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
| 198 | { |
| 199 | // Validate output |
Pablo Tello | 952aeb1 | 2018-09-12 09:47:25 +0100 | [diff] [blame] | 200 | validate(Accessor(_target), _reference, abs_tolerance_1xN_f32); |
Pablo Tello | 000d33a | 2018-09-03 16:59:20 +0100 | [diff] [blame] | 201 | } |
| 202 | |
| 203 | TEST_SUITE_END() // Conv1x5 |
| 204 | |
| 205 | TEST_SUITE(Conv5x1) |
| 206 | FIXTURE_DATA_TEST_CASE(RunSmall, NEWinogradConvolutionLayerFixture<float>, framework::DatasetMode::PRECOMMIT, |
| 207 | combine(combine(combine(datasets::SmallWinogradConvolutionLayer5x1Dataset(), |
| 208 | framework::dataset::make("DataType", { DataType::F32 })), |
| 209 | ActivationFunctionsDataset), |
| 210 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
| 211 | { |
| 212 | // Validate output |
| 213 | validate(Accessor(_target), _reference, abs_tolerance_f32); |
| 214 | } |
| 215 | FIXTURE_DATA_TEST_CASE(RunLarge, NEWinogradConvolutionLayerFixture<float>, framework::DatasetMode::NIGHTLY, |
| 216 | combine(combine(combine(datasets::LargeWinogradConvolutionLayer5x1Dataset(), |
| 217 | framework::dataset::make("DataType", { DataType::F32 })), |
| 218 | ActivationFunctionsDataset), |
| 219 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
| 220 | { |
| 221 | // Validate output |
Pablo Tello | 952aeb1 | 2018-09-12 09:47:25 +0100 | [diff] [blame] | 222 | validate(Accessor(_target), _reference, abs_tolerance_1xN_f32); |
Pablo Tello | 000d33a | 2018-09-03 16:59:20 +0100 | [diff] [blame] | 223 | } |
| 224 | |
| 225 | TEST_SUITE_END() // Conv5x1 |
| 226 | |
Pablo Tello | 96e922e | 2018-09-26 11:25:15 +0100 | [diff] [blame] | 227 | TEST_SUITE(Conv7x1) |
| 228 | FIXTURE_DATA_TEST_CASE(RunSmall, NEWinogradConvolutionLayerFixture<float>, framework::DatasetMode::PRECOMMIT, |
| 229 | combine(combine(combine(datasets::SmallWinogradConvolutionLayer7x1Dataset(), |
| 230 | framework::dataset::make("DataType", { DataType::F32 })), |
| 231 | ActivationFunctionsDataset), |
| 232 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
| 233 | { |
| 234 | // Validate output |
| 235 | validate(Accessor(_target), _reference, abs_tolerance_f32); |
| 236 | } |
| 237 | |
| 238 | FIXTURE_DATA_TEST_CASE(RunLarge, NEWinogradConvolutionLayerFixture<float>, framework::DatasetMode::NIGHTLY, |
| 239 | combine(combine(combine(datasets::LargeWinogradConvolutionLayer7x1Dataset(), |
| 240 | framework::dataset::make("DataType", { DataType::F32 })), |
| 241 | ActivationFunctionsDataset), |
| 242 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
| 243 | { |
| 244 | // Validate output |
| 245 | validate(Accessor(_target), _reference, abs_tolerance_1xN_f32); |
| 246 | } |
| 247 | TEST_SUITE_END() // Conv7x1 |
| 248 | |
| 249 | TEST_SUITE(Conv1x7) |
| 250 | FIXTURE_DATA_TEST_CASE(RunSmall, NEWinogradConvolutionLayerFixture<float>, framework::DatasetMode::PRECOMMIT, |
| 251 | combine(combine(combine(datasets::SmallWinogradConvolutionLayer1x7Dataset(), |
| 252 | framework::dataset::make("DataType", { DataType::F32 })), |
| 253 | ActivationFunctionsDataset), |
| 254 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
| 255 | { |
| 256 | // Validate output |
| 257 | validate(Accessor(_target), _reference, abs_tolerance_f32); |
| 258 | } |
| 259 | |
| 260 | FIXTURE_DATA_TEST_CASE(RunLarge, NEWinogradConvolutionLayerFixture<float>, framework::DatasetMode::NIGHTLY, |
| 261 | combine(combine(combine(datasets::LargeWinogradConvolutionLayer7x1Dataset(), |
| 262 | framework::dataset::make("DataType", { DataType::F32 })), |
| 263 | ActivationFunctionsDataset), |
| 264 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
| 265 | { |
| 266 | // Validate output |
| 267 | validate(Accessor(_target), _reference, abs_tolerance_1xN_f32); |
| 268 | } |
| 269 | TEST_SUITE_END() // Conv1x7 |
| 270 | |
Pablo Tello | bda6e4b | 2018-08-22 11:40:33 +0100 | [diff] [blame] | 271 | TEST_SUITE(Conv3x3) |
| 272 | FIXTURE_DATA_TEST_CASE(RunSmall, NEWinogradConvolutionLayerFixture<float>, framework::DatasetMode::PRECOMMIT, |
| 273 | combine(combine(combine(datasets::SmallWinogradConvolutionLayer3x3Dataset(), |
Pablo Tello | 7282d56 | 2018-06-14 15:35:49 +0100 | [diff] [blame] | 274 | framework::dataset::make("DataType", { DataType::F32 })), |
| 275 | ActivationFunctionsDataset), |
| 276 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
| 277 | |
Pablo Tello | 8951933 | 2017-11-17 11:52:36 +0000 | [diff] [blame] | 278 | { |
| 279 | // Validate output |
Georgios Pinitas | 8dea602 | 2018-06-08 18:33:31 +0100 | [diff] [blame] | 280 | validate(Accessor(_target), _reference, abs_tolerance_f32); |
Pablo Tello | 8951933 | 2017-11-17 11:52:36 +0000 | [diff] [blame] | 281 | } |
Pablo Tello | bda6e4b | 2018-08-22 11:40:33 +0100 | [diff] [blame] | 282 | FIXTURE_DATA_TEST_CASE(RunLarge, NEWinogradConvolutionLayerFixture<float>, framework::DatasetMode::NIGHTLY, |
| 283 | combine(combine(combine(datasets::LargeWinogradConvolutionLayer3x3Dataset(), |
| 284 | framework::dataset::make("DataType", { DataType::F32 })), |
| 285 | ActivationFunctionsDataset), |
| 286 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
| 287 | |
| 288 | { |
| 289 | // Validate output |
Pablo Tello | af7e600 | 2018-10-08 15:53:14 +0100 | [diff] [blame] | 290 | // floating point arithmetic the Winograd results will not be exactly the same as direct convolution, especially for big shapes |
| 291 | validate(Accessor(_target), _reference, rel_tolerance_winograd_3x3_f32, 0.f, float(abs_tolerance_f32)); |
Pablo Tello | bda6e4b | 2018-08-22 11:40:33 +0100 | [diff] [blame] | 292 | } |
| 293 | TEST_SUITE_END() // Conv3x3 |
| 294 | |
| 295 | TEST_SUITE(Conv5x5) |
| 296 | FIXTURE_DATA_TEST_CASE(RunSmall, NEWinogradConvolutionLayerFixture<float>, framework::DatasetMode::PRECOMMIT, |
| 297 | combine(combine(combine(datasets::SmallWinogradConvolutionLayer5x5Dataset(), |
| 298 | framework::dataset::make("DataType", { DataType::F32 })), |
| 299 | ActivationFunctionsDataset), |
| 300 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
| 301 | |
| 302 | { |
| 303 | // Validate output |
| 304 | validate(Accessor(_target), _reference, abs_tolerance_f32); |
| 305 | } |
| 306 | FIXTURE_DATA_TEST_CASE(RunLarge, NEWinogradConvolutionLayerFixture<float>, framework::DatasetMode::NIGHTLY, |
| 307 | combine(combine(combine(datasets::LargeWinogradConvolutionLayer5x5Dataset(), |
| 308 | framework::dataset::make("DataType", { DataType::F32 })), |
| 309 | ActivationFunctionsDataset), |
| 310 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
| 311 | |
| 312 | { |
| 313 | // Validate output |
| 314 | validate(Accessor(_target), _reference, abs_tolerance_f32); |
| 315 | } |
| 316 | |
| 317 | TEST_SUITE_END() // Conv5x5 |
Pablo Tello | 8951933 | 2017-11-17 11:52:36 +0000 | [diff] [blame] | 318 | |
Andrew Mundy | 4d9379a | 2018-03-15 16:47:03 +0000 | [diff] [blame] | 319 | FIXTURE_DATA_TEST_CASE(RunSmallNoBias, NEWinogradConvolutionLayerNoBiasFixture<float>, framework::DatasetMode::PRECOMMIT, |
Pablo Tello | 7282d56 | 2018-06-14 15:35:49 +0100 | [diff] [blame] | 320 | combine(combine(combine(framework::dataset::concat(datasets::SmallWinogradConvolutionLayer3x3Dataset(), |
| 321 | datasets::SmallWinogradConvolutionLayer5x5Dataset()), |
| 322 | framework::dataset::make("DataType", { DataType::F32 })), |
| 323 | ActivationFunctionsDataset), |
| 324 | |
| 325 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
Andrew Mundy | 4d9379a | 2018-03-15 16:47:03 +0000 | [diff] [blame] | 326 | { |
| 327 | // Validate output |
Georgios Pinitas | 8dea602 | 2018-06-08 18:33:31 +0100 | [diff] [blame] | 328 | validate(Accessor(_target), _reference, abs_tolerance_f32); |
Andrew Mundy | 4d9379a | 2018-03-15 16:47:03 +0000 | [diff] [blame] | 329 | } |
| 330 | |
Michalis Spyrou | aeebe4a | 2019-01-09 14:21:03 +0000 | [diff] [blame] | 331 | TEST_SUITE_END() // FP32 |
| 332 | TEST_SUITE_END() // WinogradLayer |
Pablo Tello | 8951933 | 2017-11-17 11:52:36 +0000 | [diff] [blame] | 333 | |
Isabella Gottardi | 6acc6ad | 2018-02-02 17:19:18 +0000 | [diff] [blame] | 334 | TEST_SUITE(GEMMConvolutionLayer) |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 335 | |
Michalis Spyrou | 5c9f0c4 | 2019-01-16 14:48:48 +0000 | [diff] [blame] | 336 | DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(datasets::SmallConvolutionLayerDataset(), |
Isabella Gottardi | 3f217ec | 2018-02-12 14:59:19 +0000 | [diff] [blame] | 337 | CNNDataTypes), |
| 338 | framework::dataset::make("ActivationInfo", |
| 339 | { ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU) })), |
| 340 | input_shape, weights_shape, bias_shape, output_shape, info, dilation, data_type, act_info) |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 341 | { |
Isabella Gottardi | e6630e4 | 2018-01-18 15:50:39 +0000 | [diff] [blame] | 342 | auto bias_data_type = is_data_type_quantized_asymmetric(data_type) ? DataType::S32 : data_type; |
| 343 | |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 344 | // Create tensors |
Vidhya Sudhan Loganathan | 014333d | 2018-07-02 09:13:49 +0100 | [diff] [blame] | 345 | Tensor src = create_tensor<Tensor>(input_shape, data_type, 1, QuantizationInfo(2.f / 255.f, 127)); |
| 346 | Tensor weights = create_tensor<Tensor>(weights_shape, data_type, 1, QuantizationInfo(2.f / 255.f, 127)); |
| 347 | Tensor bias = create_tensor<Tensor>(bias_shape, bias_data_type, 1, QuantizationInfo(2.f / 255.f, 127)); |
| 348 | Tensor dst = create_tensor<Tensor>(output_shape, data_type, 1, QuantizationInfo(2.f / 255.f, 127)); |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 349 | |
| 350 | ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 351 | ARM_COMPUTE_EXPECT(weights.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 352 | ARM_COMPUTE_EXPECT(bias.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 353 | ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 354 | |
Isabella Gottardi | e6630e4 | 2018-01-18 15:50:39 +0000 | [diff] [blame] | 355 | const QuantizationInfo src_quantization_info = src.info()->quantization_info(); |
| 356 | const QuantizationInfo weights_quantization_info = weights.info()->quantization_info(); |
| 357 | |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 358 | // Create and configure function |
Isabella Gottardi | 6acc6ad | 2018-02-02 17:19:18 +0000 | [diff] [blame] | 359 | NEGEMMConvolutionLayer conv; |
Isabella Gottardi | 3f217ec | 2018-02-12 14:59:19 +0000 | [diff] [blame] | 360 | conv.configure(&src, &weights, &bias, &dst, info, WeightsInfo(), dilation, act_info); |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 361 | |
| 362 | // Validate valid region |
| 363 | const ValidRegion src_valid_region = shape_to_valid_region(input_shape); |
| 364 | const ValidRegion weights_valid_region = shape_to_valid_region(weights_shape); |
| 365 | const ValidRegion bias_valid_region = shape_to_valid_region(bias_shape); |
| 366 | const ValidRegion dst_valid_region = shape_to_valid_region(output_shape); |
| 367 | |
| 368 | validate(src.info()->valid_region(), src_valid_region); |
| 369 | validate(weights.info()->valid_region(), weights_valid_region); |
| 370 | validate(bias.info()->valid_region(), bias_valid_region); |
| 371 | validate(dst.info()->valid_region(), dst_valid_region); |
| 372 | |
Isabella Gottardi | e6630e4 | 2018-01-18 15:50:39 +0000 | [diff] [blame] | 373 | // Validate QuantizationInfo |
| 374 | ARM_COMPUTE_EXPECT(src.info()->quantization_info() == src_quantization_info, framework::LogLevel::ERRORS); |
| 375 | ARM_COMPUTE_EXPECT(weights.info()->quantization_info() == weights_quantization_info, framework::LogLevel::ERRORS); |
| 376 | |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 377 | // Validate padding |
| 378 | //TODO(COMPMID-415) Need to validate padding? |
| 379 | } |
| 380 | |
| 381 | template <typename T> |
Anthony Barbier | c8e84b5 | 2018-07-17 16:48:42 +0100 | [diff] [blame] | 382 | using NEGEMMConvolutionLayerFixture = ConvolutionValidationFixture<Tensor, Accessor, NEGEMMConvolutionLayer, T>; |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 383 | |
| 384 | TEST_SUITE(Float) |
Georgios Pinitas | c7b183a | 2020-03-06 18:12:09 +0000 | [diff] [blame] | 385 | #if defined(__ARM_FEATURE_BF16_VECTOR_ARITHMETIC) || defined(ARM_COMPUTE_FORCE_BF16) |
| 386 | TEST_SUITE(BFLOAT16) |
| 387 | FIXTURE_DATA_TEST_CASE(RunSmall, NEGEMMConvolutionLayerFixture<float>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(combine(datasets::SmallConvolutionLayerDataset(), |
| 388 | framework::dataset::make("ReshapeWeights", { true })), |
| 389 | framework::dataset::make("DataType", DataType::BFLOAT16)), |
| 390 | framework::dataset::make("DataLayout", { DataLayout::NHWC })), |
| 391 | ActivationFunctionsDataset)) |
| 392 | { |
| 393 | // Validate output |
| 394 | validate(Accessor(_target), _reference, rel_tolerance_f32, 0.f, float(abs_tolerance_f32)); |
| 395 | } |
| 396 | TEST_SUITE_END() // BFLOAT16 |
| 397 | #endif /* defined(__ARM_FEATURE_BF16_VECTOR_ARITHMETIC) || defined(ARM_COMPUTE_FORCE_BF16) */ |
| 398 | |
Ioan-Cristian Szabo | 5edbd1c | 2017-11-13 13:34:08 +0000 | [diff] [blame] | 399 | #ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 400 | TEST_SUITE(FP16) |
Michalis Spyrou | e250389 | 2018-04-23 15:17:31 +0100 | [diff] [blame] | 401 | FIXTURE_DATA_TEST_CASE(RunSmall, NEGEMMConvolutionLayerFixture<half>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(combine(datasets::SmallConvolutionLayerDataset(), |
| 402 | framework::dataset::make("ReshapeWeights", { true })), |
Isabella Gottardi | 3f217ec | 2018-02-12 14:59:19 +0000 | [diff] [blame] | 403 | framework::dataset::make("DataType", DataType::F16)), |
Michalis Spyrou | e250389 | 2018-04-23 15:17:31 +0100 | [diff] [blame] | 404 | framework::dataset::make("DataLayout", { DataLayout::NCHW })), |
Isabella Gottardi | 3f217ec | 2018-02-12 14:59:19 +0000 | [diff] [blame] | 405 | ActivationFunctionsDataset)) |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 406 | { |
| 407 | // Validate output |
Gian Marco Iodice | 41acb76 | 2018-08-23 10:25:06 +0100 | [diff] [blame] | 408 | validate(Accessor(_target), _reference, rel_tolerance_f16, tolerance_num, abs_tolerance_f16); |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 409 | } |
Michalis Spyrou | e250389 | 2018-04-23 15:17:31 +0100 | [diff] [blame] | 410 | FIXTURE_DATA_TEST_CASE(RunLarge, NEGEMMConvolutionLayerFixture<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(datasets::LargeConvolutionLayerDataset(), |
| 411 | framework::dataset::make("ReshapeWeights", { true })), |
Isabella Gottardi | 3f217ec | 2018-02-12 14:59:19 +0000 | [diff] [blame] | 412 | framework::dataset::make("DataType", DataType::F16)), |
Michalis Spyrou | e250389 | 2018-04-23 15:17:31 +0100 | [diff] [blame] | 413 | framework::dataset::make("DataLayout", { DataLayout::NCHW })), |
Isabella Gottardi | 3f217ec | 2018-02-12 14:59:19 +0000 | [diff] [blame] | 414 | ActivationFunctionsDataset)) |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 415 | { |
| 416 | // Validate output |
Gian Marco Iodice | 41acb76 | 2018-08-23 10:25:06 +0100 | [diff] [blame] | 417 | validate(Accessor(_target), _reference, rel_tolerance_f16, tolerance_num, abs_tolerance_f16); |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 418 | } |
Michalis Spyrou | aeebe4a | 2019-01-09 14:21:03 +0000 | [diff] [blame] | 419 | TEST_SUITE_END() // FP16 |
| 420 | #endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */ |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 421 | |
| 422 | TEST_SUITE(FP32) |
Michalis Spyrou | e250389 | 2018-04-23 15:17:31 +0100 | [diff] [blame] | 423 | FIXTURE_DATA_TEST_CASE(RunSmall, NEGEMMConvolutionLayerFixture<float>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(combine(datasets::SmallConvolutionLayerDataset(), |
| 424 | framework::dataset::make("ReshapeWeights", { true })), |
Isabella Gottardi | 3f217ec | 2018-02-12 14:59:19 +0000 | [diff] [blame] | 425 | framework::dataset::make("DataType", DataType::F32)), |
Michalis Spyrou | e250389 | 2018-04-23 15:17:31 +0100 | [diff] [blame] | 426 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })), |
Isabella Gottardi | 3f217ec | 2018-02-12 14:59:19 +0000 | [diff] [blame] | 427 | ActivationFunctionsDataset)) |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 428 | { |
| 429 | // Validate output |
Georgios Pinitas | 8dea602 | 2018-06-08 18:33:31 +0100 | [diff] [blame] | 430 | validate(Accessor(_target), _reference, rel_tolerance_f32, 0.f, float(abs_tolerance_f32)); |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 431 | } |
Michalis Spyrou | e250389 | 2018-04-23 15:17:31 +0100 | [diff] [blame] | 432 | FIXTURE_DATA_TEST_CASE(RunLarge, NEGEMMConvolutionLayerFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(datasets::LargeConvolutionLayerDataset(), |
| 433 | framework::dataset::make("ReshapeWeights", { true })), |
Isabella Gottardi | 3f217ec | 2018-02-12 14:59:19 +0000 | [diff] [blame] | 434 | framework::dataset::make("DataType", DataType::F32)), |
Michalis Spyrou | e250389 | 2018-04-23 15:17:31 +0100 | [diff] [blame] | 435 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })), |
Isabella Gottardi | 3f217ec | 2018-02-12 14:59:19 +0000 | [diff] [blame] | 436 | ActivationFunctionsDataset)) |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 437 | { |
| 438 | // Validate output |
Georgios Pinitas | 8dea602 | 2018-06-08 18:33:31 +0100 | [diff] [blame] | 439 | validate(Accessor(_target), _reference, rel_tolerance_f32, 0.f, float(abs_tolerance_f32)); |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 440 | } |
Michalis Spyrou | aeebe4a | 2019-01-09 14:21:03 +0000 | [diff] [blame] | 441 | TEST_SUITE_END() // FP32 |
| 442 | TEST_SUITE_END() // Float |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 443 | |
| 444 | template <typename T> |
Isabella Gottardi | 6acc6ad | 2018-02-02 17:19:18 +0000 | [diff] [blame] | 445 | using NEGEMMConvolutionLayerQuantizedFixture = ConvolutionValidationQuantizedFixture<Tensor, Accessor, NEGEMMConvolutionLayer, T>; |
Isabella Gottardi | e6630e4 | 2018-01-18 15:50:39 +0000 | [diff] [blame] | 446 | |
Georgios Pinitas | dbdea0d | 2019-10-16 19:21:40 +0100 | [diff] [blame] | 447 | template <typename T> |
| 448 | using NEGEMMConvolutionLayerQuantizedPerChannelFixture = ConvolutionValidationQuantizedPerChannelFixture<Tensor, Accessor, NEGEMMConvolutionLayer, T, int8_t>; |
| 449 | |
Isabella Gottardi | 3f217ec | 2018-02-12 14:59:19 +0000 | [diff] [blame] | 450 | const auto QuantizedActivationFunctionsDataset = framework::dataset::make("ActivationInfo", |
| 451 | { |
| 452 | ActivationLayerInfo(), |
| 453 | ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU), |
| 454 | ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, 6.f) |
| 455 | }); |
Isabella Gottardi | e6630e4 | 2018-01-18 15:50:39 +0000 | [diff] [blame] | 456 | TEST_SUITE(Quantized) |
| 457 | TEST_SUITE(QASYMM8) |
Georgios Pinitas | 19ea419 | 2018-06-19 13:09:53 +0100 | [diff] [blame] | 458 | FIXTURE_DATA_TEST_CASE(RunSmall, NEGEMMConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(combine(combine(datasets::SmallConvolutionLayerDataset(), |
Isabella Gottardi | e6630e4 | 2018-01-18 15:50:39 +0000 | [diff] [blame] | 459 | framework::dataset::make("ReshapeWeights", { true })), |
| 460 | framework::dataset::make("DataType", DataType::QASYMM8)), |
Gian Marco Iodice | db9d46d | 2018-08-08 12:29:38 +0100 | [diff] [blame] | 461 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })), |
Isabella Gottardi | 3f217ec | 2018-02-12 14:59:19 +0000 | [diff] [blame] | 462 | framework::dataset::make("QuantizationInfo", { QuantizationInfo(2.f / 255.f, 10) })), |
| 463 | QuantizedActivationFunctionsDataset)) |
Isabella Gottardi | e6630e4 | 2018-01-18 15:50:39 +0000 | [diff] [blame] | 464 | { |
| 465 | // Validate output |
| 466 | validate(Accessor(_target), _reference, tolerance_qasymm8); |
| 467 | } |
Georgios Pinitas | 19ea419 | 2018-06-19 13:09:53 +0100 | [diff] [blame] | 468 | FIXTURE_DATA_TEST_CASE(RunLarge, NEGEMMConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(combine(datasets::LargeConvolutionLayerDataset(), |
Isabella Gottardi | 6acc6ad | 2018-02-02 17:19:18 +0000 | [diff] [blame] | 469 | framework::dataset::make("ReshapeWeights", { true })), |
| 470 | framework::dataset::make("DataType", DataType::QASYMM8)), |
Gian Marco Iodice | db9d46d | 2018-08-08 12:29:38 +0100 | [diff] [blame] | 471 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })), |
Isabella Gottardi | 3f217ec | 2018-02-12 14:59:19 +0000 | [diff] [blame] | 472 | framework::dataset::make("QuantizationInfo", { QuantizationInfo(2.f / 255.f, 10) })), |
| 473 | QuantizedActivationFunctionsDataset)) |
Isabella Gottardi | e6630e4 | 2018-01-18 15:50:39 +0000 | [diff] [blame] | 474 | { |
| 475 | // Validate output |
| 476 | validate(Accessor(_target), _reference, tolerance_qasymm8); |
| 477 | } |
Michalis Spyrou | aeebe4a | 2019-01-09 14:21:03 +0000 | [diff] [blame] | 478 | TEST_SUITE_END() // QASYMM8 |
Georgios Pinitas | dbdea0d | 2019-10-16 19:21:40 +0100 | [diff] [blame] | 479 | |
Georgios Pinitas | 6e1791b | 2019-12-02 19:01:25 +0000 | [diff] [blame] | 480 | TEST_SUITE(QASYMM8_SIGNED) |
| 481 | FIXTURE_DATA_TEST_CASE(RunSmall, NEGEMMConvolutionLayerQuantizedFixture<int8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(combine(combine(datasets::SmallConvolutionLayerDataset(), |
| 482 | framework::dataset::make("ReshapeWeights", { true })), |
| 483 | framework::dataset::make("DataType", DataType::QASYMM8_SIGNED)), |
| 484 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })), |
| 485 | framework::dataset::make("QuantizationInfo", { QuantizationInfo(2.f / 255.f, 10) })), |
| 486 | QuantizedActivationFunctionsDataset)) |
| 487 | { |
| 488 | // Validate output |
| 489 | validate(Accessor(_target), _reference, tolerance_qasymm8); |
| 490 | } |
| 491 | TEST_SUITE_END() // QASYMM8_SIGNED |
| 492 | |
Georgios Pinitas | dbdea0d | 2019-10-16 19:21:40 +0100 | [diff] [blame] | 493 | TEST_SUITE(QSYMM8_PER_CHANNEL) |
| 494 | FIXTURE_DATA_TEST_CASE(RunSmall, NEGEMMConvolutionLayerQuantizedPerChannelFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, |
| 495 | combine(combine(combine(combine(combine(combine(datasets::SmallConvolutionLayerReducedDataset(), |
| 496 | framework::dataset::make("ReshapeWeights", { true })), |
| 497 | framework::dataset::make("DataType", { DataType::QASYMM8 })), |
| 498 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })), |
| 499 | QuantizationData), |
Michele Di Giorgio | f29d1b7 | 2019-10-29 10:58:13 +0000 | [diff] [blame] | 500 | QuantizedActivationFunctionsDataset), |
Georgios Pinitas | dbdea0d | 2019-10-16 19:21:40 +0100 | [diff] [blame] | 501 | framework::dataset::make("WeightsDataType", { DataType::QSYMM8_PER_CHANNEL }))) |
| 502 | { |
| 503 | // Validate output |
| 504 | validate(Accessor(_target), _reference, tolerance_qasymm8); |
| 505 | } |
| 506 | FIXTURE_DATA_TEST_CASE(RunLarge, NEGEMMConvolutionLayerQuantizedPerChannelFixture<uint8_t>, framework::DatasetMode::NIGHTLY, |
Georgios Pinitas | 63d4dbd | 2019-11-08 11:51:56 +0000 | [diff] [blame] | 507 | combine(combine(combine(combine(combine(combine(datasets::SmallConvolutionLayerDataset(), |
Georgios Pinitas | dbdea0d | 2019-10-16 19:21:40 +0100 | [diff] [blame] | 508 | framework::dataset::make("ReshapeWeights", { true })), |
| 509 | framework::dataset::make("DataType", { DataType::QASYMM8 })), |
| 510 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })), |
| 511 | QuantizationData), |
| 512 | QuantizedActivationFunctionsDataset), |
| 513 | framework::dataset::make("WeightsDataType", { DataType::QSYMM8_PER_CHANNEL }))) |
| 514 | { |
| 515 | // Validate output |
| 516 | validate(Accessor(_target), _reference, tolerance_qasymm8); |
| 517 | } |
| 518 | TEST_SUITE_END() // QSYMM8_PER_CHANNEL |
Michalis Spyrou | aeebe4a | 2019-01-09 14:21:03 +0000 | [diff] [blame] | 519 | TEST_SUITE_END() // Quantized |
Isabella Gottardi | e6630e4 | 2018-01-18 15:50:39 +0000 | [diff] [blame] | 520 | |
Michalis Spyrou | aeebe4a | 2019-01-09 14:21:03 +0000 | [diff] [blame] | 521 | TEST_SUITE_END() // GEMMConvolutionLayer |
| 522 | TEST_SUITE_END() // NEON |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 523 | } // namespace validation |
| 524 | } // namespace test |
| 525 | } // namespace arm_compute |