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 | #pragma once |
| 6 | |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 7 | #include <backendsCommon/LayerSupportBase.hpp> |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 8 | |
| 9 | namespace armnn |
| 10 | { |
| 11 | |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 12 | class NeonLayerSupport : public LayerSupportBase |
arovir01 | 4424b0a | 2018-10-04 10:46:04 +0100 | [diff] [blame] | 13 | { |
arovir01 | 7ff76c5 | 2018-10-09 09:40:58 +0100 | [diff] [blame] | 14 | public: |
Aron Virginas-Tar | 914e4db | 2019-09-09 13:36:45 +0100 | [diff] [blame] | 15 | bool IsAbsSupported(const TensorInfo& input, |
| 16 | const TensorInfo& output, |
| 17 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 18 | |
arovir01 | 7ff76c5 | 2018-10-09 09:40:58 +0100 | [diff] [blame] | 19 | bool IsActivationSupported(const TensorInfo& input, |
| 20 | const TensorInfo& output, |
| 21 | const ActivationDescriptor& descriptor, |
| 22 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 23 | |
| 24 | bool IsAdditionSupported(const TensorInfo& input0, |
| 25 | const TensorInfo& input1, |
| 26 | const TensorInfo& output, |
| 27 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 28 | |
| 29 | bool IsBatchNormalizationSupported(const TensorInfo& input, |
| 30 | const TensorInfo& output, |
| 31 | const TensorInfo& mean, |
| 32 | const TensorInfo& var, |
| 33 | const TensorInfo& beta, |
| 34 | const TensorInfo& gamma, |
| 35 | const BatchNormalizationDescriptor& descriptor, |
| 36 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 37 | |
Jim Flynn | 906f946 | 2019-05-10 13:55:21 +0100 | [diff] [blame] | 38 | bool IsConcatSupported(const std::vector<const TensorInfo*> inputs, |
| 39 | const TensorInfo& output, |
Jim Flynn | e242f2d | 2019-05-22 14:24:13 +0100 | [diff] [blame] | 40 | const ConcatDescriptor& descriptor, |
Jim Flynn | 906f946 | 2019-05-10 13:55:21 +0100 | [diff] [blame] | 41 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 42 | |
arovir01 | 7ff76c5 | 2018-10-09 09:40:58 +0100 | [diff] [blame] | 43 | bool IsConstantSupported(const TensorInfo& output, |
| 44 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 45 | |
| 46 | bool IsConvertFp16ToFp32Supported(const TensorInfo& input, |
| 47 | const TensorInfo& output, |
| 48 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 49 | |
| 50 | bool IsConvertFp32ToFp16Supported(const TensorInfo& input, |
| 51 | const TensorInfo& output, |
| 52 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 53 | |
| 54 | bool IsConvolution2dSupported(const TensorInfo& input, |
| 55 | const TensorInfo& output, |
| 56 | const Convolution2dDescriptor& descriptor, |
| 57 | const TensorInfo& weights, |
| 58 | const Optional<TensorInfo>& biases, |
| 59 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 60 | |
| 61 | bool IsDepthwiseConvolutionSupported(const TensorInfo& input, |
| 62 | const TensorInfo& output, |
| 63 | const DepthwiseConvolution2dDescriptor& descriptor, |
| 64 | const TensorInfo& weights, |
| 65 | const Optional<TensorInfo>& biases, |
| 66 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 67 | |
Narumol Prangnawarat | 01961a7 | 2019-05-30 16:47:12 +0100 | [diff] [blame] | 68 | bool IsDequantizeSupported(const TensorInfo& input, |
| 69 | const TensorInfo& output, |
| 70 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 71 | |
Pablo Tello | f0bd683 | 2019-04-26 17:58:13 +0100 | [diff] [blame] | 72 | bool IsDilatedDepthwiseConvolutionSupported(const TensorInfo& input, |
| 73 | const TensorInfo& output, |
| 74 | const DepthwiseConvolution2dDescriptor& descriptor, |
| 75 | const TensorInfo& weights, |
| 76 | const Optional<TensorInfo>& biases, |
| 77 | Optional<std::string&> reason = EmptyOptional()) const override; |
| 78 | |
arovir01 | 7ff76c5 | 2018-10-09 09:40:58 +0100 | [diff] [blame] | 79 | bool IsFloorSupported(const TensorInfo& input, |
| 80 | const TensorInfo& output, |
| 81 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 82 | |
| 83 | bool IsFullyConnectedSupported(const TensorInfo& input, |
| 84 | const TensorInfo& output, |
| 85 | const TensorInfo& weights, |
| 86 | const TensorInfo& biases, |
| 87 | const FullyConnectedDescriptor& descriptor, |
| 88 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 89 | |
kevmay01 | eed8592 | 2019-01-28 08:37:25 +0000 | [diff] [blame] | 90 | bool IsGreaterSupported(const TensorInfo& input0, |
| 91 | const TensorInfo& input1, |
| 92 | const TensorInfo& output, |
| 93 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 94 | |
arovir01 | 7ff76c5 | 2018-10-09 09:40:58 +0100 | [diff] [blame] | 95 | bool IsInputSupported(const TensorInfo& input, |
| 96 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 97 | |
| 98 | bool IsL2NormalizationSupported(const TensorInfo& input, |
| 99 | const TensorInfo& output, |
| 100 | const L2NormalizationDescriptor& descriptor, |
| 101 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 102 | |
Jan Eilers | ad5293a | 2019-07-08 09:57:55 +0100 | [diff] [blame] | 103 | bool IsLstmSupported(const TensorInfo& input, |
| 104 | const TensorInfo& outputStateIn, |
| 105 | const TensorInfo& cellStateIn, |
| 106 | const TensorInfo& scratchBuffer, |
| 107 | const TensorInfo& outputStateOut, |
| 108 | const TensorInfo& cellStateOut, |
| 109 | const TensorInfo& output, |
| 110 | const LstmDescriptor& descriptor, |
| 111 | const LstmInputParamsInfo& paramsInfo, |
| 112 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 113 | |
Nattapat Chaimanowong | 4e6597a | 2018-12-20 14:14:06 +0000 | [diff] [blame] | 114 | bool IsMaximumSupported(const TensorInfo& input0, |
| 115 | const TensorInfo& input1, |
| 116 | const TensorInfo& output, |
| 117 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 118 | |
arovir01 | 7ff76c5 | 2018-10-09 09:40:58 +0100 | [diff] [blame] | 119 | bool IsMeanSupported(const TensorInfo& input, |
| 120 | const TensorInfo& output, |
| 121 | const MeanDescriptor& descriptor, |
| 122 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 123 | |
Jim Flynn | 906f946 | 2019-05-10 13:55:21 +0100 | [diff] [blame] | 124 | ARMNN_DEPRECATED_MSG("Use IsConcatSupported instead") |
arovir01 | 7ff76c5 | 2018-10-09 09:40:58 +0100 | [diff] [blame] | 125 | bool IsMergerSupported(const std::vector<const TensorInfo*> inputs, |
Nikhil Raj | 8599a41 | 2018-11-19 14:51:07 +0000 | [diff] [blame] | 126 | const TensorInfo& output, |
Jim Flynn | e242f2d | 2019-05-22 14:24:13 +0100 | [diff] [blame] | 127 | const MergerDescriptor& descriptor, |
arovir01 | 7ff76c5 | 2018-10-09 09:40:58 +0100 | [diff] [blame] | 128 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 129 | |
Conor Kennedy | 54b2169 | 2019-01-09 07:57:38 +0000 | [diff] [blame] | 130 | bool IsMinimumSupported(const TensorInfo& input0, |
| 131 | const TensorInfo& input1, |
| 132 | const TensorInfo& output, |
| 133 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 134 | |
arovir01 | 7ff76c5 | 2018-10-09 09:40:58 +0100 | [diff] [blame] | 135 | bool IsMultiplicationSupported(const TensorInfo& input0, |
| 136 | const TensorInfo& input1, |
| 137 | const TensorInfo& output, |
| 138 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 139 | |
| 140 | bool IsNormalizationSupported(const TensorInfo& input, |
| 141 | const TensorInfo& output, |
| 142 | const NormalizationDescriptor& descriptor, |
| 143 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 144 | |
| 145 | bool IsOutputSupported(const TensorInfo& output, |
| 146 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 147 | |
Éanna Ó Catháin | 1205574 | 2019-01-25 10:01:40 +0000 | [diff] [blame] | 148 | bool IsPadSupported(const TensorInfo& input, |
| 149 | const TensorInfo& output, |
| 150 | const PadDescriptor& descriptor, |
| 151 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 152 | |
arovir01 | 7ff76c5 | 2018-10-09 09:40:58 +0100 | [diff] [blame] | 153 | bool IsPermuteSupported(const TensorInfo& input, |
| 154 | const TensorInfo& output, |
| 155 | const PermuteDescriptor& descriptor, |
| 156 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 157 | |
| 158 | bool IsPooling2dSupported(const TensorInfo& input, |
| 159 | const TensorInfo& output, |
| 160 | const Pooling2dDescriptor& descriptor, |
| 161 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 162 | |
Nikhil Raj | 9b46148 | 2019-07-03 15:58:31 +0100 | [diff] [blame] | 163 | bool IsPreluSupported(const TensorInfo& input, |
| 164 | const TensorInfo& alpha, |
| 165 | const TensorInfo& output, |
| 166 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 167 | |
Sadik Armagan | fabc289 | 2019-05-31 09:05:11 +0100 | [diff] [blame] | 168 | bool IsQuantizeSupported(const TensorInfo& input, |
| 169 | const TensorInfo& output, |
| 170 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 171 | |
Francis Murtagh | 4fc3c48 | 2019-08-02 13:20:54 +0100 | [diff] [blame] | 172 | bool IsQuantizedLstmSupported(const TensorInfo& input, |
| 173 | const TensorInfo& cellStateIn, |
| 174 | const TensorInfo& outputStateIn, |
| 175 | const TensorInfo& cellStateOut, |
| 176 | const TensorInfo& outputStateOut, |
| 177 | const QuantizedLstmInputParamsInfo& paramsInfo, |
| 178 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 179 | |
arovir01 | 7ff76c5 | 2018-10-09 09:40:58 +0100 | [diff] [blame] | 180 | bool IsReshapeSupported(const TensorInfo& input, |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 181 | const ReshapeDescriptor& descriptor, |
arovir01 | 7ff76c5 | 2018-10-09 09:40:58 +0100 | [diff] [blame] | 182 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 183 | |
Aron Virginas-Tar | 169d2f1 | 2019-07-01 19:01:44 +0100 | [diff] [blame] | 184 | bool IsResizeSupported(const TensorInfo& input, |
| 185 | const TensorInfo& output, |
| 186 | const ResizeDescriptor& descriptor, |
| 187 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 188 | |
| 189 | ARMNN_DEPRECATED_MSG("Use IsResizeSupported instead") |
Sadik Armagan | c625f00 | 2018-12-17 11:32:16 +0000 | [diff] [blame] | 190 | bool IsResizeBilinearSupported(const TensorInfo& input, |
| 191 | const TensorInfo& output, |
| 192 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 193 | |
Aron Virginas-Tar | 0dd3b43 | 2019-09-10 13:55:09 +0100 | [diff] [blame] | 194 | bool IsRsqrtSupported(const TensorInfo& input, |
| 195 | const TensorInfo& output, |
| 196 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 197 | |
arovir01 | 7ff76c5 | 2018-10-09 09:40:58 +0100 | [diff] [blame] | 198 | bool IsSoftmaxSupported(const TensorInfo& input, |
| 199 | const TensorInfo& output, |
| 200 | const SoftmaxDescriptor& descriptor, |
| 201 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 202 | |
Ellen Norris-Thompson | 2979457 | 2019-06-26 16:40:36 +0100 | [diff] [blame] | 203 | bool IsSpaceToDepthSupported(const TensorInfo& input, |
| 204 | const TensorInfo& output, |
| 205 | const SpaceToDepthDescriptor& descriptor, |
| 206 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 207 | |
Narumol Prangnawarat | 15eb583 | 2019-05-20 15:31:05 +0100 | [diff] [blame] | 208 | ARMNN_DEPRECATED_MSG("Use IsSplitterSupported with outputs instead") |
arovir01 | 7ff76c5 | 2018-10-09 09:40:58 +0100 | [diff] [blame] | 209 | bool IsSplitterSupported(const TensorInfo& input, |
| 210 | const ViewsDescriptor& descriptor, |
| 211 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 212 | |
Narumol Prangnawarat | 15eb583 | 2019-05-20 15:31:05 +0100 | [diff] [blame] | 213 | bool IsSplitterSupported(const TensorInfo& input, |
| 214 | const std::vector<std::reference_wrapper<TensorInfo>>& outputs, |
| 215 | const ViewsDescriptor& descriptor, |
| 216 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 217 | |
Matthew Jackson | 87f65ea | 2019-08-01 10:01:34 +0100 | [diff] [blame] | 218 | bool IsStackSupported(const std::vector<const TensorInfo*>& inputs, |
| 219 | const TensorInfo& output, |
| 220 | const StackDescriptor& descriptor, |
| 221 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 222 | |
FinnWilliamsArm | 1fa1919 | 2019-08-02 17:26:31 +0100 | [diff] [blame] | 223 | bool IsStridedSliceSupported(const TensorInfo& input, |
| 224 | const TensorInfo& output, |
| 225 | const StridedSliceDescriptor& descriptor, |
| 226 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 227 | |
arovir01 | 7ff76c5 | 2018-10-09 09:40:58 +0100 | [diff] [blame] | 228 | bool IsSubtractionSupported(const TensorInfo& input0, |
| 229 | const TensorInfo& input1, |
| 230 | const TensorInfo& output, |
| 231 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
Sadik Armagan | 581742d | 2019-08-12 14:11:37 +0100 | [diff] [blame] | 232 | |
| 233 | bool IsTransposeConvolution2dSupported(const TensorInfo& input, |
| 234 | const TensorInfo& output, |
| 235 | const TransposeConvolution2dDescriptor& descriptor, |
| 236 | const TensorInfo& weights, |
| 237 | const Optional<TensorInfo>& biases, |
| 238 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 239 | |
Aron Virginas-Tar | fc82431 | 2018-10-15 15:00:13 +0100 | [diff] [blame] | 240 | }; // class NeonLayerSupport |
arovir01 | 4424b0a | 2018-10-04 10:46:04 +0100 | [diff] [blame] | 241 | |
arovir01 | 7ff76c5 | 2018-10-09 09:40:58 +0100 | [diff] [blame] | 242 | } // namespace armnn |