diff options
Diffstat (limited to 'arm_compute/runtime/CL/functions/CLSoftmaxLayer.h')
-rw-r--r-- | arm_compute/runtime/CL/functions/CLSoftmaxLayer.h | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/arm_compute/runtime/CL/functions/CLSoftmaxLayer.h b/arm_compute/runtime/CL/functions/CLSoftmaxLayer.h index 407827087c..e3feebb762 100644 --- a/arm_compute/runtime/CL/functions/CLSoftmaxLayer.h +++ b/arm_compute/runtime/CL/functions/CLSoftmaxLayer.h @@ -43,16 +43,20 @@ class ICLTensor; * Softmax is calculated by : * @f[ out = exp((x - max(x)) * beta) / sum(exp((x - max(x)) * beta)) @f] * + * Log Softmax is calculated by : + * @f[ out = (x - max(x) * beta) - \sum{e^{x - max(x) * beta}} @f] + * * This function runs the following kernels: * -# @ref CLLogits1DMaxKernel * -# @ref CLLogits1DShiftExpSumKernel * -# @ref CLLogits1DNormKernel */ -class CLSoftmaxLayer : public IFunction +template <bool IS_LOG = false> +class CLSoftmaxLayerGeneric : public IFunction { public: /** Constructor */ - CLSoftmaxLayer(std::shared_ptr<IMemoryManager> memory_manager = nullptr); + CLSoftmaxLayerGeneric(std::shared_ptr<IMemoryManager> memory_manager = nullptr); /** Set the input and output tensors. * * @param[in] input Source tensor. Data types supported: QASYMM8/F16/F32 @@ -106,5 +110,8 @@ private: CLTensor _output_flattened; bool _needs_flattening; }; -} + +using CLSoftmaxLayer = CLSoftmaxLayerGeneric<false>; +using CLLogSoftmaxLayer = CLSoftmaxLayerGeneric<true>; +} // namespace arm_compute #endif /* __ARM_COMPUTE_CLSOFTMAXLAYER_H__ */ |