MCPcopy Create free account
hub / github.com/ARM-software/armnn / TypedWorkload

Method TypedWorkload

include/armnn/backends/Workload.hpp:85–136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

83public:
84
85 TypedWorkload(const QueueDescriptor& descriptor, const WorkloadInfo& info)
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 }
137};
138
139template <typename QueueDescriptor, armnn::DataType InputDataType, armnn::DataType OutputDataType>

Callers

nothing calls this directly

Calls 6

findFunction · 0.85
emptyMethod · 0.80
ExceptionClass · 0.50
GetDataTypeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected