From 87e896a46a9403813654cadd609960c3b2af87be Mon Sep 17 00:00:00 2001 From: Giuseppe Rossini Date: Fri, 24 Aug 2018 10:24:12 +0100 Subject: [COMPMID-1353] Add support for 4D Softmax layer on OpenCL Change-Id: I4342d4240fe5b1aab234c015684a1216c3990a5f Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/145631 Tested-by: Jenkins Reviewed-by: Anthony Barbier Reviewed-by: Georgios Pinitas --- arm_compute/runtime/CL/functions/CLSoftmaxLayer.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'arm_compute/runtime/CL/functions/CLSoftmaxLayer.h') diff --git a/arm_compute/runtime/CL/functions/CLSoftmaxLayer.h b/arm_compute/runtime/CL/functions/CLSoftmaxLayer.h index 34349ed52b..90c99d6569 100644 --- a/arm_compute/runtime/CL/functions/CLSoftmaxLayer.h +++ b/arm_compute/runtime/CL/functions/CLSoftmaxLayer.h @@ -24,6 +24,8 @@ #ifndef __ARM_COMPUTE_CLSOFTMAXLAYER_H__ #define __ARM_COMPUTE_CLSOFTMAXLAYER_H__ +#include "arm_compute/core/CL/kernels/CLFlattenLayerKernel.h" +#include "arm_compute/core/CL/kernels/CLReshapeLayerKernel.h" #include "arm_compute/core/CL/kernels/CLSoftmaxLayerKernel.h" #include "arm_compute/runtime/CL/CLMemoryGroup.h" #include "arm_compute/runtime/CL/CLTensor.h" @@ -71,12 +73,29 @@ public: void run() override; private: + /** Utility method to configure the kernels needed to flatten the input + * tensor. + * + * @note This function changes the internal state of this class. In particular, + * it initializes the kernel @p _flatten_kernel and the tensors @p _input_flat and + * @p _output_flat + * + * @param[in] input Original source tensor. + * @param[in] output Original destination tensor. + */ + void configure_flatten_kernel(const ICLTensor *input, const ICLTensor *output); + CLMemoryGroup _memory_group; CLLogits1DMaxShiftExpSumKernel _max_shift_exp_sum_kernel; CLLogits1DNormKernel _norm_kernel; + CLFlattenLayerKernel _flatten_kernel; + CLReshapeLayerKernel _reshape_kernel; CLTensor _max; CLTensor _sum; CLTensor _tmp; + CLTensor _input_flat; + CLTensor _output_flat; + bool _needs_flattening; }; } #endif /* __ARM_COMPUTE_CLSOFTMAXLAYER_H__ */ -- cgit v1.2.1