ArmNN
 24.08
NeonL2NormalizationFloatWorkload Class Reference

#include <NeonL2NormalizationFloatWorkload.hpp>

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

Public Member Functions

 NeonL2NormalizationFloatWorkload (const L2NormalizationQueueDescriptor &descriptor, const WorkloadInfo &info, std::shared_ptr< arm_compute::MemoryManagerOnDemand > &memoryManager)
 
virtual void Execute () const override
 
void ReplaceInputTensorHandle (ITensorHandle *tensorHandle, unsigned int slot) override
 
void ReplaceOutputTensorHandle (ITensorHandle *tensorHandle, unsigned int slot) override
 
- Public Member Functions inherited from TypedWorkload< QueueDescriptor, DataTypes >
 TypedWorkload (const QueueDescriptor &descriptor, const WorkloadInfo &info)
 
- Public Member Functions inherited from BaseWorkload< QueueDescriptor >
 BaseWorkload (const QueueDescriptor &descriptor, const WorkloadInfo &info)
 
virtual const std::string & GetName () const override
 
void ExecuteAsync (ExecutionData &executionData) override
 
void PostAllocationConfigure () override
 
const QueueDescriptorGetData () 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 Attributes inherited from BaseWorkload< QueueDescriptor >
QueueDescriptor m_Data
 
const arm::pipe::ProfilingGuid m_Guid
 
const std::string m_Name
 

Detailed Description

Definition at line 23 of file NeonL2NormalizationFloatWorkload.hpp.

Constructor & Destructor Documentation

◆ NeonL2NormalizationFloatWorkload()

NeonL2NormalizationFloatWorkload ( const L2NormalizationQueueDescriptor descriptor,
const WorkloadInfo info,
std::shared_ptr< arm_compute::MemoryManagerOnDemand > &  memoryManager 
)

Definition at line 31 of file NeonL2NormalizationFloatWorkload.cpp.

33  : FloatWorkload<L2NormalizationQueueDescriptor>(descriptor, info)
34 {
35  // Report Profiling Details
36  ARMNN_REPORT_PROFILING_WORKLOAD_DESC("NeonL2NormalizationFloatWorkload_Construct",
37  descriptor.m_Parameters,
38  info,
39  this->GetGuid());
40 
41  m_Data.ValidateInputsOutputs("NeonL2NormalizationFloatWorkload", 1, 1);
42 
43  arm_compute::ITensor& input = PolymorphicDowncast<IAclTensorHandle*>(m_Data.m_Inputs[0])->GetTensor();
44  arm_compute::ITensor& output = PolymorphicDowncast<IAclTensorHandle*>(m_Data.m_Outputs[0])->GetTensor();
45 
46  arm_compute::DataLayout aclDataLayout = ConvertDataLayout(m_Data.m_Parameters.m_DataLayout);
47  input.info()->set_data_layout(aclDataLayout);
48  output.info()->set_data_layout(aclDataLayout);
49 
50  int axis = (m_Data.m_Parameters.m_DataLayout == DataLayout::NCHW) ? 2 : 0;
51 
52  auto layer = std::make_unique<arm_compute::NEL2NormalizeLayer>(memoryManager);
53  layer->configure(&input, &output, axis, m_Data.m_Parameters.m_Eps);
54  m_Layer.reset(layer.release());
55 }

References ARMNN_REPORT_PROFILING_WORKLOAD_DESC, armnn::info, BaseWorkload< QueueDescriptor >::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 57 of file NeonL2NormalizationFloatWorkload.cpp.

58 {
59  ARMNN_SCOPED_PROFILING_EVENT_NEON_NAME_GUID("NeonL2NormalizationFloatWorkload_Execute");
60  m_Layer->run();
61 }

References ARMNN_SCOPED_PROFILING_EVENT_NEON_NAME_GUID.

◆ ReplaceInputTensorHandle()

void ReplaceInputTensorHandle ( ITensorHandle tensorHandle,
unsigned int  slot 
)
overridevirtual

Reimplemented from BaseWorkload< QueueDescriptor >.

Definition at line 63 of file NeonL2NormalizationFloatWorkload.cpp.

64 {
65  ITensorHandle* backupHandle = this->m_Data.m_Inputs[slot];
66  this->m_Data.m_Inputs[slot] = tensorHandle;
67  try
68  {
69  Reconfigure();
70  }
72  {
73  // Cannot reconfigure, revert the slot back and throw the exception.
74  this->m_Data.m_Inputs[slot] = backupHandle;
75  throw e;
76  }
77 }

References BaseWorkload< QueueDescriptor >::m_Data, and QueueDescriptor::m_Inputs.

◆ ReplaceOutputTensorHandle()

void ReplaceOutputTensorHandle ( ITensorHandle tensorHandle,
unsigned int  slot 
)
overridevirtual

Reimplemented from BaseWorkload< QueueDescriptor >.

Definition at line 80 of file NeonL2NormalizationFloatWorkload.cpp.

81 {
82  ITensorHandle* backupHandle = this->m_Data.m_Inputs[slot];
83  this->m_Data.m_Inputs[slot] = tensorHandle;
84  try
85  {
86  Reconfigure();
87  }
89  {
90  // Cannot reconfigure, revert the slot back and throw the exception.
91  this->m_Data.m_Inputs[slot] = backupHandle;
92  throw e;
93  }
94 }

References BaseWorkload< QueueDescriptor >::m_Data, and QueueDescriptor::m_Inputs.


The documentation for this class was generated from the following files:
armnn::DataLayout
DataLayout
Definition: Types.hpp:62
armnn::QueueDescriptor::ValidateInputsOutputs
void ValidateInputsOutputs(const std::string &descName, unsigned int numExpectedIn, unsigned int numExpectedOut) const
Definition: WorkloadData.cpp:447
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::m_Data
QueueDescriptor m_Data
Definition: Workload.hpp:89
armnn::UnimplementedException
Definition: Exceptions.hpp:98
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
armnn::DataLayout::NCHW
@ NCHW