2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // See LICENSE file in the project root for full license information.
6 #include "ClSoftmaxUint8Workload.hpp"
7 #include "backends/ClTensorHandle.hpp"
8 #include "backends/CpuTensorHandle.hpp"
13 ClSoftmaxUint8Workload::ClSoftmaxUint8Workload(const SoftmaxQueueDescriptor& descriptor, const WorkloadInfo& info,
14 std::shared_ptr<arm_compute::MemoryManagerOnDemand>& memoryManager)
15 : Uint8Workload<SoftmaxQueueDescriptor>(descriptor, info)
16 , m_SoftmaxLayer(memoryManager)
18 m_Data.ValidateInputsOutputs("ClSoftmaxUint8Workload", 1, 1);
20 arm_compute::ICLTensor& input = static_cast<ClTensorHandle*>(m_Data.m_Inputs[0])->GetTensor();
21 arm_compute::ICLTensor& output = static_cast<ClTensorHandle*>(m_Data.m_Outputs[0])->GetTensor();
23 const auto outputQuantization = output.info()->quantization_info();
25 if ((outputQuantization.scale != (1.0f / 256.0f)) || (outputQuantization.offset != 0))
27 throw InvalidArgumentException(
28 "Invalid quantization for output. Only scale = 1.0f / 256.0f and offset = 0 supported");
31 m_SoftmaxLayer.configure(&input, &output, descriptor.m_Parameters.m_Beta);
34 void ClSoftmaxUint8Workload::Execute() const
36 ARMNN_SCOPED_PROFILING_EVENT_CL("ClSoftmaxUint8Workload_Execute");