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