From 48a60f9f7b0b7b5cf38253b7a2ac576aac43ef78 Mon Sep 17 00:00:00 2001 From: Pablo Palmier Date: Wed, 18 Oct 2017 11:03:08 +0100 Subject: IVGCVSW-632 CL support for Softmax beta parameter Change-Id: I21da48d2f40aa900301235eaced54b7eb644b0b2 Reviewed-on: http://mpd-gerrit.cambridge.arm.com/91307 Tested-by: Kaizen Reviewed-by: Anthony Barbier --- src/core/CL/kernels/CLSoftmaxLayerKernel.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/core/CL/kernels/CLSoftmaxLayerKernel.cpp') diff --git a/src/core/CL/kernels/CLSoftmaxLayerKernel.cpp b/src/core/CL/kernels/CLSoftmaxLayerKernel.cpp index da3b9423d5..fb066bc645 100644 --- a/src/core/CL/kernels/CLSoftmaxLayerKernel.cpp +++ b/src/core/CL/kernels/CLSoftmaxLayerKernel.cpp @@ -105,10 +105,11 @@ CLLogits1DShiftExpSumKernel::CLLogits1DShiftExpSumKernel() { } -void CLLogits1DShiftExpSumKernel::configure(const ICLTensor *input, const ICLTensor *max, ICLTensor *output, ICLTensor *sum) +void CLLogits1DShiftExpSumKernel::configure(const ICLTensor *input, const ICLTensor *max, ICLTensor *output, ICLTensor *sum, float beta) { ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::QS8, DataType::QS16, DataType::F16, DataType::F32); ARM_COMPUTE_ERROR_ON_NULLPTR(max, sum, output); + ARM_COMPUTE_ERROR_ON(beta != 1.0f && input->info()->data_type() != DataType::F32); // Output auto initialization if not yet initialized auto_init_if_empty(*sum->info(), max->info()->tensor_shape(), 1, input->info()->data_type(), input->info()->fixed_point_position()); @@ -145,6 +146,11 @@ void CLLogits1DShiftExpSumKernel::configure(const ICLTensor *input, const ICLTen build_opts.emplace("-DNON_MULTIPLE_OF_16"); } + if(beta != 1.0f) + { + build_opts.emplace(("-DBETA=" + float_to_string_with_full_precision(beta))); + } + // Create kernel _kernel = static_cast(CLKernelLibrary::get().create_kernel("softmax_layer_shift_exp_sum", build_opts)); -- cgit v1.2.1