Ferran Balaguer | f54c946 | 2019-07-10 12:43:58 +0100 | [diff] [blame] | 1 | // |
Tianle Cheng | 2828818 | 2024-02-23 17:56:54 +0000 | [diff] [blame] | 2 | // Copyright © 2017-2019,2021-2024 Arm Ltd and Contributors. All rights reserved. |
Ferran Balaguer | f54c946 | 2019-07-10 12:43:58 +0100 | [diff] [blame] | 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #pragma once |
| 7 | |
| 8 | #include <armnn/BackendId.hpp> |
Finn Williams | b9af86e | 2021-05-26 18:38:12 +0100 | [diff] [blame] | 9 | #include <armnn/BackendOptions.hpp> |
Colm Donelan | a98e79a | 2022-12-06 21:32:29 +0000 | [diff] [blame] | 10 | #include <armnn/Descriptors.hpp> |
| 11 | #include <armnn/Optional.hpp> |
| 12 | #include <functional> |
| 13 | #include <memory> |
| 14 | #include <string> |
| 15 | #include <utility> |
| 16 | #include <vector> |
Ferran Balaguer | f54c946 | 2019-07-10 12:43:58 +0100 | [diff] [blame] | 17 | |
| 18 | namespace armnn |
| 19 | { |
Colm Donelan | a98e79a | 2022-12-06 21:32:29 +0000 | [diff] [blame] | 20 | class ILayerSupport; |
| 21 | class TensorInfo; |
| 22 | struct LstmInputParamsInfo; |
| 23 | struct QuantizedLstmInputParamsInfo; |
Ferran Balaguer | f54c946 | 2019-07-10 12:43:58 +0100 | [diff] [blame] | 24 | |
Francis Murtagh | 7909c53 | 2021-01-28 14:25:15 +0000 | [diff] [blame] | 25 | // This handle calls its own IsXXXLayerSupported() functions which then call the polymorphic |
| 26 | // ILayerSupport::IsXXXLayerSupported() at the framework level so there is no risk of VTable misalignment. |
| 27 | // This is to make ILayerSupport in its abstract form a solely Backend interface alongside a |
| 28 | // separate ABI stable frontend class free of virtual functions via an added layer of indirection. |
| 29 | class LayerSupportHandle |
| 30 | { |
| 31 | public: |
| 32 | explicit LayerSupportHandle(std::shared_ptr<ILayerSupport> layerSupport) |
Sadik Armagan | f0a6dec | 2021-03-25 07:46:55 +0000 | [diff] [blame] | 33 | : m_LayerSupport(std::move(layerSupport)), m_BackendId(Compute::Undefined) {}; |
| 34 | |
| 35 | explicit LayerSupportHandle(std::shared_ptr<ILayerSupport> layerSupport, const BackendId& backendId) |
| 36 | : m_LayerSupport(std::move(layerSupport)), m_BackendId(backendId) {}; |
Francis Murtagh | 7909c53 | 2021-01-28 14:25:15 +0000 | [diff] [blame] | 37 | |
| 38 | bool IsBackendRegistered() const; |
| 39 | |
Francis Murtagh | 7909c53 | 2021-01-28 14:25:15 +0000 | [diff] [blame] | 40 | bool IsActivationSupported(const TensorInfo& input, |
| 41 | const TensorInfo& output, |
| 42 | const ActivationDescriptor& descriptor, |
| 43 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 44 | |
Mike Kelly | 2c14db6 | 2023-03-15 15:06:23 +0000 | [diff] [blame] | 45 | ARMNN_DEPRECATED_MSG_REMOVAL_DATE("Use IsElementwiseBinarySupported instead", "24.02") |
Francis Murtagh | 7909c53 | 2021-01-28 14:25:15 +0000 | [diff] [blame] | 46 | bool IsAdditionSupported(const TensorInfo& input0, |
| 47 | const TensorInfo& input1, |
| 48 | const TensorInfo& output, |
| 49 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 50 | |
| 51 | bool IsArgMinMaxSupported(const TensorInfo& input, |
| 52 | const TensorInfo& output, |
| 53 | const ArgMinMaxDescriptor& descriptor, |
| 54 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 55 | |
Samuel Yap | 6b47809 | 2022-07-06 15:36:03 +0100 | [diff] [blame] | 56 | bool IsBatchMatMulSupported(const TensorInfo& input0, |
| 57 | const TensorInfo& input1, |
| 58 | const TensorInfo& output, |
| 59 | const BatchMatMulDescriptor& descriptor, |
| 60 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 61 | |
Francis Murtagh | 7909c53 | 2021-01-28 14:25:15 +0000 | [diff] [blame] | 62 | bool IsBatchNormalizationSupported(const TensorInfo& input, |
| 63 | const TensorInfo& output, |
| 64 | const TensorInfo& mean, |
| 65 | const TensorInfo& var, |
| 66 | const TensorInfo& beta, |
| 67 | const TensorInfo& gamma, |
| 68 | const BatchNormalizationDescriptor& descriptor, |
| 69 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 70 | |
| 71 | bool IsBatchToSpaceNdSupported(const TensorInfo& input, |
| 72 | const TensorInfo& output, |
| 73 | const BatchToSpaceNdDescriptor& descriptor, |
| 74 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 75 | |
Idriss Chaouch | 98e383e | 2023-08-28 14:28:31 +0100 | [diff] [blame] | 76 | |
| 77 | bool IsBroadcastToSupported(const TensorInfo& input, |
| 78 | const TensorInfo& output, |
| 79 | const BroadcastToDescriptor& descriptor, |
| 80 | Optional<std::string&> reasonIfUnsupported); |
| 81 | |
mathad01 | b392e98 | 2021-04-07 12:07:30 +0100 | [diff] [blame] | 82 | bool IsCastSupported(const TensorInfo& input, |
| 83 | const TensorInfo& output, |
| 84 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 85 | |
Simon Obute | 51f6777 | 2021-09-03 15:50:13 +0100 | [diff] [blame] | 86 | bool IsChannelShuffleSupported(const TensorInfo& input, |
| 87 | const TensorInfo& output, |
| 88 | const ChannelShuffleDescriptor& descriptor, |
| 89 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 90 | |
Francis Murtagh | 7909c53 | 2021-01-28 14:25:15 +0000 | [diff] [blame] | 91 | bool IsComparisonSupported(const TensorInfo& input0, |
| 92 | const TensorInfo& input1, |
| 93 | const TensorInfo& output, |
| 94 | const ComparisonDescriptor& descriptor, |
| 95 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 96 | |
| 97 | bool IsConcatSupported(const std::vector<const TensorInfo*> inputs, |
| 98 | const TensorInfo& output, |
| 99 | const OriginsDescriptor& descriptor, |
| 100 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 101 | |
| 102 | bool IsConstantSupported(const TensorInfo& output, |
| 103 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 104 | |
Francis Murtagh | 7909c53 | 2021-01-28 14:25:15 +0000 | [diff] [blame] | 105 | bool IsConvertFp16ToFp32Supported(const TensorInfo& input, |
| 106 | const TensorInfo& output, |
| 107 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 108 | |
| 109 | bool IsConvertFp32ToFp16Supported(const TensorInfo& input, |
| 110 | const TensorInfo& output, |
| 111 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 112 | |
| 113 | bool IsConvolution2dSupported(const TensorInfo& input, |
| 114 | const TensorInfo& output, |
| 115 | const Convolution2dDescriptor& descriptor, |
| 116 | const TensorInfo& weights, |
| 117 | const Optional<TensorInfo>& biases, |
| 118 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 119 | |
Matthew Sloyan | b63a311 | 2021-09-08 13:05:51 +0100 | [diff] [blame] | 120 | bool IsConvolution3dSupported(const TensorInfo& input, |
| 121 | const TensorInfo& output, |
| 122 | const Convolution3dDescriptor& descriptor, |
| 123 | const TensorInfo& weights, |
| 124 | const Optional<TensorInfo>& biases, |
| 125 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 126 | |
Francis Murtagh | 7909c53 | 2021-01-28 14:25:15 +0000 | [diff] [blame] | 127 | bool IsDebugSupported(const TensorInfo& input, |
| 128 | const TensorInfo& output, |
| 129 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 130 | |
| 131 | bool IsDepthToSpaceSupported(const TensorInfo& input, |
| 132 | const TensorInfo& output, |
| 133 | const DepthToSpaceDescriptor& descriptor, |
| 134 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 135 | |
| 136 | bool IsDepthwiseConvolutionSupported( |
| 137 | const TensorInfo& input, |
| 138 | const TensorInfo& output, |
| 139 | const DepthwiseConvolution2dDescriptor& descriptor, |
| 140 | const TensorInfo& weights, |
| 141 | const Optional<TensorInfo>& biases, |
| 142 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 143 | |
| 144 | bool IsDequantizeSupported(const TensorInfo& input, |
| 145 | const TensorInfo& output, |
| 146 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 147 | |
| 148 | bool IsDetectionPostProcessSupported(const TensorInfo& boxEncodings, |
| 149 | const TensorInfo& scores, |
| 150 | const TensorInfo& anchors, |
| 151 | const TensorInfo& detectionBoxes, |
| 152 | const TensorInfo& detectionClasses, |
| 153 | const TensorInfo& detectionScores, |
| 154 | const TensorInfo& numDetections, |
| 155 | const DetectionPostProcessDescriptor& descriptor, |
| 156 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 157 | |
| 158 | bool IsDilatedDepthwiseConvolutionSupported( |
| 159 | const TensorInfo& input, |
| 160 | const TensorInfo& output, |
| 161 | const DepthwiseConvolution2dDescriptor& descriptor, |
| 162 | const TensorInfo& weights, |
| 163 | const Optional<TensorInfo>& biases, |
| 164 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 165 | |
Mike Kelly | 2c14db6 | 2023-03-15 15:06:23 +0000 | [diff] [blame] | 166 | ARMNN_DEPRECATED_MSG_REMOVAL_DATE("Use IsElementwiseBinarySupported instead", "24.02") |
Francis Murtagh | 7909c53 | 2021-01-28 14:25:15 +0000 | [diff] [blame] | 167 | bool IsDivisionSupported(const TensorInfo& input0, |
| 168 | const TensorInfo& input1, |
| 169 | const TensorInfo& output, |
| 170 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 171 | |
Mike Kelly | 3ec3077 | 2023-03-08 13:47:17 +0000 | [diff] [blame] | 172 | bool IsElementwiseBinarySupported(const TensorInfo& input0, |
| 173 | const TensorInfo& input1, |
| 174 | const TensorInfo& output, |
| 175 | const ElementwiseBinaryDescriptor& descriptor, |
| 176 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 177 | |
Francis Murtagh | 7909c53 | 2021-01-28 14:25:15 +0000 | [diff] [blame] | 178 | bool IsElementwiseUnarySupported(const TensorInfo& input, |
| 179 | const TensorInfo& output, |
| 180 | const ElementwiseUnaryDescriptor& descriptor, |
| 181 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 182 | |
Francis Murtagh | 7909c53 | 2021-01-28 14:25:15 +0000 | [diff] [blame] | 183 | bool IsFakeQuantizationSupported(const TensorInfo& input, |
| 184 | const FakeQuantizationDescriptor& descriptor, |
| 185 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 186 | |
| 187 | bool IsFillSupported(const TensorInfo& input, |
| 188 | const TensorInfo& output, |
| 189 | const FillDescriptor& descriptor, |
| 190 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 191 | |
| 192 | bool IsFloorSupported(const TensorInfo& input, |
| 193 | const TensorInfo& output, |
| 194 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 195 | |
| 196 | bool IsFullyConnectedSupported(const TensorInfo& input, |
| 197 | const TensorInfo& output, |
| 198 | const TensorInfo& weights, |
| 199 | const TensorInfo& biases, |
| 200 | const FullyConnectedDescriptor& descriptor, |
| 201 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 202 | |
Teresa Charlin | 9145e38 | 2023-08-17 18:44:58 +0100 | [diff] [blame] | 203 | bool IsFusedSupported(const std::vector<std::reference_wrapper<TensorInfo>>& inputs, |
| 204 | const std::vector<std::reference_wrapper<TensorInfo>>& outputs, |
| 205 | const FusedDescriptor& descriptor, |
| 206 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 207 | |
Francis Murtagh | 7909c53 | 2021-01-28 14:25:15 +0000 | [diff] [blame] | 208 | bool IsGatherSupported(const TensorInfo& input0, |
| 209 | const TensorInfo& input1, |
| 210 | const TensorInfo& output, |
| 211 | const GatherDescriptor& descriptor, |
| 212 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 213 | |
Teresa Charlin | b2d3ec5 | 2022-04-12 22:07:09 +0100 | [diff] [blame] | 214 | bool IsGatherNdSupported(const TensorInfo& input0, |
| 215 | const TensorInfo& input1, |
| 216 | const TensorInfo& output, |
| 217 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 218 | |
Francis Murtagh | 7909c53 | 2021-01-28 14:25:15 +0000 | [diff] [blame] | 219 | bool IsInputSupported(const TensorInfo& input, |
| 220 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 221 | |
| 222 | bool IsInstanceNormalizationSupported( |
| 223 | const TensorInfo& input, |
| 224 | const TensorInfo& output, |
| 225 | const InstanceNormalizationDescriptor& descriptor, |
| 226 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 227 | |
| 228 | bool IsL2NormalizationSupported(const TensorInfo& input, |
| 229 | const TensorInfo& output, |
| 230 | const L2NormalizationDescriptor& descriptor, |
| 231 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 232 | |
| 233 | bool IsLogicalBinarySupported(const TensorInfo& input0, |
| 234 | const TensorInfo& input1, |
| 235 | const TensorInfo& output, |
| 236 | const LogicalBinaryDescriptor& descriptor, |
| 237 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 238 | |
| 239 | bool IsLogicalUnarySupported(const TensorInfo& input, |
| 240 | const TensorInfo& output, |
| 241 | const ElementwiseUnaryDescriptor& descriptor, |
| 242 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 243 | |
| 244 | bool IsLogSoftmaxSupported(const TensorInfo& input, |
| 245 | const TensorInfo& output, |
| 246 | const LogSoftmaxDescriptor& descriptor, |
| 247 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 248 | |
| 249 | bool IsLstmSupported(const TensorInfo& input, |
| 250 | const TensorInfo& outputStateIn, |
| 251 | const TensorInfo& cellStateIn, |
| 252 | const TensorInfo& scratchBuffer, |
| 253 | const TensorInfo& outputStateOut, |
| 254 | const TensorInfo& cellStateOut, |
| 255 | const TensorInfo& output, |
| 256 | const LstmDescriptor& descriptor, |
| 257 | const LstmInputParamsInfo& paramsInfo, |
| 258 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 259 | |
Mike Kelly | 2c14db6 | 2023-03-15 15:06:23 +0000 | [diff] [blame] | 260 | ARMNN_DEPRECATED_MSG_REMOVAL_DATE("Use IsElementwiseBinarySupported instead", "24.02") |
Francis Murtagh | 7909c53 | 2021-01-28 14:25:15 +0000 | [diff] [blame] | 261 | bool IsMaximumSupported(const TensorInfo& input0, |
| 262 | const TensorInfo& input1, |
| 263 | const TensorInfo& output, |
| 264 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 265 | |
| 266 | bool IsMeanSupported(const TensorInfo& input, |
| 267 | const TensorInfo& output, |
| 268 | const MeanDescriptor& descriptor, |
| 269 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 270 | |
| 271 | bool IsMemCopySupported(const TensorInfo& input, |
| 272 | const TensorInfo& output, |
| 273 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 274 | |
| 275 | bool IsMemImportSupported(const TensorInfo& input, |
| 276 | const TensorInfo& output, |
| 277 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 278 | |
| 279 | bool IsMergeSupported(const TensorInfo& input0, |
| 280 | const TensorInfo& input1, |
| 281 | const TensorInfo& output, |
| 282 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 283 | |
Mike Kelly | 2c14db6 | 2023-03-15 15:06:23 +0000 | [diff] [blame] | 284 | ARMNN_DEPRECATED_MSG_REMOVAL_DATE("Use IsElementwiseBinarySupported instead", "24.02") |
Francis Murtagh | 7909c53 | 2021-01-28 14:25:15 +0000 | [diff] [blame] | 285 | bool IsMinimumSupported(const TensorInfo& input0, |
| 286 | const TensorInfo& input1, |
| 287 | const TensorInfo& output, |
| 288 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 289 | |
Mike Kelly | 2c14db6 | 2023-03-15 15:06:23 +0000 | [diff] [blame] | 290 | ARMNN_DEPRECATED_MSG_REMOVAL_DATE("Use IsElementwiseBinarySupported instead", "24.02") |
Francis Murtagh | 7909c53 | 2021-01-28 14:25:15 +0000 | [diff] [blame] | 291 | bool IsMultiplicationSupported(const TensorInfo& input0, |
| 292 | const TensorInfo& input1, |
| 293 | const TensorInfo& output, |
| 294 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 295 | |
| 296 | bool IsNormalizationSupported(const TensorInfo& input, |
| 297 | const TensorInfo& output, |
| 298 | const NormalizationDescriptor& descriptor, |
| 299 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 300 | |
| 301 | bool IsOutputSupported(const TensorInfo& output, |
| 302 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 303 | |
| 304 | bool IsPadSupported(const TensorInfo& input, |
| 305 | const TensorInfo& output, |
| 306 | const PadDescriptor& descriptor, |
| 307 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 308 | |
| 309 | bool IsPermuteSupported(const TensorInfo& input, |
| 310 | const TensorInfo& output, |
| 311 | const PermuteDescriptor& descriptor, |
| 312 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 313 | |
| 314 | bool IsPooling2dSupported(const TensorInfo& input, |
| 315 | const TensorInfo& output, |
| 316 | const Pooling2dDescriptor& descriptor, |
| 317 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 318 | |
Tamás Nyíri | 7b885b3 | 2021-10-26 14:47:57 +0100 | [diff] [blame] | 319 | bool IsPooling3dSupported(const TensorInfo& input, |
| 320 | const TensorInfo& output, |
| 321 | const Pooling3dDescriptor& descriptor, |
| 322 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 323 | |
Francis Murtagh | 7909c53 | 2021-01-28 14:25:15 +0000 | [diff] [blame] | 324 | bool IsPreCompiledSupported(const TensorInfo& input, |
| 325 | const PreCompiledDescriptor& descriptor, |
| 326 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 327 | |
| 328 | bool IsPreluSupported(const TensorInfo& input, |
| 329 | const TensorInfo& alpha, |
| 330 | const TensorInfo& output, |
| 331 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 332 | |
| 333 | bool IsQuantizeSupported(const TensorInfo& input, |
| 334 | const TensorInfo& output, |
| 335 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 336 | |
| 337 | bool IsQLstmSupported(const TensorInfo& input, |
| 338 | const TensorInfo& previousOutputIn, |
| 339 | const TensorInfo& previousCellStateIn, |
| 340 | const TensorInfo& outputStateOut, |
| 341 | const TensorInfo& cellStateOut, |
| 342 | const TensorInfo& output, |
| 343 | const QLstmDescriptor& descriptor, |
| 344 | const LstmInputParamsInfo& paramsInfo, |
| 345 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 346 | |
| 347 | bool IsQuantizedLstmSupported(const TensorInfo& input, |
| 348 | const TensorInfo& previousCellStateIn, |
| 349 | const TensorInfo& previousOutputIn, |
| 350 | const TensorInfo& cellStateOut, |
| 351 | const TensorInfo& output, |
| 352 | const QuantizedLstmInputParamsInfo& paramsInfo, |
| 353 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 354 | |
| 355 | bool IsRankSupported(const TensorInfo& input, |
| 356 | const TensorInfo& output, |
| 357 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 358 | |
Sadik Armagan | a274748 | 2021-02-09 10:28:54 +0000 | [diff] [blame] | 359 | bool IsReduceSupported(const TensorInfo& input, |
| 360 | const TensorInfo& output, |
| 361 | const ReduceDescriptor& descriptor, |
| 362 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 363 | |
Francis Murtagh | 7909c53 | 2021-01-28 14:25:15 +0000 | [diff] [blame] | 364 | bool IsReshapeSupported(const TensorInfo& input, |
| 365 | const TensorInfo& output, |
| 366 | const ReshapeDescriptor& descriptor, |
| 367 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 368 | |
Francis Murtagh | 7909c53 | 2021-01-28 14:25:15 +0000 | [diff] [blame] | 369 | bool IsResizeSupported(const TensorInfo& input, |
| 370 | const TensorInfo& output, |
| 371 | const ResizeDescriptor& descriptor, |
| 372 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 373 | |
Tracy Narine | bb8d759 | 2023-07-13 16:50:54 +0100 | [diff] [blame] | 374 | bool IsReverseV2Supported(const TensorInfo& input0, |
| 375 | const TensorInfo& input1, |
Tianle Cheng | 988354d | 2023-06-28 13:20:47 +0100 | [diff] [blame] | 376 | const TensorInfo& output, |
Tianle Cheng | 988354d | 2023-06-28 13:20:47 +0100 | [diff] [blame] | 377 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 378 | |
Keith Davis | 3ae3f97 | 2021-05-21 16:33:48 +0100 | [diff] [blame] | 379 | bool IsShapeSupported(const TensorInfo& input, |
| 380 | const TensorInfo& output, |
| 381 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 382 | |
Tianle Cheng | 2828818 | 2024-02-23 17:56:54 +0000 | [diff] [blame] | 383 | bool IsScatterNdSupported(const TensorInfo& input, |
| 384 | const TensorInfo& indices, |
| 385 | const TensorInfo& updates, |
| 386 | const TensorInfo& output, |
| 387 | const ScatterNdDescriptor& descriptor, |
| 388 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 389 | |
Francis Murtagh | 7909c53 | 2021-01-28 14:25:15 +0000 | [diff] [blame] | 390 | bool IsSliceSupported(const TensorInfo& input, |
| 391 | const TensorInfo& output, |
| 392 | const SliceDescriptor& descriptor, |
| 393 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 394 | |
| 395 | bool IsSoftmaxSupported(const TensorInfo& input, |
| 396 | const TensorInfo& output, |
| 397 | const SoftmaxDescriptor& descriptor, |
| 398 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 399 | |
| 400 | bool IsSpaceToBatchNdSupported(const TensorInfo& input, |
| 401 | const TensorInfo& output, |
| 402 | const SpaceToBatchNdDescriptor& descriptor, |
| 403 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 404 | |
| 405 | bool IsSpaceToDepthSupported(const TensorInfo& input, |
| 406 | const TensorInfo& output, |
| 407 | const SpaceToDepthDescriptor& descriptor, |
| 408 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 409 | |
Francis Murtagh | 7909c53 | 2021-01-28 14:25:15 +0000 | [diff] [blame] | 410 | bool IsSplitterSupported(const TensorInfo& input, |
| 411 | const std::vector<std::reference_wrapper<TensorInfo>>& outputs, |
| 412 | const ViewsDescriptor& descriptor, |
| 413 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 414 | |
| 415 | bool IsStackSupported(const std::vector<const TensorInfo*>& inputs, |
| 416 | const TensorInfo& output, |
| 417 | const StackDescriptor& descriptor, |
| 418 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 419 | |
| 420 | bool IsStandInSupported(const std::vector<const TensorInfo*>& inputs, |
| 421 | const std::vector<const TensorInfo*>& outputs, |
| 422 | const StandInDescriptor& descriptor, |
| 423 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 424 | |
| 425 | |
| 426 | bool IsStridedSliceSupported(const TensorInfo& input, |
| 427 | const TensorInfo& output, |
| 428 | const StridedSliceDescriptor& descriptor, |
| 429 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 430 | |
Mike Kelly | 2c14db6 | 2023-03-15 15:06:23 +0000 | [diff] [blame] | 431 | ARMNN_DEPRECATED_MSG_REMOVAL_DATE("Use IsElementwiseBinarySupported instead", "24.02") |
Francis Murtagh | 7909c53 | 2021-01-28 14:25:15 +0000 | [diff] [blame] | 432 | bool IsSubtractionSupported(const TensorInfo& input0, |
| 433 | const TensorInfo& input1, |
| 434 | const TensorInfo& output, |
| 435 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 436 | |
| 437 | bool IsSwitchSupported(const TensorInfo& input0, |
| 438 | const TensorInfo& input1, |
| 439 | const TensorInfo& output0, |
| 440 | const TensorInfo& output1, |
| 441 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 442 | |
Teresa Charlin | 79a06a5 | 2023-07-13 17:16:45 +0100 | [diff] [blame] | 443 | bool IsTileSupported(const TensorInfo& input, |
| 444 | const TensorInfo& output, |
| 445 | const TileDescriptor& descriptor, |
| 446 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 447 | |
Francis Murtagh | 7909c53 | 2021-01-28 14:25:15 +0000 | [diff] [blame] | 448 | bool IsTransposeConvolution2dSupported( |
| 449 | const TensorInfo& input, |
| 450 | const TensorInfo& output, |
| 451 | const TransposeConvolution2dDescriptor& descriptor, |
| 452 | const TensorInfo& weights, |
| 453 | const Optional<TensorInfo>& biases, |
| 454 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 455 | |
| 456 | bool IsTransposeSupported(const TensorInfo& input, |
| 457 | const TensorInfo& output, |
| 458 | const TransposeDescriptor& descriptor, |
| 459 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 460 | |
Narumol Prangnawarat | 8ed39ae | 2021-07-15 16:16:25 +0100 | [diff] [blame] | 461 | bool IsUnidirectionalSequenceLstmSupported( |
| 462 | const TensorInfo& input, |
| 463 | const TensorInfo& outputStateIn, |
| 464 | const TensorInfo& cellStateIn, |
Mike Kelly | 1299496 | 2022-04-21 11:57:09 +0100 | [diff] [blame] | 465 | const TensorInfo& outputStateOut, |
| 466 | const TensorInfo& cellStateOut, |
Narumol Prangnawarat | 8ed39ae | 2021-07-15 16:16:25 +0100 | [diff] [blame] | 467 | const TensorInfo& output, |
Narumol Prangnawarat | 8ed39ae | 2021-07-15 16:16:25 +0100 | [diff] [blame] | 468 | const LstmDescriptor& descriptor, |
| 469 | const LstmInputParamsInfo& paramsInfo, |
| 470 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()); |
| 471 | |
Francis Murtagh | 7909c53 | 2021-01-28 14:25:15 +0000 | [diff] [blame] | 472 | private: |
| 473 | std::shared_ptr<ILayerSupport> m_LayerSupport; |
Sadik Armagan | f0a6dec | 2021-03-25 07:46:55 +0000 | [diff] [blame] | 474 | const BackendId m_BackendId; |
Francis Murtagh | 7909c53 | 2021-01-28 14:25:15 +0000 | [diff] [blame] | 475 | }; |
| 476 | |
| 477 | /// Convenience function to retrieve the ILayerSupportHandle for a backend |
| 478 | LayerSupportHandle GetILayerSupportByBackendId(const armnn::BackendId& backend); |
Ferran Balaguer | f54c946 | 2019-07-10 12:43:58 +0100 | [diff] [blame] | 479 | |
Finn Williams | b9af86e | 2021-05-26 18:38:12 +0100 | [diff] [blame] | 480 | /// Convenience function to check if a capability exists in a BackendCapabilites struct |
| 481 | bool HasCapability(const std::string& name,const BackendCapabilities& capabilities); |
| 482 | |
| 483 | /// Convenience function to check if a capability exists in a backend |
| 484 | bool HasCapability(const std::string& name, const armnn::BackendId& backend); |
| 485 | |
| 486 | /// Convenience function to check if a given capability matches a capability in a BackendCapabilities struct |
Colm Donelan | 2812484 | 2023-08-01 14:57:25 +0100 | [diff] [blame] | 487 | ARMNN_DEPRECATED_MSG_REMOVAL_DATE("Use HasMatchingCapability instead.", "24.05") |
Finn Williams | b9af86e | 2021-05-26 18:38:12 +0100 | [diff] [blame] | 488 | bool HasCapability(const BackendOptions::BackendOption& capability, const BackendCapabilities& capabilities); |
| 489 | |
| 490 | /// Convenience function to check if a given capability matches a capability in a backend |
Colm Donelan | 2812484 | 2023-08-01 14:57:25 +0100 | [diff] [blame] | 491 | ARMNN_DEPRECATED_MSG_REMOVAL_DATE("Use HasMatchingCapability instead.", "24.05") |
Finn Williams | b9af86e | 2021-05-26 18:38:12 +0100 | [diff] [blame] | 492 | bool HasCapability(const BackendOptions::BackendOption& backendOption, const armnn::BackendId& backend); |
| 493 | |
Colm Donelan | 2812484 | 2023-08-01 14:57:25 +0100 | [diff] [blame] | 494 | /// Convenience function to check if a given capability matches a capability in a BackendCapabilities struct |
| 495 | bool HasMatchingCapability(const BackendOptions::BackendOption& capability, const BackendCapabilities& capabilities); |
| 496 | |
| 497 | /// Convenience function to check if a given capability matches a capability in a backend |
| 498 | bool HasMatchingCapability(const BackendOptions::BackendOption& backendOption, const armnn::BackendId& backend); |
| 499 | |
Finn Williams | b9af86e | 2021-05-26 18:38:12 +0100 | [diff] [blame] | 500 | /// Returns a BackendCapability if the backend lists the capability |
| 501 | /// The BackendCapability must then be inspected to check whether or not that BackendCapability is supported |
| 502 | /// Otherwise returns an EmptyOptional if the BackendCapability is unlisted |
| 503 | Optional<const BackendOptions::BackendOption> GetCapability(const std::string& backendCapabilityName, |
| 504 | const BackendCapabilities& capabilities); |
| 505 | |
| 506 | /// Returns a BackendCapability if the backend lists the capability |
| 507 | /// The BackendCapability must then be inspected to check whether or not that BackendCapability is supported |
| 508 | /// Otherwise returns an EmptyOptional if the BackendCapability is unlisted |
| 509 | Optional<const BackendOptions::BackendOption> GetCapability(const std::string& backendCapabilityName, |
| 510 | const armnn::BackendId& backend); |
| 511 | |
Sadik Armagan | b7851f9 | 2021-10-06 16:37:02 +0100 | [diff] [blame] | 512 | /// Returns the number of cached files if backend supports caching |
| 513 | unsigned int GetNumberOfCacheFiles(const armnn::BackendId& backend); |
| 514 | |
Ferran Balaguer | f54c946 | 2019-07-10 12:43:58 +0100 | [diff] [blame] | 515 | } |