telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2017 Arm Ltd. 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" |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 8 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 9 | #include <armnn/Descriptors.hpp> |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 10 | #include <armnn/Tensor.hpp> |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 11 | #include <armnn/Types.hpp> |
Matteo Martincigh | c601aa6 | 2019-10-29 15:03:22 +0000 | [diff] [blame] | 12 | #include <armnn/BackendRegistry.hpp> |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 13 | |
Matteo Martincigh | c601aa6 | 2019-10-29 15:03:22 +0000 | [diff] [blame] | 14 | #include <InternalTypes.hpp> |
| 15 | #include <LayerSupportCommon.hpp> |
David Beck | 3e9e115 | 2018-10-17 14:17:50 +0100 | [diff] [blame] | 16 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 17 | #include <boost/core/ignore_unused.hpp> |
| 18 | |
Matteo Martincigh | d95e906 | 2019-01-31 15:35:59 +0000 | [diff] [blame] | 19 | #if defined(ARMCOMPUTENEON_ENABLED) |
Narumol Prangnawarat | 15eb583 | 2019-05-20 15:31:05 +0100 | [diff] [blame] | 20 | #include <aclCommon/ArmComputeUtils.hpp> |
Aron Virginas-Tar | 914e4db | 2019-09-09 13:36:45 +0100 | [diff] [blame] | 21 | #include "workloads/NeonAbsWorkload.hpp" |
Matthew Bentham | 955258d | 2018-12-10 10:48:52 +0000 | [diff] [blame] | 22 | #include "workloads/NeonAdditionWorkload.hpp" |
Nattapat Chaimanowong | d4b7059 | 2018-10-12 11:21:49 +0100 | [diff] [blame] | 23 | #include "workloads/NeonActivationWorkload.hpp" |
James Conroy | d47a064 | 2019-09-17 14:22:06 +0100 | [diff] [blame] | 24 | #include "workloads/NeonArgMinMaxWorkload.hpp" |
Matthew Bentham | c48ac8c | 2018-12-12 16:15:59 +0000 | [diff] [blame] | 25 | #include "workloads/NeonBatchNormalizationWorkload.hpp" |
Nattapat Chaimanowong | 974b65f | 2018-10-15 15:07:34 +0100 | [diff] [blame] | 26 | #include "workloads/NeonConvolution2dWorkload.hpp" |
Aron Virginas-Tar | 2f00b74 | 2019-09-30 13:28:08 +0100 | [diff] [blame] | 27 | #include "workloads/NeonDepthToSpaceWorkload.hpp" |
Nattapat Chaimanowong | 7714088 | 2018-10-17 11:12:19 +0100 | [diff] [blame] | 28 | #include "workloads/NeonDepthwiseConvolutionWorkload.hpp" |
Narumol Prangnawarat | 01961a7 | 2019-05-30 16:47:12 +0100 | [diff] [blame] | 29 | #include "workloads/NeonDequantizeWorkload.hpp" |
kevmay01 | eed8592 | 2019-01-28 08:37:25 +0000 | [diff] [blame] | 30 | #include "workloads/NeonGreaterWorkload.hpp" |
Sadik Armagan | 0d4863d | 2019-10-09 14:26:32 +0100 | [diff] [blame] | 31 | #include "workloads/NeonInstanceNormalizationWorkload.hpp" |
David Beck | 0dbe0ee | 2018-09-24 15:59:27 +0100 | [diff] [blame] | 32 | #include "workloads/NeonL2NormalizationFloatWorkload.hpp" |
Jan Eilers | ad5293a | 2019-07-08 09:57:55 +0100 | [diff] [blame] | 33 | #include "workloads/NeonLstmFloatWorkload.hpp" |
Nattapat Chaimanowong | 4e6597a | 2018-12-20 14:14:06 +0000 | [diff] [blame] | 34 | #include "workloads/NeonMaximumWorkload.hpp" |
Matthew Bentham | fd89996 | 2018-12-31 15:49:42 +0000 | [diff] [blame] | 35 | #include "workloads/NeonMeanWorkload.hpp" |
Jim Flynn | 39d487d | 2019-05-17 15:44:36 +0100 | [diff] [blame] | 36 | #include "workloads/NeonConcatWorkload.hpp" |
Conor Kennedy | 54b2169 | 2019-01-09 07:57:38 +0000 | [diff] [blame] | 37 | #include "workloads/NeonMinimumWorkload.hpp" |
Conor Kennedy | b99480b | 2019-03-08 08:24:41 +0000 | [diff] [blame] | 38 | #include "workloads/NeonMultiplicationWorkload.hpp" |
David Beck | 0dbe0ee | 2018-09-24 15:59:27 +0100 | [diff] [blame] | 39 | #include "workloads/NeonNormalizationFloatWorkload.hpp" |
| 40 | #include "workloads/NeonFullyConnectedWorkload.hpp" |
Éanna Ó Catháin | 1205574 | 2019-01-25 10:01:40 +0000 | [diff] [blame] | 41 | #include "workloads/NeonPadWorkload.hpp" |
David Beck | 0dbe0ee | 2018-09-24 15:59:27 +0100 | [diff] [blame] | 42 | #include "workloads/NeonPermuteWorkload.hpp" |
Nattapat Chaimanowong | 5d2e700 | 2018-10-12 16:03:56 +0100 | [diff] [blame] | 43 | #include "workloads/NeonPooling2dWorkload.hpp" |
Nikhil Raj | 9b46148 | 2019-07-03 15:58:31 +0100 | [diff] [blame] | 44 | #include "workloads/NeonPreluWorkload.hpp" |
Sadik Armagan | fabc289 | 2019-05-31 09:05:11 +0100 | [diff] [blame] | 45 | #include "workloads/NeonQuantizeWorkload.hpp" |
Francis Murtagh | 4fc3c48 | 2019-08-02 13:20:54 +0100 | [diff] [blame] | 46 | #include "workloads/NeonQuantizedLstmWorkload.hpp" |
Ellen Norris-Thompson | 37e6868 | 2019-07-15 14:23:30 +0100 | [diff] [blame] | 47 | #include "workloads/NeonResizeWorkload.hpp" |
Aron Virginas-Tar | 0dd3b43 | 2019-09-10 13:55:09 +0100 | [diff] [blame] | 48 | #include "workloads/NeonRsqrtWorkload.hpp" |
David Beck | 0dbe0ee | 2018-09-24 15:59:27 +0100 | [diff] [blame] | 49 | #include "workloads/NeonSoftmaxBaseWorkload.hpp" |
Ellen Norris-Thompson | 2979457 | 2019-06-26 16:40:36 +0100 | [diff] [blame] | 50 | #include "workloads/NeonSpaceToDepthWorkload.hpp" |
Narumol Prangnawarat | 15eb583 | 2019-05-20 15:31:05 +0100 | [diff] [blame] | 51 | #include "workloads/NeonSplitterWorkload.hpp" |
Matthew Jackson | 87f65ea | 2019-08-01 10:01:34 +0100 | [diff] [blame] | 52 | #include "workloads/NeonStackWorkload.hpp" |
FinnWilliamsArm | 1fa1919 | 2019-08-02 17:26:31 +0100 | [diff] [blame] | 53 | #include "workloads/NeonStridedSliceWorkload.hpp" |
Conor Kennedy | b99480b | 2019-03-08 08:24:41 +0000 | [diff] [blame] | 54 | #include "workloads/NeonSubtractionWorkload.hpp" |
Sadik Armagan | 581742d | 2019-08-12 14:11:37 +0100 | [diff] [blame] | 55 | #include "workloads/NeonTransposeConvolution2dWorkload.hpp" |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 56 | #endif |
| 57 | |
| 58 | using namespace boost; |
| 59 | |
| 60 | namespace armnn |
| 61 | { |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 62 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 63 | namespace |
arovir01 | 7ff76c5 | 2018-10-09 09:40:58 +0100 | [diff] [blame] | 64 | { |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 65 | |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 66 | bool IsNeonBackendSupported(Optional<std::string&> reasonIfUnsupported) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 67 | { |
Matteo Martincigh | d95e906 | 2019-01-31 15:35:59 +0000 | [diff] [blame] | 68 | #if defined(ARMCOMPUTENEON_ENABLED) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 69 | return true; |
| 70 | #else |
Derek Lamberti | 0790dce | 2019-04-15 18:37:35 +0100 | [diff] [blame] | 71 | SetValueChecked(reasonIfUnsupported, "The armnn library has been built without NEON support"); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 72 | return false; |
| 73 | #endif |
| 74 | } |
| 75 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 76 | template<typename FloatFunc, typename Uint8Func, typename ... Params> |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 77 | bool IsSupportedForDataTypeNeon(Optional<std::string&> reasonIfUnsupported, |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 78 | DataType dataType, |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 79 | FloatFunc floatFuncPtr, |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 80 | Uint8Func uint8FuncPtr, |
| 81 | Params&&... params) |
| 82 | { |
| 83 | return IsNeonBackendSupported(reasonIfUnsupported) && |
| 84 | IsSupportedForDataTypeGeneric(reasonIfUnsupported, |
| 85 | dataType, |
| 86 | floatFuncPtr, |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 87 | floatFuncPtr, |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 88 | uint8FuncPtr, |
narpra01 | db2b160 | 2019-01-23 15:23:11 +0000 | [diff] [blame] | 89 | &FalseFunc<>, |
kevmay01 | 2b4d88e | 2019-01-24 14:05:09 +0000 | [diff] [blame] | 90 | &FalseFunc<>, |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 91 | std::forward<Params>(params)...); |
| 92 | } |
| 93 | |
Matteo Martincigh | d95e906 | 2019-01-31 15:35:59 +0000 | [diff] [blame] | 94 | #if defined(ARMCOMPUTENEON_ENABLED) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 95 | template<class FuncType, class... Args> |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 96 | inline bool IsWorkloadSupported(FuncType& func, Optional<std::string&> reasonIfUnsupported, Args&&... args) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 97 | { |
| 98 | arm_compute::Status aclStatus = func(std::forward<Args>(args)...); |
| 99 | const bool supported = (aclStatus.error_code() == arm_compute::ErrorCode::OK); |
| 100 | if (!supported && reasonIfUnsupported) |
| 101 | { |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 102 | reasonIfUnsupported.value() = aclStatus.error_description(); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 103 | } |
| 104 | return supported; |
| 105 | } |
| 106 | |
| 107 | #define FORWARD_WORKLOAD_VALIDATE_FUNC(func, reasonIfUnsupported, ...) \ |
| 108 | return IsWorkloadSupported(func, reasonIfUnsupported, __VA_ARGS__); |
| 109 | #else |
| 110 | #define FORWARD_WORKLOAD_VALIDATE_FUNC(func, reasonIfUnsupported, ...) \ |
| 111 | return IsNeonBackendSupported(reasonIfUnsupported); |
| 112 | #endif |
| 113 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 114 | } // anonymous namespace |
| 115 | |
Aron Virginas-Tar | 914e4db | 2019-09-09 13:36:45 +0100 | [diff] [blame] | 116 | bool NeonLayerSupport::IsAbsSupported(const TensorInfo& input, |
| 117 | const TensorInfo& output, |
| 118 | Optional<std::string&> reasonIfUnsupported) const |
| 119 | { |
| 120 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonAbsWorkloadValidate, |
| 121 | reasonIfUnsupported, |
| 122 | input, |
| 123 | output); |
| 124 | } |
| 125 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 126 | bool NeonLayerSupport::IsActivationSupported(const TensorInfo& input, |
| 127 | const TensorInfo& output, |
| 128 | const ActivationDescriptor& descriptor, |
| 129 | Optional<std::string&> reasonIfUnsupported) const |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 130 | { |
| 131 | ignore_unused(descriptor); |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 132 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonActivationWorkloadValidate, |
| 133 | reasonIfUnsupported, |
| 134 | input, |
| 135 | output, |
| 136 | descriptor); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 137 | } |
| 138 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 139 | bool NeonLayerSupport::IsAdditionSupported(const TensorInfo& input0, |
| 140 | const TensorInfo& input1, |
| 141 | const TensorInfo& output, |
| 142 | Optional<std::string&> reasonIfUnsupported) const |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 143 | { |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 144 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonAdditionWorkloadValidate, |
| 145 | reasonIfUnsupported, |
| 146 | input0, |
| 147 | input1, |
| 148 | output); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 149 | } |
| 150 | |
James Conroy | d47a064 | 2019-09-17 14:22:06 +0100 | [diff] [blame] | 151 | bool NeonLayerSupport::IsArgMinMaxSupported(const TensorInfo& input, |
| 152 | const TensorInfo& output, |
| 153 | const ArgMinMaxDescriptor& descriptor, |
| 154 | Optional<std::string&> reasonIfUnsupported) const |
| 155 | { |
| 156 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonArgMinMaxWorkloadValidate, |
| 157 | reasonIfUnsupported, |
| 158 | input, |
| 159 | output, |
| 160 | descriptor); |
| 161 | } |
| 162 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 163 | bool NeonLayerSupport::IsBatchNormalizationSupported(const TensorInfo& input, |
| 164 | const TensorInfo& output, |
| 165 | const TensorInfo& mean, |
| 166 | const TensorInfo& var, |
| 167 | const TensorInfo& beta, |
| 168 | const TensorInfo& gamma, |
| 169 | const BatchNormalizationDescriptor& descriptor, |
| 170 | Optional<std::string&> reasonIfUnsupported) const |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 171 | { |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 172 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonBatchNormalizationValidate, |
| 173 | reasonIfUnsupported, |
| 174 | input, |
| 175 | output, |
| 176 | mean, |
| 177 | var, |
| 178 | beta, |
| 179 | gamma, |
| 180 | descriptor); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 181 | } |
| 182 | |
Aron Virginas-Tar | 77bfb5e | 2019-10-16 17:45:38 +0100 | [diff] [blame] | 183 | bool NeonLayerSupport::IsComparisonSupported(const TensorInfo& input0, |
| 184 | const TensorInfo& input1, |
| 185 | const TensorInfo& output, |
| 186 | const ComparisonDescriptor& descriptor, |
| 187 | Optional<std::string&> reasonIfUnsupported) const |
| 188 | { |
| 189 | if (descriptor.m_Operation == ComparisonOperation::Greater) |
| 190 | { |
| 191 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonGreaterWorkloadValidate, |
| 192 | reasonIfUnsupported, |
| 193 | input0, |
| 194 | input1, |
| 195 | output); |
| 196 | } |
| 197 | |
| 198 | return false; |
| 199 | } |
| 200 | |
Jim Flynn | 906f946 | 2019-05-10 13:55:21 +0100 | [diff] [blame] | 201 | bool NeonLayerSupport::IsConcatSupported(const std::vector<const TensorInfo*> inputs, |
| 202 | const TensorInfo& output, |
Jim Flynn | e242f2d | 2019-05-22 14:24:13 +0100 | [diff] [blame] | 203 | const ConcatDescriptor& descriptor, |
Jim Flynn | 906f946 | 2019-05-10 13:55:21 +0100 | [diff] [blame] | 204 | Optional<std::string&> reasonIfUnsupported) const |
| 205 | { |
Jim Flynn | e242f2d | 2019-05-22 14:24:13 +0100 | [diff] [blame] | 206 | if (descriptor.GetNumDimensions() <= descriptor.GetConcatAxis()) |
| 207 | { |
| 208 | SetValueChecked(reasonIfUnsupported, "Neon Concat: Concat axis > Number of dimensions."); |
| 209 | return false; |
| 210 | } |
| 211 | |
| 212 | unsigned int concatInnerAxis = (descriptor.GetNumDimensions() - descriptor.GetConcatAxis()) - 1; |
| 213 | if(concatInnerAxis < 3) // Width, height, or channels |
| 214 | { |
| 215 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonConcatWorkloadValidate, |
| 216 | reasonIfUnsupported, |
| 217 | inputs, |
| 218 | output, |
| 219 | descriptor); |
| 220 | } |
| 221 | else if (concatInnerAxis == 3) |
| 222 | { |
| 223 | for (auto& input : inputs) |
| 224 | { |
| 225 | if (input && !output.IsTypeSpaceMatch(*input)) // Cannot use sub-tensors if the types are not same space |
| 226 | { |
| 227 | SetValueChecked(reasonIfUnsupported, "Neon Concat: Types and quantization parameters must match."); |
| 228 | return false; |
| 229 | } |
| 230 | } |
| 231 | return true; // Sub-tensors support concat along batch |
| 232 | } |
| 233 | else // > 4 dimensions not supported. |
| 234 | { |
| 235 | SetValueChecked(reasonIfUnsupported, "Neon Concat: Maximum of 4 dimensions supported."); |
| 236 | return false; |
| 237 | } |
Jim Flynn | 906f946 | 2019-05-10 13:55:21 +0100 | [diff] [blame] | 238 | } |
| 239 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 240 | bool NeonLayerSupport::IsConstantSupported(const TensorInfo& output, |
| 241 | Optional<std::string&> reasonIfUnsupported) const |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 242 | { |
| 243 | return IsSupportedForDataTypeNeon(reasonIfUnsupported, |
| 244 | output.GetDataType(), |
| 245 | &TrueFunc<>, |
| 246 | &TrueFunc<>); |
| 247 | } |
| 248 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 249 | bool NeonLayerSupport::IsConvertFp16ToFp32Supported(const TensorInfo& input, |
| 250 | const TensorInfo& output, |
| 251 | Optional<std::string&> reasonIfUnsupported) const |
| 252 | { |
| 253 | ignore_unused(input); |
| 254 | ignore_unused(output); |
| 255 | ignore_unused(reasonIfUnsupported); |
| 256 | return true; |
| 257 | } |
| 258 | |
| 259 | bool NeonLayerSupport::IsConvertFp32ToFp16Supported(const TensorInfo& input, |
| 260 | const TensorInfo& output, |
| 261 | Optional<std::string&> reasonIfUnsupported) const |
| 262 | { |
| 263 | ignore_unused(input); |
| 264 | ignore_unused(output); |
| 265 | ignore_unused(reasonIfUnsupported); |
| 266 | return true; |
| 267 | } |
| 268 | |
| 269 | bool NeonLayerSupport::IsConvolution2dSupported(const TensorInfo& input, |
| 270 | const TensorInfo& output, |
| 271 | const Convolution2dDescriptor& descriptor, |
| 272 | const TensorInfo& weights, |
| 273 | const Optional<TensorInfo>& biases, |
| 274 | Optional<std::string&> reasonIfUnsupported) const |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 275 | { |
Aron Virginas-Tar | 07f25e0 | 2019-11-07 15:19:52 +0000 | [diff] [blame] | 276 | if (weights.HasPerAxisQuantization()) |
| 277 | { |
| 278 | return false; |
| 279 | } |
| 280 | |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 281 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonConvolution2dWorkloadValidate, |
| 282 | reasonIfUnsupported, |
| 283 | input, |
| 284 | output, |
| 285 | descriptor, |
| 286 | weights, |
| 287 | biases); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 288 | } |
| 289 | |
Aron Virginas-Tar | 2f00b74 | 2019-09-30 13:28:08 +0100 | [diff] [blame] | 290 | bool NeonLayerSupport::IsDepthToSpaceSupported(const TensorInfo& input, |
| 291 | const TensorInfo& output, |
| 292 | const DepthToSpaceDescriptor& descriptor, |
| 293 | Optional<std::string&> reasonIfUnsupported) const |
| 294 | { |
| 295 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonDepthToSpaceWorkloadValidate, |
| 296 | reasonIfUnsupported, |
| 297 | input, |
| 298 | output, |
| 299 | descriptor); |
| 300 | } |
| 301 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 302 | bool NeonLayerSupport::IsDepthwiseConvolutionSupported(const TensorInfo& input, |
| 303 | const TensorInfo& output, |
| 304 | const DepthwiseConvolution2dDescriptor& descriptor, |
| 305 | const TensorInfo& weights, |
| 306 | const Optional<TensorInfo>& biases, |
| 307 | Optional<std::string&> reasonIfUnsupported) const |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 308 | { |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 309 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonDepthwiseConvolutionWorkloadValidate, |
| 310 | reasonIfUnsupported, |
| 311 | input, |
| 312 | output, |
| 313 | descriptor, |
| 314 | weights, |
| 315 | biases); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 316 | } |
| 317 | |
Narumol Prangnawarat | 01961a7 | 2019-05-30 16:47:12 +0100 | [diff] [blame] | 318 | bool NeonLayerSupport::IsDequantizeSupported(const TensorInfo& input, |
| 319 | const TensorInfo& output, |
| 320 | Optional<std::string&> reasonIfUnsupported) const |
| 321 | { |
| 322 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonDequantizeWorkloadValidate, |
| 323 | reasonIfUnsupported, |
| 324 | input, |
| 325 | output); |
| 326 | } |
| 327 | |
Pablo Tello | f0bd683 | 2019-04-26 17:58:13 +0100 | [diff] [blame] | 328 | bool NeonLayerSupport::IsDilatedDepthwiseConvolutionSupported(const TensorInfo& input, |
| 329 | const TensorInfo& output, |
| 330 | const DepthwiseConvolution2dDescriptor& descriptor, |
| 331 | const TensorInfo& weights, |
| 332 | const Optional<TensorInfo>& biases, |
| 333 | Optional<std::string&> reasonIfUnsupported) const |
| 334 | { |
| 335 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonDepthwiseConvolutionWorkloadValidate, |
| 336 | reasonIfUnsupported, |
| 337 | input, |
| 338 | output, |
| 339 | descriptor, |
| 340 | weights, |
| 341 | biases); |
| 342 | } |
| 343 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 344 | bool NeonLayerSupport::IsFloorSupported(const TensorInfo& input, |
| 345 | const TensorInfo& output, |
| 346 | Optional<std::string&> reasonIfUnsupported) const |
| 347 | { |
| 348 | ignore_unused(output); |
| 349 | return IsNeonBackendSupported(reasonIfUnsupported) && |
| 350 | IsSupportedForDataTypeGeneric(reasonIfUnsupported, |
| 351 | input.GetDataType(), |
| 352 | &FalseFuncF16<>, |
| 353 | &TrueFunc<>, |
narpra01 | db2b160 | 2019-01-23 15:23:11 +0000 | [diff] [blame] | 354 | &FalseFuncU8<>, |
kevmay01 | 2b4d88e | 2019-01-24 14:05:09 +0000 | [diff] [blame] | 355 | &FalseFuncI32<>, |
| 356 | &FalseFuncU8<>); |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 357 | } |
| 358 | |
| 359 | bool NeonLayerSupport::IsFullyConnectedSupported(const TensorInfo& input, |
| 360 | const TensorInfo& output, |
| 361 | const TensorInfo& weights, |
| 362 | const TensorInfo& biases, |
| 363 | const FullyConnectedDescriptor& descriptor, |
| 364 | Optional<std::string&> reasonIfUnsupported) const |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 365 | { |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 366 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonFullyConnectedWorkloadValidate, |
| 367 | reasonIfUnsupported, |
| 368 | input, |
| 369 | output, |
| 370 | weights, |
| 371 | biases, |
| 372 | descriptor); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 373 | } |
| 374 | |
kevmay01 | eed8592 | 2019-01-28 08:37:25 +0000 | [diff] [blame] | 375 | bool NeonLayerSupport::IsGreaterSupported(const armnn::TensorInfo& input0, |
| 376 | const armnn::TensorInfo& input1, |
| 377 | const armnn::TensorInfo& output, |
| 378 | armnn::Optional<std::string&> reasonIfUnsupported) const |
| 379 | { |
Aron Virginas-Tar | 77bfb5e | 2019-10-16 17:45:38 +0100 | [diff] [blame] | 380 | ComparisonDescriptor descriptor(ComparisonOperation::Greater); |
| 381 | return IsComparisonSupported(input0, input1, output, descriptor, reasonIfUnsupported); |
kevmay01 | eed8592 | 2019-01-28 08:37:25 +0000 | [diff] [blame] | 382 | } |
| 383 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 384 | bool NeonLayerSupport::IsInputSupported(const TensorInfo& input, |
| 385 | Optional<std::string&> reasonIfUnsupported) const |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 386 | { |
Francis Murtagh | b3fc252 | 2019-08-09 13:20:50 +0100 | [diff] [blame] | 387 | return IsNeonBackendSupported(reasonIfUnsupported); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 388 | } |
| 389 | |
Sadik Armagan | 0d4863d | 2019-10-09 14:26:32 +0100 | [diff] [blame] | 390 | bool NeonLayerSupport::IsInstanceNormalizationSupported(const TensorInfo& input, |
| 391 | const TensorInfo& output, |
| 392 | const InstanceNormalizationDescriptor& descriptor, |
| 393 | Optional<std::string&> reasonIfUnsupported) const |
| 394 | { |
| 395 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonInstanceNormalizationWorkloadValidate, |
| 396 | reasonIfUnsupported, |
| 397 | input, |
| 398 | output, |
| 399 | descriptor); |
| 400 | } |
| 401 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 402 | bool NeonLayerSupport::IsL2NormalizationSupported(const TensorInfo& input, |
| 403 | const TensorInfo& output, |
| 404 | const L2NormalizationDescriptor& descriptor, |
| 405 | Optional<std::string&> reasonIfUnsupported) const |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 406 | { |
Matteo Martincigh | bcd3c85 | 2018-09-28 14:14:12 +0100 | [diff] [blame] | 407 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonL2NormalizationWorkloadValidate, reasonIfUnsupported, input, output, descriptor); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 408 | } |
| 409 | |
Jan Eilers | ad5293a | 2019-07-08 09:57:55 +0100 | [diff] [blame] | 410 | bool NeonLayerSupport::IsLstmSupported(const TensorInfo& input, |
| 411 | const TensorInfo& outputStateIn, |
| 412 | const TensorInfo& cellStateIn, |
| 413 | const TensorInfo& scratchBuffer, |
| 414 | const TensorInfo& outputStateOut, |
| 415 | const TensorInfo& cellStateOut, |
| 416 | const TensorInfo& output, |
| 417 | const LstmDescriptor& descriptor, |
| 418 | const LstmInputParamsInfo& paramsInfo, |
| 419 | Optional<std::string&> reasonIfUnsupported) const |
| 420 | { |
| 421 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonLstmFloatWorkloadValidate, |
| 422 | reasonIfUnsupported, |
| 423 | input, |
| 424 | outputStateIn, |
| 425 | cellStateIn, |
| 426 | scratchBuffer, |
| 427 | outputStateOut, |
| 428 | cellStateOut, |
| 429 | output, |
| 430 | descriptor, |
| 431 | paramsInfo); |
| 432 | } |
| 433 | |
Nattapat Chaimanowong | 4e6597a | 2018-12-20 14:14:06 +0000 | [diff] [blame] | 434 | bool NeonLayerSupport::IsMaximumSupported(const TensorInfo& input0, |
| 435 | const TensorInfo& input1, |
| 436 | const TensorInfo& output, |
| 437 | Optional<std::string&> reasonIfUnsupported) const |
| 438 | { |
| 439 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonMaximumWorkloadValidate, |
| 440 | reasonIfUnsupported, |
| 441 | input0, |
| 442 | input1, |
| 443 | output); |
| 444 | } |
| 445 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 446 | bool NeonLayerSupport::IsMeanSupported(const TensorInfo& input, |
| 447 | const TensorInfo& output, |
| 448 | const MeanDescriptor& descriptor, |
| 449 | Optional<std::string&> reasonIfUnsupported) const |
narpra01 | 32b9046 | 2018-09-13 11:07:48 +0100 | [diff] [blame] | 450 | { |
Matthew Bentham | fd89996 | 2018-12-31 15:49:42 +0000 | [diff] [blame] | 451 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonMeanWorkloadValidate, |
| 452 | reasonIfUnsupported, |
| 453 | input, |
| 454 | output, |
| 455 | descriptor); |
narpra01 | 32b9046 | 2018-09-13 11:07:48 +0100 | [diff] [blame] | 456 | } |
| 457 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 458 | bool NeonLayerSupport::IsMergerSupported(const std::vector<const TensorInfo*> inputs, |
Nikhil Raj | 8599a41 | 2018-11-19 14:51:07 +0000 | [diff] [blame] | 459 | const TensorInfo& output, |
Jim Flynn | e242f2d | 2019-05-22 14:24:13 +0100 | [diff] [blame] | 460 | const MergerDescriptor& descriptor, |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 461 | Optional<std::string&> reasonIfUnsupported) const |
| 462 | { |
Jim Flynn | e242f2d | 2019-05-22 14:24:13 +0100 | [diff] [blame] | 463 | return IsConcatSupported(inputs, output, descriptor, reasonIfUnsupported); |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 464 | } |
| 465 | |
Conor Kennedy | 54b2169 | 2019-01-09 07:57:38 +0000 | [diff] [blame] | 466 | bool NeonLayerSupport::IsMinimumSupported(const TensorInfo& input0, |
| 467 | const TensorInfo& input1, |
| 468 | const TensorInfo& output, |
| 469 | Optional<std::string&> reasonIfUnsupported) const |
| 470 | { |
| 471 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonMinimumWorkloadValidate, |
| 472 | reasonIfUnsupported, |
| 473 | input0, |
| 474 | input1, |
| 475 | output); |
| 476 | } |
| 477 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 478 | bool NeonLayerSupport::IsMultiplicationSupported(const TensorInfo& input0, |
| 479 | const TensorInfo& input1, |
| 480 | const TensorInfo& output, |
| 481 | Optional<std::string&> reasonIfUnsupported) const |
| 482 | { |
| 483 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonMultiplicationWorkloadValidate, |
| 484 | reasonIfUnsupported, |
| 485 | input0, |
| 486 | input1, |
| 487 | output); |
| 488 | } |
| 489 | |
| 490 | bool NeonLayerSupport::IsNormalizationSupported(const TensorInfo& input, |
| 491 | const TensorInfo& output, |
| 492 | const NormalizationDescriptor& descriptor, |
| 493 | Optional<std::string&> reasonIfUnsupported) const |
| 494 | { |
| 495 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonNormalizationWorkloadValidate, |
| 496 | reasonIfUnsupported, |
| 497 | input, |
| 498 | output, |
| 499 | descriptor); |
| 500 | } |
| 501 | |
| 502 | bool NeonLayerSupport::IsOutputSupported(const TensorInfo& output, |
| 503 | Optional<std::string&> reasonIfUnsupported) const |
| 504 | { |
Francis Murtagh | b3fc252 | 2019-08-09 13:20:50 +0100 | [diff] [blame] | 505 | return IsNeonBackendSupported(reasonIfUnsupported); |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 506 | } |
| 507 | |
Éanna Ó Catháin | 1205574 | 2019-01-25 10:01:40 +0000 | [diff] [blame] | 508 | bool NeonLayerSupport::IsPadSupported(const TensorInfo& input, |
| 509 | const TensorInfo& output, |
| 510 | const PadDescriptor& descriptor, |
| 511 | Optional<std::string&> reasonIfUnsupported) const |
| 512 | { |
| 513 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonPadWorkloadValidate, |
| 514 | reasonIfUnsupported, |
| 515 | input, |
| 516 | output, |
| 517 | descriptor); |
| 518 | } |
| 519 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 520 | bool NeonLayerSupport::IsPermuteSupported(const TensorInfo& input, |
| 521 | const TensorInfo& output, |
| 522 | const PermuteDescriptor& descriptor, |
| 523 | Optional<std::string&> reasonIfUnsupported) const |
| 524 | { |
| 525 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonPermuteWorkloadValidate, reasonIfUnsupported, input, output, descriptor); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 526 | } |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 527 | |
| 528 | bool NeonLayerSupport::IsPooling2dSupported(const TensorInfo& input, |
| 529 | const TensorInfo& output, |
| 530 | const Pooling2dDescriptor& descriptor, |
| 531 | Optional<std::string&> reasonIfUnsupported) const |
| 532 | { |
| 533 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonPooling2dWorkloadValidate, reasonIfUnsupported, input, output, descriptor); |
| 534 | } |
| 535 | |
Nikhil Raj | 9b46148 | 2019-07-03 15:58:31 +0100 | [diff] [blame] | 536 | bool NeonLayerSupport::IsPreluSupported(const armnn::TensorInfo &input, |
| 537 | const armnn::TensorInfo &alpha, |
| 538 | const armnn::TensorInfo &output, |
| 539 | armnn::Optional<std::string &> reasonIfUnsupported) const |
| 540 | { |
| 541 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonPreluWorkloadValidate, reasonIfUnsupported, input, alpha, output); |
| 542 | } |
| 543 | |
Sadik Armagan | fabc289 | 2019-05-31 09:05:11 +0100 | [diff] [blame] | 544 | bool NeonLayerSupport::IsQuantizeSupported(const TensorInfo& input, |
| 545 | const TensorInfo& output, |
| 546 | Optional<std::string&> reasonIfUnsupported) const |
| 547 | { |
| 548 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonQuantizeWorkloadValidate, |
| 549 | reasonIfUnsupported, |
| 550 | input, |
| 551 | output); |
| 552 | } |
| 553 | |
Francis Murtagh | 4fc3c48 | 2019-08-02 13:20:54 +0100 | [diff] [blame] | 554 | bool NeonLayerSupport::IsQuantizedLstmSupported(const TensorInfo& input, |
| 555 | const TensorInfo& cellStateIn, |
| 556 | const TensorInfo& outputStateIn, |
| 557 | const TensorInfo& cellStateOut, |
| 558 | const TensorInfo& outputStateOut, |
| 559 | const QuantizedLstmInputParamsInfo& paramsInfo, |
| 560 | Optional<std::string&> reasonIfUnsupported) const |
| 561 | { |
| 562 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonQuantizedLstmWorkloadValidate, |
| 563 | reasonIfUnsupported, |
| 564 | input, |
| 565 | cellStateIn, |
| 566 | outputStateIn, |
| 567 | cellStateOut, |
| 568 | outputStateOut, |
| 569 | paramsInfo); |
| 570 | } |
| 571 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 572 | bool NeonLayerSupport::IsReshapeSupported(const TensorInfo& input, |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 573 | const ReshapeDescriptor& descriptor, |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 574 | Optional<std::string&> reasonIfUnsupported) const |
| 575 | { |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 576 | ignore_unused(descriptor); |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 577 | return IsSupportedForDataTypeNeon(reasonIfUnsupported, |
| 578 | input.GetDataType(), |
| 579 | &TrueFunc<>, |
| 580 | &TrueFunc<>); |
| 581 | } |
| 582 | |
Aron Virginas-Tar | 169d2f1 | 2019-07-01 19:01:44 +0100 | [diff] [blame] | 583 | bool NeonLayerSupport::IsResizeSupported(const TensorInfo& input, |
| 584 | const TensorInfo& output, |
| 585 | const ResizeDescriptor& descriptor, |
| 586 | Optional<std::string&> reasonIfUnsupported) const |
| 587 | { |
Ellen Norris-Thompson | 37e6868 | 2019-07-15 14:23:30 +0100 | [diff] [blame] | 588 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonResizeWorkloadValidate, |
| 589 | reasonIfUnsupported, |
| 590 | input, |
| 591 | output, |
| 592 | descriptor); |
Aron Virginas-Tar | 169d2f1 | 2019-07-01 19:01:44 +0100 | [diff] [blame] | 593 | } |
| 594 | |
Sadik Armagan | c625f00 | 2018-12-17 11:32:16 +0000 | [diff] [blame] | 595 | bool NeonLayerSupport::IsResizeBilinearSupported(const TensorInfo& input, |
| 596 | const TensorInfo& output, |
| 597 | Optional<std::string&> reasonIfUnsupported) const |
| 598 | { |
Ellen Norris-Thompson | 37e6868 | 2019-07-15 14:23:30 +0100 | [diff] [blame] | 599 | ResizeDescriptor descriptor; |
| 600 | descriptor.m_Method = ResizeMethod::Bilinear; |
| 601 | descriptor.m_DataLayout = DataLayout::NCHW; |
| 602 | |
| 603 | const TensorShape& outputShape = output.GetShape(); |
| 604 | descriptor.m_TargetHeight = outputShape[2]; |
| 605 | descriptor.m_TargetWidth = outputShape[3]; |
| 606 | |
| 607 | return IsResizeSupported(input, output, descriptor, reasonIfUnsupported); |
Sadik Armagan | c625f00 | 2018-12-17 11:32:16 +0000 | [diff] [blame] | 608 | } |
| 609 | |
Aron Virginas-Tar | 0dd3b43 | 2019-09-10 13:55:09 +0100 | [diff] [blame] | 610 | bool NeonLayerSupport::IsRsqrtSupported(const TensorInfo& input, |
| 611 | const TensorInfo& output, |
| 612 | Optional<std::string&> reasonIfUnsupported) const |
| 613 | { |
| 614 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonRsqrtWorkloadValidate, reasonIfUnsupported, input, output); |
| 615 | } |
| 616 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 617 | bool NeonLayerSupport::IsSoftmaxSupported(const TensorInfo& input, |
| 618 | const TensorInfo& output, |
| 619 | const SoftmaxDescriptor& descriptor, |
| 620 | Optional<std::string&> reasonIfUnsupported) const |
| 621 | { |
| 622 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonSoftmaxWorkloadValidate, reasonIfUnsupported, input, output, descriptor); |
| 623 | } |
| 624 | |
Ellen Norris-Thompson | 2979457 | 2019-06-26 16:40:36 +0100 | [diff] [blame] | 625 | bool NeonLayerSupport::IsSpaceToDepthSupported(const TensorInfo& input, |
| 626 | const TensorInfo& output, |
| 627 | const SpaceToDepthDescriptor& descriptor, |
| 628 | Optional<std::string&> reasonIfUnsupported) const |
| 629 | { |
| 630 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonSpaceToDepthWorkloadValidate, |
| 631 | reasonIfUnsupported, |
| 632 | input, |
| 633 | output, |
| 634 | descriptor); |
| 635 | } |
| 636 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 637 | bool NeonLayerSupport::IsSplitterSupported(const TensorInfo& input, |
| 638 | const ViewsDescriptor& descriptor, |
| 639 | Optional<std::string&> reasonIfUnsupported) const |
| 640 | { |
| 641 | ignore_unused(descriptor); |
| 642 | return IsSupportedForDataTypeNeon(reasonIfUnsupported, |
| 643 | input.GetDataType(), |
| 644 | &TrueFunc<>, |
| 645 | &TrueFunc<>); |
| 646 | } |
| 647 | |
Narumol Prangnawarat | 15eb583 | 2019-05-20 15:31:05 +0100 | [diff] [blame] | 648 | bool NeonLayerSupport::IsSplitterSupported(const TensorInfo& input, |
| 649 | const std::vector<std::reference_wrapper<TensorInfo>>& outputs, |
| 650 | const ViewsDescriptor& descriptor, |
| 651 | Optional<std::string&> reasonIfUnsupported) const |
| 652 | { |
| 653 | #if defined(ARMCOMPUTENEON_ENABLED) |
| 654 | // Split along the last dimension, cannot use sub-tensors |
| 655 | // as width and height of the sub-tensors do not match |
| 656 | // the width and height of the parent tensor |
| 657 | // in case of input with more than 2D. |
| 658 | std::set<unsigned int> splitAxis = ComputeSplitAxis(descriptor, input.GetShape()); |
| 659 | if (descriptor.GetNumDimensions() > 2 && splitAxis.size() == 1 && |
| 660 | *splitAxis.begin() == descriptor.GetNumDimensions() - 1 ) |
| 661 | { |
| 662 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonSplitterWorkloadValidate, |
| 663 | reasonIfUnsupported, |
| 664 | input, |
| 665 | outputs, |
| 666 | *splitAxis.begin()); |
| 667 | } |
| 668 | #endif |
| 669 | for (auto output : outputs) |
| 670 | { |
| 671 | if (!input.IsTypeSpaceMatch(output)) // Cannot use sub-tensors if the types are not same space |
| 672 | { |
| 673 | SetValueChecked(reasonIfUnsupported, "Neon Splitter: Types and quantization parameters must match."); |
| 674 | return false; |
| 675 | } |
| 676 | } |
| 677 | return true; |
| 678 | } |
| 679 | |
Matthew Jackson | 87f65ea | 2019-08-01 10:01:34 +0100 | [diff] [blame] | 680 | bool NeonLayerSupport::IsStackSupported(const std::vector<const TensorInfo*>& inputs, |
| 681 | const TensorInfo& output, |
| 682 | const StackDescriptor& descriptor, |
| 683 | Optional<std::string&> reasonIfUnsupported) const |
| 684 | { |
| 685 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonStackWorkloadValidate, |
| 686 | reasonIfUnsupported, |
| 687 | inputs, |
| 688 | output, |
| 689 | descriptor); |
| 690 | } |
| 691 | |
FinnWilliamsArm | 1fa1919 | 2019-08-02 17:26:31 +0100 | [diff] [blame] | 692 | bool NeonLayerSupport::IsStridedSliceSupported(const TensorInfo& input, |
| 693 | const TensorInfo& output, |
| 694 | const StridedSliceDescriptor& descriptor, |
| 695 | Optional<std::string&> reasonIfUnsupported) const |
| 696 | { |
| 697 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonStridedSliceWorkloadValidate, |
| 698 | reasonIfUnsupported, |
| 699 | input, |
| 700 | output, |
| 701 | descriptor); |
| 702 | } |
| 703 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 704 | bool NeonLayerSupport::IsSubtractionSupported(const TensorInfo& input0, |
| 705 | const TensorInfo& input1, |
| 706 | const TensorInfo& output, |
| 707 | Optional<std::string&> reasonIfUnsupported) const |
| 708 | { |
| 709 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonSubtractionWorkloadValidate, |
| 710 | reasonIfUnsupported, |
| 711 | input0, |
| 712 | input1, |
| 713 | output); |
| 714 | } |
| 715 | |
Sadik Armagan | 581742d | 2019-08-12 14:11:37 +0100 | [diff] [blame] | 716 | bool NeonLayerSupport::IsTransposeConvolution2dSupported(const TensorInfo& input, |
| 717 | const TensorInfo& output, |
| 718 | const TransposeConvolution2dDescriptor& descriptor, |
| 719 | const TensorInfo& weights, |
| 720 | const Optional<TensorInfo>& biases, |
| 721 | Optional<std::string&> reasonIfUnsupported) const |
| 722 | { |
| 723 | FORWARD_WORKLOAD_VALIDATE_FUNC(NeonTransposeConvolution2dWorkloadValidate, |
| 724 | reasonIfUnsupported, |
| 725 | input, |
| 726 | output, |
| 727 | descriptor, |
| 728 | weights, |
| 729 | biases); |
| 730 | } |
| 731 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 732 | } // namespace armnn |