From ad0c7388f6261989a268ffb2d042f2bd80736e3f Mon Sep 17 00:00:00 2001 From: Giorgio Arena Date: Mon, 23 Apr 2018 16:16:21 +0100 Subject: COMPMID-1068 Create validate method to CLDepthWiseConvolution Change-Id: I3301b66a8a072c6ecd0d7f2dabef350017b55ac4 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/128677 Tested-by: Jenkins Reviewed-by: Anthony Barbier --- .../kernels/CLDepthwiseConvolutionLayer3x3NCHWKernel.h | 16 ++++++++++++++++ arm_compute/core/CL/kernels/CLDepthwiseIm2ColKernel.h | 14 ++++++++++++++ .../core/CL/kernels/CLDepthwiseVectorToTensorKernel.h | 11 ++++++++++- .../core/CL/kernels/CLDepthwiseWeightsReshapeKernel.h | 10 ++++++++++ .../core/CL/kernels/CLGEMMMatrixVectorMultiplyKernel.h | 9 +++++++++ 5 files changed, 59 insertions(+), 1 deletion(-) (limited to 'arm_compute/core') diff --git a/arm_compute/core/CL/kernels/CLDepthwiseConvolutionLayer3x3NCHWKernel.h b/arm_compute/core/CL/kernels/CLDepthwiseConvolutionLayer3x3NCHWKernel.h index f80985a936..59cdf339bd 100644 --- a/arm_compute/core/CL/kernels/CLDepthwiseConvolutionLayer3x3NCHWKernel.h +++ b/arm_compute/core/CL/kernels/CLDepthwiseConvolutionLayer3x3NCHWKernel.h @@ -50,6 +50,22 @@ public: */ void configure(const ICLTensor *input, const ICLTensor *weights, const ICLTensor *biases, ICLTensor *output, const PadStrideInfo &conv_info, unsigned int depth_multiplier, ActivationLayerInfo act_info) override; + /** Static function to check if given info will lead to a valid configuration of @ref CLDepthwiseConvolutionLayer3x3NCHWKernel + * + * @param[in] input Source tensor. DataType supported: F16/F32/QASYMM8. + * @param[in] weights Weights tensor. A 3D tensor with dimensions [3, 3, IFM]. Data type supported: Same as @p input. + * @param[in] biases Biases tensor. A 1D tensor with dimensions [IFM]. Must be nullptr if not needed. + * Data type supported: Same as @p input. + * @param[in] output Destination tensor. Data type supported: Same as @p input. + * @param[in] conv_info Padding and stride information to use for the convolution. + * @param[in] depth_multiplier (Optional) Multiplier to apply to the input's depth in order to retrieve the output's depth. Defaults to 1. + * @param[in] act_info (Optional) Activation layer information in case of a fused activation. Only RELU, BOUNDED_RELU and LU_BOUNDED_RELU are supported. + * @param[in] gpu_target (Optional) GPU target to validate the kernel for. Defaults to midgard. + * + * @return a status + */ + static Status validate(const ITensorInfo *input, const ITensorInfo *weights, const ITensorInfo *biases, const ITensorInfo *output, const PadStrideInfo &conv_info, unsigned int depth_multiplier, + ActivationLayerInfo act_info = ActivationLayerInfo(), GPUTarget gpu_target = GPUTarget::MIDGARD); void run(const Window &window, cl::CommandQueue &queue) override; BorderSize border_size() const override; diff --git a/arm_compute/core/CL/kernels/CLDepthwiseIm2ColKernel.h b/arm_compute/core/CL/kernels/CLDepthwiseIm2ColKernel.h index 3f3e36100a..00d9cb64e1 100644 --- a/arm_compute/core/CL/kernels/CLDepthwiseIm2ColKernel.h +++ b/arm_compute/core/CL/kernels/CLDepthwiseIm2ColKernel.h @@ -60,6 +60,20 @@ public: * @param[in] depth_multiplier (Optional) Multiplier to apply to the input's depth in order to retrieve the output's depth. Defaults to 1. */ void configure(const ICLTensor *input, ICLTensor *output, const Size2D &kernel_dims, const PadStrideInfo &conv_info, bool has_bias = false, unsigned int depth_multiplier = 1); + /** Static function to check if given info will lead to a valid configuration of @ref CLDepthwiseIm2ColKernel + * + * @param[in] input The input tensor to convert. 3 lower dimensions represent a single input [width, height, IFM], + * while every optional dimension from 4 and above represent a batch of inputs. Data types supported: QASYMM8/F32 + * @param[in] output The output tensor. First 3 lower dimensions represent a transform of each 3D input, + * while every dimension above 3 represents a batch. Data types supported: Same as @p input + * @param[in] kernel_dims The kernel dimensions (width and height). + * @param[in] conv_info Contains padding and stride information described in @ref PadStrideInfo. + * @param[in] has_bias Boolean that specifies if the depthwise convolution has bias. + * @param[in] depth_multiplier (Optional) Multiplier to apply to the input's depth in order to retrieve the output's depth. Defaults to 1. + * + * @return a status + */ + static Status validate(const ITensorInfo *input, const ITensorInfo *output, const Size2D &kernel_dims, const PadStrideInfo &conv_info, bool has_bias, unsigned int depth_multiplier); // Inherited methods overridden: void run(const Window &window, cl::CommandQueue &queue) override; diff --git a/arm_compute/core/CL/kernels/CLDepthwiseVectorToTensorKernel.h b/arm_compute/core/CL/kernels/CLDepthwiseVectorToTensorKernel.h index 36d7cadbec..c9ec8e13bf 100644 --- a/arm_compute/core/CL/kernels/CLDepthwiseVectorToTensorKernel.h +++ b/arm_compute/core/CL/kernels/CLDepthwiseVectorToTensorKernel.h @@ -58,7 +58,16 @@ public: * @param[in] conv_h The converted tensor's height. */ void configure(const ICLTensor *input, ICLTensor *output, size_t conv_w, size_t conv_h); - + /** Static function to check if given info will lead to a valid configuration of @ref CLDepthwiseVectorToTensorKernel + * + * @param[in] input The input vector to convert. Data type supported: QASYMM8/S32/F16/F32. + * @param[in] output The output tensor. 3 lower dimensions represent a single input [width, height, IFM]. Data type supported: same as @p input. + * @param[in] conv_w The converted tensor's width. + * @param[in] conv_h The converted tensor's height. + * + * @return a status + */ + static Status validate(const ITensorInfo *input, const ITensorInfo *output, size_t conv_w, size_t conv_h); // Inherited methods overridden: void run(const Window &window, cl::CommandQueue &queue) override; diff --git a/arm_compute/core/CL/kernels/CLDepthwiseWeightsReshapeKernel.h b/arm_compute/core/CL/kernels/CLDepthwiseWeightsReshapeKernel.h index 1c1eaca474..34ffa17c2b 100644 --- a/arm_compute/core/CL/kernels/CLDepthwiseWeightsReshapeKernel.h +++ b/arm_compute/core/CL/kernels/CLDepthwiseWeightsReshapeKernel.h @@ -56,6 +56,16 @@ public: * @param[in] biases (Optional) The input biases to add. Shape [IFM]. Data type supported: same as @p input. */ void configure(const ICLTensor *input, ICLTensor *output, const ICLTensor *biases = nullptr); + /** Static function to check if given info will lead to a valid configuration of @ref CLDepthwiseWeightsReshapeKernel + * + * @param[in] input The input tensor to convert. 3 lower dimensions represent a single input [width, height, IFM]. + * Data type supported: QASYMM8/F32. + * @param[in] output The output tensor. Data type supported: same as @p input. + * @param[in] biases (Optional) The input biases to add. Shape [IFM]. Data type supported: same as @p input. + * + * @return a status + */ + static Status validate(const ITensorInfo *input, const ITensorInfo *output, const ITensorInfo *biases = nullptr); // Inherited methods overridden: void run(const Window &window, cl::CommandQueue &queue) override; diff --git a/arm_compute/core/CL/kernels/CLGEMMMatrixVectorMultiplyKernel.h b/arm_compute/core/CL/kernels/CLGEMMMatrixVectorMultiplyKernel.h index c27307e63b..6390f86d2c 100644 --- a/arm_compute/core/CL/kernels/CLGEMMMatrixVectorMultiplyKernel.h +++ b/arm_compute/core/CL/kernels/CLGEMMMatrixVectorMultiplyKernel.h @@ -51,6 +51,15 @@ public: * @param[out] output The output 2D tensor. Data types supported: Same as @p input */ void configure(const ICLTensor *input0, const ICLTensor *input1, ICLTensor *output); + /** Static function to check if given info will lead to a valid configuration of @ref CLGEMMMatrixVectorMultiplyKernel + * + * @param[in] input0 The reshaped input tensor. Data types supported: QASYMM8/F16/F32 + * @param[in] input1 The 2D reshaped weights tensor. Data type supported: Same as @p input, S32 for QASYMM8 input. + * @param[in] output The output 2D tensor. Data types supported: Same as @p input + * + * @return a status + */ + static Status validate(const ITensorInfo *input0, const ITensorInfo *input1, const ITensorInfo *output); // Inherited methods overridden: void run(const Window &window, cl::CommandQueue &queue) override; -- cgit v1.2.1