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 | |
| 6 | #include "CpuTensorHandle.hpp" |
Derek Lamberti | a9cca6a | 2019-03-25 15:41:58 +0000 | [diff] [blame] | 7 | #include "WorkloadFactory.hpp" |
| 8 | |
Aron Virginas-Tar | c9cc804 | 2018-11-01 16:15:57 +0000 | [diff] [blame] | 9 | |
| 10 | #include <Layer.hpp> |
| 11 | #include <LayersFwd.hpp> |
David Beck | dcb751f | 2018-10-03 11:42:42 +0100 | [diff] [blame] | 12 | |
David Beck | b4540be | 2018-09-24 13:18:27 +0100 | [diff] [blame] | 13 | #include <armnn/Types.hpp> |
| 14 | #include <armnn/LayerSupport.hpp> |
David Beck | 111b5d9 | 2018-11-12 14:59:37 +0000 | [diff] [blame] | 15 | #include <armnn/ILayerSupport.hpp> |
Aron Virginas-Tar | c9cc804 | 2018-11-01 16:15:57 +0000 | [diff] [blame] | 16 | |
David Beck | 111b5d9 | 2018-11-12 14:59:37 +0000 | [diff] [blame] | 17 | #include <backendsCommon/BackendRegistry.hpp> |
Aron Virginas-Tar | c9cc804 | 2018-11-01 16:15:57 +0000 | [diff] [blame] | 18 | #include <backendsCommon/WorkloadFactory.hpp> |
David Beck | 111b5d9 | 2018-11-12 14:59:37 +0000 | [diff] [blame] | 19 | #include <backendsCommon/IBackendInternal.hpp> |
Francis Murtagh | 46c09d0 | 2019-05-28 08:15:28 +0100 | [diff] [blame] | 20 | #include <backendsCommon/test/WorkloadTestUtils.hpp> |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 21 | |
| 22 | #include <boost/cast.hpp> |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 23 | #include <boost/iterator/transform_iterator.hpp> |
| 24 | |
Aron Virginas-Tar | c9cc804 | 2018-11-01 16:15:57 +0000 | [diff] [blame] | 25 | #include <cstring> |
David Beck | 111b5d9 | 2018-11-12 14:59:37 +0000 | [diff] [blame] | 26 | #include <sstream> |
Aron Virginas-Tar | c9cc804 | 2018-11-01 16:15:57 +0000 | [diff] [blame] | 27 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 28 | namespace armnn |
| 29 | { |
| 30 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 31 | namespace |
| 32 | { |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 33 | |
David Beck | 29c75de | 2018-10-23 13:35:58 +0100 | [diff] [blame] | 34 | const TensorInfo OverrideDataType(const TensorInfo& info, Optional<DataType> type) |
| 35 | { |
| 36 | if (!type) |
| 37 | { |
| 38 | return info; |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 39 | } |
| 40 | |
David Beck | 29c75de | 2018-10-23 13:35:58 +0100 | [diff] [blame] | 41 | return TensorInfo(info.GetShape(), type.value(), info.GetQuantizationScale(), info.GetQuantizationOffset()); |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 42 | } |
| 43 | |
David Beck | 29c75de | 2018-10-23 13:35:58 +0100 | [diff] [blame] | 44 | } // anonymous namespace |
| 45 | |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 46 | bool IWorkloadFactory::IsLayerSupported(const BackendId& backendId, |
David Beck | dcb751f | 2018-10-03 11:42:42 +0100 | [diff] [blame] | 47 | const IConnectableLayer& connectableLayer, |
David Beck | 29c75de | 2018-10-23 13:35:58 +0100 | [diff] [blame] | 48 | Optional<DataType> dataType, |
David Beck | dcb751f | 2018-10-03 11:42:42 +0100 | [diff] [blame] | 49 | std::string& outReasonIfUnsupported) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 50 | { |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 51 | Optional<std::string&> reason = outReasonIfUnsupported; |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 52 | bool result; |
David Beck | dcb751f | 2018-10-03 11:42:42 +0100 | [diff] [blame] | 53 | const Layer& layer = *(boost::polymorphic_downcast<const Layer*>(&connectableLayer)); |
| 54 | |
David Beck | 111b5d9 | 2018-11-12 14:59:37 +0000 | [diff] [blame] | 55 | auto const& backendRegistry = BackendRegistryInstance(); |
| 56 | if (!backendRegistry.IsBackendRegistered(backendId)) |
| 57 | { |
| 58 | std::stringstream ss; |
| 59 | ss << connectableLayer.GetName() << " is not supported on " << backendId |
| 60 | << " because this backend is not registered."; |
| 61 | |
| 62 | outReasonIfUnsupported = ss.str(); |
| 63 | return false; |
| 64 | } |
| 65 | |
| 66 | auto backendFactory = backendRegistry.GetFactory(backendId); |
| 67 | auto backendObject = backendFactory(); |
| 68 | auto layerSupportObject = backendObject->GetLayerSupport(); |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 69 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 70 | switch(layer.GetType()) |
| 71 | { |
| 72 | case LayerType::Activation: |
| 73 | { |
| 74 | auto cLayer = boost::polymorphic_downcast<const ActivationLayer*>(&layer); |
| 75 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 76 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 77 | result = layerSupportObject->IsActivationSupported( |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 78 | OverrideDataType(input, dataType), |
| 79 | OverrideDataType(output, dataType), |
| 80 | cLayer->GetParameters(), |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 81 | reason); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 82 | break; |
| 83 | } |
| 84 | case LayerType::Addition: |
| 85 | { |
| 86 | const TensorInfo& input0 = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 87 | const TensorInfo& input1 = layer.GetInputSlot(1).GetConnection()->GetTensorInfo(); |
| 88 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 89 | result = layerSupportObject->IsAdditionSupported( |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 90 | OverrideDataType(input0, dataType), |
| 91 | OverrideDataType(input1, dataType), |
| 92 | OverrideDataType(output, dataType), |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 93 | reason); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 94 | break; |
| 95 | } |
| 96 | case LayerType::BatchNormalization: |
| 97 | { |
| 98 | auto cLayer = boost::polymorphic_downcast<const BatchNormalizationLayer*>(&layer); |
| 99 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 100 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
| 101 | const TensorInfo& mean = cLayer->m_Mean->GetTensorInfo(); |
| 102 | const TensorInfo& var = cLayer->m_Variance->GetTensorInfo(); |
| 103 | const TensorInfo& beta = cLayer->m_Beta->GetTensorInfo(); |
| 104 | const TensorInfo& gamma = cLayer->m_Gamma->GetTensorInfo(); |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 105 | result = layerSupportObject->IsBatchNormalizationSupported( |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 106 | OverrideDataType(input, dataType), |
| 107 | OverrideDataType(output, dataType), |
| 108 | OverrideDataType(mean, dataType), |
| 109 | OverrideDataType(var, dataType), |
| 110 | OverrideDataType(beta, dataType), |
| 111 | OverrideDataType(gamma, dataType), |
| 112 | cLayer->GetParameters(), |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 113 | reason); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 114 | break; |
| 115 | } |
Éanna Ó Catháin | 4e1e136 | 2018-11-12 11:36:34 +0000 | [diff] [blame] | 116 | case LayerType::BatchToSpaceNd: |
| 117 | { |
| 118 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 119 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
| 120 | auto cLayer = boost::polymorphic_downcast<const BatchToSpaceNdLayer*>(&layer); |
| 121 | |
| 122 | result = layerSupportObject->IsBatchToSpaceNdSupported(OverrideDataType(input, dataType), |
| 123 | OverrideDataType(output, dataType), |
| 124 | cLayer->GetParameters(), |
| 125 | reason); |
| 126 | break; |
| 127 | } |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 128 | case LayerType::Constant: |
| 129 | { |
| 130 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 131 | result = layerSupportObject->IsConstantSupported(OverrideDataType(output, dataType), reason); |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 132 | break; |
| 133 | } |
| 134 | case LayerType::ConvertFp16ToFp32: |
| 135 | { |
| 136 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 137 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 138 | result = layerSupportObject->IsConvertFp16ToFp32Supported(input, output, reason); |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 139 | break; |
| 140 | } |
| 141 | case LayerType::ConvertFp32ToFp16: |
| 142 | { |
| 143 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 144 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 145 | result = layerSupportObject->IsConvertFp32ToFp16Supported(input, output, reason); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 146 | break; |
| 147 | } |
| 148 | case LayerType::Convolution2d: |
| 149 | { |
| 150 | auto cLayer = boost::polymorphic_downcast<const Convolution2dLayer*>(&layer); |
arovir01 | a682410 | 2018-08-28 17:40:45 +0100 | [diff] [blame] | 151 | |
| 152 | const TensorInfo input = OverrideDataType(layer.GetInputSlot(0).GetConnection()->GetTensorInfo(), |
| 153 | dataType); |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 154 | const TensorInfo output = OverrideDataType(layer.GetOutputSlot(0).GetTensorInfo(), dataType); |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 155 | BOOST_ASSERT(cLayer->m_Weight.get() != nullptr); |
| 156 | |
arovir01 | a682410 | 2018-08-28 17:40:45 +0100 | [diff] [blame] | 157 | const Convolution2dDescriptor& descriptor = cLayer->GetParameters(); |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 158 | |
arovir01 | a682410 | 2018-08-28 17:40:45 +0100 | [diff] [blame] | 159 | // Construct optional biases object based on the value of m_BiasEnabled |
David Beck | 5eec11d | 2018-10-04 15:43:17 +0100 | [diff] [blame] | 160 | Optional<TensorInfo> biases; |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 161 | if (descriptor.m_BiasEnabled) |
| 162 | { |
David Beck | 5eec11d | 2018-10-04 15:43:17 +0100 | [diff] [blame] | 163 | biases = |
| 164 | OverrideDataType(cLayer->m_Bias->GetTensorInfo(), GetBiasTypeFromWeightsType(dataType)); |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 165 | } |
| 166 | |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 167 | result = layerSupportObject->IsConvolution2dSupported( |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 168 | input, |
| 169 | output, |
| 170 | descriptor, |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 171 | OverrideDataType(cLayer->m_Weight->GetTensorInfo(), dataType), |
arovir01 | a682410 | 2018-08-28 17:40:45 +0100 | [diff] [blame] | 172 | biases, |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 173 | reason); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 174 | break; |
| 175 | } |
Nattapat Chaimanowong | a9a1cf1 | 2018-12-03 16:06:49 +0000 | [diff] [blame] | 176 | case LayerType::Debug: |
| 177 | { |
| 178 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 179 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
| 180 | |
| 181 | result = layerSupportObject->IsDebugSupported(OverrideDataType(input, dataType), |
| 182 | OverrideDataType(output, dataType), |
| 183 | reason); |
| 184 | break; |
| 185 | } |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 186 | case LayerType::DepthwiseConvolution2d: |
| 187 | { |
| 188 | auto cLayer = boost::polymorphic_downcast<const DepthwiseConvolution2dLayer*>(&layer); |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 189 | const TensorInfo& input = OverrideDataType(layer.GetInputSlot(0).GetConnection()->GetTensorInfo(), |
| 190 | dataType); |
| 191 | const TensorInfo& output = OverrideDataType(layer.GetOutputSlot(0).GetTensorInfo(), dataType); |
| 192 | BOOST_ASSERT(cLayer->m_Weight.get() != nullptr); |
| 193 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 194 | const DepthwiseConvolution2dDescriptor& descriptor = cLayer->GetParameters(); |
arovir01 | a682410 | 2018-08-28 17:40:45 +0100 | [diff] [blame] | 195 | |
| 196 | // Construct optional biases object based on the value of m_BiasEnabled |
David Beck | 5eec11d | 2018-10-04 15:43:17 +0100 | [diff] [blame] | 197 | Optional<TensorInfo> biases; |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 198 | if (descriptor.m_BiasEnabled) |
| 199 | { |
David Beck | 5eec11d | 2018-10-04 15:43:17 +0100 | [diff] [blame] | 200 | biases = |
| 201 | OverrideDataType(cLayer->m_Bias->GetTensorInfo(), GetBiasTypeFromWeightsType(dataType)); |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 202 | } |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 203 | |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 204 | result = layerSupportObject->IsDepthwiseConvolutionSupported( |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 205 | input, |
| 206 | output, |
| 207 | descriptor, |
| 208 | OverrideDataType(cLayer->m_Weight->GetTensorInfo(), dataType), |
arovir01 | a682410 | 2018-08-28 17:40:45 +0100 | [diff] [blame] | 209 | biases, |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 210 | reason); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 211 | break; |
| 212 | } |
Nattapat Chaimanowong | e4294fd | 2019-03-28 09:56:53 +0000 | [diff] [blame] | 213 | case LayerType::Dequantize: |
| 214 | { |
| 215 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 216 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
| 217 | |
| 218 | result = layerSupportObject->IsDequantizeSupported(OverrideDataType(input, dataType), |
| 219 | OverrideDataType(output, DataType::Float32), |
| 220 | reason); |
| 221 | break; |
| 222 | } |
Narumol Prangnawarat | 94dd5d8 | 2019-01-23 18:06:26 +0000 | [diff] [blame] | 223 | case LayerType::DetectionPostProcess: |
| 224 | { |
| 225 | const TensorInfo& input0 = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 226 | const TensorInfo& input1 = layer.GetInputSlot(1).GetConnection()->GetTensorInfo(); |
| 227 | auto cLayer = boost::polymorphic_downcast<const DetectionPostProcessLayer*>(&layer); |
| 228 | const DetectionPostProcessDescriptor& descriptor = cLayer->GetParameters(); |
| 229 | result = layerSupportObject->IsDetectionPostProcessSupported(input0, |
| 230 | input1, |
| 231 | descriptor, |
| 232 | reason); |
| 233 | break; |
| 234 | } |
FrancisMurtagh | 2099595 | 2018-12-17 12:11:36 +0000 | [diff] [blame] | 235 | case LayerType::Equal: |
| 236 | { |
| 237 | const TensorInfo& input0 = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 238 | const TensorInfo& input1 = layer.GetInputSlot(1).GetConnection()->GetTensorInfo(); |
| 239 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
| 240 | result = layerSupportObject->IsEqualSupported(OverrideDataType(input0, dataType), |
| 241 | OverrideDataType(input1, dataType), |
| 242 | OverrideDataType(output, dataType), |
| 243 | reason); |
| 244 | break; |
| 245 | } |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 246 | case LayerType::FakeQuantization: |
| 247 | { |
| 248 | auto cLayer = boost::polymorphic_downcast<const FakeQuantizationLayer*>(&layer); |
| 249 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 250 | result = layerSupportObject->IsFakeQuantizationSupported(OverrideDataType(input, dataType), |
| 251 | cLayer->GetParameters(), |
| 252 | reason); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 253 | break; |
| 254 | } |
| 255 | case LayerType::Floor: |
| 256 | { |
| 257 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 258 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 259 | result = layerSupportObject->IsFloorSupported(OverrideDataType(input, dataType), |
| 260 | OverrideDataType(output, dataType), |
| 261 | reason); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 262 | break; |
| 263 | } |
| 264 | case LayerType::FullyConnected: |
| 265 | { |
| 266 | auto cLayer = boost::polymorphic_downcast<const FullyConnectedLayer*>(&layer); |
| 267 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 268 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
| 269 | BOOST_ASSERT(cLayer->m_Weight.get() != nullptr); |
| 270 | |
| 271 | TensorInfo biasInfo; |
| 272 | const TensorInfo * biasInfoPtr = nullptr; |
| 273 | static const TensorInfo dummyFloat16Bias(TensorShape({1,1,1,1}), DataType::Float16); |
| 274 | static const TensorInfo dummyFloat32Bias(TensorShape({1,1,1,1}), DataType::Float32); |
| 275 | static const TensorInfo dummyQA8Bias(TensorShape({1,1,1,1}), DataType::Signed32); |
| 276 | |
| 277 | const FullyConnectedDescriptor& descriptor = cLayer->GetParameters(); |
| 278 | if (descriptor.m_BiasEnabled) |
| 279 | { |
| 280 | BOOST_ASSERT(cLayer->m_Bias.get() != nullptr); |
| 281 | biasInfo = OverrideDataType(cLayer->m_Bias->GetTensorInfo(), GetBiasTypeFromWeightsType(dataType)); |
| 282 | biasInfoPtr = &biasInfo; |
| 283 | } |
| 284 | else |
| 285 | { |
| 286 | // If biases are not enabled pass a dummy tensorinfo for the validation |
| 287 | switch(input.GetDataType()) |
| 288 | { |
| 289 | case DataType::Float16: |
| 290 | { |
| 291 | biasInfoPtr = &dummyFloat16Bias; |
| 292 | break; |
| 293 | } |
| 294 | case DataType::Float32: |
| 295 | { |
| 296 | biasInfoPtr = &dummyFloat32Bias; |
| 297 | break; |
| 298 | } |
| 299 | case DataType::QuantisedAsymm8: |
| 300 | { |
| 301 | biasInfoPtr = &dummyQA8Bias; |
| 302 | break; |
| 303 | } |
| 304 | default: |
| 305 | { |
| 306 | BOOST_ASSERT_MSG(false, "Unexpected bias type"); |
| 307 | } |
| 308 | } |
| 309 | } |
| 310 | |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 311 | result = layerSupportObject->IsFullyConnectedSupported( |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 312 | OverrideDataType(input, dataType), |
| 313 | OverrideDataType(output, dataType), |
| 314 | OverrideDataType(cLayer->m_Weight->GetTensorInfo(), dataType), |
| 315 | *biasInfoPtr, |
| 316 | descriptor, |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 317 | reason); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 318 | break; |
| 319 | } |
narpra01 | b89b05f | 2019-01-16 09:53:09 +0000 | [diff] [blame] | 320 | case LayerType::Gather: |
| 321 | { |
| 322 | const TensorInfo& input0 = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 323 | const TensorInfo& input1 = layer.GetInputSlot(1).GetConnection()->GetTensorInfo(); |
| 324 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
| 325 | result = layerSupportObject->IsGatherSupported(OverrideDataType(input0, dataType), |
| 326 | OverrideDataType(input1, dataType), |
| 327 | OverrideDataType(output, dataType), |
| 328 | reason); |
| 329 | break; |
| 330 | } |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 331 | case LayerType::Input: |
| 332 | { |
| 333 | const TensorInfo& input = layer.GetOutputSlot(0).GetTensorInfo(); |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 334 | result = layerSupportObject->IsInputSupported(OverrideDataType(input, dataType), reason); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 335 | break; |
| 336 | } |
| 337 | case LayerType::L2Normalization: |
| 338 | { |
Matteo Martincigh | bcd3c85 | 2018-09-28 14:14:12 +0100 | [diff] [blame] | 339 | auto cLayer = boost::polymorphic_downcast<const L2NormalizationLayer*>(&layer); |
| 340 | const L2NormalizationDescriptor& descriptor = cLayer->GetParameters(); |
| 341 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 342 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 343 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
Matteo Martincigh | bcd3c85 | 2018-09-28 14:14:12 +0100 | [diff] [blame] | 344 | |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 345 | result = layerSupportObject->IsL2NormalizationSupported( |
Matteo Martincigh | bcd3c85 | 2018-09-28 14:14:12 +0100 | [diff] [blame] | 346 | OverrideDataType(input, dataType), |
| 347 | OverrideDataType(output, dataType), |
| 348 | descriptor, |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 349 | reason); |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 350 | break; |
| 351 | } |
| 352 | case LayerType::Lstm: |
| 353 | { |
| 354 | auto cLayer = boost::polymorphic_downcast<const LstmLayer*>(&layer); |
| 355 | const LstmDescriptor& descriptor = cLayer->GetParameters(); |
| 356 | |
| 357 | // All inputs. |
| 358 | const TensorInfo& input = OverrideDataType(layer.GetInputSlot(0).GetConnection()->GetTensorInfo(), |
| 359 | dataType); |
| 360 | const TensorInfo& outputStateIn = OverrideDataType(layer.GetInputSlot(1).GetConnection()->GetTensorInfo(), |
| 361 | dataType); |
| 362 | const TensorInfo& cellStateIn = OverrideDataType(layer.GetInputSlot(2).GetConnection()->GetTensorInfo(), |
| 363 | dataType); |
| 364 | // All outputs |
| 365 | const TensorInfo& scratchBuffer = OverrideDataType(layer.GetOutputSlot(0).GetTensorInfo(), dataType); |
| 366 | const TensorInfo& outputStateOut = OverrideDataType(layer.GetOutputSlot(1).GetTensorInfo(), dataType); |
| 367 | const TensorInfo& cellStateOut = OverrideDataType(layer.GetOutputSlot(2).GetTensorInfo(), dataType); |
| 368 | const TensorInfo& output = OverrideDataType(layer.GetOutputSlot(3).GetTensorInfo(), dataType); |
| 369 | |
| 370 | // Basic parameters |
| 371 | const TensorInfo& inputToForgetWeights |
| 372 | = OverrideDataType(cLayer->m_BasicParameters.m_InputToForgetWeights->GetTensorInfo(), dataType); |
| 373 | const TensorInfo& inputToCellWeights |
| 374 | = OverrideDataType(cLayer->m_BasicParameters.m_InputToCellWeights->GetTensorInfo(), dataType); |
| 375 | const TensorInfo& inputToOutputWeights |
| 376 | = OverrideDataType(cLayer->m_BasicParameters.m_InputToOutputWeights->GetTensorInfo(), dataType); |
| 377 | const TensorInfo& recurrentToForgetWeights |
| 378 | = OverrideDataType(cLayer->m_BasicParameters.m_RecurrentToForgetWeights->GetTensorInfo(), dataType); |
| 379 | const TensorInfo& recurrentToCellWeights |
| 380 | = OverrideDataType(cLayer->m_BasicParameters.m_RecurrentToCellWeights->GetTensorInfo(), dataType); |
| 381 | const TensorInfo& recurrentToOutputWeights |
| 382 | = OverrideDataType(cLayer->m_BasicParameters.m_RecurrentToOutputWeights->GetTensorInfo(), dataType); |
| 383 | const TensorInfo& forgetGateBias |
| 384 | = OverrideDataType(cLayer->m_BasicParameters.m_ForgetGateBias->GetTensorInfo(), dataType); |
| 385 | const TensorInfo& cellBias |
| 386 | = OverrideDataType(cLayer->m_BasicParameters.m_CellBias->GetTensorInfo(), dataType); |
| 387 | const TensorInfo& outputGateBias |
| 388 | = OverrideDataType(cLayer->m_BasicParameters.m_OutputGateBias->GetTensorInfo(), dataType); |
| 389 | |
| 390 | // Optional parameters |
| 391 | const TensorInfo* inputToInputWeights = nullptr; |
| 392 | const TensorInfo* recurrentToInputWeights = nullptr; |
| 393 | const TensorInfo* cellToInputWeights = nullptr; |
| 394 | const TensorInfo* inputGateBias = nullptr; |
| 395 | const TensorInfo* projectionWeights = nullptr; |
| 396 | const TensorInfo* projectionBias = nullptr; |
| 397 | const TensorInfo* cellToForgetWeights = nullptr; |
| 398 | const TensorInfo* cellToOutputWeights = nullptr; |
| 399 | |
| 400 | TensorInfo optInputToInputWeights; |
| 401 | TensorInfo optRecurrentToInputWeights; |
| 402 | TensorInfo optCellToInputWeights; |
| 403 | TensorInfo optInputGateBias; |
| 404 | TensorInfo optProjectionWeights; |
| 405 | TensorInfo optProjectionBias; |
| 406 | TensorInfo optCellToForgetWeights; |
| 407 | TensorInfo optCellToOutputWeights; |
| 408 | |
| 409 | if(!descriptor.m_CifgEnabled) |
| 410 | { |
| 411 | optInputToInputWeights = |
| 412 | OverrideDataType(cLayer->m_CifgParameters.m_InputToInputWeights->GetTensorInfo(), dataType); |
| 413 | inputToInputWeights = &optInputToInputWeights; |
| 414 | |
| 415 | optRecurrentToInputWeights = |
| 416 | OverrideDataType(cLayer->m_CifgParameters.m_RecurrentToInputWeights->GetTensorInfo(), dataType); |
| 417 | recurrentToInputWeights = &optRecurrentToInputWeights; |
| 418 | if (cLayer->m_CifgParameters.m_CellToInputWeights != nullptr) |
| 419 | { |
| 420 | optCellToInputWeights = |
| 421 | OverrideDataType(cLayer->m_CifgParameters.m_CellToInputWeights->GetTensorInfo(), dataType); |
| 422 | cellToInputWeights = &optCellToInputWeights; |
| 423 | } |
| 424 | optInputGateBias = |
| 425 | OverrideDataType(cLayer->m_CifgParameters.m_InputGateBias->GetTensorInfo(), dataType); |
| 426 | inputGateBias = &optInputGateBias; |
| 427 | } |
| 428 | |
| 429 | if(descriptor.m_ProjectionEnabled) |
| 430 | { |
| 431 | optProjectionWeights = |
| 432 | OverrideDataType(cLayer->m_ProjectionParameters.m_ProjectionWeights->GetTensorInfo(), dataType); |
| 433 | projectionWeights = &optProjectionWeights; |
| 434 | if (cLayer->m_ProjectionParameters.m_ProjectionBias != nullptr) |
| 435 | { |
| 436 | optProjectionBias = |
| 437 | OverrideDataType(cLayer->m_ProjectionParameters.m_ProjectionBias->GetTensorInfo(), dataType); |
| 438 | projectionBias = &optProjectionBias; |
| 439 | } |
| 440 | } |
| 441 | |
| 442 | if(descriptor.m_PeepholeEnabled) |
| 443 | { |
| 444 | optCellToForgetWeights = |
| 445 | OverrideDataType(cLayer->m_PeepholeParameters.m_CellToForgetWeights->GetTensorInfo(), dataType); |
| 446 | cellToForgetWeights = &optCellToForgetWeights; |
| 447 | optCellToOutputWeights = |
| 448 | OverrideDataType(cLayer->m_PeepholeParameters.m_CellToOutputWeights->GetTensorInfo(), dataType); |
| 449 | cellToOutputWeights = &optCellToOutputWeights; |
| 450 | } |
| 451 | |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 452 | result = layerSupportObject->IsLstmSupported( |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 453 | input, |
| 454 | outputStateIn, |
| 455 | cellStateIn, |
| 456 | scratchBuffer, |
| 457 | outputStateOut, |
| 458 | cellStateOut, |
| 459 | output, |
| 460 | descriptor, |
| 461 | inputToForgetWeights, |
| 462 | inputToCellWeights, |
| 463 | inputToOutputWeights, |
| 464 | recurrentToForgetWeights, |
| 465 | recurrentToCellWeights, |
| 466 | recurrentToOutputWeights, |
| 467 | forgetGateBias, |
| 468 | cellBias, |
| 469 | outputGateBias, |
| 470 | inputToInputWeights, |
| 471 | recurrentToInputWeights, |
| 472 | cellToInputWeights, |
| 473 | inputGateBias, |
| 474 | projectionWeights, |
| 475 | projectionBias, |
| 476 | cellToForgetWeights, |
| 477 | cellToOutputWeights, |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 478 | reason); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 479 | break; |
| 480 | } |
Nattapat Chaimanowong | 5a4304a | 2018-11-28 10:44:37 +0000 | [diff] [blame] | 481 | case LayerType::Maximum: |
| 482 | { |
| 483 | const TensorInfo& input0 = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 484 | const TensorInfo& input1 = layer.GetInputSlot(1).GetConnection()->GetTensorInfo(); |
| 485 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
| 486 | |
| 487 | result = layerSupportObject->IsMaximumSupported(OverrideDataType(input0, dataType), |
| 488 | OverrideDataType(input1, dataType), |
| 489 | OverrideDataType(output, dataType), |
| 490 | reason); |
| 491 | break; |
| 492 | } |
narpra01 | b89b05f | 2019-01-16 09:53:09 +0000 | [diff] [blame] | 493 | case LayerType::MemCopy: |
| 494 | { |
| 495 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 496 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 497 | |
narpra01 | b89b05f | 2019-01-16 09:53:09 +0000 | [diff] [blame] | 498 | result = layerSupportObject->IsMemCopySupported(OverrideDataType(input, dataType), |
| 499 | OverrideDataType(output, dataType), |
| 500 | reason); |
| 501 | break; |
| 502 | } |
Nattapat Chaimanowong | 1f88630 | 2019-04-05 13:37:19 +0100 | [diff] [blame] | 503 | case LayerType::Merge: |
| 504 | { |
| 505 | const TensorInfo& input0 = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 506 | const TensorInfo& input1 = layer.GetInputSlot(1).GetConnection()->GetTensorInfo(); |
| 507 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
| 508 | |
| 509 | result = layerSupportObject->IsMergeSupported(OverrideDataType(input0, dataType), |
| 510 | OverrideDataType(input1, dataType), |
| 511 | OverrideDataType(output, dataType), |
| 512 | reason); |
| 513 | break; |
| 514 | } |
Jim Flynn | e242f2d | 2019-05-22 14:24:13 +0100 | [diff] [blame] | 515 | case LayerType::Concat: |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 516 | { |
Jim Flynn | e242f2d | 2019-05-22 14:24:13 +0100 | [diff] [blame] | 517 | auto cLayer = boost::polymorphic_downcast<const ConcatLayer*>(&layer); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 518 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 519 | // Get vector of all inputs. |
| 520 | auto getTensorInfo = [&dataType](const InputSlot& slot) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 521 | { |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 522 | return OverrideDataType(slot.GetConnectedOutputSlot()->GetTensorInfo(), dataType); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 523 | }; |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 524 | auto beginI = boost::make_transform_iterator(layer.GetInputSlots().begin(), getTensorInfo); |
| 525 | auto endI = boost::make_transform_iterator(layer.GetInputSlots().end(), getTensorInfo); |
| 526 | std::vector<TensorInfo> inputs(beginI, endI); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 527 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 528 | auto getTensorInfoPtr = [](const TensorInfo& info) |
| 529 | { |
| 530 | return &info; |
| 531 | }; |
| 532 | auto beginPtr = boost::make_transform_iterator(inputs.begin(), getTensorInfoPtr); |
| 533 | auto endPtr = boost::make_transform_iterator(inputs.end(), getTensorInfoPtr); |
| 534 | std::vector<const TensorInfo*> inputPtrs(beginPtr, endPtr); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 535 | |
Nikhil Raj | 8599a41 | 2018-11-19 14:51:07 +0000 | [diff] [blame] | 536 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
| 537 | |
Jim Flynn | e242f2d | 2019-05-22 14:24:13 +0100 | [diff] [blame] | 538 | result = layerSupportObject->IsConcatSupported(inputPtrs, output, cLayer->GetParameters(), reason); |
| 539 | |
| 540 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 541 | break; |
| 542 | } |
| 543 | case LayerType::Multiplication: |
| 544 | { |
| 545 | const TensorInfo& input0 = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 546 | const TensorInfo& input1 = layer.GetInputSlot(1).GetConnection()->GetTensorInfo(); |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 547 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 548 | result = layerSupportObject->IsMultiplicationSupported( |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 549 | OverrideDataType(input0, dataType), |
| 550 | OverrideDataType(input1, dataType), |
| 551 | OverrideDataType(output, dataType), |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 552 | reason); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 553 | break; |
| 554 | } |
| 555 | case LayerType::Normalization: |
| 556 | { |
| 557 | auto cLayer = boost::polymorphic_downcast<const NormalizationLayer*>(&layer); |
| 558 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 559 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 560 | result = layerSupportObject->IsNormalizationSupported(OverrideDataType(input, dataType), |
| 561 | OverrideDataType(output, dataType), |
| 562 | cLayer->GetParameters(), |
| 563 | reason); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 564 | break; |
| 565 | } |
| 566 | case LayerType::Output: |
| 567 | { |
| 568 | const TensorInfo& output = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 569 | result = layerSupportObject->IsOutputSupported(OverrideDataType(output, dataType), reason); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 570 | break; |
| 571 | } |
| 572 | case LayerType::Permute: |
| 573 | { |
| 574 | auto cLayer = boost::polymorphic_downcast<const PermuteLayer*>(&layer); |
| 575 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 576 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 577 | result = layerSupportObject->IsPermuteSupported(OverrideDataType(input, dataType), |
| 578 | OverrideDataType(output, dataType), |
| 579 | cLayer->GetParameters(), |
| 580 | reason); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 581 | break; |
| 582 | } |
Mohamed Nour Abouelseoud | 5662c20 | 2018-09-24 13:30:09 +0100 | [diff] [blame] | 583 | case LayerType::Pad: |
| 584 | { |
| 585 | auto cLayer = boost::polymorphic_downcast<const PadLayer*>(&layer); |
| 586 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 587 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 588 | result = layerSupportObject->IsPadSupported( |
Mohamed Nour Abouelseoud | 5662c20 | 2018-09-24 13:30:09 +0100 | [diff] [blame] | 589 | OverrideDataType(input, dataType), |
| 590 | OverrideDataType(output, dataType), |
| 591 | cLayer->GetParameters(), |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 592 | reason); |
Mohamed Nour Abouelseoud | 5662c20 | 2018-09-24 13:30:09 +0100 | [diff] [blame] | 593 | break; |
| 594 | } |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 595 | case LayerType::Pooling2d: |
| 596 | { |
| 597 | auto cLayer = boost::polymorphic_downcast<const Pooling2dLayer*>(&layer); |
| 598 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 599 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 600 | result = layerSupportObject->IsPooling2dSupported(OverrideDataType(input, dataType), |
| 601 | OverrideDataType(output, dataType), |
| 602 | cLayer->GetParameters(), |
| 603 | reason); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 604 | break; |
| 605 | } |
Matteo Martincigh | 4912402 | 2019-01-11 13:25:59 +0000 | [diff] [blame] | 606 | case LayerType::PreCompiled: |
| 607 | { |
| 608 | auto cLayer = boost::polymorphic_downcast<const PreCompiledLayer*>(&layer); |
| 609 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 610 | result = layerSupportObject->IsPreCompiledSupported(OverrideDataType(input, dataType), |
| 611 | cLayer->GetParameters(), |
| 612 | reason); |
| 613 | break; |
| 614 | } |
Derek Lamberti | a9cca6a | 2019-03-25 15:41:58 +0000 | [diff] [blame] | 615 | case LayerType::Quantize: |
| 616 | { |
| 617 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 618 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
| 619 | result = layerSupportObject->IsQuantizeSupported(input, output, reason); |
| 620 | break; |
| 621 | } |
Francis Murtagh | e7a86a4 | 2018-08-29 12:42:10 +0100 | [diff] [blame] | 622 | case LayerType::Division: |
| 623 | { |
| 624 | const TensorInfo& input0 = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 625 | const TensorInfo& input1 = layer.GetInputSlot(1).GetConnection()->GetTensorInfo(); |
| 626 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 627 | result = layerSupportObject->IsDivisionSupported( |
Francis Murtagh | e7a86a4 | 2018-08-29 12:42:10 +0100 | [diff] [blame] | 628 | OverrideDataType(input0, dataType), |
| 629 | OverrideDataType(input1, dataType), |
| 630 | OverrideDataType(output, dataType), |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 631 | reason); |
Francis Murtagh | e7a86a4 | 2018-08-29 12:42:10 +0100 | [diff] [blame] | 632 | break; |
| 633 | } |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 634 | case LayerType::Reshape: |
| 635 | { |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 636 | auto cLayer = boost::polymorphic_downcast<const ReshapeLayer*>(&layer); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 637 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 638 | result = layerSupportObject->IsReshapeSupported(OverrideDataType(input, dataType), |
| 639 | cLayer->GetParameters(), |
| 640 | reason); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 641 | break; |
| 642 | } |
| 643 | case LayerType::ResizeBilinear: |
| 644 | { |
| 645 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
Sadik Armagan | c625f00 | 2018-12-17 11:32:16 +0000 | [diff] [blame] | 646 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
| 647 | result = layerSupportObject->IsResizeBilinearSupported(OverrideDataType(input, dataType), |
| 648 | OverrideDataType(output, dataType), |
| 649 | reason); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 650 | break; |
| 651 | } |
Mohamed Nour Abouelseoud | a1d3c6a | 2018-12-27 12:39:16 +0000 | [diff] [blame] | 652 | case LayerType::Rsqrt: |
| 653 | { |
| 654 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 655 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
| 656 | result = layerSupportObject->IsRsqrtSupported(OverrideDataType(input, dataType), |
| 657 | OverrideDataType(output, dataType), |
| 658 | reason); |
| 659 | break; |
| 660 | } |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 661 | case LayerType::Softmax: |
| 662 | { |
| 663 | auto cLayer = boost::polymorphic_downcast<const SoftmaxLayer*>(&layer); |
| 664 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 665 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 666 | result = layerSupportObject->IsSoftmaxSupported(OverrideDataType(input, dataType), |
| 667 | OverrideDataType(output, dataType), |
| 668 | cLayer->GetParameters(), |
| 669 | reason); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 670 | break; |
| 671 | } |
Nattapat Chaimanowong | 207ef9a | 2018-11-02 10:57:25 +0000 | [diff] [blame] | 672 | case LayerType::SpaceToBatchNd: |
| 673 | { |
| 674 | auto cLayer = boost::polymorphic_downcast<const SpaceToBatchNdLayer*>(&layer); |
| 675 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 676 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
| 677 | result = layerSupportObject->IsSpaceToBatchNdSupported(OverrideDataType(input, dataType), |
| 678 | OverrideDataType(output, dataType), |
| 679 | cLayer->GetParameters(), |
| 680 | reason); |
| 681 | break; |
| 682 | } |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 683 | case LayerType::Splitter: |
| 684 | { |
| 685 | auto cLayer = boost::polymorphic_downcast<const SplitterLayer*>(&layer); |
| 686 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
Narumol Prangnawarat | 15eb583 | 2019-05-20 15:31:05 +0100 | [diff] [blame] | 687 | |
| 688 | // Get vector of all outputs. |
| 689 | auto getTensorInfo = [&dataType](const OutputSlot& slot) |
| 690 | { |
| 691 | return OverrideDataType(slot.GetTensorInfo(), dataType); |
| 692 | }; |
| 693 | auto beginI = boost::make_transform_iterator(layer.GetOutputSlots().begin(), getTensorInfo); |
| 694 | auto endI = boost::make_transform_iterator(layer.GetOutputSlots().end(), getTensorInfo); |
| 695 | std::vector<TensorInfo> outputs(beginI, endI); |
| 696 | |
| 697 | const std::vector<std::reference_wrapper<TensorInfo>> outputPtrs(outputs.begin(), outputs.end()); |
| 698 | |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 699 | result = layerSupportObject->IsSplitterSupported(OverrideDataType(input, dataType), |
Narumol Prangnawarat | 15eb583 | 2019-05-20 15:31:05 +0100 | [diff] [blame] | 700 | outputPtrs, |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 701 | cLayer->GetParameters(), |
| 702 | reason); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 703 | break; |
| 704 | } |
Conor Kennedy | 430b5d8 | 2018-11-14 15:28:28 +0000 | [diff] [blame] | 705 | case LayerType::StridedSlice: |
| 706 | { |
| 707 | auto cLayer = boost::polymorphic_downcast<const StridedSliceLayer*>(&layer); |
| 708 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 709 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
| 710 | result = layerSupportObject->IsStridedSliceSupported(OverrideDataType(input, dataType), |
| 711 | OverrideDataType(output, dataType), |
| 712 | cLayer->GetParameters(), |
| 713 | reason); |
| 714 | break; |
| 715 | } |
David Beck | c2044fe | 2018-09-05 15:00:38 +0100 | [diff] [blame] | 716 | case LayerType::Subtraction: |
| 717 | { |
| 718 | const TensorInfo& input0 = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 719 | const TensorInfo& input1 = layer.GetInputSlot(1).GetConnection()->GetTensorInfo(); |
| 720 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 721 | result = layerSupportObject->IsSubtractionSupported( |
David Beck | c2044fe | 2018-09-05 15:00:38 +0100 | [diff] [blame] | 722 | OverrideDataType(input0, dataType), |
| 723 | OverrideDataType(input1, dataType), |
| 724 | OverrideDataType(output, dataType), |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 725 | reason); |
David Beck | c2044fe | 2018-09-05 15:00:38 +0100 | [diff] [blame] | 726 | break; |
| 727 | } |
Sadik Armagan | eff363d | 2019-04-05 15:25:46 +0100 | [diff] [blame] | 728 | case LayerType::Switch: |
| 729 | { |
| 730 | const TensorInfo& input0 = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 731 | const TensorInfo& input1 = layer.GetInputSlot(1).GetConnection()->GetTensorInfo(); |
| 732 | const TensorInfo& output0 = layer.GetOutputSlot(0).GetTensorInfo(); |
| 733 | const TensorInfo& output1 = layer.GetOutputSlot(1).GetTensorInfo(); |
| 734 | result = layerSupportObject->IsSwitchSupported(OverrideDataType(input0, dataType), |
| 735 | OverrideDataType(input1, dataType), |
| 736 | OverrideDataType(output0, dataType), |
| 737 | OverrideDataType(output1, dataType), |
| 738 | reason); |
| 739 | break; |
| 740 | } |
narpra01 | 32b9046 | 2018-09-13 11:07:48 +0100 | [diff] [blame] | 741 | case LayerType::Mean: |
| 742 | { |
| 743 | auto cLayer = boost::polymorphic_downcast<const MeanLayer*>(&layer); |
| 744 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 745 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 746 | result = layerSupportObject->IsMeanSupported( |
narpra01 | 32b9046 | 2018-09-13 11:07:48 +0100 | [diff] [blame] | 747 | OverrideDataType(input, dataType), |
| 748 | OverrideDataType(output, dataType), |
| 749 | cLayer->GetParameters(), |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 750 | reason); |
narpra01 | 32b9046 | 2018-09-13 11:07:48 +0100 | [diff] [blame] | 751 | break; |
| 752 | } |
kevmay01 | 9053969 | 2018-11-29 08:40:19 +0000 | [diff] [blame] | 753 | case LayerType::Minimum: |
| 754 | { |
| 755 | const TensorInfo& input0 = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 756 | const TensorInfo& input1 = layer.GetInputSlot(1).GetConnection()->GetTensorInfo(); |
| 757 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
| 758 | result = layerSupportObject->IsMinimumSupported(OverrideDataType(input0, dataType), |
| 759 | OverrideDataType(input1, dataType), |
| 760 | OverrideDataType(output, dataType), |
| 761 | reason); |
| 762 | break; |
| 763 | } |
Matteo Martincigh | 59a950c | 2018-12-13 12:48:25 +0000 | [diff] [blame] | 764 | case LayerType::Greater: |
| 765 | { |
| 766 | const TensorInfo& input0 = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 767 | const TensorInfo& input1 = layer.GetInputSlot(1).GetConnection()->GetTensorInfo(); |
| 768 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
Nattapat Chaimanowong | c6a41ff | 2019-01-29 09:56:02 +0000 | [diff] [blame] | 769 | result = layerSupportObject->IsGreaterSupported(OverrideDataType(input0, dataType), |
| 770 | OverrideDataType(input1, dataType), |
| 771 | OverrideDataType(output, DataType::Boolean), |
| 772 | reason); |
Matteo Martincigh | 59a950c | 2018-12-13 12:48:25 +0000 | [diff] [blame] | 773 | break; |
| 774 | } |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 775 | default: |
| 776 | { |
| 777 | BOOST_ASSERT_MSG(false, "WorkloadFactory did not recognise type of layer."); |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 778 | reason.value() = "Unrecognised layer type"; |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 779 | result = false; |
| 780 | break; |
| 781 | } |
| 782 | } |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 783 | return result; |
| 784 | } |
| 785 | |
David Beck | dcb751f | 2018-10-03 11:42:42 +0100 | [diff] [blame] | 786 | bool IWorkloadFactory::IsLayerSupported(const IConnectableLayer& connectableLayer, |
David Beck | 29c75de | 2018-10-23 13:35:58 +0100 | [diff] [blame] | 787 | Optional<DataType> dataType, |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 788 | std::string& outReasonIfUnsupported) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 789 | { |
David Beck | dcb751f | 2018-10-03 11:42:42 +0100 | [diff] [blame] | 790 | auto layer = boost::polymorphic_downcast<const Layer*>(&connectableLayer); |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 791 | return IsLayerSupported(layer->GetBackendId(), connectableLayer, dataType, outReasonIfUnsupported); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 792 | } |
| 793 | |
Derek Lamberti | a9cca6a | 2019-03-25 15:41:58 +0000 | [diff] [blame] | 794 | // Default Implementations |
| 795 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateActivation(const ActivationQueueDescriptor& descriptor, |
| 796 | const WorkloadInfo& info) const |
| 797 | { |
| 798 | return std::unique_ptr<IWorkload>(); |
| 799 | } |
| 800 | |
| 801 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateAddition(const AdditionQueueDescriptor& descriptor, |
| 802 | const WorkloadInfo& info) const |
| 803 | { |
| 804 | return std::unique_ptr<IWorkload>(); |
| 805 | } |
| 806 | |
| 807 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateBatchNormalization( |
| 808 | const BatchNormalizationQueueDescriptor& descriptor, const WorkloadInfo& info) const |
| 809 | { |
| 810 | return std::unique_ptr<IWorkload>(); |
| 811 | } |
| 812 | |
| 813 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateBatchToSpaceNd(const BatchToSpaceNdQueueDescriptor& descriptor, |
| 814 | const WorkloadInfo& Info) const |
| 815 | { |
| 816 | return std::unique_ptr<IWorkload>(); |
| 817 | } |
| 818 | |
Jim Flynn | e242f2d | 2019-05-22 14:24:13 +0100 | [diff] [blame] | 819 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateConcat(const ConcatQueueDescriptor& descriptor, |
Jim Flynn | 4ed6c83 | 2019-05-20 11:02:46 +0100 | [diff] [blame] | 820 | const WorkloadInfo& info) const |
| 821 | { |
| 822 | return std::unique_ptr<IWorkload>(); |
| 823 | } |
| 824 | |
Derek Lamberti | a9cca6a | 2019-03-25 15:41:58 +0000 | [diff] [blame] | 825 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateConstant(const ConstantQueueDescriptor& descriptor, |
| 826 | const WorkloadInfo& info) const |
| 827 | { |
| 828 | return std::unique_ptr<IWorkload>(); |
| 829 | } |
| 830 | |
| 831 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateConvertFp16ToFp32(const ConvertFp16ToFp32QueueDescriptor& descriptor, |
| 832 | const WorkloadInfo& info) const |
| 833 | { |
| 834 | return std::unique_ptr<IWorkload>(); |
| 835 | } |
| 836 | |
| 837 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateConvertFp32ToFp16(const ConvertFp32ToFp16QueueDescriptor& descriptor, |
| 838 | const WorkloadInfo& info) const |
| 839 | { |
| 840 | return std::unique_ptr<IWorkload>(); |
| 841 | } |
| 842 | |
| 843 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateConvolution2d(const Convolution2dQueueDescriptor& descriptor, |
| 844 | const WorkloadInfo& info) const |
| 845 | { |
| 846 | return std::unique_ptr<IWorkload>(); |
| 847 | } |
| 848 | |
| 849 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateDebug(const DebugQueueDescriptor& descriptor, |
| 850 | const WorkloadInfo& info) const |
| 851 | { |
| 852 | return std::unique_ptr<IWorkload>(); |
| 853 | } |
| 854 | |
| 855 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateDepthwiseConvolution2d( |
| 856 | const DepthwiseConvolution2dQueueDescriptor& descriptor, const WorkloadInfo& info) const |
| 857 | { |
| 858 | return std::unique_ptr<IWorkload>(); |
| 859 | } |
| 860 | |
Nattapat Chaimanowong | e4294fd | 2019-03-28 09:56:53 +0000 | [diff] [blame] | 861 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateDequantize( |
| 862 | const DequantizeQueueDescriptor& descriptor, const WorkloadInfo& info) const |
| 863 | { |
| 864 | return std::unique_ptr<IWorkload>(); |
| 865 | } |
| 866 | |
Derek Lamberti | a9cca6a | 2019-03-25 15:41:58 +0000 | [diff] [blame] | 867 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateDetectionPostProcess( |
| 868 | const DetectionPostProcessQueueDescriptor& descriptor, const WorkloadInfo& info) const |
| 869 | { |
| 870 | return std::unique_ptr<IWorkload>(); |
| 871 | } |
| 872 | |
| 873 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateDivision(const DivisionQueueDescriptor& descriptor, |
| 874 | const WorkloadInfo& info) const |
| 875 | { |
| 876 | return std::unique_ptr<IWorkload>(); |
| 877 | } |
| 878 | |
| 879 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateEqual(const EqualQueueDescriptor& descriptor, |
| 880 | const WorkloadInfo& Info) const |
| 881 | { |
| 882 | return std::unique_ptr<IWorkload>(); |
| 883 | } |
| 884 | |
| 885 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateFakeQuantization(const FakeQuantizationQueueDescriptor& descriptor, |
| 886 | const WorkloadInfo& info) const |
| 887 | { |
| 888 | return std::unique_ptr<IWorkload>(); |
| 889 | } |
| 890 | |
| 891 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateFloor(const FloorQueueDescriptor& descriptor, |
| 892 | const WorkloadInfo& info) const |
| 893 | { |
| 894 | return std::unique_ptr<IWorkload>(); |
| 895 | } |
| 896 | |
| 897 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateFullyConnected(const FullyConnectedQueueDescriptor& descriptor, |
| 898 | const WorkloadInfo& info) const |
| 899 | { |
| 900 | return std::unique_ptr<IWorkload>(); |
| 901 | } |
| 902 | |
| 903 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateGather(const GatherQueueDescriptor& descriptor, |
| 904 | const WorkloadInfo& info) const |
| 905 | { |
| 906 | return std::unique_ptr<IWorkload>(); |
| 907 | } |
| 908 | |
| 909 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateGreater(const GreaterQueueDescriptor& descriptor, |
| 910 | const WorkloadInfo& info) const |
| 911 | { |
| 912 | return std::unique_ptr<IWorkload>(); |
| 913 | } |
| 914 | |
| 915 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateL2Normalization(const L2NormalizationQueueDescriptor& descriptor, |
| 916 | const WorkloadInfo& info) const |
| 917 | { |
| 918 | return std::unique_ptr<IWorkload>(); |
| 919 | } |
| 920 | |
| 921 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateLstm(const LstmQueueDescriptor& descriptor, |
| 922 | const WorkloadInfo& info) const |
| 923 | { |
| 924 | return std::unique_ptr<IWorkload>(); |
| 925 | } |
| 926 | |
| 927 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateMaximum(const MaximumQueueDescriptor& descriptor, |
| 928 | const WorkloadInfo& info) const |
| 929 | { |
| 930 | return std::unique_ptr<IWorkload>(); |
| 931 | } |
| 932 | |
| 933 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateMean(const MeanQueueDescriptor& descriptor, |
| 934 | const WorkloadInfo& Info) const |
| 935 | { |
| 936 | return std::unique_ptr<IWorkload>(); |
| 937 | } |
| 938 | |
| 939 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateMemCopy(const MemCopyQueueDescriptor& descriptor, |
| 940 | const WorkloadInfo& info) const |
| 941 | { |
| 942 | return std::unique_ptr<IWorkload>(); |
| 943 | } |
| 944 | |
Nattapat Chaimanowong | 1f88630 | 2019-04-05 13:37:19 +0100 | [diff] [blame] | 945 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateMerge(const MergeQueueDescriptor& descriptor, |
| 946 | const WorkloadInfo& info) const |
| 947 | { |
| 948 | return std::unique_ptr<IWorkload>(); |
| 949 | } |
| 950 | |
Derek Lamberti | a9cca6a | 2019-03-25 15:41:58 +0000 | [diff] [blame] | 951 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateMerger(const MergerQueueDescriptor& descriptor, |
| 952 | const WorkloadInfo& info) const |
| 953 | { |
| 954 | return std::unique_ptr<IWorkload>(); |
| 955 | } |
| 956 | |
| 957 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateMinimum(const MinimumQueueDescriptor& descriptor, |
| 958 | const WorkloadInfo& info) const |
| 959 | { |
| 960 | return std::unique_ptr<IWorkload>(); |
| 961 | } |
| 962 | |
| 963 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateMultiplication(const MultiplicationQueueDescriptor& descriptor, |
| 964 | const WorkloadInfo& info) const |
| 965 | { |
| 966 | return std::unique_ptr<IWorkload>(); |
| 967 | } |
| 968 | |
| 969 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateNormalization(const NormalizationQueueDescriptor& descriptor, |
| 970 | const WorkloadInfo& info) const |
| 971 | { |
| 972 | return std::unique_ptr<IWorkload>(); |
| 973 | } |
| 974 | |
| 975 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateOutput(const OutputQueueDescriptor& descriptor, |
| 976 | const WorkloadInfo& info) const |
| 977 | { |
| 978 | return std::unique_ptr<IWorkload>(); |
| 979 | } |
| 980 | |
| 981 | std::unique_ptr<IWorkload> IWorkloadFactory::CreatePad(const PadQueueDescriptor& descriptor, |
| 982 | const WorkloadInfo& Info) const |
| 983 | { |
| 984 | return std::unique_ptr<IWorkload>(); |
| 985 | } |
| 986 | |
| 987 | std::unique_ptr<IWorkload> IWorkloadFactory::CreatePermute(const PermuteQueueDescriptor& descriptor, |
| 988 | const WorkloadInfo& info) const |
| 989 | { |
| 990 | return std::unique_ptr<IWorkload>(); |
| 991 | } |
| 992 | |
| 993 | std::unique_ptr<IWorkload> IWorkloadFactory::CreatePooling2d(const Pooling2dQueueDescriptor& descriptor, |
| 994 | const WorkloadInfo& info) const |
| 995 | { |
| 996 | return std::unique_ptr<IWorkload>(); |
| 997 | } |
| 998 | |
| 999 | std::unique_ptr<IWorkload> IWorkloadFactory::CreatePreCompiled(const PreCompiledQueueDescriptor& descriptor, |
| 1000 | const WorkloadInfo& info) const |
| 1001 | { |
| 1002 | return std::unique_ptr<IWorkload>(); |
| 1003 | } |
| 1004 | |
| 1005 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateQuantize(const QuantizeQueueDescriptor& descriptor, |
| 1006 | const WorkloadInfo& Info) const |
| 1007 | { |
| 1008 | return std::unique_ptr<IWorkload>(); |
| 1009 | } |
| 1010 | |
| 1011 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateReshape(const ReshapeQueueDescriptor& descriptor, |
| 1012 | const WorkloadInfo& info) const |
| 1013 | { |
| 1014 | return std::unique_ptr<IWorkload>(); |
| 1015 | } |
| 1016 | |
| 1017 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateResizeBilinear(const ResizeBilinearQueueDescriptor& descriptor, |
| 1018 | const WorkloadInfo& info) const |
| 1019 | { |
| 1020 | return std::unique_ptr<IWorkload>(); |
| 1021 | } |
| 1022 | |
| 1023 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateRsqrt(const RsqrtQueueDescriptor& descriptor, |
| 1024 | const WorkloadInfo& info) const |
| 1025 | { |
| 1026 | return std::unique_ptr<IWorkload>(); |
| 1027 | } |
| 1028 | |
| 1029 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateSoftmax(const SoftmaxQueueDescriptor& descriptor, |
| 1030 | const WorkloadInfo& info) const |
| 1031 | { |
| 1032 | return std::unique_ptr<IWorkload>(); |
| 1033 | } |
| 1034 | |
| 1035 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateSplitter(const SplitterQueueDescriptor& descriptor, |
| 1036 | const WorkloadInfo& info) const |
| 1037 | { |
| 1038 | return std::unique_ptr<IWorkload>(); |
| 1039 | } |
| 1040 | |
| 1041 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateSpaceToBatchNd(const SpaceToBatchNdQueueDescriptor& descriptor, |
| 1042 | const WorkloadInfo& info) const |
| 1043 | { |
| 1044 | return std::unique_ptr<IWorkload>(); |
| 1045 | } |
| 1046 | |
| 1047 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateStridedSlice(const StridedSliceQueueDescriptor& descriptor, |
| 1048 | const WorkloadInfo& Info) const |
| 1049 | { |
| 1050 | return std::unique_ptr<IWorkload>(); |
| 1051 | } |
| 1052 | |
| 1053 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateSubtraction(const SubtractionQueueDescriptor& descriptor, |
| 1054 | const WorkloadInfo& info) const |
| 1055 | { |
| 1056 | return std::unique_ptr<IWorkload>(); |
| 1057 | } |
| 1058 | |
Sadik Armagan | eff363d | 2019-04-05 15:25:46 +0100 | [diff] [blame] | 1059 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateSwitch(const SwitchQueueDescriptor& descriptor, |
| 1060 | const WorkloadInfo& info) const |
| 1061 | { |
| 1062 | return std::unique_ptr<IWorkload>(); |
| 1063 | } |
| 1064 | |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 1065 | } |