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 | |
josh minor | 4a3c610 | 2020-01-06 16:40:46 -0600 | [diff] [blame] | 6 | #include <armnn/Deprecated.hpp> |
| 7 | #include <armnn/Descriptors.hpp> |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 8 | #include <armnn/Exceptions.hpp> |
josh minor | 4a3c610 | 2020-01-06 16:40:46 -0600 | [diff] [blame] | 9 | #include <armnn/Types.hpp> |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 10 | |
Matteo Martincigh | e5b8eb9 | 2019-11-28 15:45:42 +0000 | [diff] [blame] | 11 | #include <backendsCommon/LayerSupportBase.hpp> |
| 12 | |
Jan Eilers | 8eb2560 | 2020-03-09 12:13:48 +0000 | [diff] [blame] | 13 | #include <armnn/utility/IgnoreUnused.hpp> |
Derek Lamberti | f674aa0 | 2019-08-01 15:56:25 +0100 | [diff] [blame] | 14 | |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 15 | namespace |
| 16 | { |
| 17 | |
| 18 | bool DefaultLayerSupport(const char* func, |
| 19 | const char* file, |
| 20 | unsigned int line, |
| 21 | armnn::Optional<std::string&> reasonIfUnsupported) |
| 22 | { |
| 23 | // NOTE: We only need to return the reason if the optional parameter is not empty |
| 24 | if (reasonIfUnsupported) |
| 25 | { |
| 26 | std::stringstream message; |
| 27 | message << func << " is not implemented [" << file << ":" << line << "]"; |
| 28 | |
| 29 | reasonIfUnsupported.value() = message.str(); |
| 30 | } |
| 31 | |
| 32 | return false; |
| 33 | } |
| 34 | |
| 35 | } // anonymous namespace |
| 36 | |
| 37 | namespace armnn |
| 38 | { |
| 39 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 40 | bool LayerSupportBase::IsAbsSupported(const TensorInfo& /*input*/, |
| 41 | const TensorInfo& /*output*/, |
Kevin May | 868eb14 | 2019-09-04 17:29:31 +0100 | [diff] [blame] | 42 | Optional<std::string &> reasonIfUnsupported) const |
| 43 | { |
| 44 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 45 | } |
| 46 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 47 | bool LayerSupportBase::IsActivationSupported(const TensorInfo& /*input*/, |
| 48 | const TensorInfo& /*output*/, |
| 49 | const ActivationDescriptor& /*descriptor*/, |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 50 | Optional<std::string&> reasonIfUnsupported) const |
| 51 | { |
| 52 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 53 | } |
| 54 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 55 | bool LayerSupportBase::IsAdditionSupported(const TensorInfo& /*input0*/, |
| 56 | const TensorInfo& /*input1*/, |
| 57 | const TensorInfo& /*output*/, |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 58 | Optional<std::string&> reasonIfUnsupported) const |
| 59 | { |
| 60 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 61 | } |
| 62 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 63 | bool LayerSupportBase::IsArgMinMaxSupported(const armnn::TensorInfo &/*input*/, |
| 64 | const armnn::TensorInfo &/*output*/, |
| 65 | const armnn::ArgMinMaxDescriptor& /*descriptor*/, |
Nikhil Raj | ee391d5 | 2019-09-05 17:50:44 +0100 | [diff] [blame] | 66 | armnn::Optional<std::string &> reasonIfUnsupported) const |
| 67 | { |
| 68 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 69 | } |
| 70 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 71 | bool LayerSupportBase::IsBatchNormalizationSupported(const TensorInfo& /*input*/, |
| 72 | const TensorInfo& /*output*/, |
| 73 | const TensorInfo& /*mean*/, |
| 74 | const TensorInfo& /*var*/, |
| 75 | const TensorInfo& /*beta*/, |
| 76 | const TensorInfo& /*gamma*/, |
| 77 | const BatchNormalizationDescriptor& /*descriptor*/, |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 78 | Optional<std::string&> reasonIfUnsupported) const |
| 79 | { |
| 80 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 81 | } |
| 82 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 83 | bool LayerSupportBase::IsBatchToSpaceNdSupported(const TensorInfo& /*input*/, |
| 84 | const TensorInfo& /*output*/, |
| 85 | const BatchToSpaceNdDescriptor& /*descriptor*/, |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 86 | Optional<std::string&> reasonIfUnsupported) const |
| 87 | { |
| 88 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 89 | } |
| 90 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 91 | bool LayerSupportBase::IsComparisonSupported(const TensorInfo& /*input0*/, |
| 92 | const TensorInfo& /*input1*/, |
| 93 | const TensorInfo& /*output*/, |
| 94 | const ComparisonDescriptor& /*descriptor*/, |
Aron Virginas-Tar | 77bfb5e | 2019-10-16 17:45:38 +0100 | [diff] [blame] | 95 | Optional<std::string&> reasonIfUnsupported) const |
| 96 | { |
| 97 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 98 | } |
| 99 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 100 | bool LayerSupportBase::IsConcatSupported(const std::vector<const TensorInfo*> /*inputs*/, |
| 101 | const TensorInfo& /*output*/, |
| 102 | const OriginsDescriptor& /*descriptor*/, |
Jim Flynn | 906f946 | 2019-05-10 13:55:21 +0100 | [diff] [blame] | 103 | Optional<std::string&> reasonIfUnsupported) const |
| 104 | { |
Jim Flynn | e242f2d | 2019-05-22 14:24:13 +0100 | [diff] [blame] | 105 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
Jim Flynn | 906f946 | 2019-05-10 13:55:21 +0100 | [diff] [blame] | 106 | } |
| 107 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 108 | bool LayerSupportBase::IsConstantSupported(const TensorInfo& /*output*/, |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 109 | Optional<std::string&> reasonIfUnsupported) const |
| 110 | { |
| 111 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 112 | } |
| 113 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 114 | bool LayerSupportBase::IsConvertFp16ToFp32Supported(const TensorInfo& /*input*/, |
| 115 | const TensorInfo& /*output*/, |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 116 | Optional<std::string&> reasonIfUnsupported) const |
| 117 | { |
| 118 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 119 | } |
| 120 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 121 | bool LayerSupportBase::IsConvertFp32ToFp16Supported(const TensorInfo& /*input*/, |
| 122 | const TensorInfo& /*output*/, |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 123 | Optional<std::string&> reasonIfUnsupported) const |
| 124 | { |
| 125 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 126 | } |
| 127 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 128 | bool LayerSupportBase::IsConvolution2dSupported(const TensorInfo& /*input*/, |
| 129 | const TensorInfo& /*output*/, |
| 130 | const Convolution2dDescriptor& /*descriptor*/, |
| 131 | const TensorInfo& /*weights*/, |
| 132 | const Optional<TensorInfo>& /*biases*/, |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 133 | Optional<std::string&> reasonIfUnsupported) const |
| 134 | { |
| 135 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 136 | } |
| 137 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 138 | bool LayerSupportBase::IsDebugSupported(const TensorInfo& /*input*/, |
| 139 | const TensorInfo& /*output*/, |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 140 | Optional<std::string&> reasonIfUnsupported) const |
| 141 | { |
| 142 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 143 | } |
| 144 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 145 | bool LayerSupportBase::IsDepthToSpaceSupported(const TensorInfo& /*input*/, |
| 146 | const TensorInfo& /*output*/, |
| 147 | const DepthToSpaceDescriptor& /*descriptor*/, |
Aron Virginas-Tar | dd6247f | 2019-09-19 14:31:17 +0100 | [diff] [blame] | 148 | Optional<std::string&> reasonIfUnsupported) const |
| 149 | { |
| 150 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 151 | } |
| 152 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 153 | bool LayerSupportBase::IsDepthwiseConvolutionSupported(const TensorInfo& /*input*/, |
| 154 | const TensorInfo& /*output*/, |
| 155 | const DepthwiseConvolution2dDescriptor& /*descriptor*/, |
| 156 | const TensorInfo& /*weights*/, |
| 157 | const Optional<TensorInfo>& /*biases*/, |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 158 | Optional<std::string&> reasonIfUnsupported) const |
| 159 | { |
| 160 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 161 | } |
| 162 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 163 | bool LayerSupportBase::IsDequantizeSupported(const TensorInfo& /*input*/, |
| 164 | const TensorInfo& /*output*/, |
Nattapat Chaimanowong | e4294fd | 2019-03-28 09:56:53 +0000 | [diff] [blame] | 165 | Optional<std::string&> reasonIfUnsupported) const |
| 166 | { |
| 167 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 168 | } |
| 169 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 170 | bool LayerSupportBase::IsDetectionPostProcessSupported(const TensorInfo& /*boxEncodings*/, |
| 171 | const TensorInfo& /*scores*/, |
| 172 | const TensorInfo& /*anchors*/, |
| 173 | const TensorInfo& /*detectionBoxes*/, |
| 174 | const TensorInfo& /*detectionClasses*/, |
| 175 | const TensorInfo& /*detectionScores*/, |
| 176 | const TensorInfo& /*numDetections*/, |
| 177 | const DetectionPostProcessDescriptor& /*descriptor*/, |
Derek Lamberti | 6a5e5e8 | 2019-12-05 14:41:20 +0000 | [diff] [blame] | 178 | Optional<std::string&> reasonIfUnsupported) const |
Narumol Prangnawarat | 94dd5d8 | 2019-01-23 18:06:26 +0000 | [diff] [blame] | 179 | { |
| 180 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 181 | } |
| 182 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 183 | bool LayerSupportBase::IsDilatedDepthwiseConvolutionSupported(const TensorInfo& /*input*/, |
| 184 | const TensorInfo& /*output*/, |
| 185 | const DepthwiseConvolution2dDescriptor& /*descriptor*/, |
| 186 | const TensorInfo& /*weights*/, |
| 187 | const Optional<TensorInfo>& /*biases*/, |
Matteo Martincigh | eac246d | 2019-05-14 09:11:03 +0100 | [diff] [blame] | 188 | Optional<std::string&> reasonIfUnsupported) const |
| 189 | { |
| 190 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 191 | } |
| 192 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 193 | bool LayerSupportBase::IsDivisionSupported(const TensorInfo& /*input0*/, |
| 194 | const TensorInfo& /*input1*/, |
| 195 | const TensorInfo& /*output*/, |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 196 | Optional<std::string&> reasonIfUnsupported) const |
| 197 | { |
| 198 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 199 | } |
| 200 | |
josh minor | 4a3c610 | 2020-01-06 16:40:46 -0600 | [diff] [blame] | 201 | bool LayerSupportBase::IsElementwiseUnarySupported(const TensorInfo& input, |
| 202 | const TensorInfo& output, |
| 203 | const ElementwiseUnaryDescriptor& descriptor, |
| 204 | Optional<std::string&> reasonIfUnsupported) const |
| 205 | { |
| 206 | if (descriptor.m_Operation == UnaryOperation::Abs) |
| 207 | { |
| 208 | ARMNN_NO_DEPRECATE_WARN_BEGIN |
| 209 | return IsAbsSupported(input, output, reasonIfUnsupported); |
| 210 | ARMNN_NO_DEPRECATE_WARN_END |
| 211 | } |
| 212 | else if (descriptor.m_Operation == UnaryOperation::Rsqrt) |
| 213 | { |
| 214 | ARMNN_NO_DEPRECATE_WARN_BEGIN |
| 215 | return IsRsqrtSupported(input, output, reasonIfUnsupported); |
| 216 | ARMNN_NO_DEPRECATE_WARN_END |
| 217 | } |
| 218 | return false; |
| 219 | } |
| 220 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 221 | bool LayerSupportBase::IsEqualSupported(const armnn::TensorInfo& /*input0*/, |
| 222 | const armnn::TensorInfo& /*input1*/, |
| 223 | const armnn::TensorInfo& /*output*/, |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 224 | armnn::Optional<std::string &> reasonIfUnsupported) const |
| 225 | { |
| 226 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 227 | } |
| 228 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 229 | bool LayerSupportBase::IsFakeQuantizationSupported(const TensorInfo& /*input*/, |
| 230 | const FakeQuantizationDescriptor& /*descriptor*/, |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 231 | Optional<std::string&> reasonIfUnsupported) const |
| 232 | { |
| 233 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 234 | } |
| 235 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 236 | bool LayerSupportBase::IsFloorSupported(const TensorInfo& /*input*/, |
| 237 | const TensorInfo& /*output*/, |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 238 | Optional<std::string&> reasonIfUnsupported) const |
| 239 | { |
| 240 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 241 | } |
| 242 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 243 | bool LayerSupportBase::IsFullyConnectedSupported(const TensorInfo& /*input*/, |
| 244 | const TensorInfo& /*output*/, |
| 245 | const TensorInfo& /*weights*/, |
| 246 | const TensorInfo& /*biases*/, |
| 247 | const FullyConnectedDescriptor& /*descriptor*/, |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 248 | Optional<std::string&> reasonIfUnsupported) const |
| 249 | { |
| 250 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 251 | } |
| 252 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 253 | bool LayerSupportBase::IsGatherSupported(const armnn::TensorInfo& /*input0*/, |
| 254 | const armnn::TensorInfo& /*input1*/, |
| 255 | const armnn::TensorInfo& /*output*/, |
narpra01 | b89b05f | 2019-01-16 09:53:09 +0000 | [diff] [blame] | 256 | armnn::Optional<std::string&> reasonIfUnsupported) const |
| 257 | { |
| 258 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 259 | } |
| 260 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 261 | bool LayerSupportBase::IsGreaterSupported(const TensorInfo& /*input0*/, |
| 262 | const TensorInfo& /*input1*/, |
| 263 | const TensorInfo& /*output*/, |
Matteo Martincigh | 3d6898c | 2019-01-15 16:11:44 +0000 | [diff] [blame] | 264 | Optional<std::string&> reasonIfUnsupported) const |
| 265 | { |
| 266 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 267 | } |
| 268 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 269 | bool LayerSupportBase::IsInputSupported(const TensorInfo& /*input*/, |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 270 | Optional<std::string&> reasonIfUnsupported) const |
| 271 | { |
| 272 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 273 | } |
| 274 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 275 | bool LayerSupportBase::IsInstanceNormalizationSupported(const TensorInfo& /*input*/, |
| 276 | const TensorInfo& /*output*/, |
| 277 | const InstanceNormalizationDescriptor& /*descriptor*/, |
Kevin May | ce5045a | 2019-10-02 14:07:47 +0100 | [diff] [blame] | 278 | Optional<std::string&> reasonIfUnsupported) const |
| 279 | { |
| 280 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 281 | } |
| 282 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 283 | bool LayerSupportBase::IsL2NormalizationSupported(const TensorInfo& /*input*/, |
| 284 | const TensorInfo& /*output*/, |
| 285 | const L2NormalizationDescriptor& /*descriptor*/, |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 286 | Optional<std::string&> reasonIfUnsupported) const |
| 287 | { |
| 288 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 289 | } |
| 290 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 291 | bool LayerSupportBase::IsLogSoftmaxSupported(const TensorInfo& /*input*/, |
| 292 | const TensorInfo& /*output*/, |
| 293 | const LogSoftmaxDescriptor& /*descriptor*/, |
Aron Virginas-Tar | f982dea | 2019-10-11 14:07:53 +0100 | [diff] [blame] | 294 | Optional<std::string&> reasonIfUnsupported) const |
| 295 | { |
| 296 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 297 | } |
| 298 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 299 | bool LayerSupportBase::IsLstmSupported(const TensorInfo& /*input*/, |
| 300 | const TensorInfo& /*outputStateIn*/, |
| 301 | const TensorInfo& /*cellStateIn*/, |
| 302 | const TensorInfo& /*scratchBuffer*/, |
| 303 | const TensorInfo& /*outputStateOut*/, |
| 304 | const TensorInfo& /*cellStateOut*/, |
| 305 | const TensorInfo& /*output*/, |
| 306 | const LstmDescriptor& /*descriptor*/, |
| 307 | const LstmInputParamsInfo& /*paramsInfo*/, |
Jan Eilers | d01a83c | 2019-07-03 18:20:40 +0100 | [diff] [blame] | 308 | Optional<std::string&> reasonIfUnsupported) const |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 309 | { |
| 310 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 311 | } |
| 312 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 313 | bool LayerSupportBase::IsMaximumSupported(const TensorInfo& /*input0*/, |
| 314 | const TensorInfo& /*input1*/, |
| 315 | const TensorInfo& /*output*/, |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 316 | Optional<std::string&> reasonIfUnsupported) const |
| 317 | { |
| 318 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 319 | } |
| 320 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 321 | bool LayerSupportBase::IsMeanSupported(const TensorInfo& /*input*/, |
| 322 | const TensorInfo& /*output*/, |
| 323 | const MeanDescriptor& /*descriptor*/, |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 324 | Optional<std::string&> reasonIfUnsupported) const |
| 325 | { |
| 326 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 327 | } |
| 328 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 329 | bool LayerSupportBase::IsMemCopySupported(const armnn::TensorInfo& /*input*/, |
| 330 | const armnn::TensorInfo& /*output*/, |
| 331 | armnn::Optional<std::string &> /*reasonIfUnsupported*/) const |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 332 | { |
Derek Lamberti | f674aa0 | 2019-08-01 15:56:25 +0100 | [diff] [blame] | 333 | return true; |
| 334 | } |
| 335 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 336 | bool LayerSupportBase::IsMemImportSupported(const armnn::TensorInfo& /*input*/, |
| 337 | const armnn::TensorInfo& /*output*/, |
| 338 | armnn::Optional<std::string &> /*reasonIfUnsupported*/) const |
Derek Lamberti | f674aa0 | 2019-08-01 15:56:25 +0100 | [diff] [blame] | 339 | { |
Derek Lamberti | f674aa0 | 2019-08-01 15:56:25 +0100 | [diff] [blame] | 340 | return true; |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 341 | } |
| 342 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 343 | bool LayerSupportBase::IsMergeSupported(const TensorInfo& /*input0*/, |
| 344 | const TensorInfo& /*input1*/, |
| 345 | const TensorInfo& /*output*/, |
Nattapat Chaimanowong | 1f88630 | 2019-04-05 13:37:19 +0100 | [diff] [blame] | 346 | Optional<std::string&> reasonIfUnsupported) const |
| 347 | { |
| 348 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 349 | } |
| 350 | |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 351 | bool LayerSupportBase::IsMergerSupported(const std::vector<const TensorInfo*> inputs, |
| 352 | const TensorInfo& output, |
| 353 | const OriginsDescriptor& descriptor, |
| 354 | Optional<std::string&> reasonIfUnsupported) const |
| 355 | { |
Jim Flynn | e242f2d | 2019-05-22 14:24:13 +0100 | [diff] [blame] | 356 | return IsConcatSupported(inputs, output, descriptor, reasonIfUnsupported); |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 357 | } |
| 358 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 359 | bool LayerSupportBase::IsMinimumSupported(const TensorInfo& /*input0*/, |
| 360 | const TensorInfo& /*input1*/, |
| 361 | const TensorInfo& /*output*/, |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 362 | Optional<std::string&> reasonIfUnsupported) const |
| 363 | { |
| 364 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 365 | } |
| 366 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 367 | bool LayerSupportBase::IsMultiplicationSupported(const TensorInfo& /*input0*/, |
| 368 | const TensorInfo& /*input1*/, |
| 369 | const TensorInfo& /*output*/, |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 370 | Optional<std::string&> reasonIfUnsupported) const |
| 371 | { |
| 372 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 373 | } |
| 374 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 375 | bool LayerSupportBase::IsNormalizationSupported(const TensorInfo& /*input*/, |
| 376 | const TensorInfo& /*output*/, |
| 377 | const NormalizationDescriptor& /*descriptor*/, |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 378 | Optional<std::string&> reasonIfUnsupported) const |
| 379 | { |
| 380 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 381 | } |
| 382 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 383 | bool LayerSupportBase::IsOutputSupported(const TensorInfo& /*output*/, |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 384 | Optional<std::string&> reasonIfUnsupported) const |
| 385 | { |
| 386 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 387 | } |
| 388 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 389 | bool LayerSupportBase::IsPadSupported(const TensorInfo& /*input*/, |
| 390 | const TensorInfo& /*output*/, |
| 391 | const PadDescriptor& /*descriptor*/, |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 392 | Optional<std::string&> reasonIfUnsupported) const |
| 393 | { |
| 394 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 395 | } |
| 396 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 397 | bool LayerSupportBase::IsPermuteSupported(const TensorInfo& /*input*/, |
| 398 | const TensorInfo& /*output*/, |
| 399 | const PermuteDescriptor& /*descriptor*/, |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 400 | Optional<std::string&> reasonIfUnsupported) const |
| 401 | { |
| 402 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 403 | } |
| 404 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 405 | bool LayerSupportBase::IsPooling2dSupported(const TensorInfo& /*input*/, |
| 406 | const TensorInfo& /*output*/, |
| 407 | const Pooling2dDescriptor& /*descriptor*/, |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 408 | Optional<std::string&> reasonIfUnsupported) const |
| 409 | { |
| 410 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 411 | } |
| 412 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 413 | bool LayerSupportBase::IsPreCompiledSupported(const TensorInfo& /*input*/, |
| 414 | const PreCompiledDescriptor& /*descriptor*/, |
Matteo Martincigh | 4912402 | 2019-01-11 13:25:59 +0000 | [diff] [blame] | 415 | Optional<std::string&> reasonIfUnsupported) const |
| 416 | { |
| 417 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 418 | } |
| 419 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 420 | bool LayerSupportBase::IsPreluSupported(const TensorInfo& /*input*/, |
| 421 | const TensorInfo& /*alpha*/, |
| 422 | const TensorInfo& /*output*/, |
Matteo Martincigh | 0e406ee | 2019-06-12 15:42:18 +0100 | [diff] [blame] | 423 | Optional<std::string &> reasonIfUnsupported) const |
| 424 | { |
| 425 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 426 | } |
| 427 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 428 | bool LayerSupportBase::IsQuantizeSupported(const armnn::TensorInfo& /*input*/, |
| 429 | const armnn::TensorInfo& /*output*/, |
Derek Lamberti | a9cca6a | 2019-03-25 15:41:58 +0000 | [diff] [blame] | 430 | armnn::Optional<std::string&> reasonIfUnsupported) const |
| 431 | { |
| 432 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 433 | } |
| 434 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 435 | bool LayerSupportBase::IsQuantizedLstmSupported(const TensorInfo& /*input*/, |
| 436 | const TensorInfo& /*previousCellStateIn*/, |
| 437 | const TensorInfo& /*previousOutputIn*/, |
| 438 | const TensorInfo& /*cellStateOut*/, |
| 439 | const TensorInfo& /*output*/, |
| 440 | const QuantizedLstmInputParamsInfo& /*paramsInfo*/, |
James Conroy | ee18dc8 | 2019-07-17 11:27:46 +0100 | [diff] [blame] | 441 | Optional<std::string&> reasonIfUnsupported) const |
| 442 | { |
| 443 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 444 | } |
| 445 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 446 | bool LayerSupportBase::IsReshapeSupported(const TensorInfo& /*input*/, |
Kevin May | a023c40 | 2019-12-12 17:28:05 +0000 | [diff] [blame] | 447 | const TensorInfo& /*output*/, |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 448 | const ReshapeDescriptor& /*descriptor*/, |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 449 | Optional<std::string&> reasonIfUnsupported) const |
| 450 | { |
| 451 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 452 | } |
| 453 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 454 | bool LayerSupportBase::IsResizeBilinearSupported(const TensorInfo& /*input*/, |
| 455 | const TensorInfo& /*output*/, |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 456 | Optional<std::string&> reasonIfUnsupported) const |
| 457 | { |
| 458 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 459 | } |
| 460 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 461 | bool LayerSupportBase::IsResizeSupported(const TensorInfo& /*input*/, |
| 462 | const TensorInfo& /*output*/, |
| 463 | const ResizeDescriptor& /*descriptor*/, |
Teresa Charlin | a9075df | 2019-06-27 15:41:57 +0100 | [diff] [blame] | 464 | Optional<std::string&> reasonIfUnsupported) const |
| 465 | { |
| 466 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 467 | } |
| 468 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 469 | bool LayerSupportBase::IsRsqrtSupported(const TensorInfo &/*input*/, |
| 470 | const TensorInfo &/*output*/, |
Matteo Martincigh | 3d6898c | 2019-01-15 16:11:44 +0000 | [diff] [blame] | 471 | Optional<std::string &> reasonIfUnsupported) const |
| 472 | { |
| 473 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 474 | } |
| 475 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 476 | bool LayerSupportBase::IsSliceSupported(const TensorInfo& /*input*/, |
| 477 | const TensorInfo& /*output*/, |
| 478 | const SliceDescriptor& /*descriptor*/, |
Aron Virginas-Tar | 636ab40 | 2019-09-16 14:27:45 +0100 | [diff] [blame] | 479 | Optional<std::string&> reasonIfUnsupported) const |
| 480 | { |
| 481 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 482 | } |
| 483 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 484 | bool LayerSupportBase::IsSoftmaxSupported(const TensorInfo& /*input*/, |
| 485 | const TensorInfo& /*output*/, |
| 486 | const SoftmaxDescriptor& /*descriptor*/, |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 487 | Optional<std::string&> reasonIfUnsupported) const |
| 488 | { |
| 489 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 490 | } |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 491 | /**/ |
| 492 | bool LayerSupportBase::IsSpaceToBatchNdSupported(const TensorInfo& /*input*/, |
| 493 | const TensorInfo& /*output*/, |
| 494 | const SpaceToBatchNdDescriptor& /*descriptor*/, |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 495 | Optional<std::string&> reasonIfUnsupported) const |
| 496 | { |
| 497 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 498 | } |
| 499 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 500 | bool LayerSupportBase::IsSpaceToDepthSupported(const TensorInfo& /*input*/, |
| 501 | const TensorInfo& /*output*/, |
| 502 | const SpaceToDepthDescriptor& /*descriptor*/, |
Aron Virginas-Tar | 972af15 | 2019-06-11 14:14:03 +0100 | [diff] [blame] | 503 | Optional<std::string&> reasonIfUnsupported) const |
| 504 | { |
| 505 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 506 | } |
| 507 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 508 | bool LayerSupportBase::IsSplitterSupported(const TensorInfo& /*input*/, |
| 509 | const ViewsDescriptor& /*descriptor*/, |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 510 | Optional<std::string&> reasonIfUnsupported) const |
| 511 | { |
| 512 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 513 | } |
| 514 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 515 | bool LayerSupportBase::IsSplitterSupported(const TensorInfo& /*input*/, |
| 516 | const std::vector<std::reference_wrapper<TensorInfo>>& /*outputs*/, |
| 517 | const ViewsDescriptor& /*descriptor*/, |
Narumol Prangnawarat | 15eb583 | 2019-05-20 15:31:05 +0100 | [diff] [blame] | 518 | Optional<std::string&> reasonIfUnsupported) const |
| 519 | { |
| 520 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 521 | } |
| 522 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 523 | bool LayerSupportBase::IsStackSupported(const std::vector<const TensorInfo*>& /*inputs*/, |
| 524 | const TensorInfo& /*output*/, |
| 525 | const StackDescriptor& /*descriptor*/, |
Matthew Jackson | 2b8c1da | 2019-07-04 14:59:16 +0100 | [diff] [blame] | 526 | Optional<std::string&> reasonIfUnsupported) const |
| 527 | { |
| 528 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 529 | } |
| 530 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 531 | bool LayerSupportBase::IsStandInSupported(const std::vector<const TensorInfo*>& /*inputs*/, |
| 532 | const std::vector<const TensorInfo*>& /*outputs*/, |
| 533 | const StandInDescriptor& /*descriptor*/, |
Derek Lamberti | 013c390 | 2019-10-21 10:46:16 +0100 | [diff] [blame] | 534 | Optional<std::string&> reasonIfUnsupported) const |
| 535 | { |
| 536 | if (reasonIfUnsupported) |
| 537 | { |
| 538 | std::stringstream message; |
| 539 | message << "StandIn layer is not executable via backends"; |
| 540 | |
| 541 | reasonIfUnsupported.value() = message.str(); |
| 542 | } |
| 543 | |
| 544 | return false; |
| 545 | } |
| 546 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 547 | bool LayerSupportBase::IsStridedSliceSupported(const TensorInfo& /*input*/, |
| 548 | const TensorInfo& /*output*/, |
| 549 | const StridedSliceDescriptor& /*descriptor*/, |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 550 | Optional<std::string&> reasonIfUnsupported) const |
| 551 | { |
| 552 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 553 | } |
| 554 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 555 | bool LayerSupportBase::IsSubtractionSupported(const TensorInfo& /*input0*/, |
| 556 | const TensorInfo& /*input1*/, |
| 557 | const TensorInfo& /*output*/, |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 558 | Optional<std::string&> reasonIfUnsupported) const |
| 559 | { |
| 560 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 561 | } |
| 562 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 563 | bool LayerSupportBase::IsSwitchSupported(const TensorInfo& /*input0*/, |
| 564 | const TensorInfo& /*input1*/, |
| 565 | const TensorInfo& /*output0*/, |
| 566 | const TensorInfo& /*output1*/, |
Sadik Armagan | eff363d | 2019-04-05 15:25:46 +0100 | [diff] [blame] | 567 | Optional<std::string&> reasonIfUnsupported) const |
| 568 | { |
| 569 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 570 | } |
| 571 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 572 | bool LayerSupportBase::IsTransposeConvolution2dSupported(const TensorInfo& /*input*/, |
| 573 | const TensorInfo& /*output*/, |
| 574 | const TransposeConvolution2dDescriptor& /*descriptor*/, |
| 575 | const TensorInfo& /*weights*/, |
| 576 | const Optional<TensorInfo>& /*biases*/, |
Aron Virginas-Tar | 639fb04 | 2019-06-20 14:28:19 +0100 | [diff] [blame] | 577 | Optional<std::string&> reasonIfUnsupported) const |
| 578 | { |
| 579 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 580 | } |
| 581 | |
Mike Kelly | c9ea45a | 2020-02-28 18:11:58 +0000 | [diff] [blame] | 582 | bool LayerSupportBase::IsTransposeSupported(const TensorInfo& /*input*/, |
| 583 | const TensorInfo& /*output*/, |
| 584 | const TransposeDescriptor& /*descriptor*/, |
| 585 | Optional<std::string&> reasonIfUnsupported) const |
| 586 | { |
| 587 | return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); |
| 588 | } |
| 589 | |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 590 | } // namespace armnn |