ArmNN
 20.08
NeonGatherWorkload.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2020 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)
29  : BaseWorkload<GatherQueueDescriptor>(descriptor, info)
30 {
31  m_Data.ValidateInputsOutputs("NeonGatherWorkload", 1, 1);
32 
33  arm_compute::ITensor& input = PolymorphicDowncast<IAclTensorHandle*>(m_Data.m_Inputs[0])->GetTensor();
34  arm_compute::ITensor& indices = PolymorphicDowncast<IAclTensorHandle*>(m_Data.m_Inputs[1])->GetTensor();
35  arm_compute::ITensor& output = PolymorphicDowncast<IAclTensorHandle*>(m_Data.m_Outputs[0])->GetTensor();
36 
37  int aclAxis = ComputeAclAxis(descriptor.m_Parameters.m_Axis, info.m_InputTensorInfos[0]);
38 
39  m_Layer.configure(&input, &indices, &output, aclAxis);
40 }
41 
43 {
44  ARMNN_SCOPED_PROFILING_EVENT_NEON("NeonGatherWorkload_Execute");
45  m_Layer.run();
46 }
47 } //namespace armnn
arm_compute::Status NeonGatherWorkloadValidate(const TensorInfo &input, const TensorInfo &indices, const TensorInfo &output, const GatherDescriptor &descriptor)
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...
const GatherQueueDescriptor m_Data
Definition: Workload.hpp:46
#define ARMNN_SCOPED_PROFILING_EVENT_NEON(name)
void ValidateInputsOutputs(const std::string &descName, unsigned int numExpectedIn, unsigned int numExpectedOut) const
Copyright (c) 2020 ARM Limited.
std::vector< TensorInfo > m_InputTensorInfos
A GatherDescriptor for the GatherLayer.
Status
enumeration
Definition: Types.hpp:26
NeonGatherWorkload(const GatherQueueDescriptor &descriptor, const WorkloadInfo &info)
int32_t m_Axis
The axis in params to gather indices from.
std::vector< ITensorHandle * > m_Outputs
Contains information about inputs and outputs to a layer.
virtual void Execute() const override
std::vector< ITensorHandle * > m_Inputs