diff options
author | Michalis Spyrou <michalis.spyrou@arm.com> | 2017-11-23 12:10:21 +0000 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:41:04 +0000 |
commit | b7b31538eb9137e4d3e8de6d381dcbe9fc58df94 (patch) | |
tree | 7cca8c388cfb15867b9d92c6fd793ca1588b6526 /arm_compute/runtime/NEON/functions | |
parent | 02bf80d4554cfc824a76008905921cb564bee999 (diff) | |
download | ComputeLibrary-b7b31538eb9137e4d3e8de6d381dcbe9fc58df94.tar.gz |
COMPMID-464 Implement Depthwise separable convolution on NEON
Change-Id: Iccd686be18381e96bcf09b14c7017c6dda0f38d8
Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/109824
Tested-by: BSG Visual Compute Jenkins server to access repositories on http://mpd-gerrit.cambridge.arm.com <bsgcomp@arm.com>
Reviewed-by: Pablo Tello <pablo.tello@arm.com>
Diffstat (limited to 'arm_compute/runtime/NEON/functions')
-rw-r--r-- | arm_compute/runtime/NEON/functions/NEDepthwiseConvolution.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/arm_compute/runtime/NEON/functions/NEDepthwiseConvolution.h b/arm_compute/runtime/NEON/functions/NEDepthwiseConvolution.h index acf66f8dd4..f2c209cd80 100644 --- a/arm_compute/runtime/NEON/functions/NEDepthwiseConvolution.h +++ b/arm_compute/runtime/NEON/functions/NEDepthwiseConvolution.h @@ -25,8 +25,12 @@ #define __ARM_COMPUTE_NEDEPTHWISECONVOLUTION_H__ #include "arm_compute/core/NEON/kernels/NEDepthwiseConvolution3x3Kernel.h" +#include "arm_compute/core/NEON/kernels/NEDepthwiseIm2ColKernel.h" +#include "arm_compute/core/NEON/kernels/NEDepthwiseVectorToTensorKernel.h" +#include "arm_compute/core/NEON/kernels/NEDepthwiseWeightsReshapeKernel.h" #include "arm_compute/core/NEON/kernels/NEDirectConvolutionLayerBiasAccumulateKernel.h" #include "arm_compute/core/NEON/kernels/NEFillBorderKernel.h" +#include "arm_compute/core/NEON/kernels/NEGEMMMatrixVectorMultiplyKernel.h" #include "arm_compute/core/Types.h" #include "arm_compute/runtime/IFunction.h" #include "arm_compute/runtime/IMemoryManager.h" @@ -68,5 +72,42 @@ private: NEFillBorderKernel _border_handler; bool _has_bias; }; + +/** Basic function to execute a generic depthwise convolution. This function calls the following OpenCL kernels: + * + * -# @ref NEDepthwiseIm2ColKernel + * -# @ref NEDepthwiseWeightsReshapeKernel + * -# @ref NEGEMMMatrixVectorMultiplyKernel + * -# @ref NEFillBorderKernel (if pad_x or pad_y > 0) + * + */ +class NEDepthwiseConvolution : public IFunction +{ +public: + /** Default constructor */ + NEDepthwiseConvolution(); + /** Initialize the function's source, destination, weights and convolution information. + * + * @param[in, out] input Source tensor. Data type supported: F32. (Written to only for border filling). + * @param[out] output Destination tensor. Data type supported: same as @p input. + * @param[in] weights Weights tensor. These are 3D tensors with shape [kernel_x, kernel_y, IFM]. Data type supported: Same as @p input. + * @param[in] biases (Optional) Biases tensor. A 1D tensor with shape [IFM]. Must be nullptr if not needed. + * Data type supported: Same as @p input. + * @param[in] conv_info Padding and stride information to use for the convolution. + */ + void configure(ITensor *input, const ITensor *weights, const ITensor *biases, ITensor *output, const PadStrideInfo &conv_info); + + // Inherited methods overriden: + void run() override; + +private: + NEDepthwiseIm2ColKernel _im2col_kernel; + NEDepthwiseWeightsReshapeKernel _weights_reshape_kernel; + NEGEMMMatrixVectorMultiplyKernel _v2mm_kernel; + NEDepthwiseVectorToTensorKernel _vector_to_tensor_kernel; + Tensor _input_reshaped; + Tensor _weights_reshaped; + Tensor _v2mm_output; +}; } #endif /* __ARM_COMPUTE_NEDEPTHWISECONVOLUTION_H__ */
\ No newline at end of file |