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