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