Sadik Armagan | ac47210 | 2020-03-24 09:54:36 +0000 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2020 Arm Ltd. All rights reserved. |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #include "ClNegWorkload.hpp" |
| 7 | |
| 8 | #include "ClWorkloadUtils.hpp" |
| 9 | |
| 10 | #include <aclCommon/ArmComputeTensorUtils.hpp> |
Jan Eilers | bb446e5 | 2020-04-02 13:56:54 +0100 | [diff] [blame] | 11 | #include <armnn/utility/PolymorphicDowncast.hpp> |
Sadik Armagan | ac47210 | 2020-03-24 09:54:36 +0000 | [diff] [blame] | 12 | |
| 13 | #include <cl/ClTensorHandle.hpp> |
| 14 | |
Sadik Armagan | ac47210 | 2020-03-24 09:54:36 +0000 | [diff] [blame] | 15 | namespace armnn |
| 16 | { |
| 17 | |
| 18 | arm_compute::Status ClNegWorkloadValidate(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::CLNegLayer::validate(&aclInput, &aclOutput); |
| 24 | } |
| 25 | |
Sadik Armagan | e944475 | 2020-12-02 11:28:58 +0000 | [diff] [blame] | 26 | ClNegWorkload::ClNegWorkload(const ElementwiseUnaryQueueDescriptor& descriptor, |
| 27 | const WorkloadInfo& info, |
| 28 | const arm_compute::CLCompileContext& clCompileContext) |
Sadik Armagan | ac47210 | 2020-03-24 09:54:36 +0000 | [diff] [blame] | 29 | : BaseWorkload<ElementwiseUnaryQueueDescriptor>(descriptor, info) |
| 30 | { |
| 31 | m_Data.ValidateInputsOutputs("ClNegWorkload", 1, 1); |
| 32 | |
Jan Eilers | bb446e5 | 2020-04-02 13:56:54 +0100 | [diff] [blame] | 33 | arm_compute::ICLTensor& input = PolymorphicDowncast<ClTensorHandle*>(m_Data.m_Inputs[0])->GetTensor(); |
| 34 | arm_compute::ICLTensor& output = PolymorphicDowncast<ClTensorHandle*>(m_Data.m_Outputs[0])->GetTensor(); |
Sadik Armagan | ac47210 | 2020-03-24 09:54:36 +0000 | [diff] [blame] | 35 | |
Kevin May | 9f6862d | 2021-10-22 15:42:28 +0100 | [diff] [blame] | 36 | { |
| 37 | ARMNN_SCOPED_PROFILING_EVENT(Compute::Undefined, "ClNegWorkload_configure"); |
| 38 | m_NegLayer.configure(clCompileContext, &input, &output); |
| 39 | } |
Sadik Armagan | ac47210 | 2020-03-24 09:54:36 +0000 | [diff] [blame] | 40 | } |
| 41 | |
| 42 | void ClNegWorkload::Execute() const |
| 43 | { |
Keith Davis | bcd860a | 2021-08-05 14:20:33 +0100 | [diff] [blame] | 44 | ARMNN_SCOPED_PROFILING_EVENT_CL_GUID("ClNegWorkload_Execute", this->GetGuid()); |
Sadik Armagan | ac47210 | 2020-03-24 09:54:36 +0000 | [diff] [blame] | 45 | RunClFunction(m_NegLayer, CHECK_LOCATION()); |
| 46 | } |
| 47 | |
| 48 | } // namespace armnn |