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 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 6 | #include "RefLayerSupport.hpp" |
David Beck | 3e9e115 | 2018-10-17 14:17:50 +0100 | [diff] [blame] | 7 | #include "RefBackendId.hpp" |
David Beck | 3cc9a62 | 2018-10-12 10:38:31 +0100 | [diff] [blame] | 8 | |
Aron Virginas-Tar | c9cc804 | 2018-11-01 16:15:57 +0000 | [diff] [blame] | 9 | #include <InternalTypes.hpp> |
| 10 | #include <LayerSupportCommon.hpp> |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 11 | #include <armnn/Types.hpp> |
Derek Lamberti | 50db4e8 | 2019-03-13 14:16:15 +0000 | [diff] [blame] | 12 | #include <armnn/Descriptors.hpp> |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 13 | |
David Beck | 111b5d9 | 2018-11-12 14:59:37 +0000 | [diff] [blame] | 14 | #include <backendsCommon/BackendRegistry.hpp> |
David Beck | 3e9e115 | 2018-10-17 14:17:50 +0100 | [diff] [blame] | 15 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 16 | #include <boost/core/ignore_unused.hpp> |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 17 | |
Derek Lamberti | 50db4e8 | 2019-03-13 14:16:15 +0000 | [diff] [blame] | 18 | #include <vector> |
| 19 | #include <algorithm> |
| 20 | #include <array> |
| 21 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 22 | using namespace boost; |
| 23 | |
| 24 | namespace armnn |
| 25 | { |
| 26 | |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 27 | namespace |
| 28 | { |
| 29 | |
| 30 | template<typename Float32Func, typename Uint8Func, typename ... Params> |
| 31 | bool IsSupportedForDataTypeRef(Optional<std::string&> reasonIfUnsupported, |
| 32 | DataType dataType, |
| 33 | Float32Func floatFuncPtr, |
| 34 | Uint8Func uint8FuncPtr, |
| 35 | Params&&... params) |
| 36 | { |
| 37 | return IsSupportedForDataTypeGeneric(reasonIfUnsupported, |
| 38 | dataType, |
| 39 | &FalseFunc<Params...>, |
| 40 | floatFuncPtr, |
| 41 | uint8FuncPtr, |
narpra01 | db2b160 | 2019-01-23 15:23:11 +0000 | [diff] [blame] | 42 | &FalseFunc<Params...>, |
kevmay01 | 2b4d88e | 2019-01-24 14:05:09 +0000 | [diff] [blame] | 43 | &FalseFunc<Params...>, |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 44 | std::forward<Params>(params)...); |
| 45 | } |
| 46 | |
| 47 | } // anonymous namespace |
| 48 | |
Derek Lamberti | 50db4e8 | 2019-03-13 14:16:15 +0000 | [diff] [blame] | 49 | |
| 50 | namespace |
| 51 | { |
| 52 | template<typename F> |
| 53 | bool CheckSupportRule(F rule, Optional<std::string&> reasonIfUnsupported, const char* reason) |
| 54 | { |
| 55 | bool supported = rule(); |
| 56 | if (!supported && reason) |
| 57 | { |
| 58 | reasonIfUnsupported.value() += std::string(reason) + "\n"; // Append the reason on a new line |
| 59 | } |
| 60 | return supported; |
| 61 | } |
| 62 | |
| 63 | struct Rule |
| 64 | { |
| 65 | bool operator()() const |
| 66 | { |
| 67 | return m_Res; |
| 68 | } |
| 69 | |
| 70 | bool m_Res = true; |
| 71 | }; |
| 72 | |
Derek Lamberti | 2a434a8 | 2019-03-20 13:07:57 +0000 | [diff] [blame] | 73 | template<typename T> |
| 74 | bool AllTypesAreEqualImpl(T t) |
Derek Lamberti | 50db4e8 | 2019-03-13 14:16:15 +0000 | [diff] [blame] | 75 | { |
| 76 | return true; |
| 77 | } |
| 78 | |
| 79 | template<typename T, typename... Rest> |
| 80 | bool AllTypesAreEqualImpl(T t1, T t2, Rest... rest) |
| 81 | { |
| 82 | static_assert(std::is_same<T, TensorInfo>::value, "Type T must be a TensorInfo"); |
| 83 | |
Derek Lamberti | 2a434a8 | 2019-03-20 13:07:57 +0000 | [diff] [blame] | 84 | return (t1.GetDataType() == t2.GetDataType()) && AllTypesAreEqualImpl(t2, rest...); |
Derek Lamberti | 50db4e8 | 2019-03-13 14:16:15 +0000 | [diff] [blame] | 85 | } |
| 86 | |
| 87 | struct TypesAreEqual : public Rule |
| 88 | { |
| 89 | template<typename ... Ts> |
| 90 | TypesAreEqual(const Ts&... ts) |
| 91 | { |
| 92 | m_Res = AllTypesAreEqualImpl(ts...); |
| 93 | } |
| 94 | }; |
| 95 | |
| 96 | struct QuantizationParametersAreEqual : public Rule |
| 97 | { |
| 98 | QuantizationParametersAreEqual(const TensorInfo& info0, const TensorInfo& info1) |
| 99 | { |
| 100 | m_Res = info0.GetQuantizationScale() == info1.GetQuantizationScale() && |
| 101 | info0.GetQuantizationOffset() == info1.GetQuantizationOffset(); |
| 102 | } |
| 103 | }; |
| 104 | |
| 105 | struct TypeAnyOf : public Rule |
| 106 | { |
| 107 | template<typename Container> |
| 108 | TypeAnyOf(const TensorInfo& info, const Container& c) |
| 109 | { |
| 110 | m_Res = std::any_of(c.begin(), c.end(), [&info](DataType dt) |
| 111 | { |
| 112 | return dt == info.GetDataType(); |
| 113 | }); |
| 114 | } |
| 115 | }; |
| 116 | |
| 117 | struct ShapesAreSameRank : public Rule |
| 118 | { |
| 119 | ShapesAreSameRank(const TensorInfo& info0, const TensorInfo& info1) |
| 120 | { |
| 121 | m_Res = info0.GetShape().GetNumDimensions() == info1.GetShape().GetNumDimensions(); |
| 122 | } |
| 123 | }; |
| 124 | |
Derek Lamberti | 5f400d6 | 2019-03-25 15:41:58 +0000 | [diff] [blame^] | 125 | struct ShapesAreSameTotalSize : public Rule |
| 126 | { |
| 127 | ShapesAreSameTotalSize(const TensorInfo& info0, const TensorInfo& info1) |
| 128 | { |
| 129 | m_Res = info0.GetNumElements() == info1.GetNumElements(); |
| 130 | } |
| 131 | }; |
| 132 | |
Derek Lamberti | 50db4e8 | 2019-03-13 14:16:15 +0000 | [diff] [blame] | 133 | struct ShapesAreBroadcastCompatible : public Rule |
| 134 | { |
| 135 | unsigned int CalcInputSize(const TensorShape& in, const TensorShape& out, unsigned int idx) |
| 136 | { |
| 137 | unsigned int offset = out.GetNumDimensions() - in.GetNumDimensions(); |
| 138 | unsigned int sizeIn = (idx < offset) ? 1 : in[idx-offset]; |
| 139 | return sizeIn; |
| 140 | } |
| 141 | |
| 142 | ShapesAreBroadcastCompatible(const TensorInfo& in0, const TensorInfo& in1, const TensorInfo& out) |
| 143 | { |
| 144 | const TensorShape& shape0 = in0.GetShape(); |
| 145 | const TensorShape& shape1 = in1.GetShape(); |
| 146 | const TensorShape& outShape = out.GetShape(); |
| 147 | |
| 148 | for (unsigned int i=0; i < outShape.GetNumDimensions() && m_Res; i++) |
| 149 | { |
| 150 | unsigned int sizeOut = outShape[i]; |
| 151 | unsigned int sizeIn0 = CalcInputSize(shape0, outShape, i); |
| 152 | unsigned int sizeIn1 = CalcInputSize(shape1, outShape, i); |
| 153 | |
| 154 | m_Res &= ((sizeIn0 == sizeOut) || (sizeIn0 == 1)) && |
| 155 | ((sizeIn1 == sizeOut) || (sizeIn1 == 1)); |
| 156 | } |
| 157 | } |
| 158 | }; |
| 159 | } // namespace |
| 160 | |
| 161 | |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 162 | bool RefLayerSupport::IsActivationSupported(const TensorInfo& input, |
| 163 | const TensorInfo& output, |
| 164 | const ActivationDescriptor& descriptor, |
| 165 | Optional<std::string&> reasonIfUnsupported) const |
| 166 | { |
Derek Lamberti | 50db4e8 | 2019-03-13 14:16:15 +0000 | [diff] [blame] | 167 | bool supported = true; |
| 168 | |
| 169 | // Define supported types. |
| 170 | std::array<DataType,2> supportedTypes = { |
| 171 | DataType::Float32, |
| 172 | DataType::QuantisedAsymm8 |
| 173 | }; |
| 174 | |
| 175 | supported &= CheckSupportRule(TypeAnyOf(input, supportedTypes), reasonIfUnsupported, |
| 176 | "Reference activation: input type not supported."); |
| 177 | |
| 178 | supported &= CheckSupportRule(TypeAnyOf(output, supportedTypes), reasonIfUnsupported, |
| 179 | "Reference activation: output type not supported."); |
| 180 | |
| 181 | supported &= CheckSupportRule(TypesAreEqual(input, output), reasonIfUnsupported, |
| 182 | "Reference activation: input and output types mismatched."); |
| 183 | |
| 184 | supported &= CheckSupportRule(ShapesAreSameRank(input, output), reasonIfUnsupported, |
| 185 | "Reference activation: input and output shapes are of different rank."); |
| 186 | |
| 187 | |
| 188 | struct ActivationFunctionSupported : public Rule |
| 189 | { |
| 190 | ActivationFunctionSupported(const ActivationDescriptor& desc) |
| 191 | { |
| 192 | switch(desc.m_Function) |
| 193 | { |
| 194 | case ActivationFunction::Abs: |
| 195 | case ActivationFunction::BoundedReLu: |
| 196 | case ActivationFunction::LeakyReLu: |
| 197 | case ActivationFunction::Linear: |
| 198 | case ActivationFunction::ReLu: |
| 199 | case ActivationFunction::Sigmoid: |
| 200 | case ActivationFunction::SoftReLu: |
| 201 | case ActivationFunction::Sqrt: |
| 202 | case ActivationFunction::Square: |
| 203 | case ActivationFunction::TanH: |
| 204 | { |
| 205 | m_Res = true; |
| 206 | break; |
| 207 | } |
| 208 | default: |
| 209 | { |
| 210 | m_Res = false; |
| 211 | break; |
| 212 | } |
| 213 | } |
| 214 | } |
| 215 | }; |
| 216 | |
| 217 | // Function is supported |
| 218 | supported &= CheckSupportRule(ActivationFunctionSupported(descriptor), reasonIfUnsupported, |
| 219 | "Reference activation: function not supported."); |
| 220 | |
| 221 | return supported; |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 222 | } |
| 223 | |
| 224 | bool RefLayerSupport::IsAdditionSupported(const TensorInfo& input0, |
| 225 | const TensorInfo& input1, |
| 226 | const TensorInfo& output, |
| 227 | Optional<std::string&> reasonIfUnsupported) const |
| 228 | { |
Derek Lamberti | 50db4e8 | 2019-03-13 14:16:15 +0000 | [diff] [blame] | 229 | bool supported = true; |
| 230 | |
| 231 | std::array<DataType,2> supportedTypes = { |
| 232 | DataType::Float32, |
| 233 | DataType::QuantisedAsymm8 |
| 234 | }; |
| 235 | |
| 236 | supported &= CheckSupportRule(TypeAnyOf(input0, supportedTypes), reasonIfUnsupported, |
| 237 | "Reference addition: input 0 is not a supported type."); |
| 238 | |
| 239 | supported &= CheckSupportRule(TypeAnyOf(input1, supportedTypes), reasonIfUnsupported, |
| 240 | "Reference addition: input 1 is not a supported type."); |
| 241 | |
| 242 | supported &= CheckSupportRule(TypeAnyOf(output, supportedTypes), reasonIfUnsupported, |
| 243 | "Reference addition: output is not a supported type."); |
| 244 | |
| 245 | supported &= CheckSupportRule(TypesAreEqual(input0, input1), reasonIfUnsupported, |
| 246 | "Reference addition: input 0 and Input 1 types are mismatched"); |
| 247 | |
| 248 | supported &= CheckSupportRule(TypesAreEqual(input0, output), reasonIfUnsupported, |
| 249 | "Reference addition: input and output types are mismatched"); |
| 250 | |
| 251 | supported &= CheckSupportRule(ShapesAreBroadcastCompatible(input0, input1, output), reasonIfUnsupported, |
| 252 | "Reference addition: shapes are not suitable for implicit broadcast."); |
| 253 | |
| 254 | return supported; |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 255 | } |
| 256 | |
| 257 | bool RefLayerSupport::IsBatchNormalizationSupported(const TensorInfo& input, |
| 258 | const TensorInfo& output, |
| 259 | const TensorInfo& mean, |
| 260 | const TensorInfo& var, |
| 261 | const TensorInfo& beta, |
| 262 | const TensorInfo& gamma, |
| 263 | const BatchNormalizationDescriptor& descriptor, |
| 264 | Optional<std::string&> reasonIfUnsupported) const |
| 265 | { |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 266 | ignore_unused(output); |
| 267 | ignore_unused(mean); |
| 268 | ignore_unused(var); |
| 269 | ignore_unused(beta); |
| 270 | ignore_unused(gamma); |
| 271 | ignore_unused(descriptor); |
| 272 | return IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 273 | input.GetDataType(), |
| 274 | &TrueFunc<>, |
| 275 | &TrueFunc<>); |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 276 | } |
| 277 | |
Éanna Ó Catháin | 4e1e136 | 2018-11-12 11:36:34 +0000 | [diff] [blame] | 278 | bool RefLayerSupport::IsBatchToSpaceNdSupported(const TensorInfo& input, |
| 279 | const TensorInfo& output, |
| 280 | const BatchToSpaceNdDescriptor& descriptor, |
| 281 | Optional<std::string&> reasonIfUnsupported) const |
| 282 | { |
| 283 | ignore_unused(descriptor); |
| 284 | return (IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 285 | input.GetDataType(), |
| 286 | &TrueFunc<>, |
| 287 | &TrueFunc<>) && |
| 288 | IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 289 | output.GetDataType(), |
| 290 | &TrueFunc<>, |
| 291 | &TrueFunc<>)); |
| 292 | } |
| 293 | |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 294 | bool RefLayerSupport::IsConstantSupported(const TensorInfo& output, |
| 295 | Optional<std::string&> reasonIfUnsupported) const |
| 296 | { |
narpra01 | db2b160 | 2019-01-23 15:23:11 +0000 | [diff] [blame] | 297 | return IsSupportedForDataTypeGeneric(reasonIfUnsupported, |
| 298 | output.GetDataType(), |
| 299 | &FalseFunc<>, |
| 300 | &TrueFunc<>, |
| 301 | &TrueFunc<>, |
kevmay01 | 2b4d88e | 2019-01-24 14:05:09 +0000 | [diff] [blame] | 302 | &TrueFunc<>, |
| 303 | &FalseFunc<>); |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 304 | } |
| 305 | |
| 306 | bool RefLayerSupport::IsConvertFp16ToFp32Supported(const TensorInfo& input, |
| 307 | const TensorInfo& output, |
| 308 | Optional<std::string&> reasonIfUnsupported) const |
| 309 | { |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 310 | return (IsSupportedForDataTypeGeneric(reasonIfUnsupported, |
| 311 | input.GetDataType(), |
| 312 | &TrueFunc<>, |
| 313 | &FalseInputFuncF32<>, |
narpra01 | db2b160 | 2019-01-23 15:23:11 +0000 | [diff] [blame] | 314 | &FalseFuncU8<>, |
kevmay01 | 2b4d88e | 2019-01-24 14:05:09 +0000 | [diff] [blame] | 315 | &FalseFuncI32<>, |
| 316 | &FalseFuncU8<>) && |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 317 | IsSupportedForDataTypeGeneric(reasonIfUnsupported, |
| 318 | output.GetDataType(), |
| 319 | &FalseOutputFuncF16<>, |
| 320 | &TrueFunc<>, |
narpra01 | db2b160 | 2019-01-23 15:23:11 +0000 | [diff] [blame] | 321 | &FalseFuncU8<>, |
kevmay01 | 2b4d88e | 2019-01-24 14:05:09 +0000 | [diff] [blame] | 322 | &FalseFuncI32<>, |
| 323 | &FalseFuncU8<>)); |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 324 | } |
| 325 | |
| 326 | bool RefLayerSupport::IsConvertFp32ToFp16Supported(const TensorInfo& input, |
| 327 | const TensorInfo& output, |
| 328 | Optional<std::string&> reasonIfUnsupported) const |
| 329 | { |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 330 | return (IsSupportedForDataTypeGeneric(reasonIfUnsupported, |
| 331 | input.GetDataType(), |
| 332 | &FalseInputFuncF16<>, |
| 333 | &TrueFunc<>, |
narpra01 | db2b160 | 2019-01-23 15:23:11 +0000 | [diff] [blame] | 334 | &FalseFuncU8<>, |
kevmay01 | 2b4d88e | 2019-01-24 14:05:09 +0000 | [diff] [blame] | 335 | &FalseFuncI32<>, |
| 336 | &FalseFuncU8<>) && |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 337 | IsSupportedForDataTypeGeneric(reasonIfUnsupported, |
| 338 | output.GetDataType(), |
| 339 | &TrueFunc<>, |
| 340 | &FalseOutputFuncF32<>, |
narpra01 | db2b160 | 2019-01-23 15:23:11 +0000 | [diff] [blame] | 341 | &FalseFuncU8<>, |
kevmay01 | 2b4d88e | 2019-01-24 14:05:09 +0000 | [diff] [blame] | 342 | &FalseFuncI32<>, |
| 343 | &FalseFuncU8<>)); |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 344 | } |
| 345 | |
| 346 | bool RefLayerSupport::IsConvolution2dSupported(const TensorInfo& input, |
| 347 | const TensorInfo& output, |
| 348 | const Convolution2dDescriptor& descriptor, |
| 349 | const TensorInfo& weights, |
| 350 | const Optional<TensorInfo>& biases, |
| 351 | Optional<std::string&> reasonIfUnsupported) const |
| 352 | { |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 353 | ignore_unused(output); |
| 354 | ignore_unused(descriptor); |
| 355 | ignore_unused(weights); |
| 356 | ignore_unused(biases); |
| 357 | return IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 358 | input.GetDataType(), |
| 359 | &TrueFunc<>, |
| 360 | &TrueFunc<>); |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 361 | } |
| 362 | |
Nattapat Chaimanowong | cfdcadf | 2018-12-06 11:54:33 +0000 | [diff] [blame] | 363 | bool RefLayerSupport::IsDebugSupported(const TensorInfo& input, |
| 364 | const TensorInfo& output, |
Nattapat Chaimanowong | cfdcadf | 2018-12-06 11:54:33 +0000 | [diff] [blame] | 365 | Optional<std::string&> reasonIfUnsupported) const |
| 366 | { |
| 367 | ignore_unused(output); |
Nattapat Chaimanowong | cfdcadf | 2018-12-06 11:54:33 +0000 | [diff] [blame] | 368 | return IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 369 | input.GetDataType(), |
| 370 | &TrueFunc<>, |
| 371 | &TrueFunc<>); |
| 372 | } |
| 373 | |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 374 | bool RefLayerSupport::IsDepthwiseConvolutionSupported(const TensorInfo& input, |
| 375 | const TensorInfo& output, |
| 376 | const DepthwiseConvolution2dDescriptor& descriptor, |
| 377 | const TensorInfo& weights, |
| 378 | const Optional<TensorInfo>& biases, |
| 379 | Optional<std::string&> reasonIfUnsupported) const |
| 380 | { |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 381 | ignore_unused(output); |
| 382 | ignore_unused(descriptor); |
| 383 | ignore_unused(weights); |
| 384 | ignore_unused(biases); |
| 385 | return IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 386 | input.GetDataType(), |
| 387 | &TrueFunc<>, |
| 388 | &TrueFunc<>); |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 389 | } |
| 390 | |
Nattapat Chaimanowong | 8a54ac0 | 2019-03-29 15:25:04 +0000 | [diff] [blame] | 391 | bool RefLayerSupport::IsDequantizeSupported(const TensorInfo& input, |
| 392 | const TensorInfo& output, |
| 393 | Optional<std::string&> reasonIfUnsupported) const |
| 394 | { |
| 395 | return IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 396 | input.GetDataType(), |
| 397 | &FalseFunc<>, |
| 398 | &TrueFunc<>); |
| 399 | } |
| 400 | |
Narumol Prangnawarat | bc67cef | 2019-01-31 15:31:54 +0000 | [diff] [blame] | 401 | bool RefLayerSupport::IsDetectionPostProcessSupported(const armnn::TensorInfo& input0, |
| 402 | const armnn::TensorInfo& input1, |
| 403 | const armnn::DetectionPostProcessDescriptor& descriptor, |
| 404 | armnn::Optional<std::string&> reasonIfUnsupported) const |
| 405 | { |
| 406 | ignore_unused(input1); |
| 407 | return IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 408 | input0.GetDataType(), |
| 409 | &TrueFunc<>, |
| 410 | &TrueFunc<>); |
| 411 | } |
| 412 | |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 413 | bool RefLayerSupport::IsDivisionSupported(const TensorInfo& input0, |
| 414 | const TensorInfo& input1, |
| 415 | const TensorInfo& output, |
| 416 | Optional<std::string&> reasonIfUnsupported) const |
| 417 | { |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 418 | ignore_unused(input1); |
| 419 | ignore_unused(output); |
| 420 | return IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 421 | input0.GetDataType(), |
| 422 | &TrueFunc<>, |
| 423 | &TrueFunc<>); |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 424 | } |
| 425 | |
FrancisMurtagh | 30cdfca | 2018-12-18 12:57:35 +0000 | [diff] [blame] | 426 | bool RefLayerSupport::IsEqualSupported(const TensorInfo& input0, |
| 427 | const TensorInfo& input1, |
| 428 | const TensorInfo& output, |
| 429 | Optional<std::string&> reasonIfUnsupported) const |
| 430 | { |
| 431 | ignore_unused(input0); |
| 432 | ignore_unused(input1); |
| 433 | ignore_unused(output); |
| 434 | ignore_unused(reasonIfUnsupported); |
| 435 | return IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 436 | input0.GetDataType(), |
| 437 | &TrueFunc<>, |
| 438 | &TrueFunc<>); |
| 439 | } |
| 440 | |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 441 | bool RefLayerSupport::IsFakeQuantizationSupported(const TensorInfo& input, |
| 442 | const FakeQuantizationDescriptor& descriptor, |
| 443 | Optional<std::string&> reasonIfUnsupported) const |
| 444 | { |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 445 | ignore_unused(descriptor); |
| 446 | return IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 447 | input.GetDataType(), |
| 448 | &TrueFunc<>, |
| 449 | &FalseFuncU8<>); |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 450 | } |
| 451 | |
| 452 | bool RefLayerSupport::IsFloorSupported(const TensorInfo& input, |
| 453 | const TensorInfo& output, |
| 454 | Optional<std::string&> reasonIfUnsupported) const |
| 455 | { |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 456 | ignore_unused(output); |
| 457 | return IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 458 | input.GetDataType(), |
| 459 | &TrueFunc<>, |
| 460 | &FalseFuncU8<>); |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 461 | } |
| 462 | |
| 463 | bool RefLayerSupport::IsFullyConnectedSupported(const TensorInfo& input, |
| 464 | const TensorInfo& output, |
| 465 | const TensorInfo& weights, |
| 466 | const TensorInfo& biases, |
| 467 | const FullyConnectedDescriptor& descriptor, |
| 468 | Optional<std::string&> reasonIfUnsupported) const |
| 469 | { |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 470 | ignore_unused(output); |
| 471 | ignore_unused(weights); |
| 472 | ignore_unused(biases); |
| 473 | ignore_unused(descriptor); |
| 474 | return IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 475 | input.GetDataType(), |
| 476 | &TrueFunc<>, |
| 477 | &TrueFunc<>); |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 478 | } |
| 479 | |
narpra01 | 4951d84 | 2019-01-18 16:53:53 +0000 | [diff] [blame] | 480 | bool RefLayerSupport::IsGatherSupported(const armnn::TensorInfo& input0, |
| 481 | const armnn::TensorInfo& input1, |
| 482 | const armnn::TensorInfo& output, |
| 483 | armnn::Optional<std::string&> reasonIfUnsupported) const |
| 484 | { |
| 485 | ignore_unused(input1); |
| 486 | ignore_unused(output); |
| 487 | return IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 488 | input0.GetDataType(), |
| 489 | &TrueFunc<>, |
| 490 | &TrueFunc<>); |
| 491 | } |
| 492 | |
FrancisMurtagh | 878f023 | 2018-12-19 10:56:15 +0000 | [diff] [blame] | 493 | bool RefLayerSupport::IsGreaterSupported(const TensorInfo& input0, |
| 494 | const TensorInfo& input1, |
| 495 | const TensorInfo& output, |
| 496 | Optional<std::string&> reasonIfUnsupported) const |
| 497 | { |
| 498 | ignore_unused(input0); |
| 499 | ignore_unused(input1); |
| 500 | ignore_unused(output); |
| 501 | ignore_unused(reasonIfUnsupported); |
| 502 | return IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 503 | input0.GetDataType(), |
| 504 | &TrueFunc<>, |
| 505 | &TrueFunc<>); |
| 506 | } |
| 507 | |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 508 | bool RefLayerSupport::IsInputSupported(const TensorInfo& input, |
| 509 | Optional<std::string&> reasonIfUnsupported) const |
| 510 | { |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 511 | return IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 512 | input.GetDataType(), |
| 513 | &TrueFunc<>, |
| 514 | &TrueFunc<>); |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 515 | } |
| 516 | |
| 517 | bool RefLayerSupport::IsL2NormalizationSupported(const TensorInfo& input, |
| 518 | const TensorInfo& output, |
| 519 | const L2NormalizationDescriptor& descriptor, |
| 520 | Optional<std::string&> reasonIfUnsupported) const |
| 521 | { |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 522 | ignore_unused(output); |
| 523 | ignore_unused(descriptor); |
| 524 | return IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 525 | input.GetDataType(), |
| 526 | &TrueFunc<>, |
| 527 | &FalseFuncU8<>); |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 528 | } |
| 529 | |
| 530 | bool RefLayerSupport::IsLstmSupported(const TensorInfo& input, |
| 531 | const TensorInfo& outputStateIn, |
| 532 | const TensorInfo& cellStateIn, |
| 533 | const TensorInfo& scratchBuffer, |
| 534 | const TensorInfo& outputStateOut, |
| 535 | const TensorInfo& cellStateOut, |
| 536 | const TensorInfo& output, |
| 537 | const LstmDescriptor& descriptor, |
| 538 | const TensorInfo& inputToForgetWeights, |
| 539 | const TensorInfo& inputToCellWeights, |
| 540 | const TensorInfo& inputToOutputWeights, |
| 541 | const TensorInfo& recurrentToForgetWeights, |
| 542 | const TensorInfo& recurrentToCellWeights, |
| 543 | const TensorInfo& recurrentToOutputWeights, |
| 544 | const TensorInfo& forgetGateBias, |
| 545 | const TensorInfo& cellBias, |
| 546 | const TensorInfo& outputGateBias, |
| 547 | const TensorInfo* inputToInputWeights, |
| 548 | const TensorInfo* recurrentToInputWeights, |
| 549 | const TensorInfo* cellToInputWeights, |
| 550 | const TensorInfo* inputGateBias, |
| 551 | const TensorInfo* projectionWeights, |
| 552 | const TensorInfo* projectionBias, |
| 553 | const TensorInfo* cellToForgetWeights, |
| 554 | const TensorInfo* cellToOutputWeights, |
| 555 | Optional<std::string&> reasonIfUnsupported) const |
| 556 | { |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 557 | ignore_unused(outputStateIn); |
| 558 | ignore_unused(cellStateIn); |
| 559 | ignore_unused(scratchBuffer); |
| 560 | ignore_unused(outputStateOut); |
| 561 | ignore_unused(cellStateOut); |
| 562 | ignore_unused(output); |
| 563 | ignore_unused(descriptor); |
| 564 | ignore_unused(inputToForgetWeights); |
| 565 | ignore_unused(inputToCellWeights); |
| 566 | ignore_unused(inputToOutputWeights); |
| 567 | ignore_unused(recurrentToForgetWeights); |
| 568 | ignore_unused(recurrentToCellWeights); |
| 569 | ignore_unused(recurrentToOutputWeights); |
| 570 | ignore_unused(forgetGateBias); |
| 571 | ignore_unused(cellBias); |
| 572 | ignore_unused(outputGateBias); |
| 573 | ignore_unused(inputToInputWeights); |
| 574 | ignore_unused(recurrentToInputWeights); |
| 575 | ignore_unused(cellToInputWeights); |
| 576 | ignore_unused(inputGateBias); |
| 577 | ignore_unused(projectionWeights); |
| 578 | ignore_unused(projectionBias); |
| 579 | ignore_unused(cellToForgetWeights); |
| 580 | ignore_unused(cellToOutputWeights); |
Matteo Martincigh | a65b7ae | 2018-11-14 12:39:55 +0000 | [diff] [blame] | 581 | return IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 582 | input.GetDataType(), |
| 583 | &TrueFunc<>, |
| 584 | &FalseFuncU8<>); |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 585 | } |
| 586 | |
saoste01 | 2df12b3 | 2018-11-28 16:57:20 +0000 | [diff] [blame] | 587 | bool RefLayerSupport::IsMaximumSupported(const TensorInfo& input0, |
| 588 | const TensorInfo& input1, |
| 589 | const TensorInfo& output, |
| 590 | Optional<std::string&> reasonIfUnsupported) const |
| 591 | { |
| 592 | ignore_unused(input1); |
| 593 | ignore_unused(output); |
| 594 | return IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 595 | input0.GetDataType(), |
| 596 | &TrueFunc<>, |
| 597 | &TrueFunc<>); |
| 598 | } |
| 599 | |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 600 | bool RefLayerSupport::IsMeanSupported(const TensorInfo& input, |
| 601 | const TensorInfo& output, |
| 602 | const MeanDescriptor& descriptor, |
| 603 | Optional<std::string&> reasonIfUnsupported) const |
narpra01 | 32b9046 | 2018-09-13 11:07:48 +0100 | [diff] [blame] | 604 | { |
narpra01 | 1e4c31d | 2018-09-28 11:07:51 +0100 | [diff] [blame] | 605 | ignore_unused(output); |
| 606 | ignore_unused(descriptor); |
| 607 | return IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 608 | input.GetDataType(), |
| 609 | &TrueFunc<>, |
| 610 | &TrueFunc<>); |
narpra01 | 32b9046 | 2018-09-13 11:07:48 +0100 | [diff] [blame] | 611 | } |
| 612 | |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 613 | bool RefLayerSupport::IsMergerSupported(const std::vector<const TensorInfo*> inputs, |
Nikhil Raj | 8599a41 | 2018-11-19 14:51:07 +0000 | [diff] [blame] | 614 | const TensorInfo& output, |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 615 | const OriginsDescriptor& descriptor, |
| 616 | Optional<std::string&> reasonIfUnsupported) const |
| 617 | { |
| 618 | ignore_unused(descriptor); |
Nikhil Raj | 8599a41 | 2018-11-19 14:51:07 +0000 | [diff] [blame] | 619 | ignore_unused(output); |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 620 | return IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 621 | inputs[0]->GetDataType(), |
| 622 | &TrueFunc<>, |
| 623 | &TrueFunc<>); |
| 624 | } |
| 625 | |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 626 | bool RefLayerSupport::IsMemCopySupported(const TensorInfo &input, |
| 627 | const TensorInfo &output, |
| 628 | Optional<std::string &> reasonIfUnsupported) const |
| 629 | { |
| 630 | ignore_unused(output); |
kevmay01 | 2b4d88e | 2019-01-24 14:05:09 +0000 | [diff] [blame] | 631 | return IsSupportedForDataTypeGeneric(reasonIfUnsupported, |
| 632 | input.GetDataType(), |
| 633 | &TrueFunc<>, |
| 634 | &TrueFunc<>, |
| 635 | &TrueFunc<>, |
| 636 | &FalseFuncI32<>, |
| 637 | &TrueFunc<>); |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 638 | } |
| 639 | |
Éanna Ó Catháin | 20e5880 | 2018-12-04 10:29:06 +0000 | [diff] [blame] | 640 | bool RefLayerSupport::IsMinimumSupported(const TensorInfo& input0, |
| 641 | const TensorInfo& input1, |
| 642 | const TensorInfo& output, |
| 643 | Optional<std::string&> reasonIfUnsupported) const |
| 644 | { |
| 645 | ignore_unused(input1); |
| 646 | ignore_unused(output); |
| 647 | return IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 648 | input0.GetDataType(), |
| 649 | &TrueFunc<>, |
| 650 | &TrueFunc<>); |
| 651 | } |
| 652 | |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 653 | bool RefLayerSupport::IsMultiplicationSupported(const TensorInfo& input0, |
| 654 | const TensorInfo& input1, |
| 655 | const TensorInfo& output, |
| 656 | Optional<std::string&> reasonIfUnsupported) const |
| 657 | { |
| 658 | ignore_unused(input1); |
| 659 | ignore_unused(output); |
| 660 | return IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 661 | input0.GetDataType(), |
| 662 | &TrueFunc<>, |
| 663 | &TrueFunc<>); |
| 664 | } |
| 665 | |
| 666 | bool RefLayerSupport::IsNormalizationSupported(const TensorInfo& input, |
| 667 | const TensorInfo& output, |
| 668 | const NormalizationDescriptor& descriptor, |
| 669 | Optional<std::string&> reasonIfUnsupported) const |
Nina Drozd | 661dfa7 | 2018-10-02 11:14:17 +0100 | [diff] [blame] | 670 | { |
| 671 | ignore_unused(output); |
| 672 | ignore_unused(descriptor); |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 673 | return IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 674 | input.GetDataType(), |
| 675 | &TrueFunc<>, |
| 676 | &FalseFuncU8<>); |
| 677 | } |
| 678 | |
| 679 | bool RefLayerSupport::IsOutputSupported(const TensorInfo& output, |
| 680 | Optional<std::string&> reasonIfUnsupported) const |
| 681 | { |
kevmay01 | 2b4d88e | 2019-01-24 14:05:09 +0000 | [diff] [blame] | 682 | return IsSupportedForDataTypeGeneric(reasonIfUnsupported, |
| 683 | output.GetDataType(), |
| 684 | &TrueFunc<>, |
| 685 | &TrueFunc<>, |
| 686 | &TrueFunc<>, |
| 687 | &FalseFuncI32<>, |
| 688 | &TrueFunc<>); |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 689 | } |
| 690 | |
| 691 | bool RefLayerSupport::IsPadSupported(const TensorInfo& input, |
| 692 | const TensorInfo& output, |
| 693 | const PadDescriptor& descriptor, |
| 694 | Optional<std::string&> reasonIfUnsupported) const |
| 695 | { |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 696 | ignore_unused(output); |
| 697 | ignore_unused(descriptor); |
jimfly01 | f6ba747 | 2018-12-04 10:09:52 +0000 | [diff] [blame] | 698 | return IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 699 | input.GetDataType(), |
| 700 | &TrueFunc<>, |
| 701 | &TrueFunc<>); |
Nina Drozd | 661dfa7 | 2018-10-02 11:14:17 +0100 | [diff] [blame] | 702 | } |
| 703 | |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 704 | bool RefLayerSupport::IsPermuteSupported(const TensorInfo& input, |
| 705 | const TensorInfo& output, |
| 706 | const PermuteDescriptor& descriptor, |
| 707 | Optional<std::string&> reasonIfUnsupported) const |
| 708 | { |
| 709 | ignore_unused(output); |
| 710 | ignore_unused(descriptor); |
| 711 | return IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 712 | input.GetDataType(), |
| 713 | &TrueFunc<>, |
| 714 | &TrueFunc<>); |
| 715 | } |
| 716 | |
| 717 | bool RefLayerSupport::IsPooling2dSupported(const TensorInfo& input, |
| 718 | const TensorInfo& output, |
| 719 | const Pooling2dDescriptor& descriptor, |
| 720 | Optional<std::string&> reasonIfUnsupported) const |
| 721 | { |
| 722 | ignore_unused(output); |
| 723 | ignore_unused(descriptor); |
| 724 | return IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 725 | input.GetDataType(), |
| 726 | &TrueFunc<>, |
| 727 | &TrueFunc<>); |
| 728 | } |
| 729 | |
Derek Lamberti | 5f400d6 | 2019-03-25 15:41:58 +0000 | [diff] [blame^] | 730 | bool RefLayerSupport::IsQuantizeSupported(const TensorInfo& input, |
| 731 | const TensorInfo& output, |
| 732 | Optional<std::string&> reasonIfUnsupported) const |
| 733 | { |
| 734 | bool supported = true; |
| 735 | |
| 736 | // Define supported output types. |
| 737 | std::array<DataType,2> supportedInputTypes = { |
| 738 | DataType::Float32, |
| 739 | }; |
| 740 | |
| 741 | supported &= CheckSupportRule(TypeAnyOf(input, supportedInputTypes), reasonIfUnsupported, |
| 742 | "Reference quantize: input type not supported."); |
| 743 | |
| 744 | // Define supported output types. |
| 745 | std::array<DataType,2> supportedOutputTypes = { |
| 746 | DataType::QuantisedAsymm8, |
| 747 | DataType::QuantisedSymm16 |
| 748 | }; |
| 749 | supported &= CheckSupportRule(TypeAnyOf(output, supportedOutputTypes), reasonIfUnsupported, |
| 750 | "Reference quantize: output type not supported."); |
| 751 | |
| 752 | supported &= CheckSupportRule(ShapesAreSameTotalSize(input, output), reasonIfUnsupported, |
| 753 | "Reference quantize: input and output shapes have different num total elements."); |
| 754 | |
| 755 | return supported; |
| 756 | } |
| 757 | |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 758 | bool RefLayerSupport::IsReshapeSupported(const TensorInfo& input, |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 759 | const ReshapeDescriptor& descriptor, |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 760 | Optional<std::string&> reasonIfUnsupported) const |
| 761 | { |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 762 | ignore_unused(descriptor); |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 763 | return IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 764 | input.GetDataType(), |
| 765 | &TrueFunc<>, |
| 766 | &TrueFunc<>); |
| 767 | } |
| 768 | |
| 769 | bool RefLayerSupport::IsResizeBilinearSupported(const TensorInfo& input, |
Sadik Armagan | c625f00 | 2018-12-17 11:32:16 +0000 | [diff] [blame] | 770 | const TensorInfo& output, |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 771 | Optional<std::string&> reasonIfUnsupported) const |
| 772 | { |
Sadik Armagan | c625f00 | 2018-12-17 11:32:16 +0000 | [diff] [blame] | 773 | ignore_unused(output); |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 774 | return IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 775 | input.GetDataType(), |
| 776 | &TrueFunc<>, |
| 777 | &TrueFunc<>); |
| 778 | } |
| 779 | |
Mohamed Nour Abouelseoud | a1d3c6a | 2018-12-27 12:39:16 +0000 | [diff] [blame] | 780 | bool RefLayerSupport::IsRsqrtSupported(const TensorInfo& input, |
| 781 | const TensorInfo& output, |
| 782 | Optional<std::string&> reasonIfUnsupported) const |
| 783 | { |
| 784 | ignore_unused(output); |
| 785 | return IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 786 | input.GetDataType(), |
| 787 | &TrueFunc<>, |
| 788 | &FalseFuncU8<>); |
| 789 | } |
| 790 | |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 791 | bool RefLayerSupport::IsSoftmaxSupported(const TensorInfo& input, |
| 792 | const TensorInfo& output, |
| 793 | const SoftmaxDescriptor& descriptor, |
| 794 | Optional<std::string&> reasonIfUnsupported) const |
| 795 | { |
| 796 | ignore_unused(output); |
| 797 | ignore_unused(descriptor); |
| 798 | return IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 799 | input.GetDataType(), |
| 800 | &TrueFunc<>, |
| 801 | &TrueFunc<>); |
| 802 | } |
| 803 | |
Nattapat Chaimanowong | 3ea76d5 | 2018-11-09 14:10:38 +0000 | [diff] [blame] | 804 | bool RefLayerSupport::IsSpaceToBatchNdSupported(const TensorInfo& input, |
| 805 | const TensorInfo& output, |
| 806 | const SpaceToBatchNdDescriptor& descriptor, |
| 807 | Optional<std::string&> reasonIfUnsupported) const |
| 808 | { |
| 809 | ignore_unused(output); |
| 810 | ignore_unused(descriptor); |
| 811 | return IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 812 | input.GetDataType(), |
| 813 | &TrueFunc<>, |
| 814 | &TrueFunc<>); |
| 815 | } |
| 816 | |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 817 | bool RefLayerSupport::IsSplitterSupported(const TensorInfo& input, |
| 818 | const ViewsDescriptor& descriptor, |
| 819 | Optional<std::string&> reasonIfUnsupported) const |
| 820 | { |
| 821 | ignore_unused(descriptor); |
| 822 | return IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 823 | input.GetDataType(), |
| 824 | &TrueFunc<>, |
| 825 | &TrueFunc<>); |
| 826 | } |
| 827 | |
Nattapat Chaimanowong | 1216b58 | 2018-11-23 15:33:41 +0000 | [diff] [blame] | 828 | bool RefLayerSupport::IsStridedSliceSupported(const TensorInfo& input, |
| 829 | const TensorInfo& output, |
| 830 | const StridedSliceDescriptor& descriptor, |
| 831 | Optional<std::string&> reasonIfUnsupported) const |
| 832 | { |
| 833 | ignore_unused(output); |
| 834 | ignore_unused(descriptor); |
| 835 | return IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 836 | input.GetDataType(), |
| 837 | &TrueFunc<>, |
| 838 | &TrueFunc<>); |
| 839 | } |
| 840 | |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 841 | bool RefLayerSupport::IsSubtractionSupported(const TensorInfo& input0, |
| 842 | const TensorInfo& input1, |
| 843 | const TensorInfo& output, |
| 844 | Optional<std::string&> reasonIfUnsupported) const |
| 845 | { |
| 846 | ignore_unused(input1); |
| 847 | ignore_unused(output); |
| 848 | return IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 849 | input0.GetDataType(), |
| 850 | &TrueFunc<>, |
| 851 | &TrueFunc<>); |
| 852 | } |
| 853 | |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 854 | } // namespace armnn |