blob: dc70aec7fffc43d61c4ccc7cf1e802c93cb8e443 [file] [log] [blame]
Michalis Spyrou7362f0d2017-10-18 17:58:22 +01001/*
Michele Di Giorgiod9eaf612020-07-08 11:12:57 +01002 * Copyright (c) 2017-2020 Arm Limited.
Michalis Spyrou7362f0d2017-10-18 17:58:22 +01003 *
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 */
Michalis Spyrouf4643372019-11-29 16:17:13 +000024#ifndef ARM_COMPUTE_NEDEPTHWISECONVOLUTION_H
25#define ARM_COMPUTE_NEDEPTHWISECONVOLUTION_H
Michalis Spyrou7362f0d2017-10-18 17:58:22 +010026
Georgios Pinitas60e98252018-10-22 16:17:20 +010027#include "arm_compute/runtime/NEON/functions/NEActivationLayer.h"
Georgios Pinitas284cfe22018-02-13 12:15:13 +000028#include "arm_compute/runtime/NEON/functions/NEPermute.h"
Georgios Pinitas47d39dc2019-03-11 14:03:23 +000029#include "arm_compute/runtime/NEON/functions/assembly/NEDepthwiseConvolutionAssemblyDispatch.h"
Michalis Spyrouebcebf12020-10-21 00:04:14 +010030#include <memory>
Michalis Spyrou7362f0d2017-10-18 17:58:22 +010031
32namespace arm_compute
33{
Georgios Pinitas30271c72019-06-24 14:56:34 +010034// Forward declarations
Michalis Spyrou7362f0d2017-10-18 17:58:22 +010035class ITensor;
Michalis Spyrouebcebf12020-10-21 00:04:14 +010036class NEDepthwiseConvolutionLayerNativeKernel;
Michalis Spyrou7362f0d2017-10-18 17:58:22 +010037
Manuel Bottini05069f02019-09-26 17:18:26 +010038/** Function to execute a depthwise convolution.
Michalis Spyrou7362f0d2017-10-18 17:58:22 +010039 */
Manuel Bottini05069f02019-09-26 17:18:26 +010040class NEDepthwiseConvolutionLayer : public IFunction
Michalis Spyrou7362f0d2017-10-18 17:58:22 +010041{
42public:
43 /** Default constructor */
Manuel Bottini05069f02019-09-26 17:18:26 +010044 NEDepthwiseConvolutionLayer(std::shared_ptr<IMemoryManager> memory_manager = nullptr);
Georgios Pinitas47d39dc2019-03-11 14:03:23 +000045 /** Prevent instances of this class from being copied (As this class contains pointers) */
Manuel Bottini05069f02019-09-26 17:18:26 +010046 NEDepthwiseConvolutionLayer(const NEDepthwiseConvolutionLayer &) = delete;
Georgios Pinitas47d39dc2019-03-11 14:03:23 +000047 /** Default move constructor */
Manuel Bottini05069f02019-09-26 17:18:26 +010048 NEDepthwiseConvolutionLayer(NEDepthwiseConvolutionLayer &&) = default;
Georgios Pinitas47d39dc2019-03-11 14:03:23 +000049 /** Prevent instances of this class from being copied (As this class contains pointers) */
Manuel Bottini05069f02019-09-26 17:18:26 +010050 NEDepthwiseConvolutionLayer &operator=(const NEDepthwiseConvolutionLayer &) = delete;
Georgios Pinitas47d39dc2019-03-11 14:03:23 +000051 /** Default move assignment operator */
Manuel Bottini05069f02019-09-26 17:18:26 +010052 NEDepthwiseConvolutionLayer &operator=(NEDepthwiseConvolutionLayer &&) = default;
Michalis Spyrouebcebf12020-10-21 00:04:14 +010053 /** Default destructor */
54 ~NEDepthwiseConvolutionLayer();
Manuel Bottini05069f02019-09-26 17:18:26 +010055 /** Initialize the function's source, destination, weights and convolution information.
Michalis Spyrou7362f0d2017-10-18 17:58:22 +010056 *
Michele Di Giorgio8c837ca2020-01-07 15:06:41 +000057 * @param[in, out] input Source tensor. Data type supported: QASYMM8/QASYMM8_SIGNED/F16/F32
Manuel Bottini05069f02019-09-26 17:18:26 +010058 * @param[out] output Destination tensor. Data type supported: same as @p input.
Michele Di Giorgiodf4cf572019-10-09 15:32:39 +010059 * @param[in] weights Weights tensor. These are 3D tensors with shape [kernel_x, kernel_y, IFM].
Michele Di Giorgio8c837ca2020-01-07 15:06:41 +000060 * Data type supported: Same as @p input or QASYMM8/QASYMM8_SIGNED/QSYMM8_PER_CHANNEL when @p input is QASYMM8/QASYMM8_SIGNED.
Usama Arife73686a2019-04-08 17:30:48 +010061 * @param[in] biases Biases tensor. A 1D tensor with shape [IFM]. Must be nullptr if not needed.
Michele Di Giorgio8c837ca2020-01-07 15:06:41 +000062 * Data type supported: Same as @p input, S32 when input is QASYMM8/QASYMM8_SIGNED.
Giorgio Arena76572242018-04-04 17:44:26 +010063 * @param[in] conv_info Padding and stride information to use for the convolution.
64 * @param[in] depth_multiplier (Optional) Multiplier to apply to the input's depth in order to retrieve the output's depth. Defaults to 1.
Georgios Pinitas60e98252018-10-22 16:17:20 +010065 * @param[in] act_info (Optional) Activation layer information in case of a fused activation.
Usama Arif881f2de2019-04-12 10:29:17 +010066 * @param[in] dilation (Optional) Dilation, in elements, across x and y. Defaults to (1, 1).
Michalis Spyrou7362f0d2017-10-18 17:58:22 +010067 */
Georgios Pinitas60e98252018-10-22 16:17:20 +010068 void configure(ITensor *input, const ITensor *weights, const ITensor *biases, ITensor *output, const PadStrideInfo &conv_info,
Usama Arife73686a2019-04-08 17:30:48 +010069 unsigned int depth_multiplier = 1, const ActivationLayerInfo &act_info = ActivationLayerInfo(), const Size2D &dilation = Size2D(1U, 1U));
Michalis Spyrou7362f0d2017-10-18 17:58:22 +010070
Manuel Bottini05069f02019-09-26 17:18:26 +010071 /** Static function to check if given info will lead to a valid configuration of @ref NEDepthwiseConvolutionLayer
Abe Mbise7784c832018-05-31 16:48:41 +010072 *
Michele Di Giorgio8c837ca2020-01-07 15:06:41 +000073 * @param[in] input Source tensor. Data type supported: QASYMM8/QASYMM8_SIGNED/F16/F32
Manuel Bottini05069f02019-09-26 17:18:26 +010074 * @param[in] output Destination tensor. Data type supported: same as @p input.
Michele Di Giorgiodf4cf572019-10-09 15:32:39 +010075 * @param[in] weights Weights tensor. These are 3D tensors with shape [kernel_x, kernel_y, IFM].
Michele Di Giorgio8c837ca2020-01-07 15:06:41 +000076 * Data type supported: Same as @p input or QASYMM8/QASYMM8_SIGNED/QSYMM8_PER_CHANNEL when @p input is QASYMM8/QASYMM8_SIGNED.
Usama Arife73686a2019-04-08 17:30:48 +010077 * @param[in] biases Biases tensor. A 1D tensor with shape [IFM]. Must be nullptr if not needed.
Michele Di Giorgio8c837ca2020-01-07 15:06:41 +000078 * Data type supported: Same as @p input, S32 when input is QASYMM8/QASYMM8_SIGNED.
Abe Mbise7784c832018-05-31 16:48:41 +010079 * @param[in] conv_info Padding and stride information to use for the convolution.
80 * @param[in] depth_multiplier (Optional) Multiplier to apply to the input's depth in order to retrieve the output's depth. Defaults to 1.
Georgios Pinitas60e98252018-10-22 16:17:20 +010081 * @param[in] act_info (Optional) Activation layer information in case of a fused activation.
Usama Arif881f2de2019-04-12 10:29:17 +010082 * @param[in] dilation (Optional) Dilation, in elements, across x and y. Defaults to (1, 1).
Abe Mbise7784c832018-05-31 16:48:41 +010083 *
84 * @return a status
85 */
Georgios Pinitas60e98252018-10-22 16:17:20 +010086 static Status validate(const ITensorInfo *input, const ITensorInfo *weights, const ITensorInfo *biases, const ITensorInfo *output, const PadStrideInfo &conv_info,
Usama Arife73686a2019-04-08 17:30:48 +010087 unsigned int depth_multiplier = 1, const ActivationLayerInfo &act_info = ActivationLayerInfo(), const Size2D &dilation = Size2D(1U, 1U));
Abe Mbise7784c832018-05-31 16:48:41 +010088
Michalis Spyrou7362f0d2017-10-18 17:58:22 +010089 // Inherited methods overriden:
90 void run() override;
Georgios Pinitas47d39dc2019-03-11 14:03:23 +000091 void prepare() override;
Michalis Spyrou7362f0d2017-10-18 17:58:22 +010092
93private:
Manuel Bottini05069f02019-09-26 17:18:26 +010094 /** Static function to choose the best depthwise convolution function for @ref NEDepthwiseConvolutionLayer
Georgios Pinitas47d39dc2019-03-11 14:03:23 +000095 *
Michele Di Giorgio8c837ca2020-01-07 15:06:41 +000096 * @param[in] input Source tensor info. Data type supported: QASYMM8/QASYMM8_SIGNED/F16/F32
Michele Di Giorgiodf4cf572019-10-09 15:32:39 +010097 * @param[in] weights Weights tensor info. These are 3D tensors with shape [kernel_x, kernel_y, IFM].
Michele Di Giorgio8c837ca2020-01-07 15:06:41 +000098 * Data type supported: Same as @p input or QASYMM8/QASYMM8_SIGNED/QSYMM8_PER_CHANNEL when @p input is QASYMM8/QASYMM8_SIGNED.
Manuel Bottini05069f02019-09-26 17:18:26 +010099 * @param[in] biases Biases tensor info. A 1D tensor with shape [IFM]. Must be nullptr if not needed.
Michele Di Giorgio8c837ca2020-01-07 15:06:41 +0000100 * Data type supported: Same as @p input, S32 when input is QASYMM8/QASYMM8_SIGNED.
Manuel Bottini05069f02019-09-26 17:18:26 +0100101 * @param[in] output Destination tensor. Data type supported: same as @p input.
102 * @param[in] conv_info Padding and stride information to use for the convolution.
103 * @param[in] depth_multiplier (Optional) Multiplier to apply to the input's depth in order to retrieve the output's depth. Defaults to 1.
Michele Di Giorgio8c837ca2020-01-07 15:06:41 +0000104 * @param[in] act_info (Optional) Activation layer information in case of a fused activation. Only RELU, BOUNDED_RELU and LU_BOUNDED_RELU for 3x3 quantized are supported.
Manuel Bottini05069f02019-09-26 17:18:26 +0100105 * @param[in] dilation (Optional) Dilation, in elements, across x and y. Defaults to (1, 1).
Usama Arif881f2de2019-04-12 10:29:17 +0100106 *
Manuel Bottini05069f02019-09-26 17:18:26 +0100107 * @return a Depthwise Convolution Function
Georgios Pinitas47d39dc2019-03-11 14:03:23 +0000108 */
Manuel Bottini05069f02019-09-26 17:18:26 +0100109 static DepthwiseConvolutionFunction get_depthwiseconvolution_function(const ITensorInfo *input, const ITensorInfo *weights, const ITensorInfo *biases, const ITensorInfo *output,
110 const PadStrideInfo &conv_info, unsigned int depth_multiplier = 1,
111 ActivationLayerInfo act_info = ActivationLayerInfo(), const Size2D &dilation = Size2D(1U, 1U));
Georgios Pinitas47d39dc2019-03-11 14:03:23 +0000112
Manuel Bottini05069f02019-09-26 17:18:26 +0100113 /** Basic function to execute optimized depthwise convolution routines. This function calls the following NEON kernels:
114 *
115 * @note At the moment 3x3 and 5x5 convolution of stride 1, 2 are supported
116 *
117 * -# @ref NEFillBorderKernel (if pad_x or pad_y > 0) and no assembly kernel implementation is present
118 * -# @ref NEDepthwiseConvolutionLayer3x3Kernel if 3x3 and no assembly kernel implementation is present
119 * -# @ref NEDepthwiseConvolutionAssemblyDispatch if assembly kernel implementation is present
120 * -# @ref NEDirectConvolutionLayerOutputStageKernel if re-quantization of output is required
121 * -# @ref NEActivationLayer if fused activation is required
122 *
123 */
124 class NEDepthwiseConvolutionLayerOptimizedInternal : public IFunction
125 {
126 public:
127 /** Default constructor */
128 NEDepthwiseConvolutionLayerOptimizedInternal(std::shared_ptr<IMemoryManager> memory_manager = nullptr);
129 /** Prevent instances of this class from being copied (As this class contains pointers) */
130 NEDepthwiseConvolutionLayerOptimizedInternal(const NEDepthwiseConvolutionLayerOptimizedInternal &) = delete;
131 /** Default move constructor */
132 NEDepthwiseConvolutionLayerOptimizedInternal(NEDepthwiseConvolutionLayerOptimizedInternal &&) = default;
133 /** Prevent instances of this class from being copied (As this class contains pointers) */
134 NEDepthwiseConvolutionLayerOptimizedInternal &operator=(const NEDepthwiseConvolutionLayerOptimizedInternal &) = delete;
135 /** Default move assignment operator */
136 NEDepthwiseConvolutionLayerOptimizedInternal &operator=(NEDepthwiseConvolutionLayerOptimizedInternal &&) = default;
Michalis Spyrouebcebf12020-10-21 00:04:14 +0100137 /** Default destructor */
138 ~NEDepthwiseConvolutionLayerOptimizedInternal() = default;
Manuel Bottini05069f02019-09-26 17:18:26 +0100139 /** Initialize the function's source, destination, kernels and border_size.
140 *
Michele Di Giorgio8c837ca2020-01-07 15:06:41 +0000141 * @param[in, out] input Source tensor. Data type supported: QASYMM8/QASYMM8_SIGNED/F16/F32. (Written to only for border filling).
Manuel Bottini05069f02019-09-26 17:18:26 +0100142 * @param[in] weights Weights tensor. These are 3D tensors with shape [kernel_x, kernel_y, IFM]. Data type supported: Same as @p input.
143 * @param[in] biases Biases tensor. A 1D tensor with shape [IFM]. Must be nullptr if not needed.
Michele Di Giorgio8c837ca2020-01-07 15:06:41 +0000144 * Data type supported: Same as @p input, S32 when input is QASYMM8/QASYMM8_SIGNED.
Manuel Bottini05069f02019-09-26 17:18:26 +0100145 * @param[out] output Destination tensor. Data type supported: same as @p input.
146 * @param[in] conv_info Padding and stride information to use for the convolution.
147 * @param[in] depth_multiplier (Optional) Multiplier to apply to the input's depth in order to retrieve the output's depth. Defaults to 1.
148 * @param[in] act_info (Optional) Activation layer information in case of a fused activation.
149 * @param[in] dilation (Optional) Dilation, in elements, across x and y. Defaults to (1, 1).
150 */
151 void configure(ITensor *input, const ITensor *weights, const ITensor *biases, ITensor *output, const PadStrideInfo &conv_info,
152 unsigned int depth_multiplier = 1, const ActivationLayerInfo &act_info = ActivationLayerInfo(), const Size2D &dilation = Size2D(1U, 1U));
153
154 /** Static function to check if given info will lead to a valid configuration of @ref NEDepthwiseConvolutionLayer3x3
155 *
Michele Di Giorgio8c837ca2020-01-07 15:06:41 +0000156 * @param[in] input Source tensor. Data type supported: QASYMM8/QASYMM8_SIGNED/F16/F32. (Written to only for border filling).
Manuel Bottini05069f02019-09-26 17:18:26 +0100157 * @param[in] weights Weights tensor. These are 3D tensors with shape [kernel_x, kernel_y, IFM]. Data type supported: Same as @p input.
158 * @param[in] biases Biases tensor. A 1D tensor with shape [IFM]. Must be nullptr if not needed.
Michele Di Giorgio8c837ca2020-01-07 15:06:41 +0000159 * Data type supported: Same as @p input, S32 when input is QASYMM8/QASYMM8_SIGNED.
Manuel Bottini05069f02019-09-26 17:18:26 +0100160 * @param[in] output Destination tensor. Data type supported: same as @p input.
161 * @param[in] conv_info Padding and stride information to use for the convolution.
162 * @param[in] depth_multiplier (Optional) Multiplier to apply to the input's depth in order to retrieve the output's depth. Defaults to 1.
163 * @param[in] act_info (Optional) Activation layer information in case of a fused activation.
164 * @param[in] dilation (Optional) Dilation, in elements, across x and y. Defaults to (1, 1).
165 *
166 * @return a status
167 */
168 static Status validate(const ITensorInfo *input, const ITensorInfo *weights, const ITensorInfo *biases, const ITensorInfo *output, const PadStrideInfo &conv_info,
169 unsigned int depth_multiplier = 1, const ActivationLayerInfo &act_info = ActivationLayerInfo(), const Size2D &dilation = Size2D(1U, 1U));
170
171 // Inherited methods overriden:
172 void run() override;
173 void prepare() override;
174
175 private:
Michalis Spyrouebcebf12020-10-21 00:04:14 +0100176 MemoryGroup _memory_group;
177 NEDepthwiseConvolutionAssemblyDispatch _dwc_optimized_func;
178 NEPermute _permute_input;
179 NEPermute _permute_weights;
180 NEPermute _permute_output;
181 NEActivationLayer _activationlayer_function;
182 Tensor _accumulator;
183 Tensor _permuted_input;
184 Tensor _permuted_weights;
185 Tensor _permuted_output;
186 const ITensor *_original_weights;
187 bool _has_bias;
188 bool _is_quantized;
189 bool _is_nchw;
190 bool _permute;
191 bool _is_activationlayer_enabled;
192 bool _is_prepared;
Manuel Bottini05069f02019-09-26 17:18:26 +0100193 };
194
195 /** Basic function to execute a generic depthwise convolution. This function calls the following NEON kernel:
196 *
197 * -# @ref NEDepthwiseConvolutionLayerNativeKernel
198 *
199 */
200 class NEDepthwiseConvolutionLayerGeneric : public IFunction
201 {
202 public:
203 /** Default constructor */
204 NEDepthwiseConvolutionLayerGeneric();
205 /** Prevent instances of this class from being copied (As this class contains pointers) */
206 NEDepthwiseConvolutionLayerGeneric(const NEDepthwiseConvolutionLayerGeneric &) = delete;
207 /** Default move constructor */
208 NEDepthwiseConvolutionLayerGeneric(NEDepthwiseConvolutionLayerGeneric &&) = default;
209 /** Prevent instances of this class from being copied (As this class contains pointers) */
210 NEDepthwiseConvolutionLayerGeneric &operator=(const NEDepthwiseConvolutionLayerGeneric &) = delete;
211 /** Default move assignment operator */
212 NEDepthwiseConvolutionLayerGeneric &operator=(NEDepthwiseConvolutionLayerGeneric &&) = default;
Michalis Spyrouebcebf12020-10-21 00:04:14 +0100213 /** Default destructor */
214 ~NEDepthwiseConvolutionLayerGeneric() = default;
Manuel Bottini05069f02019-09-26 17:18:26 +0100215 /** Initialize the function's source, destination, weights and convolution information.
216 *
Michele Di Giorgio8c837ca2020-01-07 15:06:41 +0000217 * @param[in, out] input Source tensor. Data type supported: QASYMM8/QASYMM8_SIGNED/F16/F32. (Written to only for border filling).
Manuel Bottini05069f02019-09-26 17:18:26 +0100218 * @param[out] output Destination tensor. Data type supported: same as @p input.
Michele Di Giorgiodf4cf572019-10-09 15:32:39 +0100219 * @param[in] weights Weights tensor. These are 3D tensors with shape [kernel_x, kernel_y, IFM].
Michele Di Giorgio8c837ca2020-01-07 15:06:41 +0000220 * Data type supported: Same as @p input or QASYMM8/QASYMM8_SIGNED/QSYMM8_PER_CHANNEL when @p input is QASYMM8/QASYMM8_SIGNED.
Manuel Bottini05069f02019-09-26 17:18:26 +0100221 * @param[in] biases Biases tensor. A 1D tensor with shape [IFM]. Must be nullptr if not needed.
Michele Di Giorgio8c837ca2020-01-07 15:06:41 +0000222 * Data type supported: Same as @p input, S32 when input is QASYMM8/QASYMM8_SIGNED.
Manuel Bottini05069f02019-09-26 17:18:26 +0100223 * @param[in] conv_info Padding and stride information to use for the convolution.
224 * @param[in] depth_multiplier (Optional) Multiplier to apply to the input's depth in order to retrieve the output's depth. Defaults to 1.
225 * @param[in] act_info (Optional) Activation layer information in case of a fused activation.
226 * @param[in] dilation (Optional) Dilation, in elements, across x and y. Defaults to (1, 1).
227 */
228 void configure(ITensor *input, const ITensor *weights, const ITensor *biases, ITensor *output, const PadStrideInfo &conv_info,
229 unsigned int depth_multiplier = 1, const ActivationLayerInfo &act_info = ActivationLayerInfo(), const Size2D &dilation = Size2D(1U, 1U));
230
231 /** Static function to check if given info will lead to a valid configuration of @ref NEDepthwiseConvolutionLayerGeneric
232 *
Michele Di Giorgio8c837ca2020-01-07 15:06:41 +0000233 * @param[in] input Source tensor. Data type supported: QASYMM8/QASYMM8_SIGNED/F16/F32. (Written to only for border filling).
Manuel Bottini05069f02019-09-26 17:18:26 +0100234 * @param[in] output Destination tensor. Data type supported: same as @p input.
Michele Di Giorgiodf4cf572019-10-09 15:32:39 +0100235 * @param[in] weights Weights tensor. These are 3D tensors with shape [kernel_x, kernel_y, IFM].
Michele Di Giorgio8c837ca2020-01-07 15:06:41 +0000236 * Data type supported: Same as @p input or QASYMM8/QASYMM8_SIGNED/QSYMM8_PER_CHANNEL when @p input is QASYMM8/QASYMM8_SIGNED.
Manuel Bottini05069f02019-09-26 17:18:26 +0100237 * @param[in] biases Biases tensor. A 1D tensor with shape [IFM]. Must be nullptr if not needed.
Michele Di Giorgio8c837ca2020-01-07 15:06:41 +0000238 * Data type supported: Same as @p input, S32 when input is QASYMM8/QASYMM8_SIGNED.
Manuel Bottini05069f02019-09-26 17:18:26 +0100239 * @param[in] conv_info Padding and stride information to use for the convolution.
240 * @param[in] depth_multiplier (Optional) Multiplier to apply to the input's depth in order to retrieve the output's depth. Defaults to 1.
241 * @param[in] act_info (Optional) Activation layer information in case of a fused activation.
242 * @param[in] dilation (Optional) Dilation, in elements, across x and y. Defaults to (1, 1).
243 *
244 * @return a status
245 */
246 static Status validate(const ITensorInfo *input, const ITensorInfo *weights, const ITensorInfo *biases, const ITensorInfo *output, const PadStrideInfo &conv_info,
247 unsigned int depth_multiplier = 1, const ActivationLayerInfo &act_info = ActivationLayerInfo(), const Size2D &dilation = Size2D(1U, 1U));
248
249 // Inherited methods overriden:
250 void run() override;
251 void prepare() override;
252
253 private:
Michalis Spyrouebcebf12020-10-21 00:04:14 +0100254 std::unique_ptr<NEDepthwiseConvolutionLayerNativeKernel> _depthwise_conv_kernel;
255 NEPermute _permute_input;
256 NEPermute _permute_weights;
257 NEPermute _permute_output;
258 NEActivationLayer _activationlayer_function;
259 Tensor _permuted_input;
260 Tensor _permuted_weights;
261 Tensor _permuted_output;
262 bool _is_prepared;
263 bool _is_nchw;
264 bool _is_activationlayer_enabled;
265 const ITensor *_original_weights;
Manuel Bottini05069f02019-09-26 17:18:26 +0100266 };
267
268 DepthwiseConvolutionFunction _depth_conv_func;
269 NEDepthwiseConvolutionLayerOptimizedInternal _func_optimized;
270 NEDepthwiseConvolutionLayerGeneric _func_generic;
Michalis Spyrou7362f0d2017-10-18 17:58:22 +0100271};
Georgios Pinitas8cffcd62018-11-16 17:11:50 +0000272} // namespace arm_compute
Michalis Spyrouf4643372019-11-29 16:17:13 +0000273#endif /* ARM_COMPUTE_NEDEPTHWISECONVOLUTION_H */