ArmNN
 26.01
Loading...
Searching...
No Matches
ClConvertFp32ToFp16Workload Class Reference

#include <ClConvertFp32ToFp16Workload.hpp>

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

Public Member Functions

 ClConvertFp32ToFp16Workload (const ConvertFp32ToFp16QueueDescriptor &descriptor, const WorkloadInfo &info, const arm_compute::CLCompileContext &clCompileContext)
 
virtual void Execute () const override
 
bool SupportsTensorHandleReplacement () const override
 
void ReplaceInputTensorHandle (ITensorHandle *tensorHandle, unsigned int slot) override
 
void ReplaceOutputTensorHandle (ITensorHandle *tensorHandle, unsigned int slot) override
 
- Public Member Functions inherited from MultiTypedWorkload< QueueDescriptor, InputDataType, OutputDataType >
 MultiTypedWorkload (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 PostAllocationConfigure () override
 
const QueueDescriptorGetData () const
 
arm::pipe::ProfilingGuid GetGuid () const final
 
- 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 17 of file ClConvertFp32ToFp16Workload.hpp.

Constructor & Destructor Documentation

◆ ClConvertFp32ToFp16Workload()

ClConvertFp32ToFp16Workload ( const ConvertFp32ToFp16QueueDescriptor & descriptor,
const WorkloadInfo & info,
const arm_compute::CLCompileContext & clCompileContext )

Definition at line 17 of file ClConvertFp32ToFp16Workload.cpp.

20 :
21 Float32ToFloat16Workload<ConvertFp32ToFp16QueueDescriptor>(descriptor, info)
22{
23 this->m_Data.ValidateInputsOutputs("ClConvertFp32ToFp16Workload", 1, 1);
24
25 arm_compute::ICLTensor& input = static_cast<IClTensorHandle*>(this->m_Data.m_Inputs[0])->GetTensor();
26 arm_compute::ICLTensor& output = static_cast<IClTensorHandle*>(this->m_Data.m_Outputs[0])->GetTensor();
27
28 // Create Proxy tensor and set the initial tensor handle to it
29 m_InputProxy = std::make_unique<ICLTensorProxy>(&input);
30 m_OutputProxy = std::make_unique<ICLTensorProxy>(&output);
31
32 {
33 ARMNN_SCOPED_PROFILING_EVENT_CL_NAME_GUID("ClConvertFp32ToFp16Workload_configure");
34 m_Layer.configure(clCompileContext, m_InputProxy.get(), m_OutputProxy.get(), g_AclConvertPolicy, 0);
35 }
36}
#define ARMNN_SCOPED_PROFILING_EVENT_CL_NAME_GUID(label)
Creates a profiling event that uses GetGuid() and GetName() from the calling class.
QueueDescriptor m_Data
Definition Workload.hpp:74
std::vector< ITensorHandle * > m_Inputs
std::vector< ITensorHandle * > m_Outputs
void ValidateInputsOutputs(const std::string &descName, unsigned int numExpectedIn, unsigned int numExpectedOut) const

References ARMNN_SCOPED_PROFILING_EVENT_CL_NAME_GUID, BaseWorkload< QueueDescriptor >::m_Data, QueueDescriptor::m_Inputs, QueueDescriptor::m_Outputs, and QueueDescriptor::ValidateInputsOutputs().

Member Function Documentation

◆ Execute()

void Execute ( ) const
overridevirtual

Implements IWorkload.

Definition at line 38 of file ClConvertFp32ToFp16Workload.cpp.

39{
40 ARMNN_SCOPED_PROFILING_EVENT_CL_NAME_GUID("ClConvertFp32ToFp16Workload_Execute");
41 RunClFunction(m_Layer, CHECK_LOCATION());
42}
#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().

◆ ReplaceInputTensorHandle()

void ReplaceInputTensorHandle ( ITensorHandle * tensorHandle,
unsigned int slot )
overridevirtual

Reimplemented from BaseWorkload< QueueDescriptor >.

Definition at line 64 of file ClConvertFp32ToFp16Workload.cpp.

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

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 81 of file ClConvertFp32ToFp16Workload.cpp.

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

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

◆ SupportsTensorHandleReplacement()

bool SupportsTensorHandleReplacement ( ) const
inlineoverridevirtual

Reimplemented from BaseWorkload< QueueDescriptor >.

Definition at line 26 of file ClConvertFp32ToFp16Workload.hpp.

26{ return true;};

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