aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/cpu/operators/CpuElementwise.cpp
diff options
context:
space:
mode:
authorSang-Hoon Park <sang-hoon.park@arm.com>2021-02-17 13:12:53 +0000
committerGeorgios Pinitas <georgios.pinitas@arm.com>2021-03-11 14:50:55 +0000
commit6b0bf9972975aff01e42e5790f7b7c98cd835afb (patch)
tree5e0a50af1e5a7e325621d762d7a6c523592d2e6f /src/runtime/cpu/operators/CpuElementwise.cpp
parentd7de9c50c85be2a01b9fef2867c3be140685fd6d (diff)
downloadComputeLibrary-6b0bf9972975aff01e42e5790f7b7c98cd835afb.tar.gz
Add CpuPRelu operators
Implements: COMPMID-4184 Change-Id: I252168b460a18f837a26df5641664e95ddbd9c7e Signed-off-by: Sang-Hoon Park <sang-hoon.park@arm.com> Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/5237 Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Manuel Bottini <manuel.bottini@arm.com> Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/runtime/cpu/operators/CpuElementwise.cpp')
-rw-r--r--src/runtime/cpu/operators/CpuElementwise.cpp37
1 files changed, 10 insertions, 27 deletions
diff --git a/src/runtime/cpu/operators/CpuElementwise.cpp b/src/runtime/cpu/operators/CpuElementwise.cpp
index 5457825bd5..8953d4769c 100644
--- a/src/runtime/cpu/operators/CpuElementwise.cpp
+++ b/src/runtime/cpu/operators/CpuElementwise.cpp
@@ -44,41 +44,24 @@ void CpuElementwiseBase::run(ITensorPack &tensors)
ICpuOperator::run(tensors, shape_and_window.second);
}
-void CpuElementwiseMax::configure(const ITensorInfo *src0, const ITensorInfo *src1, ITensorInfo *dst)
+template <ArithmeticOperation op>
+void CpuElementwiseArithmetic<op>::configure(const ITensorInfo *src0, const ITensorInfo *src1, ITensorInfo *dst)
{
auto k = std::make_unique<kernels::CpuArithmeticKernel>();
- k->configure(ArithmeticOperation::MAX, src0, src1, dst);
- _kernel = std::move(k);
-}
-
-Status CpuElementwiseMax::validate(const ITensorInfo *src0, const ITensorInfo *src1, const ITensorInfo *dst)
-{
- return kernels::CpuArithmeticKernel::validate(ArithmeticOperation::MAX, src0, src1, dst);
-}
-
-void CpuElementwiseMin::configure(const ITensorInfo *src0, const ITensorInfo *src1, ITensorInfo *dst)
-{
- auto k = std::make_unique<kernels::CpuArithmeticKernel>();
- k->configure(ArithmeticOperation::MIN, src0, src1, dst);
+ k->configure(op, src0, src1, dst);
_kernel = std::move(k);
}
-Status CpuElementwiseMin::validate(const ITensorInfo *src0, const ITensorInfo *src1, const ITensorInfo *dst)
-{
- return kernels::CpuArithmeticKernel::validate(ArithmeticOperation::MIN, src0, src1, dst);
-}
-
-void CpuElementwiseSquaredDiff::configure(const ITensorInfo *src0, const ITensorInfo *src1, ITensorInfo *dst)
+template <ArithmeticOperation op>
+Status CpuElementwiseArithmetic<op>::validate(const ITensorInfo *src0, const ITensorInfo *src1, const ITensorInfo *dst)
{
- auto k = std::make_unique<kernels::CpuArithmeticKernel>();
- k->configure(ArithmeticOperation::SQUARED_DIFF, src0, src1, dst);
- _kernel = std::move(k);
+ return kernels::CpuArithmeticKernel::validate(op, src0, src1, dst);
}
-Status CpuElementwiseSquaredDiff::validate(const ITensorInfo *src0, const ITensorInfo *src1, const ITensorInfo *dst)
-{
- return kernels::CpuArithmeticKernel::validate(ArithmeticOperation::SQUARED_DIFF, src0, src1, dst);
-}
+template class CpuElementwiseArithmetic<ArithmeticOperation::MAX>;
+template class CpuElementwiseArithmetic<ArithmeticOperation::MIN>;
+template class CpuElementwiseArithmetic<ArithmeticOperation::SQUARED_DIFF>;
+template class CpuElementwiseArithmetic<ArithmeticOperation::PRELU>;
void CpuElementwiseDivision::configure(const ITensorInfo *src0, const ITensorInfo *src1, ITensorInfo *dst)
{