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 | |
| 6 | #include "NeonPermuteWorkload.hpp" |
Aron Virginas-Tar | c9cc804 | 2018-11-01 16:15:57 +0000 | [diff] [blame] | 7 | #include <neon/NeonTensorHandle.hpp> |
| 8 | #include <aclCommon/ArmComputeTensorUtils.hpp> |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 9 | |
| 10 | #include <arm_compute/core/Error.h> |
| 11 | |
| 12 | namespace armnn |
| 13 | { |
| 14 | |
| 15 | arm_compute::Status NeonPermuteWorkloadValidate(const TensorInfo& input, |
| 16 | const TensorInfo& output, |
| 17 | const PermuteDescriptor& descriptor) |
| 18 | { |
| 19 | const arm_compute::TensorInfo aclInputInfo = armcomputetensorutils::BuildArmComputeTensorInfo(input); |
| 20 | const arm_compute::TensorInfo aclOutputInfo = armcomputetensorutils::BuildArmComputeTensorInfo(output); |
| 21 | const armnn::PermutationVector& mappings = descriptor.m_DimMappings; |
| 22 | |
| 23 | return arm_compute::NEPermute::validate(&aclInputInfo, &aclOutputInfo, |
| 24 | armcomputetensorutils::BuildArmComputePermutationVector(mappings)); |
| 25 | } |
| 26 | |
Nattapat Chaimanowong | 1d32006 | 2018-10-12 14:14:44 +0100 | [diff] [blame] | 27 | NeonPermuteWorkload::NeonPermuteWorkload(const PermuteQueueDescriptor& descriptor, |
| 28 | const WorkloadInfo& info) |
| 29 | : BaseWorkload<PermuteQueueDescriptor>(descriptor, info) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 30 | { |
Keith Davis | 2d0679f | 2021-08-05 11:35:00 +0100 | [diff] [blame] | 31 | // Report Profiling Details |
| 32 | ARMNN_REPORT_PROFILING_WORKLOAD_DESC("NeonPermuteWorkload_Construct", |
| 33 | descriptor.m_Parameters, |
| 34 | info, |
| 35 | this->GetGuid()); |
| 36 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 37 | using armcomputetensorutils::BuildArmComputePermutationVector; |
| 38 | |
| 39 | m_Data.ValidateInputsOutputs(GetName(), 1, 1); |
| 40 | |
Derek Lamberti | c81855f | 2019-06-13 17:34:19 +0100 | [diff] [blame] | 41 | const arm_compute::ITensor& input = static_cast<IAclTensorHandle*>(m_Data.m_Inputs[0])->GetTensor(); |
| 42 | arm_compute::ITensor& output = static_cast<IAclTensorHandle*>(m_Data.m_Outputs[0])->GetTensor(); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 43 | const armnn::PermutationVector& mappings = m_Data.m_Parameters.m_DimMappings; |
| 44 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 45 | // Run the layer. |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 46 | m_PermuteFunction.configure(&input, &output, BuildArmComputePermutationVector(mappings)); |
| 47 | } |
| 48 | |
Nattapat Chaimanowong | 1d32006 | 2018-10-12 14:14:44 +0100 | [diff] [blame] | 49 | void NeonPermuteWorkload::Execute() const |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 50 | { |
Keith Davis | 2d0679f | 2021-08-05 11:35:00 +0100 | [diff] [blame] | 51 | ARMNN_SCOPED_PROFILING_EVENT_NEON_GUID(GetName() + "_Execute", this->GetGuid()); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 52 | m_PermuteFunction.run(); |
| 53 | } |
| 54 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 55 | } // namespace armnn |