ArmNN
 24.08
ClNormalizationFloatWorkload Class Reference

#include <ClNormalizationFloatWorkload.hpp>

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

Public Member Functions

 ClNormalizationFloatWorkload (const NormalizationQueueDescriptor &descriptor, const WorkloadInfo &info, const arm_compute::CLCompileContext &clCompileContext)
 
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 19 of file ClNormalizationFloatWorkload.hpp.

Constructor & Destructor Documentation

◆ ClNormalizationFloatWorkload()

ClNormalizationFloatWorkload ( const NormalizationQueueDescriptor descriptor,
const WorkloadInfo info,
const arm_compute::CLCompileContext &  clCompileContext 
)

Definition at line 31 of file ClNormalizationFloatWorkload.cpp.

34  : FloatWorkload<NormalizationQueueDescriptor>(descriptor, info)
35 {
36  // Report Profiling Details
37  ARMNN_REPORT_PROFILING_WORKLOAD_DESC("ClNormalizationWorkload_Construct",
38  descriptor.m_Parameters,
39  info,
40  this->GetGuid());
41 
42  m_Data.ValidateInputsOutputs("ClNormalizationFloatWorkload", 1, 1);
43 
44  arm_compute::ICLTensor& input = static_cast<IClTensorHandle*>(m_Data.m_Inputs[0])->GetTensor();
45  arm_compute::ICLTensor& output = static_cast<IClTensorHandle*>(m_Data.m_Outputs[0])->GetTensor();
46 
47  arm_compute::DataLayout aclDataLayout = ConvertDataLayout(m_Data.m_Parameters.m_DataLayout);
48  input.info()->set_data_layout(aclDataLayout);
49  output.info()->set_data_layout(aclDataLayout);
50 
51  arm_compute::NormalizationLayerInfo normalizationInfo = BuildArmComputeNormalizationLayerInfo(m_Data.m_Parameters);
52 
53  {
54  ARMNN_SCOPED_PROFILING_EVENT_CL_NAME_GUID("ClNormalizationFloatWorkload_configure");
55  m_NormalizationLayer.configure(clCompileContext, &input, &output, normalizationInfo);
56  }
57 };

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 59 of file ClNormalizationFloatWorkload.cpp.

60 {
61  ARMNN_SCOPED_PROFILING_EVENT_CL_NAME_GUID("ClNormalizationFloatWorkload_Execute");
62  RunClFunction(m_NormalizationLayer, CHECK_LOCATION());
63 }

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

◆ ReplaceInputTensorHandle()

void ReplaceInputTensorHandle ( ITensorHandle tensorHandle,
unsigned int  slot 
)
overridevirtual

Reimplemented from BaseWorkload< QueueDescriptor >.

Definition at line 65 of file ClNormalizationFloatWorkload.cpp.

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

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 82 of file ClNormalizationFloatWorkload.cpp.

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

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
CHECK_LOCATION
#define CHECK_LOCATION()
Definition: Exceptions.hpp:203
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::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::RunClFunction
void RunClFunction(arm_compute::IFunction &function, const CheckLocation &location)
Definition: ClWorkloadUtils.hpp:167
armnn::UnimplementedException
Definition: Exceptions.hpp:98
armnn::QueueDescriptor::m_Inputs
std::vector< ITensorHandle * > m_Inputs
Definition: WorkloadData.hpp:26