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