ArmNN
 24.08
NeonElementwiseBinaryWorkload Class Reference

#include <NeonElementwiseBinaryWorkload.hpp>

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

Public Member Functions

 NeonElementwiseBinaryWorkload (const ElementwiseBinaryQueueDescriptor &descriptor, const WorkloadInfo &info)
 
virtual void Execute () const override
 
- Public Member Functions inherited from NeonBaseWorkload< ElementwiseBinaryQueueDescriptor >
 NeonBaseWorkload (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 NeonBaseWorkload< 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 23 of file NeonElementwiseBinaryWorkload.hpp.

Constructor & Destructor Documentation

◆ NeonElementwiseBinaryWorkload()

Definition at line 51 of file NeonElementwiseBinaryWorkload.cpp.

53  : NeonBaseWorkload<ElementwiseBinaryQueueDescriptor>(descriptor, info)
54 {
55  m_Data.ValidateInputsOutputs("NeonElementwiseBinaryWorkload", 2, 1);
56 
57  arm_compute::ITensor& input1 = PolymorphicDowncast<IAclTensorHandle*>(m_Data.m_Inputs[0])->GetTensor();
58  arm_compute::ITensor& input2 = PolymorphicDowncast<IAclTensorHandle*>(m_Data.m_Inputs[1])->GetTensor();
59  arm_compute::ITensor& output = PolymorphicDowncast<IAclTensorHandle*>(m_Data.m_Outputs[0])->GetTensor();
60 
61  const arm_compute::ActivationLayerInfo activationInfo = ConvertAdditionalInfoToAclActivationLayerInfo(descriptor);
62 
63  ARMNN_SCOPED_PROFILING_EVENT(Compute::Undefined, "NeonElementwiseBinaryWorkload_configure");
64 
65  switch (descriptor.m_Parameters.m_Operation)
66  {
68  {
69  auto powerLayer = std::make_unique<arm_compute::NEElementwisePower>();
70  powerLayer->configure(&input1, &input2, &output, activationInfo);
71  m_ElementwiseBinaryLayer.reset(powerLayer.release());
72  break;
73  }
75  {
76  auto SqDiffLayer = std::make_unique<arm_compute::NEElementwiseSquaredDiff>();
77  SqDiffLayer->configure(&input1, &input2, &output, activationInfo);
78  m_ElementwiseBinaryLayer.reset(SqDiffLayer.release());
79  break;
80  }
81  default:
82  throw InvalidArgumentException("Unknown binary operator", CHECK_LOCATION());
83  }
84 }

References ARMNN_SCOPED_PROFILING_EVENT, 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, armnn::Undefined, and QueueDescriptor::ValidateInputsOutputs().

Member Function Documentation

◆ Execute()

void Execute ( ) const
overridevirtual

Implements IWorkload.

Definition at line 86 of file NeonElementwiseBinaryWorkload.cpp.

87 {
88  ARMNN_SCOPED_PROFILING_EVENT_NEON_NAME_GUID("NeonElementwiseBinaryWorkload_Execute");
89  m_ElementwiseBinaryLayer->run();
90 }

References ARMNN_SCOPED_PROFILING_EVENT_NEON_NAME_GUID.


The documentation for this class was generated from the following files:
armnn::Compute::Undefined
@ Undefined
armnn::QueueDescriptor::ValidateInputsOutputs
void ValidateInputsOutputs(const std::string &descName, unsigned int numExpectedIn, unsigned int numExpectedOut) const
Definition: WorkloadData.cpp:447
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
#define ARMNN_SCOPED_PROFILING_EVENT(backendId, name)
Definition: Profiling.hpp:220
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_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