ArmNN
 24.02
ClChannelShuffleWorkload Class Reference

#include <ClChannelShuffleWorkload.hpp>

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

Public Member Functions

 ClChannelShuffleWorkload (const ChannelShuffleQueueDescriptor &descriptor, const WorkloadInfo &info, const arm_compute::CLCompileContext &clCompileContext)
 
virtual void Execute () const override
 
- Public Member Functions inherited from ClBaseWorkload< ChannelShuffleQueueDescriptor >
 ClBaseWorkload (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 ClBaseWorkload< 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 ClChannelShuffleWorkload.hpp.

Constructor & Destructor Documentation

◆ ClChannelShuffleWorkload()

ClChannelShuffleWorkload ( const ChannelShuffleQueueDescriptor descriptor,
const WorkloadInfo info,
const arm_compute::CLCompileContext &  clCompileContext 
)

Definition at line 54 of file ClChannelShuffleWorkload.cpp.

57  : ClBaseWorkload<ChannelShuffleQueueDescriptor>(descriptor, info)
58 {
59  // Report Profiling Details
60  ARMNN_REPORT_PROFILING_WORKLOAD_DESC("ClChannelShufflenWorkload_Construct",
61  descriptor.m_Parameters,
62  info,
63  this->GetGuid());
64 
65  m_Data.ValidateInputsOutputs("ClChannelShuffleWorkload", 1, 1);
66 
67  arm_compute::ICLTensor& input = PolymorphicDowncast<ClTensorHandle*>(m_Data.m_Inputs[0])->GetTensor();
68  arm_compute::ICLTensor& output = PolymorphicDowncast<ClTensorHandle*>(m_Data.m_Outputs[0])->GetTensor();
69 
70  // In Arm NN and in NNAPI, channel shuffle implementation is datalayout agnostic and it has axis as a parameter.
71  // The channel shuffle Implementation for Neon is dependent on datalayout and does not have axis as a parameter,
72  // it only supports channel shuffle for 4D tensors in dimension C (1 or 3).
73  arm_compute::DataLayout aclDataLayout;
74  switch (descriptor.m_Parameters.m_Axis)
75  {
76  case 1:
77  aclDataLayout = ConvertDataLayout(armnn::DataLayout::NCHW);
78  break;
79  case 3:
80  aclDataLayout = ConvertDataLayout(armnn::DataLayout::NHWC);
81  break;
82  default:
83  ARMNN_ASSERT_MSG(false, "Unsupported axis");
84  break;
85  }
86  input.info()->set_data_layout(aclDataLayout);
87  output.info()->set_data_layout(aclDataLayout);
88 
89  {
90  ARMNN_SCOPED_PROFILING_EVENT_CL_NAME_GUID("ClChannelShuffleWorkload_configure");
91  m_ChannelShuffleLayer.configure(clCompileContext, &input, &output, descriptor.m_Parameters.m_NumGroups);
92  }
93 }

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 95 of file ClChannelShuffleWorkload.cpp.

96 {
97  ARMNN_SCOPED_PROFILING_EVENT_CL_NAME_GUID("ClChannelShuffleWorkload_Execute");
98  RunClFunction(m_ChannelShuffleLayer, CHECK_LOCATION());
99 }

References ARMNN_SCOPED_PROFILING_EVENT_CL_NAME_GUID, CHECK_LOCATION, and armnn::RunClFunction().


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:446
CHECK_LOCATION
#define CHECK_LOCATION()
Definition: Exceptions.hpp:203
ARMNN_ASSERT_MSG
#define ARMNN_ASSERT_MSG(COND, MSG)
Definition: Assert.hpp:15
ARMNN_SCOPED_PROFILING_EVENT_CL_NAME_GUID
#define ARMNN_SCOPED_PROFILING_EVENT_CL_NAME_GUID(label)
Creates a profiling event that uses GetGuid() and GetName() from the calling class.
Definition: ClWorkloadUtils.hpp:36
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::RunClFunction
void RunClFunction(arm_compute::IFunction &function, const CheckLocation &location)
Definition: ClWorkloadUtils.hpp:168
armnn::QueueDescriptor::m_Inputs
std::vector< ITensorHandle * > m_Inputs
Definition: WorkloadData.hpp:26
armnn::DataLayout::NCHW
@ NCHW