Nikhil Raj | 91e4c6d | 2019-07-05 12:22:58 +0100 | [diff] [blame] | 1 | // |
Teresa Charlin | 588cbdf | 2022-01-19 15:55:37 +0000 | [diff] [blame] | 2 | // Copyright © 2017 Arm Ltd and Contributors. All rights reserved. |
Nikhil Raj | 91e4c6d | 2019-07-05 12:22:58 +0100 | [diff] [blame] | 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #include "ClPreluWorkload.hpp" |
| 7 | #include "ClWorkloadUtils.hpp" |
Colm Donelan | 0c47974 | 2021-12-10 12:43:54 +0000 | [diff] [blame] | 8 | #include <armnn/backends/TensorHandle.hpp> |
Nikhil Raj | 91e4c6d | 2019-07-05 12:22:58 +0100 | [diff] [blame] | 9 | #include <aclCommon/ArmComputeUtils.hpp> |
| 10 | #include <cl/ClLayerSupport.hpp> |
| 11 | #include <cl/ClTensorHandle.hpp> |
| 12 | |
| 13 | namespace armnn |
| 14 | { |
| 15 | |
| 16 | arm_compute::Status ClPreluWorkloadValidate(const TensorInfo& input, |
| 17 | const TensorInfo& alpha, |
| 18 | const TensorInfo& output) |
| 19 | { |
| 20 | const arm_compute::TensorInfo aclInput = armcomputetensorutils::BuildArmComputeTensorInfo(input); |
| 21 | const arm_compute::TensorInfo aclAlpha = armcomputetensorutils::BuildArmComputeTensorInfo(alpha); |
| 22 | const arm_compute::TensorInfo aclOutput = armcomputetensorutils::BuildArmComputeTensorInfo(output); |
| 23 | |
| 24 | return arm_compute::CLPReluLayer::validate(&aclInput, |
| 25 | &aclAlpha, |
| 26 | &aclOutput); |
| 27 | } |
| 28 | |
| 29 | ClPreluWorkload::ClPreluWorkload(const PreluQueueDescriptor& descriptor, |
Sadik Armagan | e944475 | 2020-12-02 11:28:58 +0000 | [diff] [blame] | 30 | const WorkloadInfo& info, |
| 31 | const arm_compute::CLCompileContext& clCompileContext) |
Teresa Charlin | 588cbdf | 2022-01-19 15:55:37 +0000 | [diff] [blame] | 32 | : ClBaseWorkload<PreluQueueDescriptor>(descriptor, info) |
Nikhil Raj | 91e4c6d | 2019-07-05 12:22:58 +0100 | [diff] [blame] | 33 | { |
| 34 | m_Data.ValidateInputsOutputs("ClPreluWorkload", 1, 1); |
| 35 | |
| 36 | arm_compute::ICLTensor& input = static_cast<IClTensorHandle*>(m_Data.m_Inputs[0])->GetTensor(); |
| 37 | arm_compute::ICLTensor& alpha = static_cast<IClTensorHandle*>(m_Data.m_Inputs[1])->GetTensor(); |
| 38 | arm_compute::ICLTensor& output = static_cast<IClTensorHandle*>(m_Data.m_Outputs[0])->GetTensor(); |
| 39 | |
Kevin May | 9f6862d | 2021-10-22 15:42:28 +0100 | [diff] [blame] | 40 | { |
| 41 | ARMNN_SCOPED_PROFILING_EVENT(Compute::Undefined, "ClPreluWorkload_configure"); |
| 42 | m_PreluLayer.configure(clCompileContext, &input, &alpha, &output); |
| 43 | } |
Nikhil Raj | 91e4c6d | 2019-07-05 12:22:58 +0100 | [diff] [blame] | 44 | } |
| 45 | |
| 46 | void ClPreluWorkload::Execute() const |
| 47 | { |
Keith Davis | bcd860a | 2021-08-05 14:20:33 +0100 | [diff] [blame] | 48 | ARMNN_SCOPED_PROFILING_EVENT_CL_GUID("ClPreluWorkload_Execute", this->GetGuid()); |
Nikhil Raj | 91e4c6d | 2019-07-05 12:22:58 +0100 | [diff] [blame] | 49 | RunClFunction(m_PreluLayer, CHECK_LOCATION()); |
| 50 | } |
| 51 | |
| 52 | } //namespace armnn |