Ferran Balaguer | f54c946 | 2019-07-10 12:43:58 +0100 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2017 Arm Ltd. All rights reserved. |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #include <armnn/BackendHelper.hpp> |
Matteo Martincigh | c601aa6 | 2019-10-29 15:03:22 +0000 | [diff] [blame] | 7 | #include <armnn/BackendRegistry.hpp> |
| 8 | |
Matteo Martincigh | e5b8eb9 | 2019-11-28 15:45:42 +0000 | [diff] [blame] | 9 | #include <armnn/backends/IBackendInternal.hpp> |
Ferran Balaguer | f54c946 | 2019-07-10 12:43:58 +0100 | [diff] [blame] | 10 | |
| 11 | namespace armnn |
| 12 | { |
| 13 | |
Francis Murtagh | 7909c53 | 2021-01-28 14:25:15 +0000 | [diff] [blame] | 14 | // Return LayerSupportHandle instead of the previous pointer to ILayerSupport. |
| 15 | LayerSupportHandle GetILayerSupportByBackendId(const armnn::BackendId& backend) |
Ferran Balaguer | f54c946 | 2019-07-10 12:43:58 +0100 | [diff] [blame] | 16 | { |
| 17 | BackendRegistry& backendRegistry = armnn::BackendRegistryInstance(); |
| 18 | |
| 19 | if (!backendRegistry.IsBackendRegistered(backend)) |
| 20 | { |
Francis Murtagh | 7909c53 | 2021-01-28 14:25:15 +0000 | [diff] [blame] | 21 | return LayerSupportHandle(nullptr); |
Ferran Balaguer | f54c946 | 2019-07-10 12:43:58 +0100 | [diff] [blame] | 22 | } |
| 23 | |
| 24 | auto factoryFunc = backendRegistry.GetFactory(backend); |
| 25 | auto backendObject = factoryFunc(); |
Sadik Armagan | f0a6dec | 2021-03-25 07:46:55 +0000 | [diff] [blame^] | 26 | return LayerSupportHandle(backendObject->GetLayerSupport(), backend); |
| 27 | } |
| 28 | |
| 29 | /// Convenience function to check a capability on a backend |
| 30 | bool IsCapabilitySupported(const armnn::BackendId& backend, armnn::BackendCapability capability) |
| 31 | { |
| 32 | bool hasCapability = false; |
| 33 | auto const& backendRegistry = armnn::BackendRegistryInstance(); |
| 34 | if (backendRegistry.IsBackendRegistered(backend)) |
| 35 | { |
| 36 | auto factoryFunc = backendRegistry.GetFactory(backend); |
| 37 | auto backendObject = factoryFunc(); |
| 38 | hasCapability = backendObject->HasCapability(capability); |
| 39 | } |
| 40 | return hasCapability; |
Ferran Balaguer | f54c946 | 2019-07-10 12:43:58 +0100 | [diff] [blame] | 41 | } |
| 42 | |
Francis Murtagh | 7909c53 | 2021-01-28 14:25:15 +0000 | [diff] [blame] | 43 | bool LayerSupportHandle::IsBackendRegistered() const |
| 44 | { |
| 45 | if (m_LayerSupport) |
| 46 | { |
| 47 | return true; |
| 48 | } |
| 49 | |
| 50 | return false; |
Ferran Balaguer | f54c946 | 2019-07-10 12:43:58 +0100 | [diff] [blame] | 51 | } |
Francis Murtagh | 7909c53 | 2021-01-28 14:25:15 +0000 | [diff] [blame] | 52 | |
| 53 | |
| 54 | bool LayerSupportHandle::IsAbsSupported(const TensorInfo& input, |
| 55 | const TensorInfo& output, |
| 56 | Optional<std::string&> reasonIfUnsupported) |
| 57 | { |
| 58 | // Call the IsXXXLayerSupport function of the specific backend. |
| 59 | return m_LayerSupport->IsAbsSupported(input, output, reasonIfUnsupported.value()); |
| 60 | } |
| 61 | |
| 62 | bool LayerSupportHandle::IsActivationSupported(const TensorInfo& input, |
| 63 | const TensorInfo& output, |
| 64 | const ActivationDescriptor& descriptor, |
| 65 | Optional<std::string&> reasonIfUnsupported) |
| 66 | { |
| 67 | return m_LayerSupport->IsActivationSupported(input, output, descriptor, reasonIfUnsupported.value()); |
| 68 | } |
| 69 | |
| 70 | bool LayerSupportHandle::IsAdditionSupported(const TensorInfo& input0, |
| 71 | const TensorInfo& input1, |
| 72 | const TensorInfo& output, |
| 73 | Optional<std::string&> reasonIfUnsupported) |
| 74 | { |
| 75 | return m_LayerSupport->IsAdditionSupported(input0, input1, output, reasonIfUnsupported.value()); |
| 76 | } |
| 77 | |
| 78 | bool LayerSupportHandle::IsArgMinMaxSupported(const TensorInfo& input, |
| 79 | const TensorInfo& output, |
| 80 | const ArgMinMaxDescriptor& descriptor, |
| 81 | Optional<std::string&> reasonIfUnsupported) |
| 82 | { |
| 83 | return m_LayerSupport->IsArgMinMaxSupported(input, output, descriptor, reasonIfUnsupported.value()); |
| 84 | } |
| 85 | |
| 86 | bool LayerSupportHandle::IsBatchNormalizationSupported(const TensorInfo& input, |
| 87 | const TensorInfo& output, |
| 88 | const TensorInfo& mean, |
| 89 | const TensorInfo& var, |
| 90 | const TensorInfo& beta, |
| 91 | const TensorInfo& gamma, |
| 92 | const BatchNormalizationDescriptor& descriptor, |
| 93 | Optional<std::string&> reasonIfUnsupported) |
| 94 | { |
| 95 | return m_LayerSupport->IsBatchNormalizationSupported(input, |
| 96 | output, |
| 97 | mean, |
| 98 | var, |
| 99 | beta, |
| 100 | gamma, |
| 101 | descriptor, |
| 102 | reasonIfUnsupported.value()); |
| 103 | } |
| 104 | |
| 105 | bool LayerSupportHandle::IsBatchToSpaceNdSupported(const TensorInfo& input, |
| 106 | const TensorInfo& output, |
| 107 | const BatchToSpaceNdDescriptor& descriptor, |
| 108 | Optional<std::string&> reasonIfUnsupported) |
| 109 | { |
| 110 | return m_LayerSupport->IsBatchToSpaceNdSupported(input, |
| 111 | output, |
| 112 | descriptor, |
| 113 | reasonIfUnsupported.value()); |
| 114 | } |
| 115 | |
| 116 | bool LayerSupportHandle::IsComparisonSupported(const TensorInfo& input0, |
| 117 | const TensorInfo& input1, |
| 118 | const TensorInfo& output, |
| 119 | const ComparisonDescriptor& descriptor, |
| 120 | Optional<std::string&> reasonIfUnsupported) |
| 121 | { |
| 122 | return m_LayerSupport->IsComparisonSupported(input0, input1, output, descriptor, reasonIfUnsupported.value()); |
| 123 | } |
| 124 | |
| 125 | bool LayerSupportHandle::IsConcatSupported(const std::vector<const TensorInfo*> inputs, |
| 126 | const TensorInfo& output, |
| 127 | const OriginsDescriptor& descriptor, |
| 128 | Optional<std::string&> reasonIfUnsupported) |
| 129 | { |
| 130 | return m_LayerSupport->IsConcatSupported(inputs, output, descriptor, reasonIfUnsupported.value()); |
| 131 | } |
| 132 | |
| 133 | bool LayerSupportHandle::IsConstantSupported(const TensorInfo& output, |
| 134 | Optional<std::string&> reasonIfUnsupported) |
| 135 | { |
| 136 | return m_LayerSupport->IsConstantSupported(output, reasonIfUnsupported.value()); |
| 137 | } |
| 138 | |
| 139 | bool LayerSupportHandle::IsConvertBf16ToFp32Supported(const TensorInfo& input, |
| 140 | const TensorInfo& output, |
| 141 | Optional<std::string&> reasonIfUnsupported) |
| 142 | { |
| 143 | return m_LayerSupport->IsConvertBf16ToFp32Supported(input, output, reasonIfUnsupported.value()); |
| 144 | } |
| 145 | |
| 146 | bool LayerSupportHandle::IsConvertFp32ToBf16Supported(const TensorInfo& input, |
| 147 | const TensorInfo& output, |
| 148 | Optional<std::string&> reasonIfUnsupported) |
| 149 | { |
| 150 | return m_LayerSupport->IsConvertFp32ToBf16Supported(input, output, reasonIfUnsupported.value()); |
| 151 | } |
| 152 | |
| 153 | bool LayerSupportHandle::IsConvertFp16ToFp32Supported(const TensorInfo& input, |
| 154 | const TensorInfo& output, |
| 155 | Optional<std::string&> reasonIfUnsupported) |
| 156 | { |
| 157 | return m_LayerSupport->IsConvertFp16ToFp32Supported(input, output, reasonIfUnsupported.value()); |
| 158 | } |
| 159 | |
| 160 | bool LayerSupportHandle::IsConvertFp32ToFp16Supported(const TensorInfo& input, |
| 161 | const TensorInfo& output, |
| 162 | Optional<std::string&> reasonIfUnsupported) |
| 163 | { |
| 164 | return m_LayerSupport->IsConvertFp32ToFp16Supported(input, output, reasonIfUnsupported.value()); |
| 165 | } |
| 166 | |
| 167 | bool LayerSupportHandle::IsConvolution2dSupported(const TensorInfo& input, |
| 168 | const TensorInfo& output, |
| 169 | const Convolution2dDescriptor& descriptor, |
| 170 | const TensorInfo& weights, |
| 171 | const Optional<TensorInfo>& biases, |
| 172 | Optional<std::string&> reasonIfUnsupported) |
| 173 | { |
| 174 | return m_LayerSupport->IsConvolution2dSupported(input, |
| 175 | output, |
| 176 | descriptor, |
| 177 | weights, |
| 178 | biases, |
| 179 | reasonIfUnsupported.value()); |
| 180 | } |
| 181 | |
| 182 | bool LayerSupportHandle::IsDebugSupported(const TensorInfo& input, |
| 183 | const TensorInfo& output, |
| 184 | Optional<std::string&> reasonIfUnsupported) |
| 185 | { |
| 186 | return m_LayerSupport->IsDebugSupported(input, output, reasonIfUnsupported.value()); |
| 187 | } |
| 188 | |
| 189 | bool LayerSupportHandle::IsDepthToSpaceSupported(const TensorInfo& input, |
| 190 | const TensorInfo& output, |
| 191 | const DepthToSpaceDescriptor& descriptor, |
| 192 | Optional<std::string&> reasonIfUnsupported) |
| 193 | { |
| 194 | return m_LayerSupport->IsDepthToSpaceSupported(input, output, descriptor, reasonIfUnsupported.value()); |
| 195 | } |
| 196 | |
| 197 | bool LayerSupportHandle::IsDepthwiseConvolutionSupported( |
| 198 | const TensorInfo& input, |
| 199 | const TensorInfo& output, |
| 200 | const DepthwiseConvolution2dDescriptor& descriptor, |
| 201 | const TensorInfo& weights, |
| 202 | const Optional<TensorInfo>& biases, |
| 203 | Optional<std::string&> reasonIfUnsupported) |
| 204 | { |
| 205 | return m_LayerSupport->IsDepthwiseConvolutionSupported(input, |
| 206 | output, |
| 207 | descriptor, |
| 208 | weights, |
| 209 | biases, |
| 210 | reasonIfUnsupported.value()); |
| 211 | } |
| 212 | |
| 213 | bool LayerSupportHandle::IsDequantizeSupported(const TensorInfo& input, |
| 214 | const TensorInfo& output, |
| 215 | Optional<std::string&> reasonIfUnsupported) |
| 216 | { |
| 217 | return m_LayerSupport->IsDequantizeSupported(input, output, reasonIfUnsupported.value()); |
| 218 | } |
| 219 | |
| 220 | bool LayerSupportHandle::IsDetectionPostProcessSupported(const TensorInfo& boxEncodings, |
| 221 | const TensorInfo& scores, |
| 222 | const TensorInfo& anchors, |
| 223 | const TensorInfo& detectionBoxes, |
| 224 | const TensorInfo& detectionClasses, |
| 225 | const TensorInfo& detectionScores, |
| 226 | const TensorInfo& numDetections, |
| 227 | const DetectionPostProcessDescriptor& descriptor, |
| 228 | Optional<std::string&> reasonIfUnsupported) |
| 229 | { |
| 230 | return m_LayerSupport->IsDetectionPostProcessSupported(boxEncodings, |
| 231 | scores, |
| 232 | anchors, |
| 233 | detectionBoxes, |
| 234 | detectionClasses, |
| 235 | detectionScores, |
| 236 | numDetections, |
| 237 | descriptor, |
| 238 | reasonIfUnsupported); |
| 239 | } |
| 240 | |
| 241 | bool LayerSupportHandle::IsDilatedDepthwiseConvolutionSupported( |
| 242 | const TensorInfo& input, |
| 243 | const TensorInfo& output, |
| 244 | const DepthwiseConvolution2dDescriptor& descriptor, |
| 245 | const TensorInfo& weights, |
| 246 | const Optional<TensorInfo>& biases, |
| 247 | Optional<std::string&> reasonIfUnsupported) |
| 248 | { |
| 249 | return m_LayerSupport->IsDilatedDepthwiseConvolutionSupported(input, |
| 250 | output, |
| 251 | descriptor, |
| 252 | weights, |
| 253 | biases, |
| 254 | reasonIfUnsupported); |
| 255 | } |
| 256 | |
| 257 | bool LayerSupportHandle::IsDivisionSupported(const TensorInfo& input0, |
| 258 | const TensorInfo& input1, |
| 259 | const TensorInfo& output, |
| 260 | Optional<std::string&> reasonIfUnsupported) |
| 261 | { |
| 262 | return m_LayerSupport->IsDivisionSupported(input0, input1, output, reasonIfUnsupported.value()); |
| 263 | } |
| 264 | |
| 265 | bool LayerSupportHandle::IsElementwiseUnarySupported(const TensorInfo& input, |
| 266 | const TensorInfo& output, |
| 267 | const ElementwiseUnaryDescriptor& descriptor, |
| 268 | Optional<std::string&> reasonIfUnsupported) |
| 269 | { |
| 270 | return m_LayerSupport->IsElementwiseUnarySupported(input, output, descriptor, reasonIfUnsupported.value()); |
| 271 | } |
| 272 | |
| 273 | bool LayerSupportHandle::IsEqualSupported(const TensorInfo& input0, |
| 274 | const TensorInfo& input1, |
| 275 | const TensorInfo& output, |
| 276 | Optional<std::string&> reasonIfUnsupported) |
| 277 | { |
| 278 | return m_LayerSupport->IsEqualSupported(input0, input1, output, reasonIfUnsupported.value()); |
| 279 | } |
| 280 | |
| 281 | bool LayerSupportHandle::IsFakeQuantizationSupported(const TensorInfo& input, |
| 282 | const FakeQuantizationDescriptor& descriptor, |
| 283 | Optional<std::string&> reasonIfUnsupported) |
| 284 | { |
| 285 | return m_LayerSupport->IsFakeQuantizationSupported(input, descriptor, reasonIfUnsupported.value()); |
| 286 | } |
| 287 | |
| 288 | bool LayerSupportHandle::IsFillSupported(const TensorInfo& input, |
| 289 | const TensorInfo& output, |
| 290 | const FillDescriptor& descriptor, |
| 291 | Optional<std::string&> reasonIfUnsupported) |
| 292 | { |
| 293 | return m_LayerSupport->IsFillSupported(input, output, descriptor, reasonIfUnsupported.value()); |
| 294 | } |
| 295 | |
| 296 | bool LayerSupportHandle::IsFloorSupported(const TensorInfo& input, |
| 297 | const TensorInfo& output, |
| 298 | Optional<std::string&> reasonIfUnsupported) |
| 299 | { |
| 300 | return m_LayerSupport->IsFloorSupported(input, output, reasonIfUnsupported.value()); |
| 301 | } |
| 302 | |
| 303 | bool LayerSupportHandle::IsFullyConnectedSupported(const TensorInfo& input, |
| 304 | const TensorInfo& output, |
| 305 | const TensorInfo& weights, |
| 306 | const TensorInfo& biases, |
| 307 | const FullyConnectedDescriptor& descriptor, |
| 308 | Optional<std::string&> reasonIfUnsupported) |
| 309 | { |
Sadik Armagan | f0a6dec | 2021-03-25 07:46:55 +0000 | [diff] [blame^] | 310 | if(!descriptor.m_ConstantWeights && !m_BackendId.IsUndefined()) |
| 311 | { |
| 312 | bool result = false; |
| 313 | result = IsCapabilitySupported(m_BackendId, BackendCapability::NonConstWeights); |
| 314 | if (!result) |
| 315 | { |
| 316 | return result; |
| 317 | } |
| 318 | } |
| 319 | |
Francis Murtagh | 7909c53 | 2021-01-28 14:25:15 +0000 | [diff] [blame] | 320 | return m_LayerSupport->IsFullyConnectedSupported(input, |
| 321 | output, |
| 322 | weights, |
| 323 | biases, |
| 324 | descriptor, |
| 325 | reasonIfUnsupported.value()); |
| 326 | } |
| 327 | |
| 328 | bool LayerSupportHandle::IsGatherSupported(const TensorInfo& input0, |
| 329 | const TensorInfo& input1, |
| 330 | const TensorInfo& output, |
| 331 | Optional<std::string&> reasonIfUnsupported) |
| 332 | { |
| 333 | return m_LayerSupport->IsGatherSupported(input0, input1, output, reasonIfUnsupported.value()); |
| 334 | } |
| 335 | |
| 336 | bool LayerSupportHandle::IsGatherSupported(const TensorInfo& input0, |
| 337 | const TensorInfo& input1, |
| 338 | const TensorInfo& output, |
| 339 | const GatherDescriptor& descriptor, |
| 340 | Optional<std::string&> reasonIfUnsupported) |
| 341 | { |
| 342 | return m_LayerSupport->IsGatherSupported(input0, input1, output, descriptor, reasonIfUnsupported.value()); |
| 343 | } |
| 344 | |
| 345 | bool LayerSupportHandle::IsGreaterSupported(const TensorInfo& input0, |
| 346 | const TensorInfo& input1, |
| 347 | const TensorInfo& ouput, |
| 348 | Optional<std::string&> reasonIfUnsupported) |
| 349 | { |
| 350 | return m_LayerSupport->IsGreaterSupported(input0, input1, ouput, reasonIfUnsupported.value()); |
| 351 | } |
| 352 | |
| 353 | bool LayerSupportHandle::IsInputSupported(const TensorInfo& input, |
| 354 | Optional<std::string&> reasonIfUnsupported) |
| 355 | { |
| 356 | return m_LayerSupport->IsInputSupported(input, reasonIfUnsupported.value()); |
| 357 | } |
| 358 | |
| 359 | bool LayerSupportHandle::IsInstanceNormalizationSupported( |
| 360 | const TensorInfo& input, |
| 361 | const TensorInfo& output, |
| 362 | const InstanceNormalizationDescriptor& descriptor, |
| 363 | Optional<std::string&> reasonIfUnsupported) |
| 364 | { |
| 365 | return m_LayerSupport->IsInstanceNormalizationSupported(input, output, descriptor, reasonIfUnsupported.value()); |
| 366 | } |
| 367 | |
| 368 | bool LayerSupportHandle::IsL2NormalizationSupported(const TensorInfo& input, |
| 369 | const TensorInfo& output, |
| 370 | const L2NormalizationDescriptor& descriptor, |
| 371 | Optional<std::string&> reasonIfUnsupported) |
| 372 | { |
| 373 | return m_LayerSupport->IsL2NormalizationSupported(input, output, descriptor, reasonIfUnsupported.value()); |
| 374 | } |
| 375 | |
| 376 | bool LayerSupportHandle::IsLogicalBinarySupported(const TensorInfo& input0, |
| 377 | const TensorInfo& input1, |
| 378 | const TensorInfo& output, |
| 379 | const LogicalBinaryDescriptor& descriptor, |
| 380 | Optional<std::string&> reasonIfUnsupported) |
| 381 | { |
| 382 | return m_LayerSupport->IsLogicalBinarySupported(input0, |
| 383 | input1, |
| 384 | output, |
| 385 | descriptor, |
| 386 | reasonIfUnsupported.value()); |
| 387 | } |
| 388 | |
| 389 | bool LayerSupportHandle::IsLogicalUnarySupported(const TensorInfo& input, |
| 390 | const TensorInfo& output, |
| 391 | const ElementwiseUnaryDescriptor& descriptor, |
| 392 | Optional<std::string&> reasonIfUnsupported) |
| 393 | { |
| 394 | return m_LayerSupport->IsLogicalUnarySupported(input, output, descriptor, reasonIfUnsupported.value()); |
| 395 | } |
| 396 | |
| 397 | bool LayerSupportHandle::IsLogSoftmaxSupported(const TensorInfo& input, |
| 398 | const TensorInfo& output, |
| 399 | const LogSoftmaxDescriptor& descriptor, |
| 400 | Optional<std::string&> reasonIfUnsupported) |
| 401 | { |
| 402 | return m_LayerSupport->IsLogSoftmaxSupported(input, output, descriptor, reasonIfUnsupported.value()); |
| 403 | } |
| 404 | |
| 405 | bool LayerSupportHandle::IsLstmSupported(const TensorInfo& input, |
| 406 | const TensorInfo& outputStateIn, |
| 407 | const TensorInfo& cellStateIn, |
| 408 | const TensorInfo& scratchBuffer, |
| 409 | const TensorInfo& outputStateOut, |
| 410 | const TensorInfo& cellStateOut, |
| 411 | const TensorInfo& output, |
| 412 | const LstmDescriptor& descriptor, |
| 413 | const LstmInputParamsInfo& paramsInfo, |
| 414 | Optional<std::string&> reasonIfUnsupported) |
| 415 | { |
| 416 | return m_LayerSupport->IsLstmSupported(input, |
| 417 | outputStateIn, |
| 418 | cellStateIn, |
| 419 | scratchBuffer, |
| 420 | outputStateOut, |
| 421 | cellStateOut, |
| 422 | output, |
| 423 | descriptor, |
| 424 | paramsInfo, |
| 425 | reasonIfUnsupported); |
| 426 | } |
| 427 | |
| 428 | bool LayerSupportHandle::IsMaximumSupported(const TensorInfo& input0, |
| 429 | const TensorInfo& input1, |
| 430 | const TensorInfo& output, |
| 431 | Optional<std::string&> reasonIfUnsupported) |
| 432 | { |
| 433 | return m_LayerSupport->IsMaximumSupported(input0, input1, output, reasonIfUnsupported.value()); |
| 434 | } |
| 435 | |
| 436 | bool LayerSupportHandle::IsMeanSupported(const TensorInfo& input, |
| 437 | const TensorInfo& output, |
| 438 | const MeanDescriptor& descriptor, |
| 439 | Optional<std::string&> reasonIfUnsupported) |
| 440 | { |
| 441 | return m_LayerSupport->IsMeanSupported(input, output, descriptor, reasonIfUnsupported.value()); |
| 442 | } |
| 443 | |
| 444 | bool LayerSupportHandle::IsMemCopySupported(const TensorInfo& input, |
| 445 | const TensorInfo& output, |
| 446 | Optional<std::string&> reasonIfUnsupported) |
| 447 | { |
| 448 | return m_LayerSupport->IsMemCopySupported(input, output, reasonIfUnsupported.value()); |
| 449 | } |
| 450 | |
| 451 | bool LayerSupportHandle::IsMemImportSupported(const TensorInfo& input, |
| 452 | const TensorInfo& output, |
| 453 | Optional<std::string&> reasonIfUnsupported) |
| 454 | { |
| 455 | return m_LayerSupport->IsMemImportSupported(input, output, reasonIfUnsupported.value()); |
| 456 | } |
| 457 | |
| 458 | bool LayerSupportHandle::IsMergeSupported(const TensorInfo& input0, |
| 459 | const TensorInfo& input1, |
| 460 | const TensorInfo& output, |
| 461 | Optional<std::string&> reasonIfUnsupported) |
| 462 | { |
| 463 | return m_LayerSupport->IsMergeSupported(input0, input1, output, reasonIfUnsupported.value()); |
| 464 | } |
| 465 | |
| 466 | bool LayerSupportHandle::IsMergerSupported(const std::vector<const TensorInfo*> inputs, |
| 467 | const TensorInfo& output, |
| 468 | const OriginsDescriptor& descriptor, |
| 469 | Optional<std::string&> reasonIfUnsupported) |
| 470 | { |
| 471 | return m_LayerSupport->IsMergerSupported(inputs, output, descriptor, reasonIfUnsupported.value()); |
| 472 | } |
| 473 | |
| 474 | bool LayerSupportHandle::IsMinimumSupported(const TensorInfo& input0, |
| 475 | const TensorInfo& input1, |
| 476 | const TensorInfo& output, |
| 477 | Optional<std::string&> reasonIfUnsupported) |
| 478 | { |
| 479 | return m_LayerSupport->IsMinimumSupported(input0, input1, output, reasonIfUnsupported.value()); |
| 480 | } |
| 481 | |
| 482 | bool LayerSupportHandle::IsMultiplicationSupported(const TensorInfo& input0, |
| 483 | const TensorInfo& input1, |
| 484 | const TensorInfo& output, |
| 485 | Optional<std::string&> reasonIfUnsupported) |
| 486 | { |
| 487 | return m_LayerSupport->IsMultiplicationSupported(input0, input1, output, reasonIfUnsupported.value()); |
| 488 | } |
| 489 | |
| 490 | bool LayerSupportHandle::IsNormalizationSupported(const TensorInfo& input, |
| 491 | const TensorInfo& output, |
| 492 | const NormalizationDescriptor& descriptor, |
| 493 | Optional<std::string&> reasonIfUnsupported) |
| 494 | { |
| 495 | return m_LayerSupport->IsNormalizationSupported(input, output, descriptor, reasonIfUnsupported.value()); |
| 496 | } |
| 497 | |
| 498 | bool LayerSupportHandle::IsOutputSupported(const TensorInfo& output, |
| 499 | Optional<std::string&> reasonIfUnsupported) |
| 500 | { |
| 501 | return m_LayerSupport->IsOutputSupported(output, reasonIfUnsupported.value()); |
| 502 | } |
| 503 | |
| 504 | bool LayerSupportHandle::IsPadSupported(const TensorInfo& input, |
| 505 | const TensorInfo& output, |
| 506 | const PadDescriptor& descriptor, |
| 507 | Optional<std::string&> reasonIfUnsupported) |
| 508 | { |
| 509 | return m_LayerSupport->IsPadSupported(input, output, descriptor, reasonIfUnsupported.value()); |
| 510 | } |
| 511 | |
| 512 | bool LayerSupportHandle::IsPermuteSupported(const TensorInfo& input, |
| 513 | const TensorInfo& output, |
| 514 | const PermuteDescriptor& descriptor, |
| 515 | Optional<std::string&> reasonIfUnsupported) |
| 516 | { |
| 517 | return m_LayerSupport->IsPermuteSupported(input, output, descriptor, reasonIfUnsupported.value()); |
| 518 | } |
| 519 | |
| 520 | bool LayerSupportHandle::IsPooling2dSupported(const TensorInfo& input, |
| 521 | const TensorInfo& output, |
| 522 | const Pooling2dDescriptor& descriptor, |
| 523 | Optional<std::string&> reasonIfUnsupported) |
| 524 | { |
| 525 | return m_LayerSupport->IsPooling2dSupported(input, output, descriptor, reasonIfUnsupported.value()); |
| 526 | } |
| 527 | |
| 528 | bool LayerSupportHandle::IsPreCompiledSupported(const TensorInfo& input, |
| 529 | const PreCompiledDescriptor& descriptor, |
| 530 | Optional<std::string&> reasonIfUnsupported) |
| 531 | { |
| 532 | return m_LayerSupport->IsPreCompiledSupported(input, descriptor, reasonIfUnsupported.value()); |
| 533 | } |
| 534 | |
| 535 | bool LayerSupportHandle::IsPreluSupported(const TensorInfo& input, |
| 536 | const TensorInfo& alpha, |
| 537 | const TensorInfo& output, |
| 538 | Optional<std::string&> reasonIfUnsupported) |
| 539 | { |
| 540 | return m_LayerSupport->IsPreluSupported(input, alpha, output, reasonIfUnsupported.value()); |
| 541 | } |
| 542 | |
| 543 | bool LayerSupportHandle::IsQuantizeSupported(const TensorInfo& input, |
| 544 | const TensorInfo& output, |
| 545 | Optional<std::string&> reasonIfUnsupported) |
| 546 | { |
| 547 | return m_LayerSupport->IsQuantizeSupported(input, output, reasonIfUnsupported.value()); |
| 548 | } |
| 549 | |
| 550 | bool LayerSupportHandle::IsQLstmSupported(const TensorInfo& input, |
| 551 | const TensorInfo& previousOutputIn, |
| 552 | const TensorInfo& previousCellStateIn, |
| 553 | const TensorInfo& outputStateOut, |
| 554 | const TensorInfo& cellStateOut, |
| 555 | const TensorInfo& output, |
| 556 | const QLstmDescriptor& descriptor, |
| 557 | const LstmInputParamsInfo& paramsInfo, |
| 558 | Optional<std::string&> reasonIfUnsupported) |
| 559 | { |
| 560 | return m_LayerSupport->IsQLstmSupported(input, |
| 561 | previousOutputIn, |
| 562 | previousCellStateIn, |
| 563 | outputStateOut, |
| 564 | cellStateOut, |
| 565 | output, |
| 566 | descriptor, |
| 567 | paramsInfo, |
| 568 | reasonIfUnsupported); |
| 569 | } |
| 570 | |
| 571 | bool LayerSupportHandle::IsQuantizedLstmSupported(const TensorInfo& input, |
| 572 | const TensorInfo& previousCellStateIn, |
| 573 | const TensorInfo& previousOutputIn, |
| 574 | const TensorInfo& cellStateOut, |
| 575 | const TensorInfo& output, |
| 576 | const QuantizedLstmInputParamsInfo& paramsInfo, |
| 577 | Optional<std::string&> reasonIfUnsupported) |
| 578 | { |
| 579 | return m_LayerSupport->IsQuantizedLstmSupported(input, |
| 580 | previousCellStateIn, |
| 581 | previousOutputIn, |
| 582 | cellStateOut, |
| 583 | output, |
| 584 | paramsInfo, |
| 585 | reasonIfUnsupported); |
| 586 | } |
| 587 | |
| 588 | bool LayerSupportHandle::IsRankSupported(const TensorInfo& input, |
| 589 | const TensorInfo& output, |
| 590 | Optional<std::string&> reasonIfUnsupported) |
| 591 | { |
| 592 | return m_LayerSupport->IsRankSupported(input, output, reasonIfUnsupported.value()); |
| 593 | } |
| 594 | |
Sadik Armagan | a274748 | 2021-02-09 10:28:54 +0000 | [diff] [blame] | 595 | bool LayerSupportHandle::IsReduceSupported(const TensorInfo& input, |
| 596 | const TensorInfo& output, |
| 597 | const ReduceDescriptor& descriptor, |
| 598 | Optional<std::string&> reasonIfUnsupported) |
| 599 | { |
| 600 | return m_LayerSupport->IsReduceSupported(input, output, descriptor, reasonIfUnsupported.value()); |
| 601 | } |
| 602 | |
Francis Murtagh | 7909c53 | 2021-01-28 14:25:15 +0000 | [diff] [blame] | 603 | bool LayerSupportHandle::IsReshapeSupported(const TensorInfo& input, |
| 604 | const TensorInfo& output, |
| 605 | const ReshapeDescriptor& descriptor, |
| 606 | Optional<std::string&> reasonIfUnsupported) |
| 607 | { |
| 608 | return m_LayerSupport->IsReshapeSupported(input, output, descriptor, reasonIfUnsupported.value()); |
| 609 | } |
| 610 | |
| 611 | bool LayerSupportHandle::IsResizeBilinearSupported(const TensorInfo& input, |
| 612 | const TensorInfo& output, |
| 613 | Optional<std::string&> reasonIfUnsupported) |
| 614 | { |
| 615 | return m_LayerSupport->IsResizeBilinearSupported(input, output, reasonIfUnsupported.value()); |
| 616 | } |
| 617 | |
| 618 | bool LayerSupportHandle::IsResizeSupported(const TensorInfo& input, |
| 619 | const TensorInfo& output, |
| 620 | const ResizeDescriptor& descriptor, |
| 621 | Optional<std::string&> reasonIfUnsupported) |
| 622 | { |
| 623 | return m_LayerSupport->IsResizeSupported(input, output, descriptor, reasonIfUnsupported.value()); |
| 624 | } |
| 625 | |
| 626 | bool LayerSupportHandle::IsRsqrtSupported(const TensorInfo& input, |
| 627 | const TensorInfo& output, |
| 628 | Optional<std::string&> reasonIfUnsupported) |
| 629 | { |
| 630 | return m_LayerSupport->IsRsqrtSupported(input, output, reasonIfUnsupported.value()); |
| 631 | } |
| 632 | |
| 633 | bool LayerSupportHandle::IsSliceSupported(const TensorInfo& input, |
| 634 | const TensorInfo& output, |
| 635 | const SliceDescriptor& descriptor, |
| 636 | Optional<std::string&> reasonIfUnsupported) |
| 637 | { |
| 638 | return m_LayerSupport->IsSliceSupported(input, output, descriptor, reasonIfUnsupported.value()); |
| 639 | } |
| 640 | |
| 641 | bool LayerSupportHandle::IsSoftmaxSupported(const TensorInfo& input, |
| 642 | const TensorInfo& output, |
| 643 | const SoftmaxDescriptor& descriptor, |
| 644 | Optional<std::string&> reasonIfUnsupported) |
| 645 | { |
| 646 | return m_LayerSupport->IsSoftmaxSupported(input, output, descriptor, reasonIfUnsupported.value()); |
| 647 | } |
| 648 | |
| 649 | bool LayerSupportHandle::IsSpaceToBatchNdSupported(const TensorInfo& input, |
| 650 | const TensorInfo& output, |
| 651 | const SpaceToBatchNdDescriptor& descriptor, |
| 652 | Optional<std::string&> reasonIfUnsupported) |
| 653 | { |
| 654 | return m_LayerSupport->IsSpaceToBatchNdSupported(input, output, descriptor, reasonIfUnsupported.value()); |
| 655 | } |
| 656 | |
| 657 | bool LayerSupportHandle::IsSpaceToDepthSupported(const TensorInfo& input, |
| 658 | const TensorInfo& output, |
| 659 | const SpaceToDepthDescriptor& descriptor, |
| 660 | Optional<std::string&> reasonIfUnsupported) |
| 661 | { |
| 662 | return m_LayerSupport->IsSpaceToDepthSupported(input, output, descriptor, reasonIfUnsupported.value()); |
| 663 | } |
| 664 | |
| 665 | bool LayerSupportHandle::IsSplitterSupported(const TensorInfo& input, |
| 666 | const ViewsDescriptor& descriptor, |
| 667 | Optional<std::string&> reasonIfUnsupported) |
| 668 | { |
| 669 | return m_LayerSupport->IsSplitterSupported(input, descriptor, reasonIfUnsupported.value()); |
| 670 | } |
| 671 | |
| 672 | bool LayerSupportHandle::IsSplitterSupported(const TensorInfo& input, |
| 673 | const std::vector<std::reference_wrapper<TensorInfo>>& outputs, |
| 674 | const ViewsDescriptor& descriptor, |
| 675 | Optional<std::string&> reasonIfUnsupported) |
| 676 | { |
| 677 | return m_LayerSupport->IsSplitterSupported(input, outputs, descriptor, reasonIfUnsupported.value()); |
| 678 | } |
| 679 | |
| 680 | bool LayerSupportHandle::IsStackSupported(const std::vector<const TensorInfo*>& inputs, |
| 681 | const TensorInfo& output, |
| 682 | const StackDescriptor& descriptor, |
| 683 | Optional<std::string&> reasonIfUnsupported) |
| 684 | { |
| 685 | return m_LayerSupport->IsStackSupported(inputs, output, descriptor, reasonIfUnsupported.value()); |
| 686 | } |
| 687 | |
| 688 | bool LayerSupportHandle::IsStandInSupported(const std::vector<const TensorInfo*>& inputs, |
| 689 | const std::vector<const TensorInfo*>& outputs, |
| 690 | const StandInDescriptor& descriptor, |
| 691 | Optional<std::string&> reasonIfUnsupported) |
| 692 | { |
| 693 | return m_LayerSupport->IsStandInSupported(inputs, outputs, descriptor, reasonIfUnsupported.value()); |
| 694 | } |
| 695 | |
| 696 | |
| 697 | bool LayerSupportHandle::IsStridedSliceSupported(const TensorInfo& input, |
| 698 | const TensorInfo& output, |
| 699 | const StridedSliceDescriptor& descriptor, |
| 700 | Optional<std::string&> reasonIfUnsupported) |
| 701 | { |
| 702 | return m_LayerSupport->IsStridedSliceSupported(input, output, descriptor, reasonIfUnsupported.value()); |
| 703 | } |
| 704 | |
| 705 | bool LayerSupportHandle::IsSubtractionSupported(const TensorInfo& input0, |
| 706 | const TensorInfo& input1, |
| 707 | const TensorInfo& output, |
| 708 | Optional<std::string&> reasonIfUnsupported) |
| 709 | { |
| 710 | return m_LayerSupport->IsSubtractionSupported(input0, input1, output, reasonIfUnsupported.value()); |
| 711 | } |
| 712 | |
| 713 | bool LayerSupportHandle::IsSwitchSupported(const TensorInfo& input0, |
| 714 | const TensorInfo& input1, |
| 715 | const TensorInfo& output0, |
| 716 | const TensorInfo& output1, |
| 717 | Optional<std::string&> reasonIfUnsupported) |
| 718 | { |
| 719 | return m_LayerSupport->IsSwitchSupported(input0, input1, output0, output1, reasonIfUnsupported.value()); |
| 720 | } |
| 721 | |
| 722 | bool LayerSupportHandle::IsTransposeConvolution2dSupported( |
| 723 | const TensorInfo& input, |
| 724 | const TensorInfo& output, |
| 725 | const TransposeConvolution2dDescriptor& descriptor, |
| 726 | const TensorInfo& weights, |
| 727 | const Optional<TensorInfo>& biases, |
| 728 | Optional<std::string&> reasonIfUnsupported) |
| 729 | { |
| 730 | return m_LayerSupport->IsTransposeConvolution2dSupported(input, |
| 731 | output, |
| 732 | descriptor, |
| 733 | weights, |
| 734 | biases, |
| 735 | reasonIfUnsupported.value()); |
| 736 | } |
| 737 | |
| 738 | bool LayerSupportHandle::IsTransposeSupported(const TensorInfo& input, |
| 739 | const TensorInfo& output, |
| 740 | const TransposeDescriptor& descriptor, |
| 741 | Optional<std::string&> reasonIfUnsupported) |
| 742 | { |
| 743 | return m_LayerSupport->IsTransposeSupported(input, output, descriptor, reasonIfUnsupported.value()); |
| 744 | } |
| 745 | |
| 746 | } |