diff options
Diffstat (limited to 'arm_compute')
-rw-r--r-- | arm_compute/core/NEON/kernels/NEElementwiseOperationKernel.h | 29 | ||||
-rw-r--r-- | arm_compute/core/Types.h | 1 | ||||
-rw-r--r-- | arm_compute/runtime/NEON/functions/NEElementwiseOperations.h | 27 |
3 files changed, 57 insertions, 0 deletions
diff --git a/arm_compute/core/NEON/kernels/NEElementwiseOperationKernel.h b/arm_compute/core/NEON/kernels/NEElementwiseOperationKernel.h index 351b346c5a..195fd8951d 100644 --- a/arm_compute/core/NEON/kernels/NEElementwiseOperationKernel.h +++ b/arm_compute/core/NEON/kernels/NEElementwiseOperationKernel.h @@ -151,6 +151,35 @@ protected: static Status validate_arguments(const ITensorInfo &input1, const ITensorInfo &input2, const ITensorInfo &output); }; +class NEPowerOperationKernel : public NEArithmeticOperationKernel +{ +public: + /** Default constructor */ + NEPowerOperationKernel() = default; + + /** Static function to check if given info will lead to a valid configuration of @ref NEArithmeticOperationKernel + * + * @param[in] input1 First tensor input. Data types supported: F16/F32. + * @param[in] input2 Second tensor input. Data types supported: Same as @p input1. + * @param[out] output Output tensor. Data types supported: Same as @p input1. + */ + void configure(const ITensor *input1, const ITensor *input2, ITensor *output); + + /** Static function to check if given info will lead to a valid configuration of @ref NEArithmeticOperationKernel + * + * @param[in] input1 First tensor input info. Data types supported: F16/F32. + * @param[in] input2 Second tensor input info. Data types supported: Same as @p input1. + * @param[out] output Output tensor info. Data types supported: Same as @p input1. + * + * @return a Status + */ + static Status validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output); + +protected: + // Inherited methods overridden: + static Status validate_arguments(const ITensorInfo &input1, const ITensorInfo &input2, const ITensorInfo &output); +}; + class NEComparisonOperationKernel : public NEElementwiseOperationKernel { public: diff --git a/arm_compute/core/Types.h b/arm_compute/core/Types.h index 9ecd7ff2e1..99ec44d5e0 100644 --- a/arm_compute/core/Types.h +++ b/arm_compute/core/Types.h @@ -571,6 +571,7 @@ enum class ArithmeticOperation MIN, /**< Min(x, y) */ MAX, /**< Max(x, y) */ SQUARED_DIFF, /**< (x - y)^2 */ + POWER, /**< x ^ y */ }; /** Available element wise unary operations */ diff --git a/arm_compute/runtime/NEON/functions/NEElementwiseOperations.h b/arm_compute/runtime/NEON/functions/NEElementwiseOperations.h index ca3717a709..586546c8bc 100644 --- a/arm_compute/runtime/NEON/functions/NEElementwiseOperations.h +++ b/arm_compute/runtime/NEON/functions/NEElementwiseOperations.h @@ -135,6 +135,33 @@ public: static Status validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output); }; +/** Basic function to run @ref NEArithmeticOperationKernel for power + * + * @note The tensor data type for the inputs must be F16/F32. + * @note The function performs a elementwise power of in1 to in2 (i.e., out[i] = in1[i] ^ in2[i]) + * @note For an exponent that is a float, this function will only work with a positive base. + */ +class NEElementwisePower : public INESimpleFunction +{ +public: + /** Initialise the kernel's inputs, output and conversion policy. + * + * @param[in, out] input1 First tensor input. Data types supported: F16/F32. + * @param[in, out] input2 Second tensor input. Data types supported: Same as @p input1. + * @param[out] output Output tensor. Data types supported: Same as @p input1. + */ + void configure(ITensor *input1, ITensor *input2, ITensor *output); + /** Static function to check if given info will lead to a valid configuration of @ref NEArithmeticOperationKernel for power + * + * @param[in] input1 First tensor input info. Data types supported: F16/F32. + * @param[in] input2 Second tensor input info. Data types supported: Same as @p input1. + * @param[in] output Output tensor info. Data types supported: Same as @p input1. + * + * @return a status + */ + static Status validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output); +}; + /** Basic function to run @ref NEComparisonOperationKernel. * * @note The tensor data type for the inputs must be QASYMM8/S16/F16/S32/F32. |