Aron Virginas-Tar | 0dd3b43 | 2019-09-10 13:55:09 +0100 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2019 Arm Ltd. All rights reserved. |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #include "NeonRsqrtWorkload.hpp" |
| 7 | |
| 8 | #include "NeonWorkloadUtils.hpp" |
| 9 | |
| 10 | #include <aclCommon/ArmComputeTensorHandle.hpp> |
| 11 | #include <aclCommon/ArmComputeTensorUtils.hpp> |
Jan Eilers | bb446e5 | 2020-04-02 13:56:54 +0100 | [diff] [blame] | 12 | #include <armnn/utility/PolymorphicDowncast.hpp> |
Aron Virginas-Tar | 0dd3b43 | 2019-09-10 13:55:09 +0100 | [diff] [blame] | 13 | |
Aron Virginas-Tar | 0dd3b43 | 2019-09-10 13:55:09 +0100 | [diff] [blame] | 14 | |
| 15 | namespace armnn |
| 16 | { |
| 17 | |
| 18 | arm_compute::Status NeonRsqrtWorkloadValidate(const TensorInfo& input, const TensorInfo& output) |
| 19 | { |
| 20 | const arm_compute::TensorInfo aclInput = armcomputetensorutils::BuildArmComputeTensorInfo(input); |
| 21 | const arm_compute::TensorInfo aclOutput = armcomputetensorutils::BuildArmComputeTensorInfo(output); |
| 22 | |
| 23 | return arm_compute::NERsqrtLayer::validate(&aclInput, &aclOutput); |
| 24 | } |
| 25 | |
| 26 | NeonRsqrtWorkload::NeonRsqrtWorkload(const RsqrtQueueDescriptor& descriptor, const WorkloadInfo& info) |
| 27 | : BaseWorkload<RsqrtQueueDescriptor>(descriptor, info) |
| 28 | { |
| 29 | m_Data.ValidateInputsOutputs("NeonRsqrtWorkload", 1, 1); |
| 30 | |
Jan Eilers | bb446e5 | 2020-04-02 13:56:54 +0100 | [diff] [blame] | 31 | arm_compute::ITensor& input = PolymorphicDowncast<IAclTensorHandle*>(m_Data.m_Inputs[0])->GetTensor(); |
| 32 | arm_compute::ITensor& output = PolymorphicDowncast<IAclTensorHandle*>(m_Data.m_Outputs[0])->GetTensor(); |
Aron Virginas-Tar | 0dd3b43 | 2019-09-10 13:55:09 +0100 | [diff] [blame] | 33 | |
| 34 | m_RsqrtLayer.configure(&input, &output); |
| 35 | } |
| 36 | |
| 37 | void NeonRsqrtWorkload::Execute() const |
| 38 | { |
| 39 | ARMNN_SCOPED_PROFILING_EVENT_NEON("NeonRsqrtWorkload_Execute"); |
| 40 | m_RsqrtLayer.run(); |
| 41 | } |
| 42 | |
| 43 | } // namespace armnn |