telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2017 Arm Ltd. All rights reserved. |
| 3 | // See LICENSE file in the project root for full license information. |
| 4 | // |
| 5 | |
| 6 | #include "ClActivationFloat32Workload.hpp" |
| 7 | #include "backends/ClTensorHandle.hpp" |
| 8 | #include "backends/ArmComputeUtils.hpp" |
| 9 | |
| 10 | namespace armnn |
| 11 | { |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame^] | 12 | arm_compute::Status ClActivationWorkloadValidate(const TensorInfo& input, |
| 13 | const TensorInfo& output, |
| 14 | const ActivationDescriptor& descriptor) |
| 15 | { |
| 16 | const arm_compute::TensorInfo aclInput = armcomputetensorutils::BuildArmComputeTensorInfo(input); |
| 17 | const arm_compute::TensorInfo aclOutput = armcomputetensorutils::BuildArmComputeTensorInfo(output); |
| 18 | |
| 19 | const arm_compute::ActivationLayerInfo activationLayerInfo = |
| 20 | ConvertActivationDescriptorToAclActivationLayerInfo(descriptor); |
| 21 | |
| 22 | if (input.GetDataType() == DataType::QuantisedAsymm8 && |
| 23 | activationLayerInfo.activation() == arm_compute::ActivationLayerInfo::ActivationFunction::LOGISTIC) |
| 24 | { |
| 25 | return arm_compute::Status{arm_compute::ErrorCode::RUNTIME_ERROR, |
| 26 | "CL: Logistic Activations unsupported with QAsymm8 data type."}; |
| 27 | } |
| 28 | |
| 29 | return arm_compute::CLActivationLayer::validate(&aclInput, |
| 30 | &aclOutput, |
| 31 | activationLayerInfo); |
| 32 | } |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 33 | |
| 34 | ClActivationFloat32Workload::ClActivationFloat32Workload(const ActivationQueueDescriptor& descriptor, |
| 35 | const WorkloadInfo& info) |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame^] | 36 | : FloatWorkload<ActivationQueueDescriptor>(descriptor, info) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 37 | { |
| 38 | m_Data.ValidateInputsOutputs("ClActivationFloat32Workload", 1, 1); |
| 39 | |
| 40 | const arm_compute::ActivationLayerInfo activationLayerInfo = |
| 41 | ConvertActivationDescriptorToAclActivationLayerInfo(m_Data.m_Parameters); |
| 42 | |
| 43 | arm_compute::ICLTensor& input = static_cast<ClTensorHandle*>(m_Data.m_Inputs[0])->GetTensor(); |
| 44 | arm_compute::ICLTensor& output = static_cast<ClTensorHandle*>(m_Data.m_Outputs[0])->GetTensor(); |
| 45 | m_ActivationLayer.configure(&input, &output, activationLayerInfo); |
| 46 | } |
| 47 | |
| 48 | void ClActivationFloat32Workload::Execute() const |
| 49 | { |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame^] | 50 | ARMNN_SCOPED_PROFILING_EVENT_CL("ClActivationFloat32Workload_Execute"); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 51 | m_ActivationLayer.run(); |
| 52 | } |
| 53 | |
| 54 | } //namespace armnn |