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 | { |
arovir01 | 4424b0a | 2018-10-04 10:46:04 +0100 | [diff] [blame] | 11 | |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 12 | class ClLayerSupport : public LayerSupportBase |
arovir01 | 4424b0a | 2018-10-04 10:46:04 +0100 | [diff] [blame] | 13 | { |
arovir01 | 7c22c70 | 2018-10-09 11:16:46 +0100 | [diff] [blame] | 14 | public: |
josh minor | 4a3c610 | 2020-01-06 16:40:46 -0600 | [diff] [blame] | 15 | ARMNN_DEPRECATED_MSG("Use IsElementwiseUnarySupported instead") |
Aron Virginas-Tar | 8204694 | 2019-09-09 15:18:29 +0100 | [diff] [blame] | 16 | bool IsAbsSupported(const TensorInfo& input, |
| 17 | const TensorInfo& output, |
| 18 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 19 | |
arovir01 | 7c22c70 | 2018-10-09 11:16:46 +0100 | [diff] [blame] | 20 | bool IsActivationSupported(const TensorInfo& input, |
| 21 | const TensorInfo& output, |
| 22 | const ActivationDescriptor& descriptor, |
| 23 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 24 | |
| 25 | bool IsAdditionSupported(const TensorInfo& input0, |
| 26 | const TensorInfo& input1, |
| 27 | const TensorInfo& output, |
| 28 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 29 | |
James Conroy | 2dc0572 | 2019-09-19 17:00:31 +0100 | [diff] [blame] | 30 | bool IsArgMinMaxSupported(const TensorInfo& input, |
| 31 | const TensorInfo& output, |
| 32 | const ArgMinMaxDescriptor& descriptor, |
| 33 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 34 | |
arovir01 | 7c22c70 | 2018-10-09 11:16:46 +0100 | [diff] [blame] | 35 | bool IsBatchNormalizationSupported(const TensorInfo& input, |
| 36 | const TensorInfo& output, |
| 37 | const TensorInfo& mean, |
| 38 | const TensorInfo& var, |
| 39 | const TensorInfo& beta, |
| 40 | const TensorInfo& gamma, |
| 41 | const BatchNormalizationDescriptor& descriptor, |
| 42 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 43 | |
Mike Kelly | 831faed | 2018-11-28 11:52:08 +0000 | [diff] [blame] | 44 | bool IsBatchToSpaceNdSupported(const TensorInfo& input, |
| 45 | const TensorInfo& output, |
| 46 | const BatchToSpaceNdDescriptor& descriptor, |
| 47 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 48 | |
Aron Virginas-Tar | 77bfb5e | 2019-10-16 17:45:38 +0100 | [diff] [blame] | 49 | bool IsComparisonSupported(const TensorInfo& input0, |
| 50 | const TensorInfo& input1, |
| 51 | const TensorInfo& ouput, |
| 52 | const ComparisonDescriptor& descriptor, |
| 53 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 54 | |
Jim Flynn | 906f946 | 2019-05-10 13:55:21 +0100 | [diff] [blame] | 55 | bool IsConcatSupported(const std::vector<const TensorInfo*> inputs, |
| 56 | const TensorInfo& output, |
Jim Flynn | e242f2d | 2019-05-22 14:24:13 +0100 | [diff] [blame] | 57 | const ConcatDescriptor& descriptor, |
Jim Flynn | 906f946 | 2019-05-10 13:55:21 +0100 | [diff] [blame] | 58 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 59 | |
arovir01 | 7c22c70 | 2018-10-09 11:16:46 +0100 | [diff] [blame] | 60 | bool IsConstantSupported(const TensorInfo& output, |
| 61 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 62 | |
| 63 | bool IsConvertFp16ToFp32Supported(const TensorInfo& input, |
| 64 | const TensorInfo& output, |
| 65 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 66 | |
| 67 | bool IsConvertFp32ToFp16Supported(const TensorInfo& input, |
| 68 | const TensorInfo& output, |
| 69 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 70 | |
| 71 | bool IsConvolution2dSupported(const TensorInfo& input, |
| 72 | const TensorInfo& output, |
| 73 | const Convolution2dDescriptor& descriptor, |
| 74 | const TensorInfo& weights, |
| 75 | const Optional<TensorInfo>& biases, |
| 76 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 77 | |
Jim Flynn | 983daec | 2019-05-29 16:20:16 +0100 | [diff] [blame] | 78 | bool IsDequantizeSupported(const TensorInfo& input, |
| 79 | const TensorInfo& output, |
| 80 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 81 | |
Aron Virginas-Tar | b280196 | 2019-09-30 11:24:53 +0100 | [diff] [blame] | 82 | bool IsDepthToSpaceSupported(const TensorInfo& input, |
| 83 | const TensorInfo& output, |
| 84 | const DepthToSpaceDescriptor& descriptor, |
| 85 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 86 | |
arovir01 | 7c22c70 | 2018-10-09 11:16:46 +0100 | [diff] [blame] | 87 | bool IsDepthwiseConvolutionSupported(const TensorInfo& input, |
| 88 | const TensorInfo& output, |
| 89 | const DepthwiseConvolution2dDescriptor& descriptor, |
| 90 | const TensorInfo& weights, |
| 91 | const Optional<TensorInfo>& biases, |
| 92 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 93 | |
Pablo Tello | f0bd683 | 2019-04-26 17:58:13 +0100 | [diff] [blame] | 94 | bool IsDilatedDepthwiseConvolutionSupported(const TensorInfo& input, |
| 95 | const TensorInfo& output, |
| 96 | const DepthwiseConvolution2dDescriptor& descriptor, |
| 97 | const TensorInfo& weights, |
| 98 | const Optional<TensorInfo>& biases, |
| 99 | Optional<std::string&> reason = EmptyOptional()) const override; |
| 100 | |
arovir01 | 7c22c70 | 2018-10-09 11:16:46 +0100 | [diff] [blame] | 101 | bool IsDivisionSupported(const TensorInfo& input0, |
| 102 | const TensorInfo& input1, |
| 103 | const TensorInfo& output, |
| 104 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 105 | |
josh minor | 4a3c610 | 2020-01-06 16:40:46 -0600 | [diff] [blame] | 106 | bool IsElementwiseUnarySupported(const TensorInfo& input, |
| 107 | const TensorInfo& ouput, |
| 108 | const ElementwiseUnaryDescriptor& descriptor, |
| 109 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 110 | |
arovir01 | 7c22c70 | 2018-10-09 11:16:46 +0100 | [diff] [blame] | 111 | bool IsFloorSupported(const TensorInfo& input, |
| 112 | const TensorInfo& output, |
| 113 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 114 | |
| 115 | bool IsFullyConnectedSupported(const TensorInfo& input, |
| 116 | const TensorInfo& output, |
| 117 | const TensorInfo& weights, |
| 118 | const TensorInfo& biases, |
| 119 | const FullyConnectedDescriptor& descriptor, |
| 120 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 121 | |
Aron Virginas-Tar | 77bfb5e | 2019-10-16 17:45:38 +0100 | [diff] [blame] | 122 | ARMNN_DEPRECATED_MSG("Use IsComparisonSupported instead") |
Nattapat Chaimanowong | c6a41ff | 2019-01-29 09:56:02 +0000 | [diff] [blame] | 123 | bool IsGreaterSupported(const TensorInfo& input0, |
| 124 | const TensorInfo& input1, |
| 125 | const TensorInfo& ouput, |
| 126 | Optional<std::string&> reasonIfUnsupported) const override; |
| 127 | |
arovir01 | 7c22c70 | 2018-10-09 11:16:46 +0100 | [diff] [blame] | 128 | bool IsInputSupported(const TensorInfo& input, |
| 129 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 130 | |
Aron Virginas-Tar | 8168f40 | 2019-10-04 13:10:16 +0100 | [diff] [blame] | 131 | bool IsInstanceNormalizationSupported(const TensorInfo& input, |
| 132 | const TensorInfo& output, |
| 133 | const InstanceNormalizationDescriptor& descriptor, |
| 134 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 135 | |
arovir01 | 7c22c70 | 2018-10-09 11:16:46 +0100 | [diff] [blame] | 136 | bool IsL2NormalizationSupported(const TensorInfo& input, |
| 137 | const TensorInfo& output, |
| 138 | const L2NormalizationDescriptor& descriptor, |
| 139 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 140 | |
| 141 | bool IsLstmSupported(const TensorInfo& input, |
| 142 | const TensorInfo& outputStateIn, |
| 143 | const TensorInfo& cellStateIn, |
| 144 | const TensorInfo& scratchBuffer, |
| 145 | const TensorInfo& outputStateOut, |
| 146 | const TensorInfo& cellStateOut, |
| 147 | const TensorInfo& output, |
| 148 | const LstmDescriptor& descriptor, |
Jan Eilers | d01a83c | 2019-07-03 18:20:40 +0100 | [diff] [blame] | 149 | const LstmInputParamsInfo& paramsInfo, |
| 150 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
arovir01 | 7c22c70 | 2018-10-09 11:16:46 +0100 | [diff] [blame] | 151 | |
keidav01 | a959ee5 | 2018-12-19 10:04:58 +0000 | [diff] [blame] | 152 | bool IsMaximumSupported(const TensorInfo& input0, |
| 153 | const TensorInfo& input1, |
| 154 | const TensorInfo& output, |
| 155 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 156 | |
arovir01 | 7c22c70 | 2018-10-09 11:16:46 +0100 | [diff] [blame] | 157 | bool IsMeanSupported(const TensorInfo& input, |
| 158 | const TensorInfo& output, |
| 159 | const MeanDescriptor& descriptor, |
| 160 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 161 | |
Jim Flynn | 906f946 | 2019-05-10 13:55:21 +0100 | [diff] [blame] | 162 | ARMNN_DEPRECATED_MSG("Use IsConcatSupported instead") |
arovir01 | 7c22c70 | 2018-10-09 11:16:46 +0100 | [diff] [blame] | 163 | bool IsMergerSupported(const std::vector<const TensorInfo*> inputs, |
Nikhil Raj | 8599a41 | 2018-11-19 14:51:07 +0000 | [diff] [blame] | 164 | const TensorInfo& output, |
Jim Flynn | e242f2d | 2019-05-22 14:24:13 +0100 | [diff] [blame] | 165 | const MergerDescriptor& descriptor, |
arovir01 | 7c22c70 | 2018-10-09 11:16:46 +0100 | [diff] [blame] | 166 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 167 | |
saoste01 | 9292aa3 | 2019-01-08 13:55:59 +0000 | [diff] [blame] | 168 | bool IsMinimumSupported(const TensorInfo& input0, |
| 169 | const TensorInfo& input1, |
| 170 | const TensorInfo& output, |
| 171 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 172 | |
arovir01 | 7c22c70 | 2018-10-09 11:16:46 +0100 | [diff] [blame] | 173 | bool IsMultiplicationSupported(const TensorInfo& input0, |
| 174 | const TensorInfo& input1, |
| 175 | const TensorInfo& output, |
| 176 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 177 | |
| 178 | bool IsNormalizationSupported(const TensorInfo& input, |
| 179 | const TensorInfo& output, |
| 180 | const NormalizationDescriptor& descriptor, |
| 181 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 182 | |
| 183 | bool IsOutputSupported(const TensorInfo& output, |
| 184 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 185 | |
| 186 | bool IsPadSupported(const TensorInfo& input, |
| 187 | const TensorInfo& output, |
| 188 | const PadDescriptor& descriptor, |
| 189 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 190 | |
| 191 | bool IsPermuteSupported(const TensorInfo& input, |
| 192 | const TensorInfo& output, |
| 193 | const PermuteDescriptor& descriptor, |
| 194 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 195 | |
| 196 | bool IsPooling2dSupported(const TensorInfo& input, |
| 197 | const TensorInfo& output, |
| 198 | const Pooling2dDescriptor& descriptor, |
| 199 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 200 | |
Nikhil Raj | 91e4c6d | 2019-07-05 12:22:58 +0100 | [diff] [blame] | 201 | bool IsPreluSupported(const TensorInfo& input, |
| 202 | const TensorInfo& alpha, |
| 203 | const TensorInfo& output, |
| 204 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 205 | |
Ferran Balaguer | 737d9ff | 2019-08-01 09:58:08 +0100 | [diff] [blame] | 206 | bool IsQuantizedLstmSupported(const TensorInfo& input, |
| 207 | const TensorInfo& previousCellStateIn, |
| 208 | const TensorInfo& previousOutputIn, |
| 209 | const TensorInfo& cellStateOut, |
| 210 | const TensorInfo& output, |
| 211 | const QuantizedLstmInputParamsInfo& paramsInfo, |
| 212 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 213 | |
Sadik Armagan | 20ec249 | 2019-05-31 09:09:44 +0100 | [diff] [blame] | 214 | bool IsQuantizeSupported(const TensorInfo& input, |
| 215 | const TensorInfo& output, |
| 216 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 217 | |
arovir01 | 7c22c70 | 2018-10-09 11:16:46 +0100 | [diff] [blame] | 218 | bool IsReshapeSupported(const TensorInfo& input, |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 219 | const ReshapeDescriptor& descriptor, |
arovir01 | 7c22c70 | 2018-10-09 11:16:46 +0100 | [diff] [blame] | 220 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 221 | |
Aron Virginas-Tar | 169d2f1 | 2019-07-01 19:01:44 +0100 | [diff] [blame] | 222 | bool IsResizeSupported(const TensorInfo& input, |
| 223 | const TensorInfo& output, |
| 224 | const ResizeDescriptor& descriptor, |
| 225 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 226 | |
| 227 | ARMNN_DEPRECATED_MSG("Use IsResizeSupported instead") |
arovir01 | 7c22c70 | 2018-10-09 11:16:46 +0100 | [diff] [blame] | 228 | bool IsResizeBilinearSupported(const TensorInfo& input, |
Sadik Armagan | c625f00 | 2018-12-17 11:32:16 +0000 | [diff] [blame] | 229 | const TensorInfo& output, |
arovir01 | 7c22c70 | 2018-10-09 11:16:46 +0100 | [diff] [blame] | 230 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 231 | |
josh minor | 4a3c610 | 2020-01-06 16:40:46 -0600 | [diff] [blame] | 232 | ARMNN_DEPRECATED_MSG("Use IsElementwiseUnarySupported instead") |
Aron Virginas-Tar | 1a763dd | 2019-09-10 12:32:08 +0100 | [diff] [blame] | 233 | bool IsRsqrtSupported(const TensorInfo& input, |
| 234 | const TensorInfo& output, |
| 235 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 236 | |
Aron Virginas-Tar | 94c4fef | 2019-11-25 15:37:08 +0000 | [diff] [blame] | 237 | bool IsSliceSupported(const TensorInfo& input, |
| 238 | const TensorInfo& output, |
| 239 | const SliceDescriptor& descriptor, |
| 240 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 241 | |
arovir01 | 7c22c70 | 2018-10-09 11:16:46 +0100 | [diff] [blame] | 242 | bool IsSoftmaxSupported(const TensorInfo& input, |
| 243 | const TensorInfo& output, |
| 244 | const SoftmaxDescriptor& descriptor, |
| 245 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 246 | |
Sadik Armagan | f446432 | 2018-12-20 16:19:12 +0000 | [diff] [blame] | 247 | bool IsSpaceToBatchNdSupported(const TensorInfo& input, |
| 248 | const TensorInfo& output, |
| 249 | const SpaceToBatchNdDescriptor& descriptor, |
| 250 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 251 | |
James Conroy | d2aa85e | 2019-07-01 17:12:40 +0100 | [diff] [blame] | 252 | bool IsSpaceToDepthSupported(const TensorInfo& input, |
| 253 | const TensorInfo& output, |
| 254 | const SpaceToDepthDescriptor& descriptor, |
| 255 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 256 | |
Narumol Prangnawarat | 15eb583 | 2019-05-20 15:31:05 +0100 | [diff] [blame] | 257 | ARMNN_DEPRECATED_MSG("Use IsSplitterSupported with outputs instead") |
arovir01 | 7c22c70 | 2018-10-09 11:16:46 +0100 | [diff] [blame] | 258 | bool IsSplitterSupported(const TensorInfo& input, |
| 259 | const ViewsDescriptor& descriptor, |
| 260 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 261 | |
Narumol Prangnawarat | 15eb583 | 2019-05-20 15:31:05 +0100 | [diff] [blame] | 262 | bool IsSplitterSupported(const TensorInfo& input, |
| 263 | const std::vector<std::reference_wrapper<TensorInfo>>& outputs, |
| 264 | const ViewsDescriptor& descriptor, |
| 265 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 266 | |
Matthew Jackson | d516610 | 2019-07-31 14:06:28 +0100 | [diff] [blame] | 267 | bool IsStackSupported(const std::vector<const TensorInfo*>& inputs, |
| 268 | const TensorInfo& output, |
| 269 | const StackDescriptor& descriptor, |
| 270 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 271 | |
keidav01 | d74dc91 | 2018-12-10 18:16:07 +0000 | [diff] [blame] | 272 | bool IsStridedSliceSupported(const TensorInfo& input, |
| 273 | const TensorInfo& output, |
| 274 | const StridedSliceDescriptor& descriptor, |
| 275 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 276 | |
arovir01 | 7c22c70 | 2018-10-09 11:16:46 +0100 | [diff] [blame] | 277 | bool IsSubtractionSupported(const TensorInfo& input0, |
| 278 | const TensorInfo& input1, |
| 279 | const TensorInfo& output, |
| 280 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
Aron Virginas-Tar | 7a3e2fe | 2019-06-27 18:54:47 +0100 | [diff] [blame] | 281 | |
| 282 | bool IsTransposeConvolution2dSupported(const TensorInfo& input, |
| 283 | const TensorInfo& output, |
| 284 | const TransposeConvolution2dDescriptor& descriptor, |
| 285 | const TensorInfo& weights, |
| 286 | const Optional<TensorInfo>& biases, |
| 287 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
arovir01 | 4424b0a | 2018-10-04 10:46:04 +0100 | [diff] [blame] | 288 | }; |
| 289 | |
Aron Virginas-Tar | bcf9f16 | 2018-10-15 11:47:37 +0100 | [diff] [blame] | 290 | } // namespace armnn |