ArmNN
 25.11
Loading...
Searching...
No Matches
TypedWorkload< QueueDescriptor, DataTypes > Class Template Reference

#include <Workload.hpp>

Inheritance diagram for TypedWorkload< QueueDescriptor, DataTypes >:
[legend]
Collaboration diagram for TypedWorkload< QueueDescriptor, DataTypes >:
[legend]

Public Member Functions

 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 PostAllocationConfigure () override
const QueueDescriptorGetData () const
arm::pipe::ProfilingGuid GetGuid () const final
virtual 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 IWorkload
virtual ~IWorkload ()
virtual void Execute () const =0
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

template<typename QueueDescriptor, armnn::DataType... DataTypes>
class armnn::TypedWorkload< QueueDescriptor, DataTypes >

Definition at line 81 of file Workload.hpp.

Constructor & Destructor Documentation

◆ TypedWorkload()

template<typename QueueDescriptor, armnn::DataType... DataTypes>
TypedWorkload ( const QueueDescriptor & descriptor,
const WorkloadInfo & info )
inline

Definition at line 85 of file Workload.hpp.

86 : BaseWorkload<QueueDescriptor>(descriptor, info)
87 {
88 std::vector<armnn::DataType> dataTypes = {DataTypes...};
89 armnn::DataType expectedInputType;
90
91 if (!info.m_InputTensorInfos.empty())
92 {
93 expectedInputType = info.m_InputTensorInfos.front().GetDataType();
94
95 if (std::find(dataTypes.begin(), dataTypes.end(), expectedInputType) == dataTypes.end())
96 {
97 throw armnn::Exception("Trying to create workload with incorrect type");
98 }
99 if (std::all_of(std::next(info.m_InputTensorInfos.begin()),
100 info.m_InputTensorInfos.end(),
101 [&](auto it){
102 return it.GetDataType() == expectedInputType;
103 }) == false)
104 {
105 throw armnn::Exception("Trying to create workload with incorrect type");
106 }
107 }
108 armnn::DataType expectedOutputType;
109
110 if (!info.m_OutputTensorInfos.empty())
111 {
112 expectedOutputType = info.m_OutputTensorInfos.front().GetDataType();
113
114 if (!info.m_InputTensorInfos.empty())
115 {
116 expectedInputType = info.m_InputTensorInfos.front().GetDataType();
117
118 if (expectedOutputType != expectedInputType)
119 {
120 throw armnn::Exception( "Trying to create workload with incorrect type");
121 }
122 }
123 else if (std::find(dataTypes.begin(), dataTypes.end(), expectedOutputType) == dataTypes.end())
124 {
125 throw armnn::Exception("Trying to create workload with incorrect type");
126 }
127 if (std::all_of(std::next(info.m_OutputTensorInfos.begin()),
128 info.m_OutputTensorInfos.end(),
129 [&](auto it){
130 return it.GetDataType() == expectedOutputType;
131 }) == false)
132 {
133 throw armnn::Exception("Trying to create workload with incorrect type");
134 }
135 }
136 }
DataType
Definition Types.hpp:49

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