From 04a8f8c4994f1c32b3f16a832c0e6f2599364c02 Mon Sep 17 00:00:00 2001 From: Giorgio Arena Date: Thu, 23 Nov 2017 11:45:24 +0000 Subject: COMPMID-692 Consistent names for the interfaces Change-Id: I4b1f3f0da9ff5342c7de7083736fe91871d14e5b Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/110351 Tested-by: BSG Visual Compute Jenkins server to access repositories on http://mpd-gerrit.cambridge.arm.com Reviewed-by: Georgios Pinitas Reviewed-by: Anthony Barbier --- .../runtime/CL/functions/CLDepthConcatenate.h | 70 ------------- .../runtime/CL/functions/CLDepthConcatenateLayer.h | 70 +++++++++++++ arm_compute/runtime/CL/functions/CLDepthConvert.h | 64 ------------ .../runtime/CL/functions/CLDepthConvertLayer.h | 64 ++++++++++++ .../runtime/CL/functions/CLDepthwiseConvolution.h | 110 --------------------- .../CL/functions/CLDepthwiseConvolutionLayer.h | 110 +++++++++++++++++++++ .../CLDepthwiseSeparableConvolutionLayer.h | 8 +- arm_compute/runtime/CL/functions/CLL2Normalize.h | 69 ------------- .../runtime/CL/functions/CLL2NormalizeLayer.h | 69 +++++++++++++ .../runtime/CL/functions/CLLaplacianPyramid.h | 4 +- .../runtime/CL/functions/CLLaplacianReconstruct.h | 6 +- 11 files changed, 322 insertions(+), 322 deletions(-) delete mode 100644 arm_compute/runtime/CL/functions/CLDepthConcatenate.h create mode 100644 arm_compute/runtime/CL/functions/CLDepthConcatenateLayer.h delete mode 100644 arm_compute/runtime/CL/functions/CLDepthConvert.h create mode 100644 arm_compute/runtime/CL/functions/CLDepthConvertLayer.h delete mode 100644 arm_compute/runtime/CL/functions/CLDepthwiseConvolution.h create mode 100644 arm_compute/runtime/CL/functions/CLDepthwiseConvolutionLayer.h delete mode 100644 arm_compute/runtime/CL/functions/CLL2Normalize.h create mode 100644 arm_compute/runtime/CL/functions/CLL2NormalizeLayer.h (limited to 'arm_compute/runtime/CL/functions') diff --git a/arm_compute/runtime/CL/functions/CLDepthConcatenate.h b/arm_compute/runtime/CL/functions/CLDepthConcatenate.h deleted file mode 100644 index 77997f6bd1..0000000000 --- a/arm_compute/runtime/CL/functions/CLDepthConcatenate.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2017 ARM Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef __ARM_COMPUTE_CLDEPTHCONCATENATE_H__ -#define __ARM_COMPUTE_CLDEPTHCONCATENATE_H__ - -#include "arm_compute/core/CL/OpenCL.h" -#include "arm_compute/core/Types.h" -#include "arm_compute/core/Window.h" -#include "arm_compute/runtime/IFunction.h" - -#include "arm_compute/core/CL/kernels/CLDepthConcatenateKernel.h" -#include "arm_compute/core/CL/kernels/CLFillBorderKernel.h" - -#include -#include - -namespace arm_compute -{ -class ICLTensor; - -/** Basic function to execute concatenate tensors along z axis. This function calls the following kernels: - * - * -# @ref CLFillBorderKernel (executed if input's lowest two dimensions are smaller than respective output's dimensions) - * -# @ref CLDepthConcatenateKernel - * - */ -class CLDepthConcatenate : public IFunction -{ -public: - /** Default constructor */ - CLDepthConcatenate(); - /** Initialise the kernel's inputs vector and output. - * - * @param[in,out] inputs_vector The vectors containing all the tensors to concatenate. Data types supported: QS8/QS16/F16/F32. - * @param[out] output Output tensor. Data types supported: Same as @p input. - */ - void configure(std::vector inputs_vector, ICLTensor *output); - - // Inherited methods overridden: - void run() override; - -private: - std::vector _inputs_vector; - std::unique_ptr _concat_kernels_vector; - std::unique_ptr _border_handlers_vector; - unsigned int _num_inputs; -}; -} -#endif /* __ARM_COMPUTE_CLDEPTHCONCATENATE_H__ */ diff --git a/arm_compute/runtime/CL/functions/CLDepthConcatenateLayer.h b/arm_compute/runtime/CL/functions/CLDepthConcatenateLayer.h new file mode 100644 index 0000000000..00b3b66c97 --- /dev/null +++ b/arm_compute/runtime/CL/functions/CLDepthConcatenateLayer.h @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef __ARM_COMPUTE_CLDEPTHCONCATENATE_H__ +#define __ARM_COMPUTE_CLDEPTHCONCATENATE_H__ + +#include "arm_compute/core/CL/OpenCL.h" +#include "arm_compute/core/Types.h" +#include "arm_compute/core/Window.h" +#include "arm_compute/runtime/IFunction.h" + +#include "arm_compute/core/CL/kernels/CLDepthConcatenateLayerKernel.h" +#include "arm_compute/core/CL/kernels/CLFillBorderKernel.h" + +#include +#include + +namespace arm_compute +{ +class ICLTensor; + +/** Basic function to execute concatenate tensors along z axis. This function calls the following kernels: + * + * -# @ref CLFillBorderKernel (executed if input's lowest two dimensions are smaller than respective output's dimensions) + * -# @ref CLDepthConcatenateLayerKernel + * + */ +class CLDepthConcatenateLayer : public IFunction +{ +public: + /** Default constructor */ + CLDepthConcatenateLayer(); + /** Initialise the kernel's inputs vector and output. + * + * @param[in,out] inputs_vector The vectors containing all the tensors to concatenate. Data types supported: QS8/QS16/F16/F32. + * @param[out] output Output tensor. Data types supported: Same as @p input. + */ + void configure(std::vector inputs_vector, ICLTensor *output); + + // Inherited methods overridden: + void run() override; + +private: + std::vector _inputs_vector; + std::unique_ptr _concat_kernels_vector; + std::unique_ptr _border_handlers_vector; + unsigned int _num_inputs; +}; +} +#endif /* __ARM_COMPUTE_CLDEPTHCONCATENATE_H__ */ diff --git a/arm_compute/runtime/CL/functions/CLDepthConvert.h b/arm_compute/runtime/CL/functions/CLDepthConvert.h deleted file mode 100644 index 9a4c63dd6d..0000000000 --- a/arm_compute/runtime/CL/functions/CLDepthConvert.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2016, 2017 ARM Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef __ARM_COMPUTE_CLDEPTHCONVERT_H__ -#define __ARM_COMPUTE_CLDEPTHCONVERT_H__ - -#include "arm_compute/core/Types.h" -#include "arm_compute/runtime/CL/ICLSimpleFunction.h" - -#include - -namespace arm_compute -{ -class ICLTensor; - -/** Basic function to run @ref CLDepthConvertKernel. */ -class CLDepthConvert : public ICLSimpleFunction -{ -public: - /** Initialize the function's source, destination - * - * Input data type must be different than output data type. - * - * Valid conversions Input -> Output : - * - * - QS8 -> F32 - * - QS16 -> F32 - * - U8 -> U16, S16, U32, S32 - * - U16 -> U8, U32, S32 - * - S16 -> U8, U32, S32 - * - U32 -> U8, U16, S16 - * - S32 -> U8, U16, S16 - * - F32 -> QS8, QS16 - * - * @param[in] input The input tensor to convert. Data types supported: QS8/U8/U16/S16/Q16/U32/S32/F32. - * @param[out] output The output tensor. Data types supported: QS8/U8/U16/S16/QS16/U32/S32/F32. - * @param[in] policy Conversion policy. - * @param[in] shift Value for down/up conversions. Must be 0 <= shift < 8. - * It is not used on fixed point conversion. - */ - void configure(const ICLTensor *input, ICLTensor *output, ConvertPolicy policy, uint32_t shift); -}; -} -#endif /*__ARM_COMPUTE_CLDEPTHCONVERT_H__*/ diff --git a/arm_compute/runtime/CL/functions/CLDepthConvertLayer.h b/arm_compute/runtime/CL/functions/CLDepthConvertLayer.h new file mode 100644 index 0000000000..c84dc15508 --- /dev/null +++ b/arm_compute/runtime/CL/functions/CLDepthConvertLayer.h @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2016, 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef __ARM_COMPUTE_CLDEPTHCONVERT_H__ +#define __ARM_COMPUTE_CLDEPTHCONVERT_H__ + +#include "arm_compute/core/Types.h" +#include "arm_compute/runtime/CL/ICLSimpleFunction.h" + +#include + +namespace arm_compute +{ +class ICLTensor; + +/** Basic function to run @ref CLDepthConvertLayerKernel. */ +class CLDepthConvertLayer : public ICLSimpleFunction +{ +public: + /** Initialize the function's source, destination + * + * Input data type must be different than output data type. + * + * Valid conversions Input -> Output : + * + * - QS8 -> F32 + * - QS16 -> F32 + * - U8 -> U16, S16, U32, S32 + * - U16 -> U8, U32, S32 + * - S16 -> U8, U32, S32 + * - U32 -> U8, U16, S16 + * - S32 -> U8, U16, S16 + * - F32 -> QS8, QS16 + * + * @param[in] input The input tensor to convert. Data types supported: QS8/U8/U16/S16/Q16/U32/S32/F32. + * @param[out] output The output tensor. Data types supported: QS8/U8/U16/S16/QS16/U32/S32/F32. + * @param[in] policy Conversion policy. + * @param[in] shift Value for down/up conversions. Must be 0 <= shift < 8. + * It is not used on fixed point conversion. + */ + void configure(const ICLTensor *input, ICLTensor *output, ConvertPolicy policy, uint32_t shift); +}; +} +#endif /*__ARM_COMPUTE_CLDEPTHCONVERT_H__*/ diff --git a/arm_compute/runtime/CL/functions/CLDepthwiseConvolution.h b/arm_compute/runtime/CL/functions/CLDepthwiseConvolution.h deleted file mode 100644 index 40eb8523fb..0000000000 --- a/arm_compute/runtime/CL/functions/CLDepthwiseConvolution.h +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2017 ARM Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef __ARM_COMPUTE_CLDEPTHWISECONVOLUTION_H__ -#define __ARM_COMPUTE_CLDEPTHWISECONVOLUTION_H__ - -#include "arm_compute/core/CL/kernels/CLDepthwiseConvolution3x3Kernel.h" -#include "arm_compute/core/CL/kernels/CLDepthwiseIm2ColKernel.h" -#include "arm_compute/core/CL/kernels/CLDepthwiseVectorToTensorKernel.h" -#include "arm_compute/core/CL/kernels/CLDepthwiseWeightsReshapeKernel.h" -#include "arm_compute/core/CL/kernels/CLFillBorderKernel.h" -#include "arm_compute/core/CL/kernels/CLGEMMMatrixVectorMultiplyKernel.h" -#include "arm_compute/core/Types.h" -#include "arm_compute/runtime/CL/CLTensor.h" -#include "arm_compute/runtime/IFunction.h" - -namespace arm_compute -{ -class ICLTensor; - -/** Basic function to execute a depthwise convolution for kernel size 3x3xC. This function calls the following OpenCL kernels: - * - * -# @ref CLDepthwiseConvolution3x3Kernel - * -# @ref CLFillBorderKernel (if pad_x or pad_y > 0) - * - */ -class CLDepthwiseConvolution3x3 : public IFunction -{ -public: - /** Default constructor */ - CLDepthwiseConvolution3x3(); - /** Initialize the function's source, destination, conv and border_size. - * - * @param[in, out] input Source tensor. Data type supported: QASYMM8/F32. (Written to only for border filling). - * @param[in] weights Weights tensor. A 3D tensor with shape [3, 3, 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[out] output Destination tensor. Data type supported: same as @p input. - * @param[in] conv_info Padding and stride information to use for the convolution. - */ - void configure(ICLTensor *input, const ICLTensor *weights, const ICLTensor *biases, ICLTensor *output, const PadStrideInfo &conv_info); - - // Inherited methods overriden: - void run() override; - -private: - CLDepthwiseConvolution3x3Kernel _kernel; - CLFillBorderKernel _border_handler; -}; - -/** Basic function to execute a generic depthwise convolution. This function calls the following OpenCL kernels: - * - * -# @ref CLDepthwiseIm2ColKernel - * -# @ref CLGEMMMatrixVectorMultiplyKernel - * -# @ref CLDepthwiseWeightsReshapeKernel - * -# @ref CLFillBorderKernel (if pad_x or pad_y > 0) - * - */ -class CLDepthwiseConvolution : public IFunction -{ -public: - /** Default constructor */ - CLDepthwiseConvolution(); - /** 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[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[out] output Destination tensor. Data type supported: same as @p input. - * @param[in] conv_info Padding and stride information to use for the convolution. - */ - void configure(ICLTensor *input, const ICLTensor *weights, const ICLTensor *biases, ICLTensor *output, const PadStrideInfo &conv_info); - - // Inherited methods overriden: - void run() override; - -private: - CLDepthwiseIm2ColKernel _im2col_kernel; - CLDepthwiseWeightsReshapeKernel _weights_reshape_kernel; - CLGEMMMatrixVectorMultiplyKernel _v2mm_kernel; - CLDepthwiseVectorToTensorKernel _vector_to_tensor_kernel; - CLFillBorderKernel _v2mm_input_fill_border; - CLFillBorderKernel _v2mm_weights_fill_border; - CLTensor _input_reshaped; - CLTensor _weights_reshaped; - CLTensor _v2mm_output; -}; -} -#endif /*__ARM_COMPUTE_CLDEPTHWISECONVOLUTION_H__ */ diff --git a/arm_compute/runtime/CL/functions/CLDepthwiseConvolutionLayer.h b/arm_compute/runtime/CL/functions/CLDepthwiseConvolutionLayer.h new file mode 100644 index 0000000000..f7899415d2 --- /dev/null +++ b/arm_compute/runtime/CL/functions/CLDepthwiseConvolutionLayer.h @@ -0,0 +1,110 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef __ARM_COMPUTE_CLDEPTHWISECONVOLUTION_H__ +#define __ARM_COMPUTE_CLDEPTHWISECONVOLUTION_H__ + +#include "arm_compute/core/CL/kernels/CLDepthwiseConvolutionLayer3x3Kernel.h" +#include "arm_compute/core/CL/kernels/CLDepthwiseIm2ColKernel.h" +#include "arm_compute/core/CL/kernels/CLDepthwiseVectorToTensorKernel.h" +#include "arm_compute/core/CL/kernels/CLDepthwiseWeightsReshapeKernel.h" +#include "arm_compute/core/CL/kernels/CLFillBorderKernel.h" +#include "arm_compute/core/CL/kernels/CLGEMMMatrixVectorMultiplyKernel.h" +#include "arm_compute/core/Types.h" +#include "arm_compute/runtime/CL/CLTensor.h" +#include "arm_compute/runtime/IFunction.h" + +namespace arm_compute +{ +class ICLTensor; + +/** Basic function to execute a depthwise convolution for kernel size 3x3xC. This function calls the following OpenCL kernels: + * + * -# @ref CLDepthwiseConvolutionLayer3x3Kernel + * -# @ref CLFillBorderKernel (if pad_x or pad_y > 0) + * + */ +class CLDepthwiseConvolutionLayer3x3 : public IFunction +{ +public: + /** Default constructor */ + CLDepthwiseConvolutionLayer3x3(); + /** Initialize the function's source, destination, conv and border_size. + * + * @param[in, out] input Source tensor. Data type supported: QASYMM8/F32. (Written to only for border filling). + * @param[in] weights Weights tensor. A 3D tensor with shape [3, 3, 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[out] output Destination tensor. Data type supported: same as @p input. + * @param[in] conv_info Padding and stride information to use for the convolution. + */ + void configure(ICLTensor *input, const ICLTensor *weights, const ICLTensor *biases, ICLTensor *output, const PadStrideInfo &conv_info); + + // Inherited methods overriden: + void run() override; + +private: + CLDepthwiseConvolutionLayer3x3Kernel _kernel; + CLFillBorderKernel _border_handler; +}; + +/** Basic function to execute a generic depthwise convolution. This function calls the following OpenCL kernels: + * + * -# @ref CLDepthwiseIm2ColKernel + * -# @ref CLGEMMMatrixVectorMultiplyKernel + * -# @ref CLDepthwiseWeightsReshapeKernel + * -# @ref CLFillBorderKernel (if pad_x or pad_y > 0) + * + */ +class CLDepthwiseConvolutionLayer : public IFunction +{ +public: + /** Default constructor */ + CLDepthwiseConvolutionLayer(); + /** 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[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[out] output Destination tensor. Data type supported: same as @p input. + * @param[in] conv_info Padding and stride information to use for the convolution. + */ + void configure(ICLTensor *input, const ICLTensor *weights, const ICLTensor *biases, ICLTensor *output, const PadStrideInfo &conv_info); + + // Inherited methods overriden: + void run() override; + +private: + CLDepthwiseIm2ColKernel _im2col_kernel; + CLDepthwiseWeightsReshapeKernel _weights_reshape_kernel; + CLGEMMMatrixVectorMultiplyKernel _v2mm_kernel; + CLDepthwiseVectorToTensorKernel _vector_to_tensor_kernel; + CLFillBorderKernel _v2mm_input_fill_border; + CLFillBorderKernel _v2mm_weights_fill_border; + CLTensor _input_reshaped; + CLTensor _weights_reshaped; + CLTensor _v2mm_output; +}; +} +#endif /*__ARM_COMPUTE_CLDEPTHWISECONVOLUTION_H__ */ diff --git a/arm_compute/runtime/CL/functions/CLDepthwiseSeparableConvolutionLayer.h b/arm_compute/runtime/CL/functions/CLDepthwiseSeparableConvolutionLayer.h index a38446293b..27cee5ed3b 100644 --- a/arm_compute/runtime/CL/functions/CLDepthwiseSeparableConvolutionLayer.h +++ b/arm_compute/runtime/CL/functions/CLDepthwiseSeparableConvolutionLayer.h @@ -27,7 +27,7 @@ #include "arm_compute/core/Types.h" #include "arm_compute/runtime/CL/CLTensor.h" #include "arm_compute/runtime/CL/ICLSimpleFunction.h" -#include "arm_compute/runtime/CL/functions/CLDepthwiseConvolution.h" +#include "arm_compute/runtime/CL/functions/CLDepthwiseConvolutionLayer.h" #include "arm_compute/runtime/CL/functions/CLDirectConvolutionLayer.h" #include "arm_compute/runtime/IFunction.h" @@ -39,7 +39,7 @@ class ICLTensor; /** Basic function to execute depthwise convolution. This function calls the following OpenCL kernels and function: * - * -# @ref CLDepthwiseConvolution + * -# @ref CLDepthwiseConvolutionLayer * -# @ref CLDirectConvolutionLayer * */ @@ -72,8 +72,8 @@ public: void run() override; private: - CLDepthwiseConvolution _depthwise_conv; - CLDirectConvolutionLayer _pointwise_conv; + CLDepthwiseConvolutionLayer _depthwise_conv; + CLDirectConvolutionLayer _pointwise_conv; }; } #endif /*__ARM_COMPUTE_CL_DEPTHWISE_SEPARABLE_CONVOLUTION_H__ */ diff --git a/arm_compute/runtime/CL/functions/CLL2Normalize.h b/arm_compute/runtime/CL/functions/CLL2Normalize.h deleted file mode 100644 index 20af54eda2..0000000000 --- a/arm_compute/runtime/CL/functions/CLL2Normalize.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2017 ARM Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef __ARM_COMPUTE_CLL2NORMALIZE_H__ -#define __ARM_COMPUTE_CLL2NORMALIZE_H__ - -#include "arm_compute/core/CL/kernels/CLL2NormalizeKernel.h" -#include "arm_compute/core/Types.h" -#include "arm_compute/runtime/CL/CLMemoryGroup.h" -#include "arm_compute/runtime/CL/CLTensor.h" -#include "arm_compute/runtime/CL/ICLSimpleFunction.h" -#include "arm_compute/runtime/CL/functions/CLReductionOperation.h" -#include "arm_compute/runtime/IMemoryManager.h" - -#include -#include - -namespace arm_compute -{ -class ICLTensor; - -/** Perform reduction operation. - */ -class CLL2Normalize : public IFunction -{ -public: - /** Constructor */ - CLL2Normalize(std::shared_ptr memory_manager = nullptr); - - /** Set the input and output tensors. - * - * @param[in] input Source tensor. Data types supported: QS8, QS16, F32. - * @param[out] output Destination tensor. Data types supported: Same as @p input. - * @param[in] axis Axis along which to reduce. Supported reduction axis : 0 - * @param[in] epsilon Lower bound value for the normalization. - */ - void configure(ICLTensor *input, ICLTensor *output, unsigned int axis, float epsilon = 1e-12); - - // Inherited methods overridden: - void run() override; - -private: - CLMemoryGroup _memory_group; - CLReductionOperation _reduce_func; - CLL2NormalizeKernel _normalize_kernel; - CLTensor _sumsq; -}; -} -#endif /*__ARM_COMPUTE_CLL2NORMALIZE_H__ */ diff --git a/arm_compute/runtime/CL/functions/CLL2NormalizeLayer.h b/arm_compute/runtime/CL/functions/CLL2NormalizeLayer.h new file mode 100644 index 0000000000..8aea7a641b --- /dev/null +++ b/arm_compute/runtime/CL/functions/CLL2NormalizeLayer.h @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef __ARM_COMPUTE_CLL2NORMALIZE_H__ +#define __ARM_COMPUTE_CLL2NORMALIZE_H__ + +#include "arm_compute/core/CL/kernels/CLL2NormalizeLayerKernel.h" +#include "arm_compute/core/Types.h" +#include "arm_compute/runtime/CL/CLMemoryGroup.h" +#include "arm_compute/runtime/CL/CLTensor.h" +#include "arm_compute/runtime/CL/ICLSimpleFunction.h" +#include "arm_compute/runtime/CL/functions/CLReductionOperation.h" +#include "arm_compute/runtime/IMemoryManager.h" + +#include +#include + +namespace arm_compute +{ +class ICLTensor; + +/** Perform reduction operation. + */ +class CLL2NormalizeLayer : public IFunction +{ +public: + /** Constructor */ + CLL2NormalizeLayer(std::shared_ptr memory_manager = nullptr); + + /** Set the input and output tensors. + * + * @param[in] input Source tensor. Data types supported: QS8, QS16, F32. + * @param[out] output Destination tensor. Data types supported: Same as @p input. + * @param[in] axis Axis along which to reduce. Supported reduction axis : 0 + * @param[in] epsilon Lower bound value for the normalization. + */ + void configure(ICLTensor *input, ICLTensor *output, unsigned int axis, float epsilon = 1e-12); + + // Inherited methods overridden: + void run() override; + +private: + CLMemoryGroup _memory_group; + CLReductionOperation _reduce_func; + CLL2NormalizeLayerKernel _normalize_kernel; + CLTensor _sumsq; +}; +} +#endif /*__ARM_COMPUTE_CLL2NORMALIZE_H__ */ diff --git a/arm_compute/runtime/CL/functions/CLLaplacianPyramid.h b/arm_compute/runtime/CL/functions/CLLaplacianPyramid.h index 0c6708aa73..585a013e31 100644 --- a/arm_compute/runtime/CL/functions/CLLaplacianPyramid.h +++ b/arm_compute/runtime/CL/functions/CLLaplacianPyramid.h @@ -27,7 +27,7 @@ #include "arm_compute/core/Types.h" #include "arm_compute/runtime/CL/CLPyramid.h" #include "arm_compute/runtime/CL/functions/CLArithmeticSubtraction.h" -#include "arm_compute/runtime/CL/functions/CLDepthConvert.h" +#include "arm_compute/runtime/CL/functions/CLDepthConvertLayer.h" #include "arm_compute/runtime/CL/functions/CLGaussian5x5.h" #include "arm_compute/runtime/CL/functions/CLGaussianPyramid.h" #include "arm_compute/runtime/IFunction.h" @@ -77,7 +77,7 @@ private: CLGaussianPyramidHalf _gaussian_pyr_function; std::unique_ptr _convf; std::unique_ptr _subf; - CLDepthConvert _depth_function; + CLDepthConvertLayer _depth_function; CLPyramid _gauss_pyr; CLPyramid _conv_pyr; }; diff --git a/arm_compute/runtime/CL/functions/CLLaplacianReconstruct.h b/arm_compute/runtime/CL/functions/CLLaplacianReconstruct.h index 4bc7eb65ce..4a676c85a0 100644 --- a/arm_compute/runtime/CL/functions/CLLaplacianReconstruct.h +++ b/arm_compute/runtime/CL/functions/CLLaplacianReconstruct.h @@ -27,7 +27,7 @@ #include "arm_compute/core/Types.h" #include "arm_compute/runtime/CL/CLPyramid.h" #include "arm_compute/runtime/CL/functions/CLArithmeticAddition.h" -#include "arm_compute/runtime/CL/functions/CLDepthConvert.h" +#include "arm_compute/runtime/CL/functions/CLDepthConvertLayer.h" #include "arm_compute/runtime/CL/functions/CLScale.h" #include "arm_compute/runtime/IFunction.h" @@ -43,7 +43,7 @@ using ICLImage = ICLTensor; * * -# @ref CLArithmeticAddition * -# @ref CLScale - * -# @ref CLDepthConvert + * -# @ref CLDepthConvertLayer * * This function reconstructs the original image from a Laplacian Image Pyramid. * @@ -85,7 +85,7 @@ private: CLPyramid _tmp_pyr; std::unique_ptr _addf; std::unique_ptr _scalef; - CLDepthConvert _depthf; + CLDepthConvertLayer _depthf; }; } #endif /*__ARM_COMPUTE_CLLAPLACIANRECONSTRUCT_H__ */ -- cgit v1.2.1