Nattapat Chaimanowong | c6a41ff | 2019-01-29 09:56:02 +0000 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2017 Arm Ltd. All rights reserved. |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #include "ClGreaterWorkload.hpp" |
| 7 | |
| 8 | #include "ClWorkloadUtils.hpp" |
| 9 | |
| 10 | #include <aclCommon/ArmComputeUtils.hpp> |
| 11 | #include <aclCommon/ArmComputeTensorUtils.hpp> |
| 12 | |
| 13 | #include <backendsCommon/CpuTensorHandle.hpp> |
| 14 | |
| 15 | #include <cl/ClLayerSupport.hpp> |
| 16 | #include <cl/ClTensorHandle.hpp> |
| 17 | #include <cl/ClLayerSupport.hpp> |
| 18 | |
| 19 | namespace armnn |
| 20 | { |
| 21 | |
| 22 | using namespace armcomputetensorutils; |
| 23 | |
| 24 | arm_compute::Status ClGreaterWorkloadValidate(const TensorInfo& input0, |
| 25 | const TensorInfo& input1, |
| 26 | const TensorInfo& output) |
| 27 | { |
| 28 | const arm_compute::TensorInfo aclInput0Info = BuildArmComputeTensorInfo(input0); |
| 29 | const arm_compute::TensorInfo aclInput1Info = BuildArmComputeTensorInfo(input1); |
| 30 | const arm_compute::TensorInfo aclOutputInfo = BuildArmComputeTensorInfo(output); |
| 31 | |
| 32 | const arm_compute::Status aclStatus = arm_compute::CLComparison::validate( |
| 33 | &aclInput0Info, |
| 34 | &aclInput1Info, |
| 35 | &aclOutputInfo, |
| 36 | arm_compute::ComparisonOperation::Greater); |
| 37 | |
| 38 | return aclStatus; |
| 39 | } |
| 40 | |
| 41 | template<DataType T> |
| 42 | ClGreaterWorkload<T>::ClGreaterWorkload(const GreaterQueueDescriptor& descriptor, |
| 43 | const WorkloadInfo& info) |
| 44 | : MultiTypedWorkload<GreaterQueueDescriptor, T, DataType::Boolean>(descriptor, info) |
| 45 | { |
| 46 | m_Data.ValidateInputsOutputs("ClGreaterWorkload", 2, 1); |
| 47 | |
| 48 | arm_compute::ICLTensor& input0 = static_cast<IClTensorHandle*>(m_Data.m_Inputs[0])->GetTensor(); |
| 49 | arm_compute::ICLTensor& input1 = static_cast<IClTensorHandle*>(m_Data.m_Inputs[1])->GetTensor(); |
| 50 | arm_compute::ICLTensor& output = static_cast<IClTensorHandle*>(m_Data.m_Outputs[0])->GetTensor(); |
| 51 | |
| 52 | m_GreaterLayer.configure(&input0, &input1, &output, arm_compute::ComparisonOperation::Greater); |
| 53 | } |
| 54 | |
| 55 | template<DataType T> |
| 56 | void ClGreaterWorkload<T>::Execute() const |
| 57 | { |
| 58 | ARMNN_SCOPED_PROFILING_EVENT_CL("ClGreaterWorkload_Execute"); |
| 59 | RunClFunction(m_GreaterLayer, CHECK_LOCATION()); |
| 60 | } |
| 61 | |
| 62 | template class ClGreaterWorkload<DataType::Float32>; |
Derek Lamberti | f90c56d | 2020-01-10 17:14:08 +0000 | [diff] [blame] | 63 | template class ClGreaterWorkload<DataType::QAsymmU8>; |
Nattapat Chaimanowong | c6a41ff | 2019-01-29 09:56:02 +0000 | [diff] [blame] | 64 | |
| 65 | } //namespace armnn |