Michalis Spyrou | 7362f0d | 2017-10-18 17:58:22 +0100 | [diff] [blame] | 1 | /* |
Georgios Pinitas | f72f936 | 2018-01-12 16:29:45 +0000 | [diff] [blame] | 2 | * Copyright (c) 2017-2018 ARM Limited. |
Michalis Spyrou | 7362f0d | 2017-10-18 17:58:22 +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 CONCLCTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 22 | * SOFTWARE. |
| 23 | */ |
| 24 | #include "arm_compute/core/Types.h" |
Giorgio Arena | 7657224 | 2018-04-04 17:44:26 +0100 | [diff] [blame] | 25 | #include "arm_compute/core/utils/misc/ShapeCalculator.h" |
Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 26 | #include "arm_compute/runtime/NEON/functions/NEDepthwiseConvolutionLayer.h" |
Michalis Spyrou | 7362f0d | 2017-10-18 17:58:22 +0100 | [diff] [blame] | 27 | #include "arm_compute/runtime/Tensor.h" |
| 28 | #include "arm_compute/runtime/TensorAllocator.h" |
| 29 | #include "tests/NEON/Accessor.h" |
| 30 | #include "tests/PaddingCalculator.h" |
Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 31 | #include "tests/datasets/DepthwiseConvolutionLayerDataset.h" |
Michalis Spyrou | 7362f0d | 2017-10-18 17:58:22 +0100 | [diff] [blame] | 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" |
Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 36 | #include "tests/validation/fixtures/DepthwiseConvolutionLayerFixture.h" |
Michalis Spyrou | 7362f0d | 2017-10-18 17:58:22 +0100 | [diff] [blame] | 37 | |
| 38 | namespace arm_compute |
| 39 | { |
| 40 | namespace test |
| 41 | { |
| 42 | namespace validation |
| 43 | { |
Giorgio Arena | 7657224 | 2018-04-04 17:44:26 +0100 | [diff] [blame] | 44 | using namespace arm_compute::misc::shape_calculator; |
| 45 | |
Michalis Spyrou | 7362f0d | 2017-10-18 17:58:22 +0100 | [diff] [blame] | 46 | namespace |
| 47 | { |
Georgios Pinitas | 8cffcd6 | 2018-11-16 17:11:50 +0000 | [diff] [blame] | 48 | constexpr RelativeTolerance<float> tolerance_f32(0.01f); /**< Tolerance value for comparing reference's output against implementation's output for DataType::F32 */ |
| 49 | constexpr AbsoluteTolerance<uint8_t> tolerance_qasymm8(1); /**< Tolerance value for comparing reference's output against implementation's output for DataType::QASYMM8 */ |
| 50 | #ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC |
| 51 | RelativeTolerance<half_float::half> tolerance_f16(half_float::half(0.01)); /**< Tolerance value for comparing reference's output against implementation's output for DataType::F16 */ |
| 52 | constexpr float tolerance_num = 0.05f; /**< Tolerance number */ |
| 53 | #endif // __ARM_FEATURE_FP16_VECTOR_ARITHMETIC |
Giorgio Arena | 7657224 | 2018-04-04 17:44:26 +0100 | [diff] [blame] | 54 | |
| 55 | const auto depth_multipliers = framework::dataset::make("DepthMultiplier", { 1, 2, 3 }); |
Michalis Spyrou | 7362f0d | 2017-10-18 17:58:22 +0100 | [diff] [blame] | 56 | } // namespace |
| 57 | |
| 58 | TEST_SUITE(NEON) |
Pablo Tello | 941cd70 | 2017-12-12 14:35:00 +0000 | [diff] [blame] | 59 | TEST_SUITE(DepthwiseConvLayer) |
Michalis Spyrou | 7362f0d | 2017-10-18 17:58:22 +0100 | [diff] [blame] | 60 | |
Abe Mbise | 7784c83 | 2018-05-31 16:48:41 +0100 | [diff] [blame] | 61 | // *INDENT-OFF* |
| 62 | // clang-format off |
| 63 | DATA_TEST_CASE(Validate3x3, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip( |
| 64 | framework::dataset::make("InputInfo", { TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Mismatching data type input/weights |
| 65 | TensorInfo(TensorShape(32U, 18U, 3U), 1, DataType::F32), // Mismatching input feature maps |
| 66 | TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Unsupported weights dimensions |
| 67 | TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Mismatching depth multiplier |
Giorgio Arena | 66cbafb | 2018-08-23 14:51:00 +0100 | [diff] [blame] | 68 | TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::QASYMM8), // Invalid stride |
Abe Mbise | 7784c83 | 2018-05-31 16:48:41 +0100 | [diff] [blame] | 69 | TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Invalid biases size |
| 70 | TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Invalid biases dimensions |
| 71 | TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Invalid output size |
Giorgio Arena | 66cbafb | 2018-08-23 14:51:00 +0100 | [diff] [blame] | 72 | TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), |
Abe Mbise | 7784c83 | 2018-05-31 16:48:41 +0100 | [diff] [blame] | 73 | }), |
Giorgio Arena | 66cbafb | 2018-08-23 14:51:00 +0100 | [diff] [blame] | 74 | framework::dataset::make("WeightsInfo", { TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::F16), |
| 75 | TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::F32), |
| 76 | TensorInfo(TensorShape(5U, 5U, 2U, 2U), 1, DataType::F32), |
| 77 | TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::F32), |
| 78 | TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::QASYMM8), |
| 79 | TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::F32), |
| 80 | TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::F32), |
| 81 | TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::F32), |
| 82 | TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::F32), |
Abe Mbise | 7784c83 | 2018-05-31 16:48:41 +0100 | [diff] [blame] | 83 | })), |
| 84 | framework::dataset::make("BiasesInfo", { TensorInfo(TensorShape(2U), 1, DataType::F32), |
| 85 | TensorInfo(TensorShape(2U), 1, DataType::F32), |
| 86 | TensorInfo(TensorShape(2U), 1, DataType::F32), |
| 87 | TensorInfo(TensorShape(2U), 1, DataType::F32), |
Giorgio Arena | 66cbafb | 2018-08-23 14:51:00 +0100 | [diff] [blame] | 88 | TensorInfo(TensorShape(2U), 1, DataType::S32), |
Abe Mbise | 7784c83 | 2018-05-31 16:48:41 +0100 | [diff] [blame] | 89 | TensorInfo(TensorShape(4U), 1, DataType::F32), |
| 90 | TensorInfo(TensorShape(2U, 2U), 1, DataType::F32), |
| 91 | TensorInfo(TensorShape(2U), 1, DataType::F32), |
| 92 | TensorInfo(TensorShape(2U), 1, DataType::F32), |
| 93 | })), |
| 94 | framework::dataset::make("OutputInfo", { TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32), |
| 95 | TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32), |
| 96 | TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32), |
| 97 | TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32), |
Giorgio Arena | 66cbafb | 2018-08-23 14:51:00 +0100 | [diff] [blame] | 98 | TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::QASYMM8), |
Abe Mbise | 7784c83 | 2018-05-31 16:48:41 +0100 | [diff] [blame] | 99 | TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32), |
| 100 | TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32), |
| 101 | TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), |
| 102 | TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32), |
| 103 | })), |
| 104 | framework::dataset::make("ConvInfo", { PadStrideInfo(1, 1, 0, 0), |
| 105 | PadStrideInfo(1, 1, 0, 0), |
| 106 | PadStrideInfo(1, 1, 0, 0), |
| 107 | PadStrideInfo(1, 1, 0, 0), |
| 108 | PadStrideInfo(4, 1, 0, 0), |
| 109 | PadStrideInfo(1, 1, 0, 0), |
| 110 | PadStrideInfo(1, 1, 0, 0), |
| 111 | PadStrideInfo(1, 1, 0, 0), |
| 112 | PadStrideInfo(1, 1, 0, 0), |
| 113 | })), |
| 114 | framework::dataset::make("DepthMultiplier", { 1, |
| 115 | 1, |
| 116 | 1, |
| 117 | 3, |
| 118 | 1, |
| 119 | 1, |
| 120 | 1, |
| 121 | 1, |
| 122 | 1, |
| 123 | })), |
Giorgio Arena | 66cbafb | 2018-08-23 14:51:00 +0100 | [diff] [blame] | 124 | framework::dataset::make("Expected", { false, false, false, false, false, false, false, false, true })), |
Abe Mbise | 7784c83 | 2018-05-31 16:48:41 +0100 | [diff] [blame] | 125 | input_info, weights_info, biases_info, output_info, conv_info, depth_multiplier, expected) |
Michalis Spyrou | 7362f0d | 2017-10-18 17:58:22 +0100 | [diff] [blame] | 126 | { |
Abe Mbise | 7784c83 | 2018-05-31 16:48:41 +0100 | [diff] [blame] | 127 | bool is_valid = bool(NEDepthwiseConvolutionLayer3x3::validate(&input_info.clone()->set_is_resizable(false), &weights_info.clone()->set_is_resizable(false), &biases_info.clone()->set_is_resizable(false), &output_info.clone()->set_is_resizable(false), conv_info, depth_multiplier)); |
| 128 | ARM_COMPUTE_EXPECT(is_valid == expected, framework::LogLevel::ERRORS); |
Michalis Spyrou | 7362f0d | 2017-10-18 17:58:22 +0100 | [diff] [blame] | 129 | } |
| 130 | |
Abe Mbise | 7784c83 | 2018-05-31 16:48:41 +0100 | [diff] [blame] | 131 | DATA_TEST_CASE(ValidateGeneric, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip( |
| 132 | framework::dataset::make("InputInfo", { TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Mismatching data type input/weights |
| 133 | TensorInfo(TensorShape(27U, 13U, 3U), 1, DataType::F32), // Mismatching input feature maps |
| 134 | TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Mismatching depth multiplier |
| 135 | TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid biases size |
| 136 | TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid biases dimensions |
| 137 | TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid output size |
| 138 | TensorInfo(TensorShape(27U, 13U, 8U), 1, DataType::F32), |
| 139 | TensorInfo(TensorShape(32U, 13U, 8U), 1, DataType::QASYMM8), |
| 140 | }), |
| 141 | framework::dataset::make("WeightsInfo", { TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F16), |
| 142 | TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32), |
| 143 | TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32), |
| 144 | TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32), |
| 145 | TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32), |
| 146 | TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32), |
| 147 | TensorInfo(TensorShape(3U, 3U, 16U), 1, DataType::F32), |
| 148 | TensorInfo(TensorShape(3U, 3U, 24U), 1, DataType::QASYMM8), |
| 149 | })), |
| 150 | framework::dataset::make("BiasesInfo", { TensorInfo(TensorShape(2U), 1, DataType::F32), |
| 151 | TensorInfo(TensorShape(2U), 1, DataType::F32), |
| 152 | TensorInfo(TensorShape(2U), 1, DataType::F32), |
| 153 | TensorInfo(TensorShape(4U), 1, DataType::F32), |
| 154 | TensorInfo(TensorShape(2U, 2U), 1, DataType::F32), |
| 155 | TensorInfo(TensorShape(2U), 1, DataType::F32), |
| 156 | TensorInfo(TensorShape(16U), 1, DataType::F32), |
| 157 | TensorInfo(TensorShape(24U), 1, DataType::S32), |
| 158 | })), |
| 159 | framework::dataset::make("OutputInfo", { TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32), |
| 160 | TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32), |
| 161 | TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32), |
| 162 | TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32), |
| 163 | TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32), |
| 164 | TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), |
| 165 | TensorInfo(TensorShape(25U, 11U, 16U), 1, DataType::F32), |
| 166 | TensorInfo(TensorShape(32U, 11U, 24U), 1, DataType::QASYMM8), |
| 167 | })), |
| 168 | framework::dataset::make("ConvInfo", { PadStrideInfo(1, 1, 0, 0), |
| 169 | PadStrideInfo(1, 1, 0, 0), |
| 170 | PadStrideInfo(1, 1, 0, 0), |
| 171 | PadStrideInfo(1, 1, 0, 0), |
| 172 | PadStrideInfo(1, 1, 0, 0), |
| 173 | PadStrideInfo(1, 1, 0, 0), |
| 174 | PadStrideInfo(1, 1, 0, 0), |
| 175 | PadStrideInfo(1, 1, 1, 0), |
| 176 | })), |
| 177 | framework::dataset::make("DepthMultiplier", { 1, |
| 178 | 1, |
| 179 | 3, |
| 180 | 1, |
| 181 | 1, |
| 182 | 1, |
| 183 | 2, |
| 184 | 3, |
| 185 | })), |
| 186 | framework::dataset::make("Expected", { false, false, false, false, false, false, true, true })), |
| 187 | input_info, weights_info, biases_info, output_info, conv_info, depth_multiplier, expected) |
| 188 | { |
| 189 | bool is_valid = bool(NEDepthwiseConvolutionLayer::validate(&input_info.clone()->set_is_resizable(false), &weights_info.clone()->set_is_resizable(false), &biases_info.clone()->set_is_resizable(false), &output_info.clone()->set_is_resizable(false), conv_info, depth_multiplier)); |
| 190 | ARM_COMPUTE_EXPECT(is_valid == expected, framework::LogLevel::ERRORS); |
| 191 | } |
| 192 | // clang-format on |
| 193 | // *INDENT-ON* |
| 194 | |
Dmitry Savenko | d7295b7 | 2017-11-20 22:00:08 +0700 | [diff] [blame] | 195 | TEST_SUITE(Float) |
Michalis Spyrou | 7362f0d | 2017-10-18 17:58:22 +0100 | [diff] [blame] | 196 | TEST_SUITE(F32) |
Michalis Spyrou | b7b3153 | 2017-11-23 12:10:21 +0000 | [diff] [blame] | 197 | TEST_SUITE(Generic) |
| 198 | template <typename T> |
Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 199 | using NEDepthwiseConvolutionLayerFixture = DepthwiseConvolutionLayerValidationFixture<Tensor, Accessor, NEDepthwiseConvolutionLayer, T>; |
Giorgio Arena | 7657224 | 2018-04-04 17:44:26 +0100 | [diff] [blame] | 200 | FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset(), |
| 201 | depth_multipliers), |
Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 202 | framework::dataset::make("DataType", |
Giorgio Arena | 1ed1fc6 | 2018-03-26 16:20:05 +0100 | [diff] [blame] | 203 | DataType::F32)), |
Giorgio Arena | 26b2216 | 2018-08-13 15:49:49 +0100 | [diff] [blame] | 204 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
Michalis Spyrou | b7b3153 | 2017-11-23 12:10:21 +0000 | [diff] [blame] | 205 | { |
| 206 | validate(Accessor(_target), _reference, tolerance_f32); |
| 207 | } |
Giorgio Arena | 7657224 | 2018-04-04 17:44:26 +0100 | [diff] [blame] | 208 | FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset(), |
| 209 | depth_multipliers), |
Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 210 | framework::dataset::make("DataType", |
Giorgio Arena | 1ed1fc6 | 2018-03-26 16:20:05 +0100 | [diff] [blame] | 211 | DataType::F32)), |
Giorgio Arena | 26b2216 | 2018-08-13 15:49:49 +0100 | [diff] [blame] | 212 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
Michalis Spyrou | b7b3153 | 2017-11-23 12:10:21 +0000 | [diff] [blame] | 213 | { |
| 214 | validate(Accessor(_target), _reference, tolerance_f32); |
| 215 | } |
Georgios Pinitas | 20c246a | 2018-09-12 16:45:53 +0100 | [diff] [blame] | 216 | TEST_SUITE_END() // Generic |
Michalis Spyrou | b7b3153 | 2017-11-23 12:10:21 +0000 | [diff] [blame] | 217 | |
Michalis Spyrou | 7362f0d | 2017-10-18 17:58:22 +0100 | [diff] [blame] | 218 | TEST_SUITE(W3x3) |
Michalis Spyrou | b7b3153 | 2017-11-23 12:10:21 +0000 | [diff] [blame] | 219 | template <typename T> |
Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 220 | using NEDepthwiseConvolutionLayerFixture3x3 = DepthwiseConvolutionLayerValidationFixture<Tensor, Accessor, NEDepthwiseConvolutionLayer3x3, T>; |
Giorgio Arena | 7657224 | 2018-04-04 17:44:26 +0100 | [diff] [blame] | 221 | FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthwiseConvolutionLayerFixture3x3<float>, framework::DatasetMode::ALL, combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset3x3(), |
| 222 | depth_multipliers), |
Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 223 | framework::dataset::make("DataType", |
Giorgio Arena | 1ed1fc6 | 2018-03-26 16:20:05 +0100 | [diff] [blame] | 224 | DataType::F32)), |
Giorgio Arena | 26b2216 | 2018-08-13 15:49:49 +0100 | [diff] [blame] | 225 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
Michalis Spyrou | 7362f0d | 2017-10-18 17:58:22 +0100 | [diff] [blame] | 226 | { |
| 227 | validate(Accessor(_target), _reference, tolerance_f32); |
| 228 | } |
Giorgio Arena | 7657224 | 2018-04-04 17:44:26 +0100 | [diff] [blame] | 229 | FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthwiseConvolutionLayerFixture3x3<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset3x3(), |
| 230 | depth_multipliers), |
Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 231 | framework::dataset::make("DataType", |
Giorgio Arena | 1ed1fc6 | 2018-03-26 16:20:05 +0100 | [diff] [blame] | 232 | DataType::F32)), |
Giorgio Arena | 26b2216 | 2018-08-13 15:49:49 +0100 | [diff] [blame] | 233 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
Michalis Spyrou | 7362f0d | 2017-10-18 17:58:22 +0100 | [diff] [blame] | 234 | { |
| 235 | validate(Accessor(_target), _reference, tolerance_f32); |
| 236 | } |
Giorgio Arena | 7657224 | 2018-04-04 17:44:26 +0100 | [diff] [blame] | 237 | FIXTURE_DATA_TEST_CASE(RunOptimized, NEDepthwiseConvolutionLayerFixture3x3<float>, framework::DatasetMode::ALL, combine(combine(combine(datasets::OptimizedDepthwiseConvolutionLayerDataset3x3(), |
| 238 | framework::dataset::make("DepthMultiplier", 1)), |
Georgios Pinitas | 4074c99 | 2018-01-30 18:13:46 +0000 | [diff] [blame] | 239 | framework::dataset::make("DataType", |
Giorgio Arena | 1ed1fc6 | 2018-03-26 16:20:05 +0100 | [diff] [blame] | 240 | DataType::F32)), |
| 241 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
Georgios Pinitas | 4074c99 | 2018-01-30 18:13:46 +0000 | [diff] [blame] | 242 | { |
| 243 | validate(Accessor(_target), _reference, tolerance_f32); |
| 244 | } |
Georgios Pinitas | 20c246a | 2018-09-12 16:45:53 +0100 | [diff] [blame] | 245 | TEST_SUITE_END() // W3x3 |
| 246 | TEST_SUITE_END() // F32 |
Pablo Tello | 941cd70 | 2017-12-12 14:35:00 +0000 | [diff] [blame] | 247 | |
Georgios Pinitas | 20c246a | 2018-09-12 16:45:53 +0100 | [diff] [blame] | 248 | #ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC |
| 249 | TEST_SUITE(F16) |
Georgios Pinitas | 8cffcd6 | 2018-11-16 17:11:50 +0000 | [diff] [blame] | 250 | TEST_SUITE(Generic) |
| 251 | template <typename T> |
| 252 | using NEDepthwiseConvolutionLayerFixture = DepthwiseConvolutionLayerValidationFixture<Tensor, Accessor, NEDepthwiseConvolutionLayer, T>; |
| 253 | FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset(), |
| 254 | depth_multipliers), |
| 255 | framework::dataset::make("DataType", |
| 256 | DataType::F16)), |
| 257 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
| 258 | { |
| 259 | validate(Accessor(_target), _reference, tolerance_f16, tolerance_num); |
| 260 | } |
| 261 | FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset(), |
| 262 | depth_multipliers), |
| 263 | framework::dataset::make("DataType", |
| 264 | DataType::F16)), |
| 265 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
| 266 | { |
| 267 | validate(Accessor(_target), _reference, tolerance_f16, tolerance_num); |
| 268 | } |
| 269 | TEST_SUITE_END() // Generic |
Georgios Pinitas | 20c246a | 2018-09-12 16:45:53 +0100 | [diff] [blame] | 270 | TEST_SUITE(W3x3) |
| 271 | template <typename T> |
| 272 | using NEDepthwiseConvolutionLayerFixture3x3 = DepthwiseConvolutionLayerValidationFixture<Tensor, Accessor, NEDepthwiseConvolutionLayer3x3, T>; |
| 273 | FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthwiseConvolutionLayerFixture3x3<half>, framework::DatasetMode::ALL, combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset3x3(), |
| 274 | depth_multipliers), |
| 275 | framework::dataset::make("DataType", |
| 276 | DataType::F16)), |
| 277 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
| 278 | { |
| 279 | validate(Accessor(_target), _reference, tolerance_f16); |
| 280 | } |
| 281 | FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthwiseConvolutionLayerFixture3x3<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset3x3(), |
| 282 | depth_multipliers), |
| 283 | framework::dataset::make("DataType", |
| 284 | DataType::F16)), |
| 285 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
| 286 | { |
| 287 | validate(Accessor(_target), _reference, tolerance_f16); |
| 288 | } |
| 289 | FIXTURE_DATA_TEST_CASE(RunOptimized, NEDepthwiseConvolutionLayerFixture3x3<half>, framework::DatasetMode::ALL, combine(combine(combine(datasets::OptimizedDepthwiseConvolutionLayerDataset3x3(), |
| 290 | framework::dataset::make("DepthMultiplier", 1)), |
| 291 | framework::dataset::make("DataType", |
| 292 | DataType::F16)), |
| 293 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
| 294 | { |
| 295 | validate(Accessor(_target), _reference, tolerance_f16); |
| 296 | } |
| 297 | TEST_SUITE_END() // W3x3 |
| 298 | TEST_SUITE_END() // FP16 |
| 299 | #endif // __ARM_FEATURE_FP16_VECTOR_ARITHMETIC |
| 300 | |
| 301 | TEST_SUITE_END() // Float |
Michalis Spyrou | 7362f0d | 2017-10-18 17:58:22 +0100 | [diff] [blame] | 302 | |
Georgios Pinitas | f72f936 | 2018-01-12 16:29:45 +0000 | [diff] [blame] | 303 | template <typename T> |
| 304 | using NEDepthwiseConvolutionLayerQuantizedFixture3x3 = DepthwiseConvolutionLayerValidationQuantizedFixture<Tensor, Accessor, NEDepthwiseConvolutionLayer3x3, T>; |
Georgios Pinitas | d05dce4 | 2018-01-22 16:29:17 +0000 | [diff] [blame] | 305 | template <typename T> |
| 306 | using NEDepthwiseConvolutionLayerQuantizedFixture = DepthwiseConvolutionLayerValidationQuantizedFixture<Tensor, Accessor, NEDepthwiseConvolutionLayer, T>; |
Georgios Pinitas | f72f936 | 2018-01-12 16:29:45 +0000 | [diff] [blame] | 307 | |
| 308 | TEST_SUITE(Quantized) |
| 309 | TEST_SUITE(QASYMM8) |
Georgios Pinitas | d05dce4 | 2018-01-22 16:29:17 +0000 | [diff] [blame] | 310 | TEST_SUITE(Generic) |
Giorgio Arena | 7657224 | 2018-04-04 17:44:26 +0100 | [diff] [blame] | 311 | FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthwiseConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, |
| 312 | combine(combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset(), |
| 313 | depth_multipliers), |
Giorgio Arena | dfca60b | 2018-01-31 10:30:59 +0000 | [diff] [blame] | 314 | framework::dataset::make("DataType", DataType::QASYMM8)), |
| 315 | framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })), |
Giorgio Arena | 26b2216 | 2018-08-13 15:49:49 +0100 | [diff] [blame] | 316 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
Georgios Pinitas | f72f936 | 2018-01-12 16:29:45 +0000 | [diff] [blame] | 317 | { |
| 318 | validate(Accessor(_target), _reference, tolerance_qasymm8); |
| 319 | } |
Giorgio Arena | 7657224 | 2018-04-04 17:44:26 +0100 | [diff] [blame] | 320 | TEST_SUITE_END() |
| 321 | TEST_SUITE(W3x3) |
| 322 | FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthwiseConvolutionLayerQuantizedFixture3x3<uint8_t>, framework::DatasetMode::PRECOMMIT, |
| 323 | combine(combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset3x3(), depth_multipliers), |
| 324 | framework::dataset::make("DataType", DataType::QASYMM8)), |
| 325 | framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })), |
Giorgio Arena | 26b2216 | 2018-08-13 15:49:49 +0100 | [diff] [blame] | 326 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
Giorgio Arena | 7657224 | 2018-04-04 17:44:26 +0100 | [diff] [blame] | 327 | { |
| 328 | validate(Accessor(_target), _reference, tolerance_qasymm8); |
| 329 | } |
Georgios Pinitas | a799ce0 | 2018-09-12 20:11:34 +0100 | [diff] [blame] | 330 | FIXTURE_DATA_TEST_CASE(RunOptimized, NEDepthwiseConvolutionLayerQuantizedFixture3x3<uint8_t>, framework::DatasetMode::ALL, |
| 331 | combine(combine(combine(combine(datasets::OptimizedDepthwiseConvolutionLayerDataset3x3(), |
| 332 | framework::dataset::make("DepthMultiplier", 1)), |
| 333 | framework::dataset::make("DataType", |
| 334 | DataType::QASYMM8)), |
| 335 | framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })), |
| 336 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
| 337 | { |
| 338 | validate(Accessor(_target), _reference, tolerance_qasymm8); |
| 339 | } |
Giorgio Arena | 7657224 | 2018-04-04 17:44:26 +0100 | [diff] [blame] | 340 | FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthwiseConvolutionLayerQuantizedFixture3x3<uint8_t>, framework::DatasetMode::NIGHTLY, |
| 341 | combine(combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset3x3(), |
| 342 | depth_multipliers), |
| 343 | framework::dataset::make("DataType", DataType::QASYMM8)), |
| 344 | framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })), |
Giorgio Arena | 26b2216 | 2018-08-13 15:49:49 +0100 | [diff] [blame] | 345 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
Georgios Pinitas | f72f936 | 2018-01-12 16:29:45 +0000 | [diff] [blame] | 346 | { |
| 347 | validate(Accessor(_target), _reference, tolerance_qasymm8); |
| 348 | } |
| 349 | TEST_SUITE_END() |
| 350 | TEST_SUITE_END() |
| 351 | TEST_SUITE_END() |
| 352 | |
Michalis Spyrou | 7362f0d | 2017-10-18 17:58:22 +0100 | [diff] [blame] | 353 | TEST_SUITE_END() |
| 354 | TEST_SUITE_END() |
| 355 | } // namespace validation |
| 356 | } // namespace test |
| 357 | } // namespace arm_compute |