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