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