| 83 | public: |
| 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 | |
| 139 | template <typename QueueDescriptor, armnn::DataType InputDataType, armnn::DataType OutputDataType> |