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 | 651aafe | 2019-08-05 11:52:05 +0100 | [diff] [blame] | 9 | #include <DataLayoutIndexed.hpp> |
Aron Virginas-Tar | c9cc804 | 2018-11-01 16:15:57 +0000 | [diff] [blame] | 10 | #include <InternalTypes.hpp> |
| 11 | #include <LayerSupportCommon.hpp> |
Aron Virginas-Tar | 651aafe | 2019-08-05 11:52:05 +0100 | [diff] [blame] | 12 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 13 | #include <armnn/Types.hpp> |
Derek Lamberti | 50db4e8 | 2019-03-13 14:16:15 +0000 | [diff] [blame] | 14 | #include <armnn/Descriptors.hpp> |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 15 | |
David Beck | 111b5d9 | 2018-11-12 14:59:37 +0000 | [diff] [blame] | 16 | #include <backendsCommon/BackendRegistry.hpp> |
Derek Lamberti | f674aa0 | 2019-08-01 15:56:25 +0100 | [diff] [blame] | 17 | #include <backendsCommon/LayerSupportRules.hpp> |
Francis Murtagh | 46c09d0 | 2019-05-28 08:15:28 +0100 | [diff] [blame] | 18 | #include <backendsCommon/test/WorkloadTestUtils.hpp> |
David Beck | 3e9e115 | 2018-10-17 14:17:50 +0100 | [diff] [blame] | 19 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 20 | #include <boost/core/ignore_unused.hpp> |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 21 | |
Derek Lamberti | 50db4e8 | 2019-03-13 14:16:15 +0000 | [diff] [blame] | 22 | #include <vector> |
| 23 | #include <algorithm> |
| 24 | #include <array> |
| 25 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 26 | using namespace boost; |
| 27 | |
| 28 | namespace armnn |
| 29 | { |
| 30 | |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 31 | namespace |
| 32 | { |
| 33 | |
| 34 | template<typename Float32Func, typename Uint8Func, typename ... Params> |
| 35 | bool IsSupportedForDataTypeRef(Optional<std::string&> reasonIfUnsupported, |
| 36 | DataType dataType, |
| 37 | Float32Func floatFuncPtr, |
| 38 | Uint8Func uint8FuncPtr, |
| 39 | Params&&... params) |
| 40 | { |
| 41 | return IsSupportedForDataTypeGeneric(reasonIfUnsupported, |
| 42 | dataType, |
| 43 | &FalseFunc<Params...>, |
| 44 | floatFuncPtr, |
| 45 | uint8FuncPtr, |
narpra01 | db2b160 | 2019-01-23 15:23:11 +0000 | [diff] [blame] | 46 | &FalseFunc<Params...>, |
kevmay01 | 2b4d88e | 2019-01-24 14:05:09 +0000 | [diff] [blame] | 47 | &FalseFunc<Params...>, |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 48 | std::forward<Params>(params)...); |
| 49 | } |
| 50 | |
| 51 | } // anonymous namespace |
| 52 | |
James Conroy | 4d1ff58 | 2019-06-10 17:06:39 +0100 | [diff] [blame] | 53 | namespace |
| 54 | { |
| 55 | |
| 56 | std::string CreateIncorrectDimensionsErrorMsg(unsigned int expected, |
| 57 | unsigned int actual, |
| 58 | std::string& layerStr, |
| 59 | std::string& tensorName) |
| 60 | { |
| 61 | std::string errorMsg = "Reference " + layerStr + ": Expected " + std::to_string(expected) + " dimensions but got" + |
| 62 | " " + std::to_string(actual) + " dimensions instead, for the '" + tensorName + "' tensor."; |
| 63 | |
| 64 | return errorMsg; |
| 65 | } |
| 66 | |
| 67 | } // anonymous namespace |
Derek Lamberti | 50db4e8 | 2019-03-13 14:16:15 +0000 | [diff] [blame] | 68 | |
Sadik Armagan | 9199e58 | 2019-09-05 17:35:31 +0100 | [diff] [blame] | 69 | bool RefLayerSupport::IsAbsSupported(const TensorInfo& input, const TensorInfo& output, |
| 70 | Optional<std::string&> reasonIfUnsupported) const |
| 71 | { |
| 72 | bool supported = true; |
| 73 | std::array<DataType,3> supportedTypes = |
| 74 | { |
| 75 | DataType::Float32, |
| 76 | DataType::QuantisedAsymm8, |
| 77 | DataType::QuantisedSymm16 |
| 78 | }; |
| 79 | |
| 80 | supported &= CheckSupportRule(TypeAnyOf(input, supportedTypes), reasonIfUnsupported, |
| 81 | "Reference abs: input type not supported"); |
| 82 | |
| 83 | supported &= CheckSupportRule(TypeAnyOf(output, supportedTypes), reasonIfUnsupported, |
| 84 | "Reference abs: output type not supported"); |
| 85 | |
| 86 | supported &= CheckSupportRule(TypesAreEqual(input, output), reasonIfUnsupported, |
| 87 | "Reference abs: input and output types not matching"); |
| 88 | |
| 89 | supported &= CheckSupportRule(ShapesAreSameTotalSize(input, output), reasonIfUnsupported, |
| 90 | "Reference abs: input and output shapes have different number of total elements"); |
| 91 | |
| 92 | return supported; |
| 93 | } |
| 94 | |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 95 | bool RefLayerSupport::IsActivationSupported(const TensorInfo& input, |
| 96 | const TensorInfo& output, |
| 97 | const ActivationDescriptor& descriptor, |
| 98 | Optional<std::string&> reasonIfUnsupported) const |
| 99 | { |
Derek Lamberti | 50db4e8 | 2019-03-13 14:16:15 +0000 | [diff] [blame] | 100 | bool supported = true; |
| 101 | |
| 102 | // Define supported types. |
Matthew Jackson | 252df3a | 2019-09-11 09:19:18 +0100 | [diff] [blame^] | 103 | std::array<DataType,4> supportedTypes = { |
Derek Lamberti | 50db4e8 | 2019-03-13 14:16:15 +0000 | [diff] [blame] | 104 | DataType::Float32, |
Matthew Jackson | 252df3a | 2019-09-11 09:19:18 +0100 | [diff] [blame^] | 105 | DataType::Float16, |
Teresa Charlin | 18515e2 | 2019-04-24 10:17:46 +0100 | [diff] [blame] | 106 | DataType::QuantisedAsymm8, |
| 107 | DataType::QuantisedSymm16 |
Derek Lamberti | 50db4e8 | 2019-03-13 14:16:15 +0000 | [diff] [blame] | 108 | }; |
| 109 | |
| 110 | supported &= CheckSupportRule(TypeAnyOf(input, supportedTypes), reasonIfUnsupported, |
| 111 | "Reference activation: input type not supported."); |
| 112 | |
| 113 | supported &= CheckSupportRule(TypeAnyOf(output, supportedTypes), reasonIfUnsupported, |
| 114 | "Reference activation: output type not supported."); |
| 115 | |
| 116 | supported &= CheckSupportRule(TypesAreEqual(input, output), reasonIfUnsupported, |
| 117 | "Reference activation: input and output types mismatched."); |
| 118 | |
| 119 | supported &= CheckSupportRule(ShapesAreSameRank(input, output), reasonIfUnsupported, |
| 120 | "Reference activation: input and output shapes are of different rank."); |
| 121 | |
| 122 | |
| 123 | struct ActivationFunctionSupported : public Rule |
| 124 | { |
| 125 | ActivationFunctionSupported(const ActivationDescriptor& desc) |
| 126 | { |
| 127 | switch(desc.m_Function) |
| 128 | { |
| 129 | case ActivationFunction::Abs: |
| 130 | case ActivationFunction::BoundedReLu: |
| 131 | case ActivationFunction::LeakyReLu: |
| 132 | case ActivationFunction::Linear: |
| 133 | case ActivationFunction::ReLu: |
| 134 | case ActivationFunction::Sigmoid: |
| 135 | case ActivationFunction::SoftReLu: |
| 136 | case ActivationFunction::Sqrt: |
| 137 | case ActivationFunction::Square: |
| 138 | case ActivationFunction::TanH: |
| 139 | { |
| 140 | m_Res = true; |
| 141 | break; |
| 142 | } |
| 143 | default: |
| 144 | { |
| 145 | m_Res = false; |
| 146 | break; |
| 147 | } |
| 148 | } |
| 149 | } |
| 150 | }; |
| 151 | |
| 152 | // Function is supported |
| 153 | supported &= CheckSupportRule(ActivationFunctionSupported(descriptor), reasonIfUnsupported, |
| 154 | "Reference activation: function not supported."); |
| 155 | |
| 156 | return supported; |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 157 | } |
| 158 | |
| 159 | bool RefLayerSupport::IsAdditionSupported(const TensorInfo& input0, |
| 160 | const TensorInfo& input1, |
| 161 | const TensorInfo& output, |
| 162 | Optional<std::string&> reasonIfUnsupported) const |
| 163 | { |
Derek Lamberti | 50db4e8 | 2019-03-13 14:16:15 +0000 | [diff] [blame] | 164 | bool supported = true; |
| 165 | |
Matthew Jackson | 252df3a | 2019-09-11 09:19:18 +0100 | [diff] [blame^] | 166 | std::array<DataType,4> supportedTypes = { |
Derek Lamberti | 50db4e8 | 2019-03-13 14:16:15 +0000 | [diff] [blame] | 167 | DataType::Float32, |
Matthew Jackson | 252df3a | 2019-09-11 09:19:18 +0100 | [diff] [blame^] | 168 | DataType::Float16, |
Sadik Armagan | 2999a02 | 2019-04-09 14:20:12 +0100 | [diff] [blame] | 169 | DataType::QuantisedAsymm8, |
| 170 | DataType::QuantisedSymm16 |
Derek Lamberti | 50db4e8 | 2019-03-13 14:16:15 +0000 | [diff] [blame] | 171 | }; |
| 172 | |
| 173 | supported &= CheckSupportRule(TypeAnyOf(input0, supportedTypes), reasonIfUnsupported, |
| 174 | "Reference addition: input 0 is not a supported type."); |
| 175 | |
| 176 | supported &= CheckSupportRule(TypeAnyOf(input1, supportedTypes), reasonIfUnsupported, |
| 177 | "Reference addition: input 1 is not a supported type."); |
| 178 | |
| 179 | supported &= CheckSupportRule(TypeAnyOf(output, supportedTypes), reasonIfUnsupported, |
| 180 | "Reference addition: output is not a supported type."); |
| 181 | |
| 182 | supported &= CheckSupportRule(TypesAreEqual(input0, input1), reasonIfUnsupported, |
| 183 | "Reference addition: input 0 and Input 1 types are mismatched"); |
| 184 | |
| 185 | supported &= CheckSupportRule(TypesAreEqual(input0, output), reasonIfUnsupported, |
| 186 | "Reference addition: input and output types are mismatched"); |
| 187 | |
| 188 | supported &= CheckSupportRule(ShapesAreBroadcastCompatible(input0, input1, output), reasonIfUnsupported, |
| 189 | "Reference addition: shapes are not suitable for implicit broadcast."); |
| 190 | |
| 191 | return supported; |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 192 | } |
| 193 | |
| 194 | bool RefLayerSupport::IsBatchNormalizationSupported(const TensorInfo& input, |
| 195 | const TensorInfo& output, |
| 196 | const TensorInfo& mean, |
Matteo Martincigh | 3122bd5 | 2019-06-03 16:54:25 +0100 | [diff] [blame] | 197 | const TensorInfo& variance, |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 198 | const TensorInfo& beta, |
| 199 | const TensorInfo& gamma, |
| 200 | const BatchNormalizationDescriptor& descriptor, |
| 201 | Optional<std::string&> reasonIfUnsupported) const |
| 202 | { |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 203 | ignore_unused(descriptor); |
Matteo Martincigh | 3122bd5 | 2019-06-03 16:54:25 +0100 | [diff] [blame] | 204 | |
Matteo Martincigh | f550713 | 2019-06-04 10:59:47 +0100 | [diff] [blame] | 205 | std::array<DataType, 3> supportedTypes = |
Matteo Martincigh | 3122bd5 | 2019-06-03 16:54:25 +0100 | [diff] [blame] | 206 | { |
| 207 | DataType::Float32, |
Matteo Martincigh | f550713 | 2019-06-04 10:59:47 +0100 | [diff] [blame] | 208 | DataType::QuantisedAsymm8, |
| 209 | DataType::QuantisedSymm16 |
Matteo Martincigh | 3122bd5 | 2019-06-03 16:54:25 +0100 | [diff] [blame] | 210 | }; |
| 211 | |
| 212 | bool supported = true; |
| 213 | |
| 214 | supported &= CheckSupportRule(TypeAnyOf(input, supportedTypes), reasonIfUnsupported, |
| 215 | "Reference batch normalization: input is not a supported type."); |
| 216 | |
| 217 | supported &= CheckSupportRule(TypeAnyOf(output, supportedTypes), reasonIfUnsupported, |
| 218 | "Reference batch normalization: output is not a supported type."); |
| 219 | |
| 220 | supported &= CheckSupportRule(TypesAreEqual(input, output), reasonIfUnsupported, |
| 221 | "Reference batch normalization: input and output types are mismatched"); |
| 222 | |
| 223 | supported &= CheckSupportRule(TypeAnyOf(mean, supportedTypes), reasonIfUnsupported, |
| 224 | "Reference batch normalization: mean is not a supported type."); |
| 225 | |
| 226 | supported &= CheckSupportRule(TypeAnyOf(variance, supportedTypes), reasonIfUnsupported, |
| 227 | "Reference batch normalization: variance is not a supported type."); |
| 228 | |
| 229 | supported &= CheckSupportRule(TypeAnyOf(beta, supportedTypes), reasonIfUnsupported, |
| 230 | "Reference batch normalization: beta is not a supported type."); |
| 231 | |
| 232 | supported &= CheckSupportRule(TypeAnyOf(gamma, supportedTypes), reasonIfUnsupported, |
| 233 | "Reference batch normalization: gamma is not a supported type."); |
| 234 | |
| 235 | return supported; |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 236 | } |
| 237 | |
Éanna Ó Catháin | 4e1e136 | 2018-11-12 11:36:34 +0000 | [diff] [blame] | 238 | bool RefLayerSupport::IsBatchToSpaceNdSupported(const TensorInfo& input, |
| 239 | const TensorInfo& output, |
| 240 | const BatchToSpaceNdDescriptor& descriptor, |
| 241 | Optional<std::string&> reasonIfUnsupported) const |
| 242 | { |
| 243 | ignore_unused(descriptor); |
Francis Murtagh | d0dfe17 | 2019-06-25 10:57:10 +0100 | [diff] [blame] | 244 | |
| 245 | bool supported = true; |
| 246 | |
| 247 | std::string batchToSpaceNdLayerStr = "batchToSpaceNd"; |
| 248 | std::string inputTensorStr = "input"; |
| 249 | std::string outputTensorStr = "output"; |
| 250 | |
| 251 | // Define supported types. |
| 252 | std::array<DataType,3> supportedTypes = |
| 253 | { |
| 254 | DataType::Float32, |
| 255 | DataType::QuantisedAsymm8, |
| 256 | DataType::QuantisedSymm16 |
| 257 | }; |
| 258 | |
| 259 | supported &= CheckSupportRule(TypeAnyOf(input, supportedTypes), reasonIfUnsupported, |
| 260 | "Reference BatchToSpaceNd: input type not supported."); |
| 261 | |
| 262 | supported &= CheckSupportRule(TypeAnyOf(output, supportedTypes), reasonIfUnsupported, |
| 263 | "Reference BatchToSpaceNd: output type not supported."); |
| 264 | |
| 265 | supported &= CheckSupportRule(TypesAreEqual(input, output), reasonIfUnsupported, |
| 266 | "Reference BatchToSpaceNd: input and output types mismatched."); |
| 267 | |
| 268 | supported &= CheckSupportRule(TensorNumDimensionsAreCorrect(output, 4), |
| 269 | reasonIfUnsupported, |
| 270 | CreateIncorrectDimensionsErrorMsg(4, |
| 271 | output.GetNumDimensions(), |
| 272 | batchToSpaceNdLayerStr, |
| 273 | outputTensorStr).data()); |
| 274 | |
| 275 | supported &= CheckSupportRule(TensorNumDimensionsAreCorrect(input, 4), |
| 276 | reasonIfUnsupported, |
| 277 | CreateIncorrectDimensionsErrorMsg(4, |
| 278 | input.GetNumDimensions(), |
| 279 | batchToSpaceNdLayerStr, |
| 280 | inputTensorStr).data()); |
| 281 | |
| 282 | return supported; |
Éanna Ó Catháin | 4e1e136 | 2018-11-12 11:36:34 +0000 | [diff] [blame] | 283 | } |
| 284 | |
Jim Flynn | 906f946 | 2019-05-10 13:55:21 +0100 | [diff] [blame] | 285 | bool RefLayerSupport::IsConcatSupported(const std::vector<const TensorInfo*> inputs, |
| 286 | const TensorInfo& output, |
Jim Flynn | e242f2d | 2019-05-22 14:24:13 +0100 | [diff] [blame] | 287 | const ConcatDescriptor& descriptor, |
Jim Flynn | 906f946 | 2019-05-10 13:55:21 +0100 | [diff] [blame] | 288 | Optional<std::string&> reasonIfUnsupported) const |
| 289 | { |
Jim Flynn | e242f2d | 2019-05-22 14:24:13 +0100 | [diff] [blame] | 290 | ignore_unused(descriptor); |
| 291 | |
| 292 | bool supported = true; |
| 293 | std::array<DataType,3> supportedTypes = |
| 294 | { |
| 295 | DataType::Float32, |
| 296 | DataType::QuantisedAsymm8, |
| 297 | DataType::QuantisedSymm16 |
| 298 | }; |
| 299 | |
| 300 | supported &= CheckSupportRule(TypeAnyOf(output, supportedTypes), reasonIfUnsupported, |
| 301 | "Reference concatenation: output type not supported"); |
| 302 | for (const TensorInfo* input : inputs) |
| 303 | { |
Matthew Jackson | 81e601c | 2019-07-11 12:07:09 +0100 | [diff] [blame] | 304 | BOOST_ASSERT(input != nullptr); |
Jim Flynn | e242f2d | 2019-05-22 14:24:13 +0100 | [diff] [blame] | 305 | supported &= CheckSupportRule(TypeAnyOf(*input, supportedTypes), reasonIfUnsupported, |
| 306 | "Reference concatenation: input type not supported"); |
| 307 | |
| 308 | supported &= CheckSupportRule(TypesAreEqual(*input, output), reasonIfUnsupported, |
| 309 | "Reference concatenation: input and output types mismatched."); |
| 310 | } |
| 311 | |
| 312 | return supported; |
Jim Flynn | 906f946 | 2019-05-10 13:55:21 +0100 | [diff] [blame] | 313 | } |
| 314 | |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 315 | bool RefLayerSupport::IsConstantSupported(const TensorInfo& output, |
| 316 | Optional<std::string&> reasonIfUnsupported) const |
| 317 | { |
Jim Flynn | e242f2d | 2019-05-22 14:24:13 +0100 | [diff] [blame] | 318 | std::array<DataType,4> supportedTypes = |
| 319 | { |
Nina Drozd | 58ef2c6 | 2019-05-16 12:09:18 +0100 | [diff] [blame] | 320 | DataType::Float32, |
| 321 | DataType::Signed32, |
| 322 | DataType::QuantisedAsymm8, |
| 323 | DataType::QuantisedSymm16 |
| 324 | }; |
| 325 | |
| 326 | return CheckSupportRule(TypeAnyOf(output, supportedTypes), reasonIfUnsupported, |
| 327 | "Reference constant: output is not a supported type."); |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 328 | } |
| 329 | |
| 330 | bool RefLayerSupport::IsConvertFp16ToFp32Supported(const TensorInfo& input, |
| 331 | const TensorInfo& output, |
| 332 | Optional<std::string&> reasonIfUnsupported) const |
| 333 | { |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 334 | return (IsSupportedForDataTypeGeneric(reasonIfUnsupported, |
| 335 | input.GetDataType(), |
| 336 | &TrueFunc<>, |
| 337 | &FalseInputFuncF32<>, |
narpra01 | db2b160 | 2019-01-23 15:23:11 +0000 | [diff] [blame] | 338 | &FalseFuncU8<>, |
kevmay01 | 2b4d88e | 2019-01-24 14:05:09 +0000 | [diff] [blame] | 339 | &FalseFuncI32<>, |
| 340 | &FalseFuncU8<>) && |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 341 | IsSupportedForDataTypeGeneric(reasonIfUnsupported, |
| 342 | output.GetDataType(), |
| 343 | &FalseOutputFuncF16<>, |
| 344 | &TrueFunc<>, |
narpra01 | db2b160 | 2019-01-23 15:23:11 +0000 | [diff] [blame] | 345 | &FalseFuncU8<>, |
kevmay01 | 2b4d88e | 2019-01-24 14:05:09 +0000 | [diff] [blame] | 346 | &FalseFuncI32<>, |
| 347 | &FalseFuncU8<>)); |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 348 | } |
| 349 | |
| 350 | bool RefLayerSupport::IsConvertFp32ToFp16Supported(const TensorInfo& input, |
| 351 | const TensorInfo& output, |
| 352 | Optional<std::string&> reasonIfUnsupported) const |
| 353 | { |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 354 | return (IsSupportedForDataTypeGeneric(reasonIfUnsupported, |
| 355 | input.GetDataType(), |
| 356 | &FalseInputFuncF16<>, |
| 357 | &TrueFunc<>, |
narpra01 | db2b160 | 2019-01-23 15:23:11 +0000 | [diff] [blame] | 358 | &FalseFuncU8<>, |
kevmay01 | 2b4d88e | 2019-01-24 14:05:09 +0000 | [diff] [blame] | 359 | &FalseFuncI32<>, |
| 360 | &FalseFuncU8<>) && |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 361 | IsSupportedForDataTypeGeneric(reasonIfUnsupported, |
| 362 | output.GetDataType(), |
| 363 | &TrueFunc<>, |
| 364 | &FalseOutputFuncF32<>, |
narpra01 | db2b160 | 2019-01-23 15:23:11 +0000 | [diff] [blame] | 365 | &FalseFuncU8<>, |
kevmay01 | 2b4d88e | 2019-01-24 14:05:09 +0000 | [diff] [blame] | 366 | &FalseFuncI32<>, |
| 367 | &FalseFuncU8<>)); |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 368 | } |
| 369 | |
| 370 | bool RefLayerSupport::IsConvolution2dSupported(const TensorInfo& input, |
| 371 | const TensorInfo& output, |
| 372 | const Convolution2dDescriptor& descriptor, |
| 373 | const TensorInfo& weights, |
| 374 | const Optional<TensorInfo>& biases, |
| 375 | Optional<std::string&> reasonIfUnsupported) const |
| 376 | { |
Mike Kelly | 2f80f6e | 2019-05-16 12:41:34 +0100 | [diff] [blame] | 377 | bool supported = true; |
| 378 | |
| 379 | // Define supported types. |
Matthew Jackson | 252df3a | 2019-09-11 09:19:18 +0100 | [diff] [blame^] | 380 | std::array<DataType,4> supportedTypes = { |
Mike Kelly | 2f80f6e | 2019-05-16 12:41:34 +0100 | [diff] [blame] | 381 | DataType::Float32, |
Matthew Jackson | 252df3a | 2019-09-11 09:19:18 +0100 | [diff] [blame^] | 382 | DataType::Float16, |
Mike Kelly | 2f80f6e | 2019-05-16 12:41:34 +0100 | [diff] [blame] | 383 | DataType::QuantisedAsymm8, |
| 384 | DataType::QuantisedSymm16 |
| 385 | }; |
| 386 | |
| 387 | supported &= CheckSupportRule(TypeAnyOf(input, supportedTypes), reasonIfUnsupported, |
Les Bell | d7f2908 | 2019-05-30 09:08:51 +0100 | [diff] [blame] | 388 | "Reference convolution2d: input is not a supported type."); |
Mike Kelly | 2f80f6e | 2019-05-16 12:41:34 +0100 | [diff] [blame] | 389 | |
| 390 | supported &= CheckSupportRule(TypeAnyOf(output, supportedTypes), reasonIfUnsupported, |
Les Bell | d7f2908 | 2019-05-30 09:08:51 +0100 | [diff] [blame] | 391 | "Reference convolution2d: output is not a supported type."); |
Mike Kelly | 2f80f6e | 2019-05-16 12:41:34 +0100 | [diff] [blame] | 392 | |
| 393 | supported &= CheckSupportRule(TypeAnyOf(weights, supportedTypes), reasonIfUnsupported, |
Les Bell | d7f2908 | 2019-05-30 09:08:51 +0100 | [diff] [blame] | 394 | "Reference convolution2d: weights is not a supported type."); |
Mike Kelly | 2f80f6e | 2019-05-16 12:41:34 +0100 | [diff] [blame] | 395 | |
| 396 | supported &= CheckSupportRule(TypesAreEqual(input, output), reasonIfUnsupported, |
Les Bell | d7f2908 | 2019-05-30 09:08:51 +0100 | [diff] [blame] | 397 | "Reference convolution2d: input and output types mismatched."); |
Mike Kelly | 2f80f6e | 2019-05-16 12:41:34 +0100 | [diff] [blame] | 398 | |
| 399 | supported &= CheckSupportRule(TypesAreEqual(input, weights), reasonIfUnsupported, |
Les Bell | d7f2908 | 2019-05-30 09:08:51 +0100 | [diff] [blame] | 400 | "Reference convolution2d: input and weights types mismatched."); |
Mike Kelly | 2f80f6e | 2019-05-16 12:41:34 +0100 | [diff] [blame] | 401 | |
| 402 | if (biases.has_value()) |
| 403 | { |
Matthew Jackson | 252df3a | 2019-09-11 09:19:18 +0100 | [diff] [blame^] | 404 | std::array<DataType,3> biasesSupportedTypes = { |
Mike Kelly | 2f80f6e | 2019-05-16 12:41:34 +0100 | [diff] [blame] | 405 | DataType::Float32, |
Matthew Jackson | 252df3a | 2019-09-11 09:19:18 +0100 | [diff] [blame^] | 406 | DataType::Float16, |
Mike Kelly | 2f80f6e | 2019-05-16 12:41:34 +0100 | [diff] [blame] | 407 | DataType::Signed32 |
| 408 | }; |
| 409 | supported &= CheckSupportRule(TypeAnyOf(biases.value(), biasesSupportedTypes), reasonIfUnsupported, |
Les Bell | d7f2908 | 2019-05-30 09:08:51 +0100 | [diff] [blame] | 410 | "Reference convolution2d: biases is not a supported type."); |
Mike Kelly | 2f80f6e | 2019-05-16 12:41:34 +0100 | [diff] [blame] | 411 | } |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 412 | ignore_unused(descriptor); |
Mike Kelly | 2f80f6e | 2019-05-16 12:41:34 +0100 | [diff] [blame] | 413 | |
| 414 | return supported; |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 415 | } |
| 416 | |
Nattapat Chaimanowong | cfdcadf | 2018-12-06 11:54:33 +0000 | [diff] [blame] | 417 | bool RefLayerSupport::IsDebugSupported(const TensorInfo& input, |
| 418 | const TensorInfo& output, |
Nattapat Chaimanowong | cfdcadf | 2018-12-06 11:54:33 +0000 | [diff] [blame] | 419 | Optional<std::string&> reasonIfUnsupported) const |
| 420 | { |
Narumol Prangnawarat | 47cfee9 | 2019-07-04 10:29:00 +0100 | [diff] [blame] | 421 | bool supported = true; |
| 422 | |
| 423 | std::array<DataType,3> supportedTypes = |
| 424 | { |
| 425 | DataType::Float32, |
| 426 | DataType::QuantisedAsymm8, |
| 427 | DataType::QuantisedSymm16 |
| 428 | }; |
| 429 | |
| 430 | supported &= CheckSupportRule(TypeAnyOf(input, supportedTypes), reasonIfUnsupported, |
| 431 | "Reference debug: input type not supported"); |
| 432 | |
| 433 | supported &= CheckSupportRule(TypeAnyOf(output, supportedTypes), reasonIfUnsupported, |
| 434 | "Reference debug: output type not supported"); |
| 435 | |
| 436 | supported &= CheckSupportRule(TypesAreEqual(input, output), reasonIfUnsupported, |
| 437 | "Reference debug: input and output types are mismatched"); |
| 438 | |
| 439 | return supported; |
Nattapat Chaimanowong | cfdcadf | 2018-12-06 11:54:33 +0000 | [diff] [blame] | 440 | } |
| 441 | |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 442 | bool RefLayerSupport::IsDepthwiseConvolutionSupported(const TensorInfo& input, |
| 443 | const TensorInfo& output, |
| 444 | const DepthwiseConvolution2dDescriptor& descriptor, |
| 445 | const TensorInfo& weights, |
| 446 | const Optional<TensorInfo>& biases, |
| 447 | Optional<std::string&> reasonIfUnsupported) const |
| 448 | { |
Narumol Prangnawarat | f9ac3fd | 2019-07-03 14:55:57 +0100 | [diff] [blame] | 449 | bool supported = true; |
| 450 | |
| 451 | // Define supported types. |
Matthew Jackson | 252df3a | 2019-09-11 09:19:18 +0100 | [diff] [blame^] | 452 | std::array<DataType,4> supportedTypes = |
Narumol Prangnawarat | f9ac3fd | 2019-07-03 14:55:57 +0100 | [diff] [blame] | 453 | { |
| 454 | DataType::Float32, |
Matthew Jackson | 252df3a | 2019-09-11 09:19:18 +0100 | [diff] [blame^] | 455 | DataType::Float16, |
Narumol Prangnawarat | f9ac3fd | 2019-07-03 14:55:57 +0100 | [diff] [blame] | 456 | DataType::QuantisedAsymm8, |
| 457 | DataType::QuantisedSymm16 |
| 458 | }; |
| 459 | |
| 460 | supported &= CheckSupportRule(TypeAnyOf(input, supportedTypes), reasonIfUnsupported, |
| 461 | "Reference DepthwiseConvolution2d: input is not a supported type."); |
| 462 | |
| 463 | supported &= CheckSupportRule(TypeAnyOf(output, supportedTypes), reasonIfUnsupported, |
| 464 | "Reference DepthwiseConvolution2d: output is not a supported type."); |
| 465 | |
| 466 | supported &= CheckSupportRule(TypeAnyOf(weights, supportedTypes), reasonIfUnsupported, |
| 467 | "Reference DepthwiseConvolution2d: weights is not a supported type."); |
| 468 | |
| 469 | supported &= CheckSupportRule(TypesAreEqual(input, output), reasonIfUnsupported, |
| 470 | "Reference DepthwiseConvolution2d: input and output types mismatched."); |
| 471 | |
| 472 | supported &= CheckSupportRule(TypesAreEqual(input, weights), reasonIfUnsupported, |
| 473 | "Reference DepthwiseConvolution2d: input and weights types mismatched."); |
| 474 | |
| 475 | if (biases.has_value()) |
| 476 | { |
Matthew Jackson | 252df3a | 2019-09-11 09:19:18 +0100 | [diff] [blame^] | 477 | std::array<DataType,3> biasesSupportedTypes = |
Narumol Prangnawarat | f9ac3fd | 2019-07-03 14:55:57 +0100 | [diff] [blame] | 478 | { |
| 479 | DataType::Float32, |
Matthew Jackson | 252df3a | 2019-09-11 09:19:18 +0100 | [diff] [blame^] | 480 | DataType::Float16, |
Narumol Prangnawarat | f9ac3fd | 2019-07-03 14:55:57 +0100 | [diff] [blame] | 481 | DataType::Signed32 |
| 482 | }; |
| 483 | supported &= CheckSupportRule(TypeAnyOf(biases.value(), biasesSupportedTypes), reasonIfUnsupported, |
| 484 | "Reference DepthwiseConvolution2d: biases is not a supported type."); |
| 485 | } |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 486 | ignore_unused(descriptor); |
Narumol Prangnawarat | f9ac3fd | 2019-07-03 14:55:57 +0100 | [diff] [blame] | 487 | |
| 488 | return supported; |
| 489 | |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 490 | } |
| 491 | |
Nattapat Chaimanowong | 8a54ac0 | 2019-03-29 15:25:04 +0000 | [diff] [blame] | 492 | bool RefLayerSupport::IsDequantizeSupported(const TensorInfo& input, |
| 493 | const TensorInfo& output, |
| 494 | Optional<std::string&> reasonIfUnsupported) const |
| 495 | { |
Nattapat Chaimanowong | afa4e3a | 2019-04-02 11:41:45 +0100 | [diff] [blame] | 496 | bool supported = true; |
| 497 | |
| 498 | std::array<DataType,2> supportedInputTypes = { |
| 499 | DataType::QuantisedAsymm8, |
| 500 | DataType::QuantisedSymm16 |
| 501 | }; |
| 502 | |
| 503 | supported &= CheckSupportRule(TypeAnyOf(input, supportedInputTypes), reasonIfUnsupported, |
| 504 | "Reference dequantize: input type not supported."); |
| 505 | |
Mike Kelly | 4992c34 | 2019-08-14 11:33:11 +0100 | [diff] [blame] | 506 | std::array<DataType,1> supportedOutputTypes = { |
| 507 | DataType::Float32 |
Nattapat Chaimanowong | afa4e3a | 2019-04-02 11:41:45 +0100 | [diff] [blame] | 508 | }; |
| 509 | |
| 510 | supported &= CheckSupportRule(TypeAnyOf(output, supportedOutputTypes), reasonIfUnsupported, |
| 511 | "Reference dequantize: output type not supported."); |
| 512 | |
| 513 | supported &= CheckSupportRule(ShapesAreSameTotalSize(input, output), reasonIfUnsupported, |
| 514 | "Reference dequantize: input and output shapes have different num total elements."); |
| 515 | |
| 516 | return supported; |
Nattapat Chaimanowong | 8a54ac0 | 2019-03-29 15:25:04 +0000 | [diff] [blame] | 517 | } |
| 518 | |
Narumol Prangnawarat | bc67cef | 2019-01-31 15:31:54 +0000 | [diff] [blame] | 519 | bool RefLayerSupport::IsDetectionPostProcessSupported(const armnn::TensorInfo& input0, |
| 520 | const armnn::TensorInfo& input1, |
| 521 | const armnn::DetectionPostProcessDescriptor& descriptor, |
| 522 | armnn::Optional<std::string&> reasonIfUnsupported) const |
| 523 | { |
Aron Virginas-Tar | a37e1bd | 2019-06-06 16:08:30 +0100 | [diff] [blame] | 524 | bool supported = true; |
| 525 | |
Mike Kelly | 4992c34 | 2019-08-14 11:33:11 +0100 | [diff] [blame] | 526 | std::array<DataType,3> supportedInputTypes = |
Aron Virginas-Tar | a37e1bd | 2019-06-06 16:08:30 +0100 | [diff] [blame] | 527 | { |
| 528 | DataType::Float32, |
| 529 | DataType::QuantisedAsymm8, |
| 530 | DataType::QuantisedSymm16 |
| 531 | }; |
| 532 | |
| 533 | supported &= CheckSupportRule(TypeAnyOf(input0, supportedInputTypes), reasonIfUnsupported, |
| 534 | "Reference DetectionPostProcess: input 0 is not a supported type."); |
| 535 | |
| 536 | supported &= CheckSupportRule(TypeAnyOf(input1, supportedInputTypes), reasonIfUnsupported, |
| 537 | "Reference DetectionPostProcess: input 1 is not a supported type."); |
| 538 | |
| 539 | return supported; |
Narumol Prangnawarat | bc67cef | 2019-01-31 15:31:54 +0000 | [diff] [blame] | 540 | } |
| 541 | |
Pablo Tello | f0bd683 | 2019-04-26 17:58:13 +0100 | [diff] [blame] | 542 | bool RefLayerSupport::IsDilatedDepthwiseConvolutionSupported(const TensorInfo& input, |
| 543 | const TensorInfo& output, |
| 544 | const DepthwiseConvolution2dDescriptor& descriptor, |
| 545 | const TensorInfo& weights, |
| 546 | const Optional<TensorInfo>& biases, |
| 547 | Optional<std::string&> reasonIfUnsupported) const |
| 548 | { |
Aron Virginas-Tar | aece4ed | 2019-06-14 17:00:09 +0100 | [diff] [blame] | 549 | return IsDepthwiseConvolutionSupported(input, output, descriptor, weights, biases, reasonIfUnsupported); |
Pablo Tello | f0bd683 | 2019-04-26 17:58:13 +0100 | [diff] [blame] | 550 | } |
| 551 | |
Aron Virginas-Tar | aece4ed | 2019-06-14 17:00:09 +0100 | [diff] [blame] | 552 | bool RefLayerSupport::IsDivisionSupported(const TensorInfo& input0, |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 553 | const TensorInfo& input1, |
| 554 | const TensorInfo& output, |
| 555 | Optional<std::string&> reasonIfUnsupported) const |
| 556 | { |
Sadik Armagan | 2999a02 | 2019-04-09 14:20:12 +0100 | [diff] [blame] | 557 | bool supported = true; |
| 558 | |
| 559 | std::array<DataType,3> supportedTypes = { |
| 560 | DataType::Float32, |
| 561 | DataType::QuantisedAsymm8, |
| 562 | DataType::QuantisedSymm16 |
| 563 | }; |
| 564 | |
| 565 | supported &= CheckSupportRule(TypeAnyOf(input0, supportedTypes), reasonIfUnsupported, |
| 566 | "Reference division: input 0 is not a supported type."); |
| 567 | |
| 568 | supported &= CheckSupportRule(TypeAnyOf(input1, supportedTypes), reasonIfUnsupported, |
| 569 | "Reference division: input 1 is not a supported type."); |
| 570 | |
| 571 | supported &= CheckSupportRule(TypeAnyOf(output, supportedTypes), reasonIfUnsupported, |
| 572 | "Reference division: output is not a supported type."); |
| 573 | |
| 574 | supported &= CheckSupportRule(TypesAreEqual(input0, input1), reasonIfUnsupported, |
| 575 | "Reference division: input 0 and Input 1 types are mismatched"); |
| 576 | |
| 577 | supported &= CheckSupportRule(TypesAreEqual(input0, output), reasonIfUnsupported, |
| 578 | "Reference division: input and output types are mismatched"); |
| 579 | |
| 580 | supported &= CheckSupportRule(ShapesAreBroadcastCompatible(input0, input1, output), reasonIfUnsupported, |
| 581 | "Reference division: shapes are not suitable for implicit broadcast."); |
| 582 | |
| 583 | return supported; |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 584 | } |
| 585 | |
FrancisMurtagh | 30cdfca | 2018-12-18 12:57:35 +0000 | [diff] [blame] | 586 | bool RefLayerSupport::IsEqualSupported(const TensorInfo& input0, |
| 587 | const TensorInfo& input1, |
| 588 | const TensorInfo& output, |
| 589 | Optional<std::string&> reasonIfUnsupported) const |
| 590 | { |
Narumol Prangnawarat | f9ac3fd | 2019-07-03 14:55:57 +0100 | [diff] [blame] | 591 | bool supported = true; |
| 592 | |
| 593 | std::array<DataType,3> supportedTypes = |
| 594 | { |
| 595 | DataType::Float32, |
| 596 | DataType::QuantisedAsymm8, |
| 597 | DataType::QuantisedSymm16 |
| 598 | }; |
| 599 | |
| 600 | supported &= CheckSupportRule(TypeAnyOf(input0, supportedTypes), reasonIfUnsupported, |
| 601 | "Reference equal: input 0 is not a supported type."); |
| 602 | |
| 603 | supported &= CheckSupportRule(TypeAnyOf(input1, supportedTypes), reasonIfUnsupported, |
| 604 | "Reference equal: input 1 is not a supported type."); |
| 605 | |
| 606 | supported &= CheckSupportRule(TypesAreEqual(input0, input1), reasonIfUnsupported, |
| 607 | "Reference equal: input 0 and Input 1 types are mismatched"); |
| 608 | |
| 609 | supported &= CheckSupportRule(ShapesAreBroadcastCompatible(input0, input1, output), reasonIfUnsupported, |
| 610 | "Reference equal: shapes are not suitable for implicit broadcast."); |
| 611 | |
| 612 | return supported; |
FrancisMurtagh | 30cdfca | 2018-12-18 12:57:35 +0000 | [diff] [blame] | 613 | } |
| 614 | |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 615 | bool RefLayerSupport::IsFakeQuantizationSupported(const TensorInfo& input, |
| 616 | const FakeQuantizationDescriptor& descriptor, |
| 617 | Optional<std::string&> reasonIfUnsupported) const |
| 618 | { |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 619 | ignore_unused(descriptor); |
Narumol Prangnawarat | f9ac3fd | 2019-07-03 14:55:57 +0100 | [diff] [blame] | 620 | bool supported = true; |
| 621 | |
| 622 | std::array<DataType,1> supportedTypes = |
| 623 | { |
| 624 | DataType::Float32 |
| 625 | }; |
| 626 | |
| 627 | supported &= CheckSupportRule(TypeAnyOf(input, supportedTypes), reasonIfUnsupported, |
| 628 | "Reference fake quantization: input type not supported."); |
| 629 | |
| 630 | return supported; |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 631 | } |
| 632 | |
| 633 | bool RefLayerSupport::IsFloorSupported(const TensorInfo& input, |
| 634 | const TensorInfo& output, |
| 635 | Optional<std::string&> reasonIfUnsupported) const |
| 636 | { |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 637 | ignore_unused(output); |
James Conroy | 83735b1 | 2019-05-30 16:36:59 +0100 | [diff] [blame] | 638 | bool supported = true; |
| 639 | |
James Conroy | b40d710 | 2019-06-04 12:32:09 +0100 | [diff] [blame] | 640 | std::array<DataType,2> supportedTypes = |
James Conroy | 83735b1 | 2019-05-30 16:36:59 +0100 | [diff] [blame] | 641 | { |
James Conroy | b40d710 | 2019-06-04 12:32:09 +0100 | [diff] [blame] | 642 | DataType::Float32, |
| 643 | DataType::QuantisedSymm16 |
James Conroy | 83735b1 | 2019-05-30 16:36:59 +0100 | [diff] [blame] | 644 | }; |
| 645 | |
| 646 | supported &= CheckSupportRule(TypeAnyOf(input, supportedTypes), reasonIfUnsupported, |
| 647 | "Reference Floor: input type not supported."); |
| 648 | |
| 649 | supported &= CheckSupportRule(TypeAnyOf(output, supportedTypes), reasonIfUnsupported, |
| 650 | "Reference Floor: output type not supported."); |
| 651 | |
| 652 | return supported; |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 653 | } |
| 654 | |
| 655 | bool RefLayerSupport::IsFullyConnectedSupported(const TensorInfo& input, |
| 656 | const TensorInfo& output, |
| 657 | const TensorInfo& weights, |
| 658 | const TensorInfo& biases, |
| 659 | const FullyConnectedDescriptor& descriptor, |
| 660 | Optional<std::string&> reasonIfUnsupported) const |
| 661 | { |
Francis Murtagh | 46c09d0 | 2019-05-28 08:15:28 +0100 | [diff] [blame] | 662 | bool supported = true; |
| 663 | |
| 664 | // Define supported types. |
Matthew Jackson | 252df3a | 2019-09-11 09:19:18 +0100 | [diff] [blame^] | 665 | std::array<DataType,4> supportedTypes = |
Francis Murtagh | 46c09d0 | 2019-05-28 08:15:28 +0100 | [diff] [blame] | 666 | { |
| 667 | DataType::Float32, |
Matthew Jackson | 252df3a | 2019-09-11 09:19:18 +0100 | [diff] [blame^] | 668 | DataType::Float16, |
Francis Murtagh | 46c09d0 | 2019-05-28 08:15:28 +0100 | [diff] [blame] | 669 | DataType::QuantisedAsymm8, |
| 670 | DataType::QuantisedSymm16 |
| 671 | }; |
| 672 | |
| 673 | supported &= CheckSupportRule(TypeAnyOf(input, supportedTypes), reasonIfUnsupported, |
| 674 | "Reference Fully Connected: input type not supported."); |
| 675 | |
| 676 | supported &= CheckSupportRule(TypeAnyOf(output, supportedTypes), reasonIfUnsupported, |
| 677 | "Reference Fully Connected: output type not supported."); |
| 678 | |
| 679 | supported &= CheckSupportRule(TypesAreEqual(input, output), reasonIfUnsupported, |
| 680 | "Reference Fully Connected: input and output types mismatched."); |
| 681 | |
| 682 | supported &= CheckSupportRule(TypeAnyOf(weights, supportedTypes), reasonIfUnsupported, |
| 683 | "Reference Fully Connected: weights type not supported."); |
| 684 | |
| 685 | supported &= CheckSupportRule(TypesAreEqual(input, weights), reasonIfUnsupported, |
| 686 | "Reference Fully Connected: input and weight types mismatched."); |
| 687 | |
| 688 | if (descriptor.m_BiasEnabled) |
| 689 | { |
| 690 | // Defined supported types for bias |
Matthew Jackson | 252df3a | 2019-09-11 09:19:18 +0100 | [diff] [blame^] | 691 | std::array<DataType, 3> |
Francis Murtagh | 46c09d0 | 2019-05-28 08:15:28 +0100 | [diff] [blame] | 692 | supportedBiasTypes = |
| 693 | { |
| 694 | DataType::Float32, |
Matthew Jackson | 252df3a | 2019-09-11 09:19:18 +0100 | [diff] [blame^] | 695 | DataType::Float16, |
Francis Murtagh | 46c09d0 | 2019-05-28 08:15:28 +0100 | [diff] [blame] | 696 | DataType::Signed32 |
| 697 | }; |
| 698 | |
| 699 | supported &= CheckSupportRule(TypeAnyOf(biases, supportedBiasTypes), reasonIfUnsupported, |
| 700 | "Reference Fully Connected: bias type not supported."); |
| 701 | |
| 702 | supported &= CheckSupportRule(BiasAndWeightsTypesMatch(biases, weights), reasonIfUnsupported, |
| 703 | "Reference Fully Connected: bias and weight types mismatch."); |
| 704 | |
| 705 | supported &= CheckSupportRule(BiasAndWeightsTypesCompatible(weights, supportedBiasTypes), reasonIfUnsupported, |
| 706 | "Reference Fully Connected: bias type inferred from weights is incompatible."); |
| 707 | |
| 708 | } |
| 709 | |
| 710 | return supported; |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 711 | } |
| 712 | |
narpra01 | 4951d84 | 2019-01-18 16:53:53 +0000 | [diff] [blame] | 713 | bool RefLayerSupport::IsGatherSupported(const armnn::TensorInfo& input0, |
| 714 | const armnn::TensorInfo& input1, |
| 715 | const armnn::TensorInfo& output, |
| 716 | armnn::Optional<std::string&> reasonIfUnsupported) const |
| 717 | { |
Ellen Norris-Thompson | e0dbedf | 2019-06-24 09:23:38 +0100 | [diff] [blame] | 718 | bool supported = true; |
| 719 | std::array<DataType,3> supportedTypes = |
| 720 | { |
Narumol Prangnawarat | f9ac3fd | 2019-07-03 14:55:57 +0100 | [diff] [blame] | 721 | DataType::Float32, |
| 722 | DataType::QuantisedAsymm8, |
| 723 | DataType::QuantisedSymm16 |
Ellen Norris-Thompson | e0dbedf | 2019-06-24 09:23:38 +0100 | [diff] [blame] | 724 | }; |
| 725 | |
| 726 | supported &= CheckSupportRule(TypeAnyOf(input0, supportedTypes), reasonIfUnsupported, |
| 727 | "Reference Gather: input type not supported"); |
| 728 | |
| 729 | supported &= CheckSupportRule(TypeAnyOf(output, supportedTypes), reasonIfUnsupported, |
| 730 | "Reference Gather: output type not supported"); |
| 731 | |
| 732 | supported &= CheckSupportRule(TypeIs(input1, DataType::Signed32), reasonIfUnsupported, |
| 733 | "Reference Gather: indices (input1) type not supported"); |
| 734 | |
| 735 | supported &= CheckSupportRule(TypesAreEqual(input0, output), reasonIfUnsupported, |
| 736 | "Reference Gather: input and output types not matching"); |
| 737 | |
| 738 | return supported; |
narpra01 | 4951d84 | 2019-01-18 16:53:53 +0000 | [diff] [blame] | 739 | } |
| 740 | |
FrancisMurtagh | 878f023 | 2018-12-19 10:56:15 +0000 | [diff] [blame] | 741 | bool RefLayerSupport::IsGreaterSupported(const TensorInfo& input0, |
| 742 | const TensorInfo& input1, |
| 743 | const TensorInfo& output, |
| 744 | Optional<std::string&> reasonIfUnsupported) const |
| 745 | { |
Narumol Prangnawarat | f9ac3fd | 2019-07-03 14:55:57 +0100 | [diff] [blame] | 746 | bool supported = true; |
| 747 | |
| 748 | std::array<DataType,3> supportedTypes = |
| 749 | { |
| 750 | DataType::Float32, |
| 751 | DataType::QuantisedAsymm8, |
| 752 | DataType::QuantisedSymm16 |
| 753 | }; |
| 754 | |
| 755 | supported &= CheckSupportRule(TypeAnyOf(input0, supportedTypes), reasonIfUnsupported, |
| 756 | "Reference greater: input 0 is not a supported type."); |
| 757 | |
| 758 | supported &= CheckSupportRule(TypeAnyOf(input1, supportedTypes), reasonIfUnsupported, |
| 759 | "Reference greater: input 1 is not a supported type."); |
| 760 | |
| 761 | supported &= CheckSupportRule(TypesAreEqual(input0, input1), reasonIfUnsupported, |
| 762 | "Reference greater: input 0 and Input 1 types are mismatched"); |
| 763 | |
| 764 | supported &= CheckSupportRule(ShapesAreBroadcastCompatible(input0, input1, output), reasonIfUnsupported, |
| 765 | "Reference greater: shapes are not suitable for implicit broadcast."); |
| 766 | |
| 767 | return supported; |
FrancisMurtagh | 878f023 | 2018-12-19 10:56:15 +0000 | [diff] [blame] | 768 | } |
| 769 | |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 770 | bool RefLayerSupport::IsInputSupported(const TensorInfo& input, |
| 771 | Optional<std::string&> reasonIfUnsupported) const |
| 772 | { |
Narumol Prangnawarat | b6441e4 | 2019-06-04 11:22:00 +0100 | [diff] [blame] | 773 | return true; |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 774 | } |
| 775 | |
| 776 | bool RefLayerSupport::IsL2NormalizationSupported(const TensorInfo& input, |
| 777 | const TensorInfo& output, |
| 778 | const L2NormalizationDescriptor& descriptor, |
| 779 | Optional<std::string&> reasonIfUnsupported) const |
| 780 | { |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 781 | ignore_unused(descriptor); |
Ferran Balaguer | d73d14f | 2019-06-10 10:29:54 +0100 | [diff] [blame] | 782 | // Define supported types |
Matthew Jackson | 252df3a | 2019-09-11 09:19:18 +0100 | [diff] [blame^] | 783 | std::array<DataType, 4> supportedTypes = |
Ferran Balaguer | d73d14f | 2019-06-10 10:29:54 +0100 | [diff] [blame] | 784 | { |
| 785 | DataType::Float32, |
Matthew Jackson | 252df3a | 2019-09-11 09:19:18 +0100 | [diff] [blame^] | 786 | DataType::Float16, |
Ferran Balaguer | c6138d8 | 2019-06-13 17:23:50 +0100 | [diff] [blame] | 787 | DataType::QuantisedAsymm8, |
Ferran Balaguer | d73d14f | 2019-06-10 10:29:54 +0100 | [diff] [blame] | 788 | DataType::QuantisedSymm16 |
| 789 | }; |
| 790 | |
| 791 | bool supported = true; |
| 792 | |
| 793 | supported &= CheckSupportRule(TypeAnyOf(input, supportedTypes), reasonIfUnsupported, |
| 794 | "Reference L2normalization: input type not supported."); |
| 795 | |
| 796 | supported &= CheckSupportRule(TypeAnyOf(output, supportedTypes), reasonIfUnsupported, |
| 797 | "Reference L2normalization: output type not supported."); |
| 798 | |
| 799 | supported &= CheckSupportRule(TypesAreEqual(input, output), reasonIfUnsupported, |
| 800 | "Reference L2normalization: input and output types mismatched."); |
| 801 | |
| 802 | supported &= CheckSupportRule(ShapesAreSameTotalSize(input, output), reasonIfUnsupported, |
| 803 | "Reference L2normalization: input and output shapes have different " |
| 804 | "num total elements."); |
| 805 | |
| 806 | return supported; |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 807 | } |
| 808 | |
| 809 | bool RefLayerSupport::IsLstmSupported(const TensorInfo& input, |
| 810 | const TensorInfo& outputStateIn, |
| 811 | const TensorInfo& cellStateIn, |
| 812 | const TensorInfo& scratchBuffer, |
| 813 | const TensorInfo& outputStateOut, |
| 814 | const TensorInfo& cellStateOut, |
| 815 | const TensorInfo& output, |
| 816 | const LstmDescriptor& descriptor, |
Jan Eilers | d01a83c | 2019-07-03 18:20:40 +0100 | [diff] [blame] | 817 | const LstmInputParamsInfo& paramsInfo, |
| 818 | Optional<std::string&> reasonIfUnsupported) const |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 819 | { |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 820 | ignore_unused(descriptor); |
Jan Eilers | d01a83c | 2019-07-03 18:20:40 +0100 | [diff] [blame] | 821 | ignore_unused(paramsInfo); |
Nattapat Chaimanowong | eb2b329 | 2019-05-07 12:02:30 +0100 | [diff] [blame] | 822 | |
| 823 | bool supported = true; |
| 824 | |
| 825 | std::array<DataType,2> supportedTypes = { |
Conor Kennedy | b9971c9 | 2019-05-07 07:14:23 +0100 | [diff] [blame] | 826 | DataType::Float32, |
| 827 | DataType::QuantisedSymm16 |
Nattapat Chaimanowong | eb2b329 | 2019-05-07 12:02:30 +0100 | [diff] [blame] | 828 | }; |
| 829 | |
Jan Eilers | d01a83c | 2019-07-03 18:20:40 +0100 | [diff] [blame] | 830 | // check inputs and outputs |
Nattapat Chaimanowong | eb2b329 | 2019-05-07 12:02:30 +0100 | [diff] [blame] | 831 | supported &= CheckSupportRule(TypeAnyOf(input, supportedTypes), reasonIfUnsupported, |
| 832 | "Reference Lstm: input is not a supported type."); |
Nattapat Chaimanowong | eb2b329 | 2019-05-07 12:02:30 +0100 | [diff] [blame] | 833 | supported &= CheckSupportRule(TypesAreEqual(input, outputStateIn), reasonIfUnsupported, |
| 834 | "Reference Lstm: input and outputStateIn types are mismatched"); |
Nattapat Chaimanowong | eb2b329 | 2019-05-07 12:02:30 +0100 | [diff] [blame] | 835 | supported &= CheckSupportRule(TypesAreEqual(input, cellStateIn), reasonIfUnsupported, |
| 836 | "Reference Lstm: input and cellStateIn types are mismatched"); |
Nattapat Chaimanowong | eb2b329 | 2019-05-07 12:02:30 +0100 | [diff] [blame] | 837 | supported &= CheckSupportRule(TypesAreEqual(input, scratchBuffer), reasonIfUnsupported, |
| 838 | "Reference Lstm: input and scratchBuffer types are mismatched"); |
Nattapat Chaimanowong | eb2b329 | 2019-05-07 12:02:30 +0100 | [diff] [blame] | 839 | supported &= CheckSupportRule(TypesAreEqual(input, outputStateOut), reasonIfUnsupported, |
| 840 | "Reference Lstm: input and outputStateOut types are mismatched"); |
Nattapat Chaimanowong | eb2b329 | 2019-05-07 12:02:30 +0100 | [diff] [blame] | 841 | supported &= CheckSupportRule(TypesAreEqual(input, cellStateOut), reasonIfUnsupported, |
| 842 | "Reference Lstm: input and cellStateOut types are mismatched"); |
Nattapat Chaimanowong | eb2b329 | 2019-05-07 12:02:30 +0100 | [diff] [blame] | 843 | supported &= CheckSupportRule(TypesAreEqual(input, output), reasonIfUnsupported, |
| 844 | "Reference Lstm: input and output types are mismatched"); |
Jan Eilers | d01a83c | 2019-07-03 18:20:40 +0100 | [diff] [blame] | 845 | // check layer parameters |
Francis Murtagh | bb590b4 | 2019-08-14 09:51:36 +0100 | [diff] [blame] | 846 | supported &= CheckSupportRule(TypesAreEqual(input, paramsInfo.GetInputToForgetWeights()), reasonIfUnsupported, |
Jan Eilers | d01a83c | 2019-07-03 18:20:40 +0100 | [diff] [blame] | 847 | "Reference Lstm: input and InputToForgetWeights types are mismatched"); |
Francis Murtagh | bb590b4 | 2019-08-14 09:51:36 +0100 | [diff] [blame] | 848 | supported &= CheckSupportRule(TypesAreEqual(input, paramsInfo.GetInputToCellWeights()), reasonIfUnsupported, |
Jan Eilers | d01a83c | 2019-07-03 18:20:40 +0100 | [diff] [blame] | 849 | "Reference Lstm: input and InputToCellWeights types are mismatched"); |
Francis Murtagh | bb590b4 | 2019-08-14 09:51:36 +0100 | [diff] [blame] | 850 | supported &= CheckSupportRule(TypesAreEqual(input, paramsInfo.GetInputToOutputWeights()), reasonIfUnsupported, |
Jan Eilers | d01a83c | 2019-07-03 18:20:40 +0100 | [diff] [blame] | 851 | "Reference Lstm: input and InputToOutputWeights types are mismatched"); |
Francis Murtagh | bb590b4 | 2019-08-14 09:51:36 +0100 | [diff] [blame] | 852 | supported &= CheckSupportRule(TypesAreEqual(input, paramsInfo.GetRecurrentToForgetWeights()), reasonIfUnsupported, |
Jan Eilers | d01a83c | 2019-07-03 18:20:40 +0100 | [diff] [blame] | 853 | "Reference Lstm: input and RecurrentToForgetWeights types are mismatched"); |
Francis Murtagh | bb590b4 | 2019-08-14 09:51:36 +0100 | [diff] [blame] | 854 | supported &= CheckSupportRule(TypesAreEqual(input, paramsInfo.GetRecurrentToCellWeights()), reasonIfUnsupported, |
Jan Eilers | d01a83c | 2019-07-03 18:20:40 +0100 | [diff] [blame] | 855 | "Reference Lstm: input and RecurrentToCellWeights types are mismatched"); |
Francis Murtagh | bb590b4 | 2019-08-14 09:51:36 +0100 | [diff] [blame] | 856 | supported &= CheckSupportRule(TypesAreEqual(input, paramsInfo.GetRecurrentToOutputWeights()), reasonIfUnsupported, |
Jan Eilers | d01a83c | 2019-07-03 18:20:40 +0100 | [diff] [blame] | 857 | "Reference Lstm: input and RecurrentToOutputWeights types are mismatched"); |
Francis Murtagh | bb590b4 | 2019-08-14 09:51:36 +0100 | [diff] [blame] | 858 | supported &= CheckSupportRule(TypesAreEqual(input, paramsInfo.GetForgetGateBias()), reasonIfUnsupported, |
Jan Eilers | d01a83c | 2019-07-03 18:20:40 +0100 | [diff] [blame] | 859 | "Reference Lstm: input and ForgetGateBias types are mismatched"); |
Francis Murtagh | bb590b4 | 2019-08-14 09:51:36 +0100 | [diff] [blame] | 860 | supported &= CheckSupportRule(TypesAreEqual(input, paramsInfo.GetCellBias()), reasonIfUnsupported, |
Jan Eilers | d01a83c | 2019-07-03 18:20:40 +0100 | [diff] [blame] | 861 | "Reference Lstm: input and CellBias types are mismatched"); |
Francis Murtagh | bb590b4 | 2019-08-14 09:51:36 +0100 | [diff] [blame] | 862 | supported &= CheckSupportRule(TypesAreEqual(input, paramsInfo.GetOutputGateBias()), reasonIfUnsupported, |
Jan Eilers | d01a83c | 2019-07-03 18:20:40 +0100 | [diff] [blame] | 863 | "Reference Lstm: input and OutputGateBias types are mismatched"); |
| 864 | if (!descriptor.m_CifgEnabled) |
| 865 | { |
Francis Murtagh | bb590b4 | 2019-08-14 09:51:36 +0100 | [diff] [blame] | 866 | supported &= CheckSupportRule(TypesAreEqual(input, paramsInfo.GetInputToInputWeights()), reasonIfUnsupported, |
Jan Eilers | d01a83c | 2019-07-03 18:20:40 +0100 | [diff] [blame] | 867 | "Reference Lstm: input and InputToInputWeights types are mismatched"); |
Francis Murtagh | bb590b4 | 2019-08-14 09:51:36 +0100 | [diff] [blame] | 868 | supported &= CheckSupportRule(TypesAreEqual(input, paramsInfo.GetRecurrentToInputWeights()), |
Jan Eilers | d01a83c | 2019-07-03 18:20:40 +0100 | [diff] [blame] | 869 | reasonIfUnsupported, |
| 870 | "Reference Lstm: input and RecurrentToInputWeights types are mismatched"); |
Francis Murtagh | bb590b4 | 2019-08-14 09:51:36 +0100 | [diff] [blame] | 871 | supported &= CheckSupportRule(TypesAreEqual(input, paramsInfo.GetInputGateBias()), reasonIfUnsupported, |
Jan Eilers | d01a83c | 2019-07-03 18:20:40 +0100 | [diff] [blame] | 872 | "Reference Lstm: input and InputGateBias types are mismatched"); |
| 873 | if (descriptor.m_PeepholeEnabled) |
| 874 | { |
Francis Murtagh | bb590b4 | 2019-08-14 09:51:36 +0100 | [diff] [blame] | 875 | supported &= CheckSupportRule(TypesAreEqual(input, paramsInfo.GetCellToInputWeights()), |
Jan Eilers | d01a83c | 2019-07-03 18:20:40 +0100 | [diff] [blame] | 876 | reasonIfUnsupported, |
| 877 | "Reference Lstm: input and CellToInputWeights types are mismatched"); |
| 878 | } |
| 879 | } |
| 880 | if (descriptor.m_PeepholeEnabled) |
| 881 | { |
Francis Murtagh | bb590b4 | 2019-08-14 09:51:36 +0100 | [diff] [blame] | 882 | supported &= CheckSupportRule(TypesAreEqual(input, paramsInfo.GetCellToForgetWeights()), reasonIfUnsupported, |
Jan Eilers | d01a83c | 2019-07-03 18:20:40 +0100 | [diff] [blame] | 883 | "Reference Lstm: input and CellToForgetWeights types are mismatched"); |
Francis Murtagh | bb590b4 | 2019-08-14 09:51:36 +0100 | [diff] [blame] | 884 | supported &= CheckSupportRule(TypesAreEqual(input, paramsInfo.GetCellToOutputWeights()), reasonIfUnsupported, |
Jan Eilers | d01a83c | 2019-07-03 18:20:40 +0100 | [diff] [blame] | 885 | "Reference Lstm: input and CellToOutputWeights types are mismatched"); |
| 886 | } |
| 887 | if (descriptor.m_ProjectionEnabled) |
| 888 | { |
Francis Murtagh | bb590b4 | 2019-08-14 09:51:36 +0100 | [diff] [blame] | 889 | supported &= CheckSupportRule(TypesAreEqual(input, paramsInfo.GetProjectionWeights()), reasonIfUnsupported, |
Jan Eilers | d01a83c | 2019-07-03 18:20:40 +0100 | [diff] [blame] | 890 | "Reference Lstm: input and mProjectionWeights types are mismatched"); |
| 891 | if (paramsInfo.m_ProjectionBias != nullptr) |
| 892 | { |
Francis Murtagh | bb590b4 | 2019-08-14 09:51:36 +0100 | [diff] [blame] | 893 | supported &= CheckSupportRule(TypesAreEqual(input, paramsInfo.GetProjectionBias()), reasonIfUnsupported, |
Jan Eilers | d01a83c | 2019-07-03 18:20:40 +0100 | [diff] [blame] | 894 | "Reference Lstm: input and ProjectionBias types are mismatched"); |
| 895 | } |
| 896 | } |
| 897 | if (descriptor.m_LayerNormEnabled) |
| 898 | { |
| 899 | if (!descriptor.m_CifgEnabled) |
| 900 | { |
Francis Murtagh | bb590b4 | 2019-08-14 09:51:36 +0100 | [diff] [blame] | 901 | supported &= CheckSupportRule(TypesAreEqual(input, paramsInfo.GetInputLayerNormWeights()), |
Jan Eilers | d01a83c | 2019-07-03 18:20:40 +0100 | [diff] [blame] | 902 | reasonIfUnsupported, |
| 903 | "Reference Lstm: input and InputLayerNormWeights types are mismatched"); |
| 904 | } |
Francis Murtagh | bb590b4 | 2019-08-14 09:51:36 +0100 | [diff] [blame] | 905 | supported &= CheckSupportRule(TypesAreEqual(input, paramsInfo.GetForgetLayerNormWeights()), |
Jan Eilers | d01a83c | 2019-07-03 18:20:40 +0100 | [diff] [blame] | 906 | reasonIfUnsupported, |
| 907 | "Reference Lstm: input and ForgetLayerNormWeights types are mismatched"); |
Francis Murtagh | bb590b4 | 2019-08-14 09:51:36 +0100 | [diff] [blame] | 908 | supported &= CheckSupportRule(TypesAreEqual(input, paramsInfo.GetCellLayerNormWeights()), |
Jan Eilers | d01a83c | 2019-07-03 18:20:40 +0100 | [diff] [blame] | 909 | reasonIfUnsupported, |
| 910 | "Reference Lstm: input and CellLayerNormWeights types are mismatched"); |
Francis Murtagh | bb590b4 | 2019-08-14 09:51:36 +0100 | [diff] [blame] | 911 | supported &= CheckSupportRule(TypesAreEqual(input, paramsInfo.GetOutputLayerNormWeights()), |
Jan Eilers | d01a83c | 2019-07-03 18:20:40 +0100 | [diff] [blame] | 912 | reasonIfUnsupported, |
| 913 | "Reference Lstm: input and OutputLayerNormWeights types are mismatched"); |
| 914 | } |
Nattapat Chaimanowong | eb2b329 | 2019-05-07 12:02:30 +0100 | [diff] [blame] | 915 | |
| 916 | return supported; |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 917 | } |
| 918 | |
saoste01 | 2df12b3 | 2018-11-28 16:57:20 +0000 | [diff] [blame] | 919 | bool RefLayerSupport::IsMaximumSupported(const TensorInfo& input0, |
| 920 | const TensorInfo& input1, |
| 921 | const TensorInfo& output, |
| 922 | Optional<std::string&> reasonIfUnsupported) const |
| 923 | { |
Sadik Armagan | 2999a02 | 2019-04-09 14:20:12 +0100 | [diff] [blame] | 924 | bool supported = true; |
| 925 | |
Sadik Armagan | 68db21f | 2019-08-09 16:44:10 +0100 | [diff] [blame] | 926 | std::array<DataType,3> supportedTypes = { |
Sadik Armagan | 2999a02 | 2019-04-09 14:20:12 +0100 | [diff] [blame] | 927 | DataType::Float32, |
| 928 | DataType::QuantisedAsymm8, |
| 929 | DataType::QuantisedSymm16 |
| 930 | }; |
| 931 | |
| 932 | supported &= CheckSupportRule(TypeAnyOf(input0, supportedTypes), reasonIfUnsupported, |
| 933 | "Reference maximum: input 0 is not a supported type."); |
| 934 | |
| 935 | supported &= CheckSupportRule(TypeAnyOf(input1, supportedTypes), reasonIfUnsupported, |
| 936 | "Reference maximum: input 1 is not a supported type."); |
| 937 | |
| 938 | supported &= CheckSupportRule(TypeAnyOf(output, supportedTypes), reasonIfUnsupported, |
| 939 | "Reference maximum: output is not a supported type."); |
| 940 | |
| 941 | supported &= CheckSupportRule(TypesAreEqual(input0, input1), reasonIfUnsupported, |
| 942 | "Reference maximum: input 0 and Input 1 types are mismatched"); |
| 943 | |
| 944 | supported &= CheckSupportRule(TypesAreEqual(input0, output), reasonIfUnsupported, |
| 945 | "Reference maximum: input and output types are mismatched"); |
| 946 | |
| 947 | supported &= CheckSupportRule(ShapesAreBroadcastCompatible(input0, input1, output), reasonIfUnsupported, |
| 948 | "Reference maximum: shapes are not suitable for implicit broadcast."); |
| 949 | |
| 950 | return supported; |
saoste01 | 2df12b3 | 2018-11-28 16:57:20 +0000 | [diff] [blame] | 951 | } |
| 952 | |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 953 | bool RefLayerSupport::IsMeanSupported(const TensorInfo& input, |
| 954 | const TensorInfo& output, |
| 955 | const MeanDescriptor& descriptor, |
| 956 | Optional<std::string&> reasonIfUnsupported) const |
narpra01 | 32b9046 | 2018-09-13 11:07:48 +0100 | [diff] [blame] | 957 | { |
James Conroy | 4d1ff58 | 2019-06-10 17:06:39 +0100 | [diff] [blame] | 958 | bool supported = true; |
| 959 | std::string meanLayerStr = "Mean"; |
| 960 | std::string outputTensorStr = "output"; |
| 961 | |
Matthew Jackson | 252df3a | 2019-09-11 09:19:18 +0100 | [diff] [blame^] | 962 | std::array<DataType,4> supportedTypes = |
James Conroy | 4d1ff58 | 2019-06-10 17:06:39 +0100 | [diff] [blame] | 963 | { |
| 964 | DataType::Float32, |
Matthew Jackson | 252df3a | 2019-09-11 09:19:18 +0100 | [diff] [blame^] | 965 | DataType::Float16, |
James Conroy | b80775f | 2019-06-11 11:25:30 +0100 | [diff] [blame] | 966 | DataType::QuantisedAsymm8, |
| 967 | DataType::QuantisedSymm16 |
James Conroy | 4d1ff58 | 2019-06-10 17:06:39 +0100 | [diff] [blame] | 968 | }; |
| 969 | |
| 970 | supported &= CheckSupportRule(TypeAnyOf(input, supportedTypes), reasonIfUnsupported, |
| 971 | "Reference Mean: input type not supported."); |
| 972 | |
| 973 | supported &= CheckSupportRule(TypesAreEqual(input, output), reasonIfUnsupported, |
| 974 | "Reference Mean: input and output types are mismatched"); |
| 975 | |
| 976 | if (descriptor.m_KeepDims) |
| 977 | { |
| 978 | supported &= CheckSupportRule(TensorNumDimensionsAreCorrect(output, input.GetNumDimensions()), |
| 979 | reasonIfUnsupported, |
| 980 | CreateIncorrectDimensionsErrorMsg(input.GetNumDimensions(), |
| 981 | output.GetNumDimensions(), |
| 982 | meanLayerStr, outputTensorStr).data()); |
| 983 | } |
| 984 | else if (descriptor.m_Axis.empty()) |
| 985 | { |
| 986 | supported &= CheckSupportRule(TensorNumDimensionsAreCorrect(output, 1), |
| 987 | reasonIfUnsupported, |
| 988 | CreateIncorrectDimensionsErrorMsg(1, output.GetNumDimensions(), |
| 989 | meanLayerStr, outputTensorStr).data()); |
| 990 | } |
| 991 | else |
| 992 | { |
| 993 | auto outputDim = input.GetNumDimensions() - boost::numeric_cast<unsigned int>(descriptor.m_Axis.size()); |
| 994 | |
| 995 | if (outputDim > 0) |
| 996 | { |
| 997 | supported &= CheckSupportRule(TensorNumDimensionsAreCorrect(output, outputDim), |
| 998 | reasonIfUnsupported, |
| 999 | CreateIncorrectDimensionsErrorMsg(outputDim, output.GetNumDimensions(), |
| 1000 | meanLayerStr, outputTensorStr).data()); |
| 1001 | } |
| 1002 | else |
| 1003 | { |
| 1004 | supported &= CheckSupportRule(TensorNumDimensionsAreCorrect(output, 1), |
| 1005 | reasonIfUnsupported, |
| 1006 | CreateIncorrectDimensionsErrorMsg(1, output.GetNumDimensions(), |
| 1007 | meanLayerStr, outputTensorStr).data()); |
| 1008 | } |
| 1009 | } |
| 1010 | |
| 1011 | return supported; |
narpra01 | 32b9046 | 2018-09-13 11:07:48 +0100 | [diff] [blame] | 1012 | } |
| 1013 | |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 1014 | bool RefLayerSupport::IsMergerSupported(const std::vector<const TensorInfo*> inputs, |
Nikhil Raj | 8599a41 | 2018-11-19 14:51:07 +0000 | [diff] [blame] | 1015 | const TensorInfo& output, |
Jim Flynn | e242f2d | 2019-05-22 14:24:13 +0100 | [diff] [blame] | 1016 | const MergerDescriptor& descriptor, |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 1017 | Optional<std::string&> reasonIfUnsupported) const |
| 1018 | { |
Jim Flynn | e242f2d | 2019-05-22 14:24:13 +0100 | [diff] [blame] | 1019 | return IsConcatSupported(inputs, output, descriptor, reasonIfUnsupported); |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 1020 | } |
| 1021 | |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 1022 | bool RefLayerSupport::IsMemCopySupported(const TensorInfo &input, |
| 1023 | const TensorInfo &output, |
| 1024 | Optional<std::string &> reasonIfUnsupported) const |
| 1025 | { |
Narumol Prangnawarat | f9ac3fd | 2019-07-03 14:55:57 +0100 | [diff] [blame] | 1026 | bool supported = true; |
| 1027 | |
| 1028 | std::array<DataType,5> supportedTypes = |
| 1029 | { |
| 1030 | DataType::Float32, |
| 1031 | DataType::Float16, |
| 1032 | DataType::QuantisedAsymm8, |
| 1033 | DataType::QuantisedSymm16, |
| 1034 | DataType::Boolean |
| 1035 | }; |
| 1036 | |
| 1037 | supported &= CheckSupportRule(TypeAnyOf(input, supportedTypes), reasonIfUnsupported, |
| 1038 | "Reference MemCopy: input type not supported"); |
| 1039 | |
| 1040 | supported &= CheckSupportRule(TypeAnyOf(output, supportedTypes), reasonIfUnsupported, |
| 1041 | "Reference MemCopy: output type not supported"); |
| 1042 | |
| 1043 | supported &= CheckSupportRule(TypesAreEqual(input, output), reasonIfUnsupported, |
| 1044 | "Reference MemCopy: input and output types are mismatched"); |
| 1045 | |
| 1046 | return supported; |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 1047 | } |
| 1048 | |
Éanna Ó Catháin | 20e5880 | 2018-12-04 10:29:06 +0000 | [diff] [blame] | 1049 | bool RefLayerSupport::IsMinimumSupported(const TensorInfo& input0, |
| 1050 | const TensorInfo& input1, |
| 1051 | const TensorInfo& output, |
| 1052 | Optional<std::string&> reasonIfUnsupported) const |
| 1053 | { |
Sadik Armagan | 2999a02 | 2019-04-09 14:20:12 +0100 | [diff] [blame] | 1054 | bool supported = true; |
| 1055 | |
Sadik Armagan | 68db21f | 2019-08-09 16:44:10 +0100 | [diff] [blame] | 1056 | std::array<DataType,3> supportedTypes = { |
Sadik Armagan | 2999a02 | 2019-04-09 14:20:12 +0100 | [diff] [blame] | 1057 | DataType::Float32, |
| 1058 | DataType::QuantisedAsymm8, |
| 1059 | DataType::QuantisedSymm16 |
| 1060 | }; |
| 1061 | |
| 1062 | supported &= CheckSupportRule(TypeAnyOf(input0, supportedTypes), reasonIfUnsupported, |
| 1063 | "Reference minimum: input 0 is not a supported type."); |
| 1064 | |
| 1065 | supported &= CheckSupportRule(TypeAnyOf(input1, supportedTypes), reasonIfUnsupported, |
| 1066 | "Reference minimum: input 1 is not a supported type."); |
| 1067 | |
| 1068 | supported &= CheckSupportRule(TypeAnyOf(output, supportedTypes), reasonIfUnsupported, |
| 1069 | "Reference minimum: output is not a supported type."); |
| 1070 | |
| 1071 | supported &= CheckSupportRule(TypesAreEqual(input0, input1), reasonIfUnsupported, |
| 1072 | "Reference minimum: input 0 and Input 1 types are mismatched"); |
| 1073 | |
| 1074 | supported &= CheckSupportRule(TypesAreEqual(input0, output), reasonIfUnsupported, |
| 1075 | "Reference minimum: input and output types are mismatched"); |
| 1076 | |
| 1077 | supported &= CheckSupportRule(ShapesAreBroadcastCompatible(input0, input1, output), reasonIfUnsupported, |
| 1078 | "Reference minimum: shapes are not suitable for implicit broadcast."); |
| 1079 | |
| 1080 | return supported; |
Éanna Ó Catháin | 20e5880 | 2018-12-04 10:29:06 +0000 | [diff] [blame] | 1081 | } |
| 1082 | |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 1083 | bool RefLayerSupport::IsMultiplicationSupported(const TensorInfo& input0, |
| 1084 | const TensorInfo& input1, |
| 1085 | const TensorInfo& output, |
| 1086 | Optional<std::string&> reasonIfUnsupported) const |
| 1087 | { |
Sadik Armagan | 2999a02 | 2019-04-09 14:20:12 +0100 | [diff] [blame] | 1088 | bool supported = true; |
| 1089 | |
Matthew Jackson | 252df3a | 2019-09-11 09:19:18 +0100 | [diff] [blame^] | 1090 | std::array<DataType,4> supportedTypes = { |
Sadik Armagan | 2999a02 | 2019-04-09 14:20:12 +0100 | [diff] [blame] | 1091 | DataType::Float32, |
Matthew Jackson | 252df3a | 2019-09-11 09:19:18 +0100 | [diff] [blame^] | 1092 | DataType::Float16, |
Sadik Armagan | 2999a02 | 2019-04-09 14:20:12 +0100 | [diff] [blame] | 1093 | DataType::QuantisedAsymm8, |
| 1094 | DataType::QuantisedSymm16 |
| 1095 | }; |
| 1096 | |
| 1097 | supported &= CheckSupportRule(TypeAnyOf(input0, supportedTypes), reasonIfUnsupported, |
| 1098 | "Reference multiplication: input 0 is not a supported type."); |
| 1099 | |
| 1100 | supported &= CheckSupportRule(TypeAnyOf(input1, supportedTypes), reasonIfUnsupported, |
| 1101 | "Reference multiplication: input 1 is not a supported type."); |
| 1102 | |
| 1103 | supported &= CheckSupportRule(TypeAnyOf(output, supportedTypes), reasonIfUnsupported, |
| 1104 | "Reference multiplication: output is not a supported type."); |
| 1105 | |
| 1106 | supported &= CheckSupportRule(TypesAreEqual(input0, input1), reasonIfUnsupported, |
| 1107 | "Reference multiplication: input 0 and Input 1 types are mismatched"); |
| 1108 | |
| 1109 | supported &= CheckSupportRule(TypesAreEqual(input0, output), reasonIfUnsupported, |
| 1110 | "Reference multiplication: input and output types are mismatched"); |
| 1111 | |
| 1112 | supported &= CheckSupportRule(ShapesAreBroadcastCompatible(input0, input1, output), reasonIfUnsupported, |
| 1113 | "Reference multiplication: shapes are not suitable for implicit broadcast."); |
| 1114 | |
| 1115 | return supported; |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 1116 | } |
| 1117 | |
| 1118 | bool RefLayerSupport::IsNormalizationSupported(const TensorInfo& input, |
| 1119 | const TensorInfo& output, |
| 1120 | const NormalizationDescriptor& descriptor, |
| 1121 | Optional<std::string&> reasonIfUnsupported) const |
Nina Drozd | 661dfa7 | 2018-10-02 11:14:17 +0100 | [diff] [blame] | 1122 | { |
Nina Drozd | 661dfa7 | 2018-10-02 11:14:17 +0100 | [diff] [blame] | 1123 | ignore_unused(descriptor); |
Matteo Martincigh | 2fc70c5 | 2019-06-05 14:12:48 +0100 | [diff] [blame] | 1124 | |
| 1125 | // Define supported types |
Matteo Martincigh | 6aeb771 | 2019-06-05 17:23:29 +0100 | [diff] [blame] | 1126 | std::array<DataType, 4> supportedTypes = |
Matteo Martincigh | 2fc70c5 | 2019-06-05 14:12:48 +0100 | [diff] [blame] | 1127 | { |
| 1128 | DataType::Float16, |
| 1129 | DataType::Float32, |
Matteo Martincigh | 6aeb771 | 2019-06-05 17:23:29 +0100 | [diff] [blame] | 1130 | DataType::QuantisedAsymm8, |
| 1131 | DataType::QuantisedSymm16 |
Matteo Martincigh | 2fc70c5 | 2019-06-05 14:12:48 +0100 | [diff] [blame] | 1132 | }; |
| 1133 | |
| 1134 | bool supported = true; |
| 1135 | |
| 1136 | supported &= CheckSupportRule(TypeAnyOf(input, supportedTypes), reasonIfUnsupported, |
| 1137 | "Reference normalization: input type not supported."); |
| 1138 | |
| 1139 | supported &= CheckSupportRule(TypeAnyOf(output, supportedTypes), reasonIfUnsupported, |
| 1140 | "Reference normalization: output type not supported."); |
| 1141 | |
| 1142 | supported &= CheckSupportRule(ShapesAreSameTotalSize(input, output), reasonIfUnsupported, |
| 1143 | "Reference normalization: input and output shapes have different " |
| 1144 | "num total elements."); |
| 1145 | |
| 1146 | return supported; |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 1147 | } |
| 1148 | |
| 1149 | bool RefLayerSupport::IsOutputSupported(const TensorInfo& output, |
| 1150 | Optional<std::string&> reasonIfUnsupported) const |
| 1151 | { |
Narumol Prangnawarat | b6441e4 | 2019-06-04 11:22:00 +0100 | [diff] [blame] | 1152 | return true; |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 1153 | } |
| 1154 | |
| 1155 | bool RefLayerSupport::IsPadSupported(const TensorInfo& input, |
| 1156 | const TensorInfo& output, |
| 1157 | const PadDescriptor& descriptor, |
| 1158 | Optional<std::string&> reasonIfUnsupported) const |
| 1159 | { |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 1160 | ignore_unused(descriptor); |
Narumol Prangnawarat | e6eaf66 | 2019-07-08 08:57:17 +0100 | [diff] [blame] | 1161 | bool supported = true; |
| 1162 | |
| 1163 | // Define supported output and inputs types. |
Matthew Jackson | 252df3a | 2019-09-11 09:19:18 +0100 | [diff] [blame^] | 1164 | std::array<DataType,4> supportedTypes = |
Narumol Prangnawarat | e6eaf66 | 2019-07-08 08:57:17 +0100 | [diff] [blame] | 1165 | { |
| 1166 | DataType::Float32, |
Matthew Jackson | 252df3a | 2019-09-11 09:19:18 +0100 | [diff] [blame^] | 1167 | DataType::Float16, |
Narumol Prangnawarat | e6eaf66 | 2019-07-08 08:57:17 +0100 | [diff] [blame] | 1168 | DataType::QuantisedAsymm8, |
| 1169 | DataType::QuantisedSymm16 |
| 1170 | }; |
| 1171 | |
| 1172 | supported &= CheckSupportRule(TypeAnyOf(input, supportedTypes), reasonIfUnsupported, |
| 1173 | "Reference pad: input is not a supported type."); |
| 1174 | |
| 1175 | supported &= CheckSupportRule(TypeAnyOf(output, supportedTypes), reasonIfUnsupported, |
| 1176 | "Reference pad: output is not a supported type."); |
| 1177 | |
| 1178 | supported &= CheckSupportRule(TypesAreEqual(input, output), reasonIfUnsupported, |
| 1179 | "Reference pad: input and output types are mismatched."); |
| 1180 | |
| 1181 | return supported; |
Nina Drozd | 661dfa7 | 2018-10-02 11:14:17 +0100 | [diff] [blame] | 1182 | } |
| 1183 | |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 1184 | bool RefLayerSupport::IsPermuteSupported(const TensorInfo& input, |
| 1185 | const TensorInfo& output, |
| 1186 | const PermuteDescriptor& descriptor, |
| 1187 | Optional<std::string&> reasonIfUnsupported) const |
| 1188 | { |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 1189 | ignore_unused(descriptor); |
Narumol Prangnawarat | 86bb4e1 | 2019-07-08 11:36:05 +0100 | [diff] [blame] | 1190 | bool supported = true; |
| 1191 | |
| 1192 | // Define supported output and inputs types. |
| 1193 | std::array<DataType,3> supportedTypes = |
| 1194 | { |
| 1195 | DataType::Float32, |
| 1196 | DataType::QuantisedAsymm8, |
| 1197 | DataType::QuantisedSymm16 |
| 1198 | }; |
| 1199 | |
| 1200 | supported &= CheckSupportRule(TypeAnyOf(input, supportedTypes), reasonIfUnsupported, |
| 1201 | "Reference permute: input is not a supported type."); |
| 1202 | |
| 1203 | supported &= CheckSupportRule(TypeAnyOf(output, supportedTypes), reasonIfUnsupported, |
| 1204 | "Reference permute: output is not a supported type."); |
| 1205 | |
| 1206 | supported &= CheckSupportRule(TypesAreEqual(input, output), reasonIfUnsupported, |
| 1207 | "Reference permute: input and output types are mismatched."); |
| 1208 | |
| 1209 | return supported; |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 1210 | } |
| 1211 | |
| 1212 | bool RefLayerSupport::IsPooling2dSupported(const TensorInfo& input, |
| 1213 | const TensorInfo& output, |
| 1214 | const Pooling2dDescriptor& descriptor, |
| 1215 | Optional<std::string&> reasonIfUnsupported) const |
| 1216 | { |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 1217 | ignore_unused(descriptor); |
Teresa Charlin | a3b2047 | 2019-06-06 11:12:32 +0100 | [diff] [blame] | 1218 | bool supported = true; |
| 1219 | |
| 1220 | // Define supported output and inputs types. |
Matthew Jackson | 252df3a | 2019-09-11 09:19:18 +0100 | [diff] [blame^] | 1221 | std::array<DataType,4> supportedTypes = |
Teresa Charlin | a3b2047 | 2019-06-06 11:12:32 +0100 | [diff] [blame] | 1222 | { |
| 1223 | DataType::Float32, |
Matthew Jackson | 252df3a | 2019-09-11 09:19:18 +0100 | [diff] [blame^] | 1224 | DataType::Float16, |
Teresa Charlin | 0434df6 | 2019-06-06 13:40:35 +0100 | [diff] [blame] | 1225 | DataType::QuantisedAsymm8, |
| 1226 | DataType::QuantisedSymm16 |
Teresa Charlin | a3b2047 | 2019-06-06 11:12:32 +0100 | [diff] [blame] | 1227 | }; |
| 1228 | |
| 1229 | supported &= CheckSupportRule(TypeAnyOf(input, supportedTypes), reasonIfUnsupported, |
| 1230 | "Reference poolind2d: input is not a supported type."); |
| 1231 | |
| 1232 | supported &= CheckSupportRule(TypeAnyOf(output, supportedTypes), reasonIfUnsupported, |
| 1233 | "Reference poolind2d: output is not a supported type."); |
| 1234 | |
| 1235 | supported &= CheckSupportRule(TypesAreEqual(input, output), reasonIfUnsupported, |
| 1236 | "Reference poolind2d: input and output types are mismatched."); |
| 1237 | |
| 1238 | return supported; |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 1239 | } |
| 1240 | |
Derek Lamberti | 5f400d6 | 2019-03-25 15:41:58 +0000 | [diff] [blame] | 1241 | bool RefLayerSupport::IsQuantizeSupported(const TensorInfo& input, |
| 1242 | const TensorInfo& output, |
| 1243 | Optional<std::string&> reasonIfUnsupported) const |
| 1244 | { |
| 1245 | bool supported = true; |
| 1246 | |
| 1247 | // Define supported output types. |
Sadik Armagan | 1a81630 | 2019-07-29 17:16:40 +0100 | [diff] [blame] | 1248 | std::array<DataType,1> supportedInputTypes = { |
Derek Lamberti | 5f400d6 | 2019-03-25 15:41:58 +0000 | [diff] [blame] | 1249 | DataType::Float32, |
| 1250 | }; |
| 1251 | |
| 1252 | supported &= CheckSupportRule(TypeAnyOf(input, supportedInputTypes), reasonIfUnsupported, |
| 1253 | "Reference quantize: input type not supported."); |
| 1254 | |
| 1255 | // Define supported output types. |
| 1256 | std::array<DataType,2> supportedOutputTypes = { |
| 1257 | DataType::QuantisedAsymm8, |
| 1258 | DataType::QuantisedSymm16 |
| 1259 | }; |
| 1260 | supported &= CheckSupportRule(TypeAnyOf(output, supportedOutputTypes), reasonIfUnsupported, |
| 1261 | "Reference quantize: output type not supported."); |
| 1262 | |
| 1263 | supported &= CheckSupportRule(ShapesAreSameTotalSize(input, output), reasonIfUnsupported, |
| 1264 | "Reference quantize: input and output shapes have different num total elements."); |
| 1265 | |
| 1266 | return supported; |
| 1267 | } |
| 1268 | |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 1269 | bool RefLayerSupport::IsReshapeSupported(const TensorInfo& input, |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 1270 | const ReshapeDescriptor& descriptor, |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 1271 | Optional<std::string&> reasonIfUnsupported) const |
| 1272 | { |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 1273 | ignore_unused(descriptor); |
Nina Drozd | 2f2778f | 2019-05-27 10:37:05 +0100 | [diff] [blame] | 1274 | // Define supported output types. |
Nina Drozd | 8ed4b8c | 2019-05-29 10:41:04 +0100 | [diff] [blame] | 1275 | std::array<DataType,4> supportedOutputTypes = |
Nina Drozd | 2f2778f | 2019-05-27 10:37:05 +0100 | [diff] [blame] | 1276 | { |
| 1277 | DataType::Float32, |
| 1278 | DataType::Float16, |
Nina Drozd | 8ed4b8c | 2019-05-29 10:41:04 +0100 | [diff] [blame] | 1279 | DataType::QuantisedAsymm8, |
| 1280 | DataType::QuantisedSymm16 |
Nina Drozd | 2f2778f | 2019-05-27 10:37:05 +0100 | [diff] [blame] | 1281 | }; |
| 1282 | return CheckSupportRule(TypeAnyOf(input, supportedOutputTypes), reasonIfUnsupported, |
| 1283 | "Reference reshape: input type not supported."); |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 1284 | } |
| 1285 | |
| 1286 | bool RefLayerSupport::IsResizeBilinearSupported(const TensorInfo& input, |
Sadik Armagan | c625f00 | 2018-12-17 11:32:16 +0000 | [diff] [blame] | 1287 | const TensorInfo& output, |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 1288 | Optional<std::string&> reasonIfUnsupported) const |
| 1289 | { |
Ellen Norris-Thompson | 3cb85f3 | 2019-06-17 11:32:49 +0100 | [diff] [blame] | 1290 | bool supported = true; |
| 1291 | std::array<DataType,3> supportedTypes = |
Teresa Charlin | 970f43b | 2019-07-01 13:51:07 +0100 | [diff] [blame] | 1292 | { |
| 1293 | DataType::Float32, |
| 1294 | DataType::QuantisedAsymm8, |
| 1295 | DataType::QuantisedSymm16 |
| 1296 | }; |
Ellen Norris-Thompson | 3cb85f3 | 2019-06-17 11:32:49 +0100 | [diff] [blame] | 1297 | |
| 1298 | supported &= CheckSupportRule(TypeAnyOf(input, supportedTypes), reasonIfUnsupported, |
| 1299 | "Reference ResizeBilinear: input type not supported"); |
| 1300 | |
| 1301 | supported &= CheckSupportRule(TypeAnyOf(output, supportedTypes), reasonIfUnsupported, |
| 1302 | "Reference ResizeBilinear: output type not supported"); |
| 1303 | |
| 1304 | supported &= CheckSupportRule(TypesAreEqual(input, output), reasonIfUnsupported, |
| 1305 | "Reference ResizeBilinear: input and output types not matching"); |
| 1306 | |
| 1307 | return supported; |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 1308 | } |
| 1309 | |
Teresa Charlin | 970f43b | 2019-07-01 13:51:07 +0100 | [diff] [blame] | 1310 | bool RefLayerSupport::IsResizeSupported(const TensorInfo& input, |
| 1311 | const TensorInfo& output, |
| 1312 | const ResizeDescriptor& descriptor, |
| 1313 | Optional<std::string&> reasonIfUnsupported) const |
| 1314 | { |
| 1315 | bool supported = true; |
| 1316 | std::array<DataType,3> supportedTypes = |
| 1317 | { |
| 1318 | DataType::Float32, |
| 1319 | DataType::QuantisedAsymm8, |
| 1320 | DataType::QuantisedSymm16 |
| 1321 | }; |
| 1322 | |
| 1323 | supported &= CheckSupportRule(TypeAnyOf(input, supportedTypes), reasonIfUnsupported, |
| 1324 | "Reference Resize: input type not supported"); |
| 1325 | |
| 1326 | supported &= CheckSupportRule(TypeAnyOf(output, supportedTypes), reasonIfUnsupported, |
| 1327 | "Reference Resize: output type not supported"); |
| 1328 | |
| 1329 | supported &= CheckSupportRule(TypesAreEqual(input, output), reasonIfUnsupported, |
| 1330 | "Reference Resize: input and output types not matching"); |
| 1331 | |
| 1332 | return supported; |
| 1333 | } |
| 1334 | |
Mohamed Nour Abouelseoud | a1d3c6a | 2018-12-27 12:39:16 +0000 | [diff] [blame] | 1335 | bool RefLayerSupport::IsRsqrtSupported(const TensorInfo& input, |
| 1336 | const TensorInfo& output, |
| 1337 | Optional<std::string&> reasonIfUnsupported) const |
| 1338 | { |
nikraj01 | 0421e7f | 2019-06-14 09:40:34 +0100 | [diff] [blame] | 1339 | bool supported = true; |
nikraj01 | 24d7321 | 2019-06-14 14:20:40 +0100 | [diff] [blame] | 1340 | std::array<DataType,3> supportedTypes = |
nikraj01 | 0421e7f | 2019-06-14 09:40:34 +0100 | [diff] [blame] | 1341 | { |
| 1342 | DataType::Float32, |
nikraj01 | 24d7321 | 2019-06-14 14:20:40 +0100 | [diff] [blame] | 1343 | DataType::QuantisedAsymm8, |
| 1344 | DataType::QuantisedSymm16 |
nikraj01 | 0421e7f | 2019-06-14 09:40:34 +0100 | [diff] [blame] | 1345 | }; |
| 1346 | |
| 1347 | supported &= CheckSupportRule(TypeAnyOf(input, supportedTypes), reasonIfUnsupported, |
| 1348 | "Reference rsqrt: input type not supported"); |
| 1349 | |
| 1350 | supported &= CheckSupportRule(TypeAnyOf(output, supportedTypes), reasonIfUnsupported, |
| 1351 | "Reference rsqrt: output type not supported"); |
| 1352 | |
| 1353 | supported &= CheckSupportRule(TypesAreEqual(input, output), reasonIfUnsupported, |
| 1354 | "Reference rsqrt: input and output types not matching"); |
| 1355 | |
| 1356 | supported &= CheckSupportRule(ShapesAreSameTotalSize(input, output), reasonIfUnsupported, |
| 1357 | "Reference Rsqrt: input and output shapes have different number of total elements"); |
| 1358 | |
| 1359 | return supported; |
Mohamed Nour Abouelseoud | a1d3c6a | 2018-12-27 12:39:16 +0000 | [diff] [blame] | 1360 | } |
| 1361 | |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 1362 | bool RefLayerSupport::IsSoftmaxSupported(const TensorInfo& input, |
| 1363 | const TensorInfo& output, |
| 1364 | const SoftmaxDescriptor& descriptor, |
| 1365 | Optional<std::string&> reasonIfUnsupported) const |
| 1366 | { |
| 1367 | ignore_unused(output); |
nikraj01 | 248683f | 2019-05-29 16:46:50 +0100 | [diff] [blame] | 1368 | bool supported = true; |
| 1369 | std::array<DataType,3> supportedTypes = |
| 1370 | { |
| 1371 | DataType::Float32, |
| 1372 | DataType::QuantisedAsymm8, |
| 1373 | DataType::QuantisedSymm16 |
| 1374 | }; |
| 1375 | |
| 1376 | supported &= CheckSupportRule(TypeAnyOf(input, supportedTypes), reasonIfUnsupported, |
| 1377 | "Reference concatenation: output type not supported"); |
| 1378 | |
| 1379 | supported &= CheckSupportRule(TypeAnyOf(output, supportedTypes), reasonIfUnsupported, |
| 1380 | "Reference concatenation: input type not supported"); |
| 1381 | |
| 1382 | supported &= CheckSupportRule(TypesAreEqual(input, output), reasonIfUnsupported, |
| 1383 | "Reference concatenation: input type not supported"); |
| 1384 | |
| 1385 | return supported; |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 1386 | } |
| 1387 | |
Nattapat Chaimanowong | 3ea76d5 | 2018-11-09 14:10:38 +0000 | [diff] [blame] | 1388 | bool RefLayerSupport::IsSpaceToBatchNdSupported(const TensorInfo& input, |
| 1389 | const TensorInfo& output, |
| 1390 | const SpaceToBatchNdDescriptor& descriptor, |
| 1391 | Optional<std::string&> reasonIfUnsupported) const |
| 1392 | { |
| 1393 | ignore_unused(output); |
nikraj01 | 120522a | 2019-05-31 11:33:07 +0100 | [diff] [blame] | 1394 | bool supported = true; |
| 1395 | std::array<DataType,3> supportedTypes = |
| 1396 | { |
| 1397 | DataType::Float32, |
| 1398 | DataType::QuantisedAsymm8, |
| 1399 | DataType::QuantisedSymm16 |
| 1400 | }; |
| 1401 | |
| 1402 | supported &= CheckSupportRule(TypeAnyOf(input, supportedTypes), reasonIfUnsupported, |
| 1403 | "Reference SpaceToBatchNd: input type not supported"); |
| 1404 | |
| 1405 | supported &= CheckSupportRule(TypeAnyOf(output, supportedTypes), reasonIfUnsupported, |
| 1406 | "Reference SpaceToBatchNd: output type not supported"); |
| 1407 | |
| 1408 | supported &= CheckSupportRule(TypesAreEqual(input, output), reasonIfUnsupported, |
| 1409 | "Reference SpaceToBatchNd: input and output types are mismatched"); |
| 1410 | |
| 1411 | return supported; |
Nattapat Chaimanowong | 3ea76d5 | 2018-11-09 14:10:38 +0000 | [diff] [blame] | 1412 | } |
| 1413 | |
Keith Davis | a57eccb | 2019-06-14 17:33:22 +0100 | [diff] [blame] | 1414 | bool RefLayerSupport::IsSpaceToDepthSupported(const TensorInfo& input, |
Keith Davis | 5191033 | 2019-06-26 15:28:43 +0100 | [diff] [blame] | 1415 | const TensorInfo& output, |
| 1416 | const SpaceToDepthDescriptor& descriptor, |
| 1417 | Optional<std::string&> reasonIfUnsupported) const |
Keith Davis | a57eccb | 2019-06-14 17:33:22 +0100 | [diff] [blame] | 1418 | { |
| 1419 | |
| 1420 | ignore_unused(descriptor); |
| 1421 | bool supported = true; |
| 1422 | |
James Conroy | d2aa85e | 2019-07-01 17:12:40 +0100 | [diff] [blame] | 1423 | std::array<DataType,3> supportedTypes = |
Keith Davis | a57eccb | 2019-06-14 17:33:22 +0100 | [diff] [blame] | 1424 | { |
| 1425 | DataType::Float32, |
| 1426 | DataType::QuantisedAsymm8, |
James Conroy | d2aa85e | 2019-07-01 17:12:40 +0100 | [diff] [blame] | 1427 | DataType::QuantisedSymm16 |
Keith Davis | a57eccb | 2019-06-14 17:33:22 +0100 | [diff] [blame] | 1428 | }; |
| 1429 | |
| 1430 | supported &= CheckSupportRule(TypeAnyOf(input, supportedTypes), reasonIfUnsupported, |
| 1431 | "Reference SpaceToDepth: input type not supported"); |
| 1432 | |
| 1433 | supported &= CheckSupportRule(TypeAnyOf(output, supportedTypes), reasonIfUnsupported, |
| 1434 | "Reference SpaceToDepth: output type not supported"); |
| 1435 | |
| 1436 | supported &= CheckSupportRule(TypesAreEqual(input, output), reasonIfUnsupported, |
| 1437 | "Reference SpaceToDepth: input and output types are mismatched"); |
| 1438 | |
| 1439 | return supported; |
| 1440 | } |
| 1441 | |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 1442 | bool RefLayerSupport::IsSplitterSupported(const TensorInfo& input, |
| 1443 | const ViewsDescriptor& descriptor, |
| 1444 | Optional<std::string&> reasonIfUnsupported) const |
| 1445 | { |
| 1446 | ignore_unused(descriptor); |
Narumol Prangnawarat | f9ac3fd | 2019-07-03 14:55:57 +0100 | [diff] [blame] | 1447 | bool supported = true; |
| 1448 | std::array<DataType,3> supportedTypes = |
| 1449 | { |
| 1450 | DataType::Float32, |
| 1451 | DataType::QuantisedAsymm8, |
| 1452 | DataType::QuantisedSymm16 |
| 1453 | }; |
| 1454 | |
| 1455 | supported &= CheckSupportRule(TypeAnyOf(input, supportedTypes), reasonIfUnsupported, |
| 1456 | "Reference splitter: input type not supported"); |
| 1457 | |
| 1458 | return supported; |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 1459 | } |
| 1460 | |
Narumol Prangnawarat | 15eb583 | 2019-05-20 15:31:05 +0100 | [diff] [blame] | 1461 | bool RefLayerSupport::IsSplitterSupported(const TensorInfo& input, |
| 1462 | const std::vector<std::reference_wrapper<TensorInfo>>& outputs, |
| 1463 | const ViewsDescriptor& descriptor, |
| 1464 | Optional<std::string&> reasonIfUnsupported) const |
| 1465 | { |
| 1466 | ignore_unused(descriptor); |
Narumol Prangnawarat | f9ac3fd | 2019-07-03 14:55:57 +0100 | [diff] [blame] | 1467 | bool supported = true; |
| 1468 | std::array<DataType,3> supportedTypes = |
| 1469 | { |
| 1470 | DataType::Float32, |
| 1471 | DataType::QuantisedAsymm8, |
| 1472 | DataType::QuantisedSymm16 |
| 1473 | }; |
| 1474 | |
| 1475 | supported &= CheckSupportRule(TypeAnyOf(input, supportedTypes), reasonIfUnsupported, |
| 1476 | "Reference splitter: output type not supported"); |
| 1477 | for (const TensorInfo output : outputs) |
| 1478 | { |
| 1479 | supported &= CheckSupportRule(TypeAnyOf(input, supportedTypes), reasonIfUnsupported, |
| 1480 | "Reference splitter: input type not supported"); |
| 1481 | |
| 1482 | supported &= CheckSupportRule(TypesAreEqual(input, output), reasonIfUnsupported, |
| 1483 | "Reference splitter: input and output types mismatched."); |
| 1484 | } |
| 1485 | |
| 1486 | return supported; |
Narumol Prangnawarat | 15eb583 | 2019-05-20 15:31:05 +0100 | [diff] [blame] | 1487 | } |
| 1488 | |
Matthew Jackson | 81e601c | 2019-07-11 12:07:09 +0100 | [diff] [blame] | 1489 | bool RefLayerSupport::IsStackSupported(const std::vector<const TensorInfo*>& inputs, |
| 1490 | const TensorInfo& output, |
| 1491 | const StackDescriptor& descriptor, |
| 1492 | Optional<std::string&> reasonIfUnsupported) const |
| 1493 | { |
| 1494 | ignore_unused(descriptor); |
| 1495 | |
| 1496 | bool supported = true; |
Matthew Jackson | e69c399 | 2019-09-09 14:31:21 +0100 | [diff] [blame] | 1497 | std::array<DataType,4> supportedTypes = |
Matthew Jackson | 81e601c | 2019-07-11 12:07:09 +0100 | [diff] [blame] | 1498 | { |
| 1499 | DataType::Float32, |
Matthew Jackson | e69c399 | 2019-09-09 14:31:21 +0100 | [diff] [blame] | 1500 | DataType::Float16, |
Matthew Jackson | 81e601c | 2019-07-11 12:07:09 +0100 | [diff] [blame] | 1501 | DataType::QuantisedAsymm8, |
| 1502 | DataType::QuantisedSymm16 |
| 1503 | }; |
| 1504 | |
| 1505 | supported &= CheckSupportRule(TypeAnyOf(output, supportedTypes), reasonIfUnsupported, |
| 1506 | "Reference stack: output type not supported"); |
| 1507 | for (const TensorInfo* input : inputs) |
| 1508 | { |
| 1509 | BOOST_ASSERT(input != nullptr); |
| 1510 | supported &= CheckSupportRule(TypeAnyOf(*input, supportedTypes), reasonIfUnsupported, |
| 1511 | "Reference stack: input type not supported"); |
| 1512 | |
| 1513 | supported &= CheckSupportRule(TypesAreEqual(*input, output), reasonIfUnsupported, |
| 1514 | "Reference stack: input and output types mismatched."); |
| 1515 | } |
| 1516 | |
| 1517 | return supported; |
| 1518 | } |
| 1519 | |
Nattapat Chaimanowong | 1216b58 | 2018-11-23 15:33:41 +0000 | [diff] [blame] | 1520 | bool RefLayerSupport::IsStridedSliceSupported(const TensorInfo& input, |
| 1521 | const TensorInfo& output, |
| 1522 | const StridedSliceDescriptor& descriptor, |
| 1523 | Optional<std::string&> reasonIfUnsupported) const |
| 1524 | { |
Nattapat Chaimanowong | 1216b58 | 2018-11-23 15:33:41 +0000 | [diff] [blame] | 1525 | ignore_unused(descriptor); |
Narumol Prangnawarat | f9ac3fd | 2019-07-03 14:55:57 +0100 | [diff] [blame] | 1526 | bool supported = true; |
| 1527 | |
| 1528 | std::array<DataType,3> supportedTypes = |
| 1529 | { |
| 1530 | DataType::Float32, |
| 1531 | DataType::QuantisedAsymm8, |
| 1532 | DataType::QuantisedSymm16 |
| 1533 | }; |
| 1534 | |
| 1535 | supported &= CheckSupportRule(TypeAnyOf(input, supportedTypes), reasonIfUnsupported, |
| 1536 | "Reference StridedSlice: input type not supported"); |
| 1537 | |
| 1538 | supported &= CheckSupportRule(TypeAnyOf(output, supportedTypes), reasonIfUnsupported, |
| 1539 | "Reference StridedSlice: output type not supported"); |
| 1540 | |
| 1541 | supported &= CheckSupportRule(TypesAreEqual(input, output), reasonIfUnsupported, |
| 1542 | "Reference StridedSlice: input and output types are mismatched"); |
| 1543 | |
| 1544 | return supported; |
Nattapat Chaimanowong | 1216b58 | 2018-11-23 15:33:41 +0000 | [diff] [blame] | 1545 | } |
| 1546 | |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 1547 | bool RefLayerSupport::IsSubtractionSupported(const TensorInfo& input0, |
| 1548 | const TensorInfo& input1, |
| 1549 | const TensorInfo& output, |
| 1550 | Optional<std::string&> reasonIfUnsupported) const |
| 1551 | { |
Sadik Armagan | 2999a02 | 2019-04-09 14:20:12 +0100 | [diff] [blame] | 1552 | bool supported = true; |
| 1553 | |
| 1554 | std::array<DataType,3> supportedTypes = { |
| 1555 | DataType::Float32, |
| 1556 | DataType::QuantisedAsymm8, |
| 1557 | DataType::QuantisedSymm16 |
| 1558 | }; |
| 1559 | |
| 1560 | supported &= CheckSupportRule(TypeAnyOf(input0, supportedTypes), reasonIfUnsupported, |
| 1561 | "Reference subtraction: input 0 is not a supported type."); |
| 1562 | |
| 1563 | supported &= CheckSupportRule(TypeAnyOf(input1, supportedTypes), reasonIfUnsupported, |
| 1564 | "Reference subtraction: input 1 is not a supported type."); |
| 1565 | |
| 1566 | supported &= CheckSupportRule(TypeAnyOf(output, supportedTypes), reasonIfUnsupported, |
| 1567 | "Reference subtraction: output is not a supported type."); |
| 1568 | |
| 1569 | supported &= CheckSupportRule(TypesAreEqual(input0, input1), reasonIfUnsupported, |
| 1570 | "Reference subtraction: input 0 and Input 1 types are mismatched"); |
| 1571 | |
| 1572 | supported &= CheckSupportRule(TypesAreEqual(input0, output), reasonIfUnsupported, |
| 1573 | "Reference subtraction: input and output types are mismatched"); |
| 1574 | |
| 1575 | supported &= CheckSupportRule(ShapesAreBroadcastCompatible(input0, input1, output), reasonIfUnsupported, |
| 1576 | "Reference subtraction: shapes are not suitable for implicit broadcast."); |
| 1577 | |
| 1578 | return supported; |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 1579 | } |
| 1580 | |
Matteo Martincigh | ab9e525 | 2019-06-13 17:27:46 +0100 | [diff] [blame] | 1581 | bool RefLayerSupport::IsPreluSupported(const TensorInfo& input, |
| 1582 | const TensorInfo& alpha, |
| 1583 | const TensorInfo& output, |
| 1584 | Optional<std::string&> reasonIfUnsupported) const |
| 1585 | { |
| 1586 | bool supported = true; |
| 1587 | |
| 1588 | std::array<DataType, 3> supportedTypes |
| 1589 | { |
| 1590 | DataType::Float32, |
| 1591 | DataType::QuantisedAsymm8, |
| 1592 | DataType::QuantisedSymm16 |
| 1593 | }; |
| 1594 | |
| 1595 | supported &= CheckSupportRule(TypeAnyOf(input, supportedTypes), reasonIfUnsupported, |
| 1596 | "PReLU: input is not a supported type."); |
| 1597 | |
| 1598 | supported &= CheckSupportRule(TypeAnyOf(alpha, supportedTypes), reasonIfUnsupported, |
| 1599 | "PReLU: alpha is not a supported type."); |
| 1600 | |
| 1601 | supported &= CheckSupportRule(TypeAnyOf(output, supportedTypes), reasonIfUnsupported, |
| 1602 | "PReLU: output is not a supported type."); |
| 1603 | |
| 1604 | supported &= CheckSupportRule(TypesAreEqual(input, alpha, output), reasonIfUnsupported, |
| 1605 | "PReLU: input, alpha and output types are mismatched"); |
| 1606 | |
| 1607 | supported &= CheckSupportRule(ShapesAreBroadcastCompatible(input, alpha, output), reasonIfUnsupported, |
| 1608 | "PReLU: shapes are not suitable for implicit broadcast"); |
| 1609 | |
| 1610 | return supported; |
| 1611 | } |
| 1612 | |
Aron Virginas-Tar | 98180ef | 2019-06-26 15:02:47 +0100 | [diff] [blame] | 1613 | bool RefLayerSupport::IsTransposeConvolution2dSupported(const TensorInfo& input, |
| 1614 | const TensorInfo& output, |
| 1615 | const TransposeConvolution2dDescriptor& descriptor, |
| 1616 | const TensorInfo& weights, |
| 1617 | const Optional<TensorInfo>& biases, |
| 1618 | Optional<std::string&> reasonIfUnsupported) const |
| 1619 | { |
Aron Virginas-Tar | 98180ef | 2019-06-26 15:02:47 +0100 | [diff] [blame] | 1620 | bool supported = true; |
| 1621 | |
Matthew Jackson | 252df3a | 2019-09-11 09:19:18 +0100 | [diff] [blame^] | 1622 | std::array<DataType,4> supportedTypes = |
Aron Virginas-Tar | 98180ef | 2019-06-26 15:02:47 +0100 | [diff] [blame] | 1623 | { |
| 1624 | DataType::Float32, |
Matthew Jackson | 252df3a | 2019-09-11 09:19:18 +0100 | [diff] [blame^] | 1625 | DataType::Float16, |
Aron Virginas-Tar | 98180ef | 2019-06-26 15:02:47 +0100 | [diff] [blame] | 1626 | DataType::QuantisedAsymm8, |
| 1627 | DataType::QuantisedSymm16 |
| 1628 | }; |
| 1629 | |
| 1630 | supported &= CheckSupportRule(TypeAnyOf(input, supportedTypes), reasonIfUnsupported, |
| 1631 | "Reference TransposeConvolution2d: input is not a supported type."); |
| 1632 | |
| 1633 | supported &= CheckSupportRule(TypeAnyOf(output, supportedTypes), reasonIfUnsupported, |
| 1634 | "Reference TransposeConvolution2d: output is not a supported type."); |
| 1635 | |
| 1636 | supported &= CheckSupportRule(TypeAnyOf(weights, supportedTypes), reasonIfUnsupported, |
| 1637 | "Reference TransposeConvolution2d: weights is not a supported type."); |
| 1638 | |
| 1639 | supported &= CheckSupportRule(TypesAreEqual(input, output), reasonIfUnsupported, |
| 1640 | "Reference TransposeConvolution2d: input and output types mismatched."); |
| 1641 | |
| 1642 | supported &= CheckSupportRule(TypesAreEqual(input, weights), reasonIfUnsupported, |
| 1643 | "Reference TransposeConvolution2d: input and weights types mismatched."); |
| 1644 | |
| 1645 | if (biases.has_value()) |
| 1646 | { |
Matthew Jackson | 252df3a | 2019-09-11 09:19:18 +0100 | [diff] [blame^] | 1647 | std::array<DataType,3> biasesSupportedTypes = |
Aron Virginas-Tar | 651aafe | 2019-08-05 11:52:05 +0100 | [diff] [blame] | 1648 | { |
Aron Virginas-Tar | 98180ef | 2019-06-26 15:02:47 +0100 | [diff] [blame] | 1649 | DataType::Float32, |
Matthew Jackson | 252df3a | 2019-09-11 09:19:18 +0100 | [diff] [blame^] | 1650 | DataType::Float16, |
Aron Virginas-Tar | 98180ef | 2019-06-26 15:02:47 +0100 | [diff] [blame] | 1651 | DataType::Signed32 |
| 1652 | }; |
| 1653 | supported &= CheckSupportRule(TypeAnyOf(biases.value(), biasesSupportedTypes), reasonIfUnsupported, |
| 1654 | "Reference TransposeConvolution2d: biases is not a supported type."); |
| 1655 | } |
| 1656 | |
| 1657 | return supported; |
| 1658 | } |
| 1659 | |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 1660 | } // namespace armnn |