ArmNN
 24.02
NeonGatherWorkload.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2020-2023 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #include "NeonGatherWorkload.hpp"
7 #include "NeonWorkloadUtils.hpp"
10 
11 namespace armnn
12 {
14  const TensorInfo& indices,
15  const TensorInfo& output,
16  const GatherDescriptor& descriptor)
17 {
18  const arm_compute::TensorInfo aclInput = BuildArmComputeTensorInfo(input);
19  const arm_compute::TensorInfo aclIndices = BuildArmComputeTensorInfo(indices);
20  const arm_compute::TensorInfo aclOutput = BuildArmComputeTensorInfo(output);
21 
22  int aclAxis = ComputeAclAxis(descriptor.m_Axis, input);
23 
24  return arm_compute::NEGather::validate(&aclInput, &aclIndices, &aclOutput, aclAxis);
25 }
26 
28  const WorkloadInfo& info)
30 {
31  // Report Profiling Details
32  ARMNN_REPORT_PROFILING_WORKLOAD_DESC("NeonGatherWorkload_Construct",
33  descriptor.m_Parameters,
34  info,
35  this->GetGuid());
36 
37  m_Data.ValidateInputsOutputs("NeonGatherWorkload", 2, 1);
38 
39  arm_compute::ITensor& input = PolymorphicDowncast<IAclTensorHandle*>(m_Data.m_Inputs[0])->GetTensor();
40  arm_compute::ITensor& indices = PolymorphicDowncast<IAclTensorHandle*>(m_Data.m_Inputs[1])->GetTensor();
41  arm_compute::ITensor& output = PolymorphicDowncast<IAclTensorHandle*>(m_Data.m_Outputs[0])->GetTensor();
42 
43  int aclAxis = ComputeAclAxis(descriptor.m_Parameters.m_Axis, info.m_InputTensorInfos[0]);
44 
45  m_Layer.configure(&input, &indices, &output, aclAxis);
46 }
47 
49 {
50  ARMNN_SCOPED_PROFILING_EVENT_NEON_NAME_GUID("NeonGatherWorkload_Execute");
51  m_Layer.run();
52 }
53 } //namespace armnn
armnn::NeonGatherWorkloadValidate
arm_compute::Status NeonGatherWorkloadValidate(const TensorInfo &input, const TensorInfo &indices, const TensorInfo &output, const GatherDescriptor &descriptor)
Definition: NeonGatherWorkload.cpp:13
armnn::QueueDescriptor::ValidateInputsOutputs
void ValidateInputsOutputs(const std::string &descName, unsigned int numExpectedIn, unsigned int numExpectedOut) const
Definition: WorkloadData.cpp:446
armnn::NeonGatherWorkload::NeonGatherWorkload
NeonGatherWorkload(const GatherQueueDescriptor &descriptor, const WorkloadInfo &info)
Definition: NeonGatherWorkload.cpp:27
armnn::GatherDescriptor
A GatherDescriptor for the GatherLayer.
Definition: Descriptors.hpp:965
armnn::TensorInfo
Definition: Tensor.hpp:152
armnn::NeonGatherWorkload::Execute
virtual void Execute() const override
Definition: NeonGatherWorkload.cpp:48
armnn::GatherQueueDescriptor
Definition: WorkloadData.hpp:507
NeonGatherWorkload.hpp
armnn::QueueDescriptorWithParameters::m_Parameters
LayerDescriptor m_Parameters
Definition: WorkloadData.hpp:66
armnn::WorkloadInfo
Contains information about TensorInfos of a layer.
Definition: WorkloadInfo.hpp:16
PolymorphicDowncast.hpp
ArmComputeUtils.hpp
armnn::GatherDescriptor::m_Axis
int32_t m_Axis
The axis in params to gather indices from.
Definition: Descriptors.hpp:981
armnn::BoostLogSeverityMapping::info
@ info
armnn::QueueDescriptor::m_Outputs
std::vector< ITensorHandle * > m_Outputs
Definition: WorkloadData.hpp:27
ARMNN_REPORT_PROFILING_WORKLOAD_DESC
#define ARMNN_REPORT_PROFILING_WORKLOAD_DESC(name, desc, infos, guid)
Definition: Profiling.hpp:227
armnn::Status
Status
Definition: Types.hpp:42
armnn::BaseWorkload< GatherQueueDescriptor >::m_Data
GatherQueueDescriptor m_Data
Definition: Workload.hpp:89
NeonWorkloadUtils.hpp
armnn
Copyright (c) 2021 ARM Limited and Contributors.
Definition: 01_00_quick_start.dox:6
ARMNN_SCOPED_PROFILING_EVENT_NEON_NAME_GUID
#define ARMNN_SCOPED_PROFILING_EVENT_NEON_NAME_GUID(label)
Creates a profiling event that uses GetGuid() and GetName() from the calling class.
Definition: NeonWorkloadUtils.hpp:32
armnn::NeonBaseWorkload
Definition: NeonBaseWorkload.hpp:13
armnn::ComputeAclAxis
int ComputeAclAxis(const int &armnnAxis, const armnn::TensorInfo &tensor)
Function to convert ArmNN axis (left to right) to ACL axis (right to left) ranging from [-rank,...
Definition: ArmComputeUtils.hpp:273
armnn::QueueDescriptor::m_Inputs
std::vector< ITensorHandle * > m_Inputs
Definition: WorkloadData.hpp:26