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 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 10 | #include <armnn/Descriptors.hpp> |
Derek Lamberti | c77874a | 2020-04-28 13:34:56 +0100 | [diff] [blame] | 11 | #include <armnn/Exceptions.hpp> |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 12 | #include <armnn/Tensor.hpp> |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 13 | #include <armnn/Types.hpp> |
Matteo Martincigh | c601aa6 | 2019-10-29 15:03:22 +0000 | [diff] [blame] | 14 | #include <armnn/BackendRegistry.hpp> |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 15 | |
Matteo Martincigh | c601aa6 | 2019-10-29 15:03:22 +0000 | [diff] [blame] | 16 | #include <InternalTypes.hpp> |
| 17 | #include <LayerSupportCommon.hpp> |
Jan Eilers | 8eb2560 | 2020-03-09 12:13:48 +0000 | [diff] [blame] | 18 | #include <armnn/utility/IgnoreUnused.hpp> |
Sadik Armagan | 045f6be | 2020-09-10 13:37:32 +0100 | [diff] [blame] | 19 | #include <armnn/utility/PolymorphicDowncast.hpp> |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 20 | |
Matteo Martincigh | d95e906 | 2019-01-31 15:35:59 +0000 | [diff] [blame] | 21 | #if defined(ARMCOMPUTENEON_ENABLED) |
Narumol Prangnawarat | 15eb583 | 2019-05-20 15:31:05 +0100 | [diff] [blame] | 22 | #include <aclCommon/ArmComputeUtils.hpp> |
Aron Virginas-Tar | 710f664 | 2019-11-27 14:48:32 +0000 | [diff] [blame] | 23 | #include <aclCommon/ArmComputeTensorUtils.hpp> |
Aron Virginas-Tar | 914e4db | 2019-09-09 13:36:45 +0100 | [diff] [blame] | 24 | #include "workloads/NeonAbsWorkload.hpp" |
Matthew Bentham | 955258d | 2018-12-10 10:48:52 +0000 | [diff] [blame] | 25 | #include "workloads/NeonAdditionWorkload.hpp" |
Nattapat Chaimanowong | d4b7059 | 2018-10-12 11:21:49 +0100 | [diff] [blame] | 26 | #include "workloads/NeonActivationWorkload.hpp" |
James Conroy | d47a064 | 2019-09-17 14:22:06 +0100 | [diff] [blame] | 27 | #include "workloads/NeonArgMinMaxWorkload.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" |
Derek Lamberti | c77874a | 2020-04-28 13:34:56 +0100 | [diff] [blame] | 31 | #include "workloads/NeonExpWorkload.hpp" |
Teresa Charlin | cedd34f | 2020-03-30 11:17:30 +0100 | [diff] [blame] | 32 | #include "workloads/NeonComparisonWorkload.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" |
Aron Virginas-Tar | 2f00b74 | 2019-09-30 13:28:08 +0100 | [diff] [blame] | 35 | #include "workloads/NeonDepthToSpaceWorkload.hpp" |
Nattapat Chaimanowong | 7714088 | 2018-10-17 11:12:19 +0100 | [diff] [blame] | 36 | #include "workloads/NeonDepthwiseConvolutionWorkload.hpp" |
Narumol Prangnawarat | 01961a7 | 2019-05-30 16:47:12 +0100 | [diff] [blame] | 37 | #include "workloads/NeonDequantizeWorkload.hpp" |
Sadik Armagan | 0d4863d | 2019-10-09 14:26:32 +0100 | [diff] [blame] | 38 | #include "workloads/NeonInstanceNormalizationWorkload.hpp" |
David Beck | 0dbe0ee | 2018-09-24 15:59:27 +0100 | [diff] [blame] | 39 | #include "workloads/NeonL2NormalizationFloatWorkload.hpp" |
Teresa Charlin | 50de4fa | 2021-05-31 18:47:33 +0100 | [diff] [blame] | 40 | #include "workloads/NeonLogWorkload.hpp" |
Keith Davis | 69e653f | 2020-07-02 11:49:26 +0100 | [diff] [blame] | 41 | #include "workloads/NeonLogSoftmaxWorkload.hpp" |
James Conroy | 177df1e | 2020-11-13 10:18:51 +0000 | [diff] [blame] | 42 | #include "workloads/NeonLogicalAndWorkload.hpp" |
| 43 | #include "workloads/NeonLogicalNotWorkload.hpp" |
| 44 | #include "workloads/NeonLogicalOrWorkload.hpp" |
Jan Eilers | ad5293a | 2019-07-08 09:57:55 +0100 | [diff] [blame] | 45 | #include "workloads/NeonLstmFloatWorkload.hpp" |
Nattapat Chaimanowong | 4e6597a | 2018-12-20 14:14:06 +0000 | [diff] [blame] | 46 | #include "workloads/NeonMaximumWorkload.hpp" |
Matthew Bentham | fd89996 | 2018-12-31 15:49:42 +0000 | [diff] [blame] | 47 | #include "workloads/NeonMeanWorkload.hpp" |
Jim Flynn | 39d487d | 2019-05-17 15:44:36 +0100 | [diff] [blame] | 48 | #include "workloads/NeonConcatWorkload.hpp" |
Conor Kennedy | 54b2169 | 2019-01-09 07:57:38 +0000 | [diff] [blame] | 49 | #include "workloads/NeonMinimumWorkload.hpp" |
Conor Kennedy | b99480b | 2019-03-08 08:24:41 +0000 | [diff] [blame] | 50 | #include "workloads/NeonMultiplicationWorkload.hpp" |
Pablo Tello | e61f071 | 2020-01-23 10:37:17 +0000 | [diff] [blame] | 51 | #include "workloads/NeonDivisionWorkload.hpp" |
Sadik Armagan | ac47210 | 2020-03-24 09:54:36 +0000 | [diff] [blame] | 52 | #include "workloads/NeonNegWorkload.hpp" |
David Beck | 0dbe0ee | 2018-09-24 15:59:27 +0100 | [diff] [blame] | 53 | #include "workloads/NeonNormalizationFloatWorkload.hpp" |
| 54 | #include "workloads/NeonFullyConnectedWorkload.hpp" |
Teresa Charlin | f540eb8 | 2020-04-10 19:24:55 +0100 | [diff] [blame] | 55 | #include "workloads/NeonGatherWorkload.hpp" |
Éanna Ó Catháin | 1205574 | 2019-01-25 10:01:40 +0000 | [diff] [blame] | 56 | #include "workloads/NeonPadWorkload.hpp" |
David Beck | 0dbe0ee | 2018-09-24 15:59:27 +0100 | [diff] [blame] | 57 | #include "workloads/NeonPermuteWorkload.hpp" |
Nattapat Chaimanowong | 5d2e700 | 2018-10-12 16:03:56 +0100 | [diff] [blame] | 58 | #include "workloads/NeonPooling2dWorkload.hpp" |
Nikhil Raj | 9b46148 | 2019-07-03 15:58:31 +0100 | [diff] [blame] | 59 | #include "workloads/NeonPreluWorkload.hpp" |
James Conroy | cc34093 | 2020-05-12 18:08:52 +0100 | [diff] [blame] | 60 | #include "workloads/NeonQLstmWorkload.hpp" |
Sadik Armagan | fabc289 | 2019-05-31 09:05:11 +0100 | [diff] [blame] | 61 | #include "workloads/NeonQuantizeWorkload.hpp" |
Francis Murtagh | 4fc3c48 | 2019-08-02 13:20:54 +0100 | [diff] [blame] | 62 | #include "workloads/NeonQuantizedLstmWorkload.hpp" |
Sadik Armagan | a274748 | 2021-02-09 10:28:54 +0000 | [diff] [blame] | 63 | #include "workloads/NeonReduceWorkload.hpp" |
Kevin May | a023c40 | 2019-12-12 17:28:05 +0000 | [diff] [blame] | 64 | #include "workloads/NeonReshapeWorkload.hpp" |
Ellen Norris-Thompson | 37e6868 | 2019-07-15 14:23:30 +0100 | [diff] [blame] | 65 | #include "workloads/NeonResizeWorkload.hpp" |
Aron Virginas-Tar | 0dd3b43 | 2019-09-10 13:55:09 +0100 | [diff] [blame] | 66 | #include "workloads/NeonRsqrtWorkload.hpp" |
Teresa Charlin | 50de4fa | 2021-05-31 18:47:33 +0100 | [diff] [blame] | 67 | #include "workloads/NeonSinWorkload.hpp" |
josh minor | 036f02d | 2019-11-15 14:53:22 -0600 | [diff] [blame] | 68 | #include "workloads/NeonSliceWorkload.hpp" |
Sadik Armagan | be88a57 | 2020-04-30 11:39:37 +0100 | [diff] [blame] | 69 | #include "workloads/NeonSoftmaxWorkload.hpp" |
Mike Kelly | 0be3a88 | 2020-01-24 11:27:50 +0000 | [diff] [blame] | 70 | #include "workloads/NeonSpaceToBatchNdWorkload.hpp" |
Ellen Norris-Thompson | 2979457 | 2019-06-26 16:40:36 +0100 | [diff] [blame] | 71 | #include "workloads/NeonSpaceToDepthWorkload.hpp" |
Narumol Prangnawarat | 15eb583 | 2019-05-20 15:31:05 +0100 | [diff] [blame] | 72 | #include "workloads/NeonSplitterWorkload.hpp" |
Matthew Jackson | 87f65ea | 2019-08-01 10:01:34 +0100 | [diff] [blame] | 73 | #include "workloads/NeonStackWorkload.hpp" |
FinnWilliamsArm | 1fa1919 | 2019-08-02 17:26:31 +0100 | [diff] [blame] | 74 | #include "workloads/NeonStridedSliceWorkload.hpp" |
Conor Kennedy | b99480b | 2019-03-08 08:24:41 +0000 | [diff] [blame] | 75 | #include "workloads/NeonSubtractionWorkload.hpp" |
Sadik Armagan | 581742d | 2019-08-12 14:11:37 +0100 | [diff] [blame] | 76 | #include "workloads/NeonTransposeConvolution2dWorkload.hpp" |
Mike Kelly | c9ea45a | 2020-02-28 18:11:58 +0000 | [diff] [blame] | 77 | #include "workloads/NeonTransposeWorkload.hpp" |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 78 | #endif |
| 79 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 80 | namespace armnn |
| 81 | { |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 82 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 83 | namespace |
arovir01 | 7ff76c5 | 2018-10-09 09:40:58 +0100 | [diff] [blame] | 84 | { |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 85 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 86 | template< typename ... Args> |
| 87 | bool IsNeonBackendSupported(Optional<std::string&> reasonIfUnsupported, Args... args) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 88 | { |
Jan Eilers | 8eb2560 | 2020-03-09 12:13:48 +0000 | [diff] [blame] | 89 | IgnoreUnused(reasonIfUnsupported, (args)...); |
Matteo Martincigh | d95e906 | 2019-01-31 15:35:59 +0000 | [diff] [blame] | 90 | #if defined(ARMCOMPUTENEON_ENABLED) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 91 | return true; |
| 92 | #else |
Derek Lamberti | 0790dce | 2019-04-15 18:37:35 +0100 | [diff] [blame] | 93 | SetValueChecked(reasonIfUnsupported, "The armnn library has been built without NEON support"); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 94 | return false; |
| 95 | #endif |
| 96 | } |
| 97 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 98 | template<typename FloatFunc, typename Uint8Func, typename ... Params> |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 99 | bool IsSupportedForDataTypeNeon(Optional<std::string&> reasonIfUnsupported, |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 100 | DataType dataType, |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 101 | FloatFunc floatFuncPtr, |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 102 | Uint8Func uint8FuncPtr, |
| 103 | Params&&... params) |
| 104 | { |
| 105 | return IsNeonBackendSupported(reasonIfUnsupported) && |
| 106 | IsSupportedForDataTypeGeneric(reasonIfUnsupported, |
| 107 | dataType, |
| 108 | floatFuncPtr, |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 109 | floatFuncPtr, |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 110 | uint8FuncPtr, |
narpra01 | db2b160 | 2019-01-23 15:23:11 +0000 | [diff] [blame] | 111 | &FalseFunc<>, |
kevmay01 | 2b4d88e | 2019-01-24 14:05:09 +0000 | [diff] [blame] | 112 | &FalseFunc<>, |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 113 | std::forward<Params>(params)...); |
| 114 | } |
| 115 | |
Matteo Martincigh | d95e906 | 2019-01-31 15:35:59 +0000 | [diff] [blame] | 116 | #if defined(ARMCOMPUTENEON_ENABLED) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 117 | template<class FuncType, class... Args> |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 118 | inline bool IsWorkloadSupported(FuncType& func, Optional<std::string&> reasonIfUnsupported, Args&&... args) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 119 | { |
| 120 | arm_compute::Status aclStatus = func(std::forward<Args>(args)...); |
| 121 | const bool supported = (aclStatus.error_code() == arm_compute::ErrorCode::OK); |
| 122 | if (!supported && reasonIfUnsupported) |
| 123 | { |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 124 | reasonIfUnsupported.value() = aclStatus.error_description(); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 125 | } |
| 126 | return supported; |
| 127 | } |
| 128 | |
| 129 | #define FORWARD_WORKLOAD_VALIDATE_FUNC(func, reasonIfUnsupported, ...) \ |
| 130 | return IsWorkloadSupported(func, reasonIfUnsupported, __VA_ARGS__); |
| 131 | #else |
| 132 | #define FORWARD_WORKLOAD_VALIDATE_FUNC(func, reasonIfUnsupported, ...) \ |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 133 | return IsNeonBackendSupported(reasonIfUnsupported, __VA_ARGS__); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 134 | #endif |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 135 | } // anonymous namespace |
| 136 | |
Sadik Armagan | 045f6be | 2020-09-10 13:37:32 +0100 | [diff] [blame] | 137 | NeonLayerSupport::NeonLayerSupport(const IBackendInternal::IBackendSpecificModelContextPtr& modelContextPtr) |
| 138 | : m_ModelContextPtr(modelContextPtr) |
| 139 | { |
| 140 | } |
| 141 | |
| 142 | NeonLayerSupport::NeonLayerSupport() |
| 143 | : m_ModelContextPtr(nullptr) |
| 144 | { |
| 145 | } |
| 146 | |
Aron Virginas-Tar | 914e4db | 2019-09-09 13:36:45 +0100 | [diff] [blame] | 147 | bool NeonLayerSupport::IsAbsSupported(const TensorInfo& input, |
| 148 | const TensorInfo& output, |
| 149 | Optional<std::string&> reasonIfUnsupported) const |
| 150 | { |
josh minor | 4a3c610 | 2020-01-06 16:40:46 -0600 | [diff] [blame] | 151 | ElementwiseUnaryDescriptor descriptor(UnaryOperation::Abs); |
| 152 | return IsElementwiseUnarySupported(input, output, descriptor, reasonIfUnsupported); |
Aron Virginas-Tar | 914e4db | 2019-09-09 13:36:45 +0100 | [diff] [blame] | 153 | } |
| 154 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 155 | bool NeonLayerSupport::IsActivationSupported(const TensorInfo& input, |
| 156 | const TensorInfo& output, |
| 157 | const ActivationDescriptor& descriptor, |
| 158 | Optional<std::string&> reasonIfUnsupported) const |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 159 | { |
Jan Eilers | 8eb2560 | 2020-03-09 12:13:48 +0000 | [diff] [blame] | 160 | IgnoreUnused(descriptor); |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 161 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonActivationWorkloadValidate, |
| 162 | reasonIfUnsupported, |
| 163 | input, |
| 164 | output, |
| 165 | descriptor); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 166 | } |
| 167 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 168 | bool NeonLayerSupport::IsAdditionSupported(const TensorInfo& input0, |
| 169 | const TensorInfo& input1, |
| 170 | const TensorInfo& output, |
| 171 | Optional<std::string&> reasonIfUnsupported) const |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 172 | { |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 173 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonAdditionWorkloadValidate, |
| 174 | reasonIfUnsupported, |
| 175 | input0, |
| 176 | input1, |
Mike Kelly | 07810fc | 2020-11-12 10:58:48 +0000 | [diff] [blame] | 177 | output, |
| 178 | nullptr); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 179 | } |
| 180 | |
James Conroy | d47a064 | 2019-09-17 14:22:06 +0100 | [diff] [blame] | 181 | bool NeonLayerSupport::IsArgMinMaxSupported(const TensorInfo& input, |
| 182 | const TensorInfo& output, |
| 183 | const ArgMinMaxDescriptor& descriptor, |
| 184 | Optional<std::string&> reasonIfUnsupported) const |
| 185 | { |
| 186 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonArgMinMaxWorkloadValidate, |
| 187 | reasonIfUnsupported, |
| 188 | input, |
| 189 | output, |
| 190 | descriptor); |
| 191 | } |
| 192 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 193 | bool NeonLayerSupport::IsBatchNormalizationSupported(const TensorInfo& input, |
| 194 | const TensorInfo& output, |
| 195 | const TensorInfo& mean, |
| 196 | const TensorInfo& var, |
| 197 | const TensorInfo& beta, |
| 198 | const TensorInfo& gamma, |
| 199 | const BatchNormalizationDescriptor& descriptor, |
| 200 | Optional<std::string&> reasonIfUnsupported) const |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 201 | { |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 202 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonBatchNormalizationValidate, |
| 203 | reasonIfUnsupported, |
| 204 | input, |
| 205 | output, |
| 206 | mean, |
| 207 | var, |
| 208 | beta, |
| 209 | gamma, |
Mike Kelly | 07810fc | 2020-11-12 10:58:48 +0000 | [diff] [blame] | 210 | descriptor, |
| 211 | nullptr); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 212 | } |
| 213 | |
Mike Kelly | 5685802 | 2020-01-27 12:14:47 +0000 | [diff] [blame] | 214 | bool NeonLayerSupport::IsBatchToSpaceNdSupported(const TensorInfo& input, |
| 215 | const TensorInfo& output, |
| 216 | const BatchToSpaceNdDescriptor& descriptor, |
| 217 | Optional<std::string&> reasonIfUnsupported) const |
| 218 | { |
| 219 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonBatchToSpaceNdWorkloadValidate, |
| 220 | reasonIfUnsupported, |
| 221 | input, |
| 222 | output, |
| 223 | descriptor); |
| 224 | } |
| 225 | |
Sadik Armagan | 48f011e | 2021-04-21 10:50:34 +0100 | [diff] [blame] | 226 | bool NeonLayerSupport::IsCastSupported(const TensorInfo& input, |
| 227 | const TensorInfo& output, |
| 228 | Optional<std::string&> reasonIfUnsupported) const |
| 229 | { |
| 230 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonCastValidate, |
| 231 | reasonIfUnsupported, |
| 232 | input, |
| 233 | output); |
| 234 | } |
| 235 | |
Aron Virginas-Tar | 77bfb5e | 2019-10-16 17:45:38 +0100 | [diff] [blame] | 236 | bool NeonLayerSupport::IsComparisonSupported(const TensorInfo& input0, |
| 237 | const TensorInfo& input1, |
| 238 | const TensorInfo& output, |
| 239 | const ComparisonDescriptor& descriptor, |
| 240 | Optional<std::string&> reasonIfUnsupported) const |
| 241 | { |
Aron Virginas-Tar | 77bfb5e | 2019-10-16 17:45:38 +0100 | [diff] [blame] | 242 | |
Teresa Charlin | cedd34f | 2020-03-30 11:17:30 +0100 | [diff] [blame] | 243 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonComparisonWorkloadValidate, |
| 244 | reasonIfUnsupported, |
| 245 | input0, |
| 246 | input1, |
| 247 | output, |
| 248 | descriptor); |
Aron Virginas-Tar | 77bfb5e | 2019-10-16 17:45:38 +0100 | [diff] [blame] | 249 | } |
| 250 | |
Jim Flynn | 906f946 | 2019-05-10 13:55:21 +0100 | [diff] [blame] | 251 | bool NeonLayerSupport::IsConcatSupported(const std::vector<const TensorInfo*> inputs, |
| 252 | const TensorInfo& output, |
Jim Flynn | e242f2d | 2019-05-22 14:24:13 +0100 | [diff] [blame] | 253 | const ConcatDescriptor& descriptor, |
Jim Flynn | 906f946 | 2019-05-10 13:55:21 +0100 | [diff] [blame] | 254 | Optional<std::string&> reasonIfUnsupported) const |
| 255 | { |
Jim Flynn | e242f2d | 2019-05-22 14:24:13 +0100 | [diff] [blame] | 256 | if (descriptor.GetNumDimensions() <= descriptor.GetConcatAxis()) |
| 257 | { |
| 258 | SetValueChecked(reasonIfUnsupported, "Neon Concat: Concat axis > Number of dimensions."); |
| 259 | return false; |
| 260 | } |
| 261 | |
| 262 | unsigned int concatInnerAxis = (descriptor.GetNumDimensions() - descriptor.GetConcatAxis()) - 1; |
| 263 | if(concatInnerAxis < 3) // Width, height, or channels |
| 264 | { |
| 265 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonConcatWorkloadValidate, |
| 266 | reasonIfUnsupported, |
| 267 | inputs, |
| 268 | output, |
| 269 | descriptor); |
| 270 | } |
| 271 | else if (concatInnerAxis == 3) |
| 272 | { |
| 273 | for (auto& input : inputs) |
| 274 | { |
| 275 | if (input && !output.IsTypeSpaceMatch(*input)) // Cannot use sub-tensors if the types are not same space |
| 276 | { |
| 277 | SetValueChecked(reasonIfUnsupported, "Neon Concat: Types and quantization parameters must match."); |
| 278 | return false; |
| 279 | } |
| 280 | } |
| 281 | return true; // Sub-tensors support concat along batch |
| 282 | } |
| 283 | else // > 4 dimensions not supported. |
| 284 | { |
| 285 | SetValueChecked(reasonIfUnsupported, "Neon Concat: Maximum of 4 dimensions supported."); |
| 286 | return false; |
| 287 | } |
Jim Flynn | 906f946 | 2019-05-10 13:55:21 +0100 | [diff] [blame] | 288 | } |
| 289 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 290 | bool NeonLayerSupport::IsConstantSupported(const TensorInfo& output, |
| 291 | Optional<std::string&> reasonIfUnsupported) const |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 292 | { |
Mike Kelly | 0886ac4 | 2020-04-27 09:55:40 +0100 | [diff] [blame] | 293 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonConstantWorkloadValidate, |
| 294 | reasonIfUnsupported, |
| 295 | output); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 296 | } |
| 297 | |
Narumol Prangnawarat | 250d392 | 2020-03-30 16:11:04 +0100 | [diff] [blame] | 298 | bool NeonLayerSupport::IsConvertBf16ToFp32Supported(const TensorInfo& input, |
| 299 | const TensorInfo& output, |
| 300 | Optional<std::string&> reasonIfUnsupported) const |
| 301 | { |
| 302 | armnn::IgnoreUnused(input); |
| 303 | armnn::IgnoreUnused(output); |
| 304 | armnn::IgnoreUnused(reasonIfUnsupported); |
| 305 | return true; |
| 306 | } |
| 307 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 308 | bool NeonLayerSupport::IsConvertFp16ToFp32Supported(const TensorInfo& input, |
| 309 | const TensorInfo& output, |
| 310 | Optional<std::string&> reasonIfUnsupported) const |
| 311 | { |
Jan Eilers | 8eb2560 | 2020-03-09 12:13:48 +0000 | [diff] [blame] | 312 | armnn::IgnoreUnused(input); |
| 313 | armnn::IgnoreUnused(output); |
| 314 | armnn::IgnoreUnused(reasonIfUnsupported); |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 315 | return true; |
| 316 | } |
| 317 | |
Narumol Prangnawarat | 250d392 | 2020-03-30 16:11:04 +0100 | [diff] [blame] | 318 | bool NeonLayerSupport::IsConvertFp32ToBf16Supported(const TensorInfo& input, |
| 319 | const TensorInfo& output, |
| 320 | Optional<std::string&> reasonIfUnsupported) const |
| 321 | { |
| 322 | armnn::IgnoreUnused(input); |
| 323 | armnn::IgnoreUnused(output); |
| 324 | armnn::IgnoreUnused(reasonIfUnsupported); |
| 325 | return true; |
| 326 | } |
| 327 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 328 | bool NeonLayerSupport::IsConvertFp32ToFp16Supported(const TensorInfo& input, |
| 329 | const TensorInfo& output, |
| 330 | Optional<std::string&> reasonIfUnsupported) const |
| 331 | { |
Jan Eilers | 8eb2560 | 2020-03-09 12:13:48 +0000 | [diff] [blame] | 332 | armnn::IgnoreUnused(input); |
| 333 | armnn::IgnoreUnused(output); |
| 334 | armnn::IgnoreUnused(reasonIfUnsupported); |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 335 | return true; |
| 336 | } |
| 337 | |
| 338 | bool NeonLayerSupport::IsConvolution2dSupported(const TensorInfo& input, |
| 339 | const TensorInfo& output, |
| 340 | const Convolution2dDescriptor& descriptor, |
| 341 | const TensorInfo& weights, |
| 342 | const Optional<TensorInfo>& biases, |
| 343 | Optional<std::string&> reasonIfUnsupported) const |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 344 | { |
Sadik Armagan | 045f6be | 2020-09-10 13:37:32 +0100 | [diff] [blame] | 345 | bool isFastMathEnabled = false; |
| 346 | #if defined(ARMCOMPUTENEON_ENABLED) |
| 347 | if (m_ModelContextPtr) |
| 348 | { |
| 349 | if (m_ModelContextPtr.get() != nullptr) |
| 350 | { |
Sadik Armagan | 04a7297 | 2020-09-14 15:44:18 +0100 | [diff] [blame] | 351 | auto modelOptions = dynamic_cast<NeonBackendModelContext*>(m_ModelContextPtr.get()); |
Sadik Armagan | 045f6be | 2020-09-10 13:37:32 +0100 | [diff] [blame] | 352 | if (modelOptions) |
| 353 | { |
| 354 | isFastMathEnabled = modelOptions->IsFastMathEnabled(); |
| 355 | } |
| 356 | } |
| 357 | } |
| 358 | #endif |
| 359 | |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 360 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonConvolution2dWorkloadValidate, |
| 361 | reasonIfUnsupported, |
| 362 | input, |
| 363 | output, |
| 364 | descriptor, |
| 365 | weights, |
Sadik Armagan | 045f6be | 2020-09-10 13:37:32 +0100 | [diff] [blame] | 366 | biases, |
Mike Kelly | 07810fc | 2020-11-12 10:58:48 +0000 | [diff] [blame] | 367 | isFastMathEnabled, |
| 368 | nullptr); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 369 | } |
| 370 | |
Aron Virginas-Tar | 2f00b74 | 2019-09-30 13:28:08 +0100 | [diff] [blame] | 371 | bool NeonLayerSupport::IsDepthToSpaceSupported(const TensorInfo& input, |
| 372 | const TensorInfo& output, |
| 373 | const DepthToSpaceDescriptor& descriptor, |
| 374 | Optional<std::string&> reasonIfUnsupported) const |
| 375 | { |
| 376 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonDepthToSpaceWorkloadValidate, |
| 377 | reasonIfUnsupported, |
| 378 | input, |
| 379 | output, |
| 380 | descriptor); |
| 381 | } |
| 382 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 383 | bool NeonLayerSupport::IsDepthwiseConvolutionSupported(const TensorInfo& input, |
| 384 | const TensorInfo& output, |
| 385 | const DepthwiseConvolution2dDescriptor& descriptor, |
| 386 | const TensorInfo& weights, |
| 387 | const Optional<TensorInfo>& biases, |
| 388 | Optional<std::string&> reasonIfUnsupported) const |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 389 | { |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 390 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonDepthwiseConvolutionWorkloadValidate, |
| 391 | reasonIfUnsupported, |
| 392 | input, |
| 393 | output, |
| 394 | descriptor, |
| 395 | weights, |
Mike Kelly | 07810fc | 2020-11-12 10:58:48 +0000 | [diff] [blame] | 396 | biases, |
| 397 | nullptr); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 398 | } |
| 399 | |
Narumol Prangnawarat | 01961a7 | 2019-05-30 16:47:12 +0100 | [diff] [blame] | 400 | bool NeonLayerSupport::IsDequantizeSupported(const TensorInfo& input, |
| 401 | const TensorInfo& output, |
| 402 | Optional<std::string&> reasonIfUnsupported) const |
| 403 | { |
| 404 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonDequantizeWorkloadValidate, |
| 405 | reasonIfUnsupported, |
| 406 | input, |
| 407 | output); |
| 408 | } |
| 409 | |
Pablo Tello | f0bd683 | 2019-04-26 17:58:13 +0100 | [diff] [blame] | 410 | bool NeonLayerSupport::IsDilatedDepthwiseConvolutionSupported(const TensorInfo& input, |
| 411 | const TensorInfo& output, |
| 412 | const DepthwiseConvolution2dDescriptor& descriptor, |
| 413 | const TensorInfo& weights, |
| 414 | const Optional<TensorInfo>& biases, |
| 415 | Optional<std::string&> reasonIfUnsupported) const |
| 416 | { |
| 417 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonDepthwiseConvolutionWorkloadValidate, |
| 418 | reasonIfUnsupported, |
| 419 | input, |
| 420 | output, |
| 421 | descriptor, |
| 422 | weights, |
Mike Kelly | 07810fc | 2020-11-12 10:58:48 +0000 | [diff] [blame] | 423 | biases, |
| 424 | nullptr); |
Pablo Tello | f0bd683 | 2019-04-26 17:58:13 +0100 | [diff] [blame] | 425 | } |
| 426 | |
josh minor | 4a3c610 | 2020-01-06 16:40:46 -0600 | [diff] [blame] | 427 | bool NeonLayerSupport::IsElementwiseUnarySupported(const TensorInfo& input, |
| 428 | const TensorInfo& output, |
| 429 | const ElementwiseUnaryDescriptor& descriptor, |
| 430 | Optional<std::string&> reasonIfUnsupported) const |
| 431 | { |
Derek Lamberti | c77874a | 2020-04-28 13:34:56 +0100 | [diff] [blame] | 432 | switch(descriptor.m_Operation) |
josh minor | 4a3c610 | 2020-01-06 16:40:46 -0600 | [diff] [blame] | 433 | { |
Derek Lamberti | c77874a | 2020-04-28 13:34:56 +0100 | [diff] [blame] | 434 | case UnaryOperation::Abs: |
| 435 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonAbsWorkloadValidate, |
| 436 | reasonIfUnsupported, |
| 437 | input, |
| 438 | output); |
| 439 | case UnaryOperation::Exp: |
| 440 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonExpWorkloadValidate, |
| 441 | reasonIfUnsupported, |
| 442 | input, |
| 443 | output); |
Teresa Charlin | 50de4fa | 2021-05-31 18:47:33 +0100 | [diff] [blame] | 444 | case UnaryOperation::LogicalNot: |
| 445 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonLogicalNotWorkloadValidate, |
| 446 | reasonIfUnsupported, |
| 447 | input, |
| 448 | output); |
| 449 | case UnaryOperation::Log: |
| 450 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonLogWorkloadValidate, |
| 451 | reasonIfUnsupported, |
| 452 | input, |
| 453 | output); |
Derek Lamberti | c77874a | 2020-04-28 13:34:56 +0100 | [diff] [blame] | 454 | case UnaryOperation::Neg: |
| 455 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonNegWorkloadValidate, |
| 456 | reasonIfUnsupported, |
| 457 | input, |
| 458 | output); |
| 459 | case UnaryOperation::Rsqrt: |
| 460 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonRsqrtWorkloadValidate, |
| 461 | reasonIfUnsupported, |
| 462 | input, |
| 463 | output); |
Teresa Charlin | 50de4fa | 2021-05-31 18:47:33 +0100 | [diff] [blame] | 464 | case UnaryOperation::Sin: |
| 465 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonSinWorkloadValidate, |
James Conroy | 177df1e | 2020-11-13 10:18:51 +0000 | [diff] [blame] | 466 | reasonIfUnsupported, |
| 467 | input, |
| 468 | output); |
Derek Lamberti | c77874a | 2020-04-28 13:34:56 +0100 | [diff] [blame] | 469 | default: |
| 470 | return false; |
josh minor | 4a3c610 | 2020-01-06 16:40:46 -0600 | [diff] [blame] | 471 | } |
josh minor | 4a3c610 | 2020-01-06 16:40:46 -0600 | [diff] [blame] | 472 | } |
| 473 | |
Teresa Charlin | 4b10fef | 2020-07-29 09:36:41 +0100 | [diff] [blame] | 474 | bool NeonLayerSupport::IsFillSupported(const TensorInfo& input, |
| 475 | const TensorInfo& output, |
| 476 | const FillDescriptor& descriptor, |
| 477 | Optional<std::string&> reasonIfUnsupported) const |
Sadik Armagan | a792a05 | 2020-06-23 16:22:23 +0100 | [diff] [blame] | 478 | { |
Teresa Charlin | 4b10fef | 2020-07-29 09:36:41 +0100 | [diff] [blame] | 479 | armnn::IgnoreUnused(input); |
| 480 | armnn::IgnoreUnused(output); |
| 481 | armnn::IgnoreUnused(descriptor); |
| 482 | |
| 483 | return IsNeonBackendSupported(reasonIfUnsupported); |
Sadik Armagan | a792a05 | 2020-06-23 16:22:23 +0100 | [diff] [blame] | 484 | } |
| 485 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 486 | bool NeonLayerSupport::IsFloorSupported(const TensorInfo& input, |
| 487 | const TensorInfo& output, |
| 488 | Optional<std::string&> reasonIfUnsupported) const |
| 489 | { |
Jan Eilers | 8eb2560 | 2020-03-09 12:13:48 +0000 | [diff] [blame] | 490 | armnn::IgnoreUnused(output); |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 491 | return IsNeonBackendSupported(reasonIfUnsupported) && |
| 492 | IsSupportedForDataTypeGeneric(reasonIfUnsupported, |
| 493 | input.GetDataType(), |
| 494 | &FalseFuncF16<>, |
| 495 | &TrueFunc<>, |
narpra01 | db2b160 | 2019-01-23 15:23:11 +0000 | [diff] [blame] | 496 | &FalseFuncU8<>, |
kevmay01 | 2b4d88e | 2019-01-24 14:05:09 +0000 | [diff] [blame] | 497 | &FalseFuncI32<>, |
| 498 | &FalseFuncU8<>); |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 499 | } |
| 500 | |
| 501 | bool NeonLayerSupport::IsFullyConnectedSupported(const TensorInfo& input, |
| 502 | const TensorInfo& output, |
| 503 | const TensorInfo& weights, |
| 504 | const TensorInfo& biases, |
| 505 | const FullyConnectedDescriptor& descriptor, |
| 506 | Optional<std::string&> reasonIfUnsupported) const |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 507 | { |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 508 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonFullyConnectedWorkloadValidate, |
| 509 | reasonIfUnsupported, |
| 510 | input, |
| 511 | output, |
| 512 | weights, |
| 513 | biases, |
Mike Kelly | 07810fc | 2020-11-12 10:58:48 +0000 | [diff] [blame] | 514 | descriptor, |
| 515 | nullptr); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 516 | } |
| 517 | |
Teresa Charlin | f540eb8 | 2020-04-10 19:24:55 +0100 | [diff] [blame] | 518 | bool NeonLayerSupport::IsGatherSupported(const TensorInfo& input0, |
| 519 | const TensorInfo& input1, |
| 520 | const TensorInfo& output, |
Teresa Charlin | 5266473 | 2020-06-29 16:27:03 +0100 | [diff] [blame] | 521 | const GatherDescriptor& descriptor, |
Teresa Charlin | f540eb8 | 2020-04-10 19:24:55 +0100 | [diff] [blame] | 522 | Optional<std::string&> reasonIfUnsupported) const |
| 523 | { |
| 524 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonGatherWorkloadValidate, |
| 525 | reasonIfUnsupported, |
| 526 | input0, |
| 527 | input1, |
Teresa Charlin | 5266473 | 2020-06-29 16:27:03 +0100 | [diff] [blame] | 528 | output, |
| 529 | descriptor); |
Teresa Charlin | f540eb8 | 2020-04-10 19:24:55 +0100 | [diff] [blame] | 530 | } |
| 531 | |
kevmay01 | eed8592 | 2019-01-28 08:37:25 +0000 | [diff] [blame] | 532 | bool NeonLayerSupport::IsGreaterSupported(const armnn::TensorInfo& input0, |
| 533 | const armnn::TensorInfo& input1, |
| 534 | const armnn::TensorInfo& output, |
| 535 | armnn::Optional<std::string&> reasonIfUnsupported) const |
| 536 | { |
Aron Virginas-Tar | 77bfb5e | 2019-10-16 17:45:38 +0100 | [diff] [blame] | 537 | ComparisonDescriptor descriptor(ComparisonOperation::Greater); |
| 538 | return IsComparisonSupported(input0, input1, output, descriptor, reasonIfUnsupported); |
kevmay01 | eed8592 | 2019-01-28 08:37:25 +0000 | [diff] [blame] | 539 | } |
| 540 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 541 | bool NeonLayerSupport::IsInputSupported(const TensorInfo& input, |
| 542 | Optional<std::string&> reasonIfUnsupported) const |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 543 | { |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 544 | return IsNeonBackendSupported(reasonIfUnsupported, input); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 545 | } |
| 546 | |
Sadik Armagan | 0d4863d | 2019-10-09 14:26:32 +0100 | [diff] [blame] | 547 | bool NeonLayerSupport::IsInstanceNormalizationSupported(const TensorInfo& input, |
| 548 | const TensorInfo& output, |
| 549 | const InstanceNormalizationDescriptor& descriptor, |
| 550 | Optional<std::string&> reasonIfUnsupported) const |
| 551 | { |
| 552 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonInstanceNormalizationWorkloadValidate, |
| 553 | reasonIfUnsupported, |
| 554 | input, |
| 555 | output, |
| 556 | descriptor); |
| 557 | } |
| 558 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 559 | bool NeonLayerSupport::IsL2NormalizationSupported(const TensorInfo& input, |
| 560 | const TensorInfo& output, |
| 561 | const L2NormalizationDescriptor& descriptor, |
| 562 | Optional<std::string&> reasonIfUnsupported) const |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 563 | { |
Matteo Martincigh | bcd3c85 | 2018-09-28 14:14:12 +0100 | [diff] [blame] | 564 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonL2NormalizationWorkloadValidate, reasonIfUnsupported, input, output, descriptor); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 565 | } |
| 566 | |
James Conroy | 177df1e | 2020-11-13 10:18:51 +0000 | [diff] [blame] | 567 | bool NeonLayerSupport::IsLogicalBinarySupported(const TensorInfo& input0, |
| 568 | const TensorInfo& input1, |
| 569 | const TensorInfo& output, |
| 570 | const LogicalBinaryDescriptor& descriptor, |
| 571 | Optional<std::string&> reasonIfUnsupported) const |
| 572 | { |
| 573 | switch(descriptor.m_Operation) |
| 574 | { |
| 575 | case LogicalBinaryOperation::LogicalAnd: |
| 576 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonLogicalAndWorkloadValidate, |
| 577 | reasonIfUnsupported, |
| 578 | input0, |
| 579 | input1, |
| 580 | output); |
| 581 | case LogicalBinaryOperation::LogicalOr: |
| 582 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonLogicalOrWorkloadValidate, |
| 583 | reasonIfUnsupported, |
| 584 | input0, |
| 585 | input1, |
| 586 | output); |
| 587 | default: |
| 588 | return false; |
| 589 | } |
| 590 | } |
| 591 | |
Keith Davis | 69e653f | 2020-07-02 11:49:26 +0100 | [diff] [blame] | 592 | bool NeonLayerSupport::IsLogSoftmaxSupported(const TensorInfo& input, |
| 593 | const TensorInfo& output, |
| 594 | const LogSoftmaxDescriptor& descriptor, |
| 595 | Optional<std::string&> reasonIfUnsupported) const |
| 596 | { |
| 597 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonLogSoftmaxWorkloadValidate, reasonIfUnsupported, input, output, descriptor); |
| 598 | } |
| 599 | |
Jan Eilers | ad5293a | 2019-07-08 09:57:55 +0100 | [diff] [blame] | 600 | bool NeonLayerSupport::IsLstmSupported(const TensorInfo& input, |
| 601 | const TensorInfo& outputStateIn, |
| 602 | const TensorInfo& cellStateIn, |
| 603 | const TensorInfo& scratchBuffer, |
| 604 | const TensorInfo& outputStateOut, |
| 605 | const TensorInfo& cellStateOut, |
| 606 | const TensorInfo& output, |
| 607 | const LstmDescriptor& descriptor, |
| 608 | const LstmInputParamsInfo& paramsInfo, |
| 609 | Optional<std::string&> reasonIfUnsupported) const |
| 610 | { |
| 611 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonLstmFloatWorkloadValidate, |
| 612 | reasonIfUnsupported, |
| 613 | input, |
| 614 | outputStateIn, |
| 615 | cellStateIn, |
| 616 | scratchBuffer, |
| 617 | outputStateOut, |
| 618 | cellStateOut, |
| 619 | output, |
| 620 | descriptor, |
| 621 | paramsInfo); |
| 622 | } |
| 623 | |
Nattapat Chaimanowong | 4e6597a | 2018-12-20 14:14:06 +0000 | [diff] [blame] | 624 | bool NeonLayerSupport::IsMaximumSupported(const TensorInfo& input0, |
| 625 | const TensorInfo& input1, |
| 626 | const TensorInfo& output, |
| 627 | Optional<std::string&> reasonIfUnsupported) const |
| 628 | { |
| 629 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonMaximumWorkloadValidate, |
| 630 | reasonIfUnsupported, |
| 631 | input0, |
| 632 | input1, |
| 633 | output); |
| 634 | } |
| 635 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 636 | bool NeonLayerSupport::IsMeanSupported(const TensorInfo& input, |
| 637 | const TensorInfo& output, |
| 638 | const MeanDescriptor& descriptor, |
| 639 | Optional<std::string&> reasonIfUnsupported) const |
narpra01 | 32b9046 | 2018-09-13 11:07:48 +0100 | [diff] [blame] | 640 | { |
Matthew Bentham | fd89996 | 2018-12-31 15:49:42 +0000 | [diff] [blame] | 641 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonMeanWorkloadValidate, |
| 642 | reasonIfUnsupported, |
| 643 | input, |
| 644 | output, |
| 645 | descriptor); |
narpra01 | 32b9046 | 2018-09-13 11:07:48 +0100 | [diff] [blame] | 646 | } |
| 647 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 648 | bool NeonLayerSupport::IsMergerSupported(const std::vector<const TensorInfo*> inputs, |
Nikhil Raj | 8599a41 | 2018-11-19 14:51:07 +0000 | [diff] [blame] | 649 | const TensorInfo& output, |
Jim Flynn | e242f2d | 2019-05-22 14:24:13 +0100 | [diff] [blame] | 650 | const MergerDescriptor& descriptor, |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 651 | Optional<std::string&> reasonIfUnsupported) const |
| 652 | { |
Jim Flynn | e242f2d | 2019-05-22 14:24:13 +0100 | [diff] [blame] | 653 | return IsConcatSupported(inputs, output, descriptor, reasonIfUnsupported); |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 654 | } |
| 655 | |
Conor Kennedy | 54b2169 | 2019-01-09 07:57:38 +0000 | [diff] [blame] | 656 | bool NeonLayerSupport::IsMinimumSupported(const TensorInfo& input0, |
| 657 | const TensorInfo& input1, |
| 658 | const TensorInfo& output, |
| 659 | Optional<std::string&> reasonIfUnsupported) const |
| 660 | { |
| 661 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonMinimumWorkloadValidate, |
| 662 | reasonIfUnsupported, |
| 663 | input0, |
| 664 | input1, |
| 665 | output); |
| 666 | } |
| 667 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 668 | bool NeonLayerSupport::IsMultiplicationSupported(const TensorInfo& input0, |
| 669 | const TensorInfo& input1, |
| 670 | const TensorInfo& output, |
| 671 | Optional<std::string&> reasonIfUnsupported) const |
| 672 | { |
| 673 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonMultiplicationWorkloadValidate, |
| 674 | reasonIfUnsupported, |
| 675 | input0, |
| 676 | input1, |
Mike Kelly | 07810fc | 2020-11-12 10:58:48 +0000 | [diff] [blame] | 677 | output, |
| 678 | nullptr); |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 679 | } |
| 680 | |
Pablo Tello | e61f071 | 2020-01-23 10:37:17 +0000 | [diff] [blame] | 681 | bool NeonLayerSupport::IsDivisionSupported(const TensorInfo& input0, |
| 682 | const TensorInfo& input1, |
| 683 | const TensorInfo& output, |
| 684 | Optional<std::string&> reasonIfUnsupported) const |
| 685 | { |
| 686 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonDivisionWorkloadValidate, |
| 687 | reasonIfUnsupported, |
| 688 | input0, |
| 689 | input1, |
Mike Kelly | 07810fc | 2020-11-12 10:58:48 +0000 | [diff] [blame] | 690 | output, |
| 691 | nullptr); |
Pablo Tello | e61f071 | 2020-01-23 10:37:17 +0000 | [diff] [blame] | 692 | } |
| 693 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 694 | bool NeonLayerSupport::IsNormalizationSupported(const TensorInfo& input, |
| 695 | const TensorInfo& output, |
| 696 | const NormalizationDescriptor& descriptor, |
| 697 | Optional<std::string&> reasonIfUnsupported) const |
| 698 | { |
| 699 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonNormalizationWorkloadValidate, |
| 700 | reasonIfUnsupported, |
| 701 | input, |
| 702 | output, |
| 703 | descriptor); |
| 704 | } |
| 705 | |
| 706 | bool NeonLayerSupport::IsOutputSupported(const TensorInfo& output, |
| 707 | Optional<std::string&> reasonIfUnsupported) const |
| 708 | { |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 709 | return IsNeonBackendSupported(reasonIfUnsupported, output); |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 710 | } |
| 711 | |
Éanna Ó Catháin | 1205574 | 2019-01-25 10:01:40 +0000 | [diff] [blame] | 712 | bool NeonLayerSupport::IsPadSupported(const TensorInfo& input, |
| 713 | const TensorInfo& output, |
| 714 | const PadDescriptor& descriptor, |
| 715 | Optional<std::string&> reasonIfUnsupported) const |
| 716 | { |
| 717 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonPadWorkloadValidate, |
| 718 | reasonIfUnsupported, |
| 719 | input, |
| 720 | output, |
| 721 | descriptor); |
| 722 | } |
| 723 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 724 | bool NeonLayerSupport::IsPermuteSupported(const TensorInfo& input, |
| 725 | const TensorInfo& output, |
| 726 | const PermuteDescriptor& descriptor, |
| 727 | Optional<std::string&> reasonIfUnsupported) const |
| 728 | { |
| 729 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonPermuteWorkloadValidate, reasonIfUnsupported, input, output, descriptor); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 730 | } |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 731 | |
| 732 | bool NeonLayerSupport::IsPooling2dSupported(const TensorInfo& input, |
| 733 | const TensorInfo& output, |
| 734 | const Pooling2dDescriptor& descriptor, |
| 735 | Optional<std::string&> reasonIfUnsupported) const |
| 736 | { |
| 737 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonPooling2dWorkloadValidate, reasonIfUnsupported, input, output, descriptor); |
| 738 | } |
| 739 | |
Nikhil Raj | 9b46148 | 2019-07-03 15:58:31 +0100 | [diff] [blame] | 740 | bool NeonLayerSupport::IsPreluSupported(const armnn::TensorInfo &input, |
| 741 | const armnn::TensorInfo &alpha, |
| 742 | const armnn::TensorInfo &output, |
| 743 | armnn::Optional<std::string &> reasonIfUnsupported) const |
| 744 | { |
| 745 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonPreluWorkloadValidate, reasonIfUnsupported, input, alpha, output); |
| 746 | } |
| 747 | |
James Conroy | cc34093 | 2020-05-12 18:08:52 +0100 | [diff] [blame] | 748 | bool NeonLayerSupport::IsQLstmSupported(const TensorInfo& input, |
| 749 | const TensorInfo& previousOutputIn, |
| 750 | const TensorInfo& previousCellStateIn, |
| 751 | const TensorInfo& outputStateOut, |
| 752 | const TensorInfo& cellStateOut, |
| 753 | const TensorInfo& output, |
| 754 | const QLstmDescriptor& descriptor, |
| 755 | const LstmInputParamsInfo& paramsInfo, |
| 756 | Optional<std::string&> reasonIfUnsupported) const |
| 757 | { |
| 758 | // Check required here in order to pass IsLayerSupported for datatypes tests |
| 759 | if (input.GetDataType() == armnn::DataType::QAsymmS8 && |
| 760 | previousOutputIn.GetDataType() == armnn::DataType::QAsymmS8 && |
| 761 | previousCellStateIn.GetDataType() == armnn::DataType::QSymmS16 && |
| 762 | outputStateOut.GetDataType() == armnn::DataType::QAsymmS8 && |
| 763 | cellStateOut.GetDataType() == armnn::DataType::QSymmS16 && |
| 764 | output.GetDataType() == armnn::DataType::QAsymmS8) |
| 765 | { |
| 766 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonQLstmWorkloadValidate, |
| 767 | reasonIfUnsupported, |
| 768 | input, |
| 769 | previousCellStateIn, |
| 770 | previousOutputIn, |
| 771 | cellStateOut, |
| 772 | outputStateOut, |
| 773 | output, |
| 774 | descriptor, |
| 775 | paramsInfo); |
| 776 | } |
| 777 | else |
| 778 | { |
| 779 | return false; |
| 780 | } |
| 781 | } |
| 782 | |
Sadik Armagan | fabc289 | 2019-05-31 09:05:11 +0100 | [diff] [blame] | 783 | bool NeonLayerSupport::IsQuantizeSupported(const TensorInfo& input, |
| 784 | const TensorInfo& output, |
| 785 | Optional<std::string&> reasonIfUnsupported) const |
| 786 | { |
| 787 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonQuantizeWorkloadValidate, |
| 788 | reasonIfUnsupported, |
| 789 | input, |
| 790 | output); |
| 791 | } |
| 792 | |
Francis Murtagh | 4fc3c48 | 2019-08-02 13:20:54 +0100 | [diff] [blame] | 793 | bool NeonLayerSupport::IsQuantizedLstmSupported(const TensorInfo& input, |
| 794 | const TensorInfo& cellStateIn, |
| 795 | const TensorInfo& outputStateIn, |
| 796 | const TensorInfo& cellStateOut, |
| 797 | const TensorInfo& outputStateOut, |
| 798 | const QuantizedLstmInputParamsInfo& paramsInfo, |
| 799 | Optional<std::string&> reasonIfUnsupported) const |
| 800 | { |
| 801 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonQuantizedLstmWorkloadValidate, |
| 802 | reasonIfUnsupported, |
| 803 | input, |
| 804 | cellStateIn, |
| 805 | outputStateIn, |
| 806 | cellStateOut, |
| 807 | outputStateOut, |
| 808 | paramsInfo); |
| 809 | } |
| 810 | |
Sadik Armagan | a274748 | 2021-02-09 10:28:54 +0000 | [diff] [blame] | 811 | bool NeonLayerSupport::IsReduceSupported(const TensorInfo& input, |
| 812 | const TensorInfo& output, |
| 813 | const ReduceDescriptor& descriptor, |
| 814 | Optional<std::string&> reasonIfUnsupported) const |
| 815 | { |
| 816 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonReduceWorkloadValidate, |
| 817 | reasonIfUnsupported, |
| 818 | input, |
| 819 | output, |
| 820 | descriptor); |
| 821 | } |
| 822 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 823 | bool NeonLayerSupport::IsReshapeSupported(const TensorInfo& input, |
Kevin May | a023c40 | 2019-12-12 17:28:05 +0000 | [diff] [blame] | 824 | const TensorInfo& output, |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 825 | const ReshapeDescriptor& descriptor, |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 826 | Optional<std::string&> reasonIfUnsupported) const |
| 827 | { |
Jan Eilers | 8eb2560 | 2020-03-09 12:13:48 +0000 | [diff] [blame] | 828 | armnn::IgnoreUnused(descriptor); |
Kevin May | a023c40 | 2019-12-12 17:28:05 +0000 | [diff] [blame] | 829 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonReshapeWorkloadValidate, |
| 830 | reasonIfUnsupported, |
| 831 | input, |
| 832 | output); |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 833 | } |
| 834 | |
Aron Virginas-Tar | 169d2f1 | 2019-07-01 19:01:44 +0100 | [diff] [blame] | 835 | bool NeonLayerSupport::IsResizeSupported(const TensorInfo& input, |
| 836 | const TensorInfo& output, |
| 837 | const ResizeDescriptor& descriptor, |
| 838 | Optional<std::string&> reasonIfUnsupported) const |
| 839 | { |
Ellen Norris-Thompson | 37e6868 | 2019-07-15 14:23:30 +0100 | [diff] [blame] | 840 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonResizeWorkloadValidate, |
| 841 | reasonIfUnsupported, |
| 842 | input, |
| 843 | output, |
| 844 | descriptor); |
Aron Virginas-Tar | 169d2f1 | 2019-07-01 19:01:44 +0100 | [diff] [blame] | 845 | } |
| 846 | |
Sadik Armagan | c625f00 | 2018-12-17 11:32:16 +0000 | [diff] [blame] | 847 | bool NeonLayerSupport::IsResizeBilinearSupported(const TensorInfo& input, |
| 848 | const TensorInfo& output, |
| 849 | Optional<std::string&> reasonIfUnsupported) const |
| 850 | { |
Ellen Norris-Thompson | 37e6868 | 2019-07-15 14:23:30 +0100 | [diff] [blame] | 851 | ResizeDescriptor descriptor; |
| 852 | descriptor.m_Method = ResizeMethod::Bilinear; |
| 853 | descriptor.m_DataLayout = DataLayout::NCHW; |
| 854 | |
| 855 | const TensorShape& outputShape = output.GetShape(); |
| 856 | descriptor.m_TargetHeight = outputShape[2]; |
| 857 | descriptor.m_TargetWidth = outputShape[3]; |
| 858 | |
| 859 | return IsResizeSupported(input, output, descriptor, reasonIfUnsupported); |
Sadik Armagan | c625f00 | 2018-12-17 11:32:16 +0000 | [diff] [blame] | 860 | } |
| 861 | |
Aron Virginas-Tar | 0dd3b43 | 2019-09-10 13:55:09 +0100 | [diff] [blame] | 862 | bool NeonLayerSupport::IsRsqrtSupported(const TensorInfo& input, |
| 863 | const TensorInfo& output, |
| 864 | Optional<std::string&> reasonIfUnsupported) const |
| 865 | { |
josh minor | 4a3c610 | 2020-01-06 16:40:46 -0600 | [diff] [blame] | 866 | ElementwiseUnaryDescriptor descriptor(UnaryOperation::Rsqrt); |
| 867 | return IsElementwiseUnarySupported(input, output, descriptor, reasonIfUnsupported); |
Aron Virginas-Tar | 0dd3b43 | 2019-09-10 13:55:09 +0100 | [diff] [blame] | 868 | } |
| 869 | |
josh minor | 036f02d | 2019-11-15 14:53:22 -0600 | [diff] [blame] | 870 | bool NeonLayerSupport::IsSliceSupported(const TensorInfo& input, |
| 871 | const TensorInfo& output, |
| 872 | const SliceDescriptor& descriptor, |
| 873 | Optional<std::string&> reasonIfUnsupported) const |
| 874 | { |
| 875 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonSliceWorkloadValidate, |
| 876 | reasonIfUnsupported, |
| 877 | input, |
| 878 | output, |
| 879 | descriptor); |
| 880 | } |
| 881 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 882 | bool NeonLayerSupport::IsSoftmaxSupported(const TensorInfo& input, |
| 883 | const TensorInfo& output, |
| 884 | const SoftmaxDescriptor& descriptor, |
| 885 | Optional<std::string&> reasonIfUnsupported) const |
| 886 | { |
| 887 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonSoftmaxWorkloadValidate, reasonIfUnsupported, input, output, descriptor); |
| 888 | } |
| 889 | |
Mike Kelly | 0be3a88 | 2020-01-24 11:27:50 +0000 | [diff] [blame] | 890 | bool NeonLayerSupport::IsSpaceToBatchNdSupported(const TensorInfo& input, |
| 891 | const TensorInfo& output, |
| 892 | const SpaceToBatchNdDescriptor& descriptor, |
| 893 | Optional<std::string&> reasonIfUnsupported) const |
| 894 | { |
| 895 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonSpaceToBatchNdWorkloadValidate, |
| 896 | reasonIfUnsupported, |
| 897 | input, |
| 898 | output, |
| 899 | descriptor); |
| 900 | } |
| 901 | |
Ellen Norris-Thompson | 2979457 | 2019-06-26 16:40:36 +0100 | [diff] [blame] | 902 | bool NeonLayerSupport::IsSpaceToDepthSupported(const TensorInfo& input, |
Mike Kelly | 0be3a88 | 2020-01-24 11:27:50 +0000 | [diff] [blame] | 903 | const TensorInfo& output, |
| 904 | const SpaceToDepthDescriptor& descriptor, |
| 905 | Optional<std::string&> reasonIfUnsupported) const |
Ellen Norris-Thompson | 2979457 | 2019-06-26 16:40:36 +0100 | [diff] [blame] | 906 | { |
| 907 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonSpaceToDepthWorkloadValidate, |
| 908 | reasonIfUnsupported, |
| 909 | input, |
| 910 | output, |
| 911 | descriptor); |
| 912 | } |
| 913 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 914 | bool NeonLayerSupport::IsSplitterSupported(const TensorInfo& input, |
| 915 | const ViewsDescriptor& descriptor, |
| 916 | Optional<std::string&> reasonIfUnsupported) const |
| 917 | { |
Jan Eilers | 8eb2560 | 2020-03-09 12:13:48 +0000 | [diff] [blame] | 918 | armnn::IgnoreUnused(descriptor); |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 919 | return IsSupportedForDataTypeNeon(reasonIfUnsupported, |
| 920 | input.GetDataType(), |
| 921 | &TrueFunc<>, |
| 922 | &TrueFunc<>); |
| 923 | } |
| 924 | |
Narumol Prangnawarat | 15eb583 | 2019-05-20 15:31:05 +0100 | [diff] [blame] | 925 | bool NeonLayerSupport::IsSplitterSupported(const TensorInfo& input, |
| 926 | const std::vector<std::reference_wrapper<TensorInfo>>& outputs, |
| 927 | const ViewsDescriptor& descriptor, |
| 928 | Optional<std::string&> reasonIfUnsupported) const |
| 929 | { |
| 930 | #if defined(ARMCOMPUTENEON_ENABLED) |
| 931 | // Split along the last dimension, cannot use sub-tensors |
| 932 | // as width and height of the sub-tensors do not match |
| 933 | // the width and height of the parent tensor |
| 934 | // in case of input with more than 2D. |
| 935 | std::set<unsigned int> splitAxis = ComputeSplitAxis(descriptor, input.GetShape()); |
| 936 | if (descriptor.GetNumDimensions() > 2 && splitAxis.size() == 1 && |
| 937 | *splitAxis.begin() == descriptor.GetNumDimensions() - 1 ) |
| 938 | { |
| 939 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonSplitterWorkloadValidate, |
| 940 | reasonIfUnsupported, |
| 941 | input, |
| 942 | outputs, |
| 943 | *splitAxis.begin()); |
| 944 | } |
| 945 | #endif |
Jan Eilers | 8eb2560 | 2020-03-09 12:13:48 +0000 | [diff] [blame] | 946 | IgnoreUnused(descriptor); |
Narumol Prangnawarat | 15eb583 | 2019-05-20 15:31:05 +0100 | [diff] [blame] | 947 | for (auto output : outputs) |
| 948 | { |
| 949 | if (!input.IsTypeSpaceMatch(output)) // Cannot use sub-tensors if the types are not same space |
| 950 | { |
| 951 | SetValueChecked(reasonIfUnsupported, "Neon Splitter: Types and quantization parameters must match."); |
| 952 | return false; |
| 953 | } |
| 954 | } |
| 955 | return true; |
| 956 | } |
| 957 | |
Matthew Jackson | 87f65ea | 2019-08-01 10:01:34 +0100 | [diff] [blame] | 958 | bool NeonLayerSupport::IsStackSupported(const std::vector<const TensorInfo*>& inputs, |
| 959 | const TensorInfo& output, |
| 960 | const StackDescriptor& descriptor, |
| 961 | Optional<std::string&> reasonIfUnsupported) const |
| 962 | { |
| 963 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonStackWorkloadValidate, |
| 964 | reasonIfUnsupported, |
| 965 | inputs, |
| 966 | output, |
| 967 | descriptor); |
| 968 | } |
| 969 | |
FinnWilliamsArm | 1fa1919 | 2019-08-02 17:26:31 +0100 | [diff] [blame] | 970 | bool NeonLayerSupport::IsStridedSliceSupported(const TensorInfo& input, |
| 971 | const TensorInfo& output, |
| 972 | const StridedSliceDescriptor& descriptor, |
| 973 | Optional<std::string&> reasonIfUnsupported) const |
| 974 | { |
| 975 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonStridedSliceWorkloadValidate, |
| 976 | reasonIfUnsupported, |
| 977 | input, |
| 978 | output, |
| 979 | descriptor); |
| 980 | } |
| 981 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 982 | bool NeonLayerSupport::IsSubtractionSupported(const TensorInfo& input0, |
| 983 | const TensorInfo& input1, |
| 984 | const TensorInfo& output, |
| 985 | Optional<std::string&> reasonIfUnsupported) const |
| 986 | { |
| 987 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonSubtractionWorkloadValidate, |
| 988 | reasonIfUnsupported, |
| 989 | input0, |
| 990 | input1, |
Mike Kelly | 07810fc | 2020-11-12 10:58:48 +0000 | [diff] [blame] | 991 | output, |
| 992 | nullptr); |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 993 | } |
| 994 | |
Sadik Armagan | 581742d | 2019-08-12 14:11:37 +0100 | [diff] [blame] | 995 | bool NeonLayerSupport::IsTransposeConvolution2dSupported(const TensorInfo& input, |
| 996 | const TensorInfo& output, |
| 997 | const TransposeConvolution2dDescriptor& descriptor, |
| 998 | const TensorInfo& weights, |
| 999 | const Optional<TensorInfo>& biases, |
| 1000 | Optional<std::string&> reasonIfUnsupported) const |
| 1001 | { |
| 1002 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonTransposeConvolution2dWorkloadValidate, |
| 1003 | reasonIfUnsupported, |
| 1004 | input, |
| 1005 | output, |
| 1006 | descriptor, |
| 1007 | weights, |
| 1008 | biases); |
| 1009 | } |
| 1010 | |
Mike Kelly | c9ea45a | 2020-02-28 18:11:58 +0000 | [diff] [blame] | 1011 | bool NeonLayerSupport::IsTransposeSupported(const TensorInfo& input, |
| 1012 | const TensorInfo& output, |
| 1013 | const TransposeDescriptor& descriptor, |
| 1014 | Optional<std::string&> reasonIfUnsupported) const |
| 1015 | { |
| 1016 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonTransposeWorkloadValidate, reasonIfUnsupported, input, output, descriptor); |
| 1017 | } |
| 1018 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 1019 | } // namespace armnn |