Michalis Spyrou | 7362f0d | 2017-10-18 17:58:22 +0100 | [diff] [blame] | 1 | /* |
Michalis Spyrou | aeebe4a | 2019-01-09 14:21:03 +0000 | [diff] [blame] | 2 | * Copyright (c) 2017-2019 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, |
Michalis Spyrou | aeebe4a | 2019-01-09 14:21:03 +0000 | [diff] [blame] | 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
Michalis Spyrou | 7362f0d | 2017-10-18 17:58:22 +0100 | [diff] [blame] | 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 */ |
Michalis Spyrou | aeebe4a | 2019-01-09 14:21:03 +0000 | [diff] [blame] | 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 | } |
Michalis Spyrou | aeebe4a | 2019-01-09 14:21:03 +0000 | [diff] [blame] | 237 | FIXTURE_DATA_TEST_CASE(RunOptimizedSmall, NEDepthwiseConvolutionLayerFixture3x3<float>, framework::DatasetMode::PRECOMMIT, |
| 238 | combine(combine(combine(datasets::SmallOptimizedDepthwiseConvolutionLayerDataset3x3(), |
| 239 | framework::dataset::make("DepthMultiplier", 1)), |
| 240 | framework::dataset::make("DataType", |
| 241 | DataType::F32)), |
| 242 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
| 243 | { |
| 244 | validate(Accessor(_target), _reference, tolerance_f32); |
| 245 | } |
| 246 | FIXTURE_DATA_TEST_CASE(RunOptimizedLarge, NEDepthwiseConvolutionLayerFixture3x3<float>, framework::DatasetMode::NIGHTLY, |
| 247 | combine(combine(combine(datasets::LargeOptimizedDepthwiseConvolutionLayerDataset3x3(), |
| 248 | framework::dataset::make("DepthMultiplier", 1)), |
| 249 | framework::dataset::make("DataType", |
| 250 | DataType::F32)), |
| 251 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
Georgios Pinitas | 4074c99 | 2018-01-30 18:13:46 +0000 | [diff] [blame] | 252 | { |
| 253 | validate(Accessor(_target), _reference, tolerance_f32); |
| 254 | } |
Georgios Pinitas | 20c246a | 2018-09-12 16:45:53 +0100 | [diff] [blame] | 255 | TEST_SUITE_END() // W3x3 |
| 256 | TEST_SUITE_END() // F32 |
Pablo Tello | 941cd70 | 2017-12-12 14:35:00 +0000 | [diff] [blame] | 257 | |
Georgios Pinitas | 20c246a | 2018-09-12 16:45:53 +0100 | [diff] [blame] | 258 | #ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC |
| 259 | TEST_SUITE(F16) |
Georgios Pinitas | 8cffcd6 | 2018-11-16 17:11:50 +0000 | [diff] [blame] | 260 | TEST_SUITE(Generic) |
| 261 | template <typename T> |
| 262 | using NEDepthwiseConvolutionLayerFixture = DepthwiseConvolutionLayerValidationFixture<Tensor, Accessor, NEDepthwiseConvolutionLayer, T>; |
| 263 | FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset(), |
| 264 | depth_multipliers), |
| 265 | framework::dataset::make("DataType", |
| 266 | DataType::F16)), |
| 267 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
| 268 | { |
| 269 | validate(Accessor(_target), _reference, tolerance_f16, tolerance_num); |
| 270 | } |
| 271 | FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset(), |
| 272 | depth_multipliers), |
| 273 | framework::dataset::make("DataType", |
| 274 | DataType::F16)), |
| 275 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
| 276 | { |
| 277 | validate(Accessor(_target), _reference, tolerance_f16, tolerance_num); |
| 278 | } |
| 279 | TEST_SUITE_END() // Generic |
Georgios Pinitas | 20c246a | 2018-09-12 16:45:53 +0100 | [diff] [blame] | 280 | TEST_SUITE(W3x3) |
| 281 | template <typename T> |
| 282 | using NEDepthwiseConvolutionLayerFixture3x3 = DepthwiseConvolutionLayerValidationFixture<Tensor, Accessor, NEDepthwiseConvolutionLayer3x3, T>; |
| 283 | FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthwiseConvolutionLayerFixture3x3<half>, framework::DatasetMode::ALL, combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset3x3(), |
| 284 | depth_multipliers), |
| 285 | framework::dataset::make("DataType", |
| 286 | DataType::F16)), |
| 287 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
| 288 | { |
| 289 | validate(Accessor(_target), _reference, tolerance_f16); |
| 290 | } |
| 291 | FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthwiseConvolutionLayerFixture3x3<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset3x3(), |
| 292 | depth_multipliers), |
| 293 | framework::dataset::make("DataType", |
| 294 | DataType::F16)), |
| 295 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
| 296 | { |
| 297 | validate(Accessor(_target), _reference, tolerance_f16); |
| 298 | } |
Michalis Spyrou | aeebe4a | 2019-01-09 14:21:03 +0000 | [diff] [blame] | 299 | FIXTURE_DATA_TEST_CASE(RunOptimizedSmall, NEDepthwiseConvolutionLayerFixture3x3<half>, framework::DatasetMode::PRECOMMIT, |
| 300 | combine(combine(combine(datasets::SmallOptimizedDepthwiseConvolutionLayerDataset3x3(), |
| 301 | framework::dataset::make("DepthMultiplier", 1)), |
| 302 | framework::dataset::make("DataType", |
| 303 | DataType::F16)), |
| 304 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
| 305 | { |
| 306 | validate(Accessor(_target), _reference, tolerance_f16); |
| 307 | } |
| 308 | FIXTURE_DATA_TEST_CASE(RunOptimizedLarge, NEDepthwiseConvolutionLayerFixture3x3<half>, framework::DatasetMode::NIGHTLY, |
| 309 | combine(combine(combine(datasets::LargeOptimizedDepthwiseConvolutionLayerDataset3x3(), |
| 310 | framework::dataset::make("DepthMultiplier", 1)), |
| 311 | framework::dataset::make("DataType", |
| 312 | DataType::F16)), |
| 313 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
Georgios Pinitas | 20c246a | 2018-09-12 16:45:53 +0100 | [diff] [blame] | 314 | { |
| 315 | validate(Accessor(_target), _reference, tolerance_f16); |
| 316 | } |
| 317 | TEST_SUITE_END() // W3x3 |
| 318 | TEST_SUITE_END() // FP16 |
| 319 | #endif // __ARM_FEATURE_FP16_VECTOR_ARITHMETIC |
| 320 | |
| 321 | TEST_SUITE_END() // Float |
Michalis Spyrou | 7362f0d | 2017-10-18 17:58:22 +0100 | [diff] [blame] | 322 | |
Georgios Pinitas | f72f936 | 2018-01-12 16:29:45 +0000 | [diff] [blame] | 323 | template <typename T> |
| 324 | using NEDepthwiseConvolutionLayerQuantizedFixture3x3 = DepthwiseConvolutionLayerValidationQuantizedFixture<Tensor, Accessor, NEDepthwiseConvolutionLayer3x3, T>; |
Georgios Pinitas | d05dce4 | 2018-01-22 16:29:17 +0000 | [diff] [blame] | 325 | template <typename T> |
| 326 | using NEDepthwiseConvolutionLayerQuantizedFixture = DepthwiseConvolutionLayerValidationQuantizedFixture<Tensor, Accessor, NEDepthwiseConvolutionLayer, T>; |
Georgios Pinitas | f72f936 | 2018-01-12 16:29:45 +0000 | [diff] [blame] | 327 | |
| 328 | TEST_SUITE(Quantized) |
| 329 | TEST_SUITE(QASYMM8) |
Georgios Pinitas | d05dce4 | 2018-01-22 16:29:17 +0000 | [diff] [blame] | 330 | TEST_SUITE(Generic) |
Giorgio Arena | 7657224 | 2018-04-04 17:44:26 +0100 | [diff] [blame] | 331 | FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthwiseConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, |
| 332 | combine(combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset(), |
| 333 | depth_multipliers), |
Giorgio Arena | dfca60b | 2018-01-31 10:30:59 +0000 | [diff] [blame] | 334 | framework::dataset::make("DataType", DataType::QASYMM8)), |
| 335 | framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })), |
Giorgio Arena | 26b2216 | 2018-08-13 15:49:49 +0100 | [diff] [blame] | 336 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
Georgios Pinitas | f72f936 | 2018-01-12 16:29:45 +0000 | [diff] [blame] | 337 | { |
| 338 | validate(Accessor(_target), _reference, tolerance_qasymm8); |
| 339 | } |
Michalis Spyrou | aeebe4a | 2019-01-09 14:21:03 +0000 | [diff] [blame] | 340 | TEST_SUITE_END() // Generic |
Giorgio Arena | 7657224 | 2018-04-04 17:44:26 +0100 | [diff] [blame] | 341 | TEST_SUITE(W3x3) |
| 342 | FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthwiseConvolutionLayerQuantizedFixture3x3<uint8_t>, framework::DatasetMode::PRECOMMIT, |
| 343 | combine(combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset3x3(), depth_multipliers), |
| 344 | framework::dataset::make("DataType", DataType::QASYMM8)), |
| 345 | framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })), |
Giorgio Arena | 26b2216 | 2018-08-13 15:49:49 +0100 | [diff] [blame] | 346 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
Giorgio Arena | 7657224 | 2018-04-04 17:44:26 +0100 | [diff] [blame] | 347 | { |
| 348 | validate(Accessor(_target), _reference, tolerance_qasymm8); |
| 349 | } |
Michalis Spyrou | aeebe4a | 2019-01-09 14:21:03 +0000 | [diff] [blame] | 350 | FIXTURE_DATA_TEST_CASE(RunOptimizedSmall, NEDepthwiseConvolutionLayerQuantizedFixture3x3<uint8_t>, framework::DatasetMode::PRECOMMIT, |
| 351 | combine(combine(combine(combine(datasets::SmallOptimizedDepthwiseConvolutionLayerDataset3x3(), |
| 352 | framework::dataset::make("DepthMultiplier", 1)), |
| 353 | framework::dataset::make("DataType", |
| 354 | DataType::QASYMM8)), |
| 355 | framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })), |
| 356 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
| 357 | { |
| 358 | validate(Accessor(_target), _reference, tolerance_qasymm8); |
| 359 | } |
| 360 | FIXTURE_DATA_TEST_CASE(RunOptimizedLarge, NEDepthwiseConvolutionLayerQuantizedFixture3x3<uint8_t>, framework::DatasetMode::NIGHTLY, |
| 361 | combine(combine(combine(combine(datasets::LargeOptimizedDepthwiseConvolutionLayerDataset3x3(), |
Georgios Pinitas | a799ce0 | 2018-09-12 20:11:34 +0100 | [diff] [blame] | 362 | framework::dataset::make("DepthMultiplier", 1)), |
| 363 | framework::dataset::make("DataType", |
| 364 | DataType::QASYMM8)), |
| 365 | framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })), |
| 366 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
| 367 | { |
| 368 | validate(Accessor(_target), _reference, tolerance_qasymm8); |
| 369 | } |
Giorgio Arena | 7657224 | 2018-04-04 17:44:26 +0100 | [diff] [blame] | 370 | FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthwiseConvolutionLayerQuantizedFixture3x3<uint8_t>, framework::DatasetMode::NIGHTLY, |
| 371 | combine(combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset3x3(), |
| 372 | depth_multipliers), |
| 373 | framework::dataset::make("DataType", DataType::QASYMM8)), |
| 374 | framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })), |
Giorgio Arena | 26b2216 | 2018-08-13 15:49:49 +0100 | [diff] [blame] | 375 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
Georgios Pinitas | f72f936 | 2018-01-12 16:29:45 +0000 | [diff] [blame] | 376 | { |
| 377 | validate(Accessor(_target), _reference, tolerance_qasymm8); |
| 378 | } |
Michalis Spyrou | aeebe4a | 2019-01-09 14:21:03 +0000 | [diff] [blame] | 379 | TEST_SUITE_END() // W3x3 |
| 380 | TEST_SUITE_END() // QASYMM8 |
| 381 | TEST_SUITE_END() // Quantized |
Georgios Pinitas | f72f936 | 2018-01-12 16:29:45 +0000 | [diff] [blame] | 382 | |
Michalis Spyrou | aeebe4a | 2019-01-09 14:21:03 +0000 | [diff] [blame] | 383 | TEST_SUITE_END() // DepthwiseConvLayer |
| 384 | TEST_SUITE_END() // NEON |
Michalis Spyrou | 7362f0d | 2017-10-18 17:58:22 +0100 | [diff] [blame] | 385 | } // namespace validation |
| 386 | } // namespace test |
| 387 | } // namespace arm_compute |