diff options
Diffstat (limited to 'src/core/cpu/kernels/CpuSoftmaxKernel.h')
-rw-r--r-- | src/core/cpu/kernels/CpuSoftmaxKernel.h | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/src/core/cpu/kernels/CpuSoftmaxKernel.h b/src/core/cpu/kernels/CpuSoftmaxKernel.h index aa10467965..2912098c30 100644 --- a/src/core/cpu/kernels/CpuSoftmaxKernel.h +++ b/src/core/cpu/kernels/CpuSoftmaxKernel.h @@ -38,7 +38,7 @@ class CpuLogits1DMaxKernel : public ICpuKernel { public: /** Constructor */ - CpuLogits1DMaxKernel(); + CpuLogits1DMaxKernel() = default; ARM_COMPUTE_DISALLOW_COPY_ALLOW_MOVE(CpuLogits1DMaxKernel); /** Set the input and output tensors. * @@ -46,10 +46,9 @@ public: * @param[out] dst Destination tensor info. Data types supported: same as @p input */ void configure(const ITensorInfo *src, ITensorInfo *dst); - /** Static function to check if given info will lead to a valid configuration of @ref CpuLogits1DMaxKernel + /** Static function to check if given info will lead to a valid configuration * - * @param[in] src Source tensor info. Data types supported: QASYMM8/QASYMM8_SIGNED/F16/F32. - * @param[in] dst Destination tensor info. Data types supported: same as @p input + * Similar to CpuLogits1DMaxKernel::configure() * * @return a status */ @@ -58,6 +57,13 @@ public: // Inherited methods overridden: void run_op(ITensorPack &tensors, const Window &window, const ThreadInfo &info) override; const char *name() const override; + +private: + using SoftmaxLogits1DMaxKernelPtr = std::add_pointer<void(const ITensor *, ITensor *, const Window &)>::type; + +private: + SoftmaxLogits1DMaxKernelPtr _run_method{ nullptr }; + std::string _name{}; }; /** Interface for softmax computation for QASYMM8 with pre-computed max. */ @@ -66,7 +72,7 @@ class CpuLogits1DSoftmaxKernel : public ICpuKernel { public: /** Default constructor */ - CpuLogits1DSoftmaxKernel(); + CpuLogits1DSoftmaxKernel() = default; ARM_COMPUTE_DISALLOW_COPY_ALLOW_MOVE(CpuLogits1DSoftmaxKernel); /** Set the input and output tensors. @@ -80,14 +86,9 @@ public: * @param tmp Auxiliary tensor info. Must be type F32 and same shape as the input. */ void configure(const ITensorInfo *src, const ITensorInfo *max, ITensorInfo *dst, const float beta, ITensorInfo *tmp); - /** Static function to check if given info will lead to a valid configuration of @ref CpuLogits1DSoftmaxKernel + /** Static function to check if given info will lead to a valid configuration * - * @param[in] src Source tensor info. Data types supported: QASYMM8/QASYMM8_SIGNED/F16/F32. - * @param[in] max Max values tensor info. Same shape as input with dimension 0 set to 1. - * Data types supported: same as @p input. - * @param[in] dst Destination tensor info. Data types supported: same as @p input. - * @param[in] beta A scaling factor for the exponent. - * @param[in] tmp Tensor info of auxiliary. Must be type F32 and same shape as the input. + * Similar to CpuLogits1DSoftmaxKernel::configure() * * @return a status */ @@ -99,7 +100,12 @@ public: const char *name() const override; private: - float _beta; + using SoftmaxLogits1DKernelPtr = std::add_pointer<void(const ITensor *, const ITensor *, void *const, ITensor *, float, bool, const Window &)>::type; + +private: + float _beta{ 1.0f }; + SoftmaxLogits1DKernelPtr _run_method{ nullptr }; + std::string _name{}; }; } // namespace kernels } // namespace cpu |