ArmNN
 25.11
Loading...
Searching...
No Matches
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 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 &)
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 throw InvalidArgumentException("Value for axis: " + std::to_string(descriptor.m_Parameters.m_Axis) +
84 " is not valid");
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}
#define ARMNN_SCOPED_PROFILING_EVENT_CL_NAME_GUID(label)
Creates a profiling event that uses GetGuid() and GetName() from the calling class.
#define ARMNN_REPORT_PROFILING_WORKLOAD_DESC(name, desc, infos, guid)

References ARMNN_REPORT_PROFILING_WORKLOAD_DESC, ARMNN_SCOPED_PROFILING_EVENT_CL_NAME_GUID, ClBaseWorkload< ChannelShuffleQueueDescriptor >::ClBaseWorkload(), armnn::info, ChannelShuffleDescriptor::m_Axis, BaseWorkload< ChannelShuffleQueueDescriptor >::m_Data, ChannelShuffleDescriptor::m_NumGroups, QueueDescriptorWithParameters< LayerDescriptor >::m_Parameters, armnn::NCHW, armnn::NHWC, and armnn::PolymorphicDowncast().

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}
#define CHECK_LOCATION()
void RunClFunction(arm_compute::IFunction &function, const CheckLocation &location)

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


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