blob: c71217ce73bf24ea791f950a7c201c715175eb7c [file] [log] [blame]
Mike Kellyc9ea45a2020-02-28 18:11:58 +00001//
Mike Kelly7cbe7812023-07-25 17:37:33 +01002// Copyright © 2020-2023 Arm Ltd and Contributors. All rights reserved.
Mike Kellyc9ea45a2020-02-28 18:11:58 +00003// SPDX-License-Identifier: MIT
4//
5
6#include "NeonTransposeWorkload.hpp"
7#include <neon/NeonTensorHandle.hpp>
8#include <aclCommon/ArmComputeTensorUtils.hpp>
9
10#include <arm_compute/core/Error.h>
11
12namespace armnn
13{
14
15arm_compute::Status NeonTransposeWorkloadValidate(const TensorInfo& input,
16 const TensorInfo& output,
17 const TransposeDescriptor& 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::BuildArmComputeTransposeVector(mappings));
25}
26
27NeonTransposeWorkload::NeonTransposeWorkload(const TransposeQueueDescriptor& descriptor,
28 const WorkloadInfo& info)
Teresa Charlin588cbdf2022-01-19 15:55:37 +000029 : NeonBaseWorkload<TransposeQueueDescriptor>(descriptor, info)
Mike Kellyc9ea45a2020-02-28 18:11:58 +000030{
Keith Davis2d0679f2021-08-05 11:35:00 +010031 // Report Profiling Details
32 ARMNN_REPORT_PROFILING_WORKLOAD_DESC("NeonTransposeWorkload_Construct",
33 descriptor.m_Parameters,
34 info,
35 this->GetGuid());
36
Mike Kellyc9ea45a2020-02-28 18:11:58 +000037 m_Data.ValidateInputsOutputs(GetName(), 1, 1);
38
39 const arm_compute::ITensor& input = static_cast<IAclTensorHandle*>(m_Data.m_Inputs[0])->GetTensor();
40 arm_compute::ITensor& output = static_cast<IAclTensorHandle*>(m_Data.m_Outputs[0])->GetTensor();
41 const armnn::PermutationVector& mappings = m_Data.m_Parameters.m_DimMappings;
42
43 // Run the layer.
44 m_PermuteFunction.configure(&input, &output,
45 armcomputetensorutils::BuildArmComputeTransposeVector(mappings));
46}
47
48void NeonTransposeWorkload::Execute() const
49{
Mike Kelly7cbe7812023-07-25 17:37:33 +010050 ARMNN_SCOPED_PROFILING_EVENT_NEON_NAME_GUID("NeonTransposeWorkload_Execute");
Mike Kellyc9ea45a2020-02-28 18:11:58 +000051 m_PermuteFunction.run();
52}
53
54} // namespace armnn