Sadik Armagan | 9fabf43 | 2020-05-27 13:40:58 +0100 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2020 Arm Ltd. All rights reserved. |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #include "ClExpWorkload.hpp" |
| 7 | |
| 8 | #include "ClWorkloadUtils.hpp" |
| 9 | |
| 10 | #include <aclCommon/ArmComputeTensorUtils.hpp> |
| 11 | #include <armnn/utility/PolymorphicDowncast.hpp> |
| 12 | |
| 13 | #include <cl/ClTensorHandle.hpp> |
| 14 | |
Sadik Armagan | 9fabf43 | 2020-05-27 13:40:58 +0100 | [diff] [blame] | 15 | namespace armnn |
| 16 | { |
| 17 | |
| 18 | arm_compute::Status ClExpWorkloadValidate(const TensorInfo& input, const TensorInfo& output) |
| 19 | { |
| 20 | const arm_compute::TensorInfo aclInput = armcomputetensorutils::BuildArmComputeTensorInfo(input); |
| 21 | const arm_compute::TensorInfo aclOutput = armcomputetensorutils::BuildArmComputeTensorInfo(output); |
| 22 | |
| 23 | return arm_compute::CLExpLayer::validate(&aclInput, &aclOutput); |
| 24 | } |
| 25 | |
Sadik Armagan | e944475 | 2020-12-02 11:28:58 +0000 | [diff] [blame] | 26 | ClExpWorkload::ClExpWorkload(const ElementwiseUnaryQueueDescriptor& descriptor, |
| 27 | const WorkloadInfo& info, |
| 28 | const arm_compute::CLCompileContext& clCompileContext) |
Sadik Armagan | 9fabf43 | 2020-05-27 13:40:58 +0100 | [diff] [blame] | 29 | : BaseWorkload<ElementwiseUnaryQueueDescriptor>(descriptor, info) |
| 30 | { |
Keith Davis | bcd860a | 2021-08-05 14:20:33 +0100 | [diff] [blame] | 31 | // Report Profiling Details |
| 32 | ARMNN_REPORT_PROFILING_WORKLOAD_DESC("ClExpWorkload_Construct", |
| 33 | descriptor.m_Parameters, |
| 34 | info, |
| 35 | this->GetGuid()); |
| 36 | |
Sadik Armagan | 9fabf43 | 2020-05-27 13:40:58 +0100 | [diff] [blame] | 37 | m_Data.ValidateInputsOutputs("ClExpWorkload", 1, 1); |
| 38 | |
| 39 | arm_compute::ICLTensor& input = PolymorphicDowncast<ClTensorHandle*>(m_Data.m_Inputs[0])->GetTensor(); |
| 40 | arm_compute::ICLTensor& output = PolymorphicDowncast<ClTensorHandle*>(m_Data.m_Outputs[0])->GetTensor(); |
| 41 | |
Sadik Armagan | e944475 | 2020-12-02 11:28:58 +0000 | [diff] [blame] | 42 | m_ExpLayer.configure(clCompileContext, &input, &output); |
Sadik Armagan | 9fabf43 | 2020-05-27 13:40:58 +0100 | [diff] [blame] | 43 | } |
| 44 | |
| 45 | void ClExpWorkload::Execute() const |
| 46 | { |
Keith Davis | bcd860a | 2021-08-05 14:20:33 +0100 | [diff] [blame] | 47 | ARMNN_SCOPED_PROFILING_EVENT_CL_GUID("ClExpWorkload_Execute", this->GetGuid()); |
Sadik Armagan | 9fabf43 | 2020-05-27 13:40:58 +0100 | [diff] [blame] | 48 | RunClFunction(m_ExpLayer, CHECK_LOCATION()); |
| 49 | } |
| 50 | |
| 51 | } // namespace armnn |