Francis Murtagh | e7a86a4 | 2018-08-29 12:42:10 +0100 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2017 Arm Ltd. All rights reserved. |
David Beck | ecb56cd | 2018-09-05 12:52:57 +0100 | [diff] [blame] | 3 | // SPDX-License-Identifier: MIT |
Francis Murtagh | e7a86a4 | 2018-08-29 12:42:10 +0100 | [diff] [blame] | 4 | // |
| 5 | |
| 6 | #include "ClDivisionFloatWorkload.hpp" |
Aron Virginas-Tar | c9cc804 | 2018-11-01 16:15:57 +0000 | [diff] [blame] | 7 | #include <cl/ClTensorHandle.hpp> |
| 8 | #include <backendsCommon/CpuTensorHandle.hpp> |
Francis Murtagh | e7a86a4 | 2018-08-29 12:42:10 +0100 | [diff] [blame] | 9 | |
Matthew Bentham | 14e4669 | 2018-09-20 15:35:30 +0100 | [diff] [blame] | 10 | #include "ClWorkloadUtils.hpp" |
| 11 | |
Francis Murtagh | e7a86a4 | 2018-08-29 12:42:10 +0100 | [diff] [blame] | 12 | namespace armnn |
| 13 | { |
| 14 | |
| 15 | arm_compute::Status ClDivisionWorkloadValidate(const TensorInfo& input0, |
| 16 | const TensorInfo& input1, |
| 17 | const TensorInfo& output) |
| 18 | { |
| 19 | const arm_compute::TensorInfo aclInput1 = armcomputetensorutils::BuildArmComputeTensorInfo(input0); |
| 20 | const arm_compute::TensorInfo aclInput2 = armcomputetensorutils::BuildArmComputeTensorInfo(input1); |
| 21 | const arm_compute::TensorInfo aclOutput = armcomputetensorutils::BuildArmComputeTensorInfo(output); |
| 22 | |
Francis Murtagh | e7a86a4 | 2018-08-29 12:42:10 +0100 | [diff] [blame] | 23 | return arm_compute::CLArithmeticDivision::validate(&aclInput1, &aclInput2, &aclOutput); |
| 24 | } |
| 25 | |
| 26 | |
| 27 | ClDivisionFloatWorkload::ClDivisionFloatWorkload(const DivisionQueueDescriptor& descriptor, |
| 28 | const WorkloadInfo& info) |
| 29 | : FloatWorkload<DivisionQueueDescriptor>(descriptor, info) |
| 30 | { |
| 31 | m_Data.ValidateInputsOutputs("ClDivisionFloatWorkload", 2, 1); |
| 32 | |
| 33 | arm_compute::ICLTensor& input0 = static_cast<IClTensorHandle*>(m_Data.m_Inputs[0])->GetTensor(); |
| 34 | arm_compute::ICLTensor& input1 = static_cast<IClTensorHandle*>(m_Data.m_Inputs[1])->GetTensor(); |
| 35 | arm_compute::ICLTensor& output = static_cast<IClTensorHandle*>(m_Data.m_Outputs[0])->GetTensor(); |
| 36 | // Construct |
| 37 | m_ArithmeticDivision.configure(&input0, &input1, &output); |
| 38 | } |
| 39 | |
| 40 | void ClDivisionFloatWorkload::Execute() const |
| 41 | { |
| 42 | ARMNN_SCOPED_PROFILING_EVENT_CL("ClDivisionFloatWorkload_Execute"); |
Aron Virginas-Tar | a8e06ed | 2018-10-19 16:46:15 +0100 | [diff] [blame] | 43 | RunClFunction(m_ArithmeticDivision, CHECK_LOCATION()); |
Francis Murtagh | e7a86a4 | 2018-08-29 12:42:10 +0100 | [diff] [blame] | 44 | } |
| 45 | |
| 46 | } //namespace armnn |