Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 1 | /* |
Sang-Hoon Park | 4715cf9 | 2020-01-08 16:02:47 +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, |
Michalis Spyrou | 8094325 | 2019-01-10 17:19:50 +0000 | [diff] [blame] | 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 22 | * SOFTWARE. |
| 23 | */ |
| 24 | #include "arm_compute/core/Types.h" |
| 25 | #include "arm_compute/runtime/CL/CLTensor.h" |
| 26 | #include "arm_compute/runtime/CL/CLTensorAllocator.h" |
| 27 | #include "arm_compute/runtime/CL/functions/CLConvolutionLayer.h" |
Isabella Gottardi | f07d28d | 2018-02-06 14:52:43 +0000 | [diff] [blame] | 28 | #include "arm_compute/runtime/CL/functions/CLGEMMConvolutionLayer.h" |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 29 | #include "tests/CL/CLAccessor.h" |
| 30 | #include "tests/PaddingCalculator.h" |
Moritz Pflanzer | a09de0c | 2017-09-01 20:41:12 +0100 | [diff] [blame] | 31 | #include "tests/datasets/LargeConvolutionLayerDataset.h" |
| 32 | #include "tests/datasets/SmallConvolutionLayerDataset.h" |
Anthony Barbier | 1c0d0ff | 2018-01-31 13:05:09 +0000 | [diff] [blame] | 33 | #include "tests/datasets/TinyConvolutionLayerDataset.h" |
Moritz Pflanzer | a09de0c | 2017-09-01 20:41:12 +0100 | [diff] [blame] | 34 | #include "tests/framework/Asserts.h" |
| 35 | #include "tests/framework/Macros.h" |
| 36 | #include "tests/framework/datasets/Datasets.h" |
| 37 | #include "tests/validation/Validation.h" |
| 38 | #include "tests/validation/fixtures/ConvolutionLayerFixture.h" |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 39 | |
| 40 | namespace arm_compute |
| 41 | { |
| 42 | namespace test |
| 43 | { |
| 44 | namespace validation |
| 45 | { |
| 46 | namespace |
| 47 | { |
Georgios Pinitas | 5e20753 | 2018-04-27 14:38:16 +0100 | [diff] [blame] | 48 | constexpr AbsoluteTolerance<float> absolute_tolerance_float(0.0001f); /**< Absolute Tolerance value for comparing reference's output against implementation's output for DataType::F32 */ |
Georgios Pinitas | 8be9148 | 2019-03-26 17:23:28 +0000 | [diff] [blame] | 49 | RelativeTolerance<float> tolerance_f32(0.1f); /**< Tolerance value for comparing reference's output against implementation's output for DataType::F32 */ |
steniu01 | f81652d | 2017-09-11 15:29:12 +0100 | [diff] [blame] | 50 | RelativeTolerance<half_float::half> tolerance_f16(half_float::half(0.2)); /**< Tolerance value for comparing reference's output against implementation's output for DataType::F16 */ |
Georgios Pinitas | 51e53a3 | 2018-10-22 13:49:08 +0100 | [diff] [blame] | 51 | constexpr AbsoluteTolerance<float> tolerance_qasymm8(1); /**< Tolerance value for comparing reference's output against implementation's output for quantized data types */ |
steniu01 | f81652d | 2017-09-11 15:29:12 +0100 | [diff] [blame] | 52 | constexpr float tolerance_num = 0.07f; /**< Tolerance number */ |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 53 | |
| 54 | /** CNN data types */ |
| 55 | const auto CNNDataTypes = framework::dataset::make("DataType", |
| 56 | { |
| 57 | DataType::F16, |
| 58 | DataType::F32, |
Chunosov | 5124be5 | 2017-11-22 20:42:13 +0700 | [diff] [blame] | 59 | DataType::QASYMM8, |
Sang-Hoon Park | 4715cf9 | 2020-01-08 16:02:47 +0000 | [diff] [blame] | 60 | DataType::QASYMM8_SIGNED, |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 61 | }); |
Gian Marco Iodice | 916d1bc | 2018-08-13 11:20:41 +0100 | [diff] [blame] | 62 | |
| 63 | /** Grouped CNN data types */ |
| 64 | const auto GroupedCNNDataTypes = framework::dataset::make("DataType", |
| 65 | { |
| 66 | DataType::F16, |
| 67 | DataType::F32 |
| 68 | }); |
| 69 | |
Isabella Gottardi | 3f217ec | 2018-02-12 14:59:19 +0000 | [diff] [blame] | 70 | const auto ActivationFunctionsDataset = framework::dataset::make("ActivationInfo", |
| 71 | { |
| 72 | ActivationLayerInfo(), |
| 73 | ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU), |
| 74 | ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::BOUNDED_RELU, 0.5f), |
| 75 | ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, 0.5f) |
| 76 | }); |
Michalis Spyrou | 8094325 | 2019-01-10 17:19:50 +0000 | [diff] [blame] | 77 | const auto ActivationFunctionsSmallDataset = framework::dataset::make("ActivationInfo", |
| 78 | { |
| 79 | ActivationLayerInfo(), |
| 80 | ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, 0.5f) |
| 81 | }); |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 82 | } // namespace |
| 83 | |
| 84 | TEST_SUITE(CL) |
| 85 | TEST_SUITE(ConvolutionLayer) |
| 86 | |
Michalis Spyrou | 8094325 | 2019-01-10 17:19:50 +0000 | [diff] [blame] | 87 | // *INDENT-OFF* |
| 88 | // clang-format off |
Gian Marco Iodice | 2213d4b | 2018-04-27 10:39:06 +0100 | [diff] [blame] | 89 | DATA_TEST_CASE(ValidateConvolutionMethod, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(zip( |
Sang-Hoon Park | 70d33bd | 2020-01-08 16:29:15 +0000 | [diff] [blame] | 90 | framework::dataset::make("InputInfo", { TensorInfo(TensorShape(17U, 31U, 2U), 1, DataType::F32), // Select GEMM |
| 91 | TensorInfo(TensorShape(17U, 31U, 2U), 1, DataType::F32), // Select GEMM |
| 92 | TensorInfo(TensorShape(23U, 27U, 5U, 4U), 1, DataType::F32), // Select GEMM |
| 93 | TensorInfo(TensorShape(23U, 27U, 31U, 4U), 1, DataType::F32), // Select WINOGRAD |
| 94 | TensorInfo(TensorShape(3U, 3U, 2U, 1U), 1, DataType::F32), // Select GEMM |
| 95 | TensorInfo(TensorShape(33U, 27U, 7U, 4U), 1, DataType::F32), // Select GEMM |
| 96 | TensorInfo(TensorShape(17U, 31U, 32U), 1, DataType::F32), // Select WINOGRAD |
| 97 | TensorInfo(TensorShape(17U, 31U, 2U), 1, DataType::F32), // Select GEMM |
| 98 | TensorInfo(TensorShape(17U, 31U, 2U), 1, DataType::QASYMM8_SIGNED), // Select GEMM |
Michalis Spyrou | 8094325 | 2019-01-10 17:19:50 +0000 | [diff] [blame] | 99 | }), |
| 100 | framework::dataset::make("WeightsInfo", { TensorInfo(TensorShape(5U, 5U, 2U, 19U), 1, DataType::F32), |
| 101 | TensorInfo(TensorShape(5U, 5U, 2U, 19U), 1, DataType::F32), |
| 102 | TensorInfo(TensorShape(3U, 3U, 5U, 21U), 1, DataType::F32), |
| 103 | TensorInfo(TensorShape(3U, 3U, 31U, 21U), 1, DataType::F32), |
| 104 | TensorInfo(TensorShape(3U, 3U, 5U, 21U), 1, DataType::F32), |
| 105 | TensorInfo(TensorShape(5U, 5U, 7U, 16U), 1, DataType::F16), |
| 106 | TensorInfo(TensorShape(5U, 5U, 32U, 19U), 1, DataType::F32), |
Sang-Hoon Park | 70d33bd | 2020-01-08 16:29:15 +0000 | [diff] [blame] | 107 | TensorInfo(TensorShape(5U, 5U, 2U, 19U), 1, DataType::F32), |
| 108 | TensorInfo(TensorShape(5U, 5U, 2U, 19U), 1, DataType::QASYMM8_SIGNED), |
Michalis Spyrou | 8094325 | 2019-01-10 17:19:50 +0000 | [diff] [blame] | 109 | })), |
| 110 | framework::dataset::make("OutputInfo", { TensorInfo(TensorShape(15U, 15U, 19U), 1, DataType::F32), |
| 111 | TensorInfo(TensorShape(15U, 15U, 19U), 1, DataType::F32), |
| 112 | TensorInfo(TensorShape(21U, 25U, 21U, 4U), 1, DataType::F32), |
| 113 | TensorInfo(TensorShape(21U, 25U, 21U, 4U), 1, DataType::F32), |
| 114 | TensorInfo(TensorShape(11U, 25U, 21U), 1, DataType::F32), |
| 115 | TensorInfo(TensorShape(11U, 12U, 16U, 4U), 1, DataType::F32), |
| 116 | TensorInfo(TensorShape(17U, 31U, 19U), 1, DataType::F32), |
Sang-Hoon Park | 70d33bd | 2020-01-08 16:29:15 +0000 | [diff] [blame] | 117 | TensorInfo(TensorShape(17U, 31U, 19U), 1, DataType::F32), |
| 118 | TensorInfo(TensorShape(17U, 31U, 19U), 1, DataType::QASYMM8_SIGNED), |
Michalis Spyrou | 8094325 | 2019-01-10 17:19:50 +0000 | [diff] [blame] | 119 | })), |
| 120 | framework::dataset::make("ConvInfo", { PadStrideInfo(1, 2, 1, 1), |
| 121 | PadStrideInfo(1, 2, 1, 1), |
| 122 | PadStrideInfo(1, 1, 0, 0), |
| 123 | PadStrideInfo(1, 1, 0, 0), |
| 124 | PadStrideInfo(2, 1, 0, 0), |
| 125 | PadStrideInfo(3, 2, 1, 0), |
| 126 | PadStrideInfo(1, 1, 2, 2), |
Sang-Hoon Park | 70d33bd | 2020-01-08 16:29:15 +0000 | [diff] [blame] | 127 | PadStrideInfo(1, 1, 2, 2), |
| 128 | PadStrideInfo(1, 1, 2, 2), |
Michalis Spyrou | 8094325 | 2019-01-10 17:19:50 +0000 | [diff] [blame] | 129 | })), |
| 130 | framework::dataset::make("GpuTarget", { GPUTarget::BIFROST, |
| 131 | GPUTarget::MIDGARD, |
| 132 | GPUTarget::G71, |
| 133 | GPUTarget::G71, |
| 134 | GPUTarget::MIDGARD, |
| 135 | GPUTarget::BIFROST, |
| 136 | GPUTarget::BIFROST, |
Sang-Hoon Park | 70d33bd | 2020-01-08 16:29:15 +0000 | [diff] [blame] | 137 | GPUTarget::BIFROST, |
| 138 | GPUTarget::BIFROST, |
Michalis Spyrou | 8094325 | 2019-01-10 17:19:50 +0000 | [diff] [blame] | 139 | })), |
| 140 | framework::dataset::make("Dilation", { Size2D(1U, 1U), |
| 141 | Size2D(1U, 1U), |
| 142 | Size2D(1U, 1U), |
| 143 | Size2D(1U, 1U), |
| 144 | Size2D(1U, 1U), |
| 145 | Size2D(1U, 1U), |
| 146 | Size2D(1U, 1U), |
| 147 | Size2D(2U, 1U), |
Sang-Hoon Park | 70d33bd | 2020-01-08 16:29:15 +0000 | [diff] [blame] | 148 | Size2D(2U, 1U), |
Michalis Spyrou | 8094325 | 2019-01-10 17:19:50 +0000 | [diff] [blame] | 149 | })), |
Sang-Hoon Park | 70d33bd | 2020-01-08 16:29:15 +0000 | [diff] [blame] | 150 | framework::dataset::make("EnableFastMath", { false, false, false, false, false, false, true, true, true })), |
Michalis Spyrou | 8094325 | 2019-01-10 17:19:50 +0000 | [diff] [blame] | 151 | framework::dataset::make("Expected",{ ConvolutionMethod::GEMM, |
| 152 | ConvolutionMethod::GEMM, |
| 153 | ConvolutionMethod::GEMM, |
| 154 | ConvolutionMethod::WINOGRAD, |
| 155 | ConvolutionMethod::GEMM, |
| 156 | ConvolutionMethod::GEMM, |
| 157 | ConvolutionMethod::WINOGRAD, |
| 158 | ConvolutionMethod::GEMM, |
Sang-Hoon Park | 70d33bd | 2020-01-08 16:29:15 +0000 | [diff] [blame] | 159 | ConvolutionMethod::GEMM, |
Michalis Spyrou | 8094325 | 2019-01-10 17:19:50 +0000 | [diff] [blame] | 160 | })), |
| 161 | input_info, weights_info, output_info, conv_info, gpu_target, dilation, enable_fast_math, expected) |
Gian Marco Iodice | 2213d4b | 2018-04-27 10:39:06 +0100 | [diff] [blame] | 162 | { |
| 163 | ConvolutionMethod is_valid = CLConvolutionLayer::get_convolution_method(&input_info.clone()->set_is_resizable(true), |
| 164 | &weights_info.clone()->set_is_resizable(true), |
| 165 | &output_info.clone()->set_is_resizable(true), conv_info, |
| 166 | WeightsInfo(), |
| 167 | ActivationLayerInfo(), |
| 168 | gpu_target, |
| 169 | dilation, |
| 170 | enable_fast_math); |
Isabella Gottardi | f07d28d | 2018-02-06 14:52:43 +0000 | [diff] [blame] | 171 | ARM_COMPUTE_EXPECT(is_valid == expected, framework::LogLevel::ERRORS); |
| 172 | } |
Michalis Spyrou | 8094325 | 2019-01-10 17:19:50 +0000 | [diff] [blame] | 173 | // clang-format on |
| 174 | // *INDENT-ON* |
| 175 | TEST_SUITE_END() // ConvolutionLayer |
Isabella Gottardi | f07d28d | 2018-02-06 14:52:43 +0000 | [diff] [blame] | 176 | |
| 177 | TEST_SUITE(GEMMConvolutionLayer) |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 178 | template <typename T> |
Isabella Gottardi | f07d28d | 2018-02-06 14:52:43 +0000 | [diff] [blame] | 179 | using CLGEMMConvolutionLayerFixture = ConvolutionValidationFixture<CLTensor, CLAccessor, CLGEMMConvolutionLayer, T>; |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 180 | |
| 181 | TEST_SUITE(Float) |
| 182 | TEST_SUITE(FP16) |
Isabella Gottardi | 3f217ec | 2018-02-12 14:59:19 +0000 | [diff] [blame] | 183 | |
Michele Di Giorgio | e37662a | 2020-04-29 15:14:18 +0100 | [diff] [blame^] | 184 | FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMConvolutionLayerFixture<half>, framework::DatasetMode::ALL, combine(combine(combine(combine(datasets::SmallConvolutionLayerDataset(), |
| 185 | framework::dataset::make("ReshapeWeights", { true })), |
| 186 | framework::dataset::make("DataType", |
| 187 | DataType::F16)), |
| 188 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })), |
| 189 | ActivationFunctionsSmallDataset)) |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 190 | { |
| 191 | // Validate output |
steniu01 | 3e05e4e | 2017-08-25 17:18:01 +0100 | [diff] [blame] | 192 | validate(CLAccessor(_target), _reference, tolerance_f16, tolerance_num); |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 193 | } |
Gian Marco Iodice | 916d1bc | 2018-08-13 11:20:41 +0100 | [diff] [blame] | 194 | TEST_SUITE_END() // FP16 |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 195 | |
| 196 | TEST_SUITE(FP32) |
Isabella Gottardi | 3f217ec | 2018-02-12 14:59:19 +0000 | [diff] [blame] | 197 | |
Michele Di Giorgio | e37662a | 2020-04-29 15:14:18 +0100 | [diff] [blame^] | 198 | FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMConvolutionLayerFixture<float>, framework::DatasetMode::ALL, combine(combine(combine(combine(datasets::SmallConvolutionLayerDataset(), |
| 199 | framework::dataset::make("ReshapeWeights", { true })), |
| 200 | framework::dataset::make("DataType", |
| 201 | DataType::F32)), |
| 202 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })), |
| 203 | ActivationFunctionsSmallDataset)) |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 204 | { |
| 205 | // Validate output |
| 206 | validate(CLAccessor(_target), _reference, tolerance_f32); |
| 207 | } |
Gian Marco Iodice | 916d1bc | 2018-08-13 11:20:41 +0100 | [diff] [blame] | 208 | TEST_SUITE_END() // FP32 |
| 209 | TEST_SUITE_END() // Float |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 210 | |
| 211 | template <typename T> |
Isabella Gottardi | f07d28d | 2018-02-06 14:52:43 +0000 | [diff] [blame] | 212 | using CLGEMMConvolutionLayerQuantizedFixture = ConvolutionValidationQuantizedFixture<CLTensor, CLAccessor, CLGEMMConvolutionLayer, T>; |
Vidhya Sudhan Loganathan | 951b8a4 | 2019-11-04 14:42:08 +0000 | [diff] [blame] | 213 | template <typename T> |
| 214 | using CLGEMMConvolutionLayerQuantizedPerChannelFixture = ConvolutionValidationQuantizedPerChannelFixture<CLTensor, CLAccessor, CLGEMMConvolutionLayer, T, int8_t>; |
Chunosov | 5124be5 | 2017-11-22 20:42:13 +0700 | [diff] [blame] | 215 | |
Isabella Gottardi | 3f217ec | 2018-02-12 14:59:19 +0000 | [diff] [blame] | 216 | const auto QuantizedActivationFunctionsDataset = framework::dataset::make("ActivationInfo", |
| 217 | { |
| 218 | ActivationLayerInfo(), |
| 219 | ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU), |
| 220 | ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, 6.f) |
| 221 | }); |
Michalis Spyrou | 8094325 | 2019-01-10 17:19:50 +0000 | [diff] [blame] | 222 | const auto QuantizedActivationFunctionsSmallDataset = framework::dataset::make("ActivationInfo", |
| 223 | { |
| 224 | ActivationLayerInfo(), |
| 225 | ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, 6.f) |
| 226 | }); |
Isabella Gottardi | 3f217ec | 2018-02-12 14:59:19 +0000 | [diff] [blame] | 227 | |
Chunosov | 5124be5 | 2017-11-22 20:42:13 +0700 | [diff] [blame] | 228 | TEST_SUITE(Quantized) |
Isabella Gottardi | 3f217ec | 2018-02-12 14:59:19 +0000 | [diff] [blame] | 229 | |
Gian Marco Iodice | 3139f03 | 2018-11-05 14:26:32 +0000 | [diff] [blame] | 230 | const auto QuantizationData = framework::dataset::make("QuantizationInfo", |
| 231 | { |
| 232 | QuantizationInfo(0.5f, 10), |
| 233 | QuantizationInfo(0.3f, 3), |
Michele Di Giorgio | 14cbfb2 | 2019-10-23 10:53:10 +0100 | [diff] [blame] | 234 | QuantizationInfo(1.1f, 10), |
Gian Marco Iodice | 3139f03 | 2018-11-05 14:26:32 +0000 | [diff] [blame] | 235 | }); |
Vidhya Sudhan Loganathan | 951b8a4 | 2019-11-04 14:42:08 +0000 | [diff] [blame] | 236 | TEST_SUITE(QASYMM8) |
Gian Marco Iodice | 3139f03 | 2018-11-05 14:26:32 +0000 | [diff] [blame] | 237 | |
Michele Di Giorgio | e37662a | 2020-04-29 15:14:18 +0100 | [diff] [blame^] | 238 | FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::ALL, |
| 239 | combine(combine(combine(combine(combine(datasets::SmallConvolutionLayerDataset(), |
Michalis Spyrou | 8094325 | 2019-01-10 17:19:50 +0000 | [diff] [blame] | 240 | framework::dataset::make("ReshapeWeights", { true })), |
| 241 | framework::dataset::make("DataType", DataType::QASYMM8)), |
| 242 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })), |
| 243 | QuantizationData), |
| 244 | QuantizedActivationFunctionsSmallDataset)) |
Chunosov | 5124be5 | 2017-11-22 20:42:13 +0700 | [diff] [blame] | 245 | { |
| 246 | // Validate output |
| 247 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 248 | } |
Gian Marco Iodice | 916d1bc | 2018-08-13 11:20:41 +0100 | [diff] [blame] | 249 | TEST_SUITE_END() // QASYMM8 |
Sang-Hoon Park | 4715cf9 | 2020-01-08 16:02:47 +0000 | [diff] [blame] | 250 | TEST_SUITE(QASYMM8_SIGNED) |
| 251 | |
Michele Di Giorgio | e37662a | 2020-04-29 15:14:18 +0100 | [diff] [blame^] | 252 | FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMConvolutionLayerQuantizedFixture<int8_t>, framework::DatasetMode::ALL, |
| 253 | combine(combine(combine(combine(combine(datasets::SmallConvolutionLayerDataset(), |
Sang-Hoon Park | 4715cf9 | 2020-01-08 16:02:47 +0000 | [diff] [blame] | 254 | framework::dataset::make("ReshapeWeights", { true })), |
| 255 | framework::dataset::make("DataType", DataType::QASYMM8_SIGNED)), |
| 256 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })), |
| 257 | QuantizationData), |
| 258 | QuantizedActivationFunctionsSmallDataset)) |
| 259 | { |
| 260 | // Validate output |
| 261 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 262 | } |
| 263 | TEST_SUITE_END() // QASYMM8_SIGNED |
Vidhya Sudhan Loganathan | 951b8a4 | 2019-11-04 14:42:08 +0000 | [diff] [blame] | 264 | TEST_SUITE(QSYMM8_PER_CHANNEL) |
| 265 | |
Michele Di Giorgio | e37662a | 2020-04-29 15:14:18 +0100 | [diff] [blame^] | 266 | FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMConvolutionLayerQuantizedPerChannelFixture<uint8_t>, framework::DatasetMode::ALL, |
Vidhya Sudhan Loganathan | 951b8a4 | 2019-11-04 14:42:08 +0000 | [diff] [blame] | 267 | combine(combine(combine(combine(combine(combine(datasets::SmallConvolutionLayerDataset(), |
| 268 | framework::dataset::make("ReshapeWeights", { true })), |
| 269 | framework::dataset::make("DataType", { DataType::QASYMM8 })), |
| 270 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })), |
| 271 | QuantizationData), |
Michele Di Giorgio | e37662a | 2020-04-29 15:14:18 +0100 | [diff] [blame^] | 272 | QuantizedActivationFunctionsSmallDataset), |
Vidhya Sudhan Loganathan | 951b8a4 | 2019-11-04 14:42:08 +0000 | [diff] [blame] | 273 | framework::dataset::make("WeightsDataType", { DataType::QSYMM8_PER_CHANNEL }))) |
| 274 | { |
| 275 | // Validate output |
| 276 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 277 | } |
| 278 | TEST_SUITE_END() // QSYMM8_PER_CHANNEL |
Gian Marco Iodice | 916d1bc | 2018-08-13 11:20:41 +0100 | [diff] [blame] | 279 | TEST_SUITE_END() // Quantized |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 280 | |
Gian Marco Iodice | 916d1bc | 2018-08-13 11:20:41 +0100 | [diff] [blame] | 281 | TEST_SUITE_END() // GEMMConvolutionLayer |
| 282 | |
| 283 | template <typename T> |
| 284 | using CLGEMMGroupedConvolutionLayerFixture = ConvolutionValidationFixture<CLTensor, CLAccessor, CLGEMMConvolutionLayer, T>; |
| 285 | |
| 286 | TEST_SUITE(GroupedGEMMConvolutionLayer) |
| 287 | |
Gian Marco Iodice | 916d1bc | 2018-08-13 11:20:41 +0100 | [diff] [blame] | 288 | TEST_SUITE(Float) |
| 289 | TEST_SUITE(FP32) |
| 290 | |
Michele Di Giorgio | e37662a | 2020-04-29 15:14:18 +0100 | [diff] [blame^] | 291 | FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMGroupedConvolutionLayerFixture<float>, framework::DatasetMode::ALL, combine(combine(combine(combine(datasets::SmallGroupedConvolutionLayerDataset(), |
| 292 | framework::dataset::make("ReshapeWeights", { true })), |
| 293 | framework::dataset::make("DataType", DataType::F32)), |
| 294 | framework::dataset::make("DataLayout", { DataLayout::NCHW })), |
| 295 | ActivationFunctionsSmallDataset)) |
Gian Marco Iodice | 916d1bc | 2018-08-13 11:20:41 +0100 | [diff] [blame] | 296 | { |
| 297 | // Validate output |
| 298 | validate(CLAccessor(_target), _reference, tolerance_f32, tolerance_num); |
| 299 | } |
| 300 | |
Michalis Spyrou | 8094325 | 2019-01-10 17:19:50 +0000 | [diff] [blame] | 301 | FIXTURE_DATA_TEST_CASE(RunLarge, CLGEMMGroupedConvolutionLayerFixture<float>, framework::DatasetMode::NIGHTLY, |
Michele Di Giorgio | e37662a | 2020-04-29 15:14:18 +0100 | [diff] [blame^] | 302 | combine(combine(combine(combine(datasets::LargeGroupedConvolutionLayerDataset(), |
Michalis Spyrou | 8094325 | 2019-01-10 17:19:50 +0000 | [diff] [blame] | 303 | framework::dataset::make("ReshapeWeights", { true })), |
| 304 | framework::dataset::make("DataType", DataType::F32)), |
| 305 | framework::dataset::make("DataLayout", { DataLayout::NCHW })), |
| 306 | ActivationFunctionsDataset)) |
Gian Marco Iodice | 916d1bc | 2018-08-13 11:20:41 +0100 | [diff] [blame] | 307 | { |
| 308 | // Validate output |
| 309 | validate(CLAccessor(_target), _reference, tolerance_f32, tolerance_num); |
| 310 | } |
| 311 | TEST_SUITE_END() // FP32 |
| 312 | |
| 313 | TEST_SUITE(FP16) |
| 314 | |
Michele Di Giorgio | e37662a | 2020-04-29 15:14:18 +0100 | [diff] [blame^] | 315 | FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMGroupedConvolutionLayerFixture<half>, framework::DatasetMode::ALL, combine(combine(combine(combine(datasets::SmallGroupedConvolutionLayerDataset(), |
| 316 | framework::dataset::make("ReshapeWeights", { true })), |
| 317 | framework::dataset::make("DataType", DataType::F16)), |
| 318 | framework::dataset::make("DataLayout", { DataLayout::NCHW })), |
| 319 | ActivationFunctionsSmallDataset)) |
Gian Marco Iodice | 916d1bc | 2018-08-13 11:20:41 +0100 | [diff] [blame] | 320 | { |
| 321 | // Validate output |
| 322 | validate(CLAccessor(_target), _reference, tolerance_f32, tolerance_num); |
| 323 | } |
| 324 | |
Michalis Spyrou | 8094325 | 2019-01-10 17:19:50 +0000 | [diff] [blame] | 325 | FIXTURE_DATA_TEST_CASE(RunLarge, CLGEMMGroupedConvolutionLayerFixture<half>, framework::DatasetMode::NIGHTLY, |
Michele Di Giorgio | e37662a | 2020-04-29 15:14:18 +0100 | [diff] [blame^] | 326 | combine(combine(combine(combine(datasets::LargeGroupedConvolutionLayerDataset(), |
Michalis Spyrou | 8094325 | 2019-01-10 17:19:50 +0000 | [diff] [blame] | 327 | framework::dataset::make("ReshapeWeights", { true })), |
| 328 | framework::dataset::make("DataType", DataType::F16)), |
| 329 | framework::dataset::make("DataLayout", { DataLayout::NCHW })), |
| 330 | ActivationFunctionsDataset)) |
Gian Marco Iodice | 916d1bc | 2018-08-13 11:20:41 +0100 | [diff] [blame] | 331 | { |
| 332 | // Validate output |
| 333 | validate(CLAccessor(_target), _reference, tolerance_f32, tolerance_num); |
| 334 | } |
| 335 | TEST_SUITE_END() // FP16 |
| 336 | TEST_SUITE_END() // Float |
| 337 | |
| 338 | TEST_SUITE_END() // GroupedGEMMConvolutionLayer |
| 339 | TEST_SUITE_END() // CL |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 340 | } // namespace validation |
| 341 | } // namespace test |
| 342 | } // namespace arm_compute |