telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2017 Arm Ltd. All rights reserved. |
David Beck | ecb56cd | 2018-09-05 12:52:57 +0100 | [diff] [blame] | 3 | // SPDX-License-Identifier: MIT |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 4 | // |
Aron Virginas-Tar | c9cc804 | 2018-11-01 16:15:57 +0000 | [diff] [blame] | 5 | #include <backendsCommon/CpuTensorHandle.hpp> |
| 6 | #include <backendsCommon/MemCopyWorkload.hpp> |
| 7 | #include <backendsCommon/MakeWorkloadHelper.hpp> |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 8 | #include "RefWorkloadFactory.hpp" |
David Beck | 79141b9 | 2018-10-23 16:09:36 +0100 | [diff] [blame] | 9 | #include "RefBackendId.hpp" |
David Beck | b4540be | 2018-09-24 13:18:27 +0100 | [diff] [blame] | 10 | #include "workloads/RefWorkloads.hpp" |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 11 | #include "Layer.hpp" |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 12 | |
| 13 | #include <boost/log/trivial.hpp> |
| 14 | |
| 15 | namespace armnn |
| 16 | { |
| 17 | |
David Beck | 79141b9 | 2018-10-23 16:09:36 +0100 | [diff] [blame] | 18 | namespace |
| 19 | { |
| 20 | static const BackendId s_Id{RefBackendId()}; |
| 21 | } |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 22 | template <typename F32Workload, typename U8Workload, typename QueueDescriptorType> |
| 23 | std::unique_ptr<IWorkload> RefWorkloadFactory::MakeWorkload(const QueueDescriptorType& descriptor, |
| 24 | const WorkloadInfo& info) const |
| 25 | { |
kevmay01 | 2b4d88e | 2019-01-24 14:05:09 +0000 | [diff] [blame] | 26 | return armnn::MakeWorkloadHelper<NullWorkload, F32Workload, U8Workload, NullWorkload, NullWorkload>(descriptor, |
| 27 | info); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 28 | } |
| 29 | |
Jim Flynn | 82fbe7c | 2019-04-02 15:19:08 +0100 | [diff] [blame] | 30 | bool IsFloat16(const WorkloadInfo& info) |
| 31 | { |
| 32 | auto checkFloat16 = [](const TensorInfo& tensorInfo) {return tensorInfo.GetDataType() == DataType::Float16;}; |
| 33 | auto it = std::find_if(std::begin(info.m_InputTensorInfos), std::end(info.m_InputTensorInfos), checkFloat16); |
| 34 | if (it != std::end(info.m_InputTensorInfos)) |
| 35 | { |
| 36 | return true; |
| 37 | } |
| 38 | it = std::find_if(std::begin(info.m_OutputTensorInfos), std::end(info.m_OutputTensorInfos), checkFloat16); |
| 39 | if (it != std::end(info.m_OutputTensorInfos)) |
| 40 | { |
| 41 | return true; |
| 42 | } |
| 43 | return false; |
| 44 | } |
| 45 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 46 | RefWorkloadFactory::RefWorkloadFactory() |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 47 | { |
| 48 | } |
| 49 | |
David Beck | 79141b9 | 2018-10-23 16:09:36 +0100 | [diff] [blame] | 50 | const BackendId& RefWorkloadFactory::GetBackendId() const |
| 51 | { |
| 52 | return s_Id; |
| 53 | } |
| 54 | |
David Beck | 29c75de | 2018-10-23 13:35:58 +0100 | [diff] [blame] | 55 | bool RefWorkloadFactory::IsLayerSupported(const Layer& layer, |
| 56 | Optional<DataType> dataType, |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 57 | std::string& outReasonIfUnsupported) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 58 | { |
David Beck | 79141b9 | 2018-10-23 16:09:36 +0100 | [diff] [blame] | 59 | return IWorkloadFactory::IsLayerSupported(s_Id, layer, dataType, outReasonIfUnsupported); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 60 | } |
| 61 | |
| 62 | std::unique_ptr<ITensorHandle> RefWorkloadFactory::CreateTensorHandle(const TensorInfo& tensorInfo) const |
| 63 | { |
| 64 | return std::make_unique<ScopedCpuTensorHandle>(tensorInfo); |
| 65 | } |
| 66 | |
Francis Murtagh | 351d13d | 2018-09-24 15:01:18 +0100 | [diff] [blame] | 67 | std::unique_ptr<ITensorHandle> RefWorkloadFactory::CreateTensorHandle(const TensorInfo& tensorInfo, |
| 68 | DataLayout dataLayout) const |
| 69 | { |
| 70 | return std::make_unique<ScopedCpuTensorHandle>(tensorInfo); |
| 71 | } |
| 72 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 73 | std::unique_ptr<IWorkload> RefWorkloadFactory::CreateInput(const InputQueueDescriptor& descriptor, |
| 74 | const WorkloadInfo& info) const |
| 75 | { |
| 76 | if (info.m_InputTensorInfos.empty() ) |
| 77 | { |
| 78 | throw InvalidArgumentException("RefWorkloadFactory::CreateInput: Input cannot be zero length"); |
| 79 | } |
| 80 | if (info.m_OutputTensorInfos.empty()) |
| 81 | { |
| 82 | throw InvalidArgumentException("RefWorkloadFactory::CreateInput: Output cannot be zero length"); |
| 83 | } |
| 84 | |
| 85 | if (info.m_InputTensorInfos[0].GetNumBytes() != info.m_OutputTensorInfos[0].GetNumBytes()) |
| 86 | { |
| 87 | throw InvalidArgumentException("RefWorkloadFactory::CreateInput: data input and output differ in byte count."); |
| 88 | } |
| 89 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 90 | return MakeWorkload<CopyMemGenericWorkload, CopyMemGenericWorkload>(descriptor, info); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 91 | } |
| 92 | |
| 93 | std::unique_ptr<IWorkload> RefWorkloadFactory::CreateOutput(const OutputQueueDescriptor& descriptor, |
| 94 | const WorkloadInfo& info) const |
| 95 | { |
| 96 | if (info.m_InputTensorInfos.empty() ) |
| 97 | { |
| 98 | throw InvalidArgumentException("RefWorkloadFactory::CreateOutput: Input cannot be zero length"); |
| 99 | } |
| 100 | if (info.m_OutputTensorInfos.empty()) |
| 101 | { |
| 102 | throw InvalidArgumentException("RefWorkloadFactory::CreateOutput: Output cannot be zero length"); |
| 103 | } |
| 104 | if (info.m_InputTensorInfos[0].GetNumBytes() != info.m_OutputTensorInfos[0].GetNumBytes()) |
| 105 | { |
| 106 | throw InvalidArgumentException("RefWorkloadFactory::CreateOutput: data input and output differ in byte count."); |
| 107 | } |
| 108 | |
kevmay01 | 2b4d88e | 2019-01-24 14:05:09 +0000 | [diff] [blame] | 109 | return MakeWorkloadHelper<CopyMemGenericWorkload, CopyMemGenericWorkload, |
| 110 | CopyMemGenericWorkload, NullWorkload, CopyMemGenericWorkload>(descriptor, info); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 111 | } |
| 112 | |
| 113 | std::unique_ptr<IWorkload> RefWorkloadFactory::CreateActivation(const ActivationQueueDescriptor& descriptor, |
| 114 | const WorkloadInfo& info) const |
| 115 | { |
Nattapat Chaimanowong | ae2c5f0 | 2019-04-24 16:19:57 +0100 | [diff] [blame] | 116 | if (IsFloat16(info)) |
| 117 | { |
| 118 | return MakeWorkload<NullWorkload, NullWorkload>(descriptor, info); |
| 119 | } |
| 120 | return std::make_unique<RefActivationWorkload>(descriptor, info); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 121 | } |
| 122 | |
| 123 | std::unique_ptr<IWorkload> RefWorkloadFactory::CreateSoftmax(const SoftmaxQueueDescriptor& descriptor, |
| 124 | const WorkloadInfo& info) const |
| 125 | { |
| 126 | return MakeWorkload<RefSoftmaxFloat32Workload, RefSoftmaxUint8Workload>(descriptor, info); |
| 127 | } |
| 128 | |
| 129 | std::unique_ptr<IWorkload> RefWorkloadFactory::CreateSplitter(const SplitterQueueDescriptor& descriptor, |
| 130 | const WorkloadInfo& info) const |
| 131 | { |
| 132 | return MakeWorkload<RefSplitterFloat32Workload, RefSplitterUint8Workload>(descriptor, info); |
| 133 | } |
| 134 | |
| 135 | std::unique_ptr<armnn::IWorkload> RefWorkloadFactory::CreateMerger(const MergerQueueDescriptor& descriptor, |
| 136 | const WorkloadInfo& info) const |
| 137 | { |
| 138 | return MakeWorkload<RefMergerFloat32Workload, RefMergerUint8Workload>(descriptor, info); |
| 139 | } |
| 140 | |
| 141 | std::unique_ptr<armnn::IWorkload> RefWorkloadFactory::CreateFullyConnected( |
| 142 | const FullyConnectedQueueDescriptor& descriptor, const WorkloadInfo& info) const |
| 143 | { |
| 144 | return MakeWorkload<RefFullyConnectedFloat32Workload, RefFullyConnectedUint8Workload>(descriptor, info); |
| 145 | } |
| 146 | |
| 147 | std::unique_ptr<armnn::IWorkload> RefWorkloadFactory::CreatePermute(const PermuteQueueDescriptor& descriptor, |
| 148 | const WorkloadInfo& info) const |
| 149 | { |
narpra01 | db2b160 | 2019-01-23 15:23:11 +0000 | [diff] [blame] | 150 | return MakeWorkloadHelper<RefPermuteFloat16Workload, RefPermuteFloat32Workload, RefPermuteUint8Workload, |
kevmay01 | 2b4d88e | 2019-01-24 14:05:09 +0000 | [diff] [blame] | 151 | NullWorkload, NullWorkload>(descriptor, info); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 152 | } |
| 153 | |
| 154 | std::unique_ptr<armnn::IWorkload> RefWorkloadFactory::CreatePooling2d(const Pooling2dQueueDescriptor& descriptor, |
| 155 | const WorkloadInfo& info) const |
| 156 | { |
| 157 | return MakeWorkload<RefPooling2dFloat32Workload, RefPooling2dUint8Workload>(descriptor, info); |
| 158 | } |
| 159 | |
| 160 | std::unique_ptr<armnn::IWorkload> RefWorkloadFactory::CreateConvolution2d( |
| 161 | const Convolution2dQueueDescriptor& descriptor, const WorkloadInfo& info) const |
| 162 | { |
| 163 | return MakeWorkload<RefConvolution2dFloat32Workload, RefConvolution2dUint8Workload>(descriptor, info); |
| 164 | } |
| 165 | |
| 166 | std::unique_ptr<IWorkload> RefWorkloadFactory::CreateDepthwiseConvolution2d( |
| 167 | const DepthwiseConvolution2dQueueDescriptor& descriptor, const WorkloadInfo& info) const |
| 168 | { |
| 169 | return MakeWorkload<RefDepthwiseConvolution2dFloat32Workload, |
| 170 | RefDepthwiseConvolution2dUint8Workload>(descriptor, info); |
| 171 | } |
| 172 | |
Narumol Prangnawarat | 94dd5d8 | 2019-01-23 18:06:26 +0000 | [diff] [blame] | 173 | std::unique_ptr<IWorkload> RefWorkloadFactory::CreateDetectionPostProcess( |
| 174 | const armnn::DetectionPostProcessQueueDescriptor& descriptor, const armnn::WorkloadInfo& info) const |
| 175 | { |
Narumol Prangnawarat | 6d302bf | 2019-02-04 11:46:26 +0000 | [diff] [blame] | 176 | const DataType dataType = info.m_InputTensorInfos[0].GetDataType(); |
| 177 | switch (dataType) |
| 178 | { |
| 179 | case DataType::Float32: |
| 180 | return std::make_unique<RefDetectionPostProcessFloat32Workload>(descriptor, info); |
| 181 | case DataType::QuantisedAsymm8: |
| 182 | return std::make_unique<RefDetectionPostProcessUint8Workload>(descriptor, info); |
| 183 | default: |
| 184 | return MakeWorkload<NullWorkload, NullWorkload>(descriptor, info); |
| 185 | } |
Narumol Prangnawarat | 94dd5d8 | 2019-01-23 18:06:26 +0000 | [diff] [blame] | 186 | } |
| 187 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 188 | std::unique_ptr<armnn::IWorkload> RefWorkloadFactory::CreateNormalization( |
| 189 | const NormalizationQueueDescriptor& descriptor, const WorkloadInfo& info) const |
| 190 | { |
| 191 | return MakeWorkload<RefNormalizationFloat32Workload, NullWorkload>(descriptor, info); |
| 192 | } |
| 193 | |
| 194 | std::unique_ptr<armnn::IWorkload> RefWorkloadFactory::CreateAddition(const AdditionQueueDescriptor& descriptor, |
| 195 | const WorkloadInfo& info) const |
| 196 | { |
Jim Flynn | 82fbe7c | 2019-04-02 15:19:08 +0100 | [diff] [blame] | 197 | if (IsFloat16(info)) |
| 198 | { |
| 199 | return MakeWorkload<NullWorkload, NullWorkload>(descriptor, info); |
| 200 | } |
Sadik Armagan | 2e6dc3a | 2019-04-03 17:48:18 +0100 | [diff] [blame] | 201 | return std::make_unique<RefAdditionWorkload>(descriptor, info); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 202 | } |
| 203 | |
| 204 | std::unique_ptr<armnn::IWorkload> RefWorkloadFactory::CreateMultiplication( |
| 205 | const MultiplicationQueueDescriptor& descriptor, const WorkloadInfo& info) const |
| 206 | { |
Jim Flynn | 82fbe7c | 2019-04-02 15:19:08 +0100 | [diff] [blame] | 207 | if (IsFloat16(info)) |
| 208 | { |
| 209 | return MakeWorkload<NullWorkload, NullWorkload>(descriptor, info); |
| 210 | } |
Sadik Armagan | 2e6dc3a | 2019-04-03 17:48:18 +0100 | [diff] [blame] | 211 | return std::make_unique<RefMultiplicationWorkload>(descriptor, info); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 212 | } |
| 213 | |
| 214 | std::unique_ptr<armnn::IWorkload> RefWorkloadFactory::CreateBatchNormalization( |
| 215 | const BatchNormalizationQueueDescriptor& descriptor, const WorkloadInfo& info) const |
| 216 | { |
| 217 | return MakeWorkload<RefBatchNormalizationFloat32Workload, RefBatchNormalizationUint8Workload>(descriptor, info); |
| 218 | } |
| 219 | |
| 220 | std::unique_ptr<armnn::IWorkload> RefWorkloadFactory::CreateMemCopy(const MemCopyQueueDescriptor& descriptor, |
| 221 | const WorkloadInfo& info) const |
| 222 | { |
| 223 | if (descriptor.m_Inputs.empty()) |
| 224 | { |
| 225 | throw InvalidArgumentException("RefWorkloadFactory: CreateMemCopy() expected an input tensor."); |
| 226 | } |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 227 | return std::make_unique<CopyMemGenericWorkload>(descriptor, info); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 228 | } |
| 229 | |
| 230 | std::unique_ptr<IWorkload> RefWorkloadFactory::CreateResizeBilinear(const ResizeBilinearQueueDescriptor& descriptor, |
| 231 | const WorkloadInfo& info) const |
| 232 | { |
| 233 | return MakeWorkload<RefResizeBilinearFloat32Workload, RefResizeBilinearUint8Workload>(descriptor, info); |
| 234 | } |
| 235 | |
| 236 | std::unique_ptr<IWorkload> RefWorkloadFactory::CreateFakeQuantization( |
| 237 | const FakeQuantizationQueueDescriptor& descriptor, |
| 238 | const WorkloadInfo& info) const |
| 239 | { |
| 240 | return MakeWorkload<RefFakeQuantizationFloat32Workload, NullWorkload>(descriptor, info); |
| 241 | } |
| 242 | |
| 243 | std::unique_ptr<IWorkload> RefWorkloadFactory::CreateL2Normalization(const L2NormalizationQueueDescriptor& descriptor, |
| 244 | const WorkloadInfo& info) const |
| 245 | { |
| 246 | return MakeWorkload<RefL2NormalizationFloat32Workload, NullWorkload>(descriptor, info); |
| 247 | } |
| 248 | |
| 249 | std::unique_ptr<IWorkload> RefWorkloadFactory::CreateConstant(const ConstantQueueDescriptor& descriptor, |
| 250 | const WorkloadInfo& info) const |
| 251 | { |
narpra01 | db2b160 | 2019-01-23 15:23:11 +0000 | [diff] [blame] | 252 | return MakeWorkloadHelper<NullWorkload, RefConstantFloat32Workload, RefConstantUint8Workload, |
kevmay01 | 2b4d88e | 2019-01-24 14:05:09 +0000 | [diff] [blame] | 253 | RefConstantInt32Workload, NullWorkload>(descriptor, info); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 254 | } |
| 255 | |
| 256 | std::unique_ptr<IWorkload> RefWorkloadFactory::CreateReshape(const ReshapeQueueDescriptor& descriptor, |
| 257 | const WorkloadInfo& info) const |
| 258 | { |
| 259 | return MakeWorkload<RefReshapeFloat32Workload, RefReshapeUint8Workload>(descriptor, info); |
| 260 | } |
| 261 | |
Nattapat Chaimanowong | 207ef9a | 2018-11-02 10:57:25 +0000 | [diff] [blame] | 262 | std::unique_ptr<IWorkload> RefWorkloadFactory::CreateSpaceToBatchNd(const SpaceToBatchNdQueueDescriptor& descriptor, |
| 263 | const WorkloadInfo& info) const |
| 264 | { |
Nattapat Chaimanowong | 3ea76d5 | 2018-11-09 14:10:38 +0000 | [diff] [blame] | 265 | return MakeWorkload<RefSpaceToBatchNdFloat32Workload, RefSpaceToBatchNdUint8Workload>(descriptor, info); |
Nattapat Chaimanowong | 207ef9a | 2018-11-02 10:57:25 +0000 | [diff] [blame] | 266 | } |
| 267 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 268 | std::unique_ptr<IWorkload> RefWorkloadFactory::CreateFloor(const FloorQueueDescriptor& descriptor, |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 269 | const WorkloadInfo& info) const |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 270 | { |
| 271 | return MakeWorkload<RefFloorFloat32Workload, NullWorkload>(descriptor, info); |
| 272 | } |
| 273 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 274 | std::unique_ptr<IWorkload> RefWorkloadFactory::CreateLstm(const LstmQueueDescriptor& descriptor, |
| 275 | const WorkloadInfo& info) const |
| 276 | { |
| 277 | return MakeWorkload<RefLstmFloat32Workload, NullWorkload>(descriptor, info); |
| 278 | } |
| 279 | |
| 280 | std::unique_ptr<IWorkload> RefWorkloadFactory::CreateConvertFp16ToFp32( |
| 281 | const ConvertFp16ToFp32QueueDescriptor& descriptor, |
| 282 | const WorkloadInfo& info) const |
| 283 | { |
| 284 | return std::make_unique<RefConvertFp16ToFp32Workload>(descriptor, info); |
| 285 | } |
| 286 | |
| 287 | std::unique_ptr<IWorkload> RefWorkloadFactory::CreateConvertFp32ToFp16( |
| 288 | const ConvertFp32ToFp16QueueDescriptor& descriptor, |
| 289 | const WorkloadInfo& info) const |
| 290 | { |
| 291 | return std::make_unique<RefConvertFp32ToFp16Workload>(descriptor, info); |
| 292 | } |
| 293 | |
Francis Murtagh | e7a86a4 | 2018-08-29 12:42:10 +0100 | [diff] [blame] | 294 | std::unique_ptr<armnn::IWorkload> RefWorkloadFactory::CreateDivision( |
| 295 | const DivisionQueueDescriptor& descriptor, const WorkloadInfo& info) const |
| 296 | { |
Jim Flynn | 82fbe7c | 2019-04-02 15:19:08 +0100 | [diff] [blame] | 297 | if (IsFloat16(info)) |
| 298 | { |
| 299 | return MakeWorkload<NullWorkload, NullWorkload>(descriptor, info); |
| 300 | } |
Sadik Armagan | 2e6dc3a | 2019-04-03 17:48:18 +0100 | [diff] [blame] | 301 | return std::make_unique<RefDivisionWorkload>(descriptor, info); |
Francis Murtagh | e7a86a4 | 2018-08-29 12:42:10 +0100 | [diff] [blame] | 302 | } |
| 303 | |
David Beck | c2044fe | 2018-09-05 15:00:38 +0100 | [diff] [blame] | 304 | std::unique_ptr<armnn::IWorkload> RefWorkloadFactory::CreateSubtraction( |
| 305 | const SubtractionQueueDescriptor& descriptor, const WorkloadInfo& info) const |
| 306 | { |
Jim Flynn | 82fbe7c | 2019-04-02 15:19:08 +0100 | [diff] [blame] | 307 | if (IsFloat16(info)) |
| 308 | { |
| 309 | return MakeWorkload<NullWorkload, NullWorkload>(descriptor, info); |
| 310 | } |
Sadik Armagan | 2e6dc3a | 2019-04-03 17:48:18 +0100 | [diff] [blame] | 311 | return std::make_unique<RefSubtractionWorkload>(descriptor, info); |
David Beck | c2044fe | 2018-09-05 15:00:38 +0100 | [diff] [blame] | 312 | } |
| 313 | |
Nattapat Chaimanowong | 5a4304a | 2018-11-28 10:44:37 +0000 | [diff] [blame] | 314 | std::unique_ptr<armnn::IWorkload> RefWorkloadFactory::CreateMaximum( |
| 315 | const MaximumQueueDescriptor& descriptor, const WorkloadInfo& info) const |
| 316 | { |
Sadik Armagan | 2e6dc3a | 2019-04-03 17:48:18 +0100 | [diff] [blame] | 317 | return std::make_unique<RefMaximumWorkload>(descriptor, info); |
Nattapat Chaimanowong | 5a4304a | 2018-11-28 10:44:37 +0000 | [diff] [blame] | 318 | } |
| 319 | |
narpra01 | a6bf912 | 2018-09-10 09:50:09 +0100 | [diff] [blame] | 320 | std::unique_ptr<armnn::IWorkload> RefWorkloadFactory::CreateMean( |
| 321 | const MeanQueueDescriptor& descriptor, const WorkloadInfo& info) const |
| 322 | { |
narpra01 | 1e4c31d | 2018-09-28 11:07:51 +0100 | [diff] [blame] | 323 | return MakeWorkload<RefMeanFloat32Workload, RefMeanUint8Workload>(descriptor, info); |
narpra01 | a6bf912 | 2018-09-10 09:50:09 +0100 | [diff] [blame] | 324 | } |
| 325 | |
Éanna Ó Catháin | 20e5880 | 2018-12-04 10:29:06 +0000 | [diff] [blame] | 326 | std::unique_ptr<armnn::IWorkload> RefWorkloadFactory::CreateMinimum( |
| 327 | const MinimumQueueDescriptor& descriptor, const WorkloadInfo& info) const |
| 328 | { |
Sadik Armagan | 2e6dc3a | 2019-04-03 17:48:18 +0100 | [diff] [blame] | 329 | return std::make_unique<RefMinimumWorkload>(descriptor, info); |
Éanna Ó Catháin | 20e5880 | 2018-12-04 10:29:06 +0000 | [diff] [blame] | 330 | } |
| 331 | |
jimfly01 | 2c9322a | 2018-09-19 10:59:49 +0100 | [diff] [blame] | 332 | std::unique_ptr<IWorkload> RefWorkloadFactory::CreatePad(const PadQueueDescriptor& descriptor, |
| 333 | const WorkloadInfo& info) const |
| 334 | { |
Mohamed Nour Abouelseoud | dd6acea | 2018-10-18 12:26:19 +0100 | [diff] [blame] | 335 | return MakeWorkload<RefPadFloat32Workload, RefPadUint8Workload>(descriptor, info); |
jimfly01 | 2c9322a | 2018-09-19 10:59:49 +0100 | [diff] [blame] | 336 | } |
| 337 | |
FrancisMurtagh | 2099595 | 2018-12-17 12:11:36 +0000 | [diff] [blame] | 338 | std::unique_ptr<IWorkload> RefWorkloadFactory::CreateEqual(const EqualQueueDescriptor& descriptor, |
| 339 | const WorkloadInfo& info) const |
| 340 | { |
Sadik Armagan | 2e6dc3a | 2019-04-03 17:48:18 +0100 | [diff] [blame] | 341 | return std::make_unique<RefEqualWorkload>(descriptor, info); |
FrancisMurtagh | 2099595 | 2018-12-17 12:11:36 +0000 | [diff] [blame] | 342 | } |
| 343 | |
Éanna Ó Catháin | 4e1e136 | 2018-11-12 11:36:34 +0000 | [diff] [blame] | 344 | std::unique_ptr<IWorkload> RefWorkloadFactory::CreateBatchToSpaceNd(const BatchToSpaceNdQueueDescriptor& descriptor, |
| 345 | const WorkloadInfo& info) const |
| 346 | { |
| 347 | return MakeWorkload<RefBatchToSpaceNdFloat32Workload, RefBatchToSpaceNdUint8Workload>(descriptor, info); |
| 348 | } |
jimfly01 | 2c9322a | 2018-09-19 10:59:49 +0100 | [diff] [blame] | 349 | |
Conor Kennedy | 430b5d8 | 2018-11-14 15:28:28 +0000 | [diff] [blame] | 350 | std::unique_ptr<IWorkload> RefWorkloadFactory::CreateStridedSlice(const StridedSliceQueueDescriptor& descriptor, |
| 351 | const WorkloadInfo& info) const |
| 352 | { |
Nattapat Chaimanowong | 1216b58 | 2018-11-23 15:33:41 +0000 | [diff] [blame] | 353 | return MakeWorkload<RefStridedSliceFloat32Workload, RefStridedSliceUint8Workload>(descriptor, info); |
Conor Kennedy | 430b5d8 | 2018-11-14 15:28:28 +0000 | [diff] [blame] | 354 | } |
| 355 | |
Matteo Martincigh | 59a950c | 2018-12-13 12:48:25 +0000 | [diff] [blame] | 356 | std::unique_ptr<IWorkload> RefWorkloadFactory::CreateGreater(const GreaterQueueDescriptor& descriptor, |
| 357 | const WorkloadInfo& info) const |
| 358 | { |
Sadik Armagan | 2e6dc3a | 2019-04-03 17:48:18 +0100 | [diff] [blame] | 359 | return std::make_unique<RefGreaterWorkload>(descriptor, info); |
Matteo Martincigh | 59a950c | 2018-12-13 12:48:25 +0000 | [diff] [blame] | 360 | } |
| 361 | |
Nattapat Chaimanowong | a9a1cf1 | 2018-12-03 16:06:49 +0000 | [diff] [blame] | 362 | std::unique_ptr<IWorkload> RefWorkloadFactory::CreateDebug(const DebugQueueDescriptor& descriptor, |
| 363 | const WorkloadInfo& info) const |
| 364 | { |
Nattapat Chaimanowong | cfdcadf | 2018-12-06 11:54:33 +0000 | [diff] [blame] | 365 | return MakeWorkload<RefDebugFloat32Workload, RefDebugUint8Workload>(descriptor, info); |
Nattapat Chaimanowong | a9a1cf1 | 2018-12-03 16:06:49 +0000 | [diff] [blame] | 366 | } |
| 367 | |
Mohamed Nour Abouelseoud | a1d3c6a | 2018-12-27 12:39:16 +0000 | [diff] [blame] | 368 | std::unique_ptr<IWorkload> RefWorkloadFactory::CreateRsqrt(const RsqrtQueueDescriptor& descriptor, |
| 369 | const WorkloadInfo& info) const |
| 370 | { |
| 371 | return MakeWorkload<RefRsqrtFloat32Workload, NullWorkload>(descriptor, info); |
| 372 | } |
| 373 | |
narpra01 | 4951d84 | 2019-01-18 16:53:53 +0000 | [diff] [blame] | 374 | std::unique_ptr<IWorkload> RefWorkloadFactory::CreateGather(const armnn::GatherQueueDescriptor& descriptor, |
| 375 | const armnn::WorkloadInfo& info) const |
| 376 | { |
| 377 | return MakeWorkload<RefGatherFloat32Workload, RefGatherUint8Workload>(descriptor, info); |
| 378 | } |
| 379 | |
Matteo Martincigh | 4912402 | 2019-01-11 13:25:59 +0000 | [diff] [blame] | 380 | std::unique_ptr<IWorkload> RefWorkloadFactory::CreatePreCompiled(const PreCompiledQueueDescriptor& descriptor, |
| 381 | const WorkloadInfo& info) const |
| 382 | { |
| 383 | return nullptr; |
| 384 | } |
| 385 | |
Derek Lamberti | 5f400d6 | 2019-03-25 15:41:58 +0000 | [diff] [blame] | 386 | std::unique_ptr<IWorkload> RefWorkloadFactory::CreateQuantize(const QuantizeQueueDescriptor& descriptor, |
| 387 | const WorkloadInfo& info) const |
| 388 | { |
| 389 | return std::make_unique<RefQuantizeWorkload>(descriptor, info); |
| 390 | } |
| 391 | |
Nattapat Chaimanowong | 8a54ac0 | 2019-03-29 15:25:04 +0000 | [diff] [blame] | 392 | std::unique_ptr<IWorkload> RefWorkloadFactory::CreateDequantize(const DequantizeQueueDescriptor& descriptor, |
| 393 | const WorkloadInfo& info) const |
| 394 | { |
Nattapat Chaimanowong | afa4e3a | 2019-04-02 11:41:45 +0100 | [diff] [blame] | 395 | return std::make_unique<RefDequantizeWorkload>(descriptor, info); |
Nattapat Chaimanowong | 8a54ac0 | 2019-03-29 15:25:04 +0000 | [diff] [blame] | 396 | } |
| 397 | |
Matteo Martincigh | 4912402 | 2019-01-11 13:25:59 +0000 | [diff] [blame] | 398 | } // namespace armnn |