telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [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 |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 4 | // |
| 5 | |
Matthew Bentham | 955258d | 2018-12-10 10:48:52 +0000 | [diff] [blame^] | 6 | #include "NeonAdditionWorkload.hpp" |
Aron Virginas-Tar | c9cc804 | 2018-11-01 16:15:57 +0000 | [diff] [blame] | 7 | #include <aclCommon/ArmComputeTensorUtils.hpp> |
| 8 | #include <backendsCommon/CpuTensorHandle.hpp> |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 9 | |
| 10 | namespace armnn |
| 11 | { |
| 12 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 13 | arm_compute::Status NeonAdditionWorkloadValidate(const TensorInfo& input0, |
| 14 | const TensorInfo& input1, |
| 15 | const TensorInfo& output) |
| 16 | { |
| 17 | const arm_compute::TensorInfo aclInput0 = armcomputetensorutils::BuildArmComputeTensorInfo(input0); |
| 18 | const arm_compute::TensorInfo aclInput1 = armcomputetensorutils::BuildArmComputeTensorInfo(input1); |
| 19 | const arm_compute::TensorInfo aclOutput = armcomputetensorutils::BuildArmComputeTensorInfo(output); |
| 20 | |
| 21 | return arm_compute::NEArithmeticAddition::validate(&aclInput0, |
| 22 | &aclInput1, |
| 23 | &aclOutput, |
| 24 | arm_compute::ConvertPolicy::SATURATE); |
| 25 | } |
| 26 | |
| 27 | |
Matthew Bentham | 955258d | 2018-12-10 10:48:52 +0000 | [diff] [blame^] | 28 | NeonAdditionWorkload::NeonAdditionWorkload(const AdditionQueueDescriptor& descriptor, |
| 29 | const WorkloadInfo& info) |
| 30 | : BaseWorkload<AdditionQueueDescriptor>(descriptor, info) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 31 | { |
Matthew Bentham | 955258d | 2018-12-10 10:48:52 +0000 | [diff] [blame^] | 32 | m_Data.ValidateInputsOutputs("NeonAdditionWorkload", 2, 1); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 33 | |
| 34 | arm_compute::ITensor& input1 = boost::polymorphic_downcast<INeonTensorHandle*>(m_Data.m_Inputs[0])->GetTensor(); |
| 35 | arm_compute::ITensor& input2 = boost::polymorphic_downcast<INeonTensorHandle*>(m_Data.m_Inputs[1])->GetTensor(); |
| 36 | arm_compute::ITensor& output = boost::polymorphic_downcast<INeonTensorHandle*>(m_Data.m_Outputs[0])->GetTensor(); |
| 37 | |
| 38 | m_AddLayer.configure(&input1, &input2, &output, arm_compute::ConvertPolicy::SATURATE); |
| 39 | } |
| 40 | |
Matthew Bentham | 955258d | 2018-12-10 10:48:52 +0000 | [diff] [blame^] | 41 | void NeonAdditionWorkload::Execute() const |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 42 | { |
Matthew Bentham | 955258d | 2018-12-10 10:48:52 +0000 | [diff] [blame^] | 43 | ARMNN_SCOPED_PROFILING_EVENT_NEON("NeonAdditionWorkload_Execute"); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 44 | m_AddLayer.run(); |
| 45 | } |
| 46 | |
| 47 | } //namespace armnn |
| 48 | |