telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2017 Arm Ltd. All rights reserved. |
David Beck | ecb56cd | 2018-09-05 12:52:57 +0100 | [diff] [blame] | 3 | // SPDX-License-Identifier: MIT |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 4 | // |
| 5 | |
| 6 | #include "ClActivationUint8Workload.hpp" |
David Beck | 711fa31 | 2018-09-24 10:46:38 +0100 | [diff] [blame^] | 7 | #include <backends/ClLayerSupport.hpp> |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 8 | |
David Beck | 711fa31 | 2018-09-24 10:46:38 +0100 | [diff] [blame^] | 9 | #include <backends/aclCommon/ArmComputeUtils.hpp> |
| 10 | #include <backends/ClTensorHandle.hpp> |
| 11 | #include <backends/CpuTensorHandle.hpp> |
Matthew Bentham | 14e4669 | 2018-09-20 15:35:30 +0100 | [diff] [blame] | 12 | |
| 13 | #include "ClWorkloadUtils.hpp" |
| 14 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 15 | namespace armnn |
| 16 | { |
| 17 | |
| 18 | ClActivationUint8Workload::ClActivationUint8Workload(const ActivationQueueDescriptor& descriptor, |
| 19 | const WorkloadInfo& info) |
| 20 | : Uint8Workload<ActivationQueueDescriptor>(descriptor, info) |
| 21 | { |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 22 | auto activation = ConvertActivationFunctionToAclActivationFunction(m_Data.m_Parameters.m_Function); |
| 23 | arm_compute::ActivationLayerInfo layerInfo(activation, |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 24 | m_Data.m_Parameters.m_A, |
| 25 | m_Data.m_Parameters.m_B); |
| 26 | |
| 27 | m_Data.ValidateInputsOutputs("ClActivationUint8Workload", 1, 1); |
| 28 | |
| 29 | arm_compute::ICLTensor& input = static_cast<ClTensorHandle*>(m_Data.m_Inputs[0])->GetTensor(); |
| 30 | arm_compute::ICLTensor& output = static_cast<ClTensorHandle*>(m_Data.m_Outputs[0])->GetTensor(); |
| 31 | |
| 32 | m_ActivationLayer.configure(&input, &output, layerInfo); |
| 33 | } |
| 34 | |
| 35 | void ClActivationUint8Workload::Execute() const |
| 36 | { |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 37 | ARMNN_SCOPED_PROFILING_EVENT_CL("ClActivationUint8Workload_Execute"); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 38 | |
| 39 | m_ActivationLayer.run(); |
| 40 | } |
| 41 | |
| 42 | } //namespace Armnn |
| 43 | |
| 44 | |