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 | #include <Layer.hpp> |
| 10 | #include <LayersFwd.hpp> |
David Beck | dcb751f | 2018-10-03 11:42:42 +0100 | [diff] [blame] | 11 | |
David Beck | b4540be | 2018-09-24 13:18:27 +0100 | [diff] [blame] | 12 | #include <armnn/Types.hpp> |
| 13 | #include <armnn/LayerSupport.hpp> |
David Beck | 111b5d9 | 2018-11-12 14:59:37 +0000 | [diff] [blame] | 14 | #include <armnn/ILayerSupport.hpp> |
Matteo Martincigh | c601aa6 | 2019-10-29 15:03:22 +0000 | [diff] [blame] | 15 | #include <armnn/BackendRegistry.hpp> |
Aron Virginas-Tar | c9cc804 | 2018-11-01 16:15:57 +0000 | [diff] [blame] | 16 | |
Aron Virginas-Tar | c9cc804 | 2018-11-01 16:15:57 +0000 | [diff] [blame] | 17 | #include <backendsCommon/WorkloadFactory.hpp> |
David Beck | 111b5d9 | 2018-11-12 14:59:37 +0000 | [diff] [blame] | 18 | #include <backendsCommon/IBackendInternal.hpp> |
Francis Murtagh | 46c09d0 | 2019-05-28 08:15:28 +0100 | [diff] [blame] | 19 | #include <backendsCommon/test/WorkloadTestUtils.hpp> |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 20 | |
| 21 | #include <boost/cast.hpp> |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 22 | #include <boost/iterator/transform_iterator.hpp> |
| 23 | |
Aron Virginas-Tar | c9cc804 | 2018-11-01 16:15:57 +0000 | [diff] [blame] | 24 | #include <cstring> |
David Beck | 111b5d9 | 2018-11-12 14:59:37 +0000 | [diff] [blame] | 25 | #include <sstream> |
Aron Virginas-Tar | c9cc804 | 2018-11-01 16:15:57 +0000 | [diff] [blame] | 26 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 27 | namespace armnn |
| 28 | { |
| 29 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 30 | namespace |
| 31 | { |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 32 | |
David Beck | 29c75de | 2018-10-23 13:35:58 +0100 | [diff] [blame] | 33 | const TensorInfo OverrideDataType(const TensorInfo& info, Optional<DataType> type) |
| 34 | { |
| 35 | if (!type) |
| 36 | { |
| 37 | return info; |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 38 | } |
| 39 | |
David Beck | 29c75de | 2018-10-23 13:35:58 +0100 | [diff] [blame] | 40 | return TensorInfo(info.GetShape(), type.value(), info.GetQuantizationScale(), info.GetQuantizationOffset()); |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 41 | } |
| 42 | |
David Beck | 29c75de | 2018-10-23 13:35:58 +0100 | [diff] [blame] | 43 | } // anonymous namespace |
| 44 | |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 45 | bool IWorkloadFactory::IsLayerSupported(const BackendId& backendId, |
David Beck | dcb751f | 2018-10-03 11:42:42 +0100 | [diff] [blame] | 46 | const IConnectableLayer& connectableLayer, |
David Beck | 29c75de | 2018-10-23 13:35:58 +0100 | [diff] [blame] | 47 | Optional<DataType> dataType, |
David Beck | dcb751f | 2018-10-03 11:42:42 +0100 | [diff] [blame] | 48 | std::string& outReasonIfUnsupported) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 49 | { |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 50 | Optional<std::string&> reason = outReasonIfUnsupported; |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 51 | bool result; |
David Beck | dcb751f | 2018-10-03 11:42:42 +0100 | [diff] [blame] | 52 | const Layer& layer = *(boost::polymorphic_downcast<const Layer*>(&connectableLayer)); |
| 53 | |
David Beck | 111b5d9 | 2018-11-12 14:59:37 +0000 | [diff] [blame] | 54 | auto const& backendRegistry = BackendRegistryInstance(); |
| 55 | if (!backendRegistry.IsBackendRegistered(backendId)) |
| 56 | { |
| 57 | std::stringstream ss; |
| 58 | ss << connectableLayer.GetName() << " is not supported on " << backendId |
| 59 | << " because this backend is not registered."; |
| 60 | |
| 61 | outReasonIfUnsupported = ss.str(); |
| 62 | return false; |
| 63 | } |
| 64 | |
| 65 | auto backendFactory = backendRegistry.GetFactory(backendId); |
| 66 | auto backendObject = backendFactory(); |
| 67 | auto layerSupportObject = backendObject->GetLayerSupport(); |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 68 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 69 | switch(layer.GetType()) |
| 70 | { |
Kevin May | 868eb14 | 2019-09-04 17:29:31 +0100 | [diff] [blame] | 71 | case LayerType::Abs: |
| 72 | { |
| 73 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 74 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
| 75 | result = layerSupportObject->IsAbsSupported(OverrideDataType(input, dataType), |
| 76 | OverrideDataType(output, dataType), |
| 77 | reason); |
| 78 | break; |
| 79 | } |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 80 | case LayerType::Activation: |
| 81 | { |
| 82 | auto cLayer = boost::polymorphic_downcast<const ActivationLayer*>(&layer); |
| 83 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 84 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 85 | result = layerSupportObject->IsActivationSupported( |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 86 | OverrideDataType(input, dataType), |
| 87 | OverrideDataType(output, dataType), |
| 88 | cLayer->GetParameters(), |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 89 | reason); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 90 | break; |
| 91 | } |
| 92 | case LayerType::Addition: |
| 93 | { |
| 94 | const TensorInfo& input0 = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 95 | const TensorInfo& input1 = layer.GetInputSlot(1).GetConnection()->GetTensorInfo(); |
| 96 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 97 | result = layerSupportObject->IsAdditionSupported( |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 98 | OverrideDataType(input0, dataType), |
| 99 | OverrideDataType(input1, dataType), |
| 100 | OverrideDataType(output, dataType), |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 101 | reason); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 102 | break; |
| 103 | } |
Nikhil Raj | ee391d5 | 2019-09-05 17:50:44 +0100 | [diff] [blame] | 104 | case LayerType::ArgMinMax: |
| 105 | { |
| 106 | auto cLayer = boost::polymorphic_downcast<const ArgMinMaxLayer*>(&layer); |
| 107 | const ArgMinMaxDescriptor& descriptor = cLayer->GetParameters(); |
| 108 | |
| 109 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 110 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
| 111 | result = layerSupportObject->IsArgMinMaxSupported( |
| 112 | OverrideDataType(input, dataType), |
Narumol Prangnawarat | d1f5773 | 2019-10-31 14:24:02 +0000 | [diff] [blame] | 113 | OverrideDataType(output, DataType::Signed32), |
Nikhil Raj | ee391d5 | 2019-09-05 17:50:44 +0100 | [diff] [blame] | 114 | descriptor, |
| 115 | reason); |
| 116 | break; |
| 117 | } |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 118 | case LayerType::BatchNormalization: |
| 119 | { |
| 120 | auto cLayer = boost::polymorphic_downcast<const BatchNormalizationLayer*>(&layer); |
| 121 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 122 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
| 123 | const TensorInfo& mean = cLayer->m_Mean->GetTensorInfo(); |
| 124 | const TensorInfo& var = cLayer->m_Variance->GetTensorInfo(); |
| 125 | const TensorInfo& beta = cLayer->m_Beta->GetTensorInfo(); |
| 126 | const TensorInfo& gamma = cLayer->m_Gamma->GetTensorInfo(); |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 127 | result = layerSupportObject->IsBatchNormalizationSupported( |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 128 | OverrideDataType(input, dataType), |
| 129 | OverrideDataType(output, dataType), |
| 130 | OverrideDataType(mean, dataType), |
| 131 | OverrideDataType(var, dataType), |
| 132 | OverrideDataType(beta, dataType), |
| 133 | OverrideDataType(gamma, dataType), |
| 134 | cLayer->GetParameters(), |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 135 | reason); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 136 | break; |
| 137 | } |
Éanna Ó Catháin | 4e1e136 | 2018-11-12 11:36:34 +0000 | [diff] [blame] | 138 | case LayerType::BatchToSpaceNd: |
| 139 | { |
| 140 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 141 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
| 142 | auto cLayer = boost::polymorphic_downcast<const BatchToSpaceNdLayer*>(&layer); |
| 143 | |
| 144 | result = layerSupportObject->IsBatchToSpaceNdSupported(OverrideDataType(input, dataType), |
| 145 | OverrideDataType(output, dataType), |
| 146 | cLayer->GetParameters(), |
| 147 | reason); |
| 148 | break; |
| 149 | } |
Aron Virginas-Tar | 77bfb5e | 2019-10-16 17:45:38 +0100 | [diff] [blame] | 150 | case LayerType::Comparison: |
| 151 | { |
| 152 | auto cLayer = boost::polymorphic_downcast<const ComparisonLayer*>(&layer); |
| 153 | |
| 154 | const TensorInfo& input0 = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 155 | const TensorInfo& input1 = layer.GetInputSlot(1).GetConnection()->GetTensorInfo(); |
| 156 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
| 157 | |
| 158 | result = layerSupportObject->IsComparisonSupported(OverrideDataType(input0, dataType), |
| 159 | OverrideDataType(input1, dataType), |
| 160 | OverrideDataType(output, DataType::Boolean), |
| 161 | cLayer->GetParameters(), |
| 162 | reason); |
| 163 | break; |
| 164 | } |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 165 | case LayerType::Constant: |
| 166 | { |
| 167 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 168 | result = layerSupportObject->IsConstantSupported(OverrideDataType(output, dataType), reason); |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 169 | break; |
| 170 | } |
| 171 | case LayerType::ConvertFp16ToFp32: |
| 172 | { |
| 173 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 174 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 175 | result = layerSupportObject->IsConvertFp16ToFp32Supported(input, output, reason); |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 176 | break; |
| 177 | } |
| 178 | case LayerType::ConvertFp32ToFp16: |
| 179 | { |
| 180 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 181 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 182 | result = layerSupportObject->IsConvertFp32ToFp16Supported(input, output, reason); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 183 | break; |
| 184 | } |
| 185 | case LayerType::Convolution2d: |
| 186 | { |
| 187 | auto cLayer = boost::polymorphic_downcast<const Convolution2dLayer*>(&layer); |
arovir01 | a682410 | 2018-08-28 17:40:45 +0100 | [diff] [blame] | 188 | |
| 189 | const TensorInfo input = OverrideDataType(layer.GetInputSlot(0).GetConnection()->GetTensorInfo(), |
| 190 | dataType); |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 191 | const TensorInfo output = OverrideDataType(layer.GetOutputSlot(0).GetTensorInfo(), dataType); |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 192 | BOOST_ASSERT(cLayer->m_Weight.get() != nullptr); |
| 193 | |
arovir01 | a682410 | 2018-08-28 17:40:45 +0100 | [diff] [blame] | 194 | const Convolution2dDescriptor& descriptor = cLayer->GetParameters(); |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 195 | |
arovir01 | a682410 | 2018-08-28 17:40:45 +0100 | [diff] [blame] | 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; |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +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)); |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 202 | } |
| 203 | |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 204 | result = layerSupportObject->IsConvolution2dSupported( |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 205 | input, |
| 206 | output, |
| 207 | descriptor, |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 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 | a9a1cf1 | 2018-12-03 16:06:49 +0000 | [diff] [blame] | 213 | case LayerType::Debug: |
| 214 | { |
| 215 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 216 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
| 217 | |
| 218 | result = layerSupportObject->IsDebugSupported(OverrideDataType(input, dataType), |
| 219 | OverrideDataType(output, dataType), |
| 220 | reason); |
| 221 | break; |
| 222 | } |
Aron Virginas-Tar | dd6247f | 2019-09-19 14:31:17 +0100 | [diff] [blame] | 223 | case LayerType::DepthToSpace: |
| 224 | { |
| 225 | auto cLayer = boost::polymorphic_downcast<const DepthToSpaceLayer*>(&layer); |
| 226 | |
| 227 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 228 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
| 229 | |
| 230 | result = layerSupportObject->IsDepthToSpaceSupported(OverrideDataType(input, dataType), |
| 231 | OverrideDataType(output, dataType), |
| 232 | cLayer->GetParameters(), |
| 233 | reason); |
| 234 | break; |
| 235 | } |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 236 | case LayerType::DepthwiseConvolution2d: |
| 237 | { |
| 238 | auto cLayer = boost::polymorphic_downcast<const DepthwiseConvolution2dLayer*>(&layer); |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 239 | const TensorInfo& input = OverrideDataType(layer.GetInputSlot(0).GetConnection()->GetTensorInfo(), |
| 240 | dataType); |
| 241 | const TensorInfo& output = OverrideDataType(layer.GetOutputSlot(0).GetTensorInfo(), dataType); |
| 242 | BOOST_ASSERT(cLayer->m_Weight.get() != nullptr); |
| 243 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 244 | const DepthwiseConvolution2dDescriptor& descriptor = cLayer->GetParameters(); |
arovir01 | a682410 | 2018-08-28 17:40:45 +0100 | [diff] [blame] | 245 | |
| 246 | // Construct optional biases object based on the value of m_BiasEnabled |
David Beck | 5eec11d | 2018-10-04 15:43:17 +0100 | [diff] [blame] | 247 | Optional<TensorInfo> biases; |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 248 | if (descriptor.m_BiasEnabled) |
| 249 | { |
David Beck | 5eec11d | 2018-10-04 15:43:17 +0100 | [diff] [blame] | 250 | biases = |
| 251 | OverrideDataType(cLayer->m_Bias->GetTensorInfo(), GetBiasTypeFromWeightsType(dataType)); |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 252 | } |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 253 | |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 254 | result = layerSupportObject->IsDepthwiseConvolutionSupported( |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 255 | input, |
| 256 | output, |
| 257 | descriptor, |
| 258 | OverrideDataType(cLayer->m_Weight->GetTensorInfo(), dataType), |
arovir01 | a682410 | 2018-08-28 17:40:45 +0100 | [diff] [blame] | 259 | biases, |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 260 | reason); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 261 | break; |
| 262 | } |
Nattapat Chaimanowong | e4294fd | 2019-03-28 09:56:53 +0000 | [diff] [blame] | 263 | case LayerType::Dequantize: |
| 264 | { |
| 265 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 266 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
| 267 | |
| 268 | result = layerSupportObject->IsDequantizeSupported(OverrideDataType(input, dataType), |
Jan Eilers | f710793 | 2019-11-01 11:09:36 +0000 | [diff] [blame] | 269 | output, |
Nattapat Chaimanowong | e4294fd | 2019-03-28 09:56:53 +0000 | [diff] [blame] | 270 | reason); |
| 271 | break; |
| 272 | } |
Narumol Prangnawarat | 94dd5d8 | 2019-01-23 18:06:26 +0000 | [diff] [blame] | 273 | case LayerType::DetectionPostProcess: |
| 274 | { |
| 275 | const TensorInfo& input0 = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 276 | const TensorInfo& input1 = layer.GetInputSlot(1).GetConnection()->GetTensorInfo(); |
| 277 | auto cLayer = boost::polymorphic_downcast<const DetectionPostProcessLayer*>(&layer); |
| 278 | const DetectionPostProcessDescriptor& descriptor = cLayer->GetParameters(); |
| 279 | result = layerSupportObject->IsDetectionPostProcessSupported(input0, |
| 280 | input1, |
| 281 | descriptor, |
| 282 | reason); |
| 283 | break; |
| 284 | } |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 285 | case LayerType::FakeQuantization: |
| 286 | { |
| 287 | auto cLayer = boost::polymorphic_downcast<const FakeQuantizationLayer*>(&layer); |
| 288 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 289 | result = layerSupportObject->IsFakeQuantizationSupported(OverrideDataType(input, dataType), |
| 290 | cLayer->GetParameters(), |
| 291 | reason); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 292 | break; |
| 293 | } |
| 294 | case LayerType::Floor: |
| 295 | { |
| 296 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 297 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 298 | result = layerSupportObject->IsFloorSupported(OverrideDataType(input, dataType), |
| 299 | OverrideDataType(output, dataType), |
| 300 | reason); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 301 | break; |
| 302 | } |
| 303 | case LayerType::FullyConnected: |
| 304 | { |
| 305 | auto cLayer = boost::polymorphic_downcast<const FullyConnectedLayer*>(&layer); |
| 306 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 307 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
| 308 | BOOST_ASSERT(cLayer->m_Weight.get() != nullptr); |
| 309 | |
| 310 | TensorInfo biasInfo; |
| 311 | const TensorInfo * biasInfoPtr = nullptr; |
| 312 | static const TensorInfo dummyFloat16Bias(TensorShape({1,1,1,1}), DataType::Float16); |
| 313 | static const TensorInfo dummyFloat32Bias(TensorShape({1,1,1,1}), DataType::Float32); |
| 314 | static const TensorInfo dummyQA8Bias(TensorShape({1,1,1,1}), DataType::Signed32); |
| 315 | |
| 316 | const FullyConnectedDescriptor& descriptor = cLayer->GetParameters(); |
| 317 | if (descriptor.m_BiasEnabled) |
| 318 | { |
| 319 | BOOST_ASSERT(cLayer->m_Bias.get() != nullptr); |
| 320 | biasInfo = OverrideDataType(cLayer->m_Bias->GetTensorInfo(), GetBiasTypeFromWeightsType(dataType)); |
| 321 | biasInfoPtr = &biasInfo; |
| 322 | } |
| 323 | else |
| 324 | { |
| 325 | // If biases are not enabled pass a dummy tensorinfo for the validation |
| 326 | switch(input.GetDataType()) |
| 327 | { |
| 328 | case DataType::Float16: |
| 329 | { |
| 330 | biasInfoPtr = &dummyFloat16Bias; |
| 331 | break; |
| 332 | } |
| 333 | case DataType::Float32: |
| 334 | { |
| 335 | biasInfoPtr = &dummyFloat32Bias; |
| 336 | break; |
| 337 | } |
| 338 | case DataType::QuantisedAsymm8: |
Narumol Prangnawarat | f9ac3fd | 2019-07-03 14:55:57 +0100 | [diff] [blame] | 339 | case DataType::QuantisedSymm16: |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 340 | { |
| 341 | biasInfoPtr = &dummyQA8Bias; |
| 342 | break; |
| 343 | } |
| 344 | default: |
| 345 | { |
| 346 | BOOST_ASSERT_MSG(false, "Unexpected bias type"); |
| 347 | } |
| 348 | } |
| 349 | } |
| 350 | |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 351 | result = layerSupportObject->IsFullyConnectedSupported( |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 352 | OverrideDataType(input, dataType), |
| 353 | OverrideDataType(output, dataType), |
| 354 | OverrideDataType(cLayer->m_Weight->GetTensorInfo(), dataType), |
| 355 | *biasInfoPtr, |
| 356 | descriptor, |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 357 | reason); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 358 | break; |
| 359 | } |
narpra01 | b89b05f | 2019-01-16 09:53:09 +0000 | [diff] [blame] | 360 | case LayerType::Gather: |
| 361 | { |
| 362 | const TensorInfo& input0 = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 363 | const TensorInfo& input1 = layer.GetInputSlot(1).GetConnection()->GetTensorInfo(); |
| 364 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
| 365 | result = layerSupportObject->IsGatherSupported(OverrideDataType(input0, dataType), |
Ellen Norris-Thompson | e0dbedf | 2019-06-24 09:23:38 +0100 | [diff] [blame] | 366 | input1, |
narpra01 | b89b05f | 2019-01-16 09:53:09 +0000 | [diff] [blame] | 367 | OverrideDataType(output, dataType), |
| 368 | reason); |
| 369 | break; |
| 370 | } |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 371 | case LayerType::Input: |
| 372 | { |
| 373 | const TensorInfo& input = layer.GetOutputSlot(0).GetTensorInfo(); |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 374 | result = layerSupportObject->IsInputSupported(OverrideDataType(input, dataType), reason); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 375 | break; |
| 376 | } |
Kevin May | ce5045a | 2019-10-02 14:07:47 +0100 | [diff] [blame] | 377 | case LayerType::InstanceNormalization: |
| 378 | { |
| 379 | auto cLayer = boost::polymorphic_downcast<const InstanceNormalizationLayer*>(&layer); |
| 380 | const InstanceNormalizationDescriptor& descriptor = cLayer->GetParameters(); |
| 381 | |
| 382 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 383 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
| 384 | |
| 385 | result = layerSupportObject->IsInstanceNormalizationSupported( |
| 386 | OverrideDataType(input, dataType), |
| 387 | OverrideDataType(output, dataType), |
| 388 | descriptor, |
| 389 | reason); |
| 390 | break; |
| 391 | } |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 392 | case LayerType::L2Normalization: |
| 393 | { |
Matteo Martincigh | bcd3c85 | 2018-09-28 14:14:12 +0100 | [diff] [blame] | 394 | auto cLayer = boost::polymorphic_downcast<const L2NormalizationLayer*>(&layer); |
| 395 | const L2NormalizationDescriptor& descriptor = cLayer->GetParameters(); |
| 396 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 397 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 398 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
Matteo Martincigh | bcd3c85 | 2018-09-28 14:14:12 +0100 | [diff] [blame] | 399 | |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 400 | result = layerSupportObject->IsL2NormalizationSupported( |
Matteo Martincigh | bcd3c85 | 2018-09-28 14:14:12 +0100 | [diff] [blame] | 401 | OverrideDataType(input, dataType), |
| 402 | OverrideDataType(output, dataType), |
| 403 | descriptor, |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 404 | reason); |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 405 | break; |
| 406 | } |
Aron Virginas-Tar | f982dea | 2019-10-11 14:07:53 +0100 | [diff] [blame] | 407 | case LayerType::LogSoftmax: |
| 408 | { |
| 409 | auto cLayer = boost::polymorphic_downcast<const LogSoftmaxLayer*>(&layer); |
| 410 | |
| 411 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 412 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
| 413 | |
| 414 | result = layerSupportObject->IsLogSoftmaxSupported(OverrideDataType(input, dataType), |
| 415 | OverrideDataType(output, dataType), |
| 416 | cLayer->GetParameters(), |
| 417 | reason); |
| 418 | break; |
| 419 | } |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 420 | case LayerType::Lstm: |
| 421 | { |
| 422 | auto cLayer = boost::polymorphic_downcast<const LstmLayer*>(&layer); |
| 423 | const LstmDescriptor& descriptor = cLayer->GetParameters(); |
| 424 | |
| 425 | // All inputs. |
| 426 | const TensorInfo& input = OverrideDataType(layer.GetInputSlot(0).GetConnection()->GetTensorInfo(), |
| 427 | dataType); |
| 428 | const TensorInfo& outputStateIn = OverrideDataType(layer.GetInputSlot(1).GetConnection()->GetTensorInfo(), |
| 429 | dataType); |
| 430 | const TensorInfo& cellStateIn = OverrideDataType(layer.GetInputSlot(2).GetConnection()->GetTensorInfo(), |
| 431 | dataType); |
| 432 | // All outputs |
| 433 | const TensorInfo& scratchBuffer = OverrideDataType(layer.GetOutputSlot(0).GetTensorInfo(), dataType); |
| 434 | const TensorInfo& outputStateOut = OverrideDataType(layer.GetOutputSlot(1).GetTensorInfo(), dataType); |
| 435 | const TensorInfo& cellStateOut = OverrideDataType(layer.GetOutputSlot(2).GetTensorInfo(), dataType); |
| 436 | const TensorInfo& output = OverrideDataType(layer.GetOutputSlot(3).GetTensorInfo(), dataType); |
| 437 | |
| 438 | // Basic parameters |
| 439 | const TensorInfo& inputToForgetWeights |
| 440 | = OverrideDataType(cLayer->m_BasicParameters.m_InputToForgetWeights->GetTensorInfo(), dataType); |
| 441 | const TensorInfo& inputToCellWeights |
| 442 | = OverrideDataType(cLayer->m_BasicParameters.m_InputToCellWeights->GetTensorInfo(), dataType); |
| 443 | const TensorInfo& inputToOutputWeights |
| 444 | = OverrideDataType(cLayer->m_BasicParameters.m_InputToOutputWeights->GetTensorInfo(), dataType); |
| 445 | const TensorInfo& recurrentToForgetWeights |
| 446 | = OverrideDataType(cLayer->m_BasicParameters.m_RecurrentToForgetWeights->GetTensorInfo(), dataType); |
| 447 | const TensorInfo& recurrentToCellWeights |
| 448 | = OverrideDataType(cLayer->m_BasicParameters.m_RecurrentToCellWeights->GetTensorInfo(), dataType); |
| 449 | const TensorInfo& recurrentToOutputWeights |
| 450 | = OverrideDataType(cLayer->m_BasicParameters.m_RecurrentToOutputWeights->GetTensorInfo(), dataType); |
| 451 | const TensorInfo& forgetGateBias |
| 452 | = OverrideDataType(cLayer->m_BasicParameters.m_ForgetGateBias->GetTensorInfo(), dataType); |
| 453 | const TensorInfo& cellBias |
| 454 | = OverrideDataType(cLayer->m_BasicParameters.m_CellBias->GetTensorInfo(), dataType); |
| 455 | const TensorInfo& outputGateBias |
| 456 | = OverrideDataType(cLayer->m_BasicParameters.m_OutputGateBias->GetTensorInfo(), dataType); |
| 457 | |
Jan Eilers | d01a83c | 2019-07-03 18:20:40 +0100 | [diff] [blame] | 458 | LstmInputParamsInfo paramsInfo; |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 459 | |
Jan Eilers | d01a83c | 2019-07-03 18:20:40 +0100 | [diff] [blame] | 460 | paramsInfo.m_InputToForgetWeights = &inputToForgetWeights; |
| 461 | paramsInfo.m_InputToCellWeights = &inputToCellWeights; |
| 462 | paramsInfo.m_InputToOutputWeights = &inputToOutputWeights; |
| 463 | paramsInfo.m_RecurrentToForgetWeights = &recurrentToForgetWeights; |
| 464 | paramsInfo.m_RecurrentToCellWeights = &recurrentToCellWeights; |
| 465 | paramsInfo.m_RecurrentToOutputWeights = &recurrentToOutputWeights; |
| 466 | paramsInfo.m_ForgetGateBias = &forgetGateBias; |
| 467 | paramsInfo.m_CellBias = &cellBias; |
| 468 | paramsInfo.m_OutputGateBias = &outputGateBias; |
| 469 | |
| 470 | |
| 471 | // Optional parameters |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 472 | TensorInfo optInputToInputWeights; |
| 473 | TensorInfo optRecurrentToInputWeights; |
| 474 | TensorInfo optCellToInputWeights; |
| 475 | TensorInfo optInputGateBias; |
| 476 | TensorInfo optProjectionWeights; |
| 477 | TensorInfo optProjectionBias; |
| 478 | TensorInfo optCellToForgetWeights; |
| 479 | TensorInfo optCellToOutputWeights; |
Jan Eilers | 38e05bd | 2019-06-26 13:10:09 +0100 | [diff] [blame] | 480 | TensorInfo optInputLayerNormWeights; |
| 481 | TensorInfo optForgetLayerNormWeights; |
| 482 | TensorInfo optCellLayerNormWeights; |
| 483 | TensorInfo optOutputLayerNormWeights; |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 484 | |
| 485 | if(!descriptor.m_CifgEnabled) |
| 486 | { |
| 487 | optInputToInputWeights = |
| 488 | OverrideDataType(cLayer->m_CifgParameters.m_InputToInputWeights->GetTensorInfo(), dataType); |
Jan Eilers | d01a83c | 2019-07-03 18:20:40 +0100 | [diff] [blame] | 489 | paramsInfo.m_InputToInputWeights = &optInputToInputWeights; |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 490 | |
| 491 | optRecurrentToInputWeights = |
| 492 | OverrideDataType(cLayer->m_CifgParameters.m_RecurrentToInputWeights->GetTensorInfo(), dataType); |
Jan Eilers | d01a83c | 2019-07-03 18:20:40 +0100 | [diff] [blame] | 493 | paramsInfo.m_RecurrentToInputWeights = &optRecurrentToInputWeights; |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 494 | if (cLayer->m_CifgParameters.m_CellToInputWeights != nullptr) |
| 495 | { |
| 496 | optCellToInputWeights = |
| 497 | OverrideDataType(cLayer->m_CifgParameters.m_CellToInputWeights->GetTensorInfo(), dataType); |
Jan Eilers | d01a83c | 2019-07-03 18:20:40 +0100 | [diff] [blame] | 498 | paramsInfo.m_CellToInputWeights = &optCellToInputWeights; |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 499 | } |
| 500 | optInputGateBias = |
| 501 | OverrideDataType(cLayer->m_CifgParameters.m_InputGateBias->GetTensorInfo(), dataType); |
Jan Eilers | d01a83c | 2019-07-03 18:20:40 +0100 | [diff] [blame] | 502 | paramsInfo.m_InputGateBias = &optInputGateBias; |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 503 | } |
| 504 | |
| 505 | if(descriptor.m_ProjectionEnabled) |
| 506 | { |
| 507 | optProjectionWeights = |
| 508 | OverrideDataType(cLayer->m_ProjectionParameters.m_ProjectionWeights->GetTensorInfo(), dataType); |
Jan Eilers | d01a83c | 2019-07-03 18:20:40 +0100 | [diff] [blame] | 509 | paramsInfo.m_ProjectionWeights = &optProjectionWeights; |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 510 | if (cLayer->m_ProjectionParameters.m_ProjectionBias != nullptr) |
| 511 | { |
| 512 | optProjectionBias = |
| 513 | OverrideDataType(cLayer->m_ProjectionParameters.m_ProjectionBias->GetTensorInfo(), dataType); |
Jan Eilers | d01a83c | 2019-07-03 18:20:40 +0100 | [diff] [blame] | 514 | paramsInfo.m_ProjectionBias = &optProjectionBias; |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 515 | } |
| 516 | } |
| 517 | |
| 518 | if(descriptor.m_PeepholeEnabled) |
| 519 | { |
| 520 | optCellToForgetWeights = |
| 521 | OverrideDataType(cLayer->m_PeepholeParameters.m_CellToForgetWeights->GetTensorInfo(), dataType); |
Jan Eilers | d01a83c | 2019-07-03 18:20:40 +0100 | [diff] [blame] | 522 | paramsInfo.m_CellToForgetWeights = &optCellToForgetWeights; |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 523 | optCellToOutputWeights = |
| 524 | OverrideDataType(cLayer->m_PeepholeParameters.m_CellToOutputWeights->GetTensorInfo(), dataType); |
Jan Eilers | d01a83c | 2019-07-03 18:20:40 +0100 | [diff] [blame] | 525 | paramsInfo.m_CellToOutputWeights = &optCellToOutputWeights; |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 526 | } |
| 527 | |
Jan Eilers | 38e05bd | 2019-06-26 13:10:09 +0100 | [diff] [blame] | 528 | if(descriptor.m_LayerNormEnabled) |
| 529 | { |
Ferran Balaguer | e30c16e | 2019-07-24 17:03:45 +0100 | [diff] [blame] | 530 | if (!descriptor.m_CifgEnabled) |
| 531 | { |
| 532 | optInputLayerNormWeights = OverrideDataType( |
| 533 | cLayer->m_LayerNormParameters.m_InputLayerNormWeights->GetTensorInfo(), dataType); |
| 534 | paramsInfo.m_InputLayerNormWeights = &optInputLayerNormWeights; |
| 535 | } |
Jan Eilers | 38e05bd | 2019-06-26 13:10:09 +0100 | [diff] [blame] | 536 | |
| 537 | optForgetLayerNormWeights = OverrideDataType( |
| 538 | cLayer->m_LayerNormParameters.m_ForgetLayerNormWeights->GetTensorInfo(), dataType); |
Jan Eilers | d01a83c | 2019-07-03 18:20:40 +0100 | [diff] [blame] | 539 | paramsInfo.m_ForgetLayerNormWeights = &optForgetLayerNormWeights; |
Jan Eilers | 38e05bd | 2019-06-26 13:10:09 +0100 | [diff] [blame] | 540 | |
| 541 | optCellLayerNormWeights = OverrideDataType( |
| 542 | cLayer->m_LayerNormParameters.m_CellLayerNormWeights->GetTensorInfo(), dataType); |
Jan Eilers | d01a83c | 2019-07-03 18:20:40 +0100 | [diff] [blame] | 543 | paramsInfo.m_CellLayerNormWeights = &optCellLayerNormWeights; |
Jan Eilers | 38e05bd | 2019-06-26 13:10:09 +0100 | [diff] [blame] | 544 | |
| 545 | optOutputLayerNormWeights = OverrideDataType( |
| 546 | cLayer->m_LayerNormParameters.m_OutputLayerNormWeights->GetTensorInfo(), dataType); |
Jan Eilers | d01a83c | 2019-07-03 18:20:40 +0100 | [diff] [blame] | 547 | paramsInfo.m_OutputLayerNormWeights = &optOutputLayerNormWeights; |
Jan Eilers | 38e05bd | 2019-06-26 13:10:09 +0100 | [diff] [blame] | 548 | } |
| 549 | |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 550 | result = layerSupportObject->IsLstmSupported( |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 551 | input, |
| 552 | outputStateIn, |
| 553 | cellStateIn, |
| 554 | scratchBuffer, |
| 555 | outputStateOut, |
| 556 | cellStateOut, |
| 557 | output, |
| 558 | descriptor, |
Jan Eilers | d01a83c | 2019-07-03 18:20:40 +0100 | [diff] [blame] | 559 | paramsInfo, |
| 560 | reason); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 561 | break; |
| 562 | } |
Nattapat Chaimanowong | 5a4304a | 2018-11-28 10:44:37 +0000 | [diff] [blame] | 563 | case LayerType::Maximum: |
| 564 | { |
| 565 | const TensorInfo& input0 = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 566 | const TensorInfo& input1 = layer.GetInputSlot(1).GetConnection()->GetTensorInfo(); |
| 567 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
| 568 | |
| 569 | result = layerSupportObject->IsMaximumSupported(OverrideDataType(input0, dataType), |
| 570 | OverrideDataType(input1, dataType), |
| 571 | OverrideDataType(output, dataType), |
| 572 | reason); |
| 573 | break; |
| 574 | } |
narpra01 | b89b05f | 2019-01-16 09:53:09 +0000 | [diff] [blame] | 575 | case LayerType::MemCopy: |
| 576 | { |
| 577 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 578 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 579 | |
narpra01 | b89b05f | 2019-01-16 09:53:09 +0000 | [diff] [blame] | 580 | result = layerSupportObject->IsMemCopySupported(OverrideDataType(input, dataType), |
| 581 | OverrideDataType(output, dataType), |
| 582 | reason); |
| 583 | break; |
| 584 | } |
Derek Lamberti | f674aa0 | 2019-08-01 15:56:25 +0100 | [diff] [blame] | 585 | case LayerType::MemImport: |
| 586 | { |
| 587 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 588 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
| 589 | |
| 590 | result = layerSupportObject->IsMemImportSupported(OverrideDataType(input, dataType), |
| 591 | OverrideDataType(output, dataType), |
| 592 | reason); |
| 593 | break; |
| 594 | } |
Nattapat Chaimanowong | 1f88630 | 2019-04-05 13:37:19 +0100 | [diff] [blame] | 595 | case LayerType::Merge: |
| 596 | { |
| 597 | const TensorInfo& input0 = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 598 | const TensorInfo& input1 = layer.GetInputSlot(1).GetConnection()->GetTensorInfo(); |
| 599 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
| 600 | |
| 601 | result = layerSupportObject->IsMergeSupported(OverrideDataType(input0, dataType), |
| 602 | OverrideDataType(input1, dataType), |
| 603 | OverrideDataType(output, dataType), |
| 604 | reason); |
| 605 | break; |
| 606 | } |
Jim Flynn | e242f2d | 2019-05-22 14:24:13 +0100 | [diff] [blame] | 607 | case LayerType::Concat: |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 608 | { |
Jim Flynn | e242f2d | 2019-05-22 14:24:13 +0100 | [diff] [blame] | 609 | auto cLayer = boost::polymorphic_downcast<const ConcatLayer*>(&layer); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 610 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 611 | // Get vector of all inputs. |
| 612 | auto getTensorInfo = [&dataType](const InputSlot& slot) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 613 | { |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 614 | return OverrideDataType(slot.GetConnectedOutputSlot()->GetTensorInfo(), dataType); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 615 | }; |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 616 | auto beginI = boost::make_transform_iterator(layer.GetInputSlots().begin(), getTensorInfo); |
| 617 | auto endI = boost::make_transform_iterator(layer.GetInputSlots().end(), getTensorInfo); |
| 618 | std::vector<TensorInfo> inputs(beginI, endI); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 619 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 620 | auto getTensorInfoPtr = [](const TensorInfo& info) |
| 621 | { |
| 622 | return &info; |
| 623 | }; |
| 624 | auto beginPtr = boost::make_transform_iterator(inputs.begin(), getTensorInfoPtr); |
| 625 | auto endPtr = boost::make_transform_iterator(inputs.end(), getTensorInfoPtr); |
| 626 | std::vector<const TensorInfo*> inputPtrs(beginPtr, endPtr); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 627 | |
Nikhil Raj | 8599a41 | 2018-11-19 14:51:07 +0000 | [diff] [blame] | 628 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
| 629 | |
Jim Flynn | e242f2d | 2019-05-22 14:24:13 +0100 | [diff] [blame] | 630 | result = layerSupportObject->IsConcatSupported(inputPtrs, output, cLayer->GetParameters(), reason); |
| 631 | |
| 632 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 633 | break; |
| 634 | } |
| 635 | case LayerType::Multiplication: |
| 636 | { |
| 637 | const TensorInfo& input0 = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 638 | const TensorInfo& input1 = layer.GetInputSlot(1).GetConnection()->GetTensorInfo(); |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 639 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 640 | result = layerSupportObject->IsMultiplicationSupported( |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 641 | OverrideDataType(input0, dataType), |
| 642 | OverrideDataType(input1, dataType), |
| 643 | OverrideDataType(output, dataType), |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 644 | reason); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 645 | break; |
| 646 | } |
| 647 | case LayerType::Normalization: |
| 648 | { |
| 649 | auto cLayer = boost::polymorphic_downcast<const NormalizationLayer*>(&layer); |
| 650 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 651 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 652 | result = layerSupportObject->IsNormalizationSupported(OverrideDataType(input, dataType), |
| 653 | OverrideDataType(output, dataType), |
| 654 | cLayer->GetParameters(), |
| 655 | reason); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 656 | break; |
| 657 | } |
| 658 | case LayerType::Output: |
| 659 | { |
| 660 | const TensorInfo& output = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 661 | result = layerSupportObject->IsOutputSupported(OverrideDataType(output, dataType), reason); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 662 | break; |
| 663 | } |
| 664 | case LayerType::Permute: |
| 665 | { |
| 666 | auto cLayer = boost::polymorphic_downcast<const PermuteLayer*>(&layer); |
| 667 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 668 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 669 | result = layerSupportObject->IsPermuteSupported(OverrideDataType(input, dataType), |
| 670 | OverrideDataType(output, dataType), |
| 671 | cLayer->GetParameters(), |
| 672 | reason); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 673 | break; |
| 674 | } |
Mohamed Nour Abouelseoud | 5662c20 | 2018-09-24 13:30:09 +0100 | [diff] [blame] | 675 | case LayerType::Pad: |
| 676 | { |
| 677 | auto cLayer = boost::polymorphic_downcast<const PadLayer*>(&layer); |
| 678 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 679 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 680 | result = layerSupportObject->IsPadSupported( |
Mohamed Nour Abouelseoud | 5662c20 | 2018-09-24 13:30:09 +0100 | [diff] [blame] | 681 | OverrideDataType(input, dataType), |
| 682 | OverrideDataType(output, dataType), |
| 683 | cLayer->GetParameters(), |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 684 | reason); |
Mohamed Nour Abouelseoud | 5662c20 | 2018-09-24 13:30:09 +0100 | [diff] [blame] | 685 | break; |
| 686 | } |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 687 | case LayerType::Pooling2d: |
| 688 | { |
| 689 | auto cLayer = boost::polymorphic_downcast<const Pooling2dLayer*>(&layer); |
| 690 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 691 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 692 | result = layerSupportObject->IsPooling2dSupported(OverrideDataType(input, dataType), |
| 693 | OverrideDataType(output, dataType), |
| 694 | cLayer->GetParameters(), |
| 695 | reason); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 696 | break; |
| 697 | } |
Matteo Martincigh | 4912402 | 2019-01-11 13:25:59 +0000 | [diff] [blame] | 698 | case LayerType::PreCompiled: |
| 699 | { |
| 700 | auto cLayer = boost::polymorphic_downcast<const PreCompiledLayer*>(&layer); |
| 701 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 702 | result = layerSupportObject->IsPreCompiledSupported(OverrideDataType(input, dataType), |
| 703 | cLayer->GetParameters(), |
| 704 | reason); |
| 705 | break; |
| 706 | } |
Derek Lamberti | a9cca6a | 2019-03-25 15:41:58 +0000 | [diff] [blame] | 707 | case LayerType::Quantize: |
| 708 | { |
| 709 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 710 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
| 711 | result = layerSupportObject->IsQuantizeSupported(input, output, reason); |
| 712 | break; |
| 713 | } |
James Conroy | ee18dc8 | 2019-07-17 11:27:46 +0100 | [diff] [blame] | 714 | case LayerType::QuantizedLstm: |
| 715 | { |
| 716 | auto cLayer = boost::polymorphic_downcast<const QuantizedLstmLayer*>(&layer); |
| 717 | |
| 718 | // Inputs |
Ferran Balaguer | 737d9ff | 2019-08-01 09:58:08 +0100 | [diff] [blame] | 719 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 720 | const TensorInfo& previousCellStateIn = layer.GetInputSlot(1).GetConnection()->GetTensorInfo(); |
| 721 | const TensorInfo& previousOutputIn = layer.GetInputSlot(2).GetConnection()->GetTensorInfo(); |
James Conroy | ee18dc8 | 2019-07-17 11:27:46 +0100 | [diff] [blame] | 722 | |
| 723 | // Outputs |
Ferran Balaguer | 737d9ff | 2019-08-01 09:58:08 +0100 | [diff] [blame] | 724 | const TensorInfo& cellStateOut = layer.GetOutputSlot(0).GetTensorInfo(); |
| 725 | const TensorInfo& output = layer.GetOutputSlot(1).GetTensorInfo(); |
James Conroy | ee18dc8 | 2019-07-17 11:27:46 +0100 | [diff] [blame] | 726 | |
| 727 | // QuantizedLstm parameters |
James Conroy | ee18dc8 | 2019-07-17 11:27:46 +0100 | [diff] [blame] | 728 | QuantizedLstmInputParamsInfo paramsInfo; |
| 729 | |
Ferran Balaguer | 737d9ff | 2019-08-01 09:58:08 +0100 | [diff] [blame] | 730 | paramsInfo.m_InputToInputWeights = |
| 731 | &cLayer->m_QuantizedLstmParameters.m_InputToInputWeights->GetTensorInfo(); |
| 732 | paramsInfo.m_InputToForgetWeights = |
| 733 | &cLayer->m_QuantizedLstmParameters.m_InputToForgetWeights->GetTensorInfo(); |
| 734 | paramsInfo.m_InputToCellWeights = |
| 735 | &cLayer->m_QuantizedLstmParameters.m_InputToCellWeights->GetTensorInfo(); |
| 736 | paramsInfo.m_InputToOutputWeights = |
| 737 | &cLayer->m_QuantizedLstmParameters.m_InputToOutputWeights->GetTensorInfo(); |
James Conroy | ee18dc8 | 2019-07-17 11:27:46 +0100 | [diff] [blame] | 738 | |
Ferran Balaguer | 737d9ff | 2019-08-01 09:58:08 +0100 | [diff] [blame] | 739 | paramsInfo.m_RecurrentToInputWeights = |
| 740 | &cLayer->m_QuantizedLstmParameters.m_RecurrentToInputWeights->GetTensorInfo(); |
| 741 | paramsInfo.m_RecurrentToForgetWeights = |
| 742 | &cLayer->m_QuantizedLstmParameters.m_RecurrentToForgetWeights->GetTensorInfo(); |
| 743 | paramsInfo.m_RecurrentToCellWeights = |
| 744 | &cLayer->m_QuantizedLstmParameters.m_RecurrentToCellWeights->GetTensorInfo(); |
| 745 | paramsInfo.m_RecurrentToOutputWeights = |
| 746 | &cLayer->m_QuantizedLstmParameters.m_RecurrentToOutputWeights->GetTensorInfo(); |
James Conroy | ee18dc8 | 2019-07-17 11:27:46 +0100 | [diff] [blame] | 747 | |
Ferran Balaguer | 737d9ff | 2019-08-01 09:58:08 +0100 | [diff] [blame] | 748 | paramsInfo.m_InputGateBias = |
| 749 | &cLayer->m_QuantizedLstmParameters.m_InputGateBias->GetTensorInfo(); |
| 750 | paramsInfo.m_ForgetGateBias = |
| 751 | &cLayer->m_QuantizedLstmParameters.m_ForgetGateBias->GetTensorInfo(); |
| 752 | paramsInfo.m_CellBias = |
| 753 | &cLayer->m_QuantizedLstmParameters.m_CellBias->GetTensorInfo(); |
| 754 | paramsInfo.m_OutputGateBias = |
| 755 | &cLayer->m_QuantizedLstmParameters.m_OutputGateBias->GetTensorInfo();; |
James Conroy | ee18dc8 | 2019-07-17 11:27:46 +0100 | [diff] [blame] | 756 | |
| 757 | result = layerSupportObject->IsQuantizedLstmSupported(input, |
| 758 | previousCellStateIn, |
| 759 | previousOutputIn, |
| 760 | cellStateOut, |
| 761 | output, |
| 762 | paramsInfo, |
| 763 | reason); |
| 764 | break; |
| 765 | } |
Francis Murtagh | e7a86a4 | 2018-08-29 12:42:10 +0100 | [diff] [blame] | 766 | case LayerType::Division: |
| 767 | { |
| 768 | const TensorInfo& input0 = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 769 | const TensorInfo& input1 = layer.GetInputSlot(1).GetConnection()->GetTensorInfo(); |
| 770 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 771 | result = layerSupportObject->IsDivisionSupported( |
Francis Murtagh | e7a86a4 | 2018-08-29 12:42:10 +0100 | [diff] [blame] | 772 | OverrideDataType(input0, dataType), |
| 773 | OverrideDataType(input1, dataType), |
| 774 | OverrideDataType(output, dataType), |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 775 | reason); |
Francis Murtagh | e7a86a4 | 2018-08-29 12:42:10 +0100 | [diff] [blame] | 776 | break; |
| 777 | } |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 778 | case LayerType::Reshape: |
| 779 | { |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 780 | auto cLayer = boost::polymorphic_downcast<const ReshapeLayer*>(&layer); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 781 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 782 | result = layerSupportObject->IsReshapeSupported(OverrideDataType(input, dataType), |
| 783 | cLayer->GetParameters(), |
| 784 | reason); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 785 | break; |
| 786 | } |
Teresa Charlin | a9075df | 2019-06-27 15:41:57 +0100 | [diff] [blame] | 787 | case LayerType::Resize: |
| 788 | { |
| 789 | auto cLayer = boost::polymorphic_downcast<const ResizeLayer*>(&layer); |
Aron Virginas-Tar | 169d2f1 | 2019-07-01 19:01:44 +0100 | [diff] [blame] | 790 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
Teresa Charlin | a9075df | 2019-06-27 15:41:57 +0100 | [diff] [blame] | 791 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
| 792 | result = layerSupportObject->IsResizeSupported(OverrideDataType(input, dataType), |
| 793 | OverrideDataType(output, dataType), |
| 794 | cLayer->GetParameters(), |
| 795 | reason); |
| 796 | break; |
| 797 | } |
Mohamed Nour Abouelseoud | a1d3c6a | 2018-12-27 12:39:16 +0000 | [diff] [blame] | 798 | case LayerType::Rsqrt: |
| 799 | { |
| 800 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 801 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
| 802 | result = layerSupportObject->IsRsqrtSupported(OverrideDataType(input, dataType), |
| 803 | OverrideDataType(output, dataType), |
| 804 | reason); |
| 805 | break; |
| 806 | } |
Aron Virginas-Tar | 636ab40 | 2019-09-16 14:27:45 +0100 | [diff] [blame] | 807 | case LayerType::Slice: |
| 808 | { |
| 809 | auto cLayer = boost::polymorphic_downcast<const SliceLayer*>(&layer); |
| 810 | |
| 811 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 812 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
| 813 | |
| 814 | result = layerSupportObject->IsSliceSupported(OverrideDataType(input, dataType), |
| 815 | OverrideDataType(output, dataType), |
| 816 | cLayer->GetParameters(), |
| 817 | reason); |
| 818 | break; |
| 819 | } |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 820 | case LayerType::Softmax: |
| 821 | { |
| 822 | auto cLayer = boost::polymorphic_downcast<const SoftmaxLayer*>(&layer); |
| 823 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 824 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 825 | result = layerSupportObject->IsSoftmaxSupported(OverrideDataType(input, dataType), |
| 826 | OverrideDataType(output, dataType), |
| 827 | cLayer->GetParameters(), |
| 828 | reason); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 829 | break; |
| 830 | } |
Nattapat Chaimanowong | 207ef9a | 2018-11-02 10:57:25 +0000 | [diff] [blame] | 831 | case LayerType::SpaceToBatchNd: |
| 832 | { |
| 833 | auto cLayer = boost::polymorphic_downcast<const SpaceToBatchNdLayer*>(&layer); |
| 834 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 835 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
| 836 | result = layerSupportObject->IsSpaceToBatchNdSupported(OverrideDataType(input, dataType), |
| 837 | OverrideDataType(output, dataType), |
| 838 | cLayer->GetParameters(), |
| 839 | reason); |
| 840 | break; |
| 841 | } |
Aron Virginas-Tar | 972af15 | 2019-06-11 14:14:03 +0100 | [diff] [blame] | 842 | case LayerType::SpaceToDepth: |
| 843 | { |
| 844 | auto cLayer = boost::polymorphic_downcast<const SpaceToDepthLayer*>(&layer); |
| 845 | |
| 846 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 847 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
| 848 | |
| 849 | result = layerSupportObject->IsSpaceToDepthSupported(OverrideDataType(input, dataType), |
| 850 | OverrideDataType(output, dataType), |
| 851 | cLayer->GetParameters(), |
| 852 | reason); |
| 853 | break; |
| 854 | } |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 855 | case LayerType::Splitter: |
| 856 | { |
| 857 | auto cLayer = boost::polymorphic_downcast<const SplitterLayer*>(&layer); |
| 858 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
Narumol Prangnawarat | 15eb583 | 2019-05-20 15:31:05 +0100 | [diff] [blame] | 859 | |
| 860 | // Get vector of all outputs. |
| 861 | auto getTensorInfo = [&dataType](const OutputSlot& slot) |
| 862 | { |
| 863 | return OverrideDataType(slot.GetTensorInfo(), dataType); |
| 864 | }; |
| 865 | auto beginI = boost::make_transform_iterator(layer.GetOutputSlots().begin(), getTensorInfo); |
| 866 | auto endI = boost::make_transform_iterator(layer.GetOutputSlots().end(), getTensorInfo); |
| 867 | std::vector<TensorInfo> outputs(beginI, endI); |
| 868 | |
| 869 | const std::vector<std::reference_wrapper<TensorInfo>> outputPtrs(outputs.begin(), outputs.end()); |
| 870 | |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 871 | result = layerSupportObject->IsSplitterSupported(OverrideDataType(input, dataType), |
Narumol Prangnawarat | 15eb583 | 2019-05-20 15:31:05 +0100 | [diff] [blame] | 872 | outputPtrs, |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 873 | cLayer->GetParameters(), |
| 874 | reason); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 875 | break; |
| 876 | } |
Matthew Jackson | 2b8c1da | 2019-07-04 14:59:16 +0100 | [diff] [blame] | 877 | case LayerType::Stack: |
| 878 | { |
| 879 | auto cLayer = boost::polymorphic_downcast<const StackLayer*>(&layer); |
| 880 | |
| 881 | // Get vector of all inputs. |
| 882 | auto getTensorInfo = [&dataType](const InputSlot& slot) |
| 883 | { |
| 884 | return OverrideDataType(slot.GetConnectedOutputSlot()->GetTensorInfo(), dataType); |
| 885 | }; |
| 886 | auto beginI = boost::make_transform_iterator(layer.GetInputSlots().begin(), getTensorInfo); |
| 887 | auto endI = boost::make_transform_iterator(layer.GetInputSlots().end(), getTensorInfo); |
| 888 | std::vector<TensorInfo> inputs(beginI, endI); |
| 889 | |
| 890 | auto getTensorInfoPtr = [](const TensorInfo& info) |
| 891 | { |
| 892 | return &info; |
| 893 | }; |
| 894 | auto beginPtr = boost::make_transform_iterator(inputs.begin(), getTensorInfoPtr); |
| 895 | auto endPtr = boost::make_transform_iterator(inputs.end(), getTensorInfoPtr); |
| 896 | std::vector<const TensorInfo*> inputPtrs(beginPtr, endPtr); |
| 897 | |
| 898 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
| 899 | |
| 900 | result = layerSupportObject->IsStackSupported(inputPtrs, output, cLayer->GetParameters(), reason); |
| 901 | |
| 902 | break; |
| 903 | } |
Derek Lamberti | 013c390 | 2019-10-21 10:46:16 +0100 | [diff] [blame] | 904 | case LayerType::StandIn: |
| 905 | { |
| 906 | auto cLayer = boost::polymorphic_downcast<const StandInLayer*>(&layer); |
| 907 | |
| 908 | // Get vector of all inputs. |
| 909 | auto getTensorInfoIn = [&dataType](const InputSlot& slot) |
| 910 | { |
| 911 | return OverrideDataType(slot.GetConnectedOutputSlot()->GetTensorInfo(), dataType); |
| 912 | }; |
| 913 | auto getTensorInfoOut = [&dataType](const OutputSlot& slot) |
| 914 | { |
| 915 | return OverrideDataType(slot.GetTensorInfo(), dataType); |
| 916 | }; |
| 917 | auto beginI = boost::make_transform_iterator(layer.GetInputSlots().begin(), getTensorInfoIn); |
| 918 | auto endI = boost::make_transform_iterator(layer.GetInputSlots().end(), getTensorInfoIn); |
| 919 | std::vector<TensorInfo> inputs(beginI, endI); |
| 920 | |
| 921 | auto beginO = boost::make_transform_iterator(layer.GetOutputSlots().begin(), getTensorInfoOut); |
| 922 | auto endO = boost::make_transform_iterator(layer.GetOutputSlots().end(), getTensorInfoOut); |
| 923 | std::vector<TensorInfo> outputs(beginO, endO); |
| 924 | |
| 925 | |
| 926 | auto getTensorInfoPtr = [](const TensorInfo& info) |
| 927 | { |
| 928 | return &info; |
| 929 | }; |
| 930 | auto beginPtrI = boost::make_transform_iterator(inputs.begin(), getTensorInfoPtr); |
| 931 | auto endPtrI = boost::make_transform_iterator(inputs.end(), getTensorInfoPtr); |
| 932 | std::vector<const TensorInfo*> inputPtrs(beginPtrI, endPtrI); |
| 933 | |
| 934 | auto beginPtrO = boost::make_transform_iterator(outputs.begin(), getTensorInfoPtr); |
| 935 | auto endPtrO = boost::make_transform_iterator(outputs.end(), getTensorInfoPtr); |
| 936 | std::vector<const TensorInfo*> outputPtrs(beginPtrO, endPtrO); |
| 937 | |
| 938 | |
| 939 | result = layerSupportObject->IsStandInSupported(inputPtrs, |
| 940 | outputPtrs, |
| 941 | cLayer->GetParameters(), |
| 942 | reason); |
| 943 | break; |
| 944 | } |
Conor Kennedy | 430b5d8 | 2018-11-14 15:28:28 +0000 | [diff] [blame] | 945 | case LayerType::StridedSlice: |
| 946 | { |
| 947 | auto cLayer = boost::polymorphic_downcast<const StridedSliceLayer*>(&layer); |
| 948 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 949 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
| 950 | result = layerSupportObject->IsStridedSliceSupported(OverrideDataType(input, dataType), |
| 951 | OverrideDataType(output, dataType), |
| 952 | cLayer->GetParameters(), |
| 953 | reason); |
| 954 | break; |
| 955 | } |
David Beck | c2044fe | 2018-09-05 15:00:38 +0100 | [diff] [blame] | 956 | case LayerType::Subtraction: |
| 957 | { |
| 958 | const TensorInfo& input0 = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 959 | const TensorInfo& input1 = layer.GetInputSlot(1).GetConnection()->GetTensorInfo(); |
| 960 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 961 | result = layerSupportObject->IsSubtractionSupported( |
David Beck | c2044fe | 2018-09-05 15:00:38 +0100 | [diff] [blame] | 962 | OverrideDataType(input0, dataType), |
| 963 | OverrideDataType(input1, dataType), |
| 964 | OverrideDataType(output, dataType), |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 965 | reason); |
David Beck | c2044fe | 2018-09-05 15:00:38 +0100 | [diff] [blame] | 966 | break; |
| 967 | } |
Sadik Armagan | eff363d | 2019-04-05 15:25:46 +0100 | [diff] [blame] | 968 | case LayerType::Switch: |
| 969 | { |
| 970 | const TensorInfo& input0 = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 971 | const TensorInfo& input1 = layer.GetInputSlot(1).GetConnection()->GetTensorInfo(); |
| 972 | const TensorInfo& output0 = layer.GetOutputSlot(0).GetTensorInfo(); |
| 973 | const TensorInfo& output1 = layer.GetOutputSlot(1).GetTensorInfo(); |
| 974 | result = layerSupportObject->IsSwitchSupported(OverrideDataType(input0, dataType), |
| 975 | OverrideDataType(input1, dataType), |
| 976 | OverrideDataType(output0, dataType), |
| 977 | OverrideDataType(output1, dataType), |
| 978 | reason); |
| 979 | break; |
| 980 | } |
narpra01 | 32b9046 | 2018-09-13 11:07:48 +0100 | [diff] [blame] | 981 | case LayerType::Mean: |
| 982 | { |
| 983 | auto cLayer = boost::polymorphic_downcast<const MeanLayer*>(&layer); |
| 984 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 985 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 986 | result = layerSupportObject->IsMeanSupported( |
narpra01 | 32b9046 | 2018-09-13 11:07:48 +0100 | [diff] [blame] | 987 | OverrideDataType(input, dataType), |
| 988 | OverrideDataType(output, dataType), |
| 989 | cLayer->GetParameters(), |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 990 | reason); |
narpra01 | 32b9046 | 2018-09-13 11:07:48 +0100 | [diff] [blame] | 991 | break; |
| 992 | } |
kevmay01 | 9053969 | 2018-11-29 08:40:19 +0000 | [diff] [blame] | 993 | case LayerType::Minimum: |
| 994 | { |
| 995 | const TensorInfo& input0 = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 996 | const TensorInfo& input1 = layer.GetInputSlot(1).GetConnection()->GetTensorInfo(); |
| 997 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
| 998 | result = layerSupportObject->IsMinimumSupported(OverrideDataType(input0, dataType), |
| 999 | OverrideDataType(input1, dataType), |
| 1000 | OverrideDataType(output, dataType), |
| 1001 | reason); |
| 1002 | break; |
| 1003 | } |
Matteo Martincigh | 0e406ee | 2019-06-12 15:42:18 +0100 | [diff] [blame] | 1004 | case LayerType::Prelu: |
| 1005 | { |
| 1006 | const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); |
| 1007 | const TensorInfo& alpha = layer.GetInputSlot(1).GetConnection()->GetTensorInfo(); |
| 1008 | const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); |
| 1009 | result = layerSupportObject->IsPreluSupported(OverrideDataType(input, dataType), |
| 1010 | OverrideDataType(alpha, dataType), |
| 1011 | OverrideDataType(output, dataType), |
| 1012 | reason); |
| 1013 | break; |
| 1014 | } |
Aron Virginas-Tar | 639fb04 | 2019-06-20 14:28:19 +0100 | [diff] [blame] | 1015 | case LayerType::TransposeConvolution2d: |
| 1016 | { |
| 1017 | auto cLayer = boost::polymorphic_downcast<const TransposeConvolution2dLayer*>(&layer); |
| 1018 | |
| 1019 | const TensorInfo input = OverrideDataType(layer.GetInputSlot(0).GetConnection()->GetTensorInfo(), |
| 1020 | dataType); |
| 1021 | const TensorInfo output = OverrideDataType(layer.GetOutputSlot(0).GetTensorInfo(), dataType); |
| 1022 | |
| 1023 | const TransposeConvolution2dDescriptor& descriptor = cLayer->GetParameters(); |
| 1024 | |
| 1025 | Optional<TensorInfo> biases; |
| 1026 | if (descriptor.m_BiasEnabled) |
| 1027 | { |
| 1028 | BOOST_ASSERT(cLayer->m_Bias.get() != nullptr); |
| 1029 | biases = OverrideDataType(cLayer->m_Bias->GetTensorInfo(), |
| 1030 | GetBiasTypeFromWeightsType(dataType)); |
| 1031 | } |
| 1032 | |
| 1033 | BOOST_ASSERT(cLayer->m_Weight.get() != nullptr); |
| 1034 | const TensorInfo weights = OverrideDataType(cLayer->m_Weight->GetTensorInfo(), dataType); |
| 1035 | |
| 1036 | result = layerSupportObject->IsTransposeConvolution2dSupported(input, |
| 1037 | output, |
| 1038 | descriptor, |
| 1039 | weights, |
| 1040 | biases, |
| 1041 | reason); |
| 1042 | |
| 1043 | break; |
| 1044 | } |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 1045 | default: |
| 1046 | { |
| 1047 | BOOST_ASSERT_MSG(false, "WorkloadFactory did not recognise type of layer."); |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 1048 | reason.value() = "Unrecognised layer type"; |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 1049 | result = false; |
| 1050 | break; |
| 1051 | } |
| 1052 | } |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 1053 | return result; |
| 1054 | } |
| 1055 | |
David Beck | dcb751f | 2018-10-03 11:42:42 +0100 | [diff] [blame] | 1056 | bool IWorkloadFactory::IsLayerSupported(const IConnectableLayer& connectableLayer, |
David Beck | 29c75de | 2018-10-23 13:35:58 +0100 | [diff] [blame] | 1057 | Optional<DataType> dataType, |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 1058 | std::string& outReasonIfUnsupported) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 1059 | { |
David Beck | dcb751f | 2018-10-03 11:42:42 +0100 | [diff] [blame] | 1060 | auto layer = boost::polymorphic_downcast<const Layer*>(&connectableLayer); |
David Beck | 33f0ae0 | 2018-10-18 15:13:56 +0100 | [diff] [blame] | 1061 | return IsLayerSupported(layer->GetBackendId(), connectableLayer, dataType, outReasonIfUnsupported); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 1062 | } |
| 1063 | |
Derek Lamberti | a9cca6a | 2019-03-25 15:41:58 +0000 | [diff] [blame] | 1064 | // Default Implementations |
Kevin May | 868eb14 | 2019-09-04 17:29:31 +0100 | [diff] [blame] | 1065 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateAbs(const AbsQueueDescriptor& descriptor, |
| 1066 | const WorkloadInfo& info) const |
| 1067 | { |
| 1068 | return std::unique_ptr<IWorkload>(); |
| 1069 | } |
| 1070 | |
Derek Lamberti | a9cca6a | 2019-03-25 15:41:58 +0000 | [diff] [blame] | 1071 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateActivation(const ActivationQueueDescriptor& descriptor, |
| 1072 | const WorkloadInfo& info) const |
| 1073 | { |
| 1074 | return std::unique_ptr<IWorkload>(); |
| 1075 | } |
| 1076 | |
| 1077 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateAddition(const AdditionQueueDescriptor& descriptor, |
| 1078 | const WorkloadInfo& info) const |
| 1079 | { |
| 1080 | return std::unique_ptr<IWorkload>(); |
| 1081 | } |
| 1082 | |
Nikhil Raj | ee391d5 | 2019-09-05 17:50:44 +0100 | [diff] [blame] | 1083 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateArgMinMax(const ArgMinMaxQueueDescriptor& descriptor, |
| 1084 | const WorkloadInfo& info) const |
| 1085 | { |
| 1086 | return std::unique_ptr<IWorkload>(); |
| 1087 | } |
| 1088 | |
Derek Lamberti | a9cca6a | 2019-03-25 15:41:58 +0000 | [diff] [blame] | 1089 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateBatchNormalization( |
| 1090 | const BatchNormalizationQueueDescriptor& descriptor, const WorkloadInfo& info) const |
| 1091 | { |
| 1092 | return std::unique_ptr<IWorkload>(); |
| 1093 | } |
| 1094 | |
| 1095 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateBatchToSpaceNd(const BatchToSpaceNdQueueDescriptor& descriptor, |
| 1096 | const WorkloadInfo& Info) const |
| 1097 | { |
| 1098 | return std::unique_ptr<IWorkload>(); |
| 1099 | } |
| 1100 | |
Aron Virginas-Tar | 77bfb5e | 2019-10-16 17:45:38 +0100 | [diff] [blame] | 1101 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateComparison(const ComparisonQueueDescriptor& descriptor, |
| 1102 | const WorkloadInfo& info) const |
| 1103 | { |
| 1104 | return std::unique_ptr<IWorkload>(); |
| 1105 | } |
| 1106 | |
Jim Flynn | e242f2d | 2019-05-22 14:24:13 +0100 | [diff] [blame] | 1107 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateConcat(const ConcatQueueDescriptor& descriptor, |
Jim Flynn | 4ed6c83 | 2019-05-20 11:02:46 +0100 | [diff] [blame] | 1108 | const WorkloadInfo& info) const |
| 1109 | { |
| 1110 | return std::unique_ptr<IWorkload>(); |
| 1111 | } |
| 1112 | |
Derek Lamberti | a9cca6a | 2019-03-25 15:41:58 +0000 | [diff] [blame] | 1113 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateConstant(const ConstantQueueDescriptor& descriptor, |
| 1114 | const WorkloadInfo& info) const |
| 1115 | { |
| 1116 | return std::unique_ptr<IWorkload>(); |
| 1117 | } |
| 1118 | |
| 1119 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateConvertFp16ToFp32(const ConvertFp16ToFp32QueueDescriptor& descriptor, |
| 1120 | const WorkloadInfo& info) const |
| 1121 | { |
| 1122 | return std::unique_ptr<IWorkload>(); |
| 1123 | } |
| 1124 | |
| 1125 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateConvertFp32ToFp16(const ConvertFp32ToFp16QueueDescriptor& descriptor, |
| 1126 | const WorkloadInfo& info) const |
| 1127 | { |
| 1128 | return std::unique_ptr<IWorkload>(); |
| 1129 | } |
| 1130 | |
| 1131 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateConvolution2d(const Convolution2dQueueDescriptor& descriptor, |
| 1132 | const WorkloadInfo& info) const |
| 1133 | { |
| 1134 | return std::unique_ptr<IWorkload>(); |
| 1135 | } |
| 1136 | |
| 1137 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateDebug(const DebugQueueDescriptor& descriptor, |
| 1138 | const WorkloadInfo& info) const |
| 1139 | { |
| 1140 | return std::unique_ptr<IWorkload>(); |
| 1141 | } |
| 1142 | |
Aron Virginas-Tar | dd6247f | 2019-09-19 14:31:17 +0100 | [diff] [blame] | 1143 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateDepthToSpace(const DepthToSpaceQueueDescriptor& descriptor, |
| 1144 | const WorkloadInfo& info) const |
| 1145 | { |
| 1146 | return std::unique_ptr<IWorkload>(); |
| 1147 | } |
| 1148 | |
Derek Lamberti | a9cca6a | 2019-03-25 15:41:58 +0000 | [diff] [blame] | 1149 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateDepthwiseConvolution2d( |
| 1150 | const DepthwiseConvolution2dQueueDescriptor& descriptor, const WorkloadInfo& info) const |
| 1151 | { |
| 1152 | return std::unique_ptr<IWorkload>(); |
| 1153 | } |
| 1154 | |
Nattapat Chaimanowong | e4294fd | 2019-03-28 09:56:53 +0000 | [diff] [blame] | 1155 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateDequantize( |
| 1156 | const DequantizeQueueDescriptor& descriptor, const WorkloadInfo& info) const |
| 1157 | { |
| 1158 | return std::unique_ptr<IWorkload>(); |
| 1159 | } |
| 1160 | |
Derek Lamberti | a9cca6a | 2019-03-25 15:41:58 +0000 | [diff] [blame] | 1161 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateDetectionPostProcess( |
| 1162 | const DetectionPostProcessQueueDescriptor& descriptor, const WorkloadInfo& info) const |
| 1163 | { |
| 1164 | return std::unique_ptr<IWorkload>(); |
| 1165 | } |
| 1166 | |
| 1167 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateDivision(const DivisionQueueDescriptor& descriptor, |
| 1168 | const WorkloadInfo& info) const |
| 1169 | { |
| 1170 | return std::unique_ptr<IWorkload>(); |
| 1171 | } |
| 1172 | |
| 1173 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateEqual(const EqualQueueDescriptor& descriptor, |
| 1174 | const WorkloadInfo& Info) const |
| 1175 | { |
| 1176 | return std::unique_ptr<IWorkload>(); |
| 1177 | } |
| 1178 | |
| 1179 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateFakeQuantization(const FakeQuantizationQueueDescriptor& descriptor, |
| 1180 | const WorkloadInfo& info) const |
| 1181 | { |
| 1182 | return std::unique_ptr<IWorkload>(); |
| 1183 | } |
| 1184 | |
| 1185 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateFloor(const FloorQueueDescriptor& descriptor, |
| 1186 | const WorkloadInfo& info) const |
| 1187 | { |
| 1188 | return std::unique_ptr<IWorkload>(); |
| 1189 | } |
| 1190 | |
| 1191 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateFullyConnected(const FullyConnectedQueueDescriptor& descriptor, |
| 1192 | const WorkloadInfo& info) const |
| 1193 | { |
| 1194 | return std::unique_ptr<IWorkload>(); |
| 1195 | } |
| 1196 | |
| 1197 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateGather(const GatherQueueDescriptor& descriptor, |
| 1198 | const WorkloadInfo& info) const |
| 1199 | { |
| 1200 | return std::unique_ptr<IWorkload>(); |
| 1201 | } |
| 1202 | |
| 1203 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateGreater(const GreaterQueueDescriptor& descriptor, |
| 1204 | const WorkloadInfo& info) const |
| 1205 | { |
| 1206 | return std::unique_ptr<IWorkload>(); |
| 1207 | } |
| 1208 | |
Kevin May | ce5045a | 2019-10-02 14:07:47 +0100 | [diff] [blame] | 1209 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateInstanceNormalization( |
| 1210 | const InstanceNormalizationQueueDescriptor& descriptor, |
| 1211 | const WorkloadInfo& info) const |
| 1212 | { |
| 1213 | return std::unique_ptr<IWorkload>(); |
| 1214 | } |
| 1215 | |
Derek Lamberti | a9cca6a | 2019-03-25 15:41:58 +0000 | [diff] [blame] | 1216 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateL2Normalization(const L2NormalizationQueueDescriptor& descriptor, |
| 1217 | const WorkloadInfo& info) const |
| 1218 | { |
| 1219 | return std::unique_ptr<IWorkload>(); |
| 1220 | } |
| 1221 | |
Aron Virginas-Tar | f982dea | 2019-10-11 14:07:53 +0100 | [diff] [blame] | 1222 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateLogSoftmax(const LogSoftmaxQueueDescriptor& descriptor, |
| 1223 | const WorkloadInfo& info) const |
| 1224 | { |
| 1225 | return std::unique_ptr<IWorkload>(); |
| 1226 | } |
| 1227 | |
Derek Lamberti | a9cca6a | 2019-03-25 15:41:58 +0000 | [diff] [blame] | 1228 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateLstm(const LstmQueueDescriptor& descriptor, |
| 1229 | const WorkloadInfo& info) const |
| 1230 | { |
| 1231 | return std::unique_ptr<IWorkload>(); |
| 1232 | } |
| 1233 | |
| 1234 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateMaximum(const MaximumQueueDescriptor& descriptor, |
| 1235 | const WorkloadInfo& info) const |
| 1236 | { |
| 1237 | return std::unique_ptr<IWorkload>(); |
| 1238 | } |
| 1239 | |
| 1240 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateMean(const MeanQueueDescriptor& descriptor, |
| 1241 | const WorkloadInfo& Info) const |
| 1242 | { |
| 1243 | return std::unique_ptr<IWorkload>(); |
| 1244 | } |
| 1245 | |
| 1246 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateMemCopy(const MemCopyQueueDescriptor& descriptor, |
| 1247 | const WorkloadInfo& info) const |
| 1248 | { |
| 1249 | return std::unique_ptr<IWorkload>(); |
| 1250 | } |
| 1251 | |
Derek Lamberti | f674aa0 | 2019-08-01 15:56:25 +0100 | [diff] [blame] | 1252 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateMemImport(const MemImportQueueDescriptor& descriptor, |
| 1253 | const WorkloadInfo& info) const |
| 1254 | { |
| 1255 | return std::unique_ptr<IWorkload>(); |
| 1256 | } |
| 1257 | |
Nattapat Chaimanowong | 1f88630 | 2019-04-05 13:37:19 +0100 | [diff] [blame] | 1258 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateMerge(const MergeQueueDescriptor& descriptor, |
| 1259 | const WorkloadInfo& info) const |
| 1260 | { |
| 1261 | return std::unique_ptr<IWorkload>(); |
| 1262 | } |
| 1263 | |
Derek Lamberti | a9cca6a | 2019-03-25 15:41:58 +0000 | [diff] [blame] | 1264 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateMerger(const MergerQueueDescriptor& descriptor, |
| 1265 | const WorkloadInfo& info) const |
| 1266 | { |
| 1267 | return std::unique_ptr<IWorkload>(); |
| 1268 | } |
| 1269 | |
| 1270 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateMinimum(const MinimumQueueDescriptor& descriptor, |
| 1271 | const WorkloadInfo& info) const |
| 1272 | { |
| 1273 | return std::unique_ptr<IWorkload>(); |
| 1274 | } |
| 1275 | |
| 1276 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateMultiplication(const MultiplicationQueueDescriptor& descriptor, |
| 1277 | const WorkloadInfo& info) const |
| 1278 | { |
| 1279 | return std::unique_ptr<IWorkload>(); |
| 1280 | } |
| 1281 | |
| 1282 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateNormalization(const NormalizationQueueDescriptor& descriptor, |
| 1283 | const WorkloadInfo& info) const |
| 1284 | { |
| 1285 | return std::unique_ptr<IWorkload>(); |
| 1286 | } |
| 1287 | |
| 1288 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateOutput(const OutputQueueDescriptor& descriptor, |
| 1289 | const WorkloadInfo& info) const |
| 1290 | { |
| 1291 | return std::unique_ptr<IWorkload>(); |
| 1292 | } |
| 1293 | |
| 1294 | std::unique_ptr<IWorkload> IWorkloadFactory::CreatePad(const PadQueueDescriptor& descriptor, |
| 1295 | const WorkloadInfo& Info) const |
| 1296 | { |
| 1297 | return std::unique_ptr<IWorkload>(); |
| 1298 | } |
| 1299 | |
| 1300 | std::unique_ptr<IWorkload> IWorkloadFactory::CreatePermute(const PermuteQueueDescriptor& descriptor, |
| 1301 | const WorkloadInfo& info) const |
| 1302 | { |
| 1303 | return std::unique_ptr<IWorkload>(); |
| 1304 | } |
| 1305 | |
| 1306 | std::unique_ptr<IWorkload> IWorkloadFactory::CreatePooling2d(const Pooling2dQueueDescriptor& descriptor, |
| 1307 | const WorkloadInfo& info) const |
| 1308 | { |
| 1309 | return std::unique_ptr<IWorkload>(); |
| 1310 | } |
| 1311 | |
| 1312 | std::unique_ptr<IWorkload> IWorkloadFactory::CreatePreCompiled(const PreCompiledQueueDescriptor& descriptor, |
| 1313 | const WorkloadInfo& info) const |
| 1314 | { |
| 1315 | return std::unique_ptr<IWorkload>(); |
| 1316 | } |
| 1317 | |
Matteo Martincigh | 0e406ee | 2019-06-12 15:42:18 +0100 | [diff] [blame] | 1318 | std::unique_ptr<IWorkload> IWorkloadFactory::CreatePrelu(const PreluQueueDescriptor &descriptor, |
| 1319 | const WorkloadInfo &info) const |
| 1320 | { |
| 1321 | return std::unique_ptr<IWorkload>(); |
| 1322 | } |
| 1323 | |
Derek Lamberti | a9cca6a | 2019-03-25 15:41:58 +0000 | [diff] [blame] | 1324 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateQuantize(const QuantizeQueueDescriptor& descriptor, |
| 1325 | const WorkloadInfo& Info) const |
| 1326 | { |
| 1327 | return std::unique_ptr<IWorkload>(); |
| 1328 | } |
| 1329 | |
James Conroy | ee18dc8 | 2019-07-17 11:27:46 +0100 | [diff] [blame] | 1330 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateQuantizedLstm(const QuantizedLstmQueueDescriptor& descriptor, |
| 1331 | const WorkloadInfo& info) const |
| 1332 | { |
| 1333 | return std::unique_ptr<IWorkload>(); |
| 1334 | } |
| 1335 | |
Derek Lamberti | a9cca6a | 2019-03-25 15:41:58 +0000 | [diff] [blame] | 1336 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateReshape(const ReshapeQueueDescriptor& descriptor, |
| 1337 | const WorkloadInfo& info) const |
| 1338 | { |
| 1339 | return std::unique_ptr<IWorkload>(); |
| 1340 | } |
| 1341 | |
| 1342 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateResizeBilinear(const ResizeBilinearQueueDescriptor& descriptor, |
| 1343 | const WorkloadInfo& info) const |
| 1344 | { |
| 1345 | return std::unique_ptr<IWorkload>(); |
| 1346 | } |
| 1347 | |
Teresa Charlin | a9075df | 2019-06-27 15:41:57 +0100 | [diff] [blame] | 1348 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateResize(const ResizeQueueDescriptor& descriptor, |
| 1349 | const WorkloadInfo& info) const |
| 1350 | { |
| 1351 | return std::unique_ptr<IWorkload>(); |
| 1352 | } |
| 1353 | |
Derek Lamberti | a9cca6a | 2019-03-25 15:41:58 +0000 | [diff] [blame] | 1354 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateRsqrt(const RsqrtQueueDescriptor& descriptor, |
| 1355 | const WorkloadInfo& info) const |
| 1356 | { |
| 1357 | return std::unique_ptr<IWorkload>(); |
| 1358 | } |
| 1359 | |
Aron Virginas-Tar | 636ab40 | 2019-09-16 14:27:45 +0100 | [diff] [blame] | 1360 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateSlice(const SliceQueueDescriptor& descriptor, |
| 1361 | const WorkloadInfo& info) const |
| 1362 | { |
| 1363 | return std::unique_ptr<IWorkload>(); |
| 1364 | } |
| 1365 | |
Derek Lamberti | a9cca6a | 2019-03-25 15:41:58 +0000 | [diff] [blame] | 1366 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateSoftmax(const SoftmaxQueueDescriptor& descriptor, |
| 1367 | const WorkloadInfo& info) const |
| 1368 | { |
| 1369 | return std::unique_ptr<IWorkload>(); |
| 1370 | } |
| 1371 | |
| 1372 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateSplitter(const SplitterQueueDescriptor& descriptor, |
| 1373 | const WorkloadInfo& info) const |
| 1374 | { |
| 1375 | return std::unique_ptr<IWorkload>(); |
| 1376 | } |
| 1377 | |
| 1378 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateSpaceToBatchNd(const SpaceToBatchNdQueueDescriptor& descriptor, |
| 1379 | const WorkloadInfo& info) const |
| 1380 | { |
| 1381 | return std::unique_ptr<IWorkload>(); |
| 1382 | } |
| 1383 | |
Aron Virginas-Tar | 972af15 | 2019-06-11 14:14:03 +0100 | [diff] [blame] | 1384 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateSpaceToDepth(const SpaceToDepthQueueDescriptor& descriptor, |
| 1385 | const WorkloadInfo& info) const |
| 1386 | { |
| 1387 | return std::unique_ptr<IWorkload>(); |
| 1388 | } |
| 1389 | |
Matthew Jackson | 2b8c1da | 2019-07-04 14:59:16 +0100 | [diff] [blame] | 1390 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateStack(const StackQueueDescriptor& descriptor, |
| 1391 | const WorkloadInfo& info) const |
| 1392 | { |
| 1393 | return std::unique_ptr<IWorkload>(); |
| 1394 | } |
| 1395 | |
Derek Lamberti | a9cca6a | 2019-03-25 15:41:58 +0000 | [diff] [blame] | 1396 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateStridedSlice(const StridedSliceQueueDescriptor& descriptor, |
| 1397 | const WorkloadInfo& Info) const |
| 1398 | { |
| 1399 | return std::unique_ptr<IWorkload>(); |
| 1400 | } |
| 1401 | |
| 1402 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateSubtraction(const SubtractionQueueDescriptor& descriptor, |
| 1403 | const WorkloadInfo& info) const |
| 1404 | { |
| 1405 | return std::unique_ptr<IWorkload>(); |
| 1406 | } |
| 1407 | |
Sadik Armagan | eff363d | 2019-04-05 15:25:46 +0100 | [diff] [blame] | 1408 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateSwitch(const SwitchQueueDescriptor& descriptor, |
| 1409 | const WorkloadInfo& info) const |
| 1410 | { |
| 1411 | return std::unique_ptr<IWorkload>(); |
| 1412 | } |
| 1413 | |
Aron Virginas-Tar | 639fb04 | 2019-06-20 14:28:19 +0100 | [diff] [blame] | 1414 | std::unique_ptr<IWorkload> IWorkloadFactory::CreateTransposeConvolution2d( |
| 1415 | const TransposeConvolution2dQueueDescriptor& descriptor, |
| 1416 | const WorkloadInfo& info) const |
| 1417 | { |
| 1418 | return std::unique_ptr<IWorkload>(); |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 1419 | } |
Aron Virginas-Tar | 639fb04 | 2019-06-20 14:28:19 +0100 | [diff] [blame] | 1420 | |
Aron Virginas-Tar | 636ab40 | 2019-09-16 14:27:45 +0100 | [diff] [blame] | 1421 | } // namepsace armnn |