ArmNN
 22.05.01
ClChannelShuffleWorkload Class Reference

#include <ClChannelShuffleWorkload.hpp>

Inheritance diagram for ClChannelShuffleWorkload:
ClBaseWorkload< ChannelShuffleQueueDescriptor > BaseWorkload< ChannelShuffleQueueDescriptor > IWorkload

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)
 
void ExecuteAsync (WorkingMemDescriptor &workingMemDescriptor) 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 void RegisterDebugCallback (const DebugCallbackFunction &)
 

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
 

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.

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

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(Compute::Undefined, "ClChannelShuffleWorkload_configure");
91  m_ChannelShuffleLayer.configure(clCompileContext, &input, &output, descriptor.m_Parameters.m_NumGroups);
92  }
93 }
DataLayout
Definition: Types.hpp:62
void ValidateInputsOutputs(const std::string &descName, unsigned int numExpectedIn, unsigned int numExpectedOut) const
#define ARMNN_SCOPED_PROFILING_EVENT(backendId, name)
Definition: Profiling.hpp:220
#define ARMNN_ASSERT_MSG(COND, MSG)
Definition: Assert.hpp:15
std::vector< ITensorHandle * > m_Outputs
#define ARMNN_REPORT_PROFILING_WORKLOAD_DESC(name, desc, infos, guid)
Definition: Profiling.hpp:227
std::vector< ITensorHandle * > m_Inputs

Member Function Documentation

◆ Execute()

void Execute ( ) const
overridevirtual

Implements IWorkload.

Definition at line 95 of file ClChannelShuffleWorkload.cpp.

References ARMNN_SCOPED_PROFILING_EVENT_CL_GUID, CHECK_LOCATION, BaseWorkload< ChannelShuffleQueueDescriptor >::GetGuid(), and armnn::RunClFunction().

96 {
97  ARMNN_SCOPED_PROFILING_EVENT_CL_GUID("ClChannelShuffleWorkload_Execute", this->GetGuid());
98  RunClFunction(m_ChannelShuffleLayer, CHECK_LOCATION());
99 }
#define ARMNN_SCOPED_PROFILING_EVENT_CL_GUID(name, guid)
void RunClFunction(arm_compute::IFunction &function, const CheckLocation &location)
arm::pipe::ProfilingGuid GetGuid() const final
Definition: Workload.hpp:59
#define CHECK_LOCATION()
Definition: Exceptions.hpp:203

The documentation for this class was generated from the following files: