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