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