Giorgio Arena | 93a690e | 2017-08-01 16:09:33 +0100 | [diff] [blame] | 1 | /* |
Viet-Hoa Do | cd2502c | 2023-05-11 16:13:24 +0100 | [diff] [blame] | 2 | * Copyright (c) 2017-2021, 2023 Arm Limited. |
Giorgio Arena | 93a690e | 2017-08-01 16:09:33 +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 | */ |
ramy.elgammal@arm.com | a04ae3e | 2023-07-27 18:23:17 +0100 | [diff] [blame] | 24 | #ifndef ACL_TESTS_DATASETS_DEPTHWISECONVOLUTIONLAYERDATASET_H |
| 25 | #define ACL_TESTS_DATASETS_DEPTHWISECONVOLUTIONLAYERDATASET_H |
Giorgio Arena | 93a690e | 2017-08-01 16:09:33 +0100 | [diff] [blame] | 26 | |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 27 | #include "utils/TypePrinter.h" |
Giorgio Arena | 93a690e | 2017-08-01 16:09:33 +0100 | [diff] [blame] | 28 | |
| 29 | #include "arm_compute/core/TensorShape.h" |
| 30 | #include "arm_compute/core/Types.h" |
| 31 | |
| 32 | namespace arm_compute |
| 33 | { |
| 34 | namespace test |
| 35 | { |
| 36 | namespace datasets |
| 37 | { |
Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 38 | class DepthwiseConvolutionLayerDataset |
Giorgio Arena | 93a690e | 2017-08-01 16:09:33 +0100 | [diff] [blame] | 39 | { |
| 40 | public: |
Usama Arif | e73686a | 2019-04-08 17:30:48 +0100 | [diff] [blame] | 41 | using type = std::tuple<TensorShape, Size2D, PadStrideInfo, Size2D>; |
Giorgio Arena | 93a690e | 2017-08-01 16:09:33 +0100 | [diff] [blame] | 42 | |
| 43 | struct iterator |
| 44 | { |
| 45 | iterator(std::vector<TensorShape>::const_iterator src_it, |
Giorgio Arena | 7657224 | 2018-04-04 17:44:26 +0100 | [diff] [blame] | 46 | std::vector<Size2D>::const_iterator weights_it, |
Usama Arif | e73686a | 2019-04-08 17:30:48 +0100 | [diff] [blame] | 47 | std::vector<PadStrideInfo>::const_iterator infos_it, |
| 48 | std::vector<Size2D>::const_iterator dilation_it) |
Giorgio Arena | 93a690e | 2017-08-01 16:09:33 +0100 | [diff] [blame] | 49 | : _src_it{ std::move(src_it) }, |
| 50 | _weights_it{ std::move(weights_it) }, |
Usama Arif | e73686a | 2019-04-08 17:30:48 +0100 | [diff] [blame] | 51 | _infos_it{ std::move(infos_it) }, |
| 52 | _dilation_it{ std::move(dilation_it) } |
Giorgio Arena | 93a690e | 2017-08-01 16:09:33 +0100 | [diff] [blame] | 53 | { |
| 54 | } |
| 55 | |
| 56 | std::string description() const |
| 57 | { |
| 58 | std::stringstream description; |
| 59 | description << "In=" << *_src_it << ":"; |
| 60 | description << "Weights=" << *_weights_it << ":"; |
Usama Arif | e73686a | 2019-04-08 17:30:48 +0100 | [diff] [blame] | 61 | description << "Info=" << *_infos_it << ":"; |
| 62 | description << "Dilation=" << *_dilation_it; |
Giorgio Arena | 93a690e | 2017-08-01 16:09:33 +0100 | [diff] [blame] | 63 | return description.str(); |
| 64 | } |
| 65 | |
Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 66 | DepthwiseConvolutionLayerDataset::type operator*() const |
Giorgio Arena | 93a690e | 2017-08-01 16:09:33 +0100 | [diff] [blame] | 67 | { |
Usama Arif | e73686a | 2019-04-08 17:30:48 +0100 | [diff] [blame] | 68 | return std::make_tuple(*_src_it, *_weights_it, *_infos_it, *_dilation_it); |
Giorgio Arena | 93a690e | 2017-08-01 16:09:33 +0100 | [diff] [blame] | 69 | } |
| 70 | |
| 71 | iterator &operator++() |
| 72 | { |
| 73 | ++_src_it; |
| 74 | ++_weights_it; |
Giorgio Arena | 93a690e | 2017-08-01 16:09:33 +0100 | [diff] [blame] | 75 | ++_infos_it; |
Usama Arif | e73686a | 2019-04-08 17:30:48 +0100 | [diff] [blame] | 76 | ++_dilation_it; |
Giorgio Arena | 93a690e | 2017-08-01 16:09:33 +0100 | [diff] [blame] | 77 | |
| 78 | return *this; |
| 79 | } |
| 80 | |
| 81 | private: |
| 82 | std::vector<TensorShape>::const_iterator _src_it; |
Giorgio Arena | 7657224 | 2018-04-04 17:44:26 +0100 | [diff] [blame] | 83 | std::vector<Size2D>::const_iterator _weights_it; |
Giorgio Arena | 93a690e | 2017-08-01 16:09:33 +0100 | [diff] [blame] | 84 | std::vector<PadStrideInfo>::const_iterator _infos_it; |
Usama Arif | e73686a | 2019-04-08 17:30:48 +0100 | [diff] [blame] | 85 | std::vector<Size2D>::const_iterator _dilation_it; |
Giorgio Arena | 93a690e | 2017-08-01 16:09:33 +0100 | [diff] [blame] | 86 | }; |
| 87 | |
| 88 | iterator begin() const |
| 89 | { |
Usama Arif | e73686a | 2019-04-08 17:30:48 +0100 | [diff] [blame] | 90 | return iterator(_src_shapes.begin(), _weight_shapes.begin(), _infos.begin(), _dilations.begin()); |
Giorgio Arena | 93a690e | 2017-08-01 16:09:33 +0100 | [diff] [blame] | 91 | } |
| 92 | |
| 93 | int size() const |
| 94 | { |
Usama Arif | e73686a | 2019-04-08 17:30:48 +0100 | [diff] [blame] | 95 | return std::min(_src_shapes.size(), std::min(_weight_shapes.size(), std::min(_infos.size(), _dilations.size()))); |
Giorgio Arena | 93a690e | 2017-08-01 16:09:33 +0100 | [diff] [blame] | 96 | } |
| 97 | |
Usama Arif | e73686a | 2019-04-08 17:30:48 +0100 | [diff] [blame] | 98 | void add_config(TensorShape src, Size2D weights, PadStrideInfo info, Size2D dilation = Size2D(1U, 1U)) |
Giorgio Arena | 93a690e | 2017-08-01 16:09:33 +0100 | [diff] [blame] | 99 | { |
| 100 | _src_shapes.emplace_back(std::move(src)); |
| 101 | _weight_shapes.emplace_back(std::move(weights)); |
Giorgio Arena | 93a690e | 2017-08-01 16:09:33 +0100 | [diff] [blame] | 102 | _infos.emplace_back(std::move(info)); |
Usama Arif | e73686a | 2019-04-08 17:30:48 +0100 | [diff] [blame] | 103 | _dilations.emplace_back(std::move(dilation)); |
Giorgio Arena | 93a690e | 2017-08-01 16:09:33 +0100 | [diff] [blame] | 104 | } |
| 105 | |
| 106 | protected: |
Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 107 | DepthwiseConvolutionLayerDataset() = default; |
| 108 | DepthwiseConvolutionLayerDataset(DepthwiseConvolutionLayerDataset &&) = default; |
Giorgio Arena | 93a690e | 2017-08-01 16:09:33 +0100 | [diff] [blame] | 109 | |
| 110 | private: |
| 111 | std::vector<TensorShape> _src_shapes{}; |
Giorgio Arena | 7657224 | 2018-04-04 17:44:26 +0100 | [diff] [blame] | 112 | std::vector<Size2D> _weight_shapes{}; |
Giorgio Arena | 93a690e | 2017-08-01 16:09:33 +0100 | [diff] [blame] | 113 | std::vector<PadStrideInfo> _infos{}; |
Usama Arif | e73686a | 2019-04-08 17:30:48 +0100 | [diff] [blame] | 114 | std::vector<Size2D> _dilations{}; |
Giorgio Arena | 93a690e | 2017-08-01 16:09:33 +0100 | [diff] [blame] | 115 | }; |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 116 | |
| 117 | /** Dataset containing small, generic depthwise convolution shapes. */ |
Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 118 | class SmallDepthwiseConvolutionLayerDataset final : public DepthwiseConvolutionLayerDataset |
Giorgio Arena | 9fe4144 | 2017-08-23 16:36:24 +0100 | [diff] [blame] | 119 | { |
| 120 | public: |
Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 121 | SmallDepthwiseConvolutionLayerDataset() |
Giorgio Arena | 9fe4144 | 2017-08-23 16:36:24 +0100 | [diff] [blame] | 122 | { |
Michele Di Giorgio | a046e16 | 2019-10-08 09:36:26 +0100 | [diff] [blame] | 123 | add_config(TensorShape(7U, 7U, 1U), Size2D(1U, 1U), PadStrideInfo(1, 1, 0, 0)); |
Gian Marco Iodice | 8155c02 | 2021-04-16 15:08:59 +0100 | [diff] [blame] | 124 | add_config(TensorShape(3U, 3U, 2U), Size2D(2U, 2U), PadStrideInfo(1, 1, 0, 0)); |
Giorgio Arena | 7657224 | 2018-04-04 17:44:26 +0100 | [diff] [blame] | 125 | add_config(TensorShape(33U, 27U, 7U), Size2D(7U, 3U), PadStrideInfo(3, 2, 1, 0)); |
Jaroslaw Rzepecki | a1ed41f | 2017-10-13 11:13:58 +0100 | [diff] [blame] | 126 | // Asymmetric padding |
Giorgio Arena | 7657224 | 2018-04-04 17:44:26 +0100 | [diff] [blame] | 127 | add_config(TensorShape(33U, 27U, 7U), Size2D(5U, 7U), PadStrideInfo(3, 2, 1, 1, 2, 0, DimensionRoundingType::FLOOR)); |
| 128 | add_config(TensorShape(33U, 27U, 7U), Size2D(5U, 7U), PadStrideInfo(3, 2, 1, 1, 0, 2, DimensionRoundingType::FLOOR)); |
Giorgio Arena | aadf846 | 2019-12-19 09:35:40 +0000 | [diff] [blame] | 129 | // Ceil rounding |
ramy.elgammal@arm.com | a04ae3e | 2023-07-27 18:23:17 +0100 | [diff] [blame] | 130 | add_config(TensorShape(7U, 8U, 5U, 9U), Size2D(8U, 6U), PadStrideInfo(2, 3, 1, 1, 1, 3, DimensionRoundingType::CEIL)); |
Giorgio Arena | 9fe4144 | 2017-08-23 16:36:24 +0100 | [diff] [blame] | 131 | } |
| 132 | }; |
| 133 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 134 | /** Dataset containing large, generic depthwise convolution shapes. */ |
Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 135 | class LargeDepthwiseConvolutionLayerDataset final : public DepthwiseConvolutionLayerDataset |
Giorgio Arena | 9fe4144 | 2017-08-23 16:36:24 +0100 | [diff] [blame] | 136 | { |
| 137 | public: |
Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 138 | LargeDepthwiseConvolutionLayerDataset() |
Giorgio Arena | 9fe4144 | 2017-08-23 16:36:24 +0100 | [diff] [blame] | 139 | { |
Michele Di Giorgio | a046e16 | 2019-10-08 09:36:26 +0100 | [diff] [blame] | 140 | add_config(TensorShape(33U, 27U, 11U), Size2D(3U, 4U), PadStrideInfo(1, 2, 0, 1)); |
Viet-Hoa Do | cd2502c | 2023-05-11 16:13:24 +0100 | [diff] [blame] | 141 | add_config(TensorShape(17U, 31U, 2U), Size2D(13U, 9U), PadStrideInfo(1, 2, 1, 1)); |
Michalis Spyrou | aeebe4a | 2019-01-09 14:21:03 +0000 | [diff] [blame] | 142 | add_config(TensorShape(23U, 27U, 5U), Size2D(11U, 3U), PadStrideInfo(1, 2, 0, 0)); |
| 143 | add_config(TensorShape(17U, 31U, 2U, 3U), Size2D(5U, 9U), PadStrideInfo(1, 2, 1, 1)); |
Gunes Bayir | 3af4c9b | 2023-10-08 17:51:28 +0100 | [diff] [blame] | 144 | add_config(TensorShape(133U, 127U, 55U), Size2D(1U, 1U), PadStrideInfo(2, 1, 0, 0)); |
| 145 | add_config(TensorShape(233U, 109U, 77U), Size2D(1U, 1U), PadStrideInfo(3, 2, 1, 0)); |
| 146 | add_config(TensorShape(177U, 111U, 22U), Size2D(3U, 4U), PadStrideInfo(1, 2, 1, 1)); |
| 147 | add_config(TensorShape(233U, 87U, 55U), Size2D(3U, 4U), PadStrideInfo(1, 2, 0, 0)); |
| 148 | add_config(TensorShape(333U, 79U, 77U), Size2D(3U, 4U), PadStrideInfo(2, 3, 0, 1)); |
| 149 | add_config(TensorShape(67U, 211U, 22U), Size2D(3U, 4U), PadStrideInfo(2, 1, 1, 1)); |
Michalis Spyrou | aeebe4a | 2019-01-09 14:21:03 +0000 | [diff] [blame] | 150 | // Asymmetric padding |
| 151 | add_config(TensorShape(33U, 27U, 7U), Size2D(5U, 7U), PadStrideInfo(3, 2, 2, 1, 2, 0, DimensionRoundingType::FLOOR)); |
| 152 | add_config(TensorShape(33U, 27U, 7U), Size2D(5U, 7U), PadStrideInfo(3, 2, 1, 3, 0, 2, DimensionRoundingType::FLOOR)); |
| 153 | add_config(TensorShape(33U, 27U, 7U), Size2D(5U, 7U), PadStrideInfo(3, 2, 1, 0, 1, 0, DimensionRoundingType::FLOOR)); |
| 154 | add_config(TensorShape(33U, 27U, 7U), Size2D(5U, 7U), PadStrideInfo(3, 2, 0, 1, 0, 1, DimensionRoundingType::FLOOR)); |
Viet-Hoa Do | 8eb82d2 | 2023-06-21 10:39:48 +0100 | [diff] [blame] | 155 | // Padding greater than kernel size. |
| 156 | add_config(TensorShape(128, 56, 56), Size2D(4, 4), PadStrideInfo(2, 2, 0, 10, 0, 10, DimensionRoundingType::FLOOR)); |
Giorgio Arena | 9fe4144 | 2017-08-23 16:36:24 +0100 | [diff] [blame] | 157 | } |
| 158 | }; |
| 159 | |
Gunes Bayir | 3af4c9b | 2023-10-08 17:51:28 +0100 | [diff] [blame] | 160 | class LargeDepthwiseConvolutionLayerDatasetFp16Subset final : public DepthwiseConvolutionLayerDataset |
| 161 | { |
| 162 | public: |
| 163 | LargeDepthwiseConvolutionLayerDatasetFp16Subset() |
| 164 | { |
| 165 | add_config(TensorShape(33U, 27U, 11U), Size2D(3U, 4U), PadStrideInfo(1, 2, 0, 1)); |
| 166 | add_config(TensorShape(17U, 31U, 2U, 3U), Size2D(5U, 9U), PadStrideInfo(1, 2, 1, 1)); |
| 167 | add_config(TensorShape(233U, 109U, 77U), Size2D(1U, 1U), PadStrideInfo(3, 2, 1, 0)); |
| 168 | add_config(TensorShape(177U, 111U, 22U), Size2D(3U, 4U), PadStrideInfo(1, 2, 1, 1)); |
| 169 | add_config(TensorShape(67U, 211U, 22U), Size2D(3U, 4U), PadStrideInfo(2, 1, 1, 1)); |
| 170 | // Asymmetric padding |
| 171 | add_config(TensorShape(33U, 27U, 7U), Size2D(5U, 7U), PadStrideInfo(3, 2, 1, 3, 0, 2, DimensionRoundingType::FLOOR)); |
| 172 | add_config(TensorShape(33U, 27U, 7U), Size2D(5U, 7U), PadStrideInfo(3, 2, 1, 0, 1, 0, DimensionRoundingType::FLOOR)); |
| 173 | // Padding greater than kernel size. |
| 174 | add_config(TensorShape(128, 56, 56), Size2D(4, 4), PadStrideInfo(2, 2, 0, 10, 0, 10, DimensionRoundingType::FLOOR)); |
| 175 | } |
| 176 | }; |
| 177 | |
Gian Marco Iodice | 5e28181 | 2021-07-06 13:19:41 +0100 | [diff] [blame] | 178 | /** Dataset containing large kernel size for generic depthwise convolution. */ |
| 179 | class LargeKernelSizeDepthwiseConvolutionLayerNHWCDataset final : public DepthwiseConvolutionLayerDataset |
| 180 | { |
| 181 | public: |
| 182 | LargeKernelSizeDepthwiseConvolutionLayerNHWCDataset() |
| 183 | { |
| 184 | add_config(TensorShape(6U, 210U, 8U), Size2D(4U, 194U), PadStrideInfo(1, 1, 0, 0)); |
| 185 | } |
| 186 | }; |
| 187 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 188 | /** Dataset containing small, 3x3 depthwise convolution shapes. */ |
Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 189 | class SmallDepthwiseConvolutionLayerDataset3x3 final : public DepthwiseConvolutionLayerDataset |
Georgios Pinitas | c26ecf8 | 2017-09-22 13:44:05 +0100 | [diff] [blame] | 190 | { |
| 191 | public: |
Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 192 | SmallDepthwiseConvolutionLayerDataset3x3() |
Georgios Pinitas | c26ecf8 | 2017-09-22 13:44:05 +0100 | [diff] [blame] | 193 | { |
Giorgio Arena | 15bc848 | 2020-12-08 14:34:00 +0000 | [diff] [blame] | 194 | add_config(TensorShape(1U, 1U, 2U), Size2D(3U, 3U), PadStrideInfo(1, 1, 2, 2)); |
Giorgio Arena | 1e2af2a | 2020-10-15 17:39:41 +0100 | [diff] [blame] | 195 | add_config(TensorShape(7U, 8U, 3U, 2U), Size2D(3U, 3U), PadStrideInfo(1, 1, 0, 0)); |
Giorgio Arena | 15bc848 | 2020-12-08 14:34:00 +0000 | [diff] [blame] | 196 | add_config(TensorShape(32U, 31U, 9U, 4U), Size2D(3U, 3U), PadStrideInfo(1, 1, 0, 0)); |
Georgios Pinitas | 1599787 | 2018-02-19 13:58:22 +0000 | [diff] [blame] | 197 | // Asymmetric padding |
Giorgio Arena | 7657224 | 2018-04-04 17:44:26 +0100 | [diff] [blame] | 198 | add_config(TensorShape(33U, 27U, 11U), Size2D(3U, 3U), PadStrideInfo(2, 2, 0, 1, 0, 1, DimensionRoundingType::FLOOR)); |
Giorgio Arena | dfca60b | 2018-01-31 10:30:59 +0000 | [diff] [blame] | 199 | } |
| 200 | }; |
| 201 | |
| 202 | class SmallDepthwiseConvolutionLayerDataset3x3NCHW final : public DepthwiseConvolutionLayerDataset |
| 203 | { |
| 204 | public: |
| 205 | SmallDepthwiseConvolutionLayerDataset3x3NCHW() |
| 206 | { |
Giorgio Arena | 7657224 | 2018-04-04 17:44:26 +0100 | [diff] [blame] | 207 | add_config(TensorShape(33U, 27U, 11U), Size2D(3U, 3U), PadStrideInfo(3, 2, 1, 1)); |
Giorgio Arena | dfca60b | 2018-01-31 10:30:59 +0000 | [diff] [blame] | 208 | // Asymmetric padding |
Giorgio Arena | 7657224 | 2018-04-04 17:44:26 +0100 | [diff] [blame] | 209 | add_config(TensorShape(33U, 27U, 11U), Size2D(3U, 3U), PadStrideInfo(2, 2, 3, 1, 2, 1, DimensionRoundingType::FLOOR)); |
Georgios Pinitas | c26ecf8 | 2017-09-22 13:44:05 +0100 | [diff] [blame] | 210 | } |
| 211 | }; |
| 212 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 213 | /** Dataset containing large, 3x3 depthwise convolution shapes. */ |
Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 214 | class LargeDepthwiseConvolutionLayerDataset3x3 final : public DepthwiseConvolutionLayerDataset |
Georgios Pinitas | c26ecf8 | 2017-09-22 13:44:05 +0100 | [diff] [blame] | 215 | { |
| 216 | public: |
Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 217 | LargeDepthwiseConvolutionLayerDataset3x3() |
Georgios Pinitas | c26ecf8 | 2017-09-22 13:44:05 +0100 | [diff] [blame] | 218 | { |
Michalis Spyrou | aeebe4a | 2019-01-09 14:21:03 +0000 | [diff] [blame] | 219 | add_config(TensorShape(21U, 31U, 9U, 4U), Size2D(3U, 3U), PadStrideInfo(1, 2, 1, 0)); |
Michalis Spyrou | aeebe4a | 2019-01-09 14:21:03 +0000 | [diff] [blame] | 220 | add_config(TensorShape(21U, 31U, 9U, 4U), Size2D(3U, 3U), PadStrideInfo(2, 1, 1, 0)); |
Gunes Bayir | 3af4c9b | 2023-10-08 17:51:28 +0100 | [diff] [blame] | 221 | add_config(TensorShape(21U, 31U, 9U, 4U), Size2D(3U, 3U), PadStrideInfo(2, 2, 1, 2)); |
| 222 | |
| 223 | add_config(TensorShape(33U, 27U, 11U, 3U), Size2D(3U, 3U), PadStrideInfo(1, 1, 1, 1)); |
| 224 | add_config(TensorShape(33U, 27U, 11U, 3U), Size2D(3U, 3U), PadStrideInfo(1, 2, 1, 2)); |
Michalis Spyrou | aeebe4a | 2019-01-09 14:21:03 +0000 | [diff] [blame] | 225 | add_config(TensorShape(33U, 27U, 11U, 3U), Size2D(3U, 3U), PadStrideInfo(2, 1, 0, 1)); |
Gunes Bayir | 3af4c9b | 2023-10-08 17:51:28 +0100 | [diff] [blame] | 226 | add_config(TensorShape(33U, 27U, 11U, 3U), Size2D(3U, 3U), PadStrideInfo(2, 2, 2, 1)); |
| 227 | |
| 228 | add_config(TensorShape(77U, 209U, 22U), Size2D(3U, 3U), PadStrideInfo(1, 2, 1, 1)); |
| 229 | add_config(TensorShape(123U, 76U, 55U), Size2D(3U, 3U), PadStrideInfo(1, 2, 0, 0)); |
| 230 | add_config(TensorShape(133U, 277U, 77U), Size2D(3U, 3U), PadStrideInfo(2, 3, 0, 0)); |
| 231 | add_config(TensorShape(77U, 95U, 22U), Size2D(3U, 3U), PadStrideInfo(2, 1, 1, 1)); |
| 232 | |
| 233 | // Width and height are a multiple of the processing tile size |
| 234 | add_config(TensorShape(32U, 21U, 11U, 3U), Size2D(3U, 3U), PadStrideInfo(1, 1, 0, 1)); |
| 235 | } |
| 236 | }; |
| 237 | |
| 238 | class LargeDepthwiseConvolutionLayerDataset3x3Fp16Subset final : public DepthwiseConvolutionLayerDataset |
| 239 | { |
| 240 | public: |
| 241 | LargeDepthwiseConvolutionLayerDataset3x3Fp16Subset() |
| 242 | { |
| 243 | add_config(TensorShape(21U, 31U, 9U, 4U), Size2D(3U, 3U), PadStrideInfo(2, 2, 1, 2)); |
| 244 | |
| 245 | add_config(TensorShape(33U, 27U, 11U, 3U), Size2D(3U, 3U), PadStrideInfo(1, 2, 1, 2)); |
| 246 | add_config(TensorShape(33U, 27U, 11U, 3U), Size2D(3U, 3U), PadStrideInfo(2, 1, 0, 1)); |
| 247 | |
| 248 | add_config(TensorShape(123U, 76U, 55U), Size2D(3U, 3U), PadStrideInfo(1, 2, 0, 0)); |
| 249 | add_config(TensorShape(77U, 95U, 22U), Size2D(3U, 3U), PadStrideInfo(2, 1, 1, 1)); |
| 250 | |
| 251 | // Width and height are a multiple of the processing tile size |
Giorgio Arena | 15bc848 | 2020-12-08 14:34:00 +0000 | [diff] [blame] | 252 | add_config(TensorShape(32U, 21U, 11U, 3U), Size2D(3U, 3U), PadStrideInfo(1, 1, 0, 1)); |
Georgios Pinitas | c26ecf8 | 2017-09-22 13:44:05 +0100 | [diff] [blame] | 253 | } |
| 254 | }; |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 255 | |
| 256 | /** Dataset containing optimized, 3x3 depthwise convolution shapes. */ |
Michalis Spyrou | aeebe4a | 2019-01-09 14:21:03 +0000 | [diff] [blame] | 257 | class SmallOptimizedDepthwiseConvolutionLayerDataset3x3 final : public DepthwiseConvolutionLayerDataset |
Georgios Pinitas | 4074c99 | 2018-01-30 18:13:46 +0000 | [diff] [blame] | 258 | { |
| 259 | public: |
Michalis Spyrou | aeebe4a | 2019-01-09 14:21:03 +0000 | [diff] [blame] | 260 | SmallOptimizedDepthwiseConvolutionLayerDataset3x3() |
Georgios Pinitas | 4074c99 | 2018-01-30 18:13:46 +0000 | [diff] [blame] | 261 | { |
| 262 | // Stride 1 |
Giorgio Arena | 7657224 | 2018-04-04 17:44:26 +0100 | [diff] [blame] | 263 | add_config(TensorShape(7U, 7U, 16U), Size2D(3U, 3U), PadStrideInfo(1, 1, 0, 0, DimensionRoundingType::CEIL)); |
Georgios Pinitas | 4c75851 | 2019-07-10 19:49:11 +0100 | [diff] [blame] | 264 | add_config(TensorShape(7U, 7U, 16U), Size2D(3U, 3U), PadStrideInfo(1, 1, 0, 0, DimensionRoundingType::CEIL), Size2D(2U, 2U)); |
Giorgio Arena | 7657224 | 2018-04-04 17:44:26 +0100 | [diff] [blame] | 265 | add_config(TensorShape(7U, 7U, 16U), Size2D(3U, 3U), PadStrideInfo(1, 1, 1, 1, DimensionRoundingType::CEIL)); |
Georgios Pinitas | 4c75851 | 2019-07-10 19:49:11 +0100 | [diff] [blame] | 266 | add_config(TensorShape(7U, 7U, 16U), Size2D(3U, 3U), PadStrideInfo(1, 1, 2, 2, DimensionRoundingType::CEIL), Size2D(2U, 2U)); |
Michalis Spyrou | aeebe4a | 2019-01-09 14:21:03 +0000 | [diff] [blame] | 267 | // Stride 2 |
Georgios Pinitas | 4c75851 | 2019-07-10 19:49:11 +0100 | [diff] [blame] | 268 | add_config(TensorShape(9U, 9U, 32U), Size2D(3U, 3U), PadStrideInfo(2, 2, 0, 0, DimensionRoundingType::CEIL)); |
| 269 | add_config(TensorShape(9U, 9U, 32U), Size2D(3U, 3U), PadStrideInfo(2, 2, 0, 0, DimensionRoundingType::CEIL), Size2D(2U, 2U)); |
| 270 | add_config(TensorShape(9U, 9U, 32U), Size2D(3U, 3U), PadStrideInfo(2, 2, 1, 1, DimensionRoundingType::CEIL)); |
Michalis Spyrou | aeebe4a | 2019-01-09 14:21:03 +0000 | [diff] [blame] | 271 | } |
| 272 | }; |
| 273 | /** Dataset containing optimized, 3x3 depthwise convolution shapes. */ |
| 274 | class LargeOptimizedDepthwiseConvolutionLayerDataset3x3 final : public DepthwiseConvolutionLayerDataset |
| 275 | { |
| 276 | public: |
| 277 | LargeOptimizedDepthwiseConvolutionLayerDataset3x3() |
| 278 | { |
| 279 | // Stride 1 |
Gunes Bayir | 3af4c9b | 2023-10-08 17:51:28 +0100 | [diff] [blame] | 280 | add_config(TensorShape(233U, 173U, 16U), Size2D(3U, 3U), PadStrideInfo(1, 1, 0, 0, DimensionRoundingType::CEIL)); |
| 281 | add_config(TensorShape(133U, 7U, 16U), Size2D(3U, 3U), PadStrideInfo(1, 1, 1, 1, DimensionRoundingType::CEIL)); |
Georgios Pinitas | a799ce0 | 2018-09-12 20:11:34 +0100 | [diff] [blame] | 282 | add_config(TensorShape(7U, 7U, 21U), Size2D(3U, 3U), PadStrideInfo(1, 1, 1, 1, DimensionRoundingType::CEIL)); |
Giorgio Arena | 7657224 | 2018-04-04 17:44:26 +0100 | [diff] [blame] | 283 | add_config(TensorShape(28U, 28U, 16U), Size2D(3U, 3U), PadStrideInfo(1, 1, 0, 0, DimensionRoundingType::CEIL)); |
| 284 | add_config(TensorShape(28U, 28U, 16U), Size2D(3U, 3U), PadStrideInfo(1, 1, 1, 1, DimensionRoundingType::CEIL)); |
Georgios Pinitas | 4074c99 | 2018-01-30 18:13:46 +0000 | [diff] [blame] | 285 | // Stride 2 |
Gunes Bayir | 3af4c9b | 2023-10-08 17:51:28 +0100 | [diff] [blame] | 286 | add_config(TensorShape(133U, 97U, 32U), Size2D(3U, 3U), PadStrideInfo(2, 2, 0, 0, DimensionRoundingType::CEIL)); |
| 287 | add_config(TensorShape(153U, 77U, 32U), Size2D(3U, 3U), PadStrideInfo(2, 2, 1, 1, 1, 1, DimensionRoundingType::CEIL)); |
Giorgio Arena | 7657224 | 2018-04-04 17:44:26 +0100 | [diff] [blame] | 288 | add_config(TensorShape(8U, 8U, 32U), Size2D(3U, 3U), PadStrideInfo(2, 2, 0, 0, DimensionRoundingType::FLOOR)); |
| 289 | add_config(TensorShape(8U, 8U, 32U), Size2D(3U, 3U), PadStrideInfo(2, 2, 0, 1, 0, 1, DimensionRoundingType::CEIL)); |
Georgios Pinitas | a799ce0 | 2018-09-12 20:11:34 +0100 | [diff] [blame] | 290 | add_config(TensorShape(8U, 8U, 33U), Size2D(3U, 3U), PadStrideInfo(2, 2, 0, 1, 0, 1, DimensionRoundingType::CEIL)); |
Giorgio Arena | 7657224 | 2018-04-04 17:44:26 +0100 | [diff] [blame] | 291 | add_config(TensorShape(64U, 64U, 128U), Size2D(3U, 3U), PadStrideInfo(2, 2, 0, 1, 0, 1, DimensionRoundingType::CEIL)); |
Georgios Pinitas | 4074c99 | 2018-01-30 18:13:46 +0000 | [diff] [blame] | 292 | } |
| 293 | }; |
Georgios Pinitas | 4c75851 | 2019-07-10 19:49:11 +0100 | [diff] [blame] | 294 | |
| 295 | /** Dataset containing optimized, 5x5 depthwise convolution shapes. */ |
| 296 | class SmallOptimizedDepthwiseConvolutionLayerDataset5x5 final : public DepthwiseConvolutionLayerDataset |
| 297 | { |
| 298 | public: |
| 299 | SmallOptimizedDepthwiseConvolutionLayerDataset5x5() |
| 300 | { |
| 301 | // Stride 1 |
| 302 | add_config(TensorShape(7U, 7U, 16U), Size2D(5U, 5U), PadStrideInfo(1, 1, 0, 0, DimensionRoundingType::CEIL)); |
| 303 | add_config(TensorShape(11U, 11U, 16U), Size2D(5U, 5U), PadStrideInfo(1, 1, 0, 0, DimensionRoundingType::CEIL), Size2D(2U, 2U)); |
| 304 | add_config(TensorShape(7U, 7U, 16U), Size2D(5U, 5U), PadStrideInfo(1, 1, 2, 2, DimensionRoundingType::CEIL)); |
| 305 | add_config(TensorShape(7U, 7U, 16U), Size2D(5U, 5U), PadStrideInfo(1, 1, 4, 4, DimensionRoundingType::CEIL), Size2D(2U, 2U)); |
| 306 | // Stride 2 |
| 307 | add_config(TensorShape(9U, 9U, 32U), Size2D(5U, 5U), PadStrideInfo(2, 2, 0, 0, DimensionRoundingType::CEIL)); |
Michele Di Giorgio | d02d5ed | 2021-01-22 09:47:04 +0000 | [diff] [blame] | 308 | add_config(TensorShape(9U, 9U, 32U), Size2D(5U, 5U), PadStrideInfo(2, 2, 0, 0, DimensionRoundingType::CEIL), Size2D(2U, 2U)); |
Georgios Pinitas | 4c75851 | 2019-07-10 19:49:11 +0100 | [diff] [blame] | 309 | add_config(TensorShape(9U, 9U, 32U), Size2D(5U, 5U), PadStrideInfo(2, 2, 2, 2, 2, 2, DimensionRoundingType::CEIL)); |
Michele Di Giorgio | d02d5ed | 2021-01-22 09:47:04 +0000 | [diff] [blame] | 310 | add_config(TensorShape(9U, 9U, 32U), Size2D(5U, 5U), PadStrideInfo(2, 2, 4, 4, 4, 4, DimensionRoundingType::CEIL), Size2D(2U, 2U)); |
Georgios Pinitas | 4c75851 | 2019-07-10 19:49:11 +0100 | [diff] [blame] | 311 | } |
| 312 | }; |
SiCongLi | bc4e311 | 2021-06-29 13:18:30 +0100 | [diff] [blame] | 313 | |
| 314 | /** Dataset containing in-place 1x1 depthwise convolution shapes. |
| 315 | * |
| 316 | * For a depthwise convolution op to be in-place: |
| 317 | * * Output has the same shape as the input; |
| 318 | * * 1x1 filter |
| 319 | * * stride == 1 |
| 320 | * * dilations == 1 |
| 321 | * * No paddings |
| 322 | */ |
| 323 | class SmallInPlaceDepthwiseConvolutionLayerDataset final : public DepthwiseConvolutionLayerDataset |
| 324 | { |
| 325 | public: |
| 326 | SmallInPlaceDepthwiseConvolutionLayerDataset() |
| 327 | { |
| 328 | add_config(TensorShape(7U, 7U, 1U), Size2D(1U, 1U), PadStrideInfo(1, 1, 0, 0)); |
| 329 | add_config(TensorShape(11U, 13U, 16U), Size2D(1U, 1U), PadStrideInfo(1, 1, 0, 0)); |
| 330 | } |
| 331 | }; |
Giorgio Arena | 93a690e | 2017-08-01 16:09:33 +0100 | [diff] [blame] | 332 | } // namespace datasets |
| 333 | } // namespace test |
| 334 | } // namespace arm_compute |
ramy.elgammal@arm.com | a04ae3e | 2023-07-27 18:23:17 +0100 | [diff] [blame] | 335 | #endif // ACL_TESTS_DATASETS_DEPTHWISECONVOLUTIONLAYERDATASET_H |