IVGCVSW-1946: Remove armnn/src from the include paths
[platform/upstream/armnn.git] / src / backends / neon / workloads / NeonAdditionFloatWorkload.cpp
1 //
2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5
6 #include "NeonAdditionFloatWorkload.hpp"
7 #include <aclCommon/ArmComputeTensorUtils.hpp>
8 #include <backendsCommon/CpuTensorHandle.hpp>
9
10 namespace armnn
11 {
12
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
28 NeonAdditionFloatWorkload::NeonAdditionFloatWorkload(const AdditionQueueDescriptor& descriptor,
29                                                      const WorkloadInfo& info)
30     : FloatWorkload<AdditionQueueDescriptor>(descriptor, info)
31 {
32     m_Data.ValidateInputsOutputs("NeonAdditionFloatWorkload", 2, 1);
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
41 void NeonAdditionFloatWorkload::Execute() const
42 {
43     ARMNN_SCOPED_PROFILING_EVENT_NEON("NeonAdditionFloatWorkload_Execute");
44     m_AddLayer.run();
45 }
46
47 } //namespace armnn
48