diff options
Diffstat (limited to 'src/core/cpu/kernels')
-rw-r--r-- | src/core/cpu/kernels/CpuMulKernel.cpp (renamed from src/core/cpu/kernels/CpuPixelWiseMultiplicationKernel.cpp) | 24 | ||||
-rw-r--r-- | src/core/cpu/kernels/CpuMulKernel.h (renamed from src/core/cpu/kernels/CpuPixelWiseMultiplicationKernel.h) | 53 |
2 files changed, 26 insertions, 51 deletions
diff --git a/src/core/cpu/kernels/CpuPixelWiseMultiplicationKernel.cpp b/src/core/cpu/kernels/CpuMulKernel.cpp index 91b7552ecf..dabf656e6e 100644 --- a/src/core/cpu/kernels/CpuPixelWiseMultiplicationKernel.cpp +++ b/src/core/cpu/kernels/CpuMulKernel.cpp @@ -21,7 +21,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include "src/core/cpu/kernels/CpuPixelWiseMultiplicationKernel.h" +#include "src/core/cpu/kernels/CpuMulKernel.h" #include "arm_compute/core/ITensor.h" #include "arm_compute/core/TensorInfo.h" @@ -1475,7 +1475,7 @@ void mul_U8_S16_S16(const ITensor *src1, const ITensor *src2, ITensor *out, cons } } // namespace -void CpuPixelWiseMultiplicationKernel::configure(ITensorInfo *src1, ITensorInfo *src2, ITensorInfo *dst, float scale, ConvertPolicy overflow_policy, RoundingPolicy rounding_policy) +void CpuMulKernel::configure(ITensorInfo *src1, ITensorInfo *src2, ITensorInfo *dst, float scale, ConvertPolicy overflow_policy, RoundingPolicy rounding_policy) { ARM_COMPUTE_UNUSED(rounding_policy); ARM_COMPUTE_ERROR_ON_NULLPTR(src1, src2, dst); @@ -1623,8 +1623,8 @@ void CpuPixelWiseMultiplicationKernel::configure(ITensorInfo *src1, ITensorInfo ICpuKernel::configure(win); } -Status CpuPixelWiseMultiplicationKernel::validate(const ITensorInfo *src1, const ITensorInfo *src2, const ITensorInfo *dst, float scale, ConvertPolicy overflow_policy, - RoundingPolicy rounding_policy) +Status CpuMulKernel::validate(const ITensorInfo *src1, const ITensorInfo *src2, const ITensorInfo *dst, float scale, ConvertPolicy overflow_policy, + RoundingPolicy rounding_policy) { ARM_COMPUTE_ERROR_ON_NULLPTR(src1, src2, dst); ARM_COMPUTE_RETURN_ON_ERROR(validate_arguments(src1, src2, dst, scale, overflow_policy, rounding_policy)); @@ -1632,7 +1632,7 @@ Status CpuPixelWiseMultiplicationKernel::validate(const ITensorInfo *src1, const return Status{}; } -void CpuPixelWiseMultiplicationKernel::run_op(ITensorPack &tensors, const Window &window, const ThreadInfo &info) +void CpuMulKernel::run_op(ITensorPack &tensors, const Window &window, const ThreadInfo &info) { ARM_COMPUTE_UNUSED(info); ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(this); @@ -1656,9 +1656,9 @@ void CpuPixelWiseMultiplicationKernel::run_op(ITensorPack &tensors, const Window (*_func_float)(src1, src2, dst, window, _scale); } } -const char *CpuPixelWiseMultiplicationKernel::name() const +const char *CpuMulKernel::name() const { - return "CpuPixelWiseMultiplicationKernel"; + return "CpuMulKernel"; } namespace { @@ -1682,7 +1682,7 @@ Status validate_arguments_complex(const ITensorInfo *src1, const ITensorInfo *sr } } // namespace -void CpuComplexPixelWiseMultiplicationKernel::configure(ITensorInfo *src1, ITensorInfo *src2, ITensorInfo *dst) +void CpuComplexMulKernel::configure(ITensorInfo *src1, ITensorInfo *src2, ITensorInfo *dst) { ARM_COMPUTE_ERROR_ON_NULLPTR(src1, src2, dst); ARM_COMPUTE_ERROR_THROW_ON(validate_arguments_complex(src1, src2, dst)); @@ -1699,7 +1699,7 @@ void CpuComplexPixelWiseMultiplicationKernel::configure(ITensorInfo *src1, ITens ICpuKernel::configure(win); } -Status CpuComplexPixelWiseMultiplicationKernel::validate(const ITensorInfo *src1, const ITensorInfo *src2, const ITensorInfo *dst) +Status CpuComplexMulKernel::validate(const ITensorInfo *src1, const ITensorInfo *src2, const ITensorInfo *dst) { ARM_COMPUTE_ERROR_ON_NULLPTR(src1, src2, dst); ARM_COMPUTE_RETURN_ON_ERROR(validate_arguments_complex(src1, src2, dst)); @@ -1707,7 +1707,7 @@ Status CpuComplexPixelWiseMultiplicationKernel::validate(const ITensorInfo *src1 return Status{}; } -void CpuComplexPixelWiseMultiplicationKernel::run_op(ITensorPack &tensors, const Window &window, const ThreadInfo &info) +void CpuComplexMulKernel::run_op(ITensorPack &tensors, const Window &window, const ThreadInfo &info) { ARM_COMPUTE_UNUSED(info); ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(this); @@ -1720,9 +1720,9 @@ void CpuComplexPixelWiseMultiplicationKernel::run_op(ITensorPack &tensors, const c_mul_F32_F32_F32_n(src1, src2, dst, window); } -const char *CpuComplexPixelWiseMultiplicationKernel::name() const +const char *CpuComplexMulKernel::name() const { - return "CpuComplexPixelWiseMultiplicationKernel"; + return "CpuComplexMulKernel"; } } // namespace kernels } // namespace cpu diff --git a/src/core/cpu/kernels/CpuPixelWiseMultiplicationKernel.h b/src/core/cpu/kernels/CpuMulKernel.h index 567f08d06e..3e667bc4be 100644 --- a/src/core/cpu/kernels/CpuPixelWiseMultiplicationKernel.h +++ b/src/core/cpu/kernels/CpuMulKernel.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_CPU_PIXELWISE_MULTIPLICATION_KERNEL_H -#define ARM_COMPUTE_CPU_PIXELWISE_MULTIPLICATION_KERNEL_H +#ifndef ARM_COMPUTE_CPU_MUL_KERNEL_H +#define ARM_COMPUTE_CPU_MUL_KERNEL_H #include "src/core/common/Macros.h" #include "src/core/cpu/ICpuKernel.h" @@ -33,13 +33,13 @@ namespace cpu { namespace kernels { -/** Interface for the kernel to perform addition between two tensors */ -class CpuPixelWiseMultiplicationKernel : public ICpuKernel +/** Interface for the kernel to perform multiplication between two tensors */ +class CpuMulKernel : public ICpuKernel { public: /** Default constructor */ - CpuPixelWiseMultiplicationKernel() = default; - ARM_COMPUTE_DISALLOW_COPY_ALLOW_MOVE(CpuPixelWiseMultiplicationKernel); + CpuMulKernel() = default; + ARM_COMPUTE_DISALLOW_COPY_ALLOW_MOVE(CpuMulKernel); /** Initialise the kernel's input, dst and border mode. * * Valid configurations (Src1,Src2) -> Dst : @@ -69,32 +69,9 @@ public: * @param[in] rounding_policy Rounding policy. */ void configure(ITensorInfo *src1, ITensorInfo *src2, ITensorInfo *dst, float scale, ConvertPolicy overflow_policy, RoundingPolicy rounding_policy); - /** Static function to check if given info will lead to a valid configuration of @ref CpuPixelWiseMultiplicationKernel + /** Static function to check if given info will lead to a valid configuration * - * Valid configurations (Src1,Src2) -> Dst : - * Support: Broadcast? Scale=1/255? - * - (U8,U8) -> U8, S16 N Y - * - (U8,S16) -> S16 N Y - * - (S16,U8) -> S16 N Y - * - (S16,S16) -> S16 N Y - * - (S32,S32) -> S32 Y N - * - (F16,F16) -> F16 N Y - * - (F32,F32) -> F32 Y Y - * - (QASYMM8,QASYMM8) -> QASYMM8 Y Y - * - (QASYMM8_SIGNED,QASYMM8_SIGNED) -> QASYMM8_SIGNED Y Y - * - (QSYMM16,QSYMM16) -> QSYMM16, S32 N Y - * - * @note For @p scale equal to 1/255 only round to nearest even (implemented as round half up) is supported. - * For all other scale values only round to zero (implemented as round towards minus infinity) is supported. - * - * @param[in] src1 First src tensor info. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/S32/QSYMM16/F16/F32 - * @param[in] src2 Second src tensor info. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/S32/QSYMM16/F16/F32 - * @param[in] dst Dst tensor info. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/S32/QSYMM16/F16/F32 - * @param[in] scale Scale to apply after multiplication. - * Scale must be positive and its value must be either 1/255 or 1/2^n where n is between 0 and 15. - * If both @p src1, @p src2 and @p dst are of datatype S32, scale cannot be 1/255 - * @param[in] overflow_policy Overflow policy. ConvertPolicy cannot be WRAP if any of the srcs is of quantized datatype - * @param[in] rounding_policy Rounding policy. + * Similar to @ref CpuMulKernel::configure() * * @return a status */ @@ -142,12 +119,12 @@ private: }; /** Interface for the complex pixelwise multiplication kernel. */ -class CpuComplexPixelWiseMultiplicationKernel : public ICpuKernel +class CpuComplexMulKernel : public ICpuKernel { public: /** Default constructor */ - CpuComplexPixelWiseMultiplicationKernel() = default; - ARM_COMPUTE_DISALLOW_COPY_ALLOW_MOVE(CpuComplexPixelWiseMultiplicationKernel); + CpuComplexMulKernel() = default; + ARM_COMPUTE_DISALLOW_COPY_ALLOW_MOVE(CpuComplexMulKernel); /** Initialise the kernel's src, dst and border mode. * * @param[in] src1 An src tensor. Data types supported: F32. Number of channels supported: 2 (complex tensor). @@ -155,11 +132,9 @@ public: * @param[out] dst The dst tensor, Data types supported: same as @p src1. Number of channels supported: same as @p src1. */ void configure(ITensorInfo *src1, ITensorInfo *src2, ITensorInfo *dst); - /** Static function to check if given info will lead to a valid configuration of @ref CpuComplexPixelWiseMultiplicationKernel + /** Static function to check if given info will lead to a valid configuration * - * @param[in] src1 An src tensor info. Data types supported: F32. Number of channels supported: 2 (complex tensor). - * @param[in] src2 An src tensor info. Data types supported: same as @p src1. Number of channels supported: same as @p src1. - * @param[in] dst The dst tensor info. Data types supported: same as @p src1. Number of channels supported: same as @p src1. + * Similar to @ref CpuComplexMulKernel::configure() * * @return a status */ @@ -172,4 +147,4 @@ public: } // namespace kernels } // namespace cpu } // namespace arm_compute -#endif /*ARM_COMPUTE_CPU_PIXELWISE_MULTIPLICATION_KERNEL_H */ +#endif /* ARM_COMPUTE_CPU_MUL_KERNEL_H */ |