diff options
author | Georgios Pinitas <georgios.pinitas@arm.com> | 2017-11-27 21:00:13 +0000 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:41:36 +0000 |
commit | d912fd8eaaa56aac90f2b0b118c76f24ba8efa02 (patch) | |
tree | 1474ecd7ddb8218c6471d2e2a2273e6060bcf0b5 /arm_compute | |
parent | b6f182d3e5b69cc193d7e5ec397c4d61083572d5 (diff) | |
download | ComputeLibrary-d912fd8eaaa56aac90f2b0b118c76f24ba8efa02.tar.gz |
COMPMID-617: Add validation to NEON functions.
Adds validation to:
- NECol2Im
- NEIm2Col
Change-Id: I346298583a6985ea793f71bb4527aa216a5cd4b2
Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/110835
Tested-by: BSG Visual Compute Jenkins server to access repositories on http://mpd-gerrit.cambridge.arm.com <bsgcomp@arm.com>
Reviewed-by: Michalis Spyrou <michalis.spyrou@arm.com>
Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
Diffstat (limited to 'arm_compute')
-rw-r--r-- | arm_compute/core/NEON/kernels/NECol2ImKernel.h | 16 | ||||
-rw-r--r-- | arm_compute/core/NEON/kernels/NEIm2ColKernel.h | 13 | ||||
-rw-r--r-- | arm_compute/runtime/NEON/functions/NECol2Im.h | 17 | ||||
-rw-r--r-- | arm_compute/runtime/NEON/functions/NEIm2Col.h | 13 |
4 files changed, 54 insertions, 5 deletions
diff --git a/arm_compute/core/NEON/kernels/NECol2ImKernel.h b/arm_compute/core/NEON/kernels/NECol2ImKernel.h index 93ec37a610..960e3021db 100644 --- a/arm_compute/core/NEON/kernels/NECol2ImKernel.h +++ b/arm_compute/core/NEON/kernels/NECol2ImKernel.h @@ -26,6 +26,8 @@ #include "arm_compute/core/NEON/INEKernel.h" +#include "arm_compute/core/Size2D.h" + namespace arm_compute { class ITensor; @@ -71,7 +73,17 @@ public: * while the rest represent batch of outputs. Data types supported: Same as @p input * @param[in] convolved_dims Output convolved dimensions. */ - void configure(const ITensor *input, ITensor *output, std::pair<unsigned int, unsigned int> convolved_dims); + void configure(const ITensor *input, ITensor *output, const Size2D &convolved_dims); + /** Static function to check if given info will lead to a valid configuration of @ref NECol2ImKernel + * + * @param[in] input The input tensor to convert. Data types supported: U8/S8/QS8/QASYMM8/U16/S16/QS16/F16/U32/S32/F32 + * @param[in] output The output tensor. 3 lower dimensions represent a single output [width, height, OFM], + * while the rest represent batch of outputs. Data types supported: Same as @p input + * @param[in] convolved_dims Output convolved dimensions. + * + * @return an error status + */ + static Error validate(const ITensorInfo *input, const ITensorInfo *output, const Size2D &convolved_dims); // Inherited methods overridden: void run(const Window &window, const ThreadInfo &info) override; @@ -93,7 +105,7 @@ private: Col2ImFunctionPtr _func; const ITensor *_input; ITensor *_output; - std::pair<unsigned int, unsigned int> _convolved_dims; + Size2D _convolved_dims; }; } // namespace arm_compute #endif /*__ARM_COMPUTE_NECOL2IMKERNEL_H__ */ diff --git a/arm_compute/core/NEON/kernels/NEIm2ColKernel.h b/arm_compute/core/NEON/kernels/NEIm2ColKernel.h index 176799e824..5f9df5136b 100644 --- a/arm_compute/core/NEON/kernels/NEIm2ColKernel.h +++ b/arm_compute/core/NEON/kernels/NEIm2ColKernel.h @@ -81,6 +81,19 @@ public: * @param[in] has_bias In case biases are provided expands the matrix with 1. */ void configure(const ITensor *input, ITensor *output, const Size2D &kernel_dims, const PadStrideInfo &conv_info, bool has_bias); + /** Static function to check if given info will lead to a valid configuration of @ref NEIm2ColKernel + * + * @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: QS8/QS16/QASYMM8/F16/F32 + * Note: QASYMM8 works only for has_bias = false + * @param[in] output The output tensor. 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 In case biases are provided expands the matrix with 1. + * + * @return an error status + */ + static Error validate(const ITensorInfo *input, const ITensorInfo *output, const Size2D &kernel_dims, const PadStrideInfo &conv_info, bool has_bias); // Inherited methods overridden: void run(const Window &window, const ThreadInfo &info) override; diff --git a/arm_compute/runtime/NEON/functions/NECol2Im.h b/arm_compute/runtime/NEON/functions/NECol2Im.h index 7794d8673f..ba777c5b64 100644 --- a/arm_compute/runtime/NEON/functions/NECol2Im.h +++ b/arm_compute/runtime/NEON/functions/NECol2Im.h @@ -26,24 +26,35 @@ #include "arm_compute/runtime/NEON/INESimpleFunction.h" +#include "arm_compute/core/Size2D.h" #include "arm_compute/core/Types.h" namespace arm_compute { class ITensor; -/** Basic function to run @ref NECol2ImKernel */ +/** Basic function to run @ref NECol2Im */ class NECol2Im : public INESimpleFunction { public: /** Configure the col2im NEON kernel * - * @param[in] input The input tensor to convert. Data types supported: QS8/QS16/QASYMM8/F16/F32 + * @param[in] input The input tensor to convert. Data types supported: U8/S8/QS8/QASYMM8/U16/S16/QS16/F16/U32/S32/F32 * @param[out] output The output tensor. 3 lower dimensions represent a single output [width, height, OFM], * while the rest represent batch of outputs. Data types supported: Same as @p input * @param[in] convolved_dims Output convolved dimensions. */ - void configure(const ITensor *input, ITensor *output, std::pair<unsigned int, unsigned int> convolved_dims); + void configure(const ITensor *input, ITensor *output, const Size2D &convolved_dims); + /** Static function to check if given info will lead to a valid configuration of @ref NECol2Im + * + * @param[in] input The input tensor to convert. Data types supported: U8/S8/QS8/QASYMM8/U16/S16/QS16/F16/U32/S32/F32 + * @param[in] output The output tensor. 3 lower dimensions represent a single output [width, height, OFM], + * while the rest represent batch of outputs. Data types supported: Same as @p input + * @param[in] convolved_dims Output convolved dimensions. + * + * @return an error status + */ + static Error validate(const ITensorInfo *input, const ITensorInfo *output, const Size2D &convolved_dims); }; } #endif /* __ARM_COMPUTE_NECOL2IM_H__ */ diff --git a/arm_compute/runtime/NEON/functions/NEIm2Col.h b/arm_compute/runtime/NEON/functions/NEIm2Col.h index 913eafabea..4a498514a6 100644 --- a/arm_compute/runtime/NEON/functions/NEIm2Col.h +++ b/arm_compute/runtime/NEON/functions/NEIm2Col.h @@ -48,6 +48,19 @@ public: * @param[in] has_bias In case biases are provided expands the matrix with 1. */ void configure(const ITensor *input, ITensor *output, const Size2D &kernel_dims, const PadStrideInfo &conv_info, bool has_bias); + /** Static function to check if given info will lead to a valid configuration of @ref NEIm2Col + * + * @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: QS8/QS16/QASYMM8/F16/F32 + * Note: QASYMM8 works only for has_bias = false + * @param[in] output The output tensor. 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 In case biases are provided expands the matrix with 1. + * + * @return an error status + */ + static Error validate(const ITensorInfo *input, const ITensorInfo *output, const Size2D &kernel_dims, const PadStrideInfo &conv_info, bool has_bias); }; } #endif /* __ARM_COMPUTE_NEIM2COL_H__ */ |