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 | |
arovir01 | 9e53a35 | 2018-08-31 15:26:35 +0100 | [diff] [blame] | 6 | #include "NeonMultiplicationFloatWorkload.hpp" |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 7 | |
| 8 | |
| 9 | namespace armnn |
| 10 | { |
| 11 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 12 | arm_compute::Status NeonMultiplicationWorkloadValidate(const TensorInfo& input0, |
| 13 | const TensorInfo& input1, |
| 14 | const TensorInfo& output) |
| 15 | { |
| 16 | const arm_compute::TensorInfo aclInput1 = armcomputetensorutils::BuildArmComputeTensorInfo(input0); |
| 17 | const arm_compute::TensorInfo aclInput2 = armcomputetensorutils::BuildArmComputeTensorInfo(input1); |
| 18 | const arm_compute::TensorInfo aclOutput = armcomputetensorutils::BuildArmComputeTensorInfo(output); |
| 19 | |
| 20 | // At the time of writing, configure() will fail if a rounding policy other than TO_ZERO is supplied to it, |
| 21 | // when providing a scale of 1.0 for F32 tensors, even though the provided rounding policy appears to be |
| 22 | // ignored for F32 tensors. |
| 23 | return arm_compute::NEPixelWiseMultiplication::validate(&aclInput1, |
| 24 | &aclInput2, |
| 25 | &aclOutput, |
| 26 | 1.0f, |
| 27 | arm_compute::ConvertPolicy::SATURATE, |
| 28 | arm_compute::RoundingPolicy::TO_ZERO); |
| 29 | } |
| 30 | |
arovir01 | 9e53a35 | 2018-08-31 15:26:35 +0100 | [diff] [blame] | 31 | NeonMultiplicationFloatWorkload::NeonMultiplicationFloatWorkload(const MultiplicationQueueDescriptor& descriptor, |
| 32 | const WorkloadInfo& info) |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 33 | : FloatWorkload<MultiplicationQueueDescriptor>(descriptor, info) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 34 | { |
arovir01 | 9e53a35 | 2018-08-31 15:26:35 +0100 | [diff] [blame] | 35 | m_Data.ValidateInputsOutputs("NeonMultiplicationFloatWorkload", 2, 1); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 36 | |
| 37 | arm_compute::ITensor& input1 = boost::polymorphic_downcast<INeonTensorHandle*>(m_Data.m_Inputs[0])->GetTensor(); |
| 38 | arm_compute::ITensor& input2 = boost::polymorphic_downcast<INeonTensorHandle*>(m_Data.m_Inputs[1])->GetTensor(); |
| 39 | arm_compute::ITensor& output = boost::polymorphic_downcast<INeonTensorHandle*>(m_Data.m_Outputs[0])->GetTensor(); |
| 40 | |
| 41 | // At the time of writing, configure() will fail if a rounding policy other than TO_ZERO is supplied to it, |
| 42 | // when providing a scale of 1.0 for F32 tensors, even though the provided rounding policy appears to be |
| 43 | // ignored for F32 tensors. |
| 44 | m_PixelWiseMultiplication.configure(&input1, |
| 45 | &input2, |
| 46 | &output, |
| 47 | 1.0f, |
| 48 | arm_compute::ConvertPolicy::SATURATE, |
| 49 | arm_compute::RoundingPolicy::TO_ZERO); |
| 50 | } |
| 51 | |
arovir01 | 9e53a35 | 2018-08-31 15:26:35 +0100 | [diff] [blame] | 52 | void NeonMultiplicationFloatWorkload::Execute() const |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 53 | { |
arovir01 | 9e53a35 | 2018-08-31 15:26:35 +0100 | [diff] [blame] | 54 | ARMNN_SCOPED_PROFILING_EVENT_NEON("NeonMultiplicationFloatWorkload_Execute"); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 55 | m_PixelWiseMultiplication.run(); |
| 56 | } |
| 57 | |
| 58 | } //namespace armnn |
| 59 | |
| 60 | |