From f6e475c9a092bc6e0fb53f484fbf2832183a9c44 Mon Sep 17 00:00:00 2001 From: Usama Arif Date: Fri, 10 May 2019 12:06:28 +0100 Subject: COMPMID-2268: Implement NEG for NEON. Change-Id: I90c023dbea8ea12e9af677294ba576b2bfcc02a4 Signed-off-by: Usama Arif Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/184216 Tested-by: bsgcomp Comments-Addressed: bsgcomp Reviewed-by: Pablo Tello Reviewed-on: https://review.mlplatform.org/c/1099 Tested-by: Arm Jenkins Reviewed-by: Pablo Marquez Comments-Addressed: Arm Jenkins --- .../core/NEON/kernels/NEElementwiseUnaryKernel.h | 2 +- arm_compute/core/Types.h | 1 + .../runtime/NEON/functions/NEElementwiseUnaryLayer.h | 20 ++++++++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) (limited to 'arm_compute') diff --git a/arm_compute/core/NEON/kernels/NEElementwiseUnaryKernel.h b/arm_compute/core/NEON/kernels/NEElementwiseUnaryKernel.h index f632b1a93a..2c019b52f0 100644 --- a/arm_compute/core/NEON/kernels/NEElementwiseUnaryKernel.h +++ b/arm_compute/core/NEON/kernels/NEElementwiseUnaryKernel.h @@ -88,7 +88,7 @@ public: protected: // Inherited methods overridden: - static Status validate_arguments(const ITensorInfo &input, const ITensorInfo &output); + static Status validate_arguments(ElementWiseUnary op, const ITensorInfo &input, const ITensorInfo &output); /** Function to use for the particular tensor types passed to configure() */ std::function _function; diff --git a/arm_compute/core/Types.h b/arm_compute/core/Types.h index a2dfbb7d82..544ebff410 100644 --- a/arm_compute/core/Types.h +++ b/arm_compute/core/Types.h @@ -578,6 +578,7 @@ enum class ElementWiseUnary { RSQRT, /**< Reverse square root */ EXP, /**< Exponential */ + NEG, /**< Negate */ }; /** The normalization type used for the normalization layer */ diff --git a/arm_compute/runtime/NEON/functions/NEElementwiseUnaryLayer.h b/arm_compute/runtime/NEON/functions/NEElementwiseUnaryLayer.h index 76827903fa..f4b7e89889 100644 --- a/arm_compute/runtime/NEON/functions/NEElementwiseUnaryLayer.h +++ b/arm_compute/runtime/NEON/functions/NEElementwiseUnaryLayer.h @@ -69,5 +69,25 @@ public: */ static Status validate(const ITensorInfo *input, const ITensorInfo *output); }; + +/** Basic function to negate an input tensor. */ +class NENegLayer : public INESimpleFunction +{ +public: + /** Initialize the function + * + * @param[in] input Input tensor. Data types supported: F16/F32/S32. + * @param[out] output Output tensor. Data types supported: same as @p input. + */ + void configure(const ITensor *input, ITensor *output); + /** Static function to check if given info will lead to a valid configuration of @ref NENegLayer + * + * @param[in] input First tensor input info. Data types supported: F16/F32/S32. + * @param[in] output Output tensor info. Data types supported: Same as @p input. + * + * @return a status + */ + static Status validate(const ITensorInfo *input, const ITensorInfo *output); +}; } // namespace arm_compute #endif /* __ARM_COMPUTE_NEELEMENTWISEUNARYLAYER_H__ */ -- cgit v1.2.1