diff options
author | George Wort <george.wort@arm.com> | 2019-01-15 11:00:29 +0000 |
---|---|---|
committer | George Wort <george.wort@arm.com> | 2019-01-21 16:37:31 +0000 |
commit | a1e7e2818ab282e4d3b707feb5783b4bd4fbe45b (patch) | |
tree | 30c4395d0b18e90f5e1cbbf5ee1612c2ea679774 /src/core/NEON | |
parent | d88590f4022bfb6eda3bad4fa599727bab723667 (diff) | |
download | ComputeLibrary-a1e7e2818ab282e4d3b707feb5783b4bd4fbe45b.tar.gz |
COMPMID-1768: NEON: Implement RealDiv
Change-Id: I0868669f7b733df141794fba1d79436e7581bd3a
Reviewed-on: https://review.mlplatform.org/426
Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com>
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/core/NEON')
-rw-r--r-- | src/core/NEON/kernels/NEElementwiseOperationKernel.cpp | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/src/core/NEON/kernels/NEElementwiseOperationKernel.cpp b/src/core/NEON/kernels/NEElementwiseOperationKernel.cpp index 88fd730554..99a3b5ac66 100644 --- a/src/core/NEON/kernels/NEElementwiseOperationKernel.cpp +++ b/src/core/NEON/kernels/NEElementwiseOperationKernel.cpp @@ -123,6 +123,11 @@ inline ScalarType elementwise_arithm_op_scalar(const ScalarType &a, const Scalar res = (a - b) * (a - b); break; } + case ArithmeticOperation::DIV: + { + res = a / b; + break; + } default: ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); } @@ -154,7 +159,6 @@ inline VectorType elementwise_arithm_op(const VectorType &a, const VectorType &b res = wrapper::vmul(tmp, tmp); break; } - default: ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); } @@ -162,6 +166,20 @@ inline VectorType elementwise_arithm_op(const VectorType &a, const VectorType &b return res; } +template <> +inline float32x4_t elementwise_arithm_op<ArithmeticOperation::DIV, float32x4_t>(const float32x4_t &a, const float32x4_t &b) +{ + return wrapper::vdiv(a, b); +} + +#ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC +template <> +inline float16x8_t elementwise_arithm_op<ArithmeticOperation::DIV, float16x8_t>(const float16x8_t &a, const float16x8_t &b) +{ + return wrapper::vdiv(a, b); +} +#endif // __ARM_FEATURE_FP16_VECTOR_ARITHMETIC + template <ArithmeticOperation op> inline float32x4x4_t elementwise_arithm_op(const float32x4x4_t &a, const float32x4x4_t &b) { @@ -833,6 +851,28 @@ Status NEArithmeticOperationKernel::validate(ArithmeticOperation op, const ITens return Status{}; } +/** The division operator */ + +void NEDivisionOperationKernel::configure(const ITensor *input1, const ITensor *input2, ITensor *output) +{ + ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(*input1->info(), *input2->info(), *output->info())); + configure_common(input1, input2, output); + _function = configure_arithm_func<ArithmeticOperation::DIV>(input1, input2, output); +} + +Status NEDivisionOperationKernel::validate_arguments(const ITensorInfo &input1, const ITensorInfo &input2, const ITensorInfo &output) +{ + ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(&input1, 1, DataType::F16, DataType::F32); + return NEArithmeticOperationKernel::validate_arguments(input1, input2, output); +} + +Status NEDivisionOperationKernel::validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output) +{ + ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(input1, input2, output); + ARM_COMPUTE_RETURN_ON_ERROR(validate_arguments(*input1, *input2, *output)); + return Status{}; +} + /** Comparison operators (equal, not equal, less than, greater than, less than or equal, greater than or equal) */ void NEComparisonOperationKernel::configure(ComparisonOperation op, const ITensor *input1, const ITensor *input2, ITensor *output) |