Tianle Cheng | 21a9f33 | 2023-11-09 13:56:53 +0000 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2023 Arm Ltd and Contributors. All rights reserved. |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #include "ClReverseV2Workload.hpp" |
| 7 | #include "ClWorkloadUtils.hpp" |
| 8 | #include <aclCommon/ArmComputeUtils.hpp> |
| 9 | #include <cl/ClTensorHandle.hpp> |
| 10 | #include <backendsCommon/WorkloadUtils.hpp> |
| 11 | |
| 12 | using namespace armnn::armcomputetensorutils; |
| 13 | |
| 14 | namespace armnn |
| 15 | { |
| 16 | arm_compute::Status ClReverseV2WorkloadValidate(const TensorInfo& input, |
| 17 | const TensorInfo& axis, |
| 18 | const TensorInfo& output) |
| 19 | { |
| 20 | const arm_compute::TensorInfo aclInput = BuildArmComputeTensorInfo(input); |
| 21 | const arm_compute::TensorInfo aclAxis = BuildArmComputeTensorInfo(axis); |
| 22 | const arm_compute::TensorInfo aclOutput = BuildArmComputeTensorInfo(output); |
| 23 | |
| 24 | return arm_compute::CLReverse::validate(&aclInput, &aclOutput, &aclAxis, true); |
| 25 | } |
| 26 | |
| 27 | ClReverseV2Workload::ClReverseV2Workload(const armnn::ReverseV2QueueDescriptor &descriptor, |
| 28 | const armnn::WorkloadInfo &info, |
| 29 | const arm_compute::CLCompileContext& clCompileContext) |
| 30 | : BaseWorkload<ReverseV2QueueDescriptor>(descriptor, info) |
| 31 | { |
| 32 | m_Data.ValidateInputsOutputs("ClReverseV2Workload", 2, 1); |
| 33 | |
| 34 | arm_compute::ICLTensor& input = static_cast<IClTensorHandle*>(m_Data.m_Inputs[0])->GetTensor(); |
| 35 | arm_compute::ICLTensor& axis = static_cast<IClTensorHandle*>(m_Data.m_Inputs[1])->GetTensor(); |
| 36 | arm_compute::ICLTensor& output = static_cast<IClTensorHandle*>(m_Data.m_Outputs[0])->GetTensor(); |
| 37 | |
| 38 | { |
| 39 | ARMNN_SCOPED_PROFILING_EVENT_CL_NAME_GUID("ClReverseV2Workload_configure"); |
| 40 | m_Layer.configure(clCompileContext, &input, &output, &axis, true); |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | void ClReverseV2Workload::Execute() const |
| 45 | { |
| 46 | ARMNN_SCOPED_PROFILING_EVENT_CL_NAME_GUID("ClReverseV2Workload_Execute"); |
| 47 | m_Layer.run(); |
| 48 | } |
| 49 | |
| 50 | } //namespace armnn |