ArmNN
 24.02
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 ExecuteAsync (ExecutionData &executionData) 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 101 of file Workload.hpp.

Constructor & Destructor Documentation

◆ TypedWorkload()

TypedWorkload ( const QueueDescriptor descriptor,
const WorkloadInfo info 
)
inline

Definition at line 105 of file Workload.hpp.

106  : BaseWorkload<QueueDescriptor>(descriptor, info)
107  {
108  std::vector<armnn::DataType> dataTypes = {DataTypes...};
109  armnn::DataType expectedInputType;
110 
111  if (!info.m_InputTensorInfos.empty())
112  {
113  expectedInputType = info.m_InputTensorInfos.front().GetDataType();
114 
115  if (std::find(dataTypes.begin(), dataTypes.end(), expectedInputType) == dataTypes.end())
116  {
117  throw armnn::Exception("Trying to create workload with incorrect type");
118  }
119  if (std::all_of(std::next(info.m_InputTensorInfos.begin()),
120  info.m_InputTensorInfos.end(),
121  [&](auto it){
122  return it.GetDataType() == expectedInputType;
123  }) == false)
124  {
125  throw armnn::Exception("Trying to create workload with incorrect type");
126  }
127  }
128  armnn::DataType expectedOutputType;
129 
130  if (!info.m_OutputTensorInfos.empty())
131  {
132  expectedOutputType = info.m_OutputTensorInfos.front().GetDataType();
133 
134  if (!info.m_InputTensorInfos.empty())
135  {
136  expectedInputType = info.m_InputTensorInfos.front().GetDataType();
137 
138  if (expectedOutputType != expectedInputType)
139  {
140  throw armnn::Exception( "Trying to create workload with incorrect type");
141  }
142  }
143  else if (std::find(dataTypes.begin(), dataTypes.end(), expectedOutputType) == dataTypes.end())
144  {
145  throw armnn::Exception("Trying to create workload with incorrect type");
146  }
147  if (std::all_of(std::next(info.m_OutputTensorInfos.begin()),
148  info.m_OutputTensorInfos.end(),
149  [&](auto it){
150  return it.GetDataType() == expectedOutputType;
151  }) == false)
152  {
153  throw armnn::Exception("Trying to create workload with incorrect type");
154  }
155  }
156  }

The documentation for this class was generated from the following file:
armnn::DataType
DataType
Definition: Types.hpp:48
armnn::Exception
Base class for all ArmNN exceptions so that users can filter to just those.
Definition: Exceptions.hpp:46
armnn::BoostLogSeverityMapping::info
@ info