diff options
author | John Richardson <john.richardson@arm.com> | 2018-05-08 14:34:33 +0100 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:52:35 +0000 |
commit | 73d4aef12463ac42fa9e31174675f32535a7edd8 (patch) | |
tree | 31707cdf30e99ee6a0e55db4eda34090349bc572 /arm_compute | |
parent | 5415a0267523931bae0a012db2438fa7cc89a549 (diff) | |
download | ComputeLibrary-73d4aef12463ac42fa9e31174675f32535a7edd8.tar.gz |
COMPMID-948: Add validation to NEL2NormalizeLayer
Change-Id: I0cfea24884066412c2f13d9acdb72ddbccac7545
Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/130407
Tested-by: Jenkins <bsgcomp@arm.com>
Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
Diffstat (limited to 'arm_compute')
4 files changed, 70 insertions, 17 deletions
diff --git a/arm_compute/core/NEON/kernels/NEL2NormalizeLayerKernel.h b/arm_compute/core/NEON/kernels/NEL2NormalizeLayerKernel.h index 7fb968e1d8..0de07fdab7 100644 --- a/arm_compute/core/NEON/kernels/NEL2NormalizeLayerKernel.h +++ b/arm_compute/core/NEON/kernels/NEL2NormalizeLayerKernel.h @@ -21,8 +21,8 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_NEL2NORMALIZEKERNEL_H__ -#define __ARM_COMPUTE_NEL2NORMALIZEKERNEL_H__ +#ifndef __ARM_COMPUTE_NEL2NORMALIZELAYERKERNEL_H__ +#define __ARM_COMPUTE_NEL2NORMALIZELAYERKERNEL_H__ #include "arm_compute/core/NEON/INEKernel.h" @@ -52,14 +52,30 @@ public: ~NEL2NormalizeLayerKernel() = default; /** Set the input and output tensors. * - * @param[in] input Source tensor. Data types supported: F32. + * @param[in] input Source tensor. Data types supported: F32. Data layouts supported: NCHW. * @param[in] sum Sum values tensor. Data types supported: same as @p input. - * @param[out] output Destination tensor. Data types supported: same as @p input. + * Sum will have the same number of dimensions as input. + * @param[out] output Destination tensor. Data types and data layouts supported: same as @p input. + * Output will have the same number of dimensions as input. * @param[in] axis Dimension along which to reduce. Supported reduction axis : 0 * @param[in] epsilon Lower bound value for the normalization. */ void configure(const ITensor *input, const ITensor *sum, ITensor *output, unsigned int axis, float epsilon); + /** Static function to check if given info will lead to a valid configuration of @ref NEL2NormalizeLayerKernel. + * + * @param[in] input Source tensor info. Data types supported: F32. Data layouts supported: NCHW. + * @param[in] sum Sum values tensor info. Data types supported: same as @p input. + * Sum will have the same number of dimensions as input. + * @param[in] output Destination tensor info. Data types and data layouts supported: same as @p input. + * Output will have the same number of dimensions as input. + * @param[in] axis Dimension along which to reduce. Supported reduction axis : 0 + * @param[in] epsilon Lower bound value for the normalization. + * + * @return a status + */ + static Status validate(const ITensorInfo *input, const ITensorInfo *sum, const ITensorInfo *output, unsigned int axis, float epsilon); + // Inherited methods overridden: void run(const Window &window, const ThreadInfo &info) override; @@ -71,4 +87,4 @@ private: float _epsilon; }; } // namespace arm_compute -#endif /*__ARM_COMPUTE_NEL2NORMALIZEKERNEL_H__ */ +#endif /*__ARM_COMPUTE_NEL2NORMALIZELAYERKERNEL_H__ */ diff --git a/arm_compute/core/NEON/kernels/NEReductionOperationKernel.h b/arm_compute/core/NEON/kernels/NEReductionOperationKernel.h index a5ddd067ef..a20cd46434 100644 --- a/arm_compute/core/NEON/kernels/NEReductionOperationKernel.h +++ b/arm_compute/core/NEON/kernels/NEReductionOperationKernel.h @@ -50,14 +50,29 @@ public: NEReductionOperationKernel &operator=(NEReductionOperationKernel &&) = default; /** Default destructor */ ~NEReductionOperationKernel() = default; + /** Set the source, destination of the kernel * - * @param[in] input Source tensor. Data type supported: F32. - * @param[out] output Destination tensor.Data types supported: same as @p input. + * @param[in] input Source tensor. Data type supported: F32. Data layouts supported: NCHW. + * @param[out] output Destination tensor.Data types and data layouts supported: same as @p input. + * Output will have the same number of dimensions as input. * @param[in] axis Axis along which to reduce. Supported reduction axis : 0 * @param[in] op Reduction operation to perform. */ void configure(const ITensor *input, ITensor *output, unsigned int axis, ReductionOperation op); + + /** Static function to check if given info will lead to a valid configuration of @ref NEReductionOperationKernel. + * + * @param[in] input Source tensor info. Data type supported: F32. Data layouts supported: NCHW. + * @param[in] output Destination tensor info.Data types and data layouts supported: same as @p input. + * Output will have the same number of dimensions as input. + * @param[in] axis Axis along which to reduce. Supported reduction axis : 0 + * @param[in] op Reduction operation to perform. + * + * @return a status + */ + static Status validate(const ITensorInfo *input, const ITensorInfo *output, unsigned int axis, ReductionOperation op); + // Inherited methods overridden: void run(const Window &window, const ThreadInfo &info) override; BorderSize border_size() const override; diff --git a/arm_compute/runtime/NEON/functions/NEL2NormalizeLayer.h b/arm_compute/runtime/NEON/functions/NEL2NormalizeLayer.h index 100e239406..3c88bbd9d3 100644 --- a/arm_compute/runtime/NEON/functions/NEL2NormalizeLayer.h +++ b/arm_compute/runtime/NEON/functions/NEL2NormalizeLayer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2017-2018 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -21,8 +21,8 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_NEL2NORMALIZE_H__ -#define __ARM_COMPUTE_NEL2NORMALIZE_H__ +#ifndef __ARM_COMPUTE_NEL2NORMALIZELAYER_H__ +#define __ARM_COMPUTE_NEL2NORMALIZELAYER_H__ #include "arm_compute/core/NEON/kernels/NEL2NormalizeLayerKernel.h" #include "arm_compute/runtime/IFunction.h" @@ -50,13 +50,24 @@ public: NEL2NormalizeLayer(std::shared_ptr<IMemoryManager> memory_manager = nullptr); /** Set the input and output tensors. * - * @param[in, out] input Source tensor. Data types supported: F32. (Written to only for border_size != 0) - * @param[out] output Destination tensor. Data types supported: same as @p input. + * @param[in, out] input Source tensor. Data types supported: F32. Data layouts supported: NCHW. (Written to only for border_size != 0) + * @param[out] output Destination tensor. Data types and data layouts supported: same as @p input. * @param[in] axis Dimension along which to reduce. Supported reduction axis : 0 - * @param[in] epsilon Lower bound value for the normalization. + * @param[in] epsilon (Optional) Lower bound value for the normalization. */ void configure(ITensor *input, ITensor *output, unsigned int axis, float epsilon = 1e-12); + /** Static function to check if given info will lead to a valid configuration of @ref NEL2NormalizeLayer. + * + * @param[in] input Source tensor info. Data types supported: F32. Data layouts supported: NCHW. (Written to only for border_size != 0) + * @param[in] output Destination tensor info. Data types and data layouts supported: same as @p input. + * @param[in] axis Dimension along which to reduce. Supported reduction axis : 0 + * @param[in] epsilon (Optional) Lower bound value for the normalization. + * + * @return a status + */ + static Status validate(const ITensorInfo *input, const ITensorInfo *output, unsigned int axis, float epsilon = 1e-12); + // Inherited methods overridden: void run() override; @@ -67,4 +78,4 @@ private: Tensor _sumsq; }; } -#endif /* __ARM_COMPUTE_NEL2NORMALIZE_H__ */ +#endif /* __ARM_COMPUTE_NEL2NORMALIZELAYER_H__ */ diff --git a/arm_compute/runtime/NEON/functions/NEReductionOperation.h b/arm_compute/runtime/NEON/functions/NEReductionOperation.h index 9aa5228b16..02b29fb64e 100644 --- a/arm_compute/runtime/NEON/functions/NEReductionOperation.h +++ b/arm_compute/runtime/NEON/functions/NEReductionOperation.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2017-2018 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -47,13 +47,24 @@ public: NEReductionOperation(); /** Set the input and output tensors. * - * @param[in, out] input Source tensor. Data type supported: F32. (Written to only for border_size != 0) - * @param[out] output Destination tensor. Data types supported: same as @p input. + * @param[in, out] input Source tensor. Data type supported: F32. Data layouts supported: NCHW. (Written to only for border_size != 0) + * @param[out] output Destination tensor. Data types and data layouts supported: same as @p input. * @param[in] axis Dimension along which to reduce. Supported reduction axis : 0 * @param[in] op Reduction operation to perform. */ void configure(ITensor *input, ITensor *output, unsigned int axis, ReductionOperation op); + /** Static function to check if given info will lead to a valid configuration of @ref NEReductionOperation. + * + * @param[in] input Source tensor info. Data type supported: F32. Data layouts supported: NCHW. (Written to only for border_size != 0) + * @param[in] output Destination tensor info. Data types and data layouts supported: same as @p input. + * @param[in] axis Dimension along which to reduce. Supported reduction axis : 0 + * @param[in] op Reduction operation to perform. + * + * @return a status + */ + static Status validate(const ITensorInfo *input, const ITensorInfo *output, unsigned int axis, ReductionOperation op); + // Inherited methods overridden: void run() override; |