ArmNN
 24.02
ClElementwiseBinaryWorkload Class Reference

#include <ClElementwiseBinaryWorkload.hpp>

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

Public Member Functions

 ClElementwiseBinaryWorkload (const ElementwiseBinaryQueueDescriptor &descriptor, const WorkloadInfo &info, const arm_compute::CLCompileContext &clCompileContext)
 
void Execute () const override
 
- Public Member Functions inherited from ClBaseWorkload< ElementwiseBinaryQueueDescriptor >
 ClBaseWorkload (const ElementwiseBinaryQueueDescriptor &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< ElementwiseBinaryQueueDescriptor >
 BaseWorkload (const ElementwiseBinaryQueueDescriptor &descriptor, const WorkloadInfo &info)
 
virtual const std::string & GetName () const override
 
void ExecuteAsync (ExecutionData &executionData) override
 
void PostAllocationConfigure () override
 
const ElementwiseBinaryQueueDescriptorGetData () 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< ElementwiseBinaryQueueDescriptor >
virtual void Reconfigure ()
 
- Protected Attributes inherited from BaseWorkload< ElementwiseBinaryQueueDescriptor >
ElementwiseBinaryQueueDescriptor m_Data
 
const arm::pipe::ProfilingGuid m_Guid
 
const std::string m_Name
 

Detailed Description

Definition at line 15 of file ClElementwiseBinaryWorkload.hpp.

Constructor & Destructor Documentation

◆ ClElementwiseBinaryWorkload()

ClElementwiseBinaryWorkload ( const ElementwiseBinaryQueueDescriptor descriptor,
const WorkloadInfo info,
const arm_compute::CLCompileContext &  clCompileContext 
)

Definition at line 19 of file ClElementwiseBinaryWorkload.cpp.

22  : ClBaseWorkload<ElementwiseBinaryQueueDescriptor>(descriptor, info)
23 {
24  this->m_Data.ValidateInputsOutputs("ClElementwiseBinaryWorkload", 2, 1);
25 
26  arm_compute::ICLTensor &input0 = static_cast<IClTensorHandle *>(this->m_Data.m_Inputs[0])->GetTensor();
27  arm_compute::ICLTensor &input1 = static_cast<IClTensorHandle *>(this->m_Data.m_Inputs[1])->GetTensor();
28  arm_compute::ICLTensor &output = static_cast<IClTensorHandle *>(this->m_Data.m_Outputs[0])->GetTensor();
29 
30  const arm_compute::ActivationLayerInfo activationInfo = ConvertAdditionalInfoToAclActivationLayerInfo(descriptor);
31  {
32  ARMNN_SCOPED_PROFILING_EVENT_CL_NAME_GUID("ClElementwiseBinaryWorkload_configure");
33 
34  switch (descriptor.m_Parameters.m_Operation)
35  {
37  {
38  auto powerLayer = std::make_unique<arm_compute::CLElementwisePower>();
39  powerLayer->configure(clCompileContext, &input0, &input1, &output, activationInfo);
40  m_ElementwiseBinaryLayer.reset(powerLayer.release());
41  break;
42  }
44  {
45  auto SqDiffLayer = std::make_unique<arm_compute::CLElementwiseSquaredDiff>();
46  SqDiffLayer->configure(clCompileContext, &input0, &input1, &output, activationInfo);
47  m_ElementwiseBinaryLayer.reset(SqDiffLayer.release());
48  break;
49  }
50  default:
51  throw InvalidArgumentException("Unknown binary operator", CHECK_LOCATION());
52  }
53  }
54 }

References ARMNN_SCOPED_PROFILING_EVENT_CL_NAME_GUID, CHECK_LOCATION, armnn::ConvertAdditionalInfoToAclActivationLayerInfo(), armnn::info, BaseWorkload< ElementwiseBinaryQueueDescriptor >::m_Data, QueueDescriptor::m_Inputs, ElementwiseBinaryDescriptor::m_Operation, QueueDescriptor::m_Outputs, QueueDescriptorWithParameters< LayerDescriptor >::m_Parameters, armnn::Power, armnn::SqDiff, and QueueDescriptor::ValidateInputsOutputs().

Member Function Documentation

◆ Execute()

void Execute ( ) const
overridevirtual

Implements IWorkload.

Definition at line 55 of file ClElementwiseBinaryWorkload.cpp.

56 {
57  if (m_ElementwiseBinaryLayer)
58  {
59  ARMNN_SCOPED_PROFILING_EVENT_CL_NAME_GUID("ClElementwiseBinaryWorkload_Execute");
60  m_ElementwiseBinaryLayer->run();
61  }
62 }

References ARMNN_SCOPED_PROFILING_EVENT_CL_NAME_GUID.


The documentation for this class was generated from the following files:
armnn::QueueDescriptor::ValidateInputsOutputs
void ValidateInputsOutputs(const std::string &descName, unsigned int numExpectedIn, unsigned int numExpectedOut) const
Definition: WorkloadData.cpp:446
armnn::ConvertAdditionalInfoToAclActivationLayerInfo
arm_compute::ActivationLayerInfo ConvertAdditionalInfoToAclActivationLayerInfo(const QueueDescriptor &queueDescriptor)
Definition: ArmComputeUtils.hpp:105
CHECK_LOCATION
#define CHECK_LOCATION()
Definition: Exceptions.hpp:203
armnn::BinaryOperation::SqDiff
@ SqDiff
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::BinaryOperation::Power
@ Power
armnn::QueueDescriptor::m_Outputs
std::vector< ITensorHandle * > m_Outputs
Definition: WorkloadData.hpp:27
armnn::BaseWorkload< ElementwiseBinaryQueueDescriptor >::m_Data
ElementwiseBinaryQueueDescriptor m_Data
Definition: Workload.hpp:89
armnn::QueueDescriptor::m_Inputs
std::vector< ITensorHandle * > m_Inputs
Definition: WorkloadData.hpp:26