Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2017 Arm Ltd. All rights reserved. |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #pragma once |
| 7 | |
| 8 | #include <armnn/ILayerSupport.hpp> |
| 9 | |
| 10 | namespace armnn |
| 11 | { |
| 12 | |
| 13 | class LayerSupportBase : public ILayerSupport |
| 14 | { |
| 15 | public: |
| 16 | bool IsActivationSupported(const TensorInfo& input, |
| 17 | const TensorInfo& output, |
| 18 | const ActivationDescriptor& descriptor, |
| 19 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 20 | |
| 21 | bool IsAdditionSupported(const TensorInfo& input0, |
| 22 | const TensorInfo& input1, |
| 23 | const TensorInfo& output, |
| 24 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 25 | |
| 26 | bool IsBatchNormalizationSupported(const TensorInfo& input, |
| 27 | const TensorInfo& output, |
| 28 | const TensorInfo& mean, |
| 29 | const TensorInfo& var, |
| 30 | const TensorInfo& beta, |
| 31 | const TensorInfo& gamma, |
| 32 | const BatchNormalizationDescriptor& descriptor, |
| 33 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 34 | |
| 35 | bool IsBatchToSpaceNdSupported(const TensorInfo& input, |
| 36 | const TensorInfo& output, |
| 37 | const BatchToSpaceNdDescriptor& descriptor, |
| 38 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 39 | |
Jim Flynn | 906f946 | 2019-05-10 13:55:21 +0100 | [diff] [blame] | 40 | bool IsConcatSupported(const std::vector<const TensorInfo*> inputs, |
| 41 | const TensorInfo& output, |
| 42 | const OriginsDescriptor& descriptor, |
| 43 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 44 | |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 45 | bool IsConstantSupported(const TensorInfo& output, |
| 46 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 47 | |
| 48 | bool IsConvertFp16ToFp32Supported(const TensorInfo& input, |
| 49 | const TensorInfo& output, |
| 50 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 51 | |
Matteo Martincigh | 3d6898c | 2019-01-15 16:11:44 +0000 | [diff] [blame] | 52 | bool IsConvertFp32ToFp16Supported( |
| 53 | const TensorInfo& input, |
| 54 | const TensorInfo& output, |
| 55 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 56 | |
| 57 | bool IsConvolution2dSupported(const TensorInfo& input, |
| 58 | const TensorInfo& output, |
| 59 | const Convolution2dDescriptor& descriptor, |
| 60 | const TensorInfo& weights, |
| 61 | const Optional<TensorInfo>& biases, |
| 62 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 63 | |
| 64 | bool IsDebugSupported(const TensorInfo& input, |
| 65 | const TensorInfo& output, |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 66 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 67 | |
| 68 | bool IsDepthwiseConvolutionSupported(const TensorInfo& input, |
| 69 | const TensorInfo& output, |
| 70 | const DepthwiseConvolution2dDescriptor& descriptor, |
| 71 | const TensorInfo& weights, |
| 72 | const Optional<TensorInfo>& biases, |
| 73 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 74 | |
Nattapat Chaimanowong | e4294fd | 2019-03-28 09:56:53 +0000 | [diff] [blame] | 75 | bool IsDequantizeSupported(const TensorInfo& input, |
| 76 | const TensorInfo& output, |
| 77 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 78 | |
Narumol Prangnawarat | 94dd5d8 | 2019-01-23 18:06:26 +0000 | [diff] [blame] | 79 | bool IsDetectionPostProcessSupported(const TensorInfo& input0, |
| 80 | const TensorInfo& input1, |
| 81 | const DetectionPostProcessDescriptor& descriptor, |
| 82 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 83 | |
Matteo Martincigh | eac246d | 2019-05-14 09:11:03 +0100 | [diff] [blame] | 84 | bool IsDilatedDepthwiseConvolutionSupported(const TensorInfo& input, |
| 85 | const TensorInfo& output, |
| 86 | const DepthwiseConvolution2dDescriptor& descriptor, |
| 87 | const TensorInfo& weights, |
| 88 | const Optional<TensorInfo>& biases, |
| 89 | Optional<std::string&> reasonIfUnsupported = |
| 90 | EmptyOptional()) const override; |
| 91 | |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 92 | bool IsDivisionSupported(const TensorInfo& input0, |
| 93 | const TensorInfo& input1, |
| 94 | const TensorInfo& output, |
| 95 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 96 | |
| 97 | bool IsEqualSupported(const TensorInfo& input0, |
| 98 | const TensorInfo& input1, |
| 99 | const TensorInfo& output, |
| 100 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 101 | |
| 102 | bool IsFakeQuantizationSupported(const TensorInfo& input, |
| 103 | const FakeQuantizationDescriptor& descriptor, |
| 104 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 105 | |
| 106 | bool IsFloorSupported(const TensorInfo& input, |
| 107 | const TensorInfo& output, |
| 108 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 109 | |
| 110 | bool IsFullyConnectedSupported(const TensorInfo& input, |
| 111 | const TensorInfo& output, |
| 112 | const TensorInfo& weights, |
| 113 | const TensorInfo& biases, |
| 114 | const FullyConnectedDescriptor& descriptor, |
| 115 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 116 | |
narpra01 | b89b05f | 2019-01-16 09:53:09 +0000 | [diff] [blame] | 117 | bool IsGatherSupported(const TensorInfo& input0, |
| 118 | const TensorInfo& input1, |
| 119 | const TensorInfo& output, |
| 120 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 121 | |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 122 | bool IsGreaterSupported(const TensorInfo& input0, |
| 123 | const TensorInfo& input1, |
| 124 | const TensorInfo& output, |
| 125 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 126 | |
| 127 | bool IsInputSupported(const TensorInfo& input, |
| 128 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 129 | |
| 130 | bool IsL2NormalizationSupported(const TensorInfo& input, |
| 131 | const TensorInfo& output, |
| 132 | const L2NormalizationDescriptor& descriptor, |
| 133 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 134 | |
| 135 | bool IsLstmSupported(const TensorInfo& input, |
| 136 | const TensorInfo& outputStateIn, |
| 137 | const TensorInfo& cellStateIn, |
| 138 | const TensorInfo& scratchBuffer, |
| 139 | const TensorInfo& outputStateOut, |
| 140 | const TensorInfo& cellStateOut, |
| 141 | const TensorInfo& output, |
| 142 | const LstmDescriptor& descriptor, |
| 143 | const TensorInfo& inputToForgetWeights, |
| 144 | const TensorInfo& inputToCellWeights, |
| 145 | const TensorInfo& inputToOutputWeights, |
| 146 | const TensorInfo& recurrentToForgetWeights, |
| 147 | const TensorInfo& recurrentToCellWeights, |
| 148 | const TensorInfo& recurrentToOutputWeights, |
| 149 | const TensorInfo& forgetGateBias, |
| 150 | const TensorInfo& cellBias, |
| 151 | const TensorInfo& outputGateBias, |
| 152 | const TensorInfo* inputToInputWeights, |
| 153 | const TensorInfo* recurrentToInputWeights, |
| 154 | const TensorInfo* cellToInputWeights, |
| 155 | const TensorInfo* inputGateBias, |
| 156 | const TensorInfo* projectionWeights, |
| 157 | const TensorInfo* projectionBias, |
| 158 | const TensorInfo* cellToForgetWeights, |
| 159 | const TensorInfo* cellToOutputWeights, |
| 160 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 161 | |
| 162 | bool IsMaximumSupported(const TensorInfo& input0, |
| 163 | const TensorInfo& input1, |
| 164 | const TensorInfo& output, |
| 165 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 166 | |
| 167 | bool IsMeanSupported(const TensorInfo& input, |
| 168 | const TensorInfo& output, |
| 169 | const MeanDescriptor& descriptor, |
| 170 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 171 | |
| 172 | bool IsMemCopySupported(const TensorInfo& input, |
| 173 | const TensorInfo& output, |
| 174 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 175 | |
Nattapat Chaimanowong | 1f88630 | 2019-04-05 13:37:19 +0100 | [diff] [blame] | 176 | bool IsMergeSupported(const TensorInfo& input0, |
| 177 | const TensorInfo& input1, |
| 178 | const TensorInfo& output, |
| 179 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 180 | |
Jim Flynn | 906f946 | 2019-05-10 13:55:21 +0100 | [diff] [blame] | 181 | ARMNN_DEPRECATED_MSG("Use IsConcatSupported instead") |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 182 | bool IsMergerSupported(const std::vector<const TensorInfo*> inputs, |
| 183 | const TensorInfo& output, |
| 184 | const OriginsDescriptor& descriptor, |
| 185 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 186 | |
| 187 | bool IsMinimumSupported(const TensorInfo& input0, |
| 188 | const TensorInfo& input1, |
| 189 | const TensorInfo& output, |
| 190 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 191 | |
| 192 | bool IsMultiplicationSupported(const TensorInfo& input0, |
| 193 | const TensorInfo& input1, |
| 194 | const TensorInfo& output, |
| 195 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 196 | |
| 197 | bool IsNormalizationSupported(const TensorInfo& input, |
| 198 | const TensorInfo& output, |
| 199 | const NormalizationDescriptor& descriptor, |
| 200 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 201 | |
| 202 | bool IsOutputSupported(const TensorInfo& output, |
| 203 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 204 | |
| 205 | bool IsPadSupported(const TensorInfo& input, |
| 206 | const TensorInfo& output, |
| 207 | const PadDescriptor& descriptor, |
| 208 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 209 | |
| 210 | bool IsPermuteSupported(const TensorInfo& input, |
| 211 | const TensorInfo& output, |
| 212 | const PermuteDescriptor& descriptor, |
| 213 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 214 | |
| 215 | bool IsPooling2dSupported(const TensorInfo& input, |
| 216 | const TensorInfo& output, |
| 217 | const Pooling2dDescriptor& descriptor, |
| 218 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 219 | |
Matteo Martincigh | 4912402 | 2019-01-11 13:25:59 +0000 | [diff] [blame] | 220 | bool IsPreCompiledSupported(const TensorInfo& input, |
| 221 | const PreCompiledDescriptor& descriptor, |
| 222 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 223 | |
Derek Lamberti | a9cca6a | 2019-03-25 15:41:58 +0000 | [diff] [blame] | 224 | bool IsQuantizeSupported(const TensorInfo& input, |
| 225 | const TensorInfo& output, |
| 226 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 227 | |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 228 | bool IsReshapeSupported(const TensorInfo& input, |
| 229 | const ReshapeDescriptor& descriptor, |
| 230 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 231 | |
| 232 | bool IsResizeBilinearSupported(const TensorInfo& input, |
Sadik Armagan | c625f00 | 2018-12-17 11:32:16 +0000 | [diff] [blame] | 233 | const TensorInfo& output, |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 234 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 235 | |
| 236 | bool IsRsqrtSupported(const TensorInfo& input, |
| 237 | const TensorInfo& output, |
| 238 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 239 | |
| 240 | bool IsSoftmaxSupported(const TensorInfo& input, |
| 241 | const TensorInfo& output, |
| 242 | const SoftmaxDescriptor& descriptor, |
| 243 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 244 | |
| 245 | bool IsSpaceToBatchNdSupported(const TensorInfo& input, |
| 246 | const TensorInfo& output, |
| 247 | const SpaceToBatchNdDescriptor& descriptor, |
| 248 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 249 | |
Narumol Prangnawarat | 15eb583 | 2019-05-20 15:31:05 +0100 | [diff] [blame] | 250 | ARMNN_DEPRECATED_MSG("Use IsSplitterSupported with outputs instead") |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 251 | bool IsSplitterSupported(const TensorInfo& input, |
| 252 | const ViewsDescriptor& descriptor, |
| 253 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 254 | |
Narumol Prangnawarat | 15eb583 | 2019-05-20 15:31:05 +0100 | [diff] [blame] | 255 | bool IsSplitterSupported(const TensorInfo& input, |
| 256 | const std::vector<std::reference_wrapper<TensorInfo>>& outputs, |
| 257 | const ViewsDescriptor& descriptor, |
| 258 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 259 | |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 260 | bool IsStridedSliceSupported(const TensorInfo& input, |
| 261 | const TensorInfo& output, |
| 262 | const StridedSliceDescriptor& descriptor, |
| 263 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
| 264 | |
| 265 | bool IsSubtractionSupported(const TensorInfo& input0, |
| 266 | const TensorInfo& input1, |
| 267 | const TensorInfo& output, |
| 268 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
Sadik Armagan | eff363d | 2019-04-05 15:25:46 +0100 | [diff] [blame] | 269 | |
| 270 | bool IsSwitchSupported(const TensorInfo& input0, |
| 271 | const TensorInfo& input1, |
| 272 | const TensorInfo& output0, |
| 273 | const TensorInfo& output1, |
| 274 | Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override; |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 275 | }; |
| 276 | |
| 277 | } // namespace armnn |