telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 1 | // |
Mike Kelly | 3ec3077 | 2023-03-08 13:47:17 +0000 | [diff] [blame] | 2 | // Copyright © 2017-2023 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 | // |
| 5 | |
| 6 | #include "NeonLayerSupport.hpp" |
David Beck | 3e9e115 | 2018-10-17 14:17:50 +0100 | [diff] [blame] | 7 | #include "NeonBackendId.hpp" |
Sadik Armagan | 045f6be | 2020-09-10 13:37:32 +0100 | [diff] [blame] | 8 | #include "NeonBackendModelContext.hpp" |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 9 | |
Derek Lamberti | c77874a | 2020-04-28 13:34:56 +0100 | [diff] [blame] | 10 | #include <armnn/Exceptions.hpp> |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 11 | #include <armnn/Tensor.hpp> |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 12 | #include <armnn/Types.hpp> |
Matteo Martincigh | c601aa6 | 2019-10-29 15:03:22 +0000 | [diff] [blame] | 13 | #include <armnn/BackendRegistry.hpp> |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 14 | |
Matteo Martincigh | c601aa6 | 2019-10-29 15:03:22 +0000 | [diff] [blame] | 15 | #include <InternalTypes.hpp> |
| 16 | #include <LayerSupportCommon.hpp> |
Jan Eilers | 8eb2560 | 2020-03-09 12:13:48 +0000 | [diff] [blame] | 17 | #include <armnn/utility/IgnoreUnused.hpp> |
Sadik Armagan | 045f6be | 2020-09-10 13:37:32 +0100 | [diff] [blame] | 18 | #include <armnn/utility/PolymorphicDowncast.hpp> |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 19 | |
Matteo Martincigh | d95e906 | 2019-01-31 15:35:59 +0000 | [diff] [blame] | 20 | #if defined(ARMCOMPUTENEON_ENABLED) |
Narumol Prangnawarat | 15eb583 | 2019-05-20 15:31:05 +0100 | [diff] [blame] | 21 | #include <aclCommon/ArmComputeUtils.hpp> |
Aron Virginas-Tar | 710f664 | 2019-11-27 14:48:32 +0000 | [diff] [blame] | 22 | #include <aclCommon/ArmComputeTensorUtils.hpp> |
Aron Virginas-Tar | 914e4db | 2019-09-09 13:36:45 +0100 | [diff] [blame] | 23 | #include "workloads/NeonAbsWorkload.hpp" |
Matthew Bentham | 955258d | 2018-12-10 10:48:52 +0000 | [diff] [blame] | 24 | #include "workloads/NeonAdditionWorkload.hpp" |
Nattapat Chaimanowong | d4b7059 | 2018-10-12 11:21:49 +0100 | [diff] [blame] | 25 | #include "workloads/NeonActivationWorkload.hpp" |
James Conroy | d47a064 | 2019-09-17 14:22:06 +0100 | [diff] [blame] | 26 | #include "workloads/NeonArgMinMaxWorkload.hpp" |
Teresa Charlin | 0f86ecf | 2022-10-13 15:47:08 +0100 | [diff] [blame] | 27 | #include "workloads/NeonBatchMatMulWorkload.hpp" |
Matthew Bentham | c48ac8c | 2018-12-12 16:15:59 +0000 | [diff] [blame] | 28 | #include "workloads/NeonBatchNormalizationWorkload.hpp" |
Mike Kelly | 5685802 | 2020-01-27 12:14:47 +0000 | [diff] [blame] | 29 | #include "workloads/NeonBatchToSpaceNdWorkload.hpp" |
Sadik Armagan | 48f011e | 2021-04-21 10:50:34 +0100 | [diff] [blame] | 30 | #include "workloads/NeonCastWorkload.hpp" |
Teresa Charlin | e89dd69 | 2021-09-01 16:30:34 +0100 | [diff] [blame] | 31 | #include "workloads/NeonChannelShuffleWorkload.hpp" |
Teresa Charlin | cedd34f | 2020-03-30 11:17:30 +0100 | [diff] [blame] | 32 | #include "workloads/NeonComparisonWorkload.hpp" |
Teresa Charlin | e89dd69 | 2021-09-01 16:30:34 +0100 | [diff] [blame] | 33 | #include "workloads/NeonConcatWorkload.hpp" |
Mike Kelly | 0886ac4 | 2020-04-27 09:55:40 +0100 | [diff] [blame] | 34 | #include "workloads/NeonConstantWorkload.hpp" |
Matthew Bentham | 34336f9 | 2023-04-27 12:13:50 +0000 | [diff] [blame] | 35 | #include "workloads/NeonConvertFp16ToFp32Workload.hpp" |
| 36 | #include "workloads/NeonConvertFp32ToFp16Workload.hpp" |
Nattapat Chaimanowong | 974b65f | 2018-10-15 15:07:34 +0100 | [diff] [blame] | 37 | #include "workloads/NeonConvolution2dWorkload.hpp" |
Teresa Charlin | ec5f7d1 | 2021-10-22 17:15:00 +0100 | [diff] [blame] | 38 | #include "workloads/NeonConvolution3dWorkload.hpp" |
Aron Virginas-Tar | 2f00b74 | 2019-09-30 13:28:08 +0100 | [diff] [blame] | 39 | #include "workloads/NeonDepthToSpaceWorkload.hpp" |
Nattapat Chaimanowong | 7714088 | 2018-10-17 11:12:19 +0100 | [diff] [blame] | 40 | #include "workloads/NeonDepthwiseConvolutionWorkload.hpp" |
Narumol Prangnawarat | 01961a7 | 2019-05-30 16:47:12 +0100 | [diff] [blame] | 41 | #include "workloads/NeonDequantizeWorkload.hpp" |
Teresa Charlin | e89dd69 | 2021-09-01 16:30:34 +0100 | [diff] [blame] | 42 | #include "workloads/NeonExpWorkload.hpp" |
Sadik Armagan | 0d4863d | 2019-10-09 14:26:32 +0100 | [diff] [blame] | 43 | #include "workloads/NeonInstanceNormalizationWorkload.hpp" |
David Beck | 0dbe0ee | 2018-09-24 15:59:27 +0100 | [diff] [blame] | 44 | #include "workloads/NeonL2NormalizationFloatWorkload.hpp" |
Teresa Charlin | 50de4fa | 2021-05-31 18:47:33 +0100 | [diff] [blame] | 45 | #include "workloads/NeonLogWorkload.hpp" |
Keith Davis | 69e653f | 2020-07-02 11:49:26 +0100 | [diff] [blame] | 46 | #include "workloads/NeonLogSoftmaxWorkload.hpp" |
James Conroy | 177df1e | 2020-11-13 10:18:51 +0000 | [diff] [blame] | 47 | #include "workloads/NeonLogicalAndWorkload.hpp" |
| 48 | #include "workloads/NeonLogicalNotWorkload.hpp" |
| 49 | #include "workloads/NeonLogicalOrWorkload.hpp" |
Jan Eilers | ad5293a | 2019-07-08 09:57:55 +0100 | [diff] [blame] | 50 | #include "workloads/NeonLstmFloatWorkload.hpp" |
Nattapat Chaimanowong | 4e6597a | 2018-12-20 14:14:06 +0000 | [diff] [blame] | 51 | #include "workloads/NeonMaximumWorkload.hpp" |
Matthew Bentham | fd89996 | 2018-12-31 15:49:42 +0000 | [diff] [blame] | 52 | #include "workloads/NeonMeanWorkload.hpp" |
Conor Kennedy | 54b2169 | 2019-01-09 07:57:38 +0000 | [diff] [blame] | 53 | #include "workloads/NeonMinimumWorkload.hpp" |
Conor Kennedy | b99480b | 2019-03-08 08:24:41 +0000 | [diff] [blame] | 54 | #include "workloads/NeonMultiplicationWorkload.hpp" |
Pablo Tello | e61f071 | 2020-01-23 10:37:17 +0000 | [diff] [blame] | 55 | #include "workloads/NeonDivisionWorkload.hpp" |
Sadik Armagan | ac47210 | 2020-03-24 09:54:36 +0000 | [diff] [blame] | 56 | #include "workloads/NeonNegWorkload.hpp" |
David Beck | 0dbe0ee | 2018-09-24 15:59:27 +0100 | [diff] [blame] | 57 | #include "workloads/NeonNormalizationFloatWorkload.hpp" |
| 58 | #include "workloads/NeonFullyConnectedWorkload.hpp" |
Teresa Charlin | f540eb8 | 2020-04-10 19:24:55 +0100 | [diff] [blame] | 59 | #include "workloads/NeonGatherWorkload.hpp" |
Teresa Charlin | bd22c7d | 2022-04-26 18:14:12 +0100 | [diff] [blame] | 60 | #include "workloads/NeonGatherNdWorkload.hpp" |
Éanna Ó Catháin | 1205574 | 2019-01-25 10:01:40 +0000 | [diff] [blame] | 61 | #include "workloads/NeonPadWorkload.hpp" |
David Beck | 0dbe0ee | 2018-09-24 15:59:27 +0100 | [diff] [blame] | 62 | #include "workloads/NeonPermuteWorkload.hpp" |
Nattapat Chaimanowong | 5d2e700 | 2018-10-12 16:03:56 +0100 | [diff] [blame] | 63 | #include "workloads/NeonPooling2dWorkload.hpp" |
Ryan OShea | 19e7942 | 2022-05-04 00:38:03 +0100 | [diff] [blame] | 64 | #include "workloads/NeonPooling3dWorkload.hpp" |
Nikhil Raj | 9b46148 | 2019-07-03 15:58:31 +0100 | [diff] [blame] | 65 | #include "workloads/NeonPreluWorkload.hpp" |
James Conroy | cc34093 | 2020-05-12 18:08:52 +0100 | [diff] [blame] | 66 | #include "workloads/NeonQLstmWorkload.hpp" |
Sadik Armagan | fabc289 | 2019-05-31 09:05:11 +0100 | [diff] [blame] | 67 | #include "workloads/NeonQuantizeWorkload.hpp" |
Francis Murtagh | 4fc3c48 | 2019-08-02 13:20:54 +0100 | [diff] [blame] | 68 | #include "workloads/NeonQuantizedLstmWorkload.hpp" |
Sadik Armagan | a274748 | 2021-02-09 10:28:54 +0000 | [diff] [blame] | 69 | #include "workloads/NeonReduceWorkload.hpp" |
Kevin May | a023c40 | 2019-12-12 17:28:05 +0000 | [diff] [blame] | 70 | #include "workloads/NeonReshapeWorkload.hpp" |
Ellen Norris-Thompson | 37e6868 | 2019-07-15 14:23:30 +0100 | [diff] [blame] | 71 | #include "workloads/NeonResizeWorkload.hpp" |
Aron Virginas-Tar | 0dd3b43 | 2019-09-10 13:55:09 +0100 | [diff] [blame] | 72 | #include "workloads/NeonRsqrtWorkload.hpp" |
Teresa Charlin | 50de4fa | 2021-05-31 18:47:33 +0100 | [diff] [blame] | 73 | #include "workloads/NeonSinWorkload.hpp" |
josh minor | 036f02d | 2019-11-15 14:53:22 -0600 | [diff] [blame] | 74 | #include "workloads/NeonSliceWorkload.hpp" |
Sadik Armagan | be88a57 | 2020-04-30 11:39:37 +0100 | [diff] [blame] | 75 | #include "workloads/NeonSoftmaxWorkload.hpp" |
Mike Kelly | 0be3a88 | 2020-01-24 11:27:50 +0000 | [diff] [blame] | 76 | #include "workloads/NeonSpaceToBatchNdWorkload.hpp" |
Ellen Norris-Thompson | 2979457 | 2019-06-26 16:40:36 +0100 | [diff] [blame] | 77 | #include "workloads/NeonSpaceToDepthWorkload.hpp" |
Narumol Prangnawarat | 15eb583 | 2019-05-20 15:31:05 +0100 | [diff] [blame] | 78 | #include "workloads/NeonSplitterWorkload.hpp" |
Teresa Charlin | 06145cc | 2022-05-05 15:31:30 +0100 | [diff] [blame] | 79 | #include "workloads/NeonSqrtWorkload.hpp" |
Matthew Jackson | 87f65ea | 2019-08-01 10:01:34 +0100 | [diff] [blame] | 80 | #include "workloads/NeonStackWorkload.hpp" |
FinnWilliamsArm | 1fa1919 | 2019-08-02 17:26:31 +0100 | [diff] [blame] | 81 | #include "workloads/NeonStridedSliceWorkload.hpp" |
Conor Kennedy | b99480b | 2019-03-08 08:24:41 +0000 | [diff] [blame] | 82 | #include "workloads/NeonSubtractionWorkload.hpp" |
Sadik Armagan | 581742d | 2019-08-12 14:11:37 +0100 | [diff] [blame] | 83 | #include "workloads/NeonTransposeConvolution2dWorkload.hpp" |
Mike Kelly | c9ea45a | 2020-02-28 18:11:58 +0000 | [diff] [blame] | 84 | #include "workloads/NeonTransposeWorkload.hpp" |
Cathal Corbett | fd5bec4 | 2022-03-03 15:13:23 +0000 | [diff] [blame] | 85 | #include "workloads/NeonUnidirectionalSequenceLstmFloatWorkload.hpp" |
Mike Kelly | 1299496 | 2022-04-21 11:57:09 +0100 | [diff] [blame] | 86 | #include "workloads/NeonUnidirectionalSequenceLstmWorkload.hpp" |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 87 | #endif |
| 88 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 89 | namespace armnn |
| 90 | { |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 91 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 92 | namespace |
arovir01 | 7ff76c5 | 2018-10-09 09:40:58 +0100 | [diff] [blame] | 93 | { |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 94 | |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 95 | const TensorInfo OverrideDataType(const TensorInfo& info, Optional<DataType> type) |
| 96 | { |
| 97 | if (!type) |
| 98 | { |
| 99 | return info; |
| 100 | } |
| 101 | return TensorInfo(info.GetShape(), |
| 102 | type.value(), |
| 103 | info.GetQuantizationScale(), |
| 104 | info.GetQuantizationOffset(), |
| 105 | info.IsConstant()); |
| 106 | } |
| 107 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 108 | template< typename ... Args> |
| 109 | bool IsNeonBackendSupported(Optional<std::string&> reasonIfUnsupported, Args... args) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 110 | { |
Jan Eilers | 8eb2560 | 2020-03-09 12:13:48 +0000 | [diff] [blame] | 111 | IgnoreUnused(reasonIfUnsupported, (args)...); |
Matteo Martincigh | d95e906 | 2019-01-31 15:35:59 +0000 | [diff] [blame] | 112 | #if defined(ARMCOMPUTENEON_ENABLED) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 113 | return true; |
| 114 | #else |
Derek Lamberti | 0790dce | 2019-04-15 18:37:35 +0100 | [diff] [blame] | 115 | SetValueChecked(reasonIfUnsupported, "The armnn library has been built without NEON support"); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 116 | return false; |
| 117 | #endif |
| 118 | } |
| 119 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 120 | template<typename FloatFunc, typename Uint8Func, typename ... Params> |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 121 | bool IsSupportedForDataTypeNeon(Optional<std::string&> reasonIfUnsupported, |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 122 | DataType dataType, |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 123 | FloatFunc floatFuncPtr, |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 124 | Uint8Func uint8FuncPtr, |
| 125 | Params&&... params) |
| 126 | { |
| 127 | return IsNeonBackendSupported(reasonIfUnsupported) && |
| 128 | IsSupportedForDataTypeGeneric(reasonIfUnsupported, |
| 129 | dataType, |
| 130 | floatFuncPtr, |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 131 | floatFuncPtr, |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 132 | uint8FuncPtr, |
narpra01 | db2b160 | 2019-01-23 15:23:11 +0000 | [diff] [blame] | 133 | &FalseFunc<>, |
kevmay01 | 2b4d88e | 2019-01-24 14:05:09 +0000 | [diff] [blame] | 134 | &FalseFunc<>, |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 135 | std::forward<Params>(params)...); |
| 136 | } |
| 137 | |
Matteo Martincigh | d95e906 | 2019-01-31 15:35:59 +0000 | [diff] [blame] | 138 | #if defined(ARMCOMPUTENEON_ENABLED) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 139 | template<class FuncType, class... Args> |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 140 | inline bool IsWorkloadSupported(FuncType& func, Optional<std::string&> reasonIfUnsupported, Args&&... args) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 141 | { |
| 142 | arm_compute::Status aclStatus = func(std::forward<Args>(args)...); |
| 143 | const bool supported = (aclStatus.error_code() == arm_compute::ErrorCode::OK); |
| 144 | if (!supported && reasonIfUnsupported) |
| 145 | { |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 146 | reasonIfUnsupported.value() = aclStatus.error_description(); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 147 | } |
| 148 | return supported; |
| 149 | } |
| 150 | |
| 151 | #define FORWARD_WORKLOAD_VALIDATE_FUNC(func, reasonIfUnsupported, ...) \ |
| 152 | return IsWorkloadSupported(func, reasonIfUnsupported, __VA_ARGS__); |
| 153 | #else |
| 154 | #define FORWARD_WORKLOAD_VALIDATE_FUNC(func, reasonIfUnsupported, ...) \ |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 155 | return IsNeonBackendSupported(reasonIfUnsupported, __VA_ARGS__); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 156 | #endif |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 157 | } // anonymous namespace |
| 158 | |
Sadik Armagan | 045f6be | 2020-09-10 13:37:32 +0100 | [diff] [blame] | 159 | NeonLayerSupport::NeonLayerSupport(const IBackendInternal::IBackendSpecificModelContextPtr& modelContextPtr) |
| 160 | : m_ModelContextPtr(modelContextPtr) |
| 161 | { |
| 162 | } |
| 163 | |
| 164 | NeonLayerSupport::NeonLayerSupport() |
| 165 | : m_ModelContextPtr(nullptr) |
| 166 | { |
| 167 | } |
| 168 | |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 169 | bool IsLayerTypeSupported(const LayerType& type, |
| 170 | const std::vector<TensorInfo>& infos, |
| 171 | const BaseDescriptor& descriptor, |
| 172 | const Optional<LstmInputParamsInfo>& lstmParamsInfo, |
| 173 | const Optional<QuantizedLstmInputParamsInfo>& quantizedLstmParamsInfo, |
| 174 | Optional<std::string&> reasonIfUnsupported, |
| 175 | const NeonLayerSupport& support) |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 176 | { |
| 177 | switch (type) |
| 178 | { |
| 179 | case LayerType::Activation: |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 180 | return support.IsActivationSupported(infos[0], |
| 181 | infos[1], |
| 182 | *(PolymorphicDowncast<const ActivationDescriptor*>(&descriptor)), |
| 183 | reasonIfUnsupported); |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 184 | case LayerType::Addition: |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 185 | return support.IsAdditionSupported(infos[0], infos[1], infos[2], reasonIfUnsupported); |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 186 | case LayerType::ArgMinMax: |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 187 | return support.IsArgMinMaxSupported(infos[0], |
| 188 | infos[1], |
| 189 | *(PolymorphicDowncast<const ArgMinMaxDescriptor*>(&descriptor)), |
| 190 | reasonIfUnsupported); |
Teresa Charlin | 0f86ecf | 2022-10-13 15:47:08 +0100 | [diff] [blame] | 191 | case LayerType::BatchMatMul: |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 192 | return support.IsBatchMatMulSupported(infos[0], |
| 193 | infos[1], |
| 194 | infos[2], |
| 195 | *(PolymorphicDowncast<const BatchMatMulDescriptor*>(&descriptor)), |
| 196 | reasonIfUnsupported); |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 197 | case LayerType::BatchNormalization: |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 198 | return support.IsBatchNormalizationSupported(infos[0], |
| 199 | infos[1], |
| 200 | infos[2], |
| 201 | infos[3], |
| 202 | infos[4], |
| 203 | infos[5], |
| 204 | *(PolymorphicDowncast<const |
| 205 | BatchNormalizationDescriptor*>(&descriptor)), |
| 206 | reasonIfUnsupported); |
| 207 | case LayerType::BatchToSpaceNd: |
| 208 | return support.IsBatchToSpaceNdSupported(infos[0], |
| 209 | infos[1], |
| 210 | *(PolymorphicDowncast<const |
| 211 | BatchToSpaceNdDescriptor*>(&descriptor)), |
| 212 | reasonIfUnsupported); |
| 213 | case LayerType::Cast: |
| 214 | return support.IsCastSupported(infos[0], infos[1], reasonIfUnsupported); |
| 215 | case LayerType::ChannelShuffle: |
| 216 | return support.IsChannelShuffleSupported(infos[0], |
| 217 | infos[1], |
| 218 | *(PolymorphicDowncast<const |
| 219 | ChannelShuffleDescriptor*>(&descriptor)), |
| 220 | reasonIfUnsupported); |
| 221 | case LayerType::Comparison: |
| 222 | return support.IsComparisonSupported(infos[0], |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 223 | infos[1], |
| 224 | infos[2], |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 225 | *(PolymorphicDowncast<const ComparisonDescriptor*>(&descriptor)), |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 226 | reasonIfUnsupported); |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 227 | case LayerType::Concat: |
| 228 | { |
| 229 | std::vector<const TensorInfo*> inputInfos; |
| 230 | for (uint32_t i = 0; i < (infos.size() - 1); i++) |
| 231 | { |
| 232 | inputInfos.push_back(&infos[i]); |
| 233 | } |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 234 | return support.IsConcatSupported(inputInfos, |
| 235 | infos[infos.size() - 1], |
| 236 | *(PolymorphicDowncast<const OriginsDescriptor*>(&descriptor)), |
| 237 | reasonIfUnsupported); |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 238 | } |
| 239 | case LayerType::Constant: |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 240 | return support.IsConstantSupported(infos[0], reasonIfUnsupported); |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 241 | case LayerType::ConvertFp16ToFp32: |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 242 | return support.IsConvertFp16ToFp32Supported(infos[0], infos[1], reasonIfUnsupported); |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 243 | case LayerType::ConvertFp32ToFp16: |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 244 | return support.IsConvertFp32ToFp16Supported(infos[0], infos[1], reasonIfUnsupported); |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 245 | case LayerType::Convolution2d: |
| 246 | { |
| 247 | if (infos.size() != 4) |
| 248 | { |
| 249 | throw InvalidArgumentException("Invalid number of TransposeConvolution2d TensorInfos. " |
| 250 | "TensorInfos should be of format: {input, output, weights, biases}."); |
| 251 | } |
| 252 | |
| 253 | auto desc = *(PolymorphicDowncast<const Convolution2dDescriptor*>(&descriptor)); |
| 254 | if (infos[3] == TensorInfo()) |
| 255 | { |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 256 | return support.IsConvolution2dSupported(infos[0], |
| 257 | infos[1], |
| 258 | desc, |
| 259 | infos[2], |
| 260 | EmptyOptional(), |
| 261 | reasonIfUnsupported); |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 262 | } |
| 263 | else |
| 264 | { |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 265 | return support.IsConvolution2dSupported(infos[0], |
| 266 | infos[1], |
| 267 | desc, |
| 268 | infos[2], |
| 269 | infos[3], |
| 270 | reasonIfUnsupported); |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 271 | } |
| 272 | } |
Cathal Corbett | 4952a3e | 2022-03-03 15:14:18 +0000 | [diff] [blame] | 273 | case LayerType::Convolution3d: |
| 274 | { |
| 275 | if (infos.size() != 4) |
| 276 | { |
| 277 | throw InvalidArgumentException("Invalid number of Convolution3d TensorInfos. " |
| 278 | "TensorInfos should be of format: {input, output, weights, biases}."); |
| 279 | } |
| 280 | |
| 281 | auto desc = *(PolymorphicDowncast<const Convolution3dDescriptor*>(&descriptor)); |
| 282 | if (infos[3] == TensorInfo()) |
| 283 | { |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 284 | return support.IsConvolution3dSupported(infos[0], |
| 285 | infos[1], |
| 286 | desc, |
| 287 | infos[2], |
| 288 | EmptyOptional(), |
| 289 | reasonIfUnsupported); |
Cathal Corbett | 4952a3e | 2022-03-03 15:14:18 +0000 | [diff] [blame] | 290 | } |
| 291 | else |
| 292 | { |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 293 | return support.IsConvolution3dSupported(infos[0], |
| 294 | infos[1], |
| 295 | desc, |
| 296 | infos[2], |
| 297 | infos[3], |
| 298 | reasonIfUnsupported); |
Cathal Corbett | 4952a3e | 2022-03-03 15:14:18 +0000 | [diff] [blame] | 299 | } |
| 300 | } |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 301 | case LayerType::DepthToSpace: |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 302 | return support.IsDepthToSpaceSupported(infos[0], |
| 303 | infos[1], |
| 304 | *(PolymorphicDowncast<const DepthToSpaceDescriptor*>(&descriptor)), |
| 305 | reasonIfUnsupported); |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 306 | case LayerType::DepthwiseConvolution2d: |
| 307 | { |
| 308 | if (infos.size() != 4) |
| 309 | { |
| 310 | throw InvalidArgumentException("Invalid number of DepthwiseConvolution2d TensorInfos. " |
| 311 | "TensorInfos should be of format: {input, output, weights, biases}."); |
| 312 | } |
| 313 | |
| 314 | auto desc = *(PolymorphicDowncast<const DepthwiseConvolution2dDescriptor*>(&descriptor)); |
| 315 | if (infos[3] == TensorInfo()) |
| 316 | { |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 317 | return support.IsDepthwiseConvolutionSupported(infos[0], |
| 318 | infos[1], |
| 319 | desc, |
| 320 | infos[2], |
| 321 | EmptyOptional(), |
| 322 | reasonIfUnsupported); |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 323 | } |
| 324 | else |
| 325 | { |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 326 | return support.IsDepthwiseConvolutionSupported(infos[0], |
| 327 | infos[1], |
| 328 | desc, |
| 329 | infos[2], |
| 330 | infos[3], |
| 331 | reasonIfUnsupported); |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 332 | } |
| 333 | } |
| 334 | case LayerType::Dequantize: |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 335 | return support.IsDequantizeSupported(infos[0], infos[1], reasonIfUnsupported); |
Cathal Corbett | 4952a3e | 2022-03-03 15:14:18 +0000 | [diff] [blame] | 336 | case LayerType::DetectionPostProcess: |
| 337 | { |
| 338 | auto desc = *(PolymorphicDowncast<const DetectionPostProcessDescriptor*>(&descriptor)); |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 339 | return support.IsDetectionPostProcessSupported(infos[0], |
| 340 | infos[1], |
| 341 | infos[2], |
| 342 | infos[3], |
| 343 | infos[4], |
| 344 | infos[5], |
| 345 | infos[6], |
| 346 | desc, |
| 347 | reasonIfUnsupported); |
Cathal Corbett | 4952a3e | 2022-03-03 15:14:18 +0000 | [diff] [blame] | 348 | } |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 349 | case LayerType::Division: |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 350 | return support.IsDivisionSupported(infos[0], infos[1], infos[2], reasonIfUnsupported); |
Mike Kelly | 3ec3077 | 2023-03-08 13:47:17 +0000 | [diff] [blame] | 351 | case LayerType::ElementwiseBinary: |
| 352 | { |
| 353 | auto desc = *(PolymorphicDowncast<const ElementwiseBinaryDescriptor *>(&descriptor)); |
| 354 | |
| 355 | switch (desc.m_Operation) |
| 356 | { |
| 357 | case BinaryOperation::Add: |
| 358 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonAdditionWorkloadValidate, |
| 359 | reasonIfUnsupported, |
| 360 | infos[0], |
| 361 | infos[1], |
| 362 | infos[2], |
| 363 | nullptr); |
| 364 | case BinaryOperation::Div: |
| 365 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonDivisionWorkloadValidate, |
| 366 | reasonIfUnsupported, |
| 367 | infos[0], |
| 368 | infos[1], |
| 369 | infos[2], |
| 370 | nullptr); |
| 371 | case BinaryOperation::Maximum: |
| 372 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonMaximumWorkloadValidate, |
| 373 | reasonIfUnsupported, |
| 374 | infos[0], |
| 375 | infos[1], |
| 376 | infos[2]); |
| 377 | case BinaryOperation::Minimum: |
| 378 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonMinimumWorkloadValidate, |
| 379 | reasonIfUnsupported, |
| 380 | infos[0], |
| 381 | infos[1], |
| 382 | infos[2]); |
| 383 | case BinaryOperation::Mul: |
| 384 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonMultiplicationWorkloadValidate, |
| 385 | reasonIfUnsupported, |
| 386 | infos[0], |
| 387 | infos[1], |
| 388 | infos[2], |
| 389 | nullptr); |
| 390 | case BinaryOperation::Sub: |
| 391 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonSubtractionWorkloadValidate, |
| 392 | reasonIfUnsupported, |
| 393 | infos[0], |
| 394 | infos[1], |
| 395 | infos[2], |
| 396 | nullptr); |
| 397 | default: |
| 398 | return false; |
| 399 | } |
| 400 | } |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 401 | case LayerType::ElementwiseUnary: |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 402 | return support.IsElementwiseUnarySupported(infos[0], |
| 403 | infos[1], |
| 404 | *(PolymorphicDowncast<const |
| 405 | ElementwiseUnaryDescriptor*>(&descriptor)), |
| 406 | reasonIfUnsupported); |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 407 | case LayerType::Fill: |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 408 | return support.IsFillSupported(infos[0], |
| 409 | infos[1], |
| 410 | *(PolymorphicDowncast<const FillDescriptor*>(&descriptor)), |
| 411 | reasonIfUnsupported); |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 412 | case LayerType::Floor: |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 413 | return support.IsFloorSupported(infos[0], infos[1], reasonIfUnsupported); |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 414 | case LayerType::FullyConnected: |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 415 | return support.IsFullyConnectedSupported(infos[0], |
| 416 | infos[1], |
| 417 | infos[2], |
| 418 | infos[3], |
| 419 | *(PolymorphicDowncast<const |
| 420 | FullyConnectedDescriptor*>(&descriptor)), |
| 421 | reasonIfUnsupported); |
| 422 | case LayerType::Gather: |
| 423 | return support.IsGatherSupported(infos[0], |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 424 | infos[1], |
| 425 | infos[2], |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 426 | *(PolymorphicDowncast<const GatherDescriptor*>(&descriptor)), |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 427 | reasonIfUnsupported); |
Teresa Charlin | bd22c7d | 2022-04-26 18:14:12 +0100 | [diff] [blame] | 428 | case LayerType::GatherNd: |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 429 | return support.IsGatherNdSupported(infos[0], |
| 430 | infos[1], |
| 431 | infos[2], |
| 432 | reasonIfUnsupported); |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 433 | case LayerType::Input: |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 434 | return support.IsInputSupported(infos[0], reasonIfUnsupported); |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 435 | case LayerType::InstanceNormalization: |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 436 | return support.IsInstanceNormalizationSupported(infos[0], |
| 437 | infos[1], |
| 438 | *(PolymorphicDowncast<const |
| 439 | InstanceNormalizationDescriptor*>(&descriptor)), |
| 440 | reasonIfUnsupported); |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 441 | case LayerType::L2Normalization: |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 442 | return support.IsL2NormalizationSupported(infos[0], |
| 443 | infos[1], |
| 444 | *(PolymorphicDowncast<const |
| 445 | L2NormalizationDescriptor*>(&descriptor)), |
| 446 | reasonIfUnsupported); |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 447 | case LayerType::LogicalBinary: |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 448 | return support.IsLogicalBinarySupported(infos[0], |
| 449 | infos[1], |
| 450 | infos[2], |
| 451 | *(PolymorphicDowncast<const |
| 452 | LogicalBinaryDescriptor*>(&descriptor)), |
| 453 | reasonIfUnsupported); |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 454 | case LayerType::LogSoftmax: |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 455 | return support.IsLogSoftmaxSupported(infos[0], |
| 456 | infos[1], |
| 457 | *(PolymorphicDowncast<const LogSoftmaxDescriptor*>(&descriptor)), |
| 458 | reasonIfUnsupported); |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 459 | case LayerType::Lstm: |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 460 | return support.IsLstmSupported(infos[0], |
| 461 | infos[1], |
| 462 | infos[2], |
| 463 | infos[3], |
| 464 | infos[4], |
| 465 | infos[5], |
| 466 | infos[6], |
| 467 | *(PolymorphicDowncast<const LstmDescriptor*>(&descriptor)), |
| 468 | lstmParamsInfo.value(), |
| 469 | reasonIfUnsupported); |
Cathal Corbett | 4952a3e | 2022-03-03 15:14:18 +0000 | [diff] [blame] | 470 | case LayerType::Map: |
| 471 | return true; |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 472 | case LayerType::Maximum: |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 473 | return support.IsMaximumSupported(infos[0], infos[1], infos[2], reasonIfUnsupported); |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 474 | case LayerType::Mean: |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 475 | return support.IsMeanSupported(infos[0], |
| 476 | infos[1], |
| 477 | *(PolymorphicDowncast<const MeanDescriptor*>(&descriptor)), |
| 478 | reasonIfUnsupported); |
Cathal Corbett | 4952a3e | 2022-03-03 15:14:18 +0000 | [diff] [blame] | 479 | case LayerType::MemCopy: |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 480 | return support.IsMemCopySupported(infos[0], infos[1], reasonIfUnsupported); |
Cathal Corbett | 4952a3e | 2022-03-03 15:14:18 +0000 | [diff] [blame] | 481 | case LayerType::MemImport: |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 482 | return support.IsMemImportSupported(infos[0], infos[1], reasonIfUnsupported); |
Cathal Corbett | 4952a3e | 2022-03-03 15:14:18 +0000 | [diff] [blame] | 483 | case LayerType::Merge: |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 484 | return support.IsMergeSupported(infos[0], |
Cathal Corbett | 4952a3e | 2022-03-03 15:14:18 +0000 | [diff] [blame] | 485 | infos[1], |
| 486 | infos[2], |
| 487 | reasonIfUnsupported); |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 488 | case LayerType::Minimum: |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 489 | return support.IsMinimumSupported(infos[0], infos[1], infos[2], reasonIfUnsupported); |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 490 | case LayerType::Multiplication: |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 491 | return support.IsMultiplicationSupported(infos[0], infos[1], infos[2], reasonIfUnsupported); |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 492 | case LayerType::Normalization: |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 493 | return support.IsNormalizationSupported(infos[0], |
| 494 | infos[1], |
| 495 | *(PolymorphicDowncast<const |
| 496 | NormalizationDescriptor*>(&descriptor)), |
| 497 | reasonIfUnsupported); |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 498 | case LayerType::Output: |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 499 | return support.IsOutputSupported(infos[0], reasonIfUnsupported); |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 500 | case LayerType::Pad: |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 501 | return support.IsPadSupported(infos[0], |
| 502 | infos[1], |
| 503 | *(PolymorphicDowncast<const PadDescriptor*>(&descriptor)), |
| 504 | reasonIfUnsupported); |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 505 | case LayerType::Permute: |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 506 | return support.IsPermuteSupported(infos[0], |
| 507 | infos[1], |
| 508 | *(PolymorphicDowncast<const PermuteDescriptor*>(&descriptor)), |
| 509 | reasonIfUnsupported); |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 510 | case LayerType::Pooling2d: |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 511 | return support.IsPooling2dSupported(infos[0], |
| 512 | infos[1], |
| 513 | *(PolymorphicDowncast<const Pooling2dDescriptor*>(&descriptor)), |
| 514 | reasonIfUnsupported); |
Ryan OShea | 19e7942 | 2022-05-04 00:38:03 +0100 | [diff] [blame] | 515 | case LayerType::Pooling3d: |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 516 | return support.IsPooling3dSupported(infos[0], |
| 517 | infos[1], |
| 518 | *(PolymorphicDowncast<const Pooling3dDescriptor*>(&descriptor)), |
| 519 | reasonIfUnsupported); |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 520 | case LayerType::Prelu: |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 521 | return support.IsPreluSupported(infos[0], infos[1], infos[2], reasonIfUnsupported); |
Cathal Corbett | 4952a3e | 2022-03-03 15:14:18 +0000 | [diff] [blame] | 522 | case LayerType::QLstm: |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 523 | return support.IsQLstmSupported(infos[0], |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 524 | infos[1], |
| 525 | infos[2], |
| 526 | infos[3], |
| 527 | infos[4], |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 528 | infos[5], |
| 529 | *(PolymorphicDowncast<const QLstmDescriptor*>(&descriptor)), |
| 530 | lstmParamsInfo.value(), |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 531 | reasonIfUnsupported); |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 532 | case LayerType::Quantize: |
| 533 | return support.IsQuantizeSupported(infos[0], infos[1], reasonIfUnsupported); |
| 534 | case LayerType::QuantizedLstm: |
| 535 | return support.IsQuantizedLstmSupported(infos[0], |
| 536 | infos[1], |
| 537 | infos[2], |
| 538 | infos[3], |
| 539 | infos[4], |
| 540 | quantizedLstmParamsInfo.value(), |
| 541 | reasonIfUnsupported); |
Cathal Corbett | 4952a3e | 2022-03-03 15:14:18 +0000 | [diff] [blame] | 542 | case LayerType::Rank: |
| 543 | return true; |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 544 | case LayerType::Reshape: |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 545 | return support.IsReshapeSupported(infos[0], |
| 546 | infos[1], |
| 547 | *(PolymorphicDowncast<const ReshapeDescriptor*>(&descriptor)), |
| 548 | reasonIfUnsupported); |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 549 | case LayerType::Resize: |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 550 | return support.IsResizeSupported(infos[0], |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 551 | infos[1], |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 552 | *(PolymorphicDowncast<const ResizeDescriptor*>(&descriptor)), |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 553 | reasonIfUnsupported); |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 554 | case LayerType::Reduce: |
| 555 | return support.IsReduceSupported(infos[0], |
| 556 | infos[1], |
| 557 | *(PolymorphicDowncast<const ReduceDescriptor*>(&descriptor)), |
| 558 | reasonIfUnsupported); |
| 559 | case LayerType::Shape: |
| 560 | return support.IsShapeSupported(infos[0], |
| 561 | infos[1], |
| 562 | reasonIfUnsupported); |
| 563 | case LayerType::Slice: |
| 564 | return support.IsSliceSupported(infos[0], |
| 565 | infos[1], |
| 566 | *(PolymorphicDowncast<const SliceDescriptor*>(&descriptor)), |
| 567 | reasonIfUnsupported); |
| 568 | case LayerType::Softmax: |
| 569 | return support.IsSoftmaxSupported(infos[0], |
| 570 | infos[1], |
| 571 | *(PolymorphicDowncast<const SoftmaxDescriptor*>(&descriptor)), |
| 572 | reasonIfUnsupported); |
| 573 | case LayerType::SpaceToBatchNd: |
| 574 | return support.IsSpaceToBatchNdSupported(infos[0], |
| 575 | infos[1], |
| 576 | *(PolymorphicDowncast<const |
| 577 | SpaceToBatchNdDescriptor*>(&descriptor)), |
| 578 | reasonIfUnsupported); |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 579 | case LayerType::SpaceToDepth: |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 580 | return support.IsSpaceToDepthSupported(infos[0], |
| 581 | infos[1], |
| 582 | *(PolymorphicDowncast<const SpaceToDepthDescriptor*>(&descriptor)), |
| 583 | reasonIfUnsupported); |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 584 | case LayerType::Splitter: |
| 585 | { |
| 586 | std::vector<TensorInfo> outputInfos; |
| 587 | for (uint32_t i = 1; i < infos.size(); i++) |
| 588 | { |
| 589 | outputInfos.push_back(infos[i]); |
| 590 | } |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 591 | return support.IsSplitterSupported(infos[0], |
| 592 | {outputInfos.begin(), outputInfos.end()}, |
| 593 | *(PolymorphicDowncast<const ViewsDescriptor*>(&descriptor)), |
| 594 | reasonIfUnsupported); |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 595 | } |
| 596 | case LayerType::Stack: |
| 597 | { |
| 598 | std::vector<const TensorInfo*> inputInfos; |
| 599 | for (uint32_t i = 0; i < infos.size() - 1; i++) |
| 600 | { |
| 601 | inputInfos.push_back(&infos[i]); |
| 602 | } |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 603 | return support.IsStackSupported(inputInfos, |
| 604 | infos[infos.size() - 1], |
| 605 | *(PolymorphicDowncast<const StackDescriptor*>(&descriptor)), |
| 606 | reasonIfUnsupported); |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 607 | } |
| 608 | case LayerType::StridedSlice: |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 609 | return support.IsStridedSliceSupported(infos[0], |
| 610 | infos[1], |
| 611 | *(PolymorphicDowncast<const StridedSliceDescriptor*>(&descriptor)), |
| 612 | reasonIfUnsupported); |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 613 | case LayerType::Subtraction: |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 614 | return support.IsSubtractionSupported(infos[0], infos[1], infos[2], reasonIfUnsupported); |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 615 | case LayerType::Transpose: |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 616 | return support.IsTransposeSupported(infos[0], |
| 617 | infos[1], |
| 618 | *(PolymorphicDowncast<const TransposeDescriptor*>(&descriptor)), |
| 619 | reasonIfUnsupported); |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 620 | case LayerType::TransposeConvolution2d: |
| 621 | { |
| 622 | if (infos.size() != 4) |
| 623 | { |
| 624 | throw InvalidArgumentException("Invalid number of TransposeConvolution2d TensorInfos. " |
| 625 | "TensorInfos should be of format: {input, output, weights, biases}."); |
| 626 | } |
| 627 | |
| 628 | auto desc = *(PolymorphicDowncast<const TransposeConvolution2dDescriptor*>(&descriptor)); |
| 629 | if (infos[3] == TensorInfo()) |
| 630 | { |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 631 | return support.IsTransposeConvolution2dSupported(infos[0], |
| 632 | infos[1], |
| 633 | desc, |
| 634 | infos[2], |
| 635 | EmptyOptional(), |
| 636 | reasonIfUnsupported); |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 637 | } |
| 638 | else |
| 639 | { |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 640 | return support.IsTransposeConvolution2dSupported(infos[0], |
| 641 | infos[1], |
| 642 | desc, |
| 643 | infos[2], |
| 644 | infos[3], |
| 645 | reasonIfUnsupported); |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 646 | } |
| 647 | } |
Cathal Corbett | 4952a3e | 2022-03-03 15:14:18 +0000 | [diff] [blame] | 648 | case LayerType::UnidirectionalSequenceLstm: |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 649 | { |
| 650 | auto desc = *(PolymorphicDowncast<const UnidirectionalSequenceLstmDescriptor*>(&descriptor)); |
| 651 | return support.IsUnidirectionalSequenceLstmSupported(infos[0], |
| 652 | infos[1], |
| 653 | infos[2], |
| 654 | infos[3], |
| 655 | infos[4], |
| 656 | infos[5], |
| 657 | desc, |
| 658 | lstmParamsInfo.value(), |
| 659 | reasonIfUnsupported); |
| 660 | } |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 661 | case LayerType::Unmap: |
| 662 | return true; |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 663 | default: |
| 664 | // layers not supported in neon by default: |
Cathal Corbett | 4952a3e | 2022-03-03 15:14:18 +0000 | [diff] [blame] | 665 | // debug, fakequantization, precompiled, |
Ryan OShea | 19e7942 | 2022-05-04 00:38:03 +0100 | [diff] [blame] | 666 | // standin, switch |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 667 | return false; |
| 668 | } |
| 669 | } |
| 670 | |
Cathal Corbett | 80f71a8 | 2022-12-20 18:25:40 +0000 | [diff] [blame] | 671 | bool NeonLayerSupport::IsLayerSupported(const LayerType& type, |
| 672 | const std::vector<TensorInfo>& infos, |
| 673 | const BaseDescriptor& descriptor, |
| 674 | const Optional<LstmInputParamsInfo>& lstmParamsInfo, |
| 675 | const Optional<QuantizedLstmInputParamsInfo>& quantizedLstmParamsInfo, |
| 676 | Optional<std::string&> reasonIfUnsupported) const |
| 677 | { |
| 678 | bool isSupported = IsLayerTypeSupported(type, |
| 679 | infos, |
| 680 | descriptor, |
| 681 | lstmParamsInfo, |
| 682 | quantizedLstmParamsInfo, |
| 683 | reasonIfUnsupported, |
| 684 | *this); |
| 685 | |
| 686 | // For android-nn-driver and support library, to run FP16 operations on CpuAcc we need at least v8.2 |
| 687 | // architecture. If the available architecture is older than v8.2, we can check if the operator is |
| 688 | // supported by changing operator inputs & outputs to be FP32. |
| 689 | // This does not change the operator datatype in the above parsers to be FP32. We are simply reporting |
| 690 | // to the parsers if the operator can supported in ArmNN. We will then re-enter ArmNN (Network.cpp) |
| 691 | // where we will recheck IsLayerSupported() on the FP16 datatype, update the operator to be FP32, |
| 692 | // and, insert convert layers around the FP32 operator. |
| 693 | if (reasonIfUnsupported.has_value()) |
| 694 | { |
| 695 | std::string checkStr = "This CPU architecture does not support F16 data type, you need v8.2 or above"; |
| 696 | if (!isSupported |
| 697 | && reasonIfUnsupported.value().find(checkStr) != std::string::npos) |
| 698 | { |
| 699 | std::vector<TensorInfo> newInfos; |
| 700 | for (auto info: infos) |
| 701 | { |
| 702 | newInfos.emplace_back(OverrideDataType(info, DataType::Float32)); |
| 703 | } |
| 704 | |
| 705 | std::string tmpString; |
| 706 | return IsLayerTypeSupported(type, |
| 707 | newInfos, |
| 708 | descriptor, |
| 709 | lstmParamsInfo, |
| 710 | quantizedLstmParamsInfo, |
| 711 | tmpString, |
| 712 | *this); |
| 713 | } |
| 714 | } |
| 715 | |
| 716 | return isSupported; |
| 717 | } |
| 718 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 719 | bool NeonLayerSupport::IsActivationSupported(const TensorInfo& input, |
| 720 | const TensorInfo& output, |
| 721 | const ActivationDescriptor& descriptor, |
| 722 | Optional<std::string&> reasonIfUnsupported) const |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 723 | { |
Jan Eilers | 8eb2560 | 2020-03-09 12:13:48 +0000 | [diff] [blame] | 724 | IgnoreUnused(descriptor); |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 725 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonActivationWorkloadValidate, |
| 726 | reasonIfUnsupported, |
| 727 | input, |
| 728 | output, |
| 729 | descriptor); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 730 | } |
| 731 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 732 | bool NeonLayerSupport::IsAdditionSupported(const TensorInfo& input0, |
| 733 | const TensorInfo& input1, |
| 734 | const TensorInfo& output, |
| 735 | Optional<std::string&> reasonIfUnsupported) const |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 736 | { |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 737 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonAdditionWorkloadValidate, |
| 738 | reasonIfUnsupported, |
| 739 | input0, |
| 740 | input1, |
Mike Kelly | 07810fc | 2020-11-12 10:58:48 +0000 | [diff] [blame] | 741 | output, |
| 742 | nullptr); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 743 | } |
| 744 | |
James Conroy | d47a064 | 2019-09-17 14:22:06 +0100 | [diff] [blame] | 745 | bool NeonLayerSupport::IsArgMinMaxSupported(const TensorInfo& input, |
| 746 | const TensorInfo& output, |
| 747 | const ArgMinMaxDescriptor& descriptor, |
| 748 | Optional<std::string&> reasonIfUnsupported) const |
| 749 | { |
| 750 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonArgMinMaxWorkloadValidate, |
| 751 | reasonIfUnsupported, |
| 752 | input, |
| 753 | output, |
| 754 | descriptor); |
| 755 | } |
| 756 | |
Teresa Charlin | 0f86ecf | 2022-10-13 15:47:08 +0100 | [diff] [blame] | 757 | bool NeonLayerSupport::IsBatchMatMulSupported(const TensorInfo& inputX, |
| 758 | const TensorInfo& inputY, |
| 759 | const TensorInfo& output, |
| 760 | const BatchMatMulDescriptor& descriptor, |
| 761 | Optional<std::string&> reasonIfUnsupported) const |
| 762 | { |
Teresa Charlin | 1fe6c81 | 2022-11-01 15:59:50 +0000 | [diff] [blame] | 763 | bool isFastMathEnabled = false; |
| 764 | #if defined(ARMCOMPUTENEON_ENABLED) |
| 765 | if (m_ModelContextPtr) |
| 766 | { |
| 767 | if (m_ModelContextPtr.get() != nullptr) |
| 768 | { |
| 769 | auto modelOptions = dynamic_cast<NeonBackendModelContext*>(m_ModelContextPtr.get()); |
| 770 | if (modelOptions) |
| 771 | { |
| 772 | isFastMathEnabled = modelOptions->IsFastMathEnabled(); |
| 773 | } |
| 774 | } |
| 775 | } |
| 776 | #endif |
Teresa Charlin | 0f86ecf | 2022-10-13 15:47:08 +0100 | [diff] [blame] | 777 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonBatchMatMulValidate, |
| 778 | reasonIfUnsupported, |
| 779 | inputX, |
| 780 | inputY, |
| 781 | output, |
Teresa Charlin | 1fe6c81 | 2022-11-01 15:59:50 +0000 | [diff] [blame] | 782 | descriptor, |
| 783 | isFastMathEnabled, |
| 784 | nullptr); |
Teresa Charlin | 0f86ecf | 2022-10-13 15:47:08 +0100 | [diff] [blame] | 785 | } |
| 786 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 787 | bool NeonLayerSupport::IsBatchNormalizationSupported(const TensorInfo& input, |
| 788 | const TensorInfo& output, |
| 789 | const TensorInfo& mean, |
| 790 | const TensorInfo& var, |
| 791 | const TensorInfo& beta, |
| 792 | const TensorInfo& gamma, |
| 793 | const BatchNormalizationDescriptor& descriptor, |
| 794 | Optional<std::string&> reasonIfUnsupported) const |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 795 | { |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 796 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonBatchNormalizationValidate, |
| 797 | reasonIfUnsupported, |
| 798 | input, |
| 799 | output, |
| 800 | mean, |
| 801 | var, |
| 802 | beta, |
| 803 | gamma, |
Mike Kelly | 07810fc | 2020-11-12 10:58:48 +0000 | [diff] [blame] | 804 | descriptor, |
| 805 | nullptr); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 806 | } |
| 807 | |
Mike Kelly | 5685802 | 2020-01-27 12:14:47 +0000 | [diff] [blame] | 808 | bool NeonLayerSupport::IsBatchToSpaceNdSupported(const TensorInfo& input, |
| 809 | const TensorInfo& output, |
| 810 | const BatchToSpaceNdDescriptor& descriptor, |
| 811 | Optional<std::string&> reasonIfUnsupported) const |
| 812 | { |
| 813 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonBatchToSpaceNdWorkloadValidate, |
| 814 | reasonIfUnsupported, |
| 815 | input, |
| 816 | output, |
| 817 | descriptor); |
| 818 | } |
| 819 | |
Sadik Armagan | 48f011e | 2021-04-21 10:50:34 +0100 | [diff] [blame] | 820 | bool NeonLayerSupport::IsCastSupported(const TensorInfo& input, |
| 821 | const TensorInfo& output, |
| 822 | Optional<std::string&> reasonIfUnsupported) const |
| 823 | { |
| 824 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonCastValidate, |
| 825 | reasonIfUnsupported, |
| 826 | input, |
| 827 | output); |
| 828 | } |
| 829 | |
Teresa Charlin | e89dd69 | 2021-09-01 16:30:34 +0100 | [diff] [blame] | 830 | bool NeonLayerSupport::IsChannelShuffleSupported(const TensorInfo& input, |
| 831 | const TensorInfo& output, |
| 832 | const ChannelShuffleDescriptor& descriptor, |
| 833 | Optional<std::string&> reasonIfUnsupported) const |
| 834 | { |
| 835 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonChannelShuffleValidate, |
| 836 | reasonIfUnsupported, |
| 837 | input, |
| 838 | output, |
| 839 | descriptor); |
| 840 | } |
| 841 | |
Aron Virginas-Tar | 77bfb5e | 2019-10-16 17:45:38 +0100 | [diff] [blame] | 842 | bool NeonLayerSupport::IsComparisonSupported(const TensorInfo& input0, |
| 843 | const TensorInfo& input1, |
| 844 | const TensorInfo& output, |
| 845 | const ComparisonDescriptor& descriptor, |
| 846 | Optional<std::string&> reasonIfUnsupported) const |
| 847 | { |
Aron Virginas-Tar | 77bfb5e | 2019-10-16 17:45:38 +0100 | [diff] [blame] | 848 | |
Teresa Charlin | cedd34f | 2020-03-30 11:17:30 +0100 | [diff] [blame] | 849 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonComparisonWorkloadValidate, |
| 850 | reasonIfUnsupported, |
| 851 | input0, |
| 852 | input1, |
| 853 | output, |
| 854 | descriptor); |
Aron Virginas-Tar | 77bfb5e | 2019-10-16 17:45:38 +0100 | [diff] [blame] | 855 | } |
| 856 | |
Jim Flynn | 906f946 | 2019-05-10 13:55:21 +0100 | [diff] [blame] | 857 | bool NeonLayerSupport::IsConcatSupported(const std::vector<const TensorInfo*> inputs, |
| 858 | const TensorInfo& output, |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 859 | const OriginsDescriptor& descriptor, |
Jim Flynn | 906f946 | 2019-05-10 13:55:21 +0100 | [diff] [blame] | 860 | Optional<std::string&> reasonIfUnsupported) const |
| 861 | { |
Jim Flynn | e242f2d | 2019-05-22 14:24:13 +0100 | [diff] [blame] | 862 | if (descriptor.GetNumDimensions() <= descriptor.GetConcatAxis()) |
| 863 | { |
| 864 | SetValueChecked(reasonIfUnsupported, "Neon Concat: Concat axis > Number of dimensions."); |
| 865 | return false; |
| 866 | } |
| 867 | |
| 868 | unsigned int concatInnerAxis = (descriptor.GetNumDimensions() - descriptor.GetConcatAxis()) - 1; |
| 869 | if(concatInnerAxis < 3) // Width, height, or channels |
| 870 | { |
| 871 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonConcatWorkloadValidate, |
| 872 | reasonIfUnsupported, |
| 873 | inputs, |
| 874 | output, |
| 875 | descriptor); |
| 876 | } |
| 877 | else if (concatInnerAxis == 3) |
| 878 | { |
| 879 | for (auto& input : inputs) |
| 880 | { |
| 881 | if (input && !output.IsTypeSpaceMatch(*input)) // Cannot use sub-tensors if the types are not same space |
| 882 | { |
| 883 | SetValueChecked(reasonIfUnsupported, "Neon Concat: Types and quantization parameters must match."); |
| 884 | return false; |
| 885 | } |
| 886 | } |
| 887 | return true; // Sub-tensors support concat along batch |
| 888 | } |
| 889 | else // > 4 dimensions not supported. |
| 890 | { |
| 891 | SetValueChecked(reasonIfUnsupported, "Neon Concat: Maximum of 4 dimensions supported."); |
| 892 | return false; |
| 893 | } |
Jim Flynn | 906f946 | 2019-05-10 13:55:21 +0100 | [diff] [blame] | 894 | } |
| 895 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 896 | bool NeonLayerSupport::IsConstantSupported(const TensorInfo& output, |
| 897 | Optional<std::string&> reasonIfUnsupported) const |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 898 | { |
Mike Kelly | 0886ac4 | 2020-04-27 09:55:40 +0100 | [diff] [blame] | 899 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonConstantWorkloadValidate, |
| 900 | reasonIfUnsupported, |
| 901 | output); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 902 | } |
| 903 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 904 | bool NeonLayerSupport::IsConvertFp16ToFp32Supported(const TensorInfo& input, |
| 905 | const TensorInfo& output, |
| 906 | Optional<std::string&> reasonIfUnsupported) const |
| 907 | { |
Matthew Bentham | 34336f9 | 2023-04-27 12:13:50 +0000 | [diff] [blame] | 908 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonConvertFp16ToFp32WorkloadValidate, |
| 909 | reasonIfUnsupported, |
| 910 | input, |
| 911 | output); |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 912 | } |
| 913 | |
| 914 | bool NeonLayerSupport::IsConvertFp32ToFp16Supported(const TensorInfo& input, |
| 915 | const TensorInfo& output, |
| 916 | Optional<std::string&> reasonIfUnsupported) const |
| 917 | { |
Matthew Bentham | 34336f9 | 2023-04-27 12:13:50 +0000 | [diff] [blame] | 918 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonConvertFp32ToFp16WorkloadValidate, |
| 919 | reasonIfUnsupported, |
| 920 | input, |
| 921 | output); |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 922 | } |
| 923 | |
| 924 | bool NeonLayerSupport::IsConvolution2dSupported(const TensorInfo& input, |
| 925 | const TensorInfo& output, |
| 926 | const Convolution2dDescriptor& descriptor, |
| 927 | const TensorInfo& weights, |
| 928 | const Optional<TensorInfo>& biases, |
| 929 | Optional<std::string&> reasonIfUnsupported) const |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 930 | { |
Sadik Armagan | 045f6be | 2020-09-10 13:37:32 +0100 | [diff] [blame] | 931 | bool isFastMathEnabled = false; |
| 932 | #if defined(ARMCOMPUTENEON_ENABLED) |
| 933 | if (m_ModelContextPtr) |
| 934 | { |
| 935 | if (m_ModelContextPtr.get() != nullptr) |
| 936 | { |
Sadik Armagan | 04a7297 | 2020-09-14 15:44:18 +0100 | [diff] [blame] | 937 | auto modelOptions = dynamic_cast<NeonBackendModelContext*>(m_ModelContextPtr.get()); |
Sadik Armagan | 045f6be | 2020-09-10 13:37:32 +0100 | [diff] [blame] | 938 | if (modelOptions) |
| 939 | { |
| 940 | isFastMathEnabled = modelOptions->IsFastMathEnabled(); |
| 941 | } |
| 942 | } |
| 943 | } |
| 944 | #endif |
| 945 | |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 946 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonConvolution2dWorkloadValidate, |
| 947 | reasonIfUnsupported, |
| 948 | input, |
| 949 | output, |
| 950 | descriptor, |
| 951 | weights, |
Sadik Armagan | 045f6be | 2020-09-10 13:37:32 +0100 | [diff] [blame] | 952 | biases, |
Mike Kelly | 07810fc | 2020-11-12 10:58:48 +0000 | [diff] [blame] | 953 | isFastMathEnabled, |
| 954 | nullptr); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 955 | } |
| 956 | |
Teresa Charlin | ec5f7d1 | 2021-10-22 17:15:00 +0100 | [diff] [blame] | 957 | bool NeonLayerSupport::IsConvolution3dSupported(const TensorInfo& input, |
| 958 | const TensorInfo& output, |
| 959 | const Convolution3dDescriptor& descriptor, |
| 960 | const TensorInfo& weights, |
| 961 | const Optional<TensorInfo>& biases, |
| 962 | Optional<std::string&> reasonIfUnsupported) const |
| 963 | { |
| 964 | bool isFastMathEnabled = false; |
| 965 | #if defined(ARMCOMPUTENEON_ENABLED) |
| 966 | if (m_ModelContextPtr) |
| 967 | { |
| 968 | if (m_ModelContextPtr.get() != nullptr) |
| 969 | { |
| 970 | auto modelOptions = dynamic_cast<NeonBackendModelContext*>(m_ModelContextPtr.get()); |
| 971 | if (modelOptions) |
| 972 | { |
| 973 | isFastMathEnabled = modelOptions->IsFastMathEnabled(); |
| 974 | } |
| 975 | } |
| 976 | } |
| 977 | #endif |
| 978 | |
| 979 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonConvolution3dWorkloadValidate, |
| 980 | reasonIfUnsupported, |
| 981 | input, |
| 982 | output, |
| 983 | descriptor, |
| 984 | weights, |
| 985 | biases, |
| 986 | isFastMathEnabled, |
| 987 | nullptr); |
| 988 | } |
| 989 | |
Aron Virginas-Tar | 2f00b74 | 2019-09-30 13:28:08 +0100 | [diff] [blame] | 990 | bool NeonLayerSupport::IsDepthToSpaceSupported(const TensorInfo& input, |
| 991 | const TensorInfo& output, |
| 992 | const DepthToSpaceDescriptor& descriptor, |
| 993 | Optional<std::string&> reasonIfUnsupported) const |
| 994 | { |
| 995 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonDepthToSpaceWorkloadValidate, |
| 996 | reasonIfUnsupported, |
| 997 | input, |
| 998 | output, |
| 999 | descriptor); |
| 1000 | } |
| 1001 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 1002 | bool NeonLayerSupport::IsDepthwiseConvolutionSupported(const TensorInfo& input, |
| 1003 | const TensorInfo& output, |
| 1004 | const DepthwiseConvolution2dDescriptor& descriptor, |
| 1005 | const TensorInfo& weights, |
| 1006 | const Optional<TensorInfo>& biases, |
| 1007 | Optional<std::string&> reasonIfUnsupported) const |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 1008 | { |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 1009 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonDepthwiseConvolutionWorkloadValidate, |
| 1010 | reasonIfUnsupported, |
| 1011 | input, |
| 1012 | output, |
| 1013 | descriptor, |
| 1014 | weights, |
Mike Kelly | 07810fc | 2020-11-12 10:58:48 +0000 | [diff] [blame] | 1015 | biases, |
| 1016 | nullptr); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 1017 | } |
| 1018 | |
Narumol Prangnawarat | 01961a7 | 2019-05-30 16:47:12 +0100 | [diff] [blame] | 1019 | bool NeonLayerSupport::IsDequantizeSupported(const TensorInfo& input, |
| 1020 | const TensorInfo& output, |
| 1021 | Optional<std::string&> reasonIfUnsupported) const |
| 1022 | { |
| 1023 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonDequantizeWorkloadValidate, |
| 1024 | reasonIfUnsupported, |
| 1025 | input, |
| 1026 | output); |
| 1027 | } |
| 1028 | |
Pablo Tello | f0bd683 | 2019-04-26 17:58:13 +0100 | [diff] [blame] | 1029 | bool NeonLayerSupport::IsDilatedDepthwiseConvolutionSupported(const TensorInfo& input, |
| 1030 | const TensorInfo& output, |
| 1031 | const DepthwiseConvolution2dDescriptor& descriptor, |
| 1032 | const TensorInfo& weights, |
| 1033 | const Optional<TensorInfo>& biases, |
| 1034 | Optional<std::string&> reasonIfUnsupported) const |
| 1035 | { |
| 1036 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonDepthwiseConvolutionWorkloadValidate, |
| 1037 | reasonIfUnsupported, |
| 1038 | input, |
| 1039 | output, |
| 1040 | descriptor, |
| 1041 | weights, |
Mike Kelly | 07810fc | 2020-11-12 10:58:48 +0000 | [diff] [blame] | 1042 | biases, |
| 1043 | nullptr); |
Pablo Tello | f0bd683 | 2019-04-26 17:58:13 +0100 | [diff] [blame] | 1044 | } |
| 1045 | |
josh minor | 4a3c610 | 2020-01-06 16:40:46 -0600 | [diff] [blame] | 1046 | bool NeonLayerSupport::IsElementwiseUnarySupported(const TensorInfo& input, |
| 1047 | const TensorInfo& output, |
| 1048 | const ElementwiseUnaryDescriptor& descriptor, |
| 1049 | Optional<std::string&> reasonIfUnsupported) const |
| 1050 | { |
Derek Lamberti | c77874a | 2020-04-28 13:34:56 +0100 | [diff] [blame] | 1051 | switch(descriptor.m_Operation) |
josh minor | 4a3c610 | 2020-01-06 16:40:46 -0600 | [diff] [blame] | 1052 | { |
Derek Lamberti | c77874a | 2020-04-28 13:34:56 +0100 | [diff] [blame] | 1053 | case UnaryOperation::Abs: |
| 1054 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonAbsWorkloadValidate, |
| 1055 | reasonIfUnsupported, |
| 1056 | input, |
| 1057 | output); |
| 1058 | case UnaryOperation::Exp: |
| 1059 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonExpWorkloadValidate, |
| 1060 | reasonIfUnsupported, |
| 1061 | input, |
| 1062 | output); |
Teresa Charlin | 50de4fa | 2021-05-31 18:47:33 +0100 | [diff] [blame] | 1063 | case UnaryOperation::LogicalNot: |
| 1064 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonLogicalNotWorkloadValidate, |
| 1065 | reasonIfUnsupported, |
| 1066 | input, |
| 1067 | output); |
| 1068 | case UnaryOperation::Log: |
| 1069 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonLogWorkloadValidate, |
| 1070 | reasonIfUnsupported, |
| 1071 | input, |
| 1072 | output); |
Derek Lamberti | c77874a | 2020-04-28 13:34:56 +0100 | [diff] [blame] | 1073 | case UnaryOperation::Neg: |
| 1074 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonNegWorkloadValidate, |
| 1075 | reasonIfUnsupported, |
| 1076 | input, |
| 1077 | output); |
| 1078 | case UnaryOperation::Rsqrt: |
| 1079 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonRsqrtWorkloadValidate, |
| 1080 | reasonIfUnsupported, |
| 1081 | input, |
| 1082 | output); |
ryan.oshea3 | cff135b | 2021-10-07 15:28:14 +0000 | [diff] [blame] | 1083 | case UnaryOperation::Sin: |
| 1084 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonSinWorkloadValidate, |
| 1085 | reasonIfUnsupported, |
| 1086 | input, |
| 1087 | output); |
Teresa Charlin | 06145cc | 2022-05-05 15:31:30 +0100 | [diff] [blame] | 1088 | case UnaryOperation::Sqrt: |
| 1089 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonSqrtWorkloadValidate, |
| 1090 | reasonIfUnsupported, |
| 1091 | input, |
| 1092 | output); |
Derek Lamberti | c77874a | 2020-04-28 13:34:56 +0100 | [diff] [blame] | 1093 | default: |
| 1094 | return false; |
josh minor | 4a3c610 | 2020-01-06 16:40:46 -0600 | [diff] [blame] | 1095 | } |
josh minor | 4a3c610 | 2020-01-06 16:40:46 -0600 | [diff] [blame] | 1096 | } |
| 1097 | |
Teresa Charlin | 4b10fef | 2020-07-29 09:36:41 +0100 | [diff] [blame] | 1098 | bool NeonLayerSupport::IsFillSupported(const TensorInfo& input, |
| 1099 | const TensorInfo& output, |
| 1100 | const FillDescriptor& descriptor, |
| 1101 | Optional<std::string&> reasonIfUnsupported) const |
Sadik Armagan | a792a05 | 2020-06-23 16:22:23 +0100 | [diff] [blame] | 1102 | { |
Teresa Charlin | 4b10fef | 2020-07-29 09:36:41 +0100 | [diff] [blame] | 1103 | armnn::IgnoreUnused(input); |
| 1104 | armnn::IgnoreUnused(output); |
| 1105 | armnn::IgnoreUnused(descriptor); |
| 1106 | |
| 1107 | return IsNeonBackendSupported(reasonIfUnsupported); |
Sadik Armagan | a792a05 | 2020-06-23 16:22:23 +0100 | [diff] [blame] | 1108 | } |
| 1109 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 1110 | bool NeonLayerSupport::IsFloorSupported(const TensorInfo& input, |
| 1111 | const TensorInfo& output, |
| 1112 | Optional<std::string&> reasonIfUnsupported) const |
| 1113 | { |
Jan Eilers | 8eb2560 | 2020-03-09 12:13:48 +0000 | [diff] [blame] | 1114 | armnn::IgnoreUnused(output); |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 1115 | return IsNeonBackendSupported(reasonIfUnsupported) && |
| 1116 | IsSupportedForDataTypeGeneric(reasonIfUnsupported, |
| 1117 | input.GetDataType(), |
| 1118 | &FalseFuncF16<>, |
| 1119 | &TrueFunc<>, |
narpra01 | db2b160 | 2019-01-23 15:23:11 +0000 | [diff] [blame] | 1120 | &FalseFuncU8<>, |
kevmay01 | 2b4d88e | 2019-01-24 14:05:09 +0000 | [diff] [blame] | 1121 | &FalseFuncI32<>, |
| 1122 | &FalseFuncU8<>); |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 1123 | } |
| 1124 | |
| 1125 | bool NeonLayerSupport::IsFullyConnectedSupported(const TensorInfo& input, |
| 1126 | const TensorInfo& output, |
| 1127 | const TensorInfo& weights, |
| 1128 | const TensorInfo& biases, |
| 1129 | const FullyConnectedDescriptor& descriptor, |
| 1130 | Optional<std::string&> reasonIfUnsupported) const |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 1131 | { |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 1132 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonFullyConnectedWorkloadValidate, |
| 1133 | reasonIfUnsupported, |
| 1134 | input, |
| 1135 | output, |
| 1136 | weights, |
| 1137 | biases, |
Mike Kelly | 07810fc | 2020-11-12 10:58:48 +0000 | [diff] [blame] | 1138 | descriptor, |
| 1139 | nullptr); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 1140 | } |
| 1141 | |
Teresa Charlin | f540eb8 | 2020-04-10 19:24:55 +0100 | [diff] [blame] | 1142 | bool NeonLayerSupport::IsGatherSupported(const TensorInfo& input0, |
| 1143 | const TensorInfo& input1, |
| 1144 | const TensorInfo& output, |
Teresa Charlin | 5266473 | 2020-06-29 16:27:03 +0100 | [diff] [blame] | 1145 | const GatherDescriptor& descriptor, |
Teresa Charlin | f540eb8 | 2020-04-10 19:24:55 +0100 | [diff] [blame] | 1146 | Optional<std::string&> reasonIfUnsupported) const |
| 1147 | { |
| 1148 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonGatherWorkloadValidate, |
| 1149 | reasonIfUnsupported, |
| 1150 | input0, |
| 1151 | input1, |
Teresa Charlin | 5266473 | 2020-06-29 16:27:03 +0100 | [diff] [blame] | 1152 | output, |
| 1153 | descriptor); |
Teresa Charlin | f540eb8 | 2020-04-10 19:24:55 +0100 | [diff] [blame] | 1154 | } |
| 1155 | |
Teresa Charlin | bd22c7d | 2022-04-26 18:14:12 +0100 | [diff] [blame] | 1156 | bool NeonLayerSupport::IsGatherNdSupported(const TensorInfo& input0, |
| 1157 | const TensorInfo& input1, |
| 1158 | const TensorInfo& output, |
| 1159 | Optional<std::string&> reasonIfUnsupported) const |
| 1160 | { |
| 1161 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonGatherNdWorkloadValidate, |
| 1162 | reasonIfUnsupported, |
| 1163 | input0, |
| 1164 | input1, |
| 1165 | output); |
| 1166 | } |
| 1167 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 1168 | bool NeonLayerSupport::IsInputSupported(const TensorInfo& input, |
| 1169 | Optional<std::string&> reasonIfUnsupported) const |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 1170 | { |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 1171 | return IsNeonBackendSupported(reasonIfUnsupported, input); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 1172 | } |
| 1173 | |
Sadik Armagan | 0d4863d | 2019-10-09 14:26:32 +0100 | [diff] [blame] | 1174 | bool NeonLayerSupport::IsInstanceNormalizationSupported(const TensorInfo& input, |
| 1175 | const TensorInfo& output, |
| 1176 | const InstanceNormalizationDescriptor& descriptor, |
| 1177 | Optional<std::string&> reasonIfUnsupported) const |
| 1178 | { |
| 1179 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonInstanceNormalizationWorkloadValidate, |
| 1180 | reasonIfUnsupported, |
| 1181 | input, |
| 1182 | output, |
| 1183 | descriptor); |
| 1184 | } |
| 1185 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 1186 | bool NeonLayerSupport::IsL2NormalizationSupported(const TensorInfo& input, |
| 1187 | const TensorInfo& output, |
| 1188 | const L2NormalizationDescriptor& descriptor, |
| 1189 | Optional<std::string&> reasonIfUnsupported) const |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 1190 | { |
Matteo Martincigh | bcd3c85 | 2018-09-28 14:14:12 +0100 | [diff] [blame] | 1191 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonL2NormalizationWorkloadValidate, reasonIfUnsupported, input, output, descriptor); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 1192 | } |
| 1193 | |
James Conroy | 177df1e | 2020-11-13 10:18:51 +0000 | [diff] [blame] | 1194 | bool NeonLayerSupport::IsLogicalBinarySupported(const TensorInfo& input0, |
| 1195 | const TensorInfo& input1, |
| 1196 | const TensorInfo& output, |
| 1197 | const LogicalBinaryDescriptor& descriptor, |
| 1198 | Optional<std::string&> reasonIfUnsupported) const |
| 1199 | { |
| 1200 | switch(descriptor.m_Operation) |
| 1201 | { |
| 1202 | case LogicalBinaryOperation::LogicalAnd: |
| 1203 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonLogicalAndWorkloadValidate, |
| 1204 | reasonIfUnsupported, |
| 1205 | input0, |
| 1206 | input1, |
| 1207 | output); |
| 1208 | case LogicalBinaryOperation::LogicalOr: |
| 1209 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonLogicalOrWorkloadValidate, |
| 1210 | reasonIfUnsupported, |
| 1211 | input0, |
| 1212 | input1, |
| 1213 | output); |
| 1214 | default: |
| 1215 | return false; |
| 1216 | } |
| 1217 | } |
| 1218 | |
Keith Davis | 69e653f | 2020-07-02 11:49:26 +0100 | [diff] [blame] | 1219 | bool NeonLayerSupport::IsLogSoftmaxSupported(const TensorInfo& input, |
| 1220 | const TensorInfo& output, |
| 1221 | const LogSoftmaxDescriptor& descriptor, |
| 1222 | Optional<std::string&> reasonIfUnsupported) const |
| 1223 | { |
| 1224 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonLogSoftmaxWorkloadValidate, reasonIfUnsupported, input, output, descriptor); |
| 1225 | } |
| 1226 | |
Jan Eilers | ad5293a | 2019-07-08 09:57:55 +0100 | [diff] [blame] | 1227 | bool NeonLayerSupport::IsLstmSupported(const TensorInfo& input, |
| 1228 | const TensorInfo& outputStateIn, |
| 1229 | const TensorInfo& cellStateIn, |
| 1230 | const TensorInfo& scratchBuffer, |
| 1231 | const TensorInfo& outputStateOut, |
| 1232 | const TensorInfo& cellStateOut, |
| 1233 | const TensorInfo& output, |
| 1234 | const LstmDescriptor& descriptor, |
| 1235 | const LstmInputParamsInfo& paramsInfo, |
| 1236 | Optional<std::string&> reasonIfUnsupported) const |
| 1237 | { |
| 1238 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonLstmFloatWorkloadValidate, |
| 1239 | reasonIfUnsupported, |
| 1240 | input, |
| 1241 | outputStateIn, |
| 1242 | cellStateIn, |
| 1243 | scratchBuffer, |
| 1244 | outputStateOut, |
| 1245 | cellStateOut, |
| 1246 | output, |
| 1247 | descriptor, |
| 1248 | paramsInfo); |
| 1249 | } |
| 1250 | |
Nattapat Chaimanowong | 4e6597a | 2018-12-20 14:14:06 +0000 | [diff] [blame] | 1251 | bool NeonLayerSupport::IsMaximumSupported(const TensorInfo& input0, |
| 1252 | const TensorInfo& input1, |
| 1253 | const TensorInfo& output, |
| 1254 | Optional<std::string&> reasonIfUnsupported) const |
| 1255 | { |
| 1256 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonMaximumWorkloadValidate, |
| 1257 | reasonIfUnsupported, |
| 1258 | input0, |
| 1259 | input1, |
| 1260 | output); |
| 1261 | } |
| 1262 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 1263 | bool NeonLayerSupport::IsMeanSupported(const TensorInfo& input, |
| 1264 | const TensorInfo& output, |
| 1265 | const MeanDescriptor& descriptor, |
| 1266 | Optional<std::string&> reasonIfUnsupported) const |
narpra01 | 32b9046 | 2018-09-13 11:07:48 +0100 | [diff] [blame] | 1267 | { |
Matthew Bentham | fd89996 | 2018-12-31 15:49:42 +0000 | [diff] [blame] | 1268 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonMeanWorkloadValidate, |
| 1269 | reasonIfUnsupported, |
| 1270 | input, |
| 1271 | output, |
| 1272 | descriptor); |
narpra01 | 32b9046 | 2018-09-13 11:07:48 +0100 | [diff] [blame] | 1273 | } |
| 1274 | |
Conor Kennedy | 54b2169 | 2019-01-09 07:57:38 +0000 | [diff] [blame] | 1275 | bool NeonLayerSupport::IsMinimumSupported(const TensorInfo& input0, |
| 1276 | const TensorInfo& input1, |
| 1277 | const TensorInfo& output, |
| 1278 | Optional<std::string&> reasonIfUnsupported) const |
| 1279 | { |
| 1280 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonMinimumWorkloadValidate, |
| 1281 | reasonIfUnsupported, |
| 1282 | input0, |
| 1283 | input1, |
| 1284 | output); |
| 1285 | } |
| 1286 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 1287 | bool NeonLayerSupport::IsMultiplicationSupported(const TensorInfo& input0, |
| 1288 | const TensorInfo& input1, |
| 1289 | const TensorInfo& output, |
| 1290 | Optional<std::string&> reasonIfUnsupported) const |
| 1291 | { |
| 1292 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonMultiplicationWorkloadValidate, |
| 1293 | reasonIfUnsupported, |
| 1294 | input0, |
| 1295 | input1, |
Mike Kelly | 07810fc | 2020-11-12 10:58:48 +0000 | [diff] [blame] | 1296 | output, |
| 1297 | nullptr); |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 1298 | } |
| 1299 | |
Pablo Tello | e61f071 | 2020-01-23 10:37:17 +0000 | [diff] [blame] | 1300 | bool NeonLayerSupport::IsDivisionSupported(const TensorInfo& input0, |
| 1301 | const TensorInfo& input1, |
| 1302 | const TensorInfo& output, |
| 1303 | Optional<std::string&> reasonIfUnsupported) const |
| 1304 | { |
| 1305 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonDivisionWorkloadValidate, |
| 1306 | reasonIfUnsupported, |
| 1307 | input0, |
| 1308 | input1, |
Mike Kelly | 07810fc | 2020-11-12 10:58:48 +0000 | [diff] [blame] | 1309 | output, |
| 1310 | nullptr); |
Pablo Tello | e61f071 | 2020-01-23 10:37:17 +0000 | [diff] [blame] | 1311 | } |
| 1312 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 1313 | bool NeonLayerSupport::IsNormalizationSupported(const TensorInfo& input, |
| 1314 | const TensorInfo& output, |
| 1315 | const NormalizationDescriptor& descriptor, |
| 1316 | Optional<std::string&> reasonIfUnsupported) const |
| 1317 | { |
| 1318 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonNormalizationWorkloadValidate, |
| 1319 | reasonIfUnsupported, |
| 1320 | input, |
| 1321 | output, |
| 1322 | descriptor); |
| 1323 | } |
| 1324 | |
| 1325 | bool NeonLayerSupport::IsOutputSupported(const TensorInfo& output, |
| 1326 | Optional<std::string&> reasonIfUnsupported) const |
| 1327 | { |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 1328 | return IsNeonBackendSupported(reasonIfUnsupported, output); |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 1329 | } |
| 1330 | |
Éanna Ó Catháin | 1205574 | 2019-01-25 10:01:40 +0000 | [diff] [blame] | 1331 | bool NeonLayerSupport::IsPadSupported(const TensorInfo& input, |
| 1332 | const TensorInfo& output, |
| 1333 | const PadDescriptor& descriptor, |
| 1334 | Optional<std::string&> reasonIfUnsupported) const |
| 1335 | { |
| 1336 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonPadWorkloadValidate, |
| 1337 | reasonIfUnsupported, |
| 1338 | input, |
| 1339 | output, |
| 1340 | descriptor); |
| 1341 | } |
| 1342 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 1343 | bool NeonLayerSupport::IsPermuteSupported(const TensorInfo& input, |
| 1344 | const TensorInfo& output, |
| 1345 | const PermuteDescriptor& descriptor, |
| 1346 | Optional<std::string&> reasonIfUnsupported) const |
| 1347 | { |
| 1348 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonPermuteWorkloadValidate, reasonIfUnsupported, input, output, descriptor); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 1349 | } |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 1350 | |
| 1351 | bool NeonLayerSupport::IsPooling2dSupported(const TensorInfo& input, |
| 1352 | const TensorInfo& output, |
| 1353 | const Pooling2dDescriptor& descriptor, |
| 1354 | Optional<std::string&> reasonIfUnsupported) const |
| 1355 | { |
| 1356 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonPooling2dWorkloadValidate, reasonIfUnsupported, input, output, descriptor); |
| 1357 | } |
| 1358 | |
Ryan OShea | 19e7942 | 2022-05-04 00:38:03 +0100 | [diff] [blame] | 1359 | bool NeonLayerSupport::IsPooling3dSupported(const TensorInfo& input, |
| 1360 | const TensorInfo& output, |
| 1361 | const Pooling3dDescriptor& descriptor, |
| 1362 | Optional<std::string&> reasonIfUnsupported) const |
| 1363 | { |
| 1364 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonPooling3dWorkloadValidate, reasonIfUnsupported, input, output, descriptor); |
| 1365 | } |
| 1366 | |
Nikhil Raj | 9b46148 | 2019-07-03 15:58:31 +0100 | [diff] [blame] | 1367 | bool NeonLayerSupport::IsPreluSupported(const armnn::TensorInfo &input, |
| 1368 | const armnn::TensorInfo &alpha, |
| 1369 | const armnn::TensorInfo &output, |
| 1370 | armnn::Optional<std::string &> reasonIfUnsupported) const |
| 1371 | { |
| 1372 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonPreluWorkloadValidate, reasonIfUnsupported, input, alpha, output); |
| 1373 | } |
| 1374 | |
James Conroy | cc34093 | 2020-05-12 18:08:52 +0100 | [diff] [blame] | 1375 | bool NeonLayerSupport::IsQLstmSupported(const TensorInfo& input, |
| 1376 | const TensorInfo& previousOutputIn, |
| 1377 | const TensorInfo& previousCellStateIn, |
| 1378 | const TensorInfo& outputStateOut, |
| 1379 | const TensorInfo& cellStateOut, |
| 1380 | const TensorInfo& output, |
| 1381 | const QLstmDescriptor& descriptor, |
| 1382 | const LstmInputParamsInfo& paramsInfo, |
| 1383 | Optional<std::string&> reasonIfUnsupported) const |
| 1384 | { |
| 1385 | // Check required here in order to pass IsLayerSupported for datatypes tests |
| 1386 | if (input.GetDataType() == armnn::DataType::QAsymmS8 && |
| 1387 | previousOutputIn.GetDataType() == armnn::DataType::QAsymmS8 && |
| 1388 | previousCellStateIn.GetDataType() == armnn::DataType::QSymmS16 && |
| 1389 | outputStateOut.GetDataType() == armnn::DataType::QAsymmS8 && |
| 1390 | cellStateOut.GetDataType() == armnn::DataType::QSymmS16 && |
| 1391 | output.GetDataType() == armnn::DataType::QAsymmS8) |
| 1392 | { |
| 1393 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonQLstmWorkloadValidate, |
| 1394 | reasonIfUnsupported, |
| 1395 | input, |
| 1396 | previousCellStateIn, |
| 1397 | previousOutputIn, |
| 1398 | cellStateOut, |
| 1399 | outputStateOut, |
| 1400 | output, |
| 1401 | descriptor, |
| 1402 | paramsInfo); |
| 1403 | } |
| 1404 | else |
| 1405 | { |
| 1406 | return false; |
| 1407 | } |
| 1408 | } |
| 1409 | |
Sadik Armagan | fabc289 | 2019-05-31 09:05:11 +0100 | [diff] [blame] | 1410 | bool NeonLayerSupport::IsQuantizeSupported(const TensorInfo& input, |
| 1411 | const TensorInfo& output, |
| 1412 | Optional<std::string&> reasonIfUnsupported) const |
| 1413 | { |
| 1414 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonQuantizeWorkloadValidate, |
| 1415 | reasonIfUnsupported, |
| 1416 | input, |
| 1417 | output); |
| 1418 | } |
| 1419 | |
Francis Murtagh | 4fc3c48 | 2019-08-02 13:20:54 +0100 | [diff] [blame] | 1420 | bool NeonLayerSupport::IsQuantizedLstmSupported(const TensorInfo& input, |
| 1421 | const TensorInfo& cellStateIn, |
| 1422 | const TensorInfo& outputStateIn, |
| 1423 | const TensorInfo& cellStateOut, |
| 1424 | const TensorInfo& outputStateOut, |
| 1425 | const QuantizedLstmInputParamsInfo& paramsInfo, |
| 1426 | Optional<std::string&> reasonIfUnsupported) const |
| 1427 | { |
| 1428 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonQuantizedLstmWorkloadValidate, |
| 1429 | reasonIfUnsupported, |
| 1430 | input, |
| 1431 | cellStateIn, |
| 1432 | outputStateIn, |
| 1433 | cellStateOut, |
| 1434 | outputStateOut, |
| 1435 | paramsInfo); |
| 1436 | } |
| 1437 | |
Sadik Armagan | a274748 | 2021-02-09 10:28:54 +0000 | [diff] [blame] | 1438 | bool NeonLayerSupport::IsReduceSupported(const TensorInfo& input, |
| 1439 | const TensorInfo& output, |
| 1440 | const ReduceDescriptor& descriptor, |
| 1441 | Optional<std::string&> reasonIfUnsupported) const |
| 1442 | { |
| 1443 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonReduceWorkloadValidate, |
| 1444 | reasonIfUnsupported, |
| 1445 | input, |
| 1446 | output, |
| 1447 | descriptor); |
| 1448 | } |
| 1449 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 1450 | bool NeonLayerSupport::IsReshapeSupported(const TensorInfo& input, |
Kevin May | a023c40 | 2019-12-12 17:28:05 +0000 | [diff] [blame] | 1451 | const TensorInfo& output, |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 1452 | const ReshapeDescriptor& descriptor, |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 1453 | Optional<std::string&> reasonIfUnsupported) const |
| 1454 | { |
Jan Eilers | 8eb2560 | 2020-03-09 12:13:48 +0000 | [diff] [blame] | 1455 | armnn::IgnoreUnused(descriptor); |
Kevin May | a023c40 | 2019-12-12 17:28:05 +0000 | [diff] [blame] | 1456 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonReshapeWorkloadValidate, |
| 1457 | reasonIfUnsupported, |
| 1458 | input, |
| 1459 | output); |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 1460 | } |
| 1461 | |
Aron Virginas-Tar | 169d2f1 | 2019-07-01 19:01:44 +0100 | [diff] [blame] | 1462 | bool NeonLayerSupport::IsResizeSupported(const TensorInfo& input, |
| 1463 | const TensorInfo& output, |
| 1464 | const ResizeDescriptor& descriptor, |
| 1465 | Optional<std::string&> reasonIfUnsupported) const |
| 1466 | { |
Ellen Norris-Thompson | 37e6868 | 2019-07-15 14:23:30 +0100 | [diff] [blame] | 1467 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonResizeWorkloadValidate, |
| 1468 | reasonIfUnsupported, |
| 1469 | input, |
| 1470 | output, |
| 1471 | descriptor); |
Aron Virginas-Tar | 169d2f1 | 2019-07-01 19:01:44 +0100 | [diff] [blame] | 1472 | } |
| 1473 | |
josh minor | 036f02d | 2019-11-15 14:53:22 -0600 | [diff] [blame] | 1474 | bool NeonLayerSupport::IsSliceSupported(const TensorInfo& input, |
| 1475 | const TensorInfo& output, |
| 1476 | const SliceDescriptor& descriptor, |
| 1477 | Optional<std::string&> reasonIfUnsupported) const |
| 1478 | { |
| 1479 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonSliceWorkloadValidate, |
| 1480 | reasonIfUnsupported, |
| 1481 | input, |
| 1482 | output, |
| 1483 | descriptor); |
| 1484 | } |
| 1485 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 1486 | bool NeonLayerSupport::IsSoftmaxSupported(const TensorInfo& input, |
| 1487 | const TensorInfo& output, |
| 1488 | const SoftmaxDescriptor& descriptor, |
| 1489 | Optional<std::string&> reasonIfUnsupported) const |
| 1490 | { |
| 1491 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonSoftmaxWorkloadValidate, reasonIfUnsupported, input, output, descriptor); |
| 1492 | } |
| 1493 | |
Mike Kelly | 0be3a88 | 2020-01-24 11:27:50 +0000 | [diff] [blame] | 1494 | bool NeonLayerSupport::IsSpaceToBatchNdSupported(const TensorInfo& input, |
| 1495 | const TensorInfo& output, |
| 1496 | const SpaceToBatchNdDescriptor& descriptor, |
| 1497 | Optional<std::string&> reasonIfUnsupported) const |
| 1498 | { |
| 1499 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonSpaceToBatchNdWorkloadValidate, |
| 1500 | reasonIfUnsupported, |
| 1501 | input, |
| 1502 | output, |
| 1503 | descriptor); |
| 1504 | } |
| 1505 | |
Ellen Norris-Thompson | 2979457 | 2019-06-26 16:40:36 +0100 | [diff] [blame] | 1506 | bool NeonLayerSupport::IsSpaceToDepthSupported(const TensorInfo& input, |
Mike Kelly | 0be3a88 | 2020-01-24 11:27:50 +0000 | [diff] [blame] | 1507 | const TensorInfo& output, |
| 1508 | const SpaceToDepthDescriptor& descriptor, |
| 1509 | Optional<std::string&> reasonIfUnsupported) const |
Ellen Norris-Thompson | 2979457 | 2019-06-26 16:40:36 +0100 | [diff] [blame] | 1510 | { |
| 1511 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonSpaceToDepthWorkloadValidate, |
| 1512 | reasonIfUnsupported, |
| 1513 | input, |
| 1514 | output, |
| 1515 | descriptor); |
| 1516 | } |
| 1517 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 1518 | bool NeonLayerSupport::IsSplitterSupported(const TensorInfo& input, |
Narumol Prangnawarat | 15eb583 | 2019-05-20 15:31:05 +0100 | [diff] [blame] | 1519 | const std::vector<std::reference_wrapper<TensorInfo>>& outputs, |
| 1520 | const ViewsDescriptor& descriptor, |
| 1521 | Optional<std::string&> reasonIfUnsupported) const |
| 1522 | { |
| 1523 | #if defined(ARMCOMPUTENEON_ENABLED) |
| 1524 | // Split along the last dimension, cannot use sub-tensors |
| 1525 | // as width and height of the sub-tensors do not match |
| 1526 | // the width and height of the parent tensor |
| 1527 | // in case of input with more than 2D. |
| 1528 | std::set<unsigned int> splitAxis = ComputeSplitAxis(descriptor, input.GetShape()); |
| 1529 | if (descriptor.GetNumDimensions() > 2 && splitAxis.size() == 1 && |
| 1530 | *splitAxis.begin() == descriptor.GetNumDimensions() - 1 ) |
| 1531 | { |
| 1532 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonSplitterWorkloadValidate, |
| 1533 | reasonIfUnsupported, |
| 1534 | input, |
| 1535 | outputs, |
| 1536 | *splitAxis.begin()); |
| 1537 | } |
| 1538 | #endif |
Jan Eilers | 8eb2560 | 2020-03-09 12:13:48 +0000 | [diff] [blame] | 1539 | IgnoreUnused(descriptor); |
Narumol Prangnawarat | 15eb583 | 2019-05-20 15:31:05 +0100 | [diff] [blame] | 1540 | for (auto output : outputs) |
| 1541 | { |
| 1542 | if (!input.IsTypeSpaceMatch(output)) // Cannot use sub-tensors if the types are not same space |
| 1543 | { |
| 1544 | SetValueChecked(reasonIfUnsupported, "Neon Splitter: Types and quantization parameters must match."); |
| 1545 | return false; |
| 1546 | } |
| 1547 | } |
| 1548 | return true; |
| 1549 | } |
| 1550 | |
Matthew Jackson | 87f65ea | 2019-08-01 10:01:34 +0100 | [diff] [blame] | 1551 | bool NeonLayerSupport::IsStackSupported(const std::vector<const TensorInfo*>& inputs, |
| 1552 | const TensorInfo& output, |
| 1553 | const StackDescriptor& descriptor, |
| 1554 | Optional<std::string&> reasonIfUnsupported) const |
| 1555 | { |
| 1556 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonStackWorkloadValidate, |
| 1557 | reasonIfUnsupported, |
| 1558 | inputs, |
| 1559 | output, |
| 1560 | descriptor); |
| 1561 | } |
| 1562 | |
FinnWilliamsArm | 1fa1919 | 2019-08-02 17:26:31 +0100 | [diff] [blame] | 1563 | bool NeonLayerSupport::IsStridedSliceSupported(const TensorInfo& input, |
| 1564 | const TensorInfo& output, |
| 1565 | const StridedSliceDescriptor& descriptor, |
| 1566 | Optional<std::string&> reasonIfUnsupported) const |
| 1567 | { |
| 1568 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonStridedSliceWorkloadValidate, |
| 1569 | reasonIfUnsupported, |
| 1570 | input, |
| 1571 | output, |
| 1572 | descriptor); |
| 1573 | } |
| 1574 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 1575 | bool NeonLayerSupport::IsSubtractionSupported(const TensorInfo& input0, |
| 1576 | const TensorInfo& input1, |
| 1577 | const TensorInfo& output, |
| 1578 | Optional<std::string&> reasonIfUnsupported) const |
| 1579 | { |
| 1580 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonSubtractionWorkloadValidate, |
| 1581 | reasonIfUnsupported, |
| 1582 | input0, |
| 1583 | input1, |
Mike Kelly | 07810fc | 2020-11-12 10:58:48 +0000 | [diff] [blame] | 1584 | output, |
| 1585 | nullptr); |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 1586 | } |
| 1587 | |
Sadik Armagan | 581742d | 2019-08-12 14:11:37 +0100 | [diff] [blame] | 1588 | bool NeonLayerSupport::IsTransposeConvolution2dSupported(const TensorInfo& input, |
| 1589 | const TensorInfo& output, |
| 1590 | const TransposeConvolution2dDescriptor& descriptor, |
| 1591 | const TensorInfo& weights, |
| 1592 | const Optional<TensorInfo>& biases, |
| 1593 | Optional<std::string&> reasonIfUnsupported) const |
| 1594 | { |
| 1595 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonTransposeConvolution2dWorkloadValidate, |
| 1596 | reasonIfUnsupported, |
| 1597 | input, |
| 1598 | output, |
| 1599 | descriptor, |
| 1600 | weights, |
| 1601 | biases); |
| 1602 | } |
| 1603 | |
Mike Kelly | c9ea45a | 2020-02-28 18:11:58 +0000 | [diff] [blame] | 1604 | bool NeonLayerSupport::IsTransposeSupported(const TensorInfo& input, |
| 1605 | const TensorInfo& output, |
| 1606 | const TransposeDescriptor& descriptor, |
| 1607 | Optional<std::string&> reasonIfUnsupported) const |
| 1608 | { |
| 1609 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonTransposeWorkloadValidate, reasonIfUnsupported, input, output, descriptor); |
| 1610 | } |
| 1611 | |
Cathal Corbett | fd5bec4 | 2022-03-03 15:13:23 +0000 | [diff] [blame] | 1612 | bool NeonLayerSupport::IsUnidirectionalSequenceLstmSupported(const TensorInfo& input, |
| 1613 | const TensorInfo& outputStateIn, |
| 1614 | const TensorInfo& cellStateIn, |
Mike Kelly | 1299496 | 2022-04-21 11:57:09 +0100 | [diff] [blame] | 1615 | const TensorInfo& outputStateOut, |
| 1616 | const TensorInfo& cellStateOut, |
Cathal Corbett | fd5bec4 | 2022-03-03 15:13:23 +0000 | [diff] [blame] | 1617 | const TensorInfo& output, |
Cathal Corbett | fd5bec4 | 2022-03-03 15:13:23 +0000 | [diff] [blame] | 1618 | const UnidirectionalSequenceLstmDescriptor& descriptor, |
| 1619 | const LstmInputParamsInfo& paramsInfo, |
| 1620 | Optional<std::string&> reasonIfUnsupported) const |
| 1621 | { |
Mike Kelly | 1299496 | 2022-04-21 11:57:09 +0100 | [diff] [blame] | 1622 | if (input.GetDataType() == armnn::DataType::QAsymmS8 && |
| 1623 | outputStateIn.GetDataType() == armnn::DataType::QAsymmS8 && |
| 1624 | cellStateIn.GetDataType() == armnn::DataType::QSymmS16 && |
| 1625 | outputStateOut.GetDataType() == armnn::DataType::QAsymmS8 && |
| 1626 | cellStateOut.GetDataType() == armnn::DataType::QSymmS16 && |
| 1627 | output.GetDataType() == armnn::DataType::QAsymmS8) |
| 1628 | { |
| 1629 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonUnidirectionalSequenceLstmWorkloadValidate, |
| 1630 | reasonIfUnsupported, |
| 1631 | input, |
| 1632 | outputStateIn, |
| 1633 | cellStateIn, |
| 1634 | outputStateOut, |
| 1635 | cellStateOut, |
| 1636 | output, |
| 1637 | descriptor, |
| 1638 | paramsInfo); |
| 1639 | } |
| 1640 | else |
| 1641 | { |
| 1642 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonUnidirectionalSequenceLstmFloatWorkloadValidate, |
| 1643 | reasonIfUnsupported, |
| 1644 | input, |
| 1645 | outputStateIn, |
| 1646 | cellStateIn, |
| 1647 | outputStateOut, |
| 1648 | cellStateOut, |
| 1649 | output, |
| 1650 | descriptor, |
| 1651 | paramsInfo); |
| 1652 | } |
Cathal Corbett | fd5bec4 | 2022-03-03 15:13:23 +0000 | [diff] [blame] | 1653 | } |
| 1654 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 1655 | } // namespace armnn |