Aron Virginas-Tar | 8204694 | 2019-09-09 15:18:29 +0100 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2017 Arm Ltd. All rights reserved. |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #include "ClAbsWorkload.hpp" |
| 7 | |
| 8 | #include "ClWorkloadUtils.hpp" |
| 9 | |
Jan Eilers | bb446e5 | 2020-04-02 13:56:54 +0100 | [diff] [blame] | 10 | #include <armnn/utility/PolymorphicDowncast.hpp> |
| 11 | |
Aron Virginas-Tar | 8204694 | 2019-09-09 15:18:29 +0100 | [diff] [blame] | 12 | #include <aclCommon/ArmComputeTensorUtils.hpp> |
| 13 | |
| 14 | #include <cl/ClTensorHandle.hpp> |
| 15 | |
Aron Virginas-Tar | 8204694 | 2019-09-09 15:18:29 +0100 | [diff] [blame] | 16 | namespace armnn |
| 17 | { |
| 18 | |
| 19 | arm_compute::Status ClAbsWorkloadValidate(const TensorInfo& input, const TensorInfo& output) |
| 20 | { |
| 21 | const arm_compute::TensorInfo aclInput = armcomputetensorutils::BuildArmComputeTensorInfo(input); |
| 22 | const arm_compute::TensorInfo aclOutput = armcomputetensorutils::BuildArmComputeTensorInfo(output); |
| 23 | |
| 24 | return arm_compute::CLAbsLayer::validate(&aclInput, &aclOutput); |
| 25 | } |
| 26 | |
Sadik Armagan | e944475 | 2020-12-02 11:28:58 +0000 | [diff] [blame] | 27 | ClAbsWorkload::ClAbsWorkload(const AbsQueueDescriptor& descriptor, |
| 28 | const WorkloadInfo& info, |
| 29 | const arm_compute::CLCompileContext& clCompileContext) |
Aron Virginas-Tar | 8204694 | 2019-09-09 15:18:29 +0100 | [diff] [blame] | 30 | : BaseWorkload<AbsQueueDescriptor>(descriptor, info) |
| 31 | { |
| 32 | m_Data.ValidateInputsOutputs("ClAbsWorkload", 1, 1); |
| 33 | |
Jan Eilers | bb446e5 | 2020-04-02 13:56:54 +0100 | [diff] [blame] | 34 | arm_compute::ICLTensor& input = PolymorphicDowncast<ClTensorHandle*>(m_Data.m_Inputs[0])->GetTensor(); |
| 35 | arm_compute::ICLTensor& output = PolymorphicDowncast<ClTensorHandle*>(m_Data.m_Outputs[0])->GetTensor(); |
Aron Virginas-Tar | 8204694 | 2019-09-09 15:18:29 +0100 | [diff] [blame] | 36 | |
Sadik Armagan | e944475 | 2020-12-02 11:28:58 +0000 | [diff] [blame] | 37 | m_AbsLayer.configure(clCompileContext, &input, &output); |
Aron Virginas-Tar | 8204694 | 2019-09-09 15:18:29 +0100 | [diff] [blame] | 38 | } |
| 39 | |
| 40 | void ClAbsWorkload::Execute() const |
| 41 | { |
Keith Davis | bcd860a | 2021-08-05 14:20:33 +0100 | [diff] [blame] | 42 | ARMNN_SCOPED_PROFILING_EVENT_CL_GUID("ClAbsWorkload_Execute", this->GetGuid()); |
Aron Virginas-Tar | 8204694 | 2019-09-09 15:18:29 +0100 | [diff] [blame] | 43 | RunClFunction(m_AbsLayer, CHECK_LOCATION()); |
| 44 | } |
| 45 | |
| 46 | } // namespace armnn |