ArmNN
 24.08
NeonChannelShuffleWorkload Class Reference

#include <NeonChannelShuffleWorkload.hpp>

Inheritance diagram for NeonChannelShuffleWorkload:
[legend]
Collaboration diagram for NeonChannelShuffleWorkload:
[legend]

Public Member Functions

 NeonChannelShuffleWorkload (const ChannelShuffleQueueDescriptor &descriptor, const WorkloadInfo &info)
 
virtual void Execute () const override
 
- Public Member Functions inherited from NeonBaseWorkload< ChannelShuffleQueueDescriptor >
 NeonBaseWorkload (const ChannelShuffleQueueDescriptor &descriptor, const WorkloadInfo &info)
 
void ReplaceInputTensorHandle (ITensorHandle *tensorHandle, unsigned int slot) override
 
void ReplaceOutputTensorHandle (ITensorHandle *tensorHandle, unsigned int slot) override
 
- Public Member Functions inherited from BaseWorkload< ChannelShuffleQueueDescriptor >
 BaseWorkload (const ChannelShuffleQueueDescriptor &descriptor, const WorkloadInfo &info)
 
virtual const std::string & GetName () const override
 
void ExecuteAsync (ExecutionData &executionData) override
 
void PostAllocationConfigure () override
 
const ChannelShuffleQueueDescriptorGetData () const
 
arm::pipe::ProfilingGuid GetGuid () const final
 
virtual bool SupportsTensorHandleReplacement () const override
 
- Public Member Functions inherited from IWorkload
virtual ~IWorkload ()
 
virtual arm::pipe::ProfilingGuid GetGuid () const =0
 
virtual bool SupportsTensorHandleReplacement () const =0
 
virtual const std::string & GetName () const =0
 
virtual void RegisterDebugCallback (const DebugCallbackFunction &)
 
virtual armnn::Optional< armnn::MemoryRequirementsGetMemoryRequirements ()
 

Additional Inherited Members

- Protected Member Functions inherited from NeonBaseWorkload< ChannelShuffleQueueDescriptor >
virtual void Reconfigure ()
 
- Protected Attributes inherited from BaseWorkload< ChannelShuffleQueueDescriptor >
ChannelShuffleQueueDescriptor m_Data
 
const arm::pipe::ProfilingGuid m_Guid
 
const std::string m_Name
 

Detailed Description

Definition at line 20 of file NeonChannelShuffleWorkload.hpp.

Constructor & Destructor Documentation

◆ NeonChannelShuffleWorkload()

NeonChannelShuffleWorkload ( const ChannelShuffleQueueDescriptor descriptor,
const WorkloadInfo info 
)

Definition at line 51 of file NeonChannelShuffleWorkload.cpp.

53  : NeonBaseWorkload<ChannelShuffleQueueDescriptor>(descriptor, info)
54 {
55  // Report Profiling Details
56  ARMNN_REPORT_PROFILING_WORKLOAD_DESC("NeonChannelShufflenWorkload_Construct",
57  descriptor.m_Parameters,
58  info,
59  this->GetGuid());
60 
61  m_Data.ValidateInputsOutputs("NeonChannelShuffleWorkload", 1, 1);
62 
63  arm_compute::ITensor& input = PolymorphicDowncast<IAclTensorHandle*>(m_Data.m_Inputs[0])->GetTensor();
64  arm_compute::ITensor& output = PolymorphicDowncast<IAclTensorHandle*>(m_Data.m_Outputs[0])->GetTensor();
65 
66  // In Arm NN and in NNAPI, channel shuffle implementation is datalayout agnostic and it has axis as a parameter.
67  // The channel shuffle Implementation for Neon is dependent on datalayout and does not have axis as a parameter,
68  // it only supports channel shuffle for 4D tensors in dimension C (1 or 3).
69  arm_compute::DataLayout aclDataLayout;
70  switch (descriptor.m_Parameters.m_Axis)
71  {
72  case 1:
73  aclDataLayout = ConvertDataLayout(armnn::DataLayout::NCHW);
74  break;
75  case 3:
76  aclDataLayout = ConvertDataLayout(armnn::DataLayout::NHWC);
77  break;
78  default:
79  throw InvalidArgumentException("Value for axis: " + std::to_string(descriptor.m_Parameters.m_Axis) +
80  " is not valid");
81  break;
82  }
83  input.info()->set_data_layout(aclDataLayout);
84  output.info()->set_data_layout(aclDataLayout);
85 
86  m_ChannelShuffleLayer.configure(&input, &output, descriptor.m_Parameters.m_NumGroups);
87 }

References ARMNN_REPORT_PROFILING_WORKLOAD_DESC, armnn::info, ChannelShuffleDescriptor::m_Axis, BaseWorkload< ChannelShuffleQueueDescriptor >::m_Data, QueueDescriptor::m_Inputs, QueueDescriptor::m_Outputs, QueueDescriptorWithParameters< LayerDescriptor >::m_Parameters, and QueueDescriptor::ValidateInputsOutputs().

Member Function Documentation

◆ Execute()

void Execute ( ) const
overridevirtual

Implements IWorkload.

Definition at line 89 of file NeonChannelShuffleWorkload.cpp.

90 {
91  ARMNN_SCOPED_PROFILING_EVENT_NEON_NAME_GUID("NeonChannelShuffleWorkload_Execute");
92  m_ChannelShuffleLayer.run();
93 }

References ARMNN_SCOPED_PROFILING_EVENT_NEON_NAME_GUID.


The documentation for this class was generated from the following files:
armnn::DataLayout
DataLayout
Definition: Types.hpp:62
armnn::DataLayout::NHWC
@ NHWC
armnn::QueueDescriptor::ValidateInputsOutputs
void ValidateInputsOutputs(const std::string &descName, unsigned int numExpectedIn, unsigned int numExpectedOut) const
Definition: WorkloadData.cpp:447
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::BaseWorkload< ChannelShuffleQueueDescriptor >::m_Data
ChannelShuffleQueueDescriptor m_Data
Definition: Workload.hpp:89
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:33
armnn::QueueDescriptor::m_Inputs
std::vector< ITensorHandle * > m_Inputs
Definition: WorkloadData.hpp:26
armnn::DataLayout::NCHW
@ NCHW