telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2017 Arm Ltd. All rights reserved. |
David Beck | ecb56cd | 2018-09-05 12:52:57 +0100 | [diff] [blame] | 3 | // SPDX-License-Identifier: MIT |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 4 | // |
| 5 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 6 | #include "RefLayerSupport.hpp" |
David Beck | 3e9e115 | 2018-10-17 14:17:50 +0100 | [diff] [blame] | 7 | #include "RefBackendId.hpp" |
David Beck | 3cc9a62 | 2018-10-12 10:38:31 +0100 | [diff] [blame] | 8 | |
Aron Virginas-Tar | c9cc804 | 2018-11-01 16:15:57 +0000 | [diff] [blame] | 9 | #include <InternalTypes.hpp> |
| 10 | #include <LayerSupportCommon.hpp> |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 11 | #include <armnn/Types.hpp> |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 12 | |
Aron Virginas-Tar | c9cc804 | 2018-11-01 16:15:57 +0000 | [diff] [blame] | 13 | #include <backendsCommon/LayerSupportRegistry.hpp> |
David Beck | 3e9e115 | 2018-10-17 14:17:50 +0100 | [diff] [blame] | 14 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 15 | #include <boost/core/ignore_unused.hpp> |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 16 | |
| 17 | using namespace boost; |
| 18 | |
| 19 | namespace armnn |
| 20 | { |
| 21 | |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 22 | namespace |
| 23 | { |
| 24 | |
David Beck | 3e9e115 | 2018-10-17 14:17:50 +0100 | [diff] [blame] | 25 | ILayerSupportSharedPtr GetLayerSupportPointer() |
| 26 | { |
| 27 | static ILayerSupportSharedPtr instance{new RefLayerSupport}; |
| 28 | return instance; |
| 29 | } |
| 30 | |
| 31 | static StaticRegistryInitializer<LayerSupportRegistry> g_RegisterHelper{ |
| 32 | LayerSupportRegistryInstance(), |
| 33 | RefBackendId(), |
David Beck | 9efb57d | 2018-11-05 13:40:33 +0000 | [diff] [blame] | 34 | []() |
David Beck | 3e9e115 | 2018-10-17 14:17:50 +0100 | [diff] [blame] | 35 | { |
| 36 | return GetLayerSupportPointer(); |
| 37 | } |
| 38 | }; |
| 39 | |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 40 | template<typename Float32Func, typename Uint8Func, typename ... Params> |
| 41 | bool IsSupportedForDataTypeRef(Optional<std::string&> reasonIfUnsupported, |
| 42 | DataType dataType, |
| 43 | Float32Func floatFuncPtr, |
| 44 | Uint8Func uint8FuncPtr, |
| 45 | Params&&... params) |
| 46 | { |
| 47 | return IsSupportedForDataTypeGeneric(reasonIfUnsupported, |
| 48 | dataType, |
| 49 | &FalseFunc<Params...>, |
| 50 | floatFuncPtr, |
| 51 | uint8FuncPtr, |
| 52 | std::forward<Params>(params)...); |
| 53 | } |
| 54 | |
| 55 | } // anonymous namespace |
| 56 | |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 57 | bool RefLayerSupport::IsActivationSupported(const TensorInfo& input, |
| 58 | const TensorInfo& output, |
| 59 | const ActivationDescriptor& descriptor, |
| 60 | Optional<std::string&> reasonIfUnsupported) const |
| 61 | { |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 62 | ignore_unused(output); |
| 63 | ignore_unused(descriptor); |
| 64 | return IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 65 | input.GetDataType(), |
| 66 | &TrueFunc<>, |
| 67 | &TrueFunc<>); |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 68 | } |
| 69 | |
| 70 | bool RefLayerSupport::IsAdditionSupported(const TensorInfo& input0, |
| 71 | const TensorInfo& input1, |
| 72 | const TensorInfo& output, |
| 73 | Optional<std::string&> reasonIfUnsupported) const |
| 74 | { |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 75 | ignore_unused(input1); |
| 76 | ignore_unused(output); |
| 77 | return IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 78 | input0.GetDataType(), |
| 79 | &TrueFunc<>, |
| 80 | &TrueFunc<>); |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 81 | } |
| 82 | |
| 83 | bool RefLayerSupport::IsBatchNormalizationSupported(const TensorInfo& input, |
| 84 | const TensorInfo& output, |
| 85 | const TensorInfo& mean, |
| 86 | const TensorInfo& var, |
| 87 | const TensorInfo& beta, |
| 88 | const TensorInfo& gamma, |
| 89 | const BatchNormalizationDescriptor& descriptor, |
| 90 | Optional<std::string&> reasonIfUnsupported) const |
| 91 | { |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 92 | ignore_unused(output); |
| 93 | ignore_unused(mean); |
| 94 | ignore_unused(var); |
| 95 | ignore_unused(beta); |
| 96 | ignore_unused(gamma); |
| 97 | ignore_unused(descriptor); |
| 98 | return IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 99 | input.GetDataType(), |
| 100 | &TrueFunc<>, |
| 101 | &TrueFunc<>); |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 102 | } |
| 103 | |
Éanna Ó Catháin | 4e1e136 | 2018-11-12 11:36:34 +0000 | [diff] [blame^] | 104 | bool RefLayerSupport::IsBatchToSpaceNdSupported(const TensorInfo& input, |
| 105 | const TensorInfo& output, |
| 106 | const BatchToSpaceNdDescriptor& descriptor, |
| 107 | Optional<std::string&> reasonIfUnsupported) const |
| 108 | { |
| 109 | ignore_unused(descriptor); |
| 110 | return (IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 111 | input.GetDataType(), |
| 112 | &TrueFunc<>, |
| 113 | &TrueFunc<>) && |
| 114 | IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 115 | output.GetDataType(), |
| 116 | &TrueFunc<>, |
| 117 | &TrueFunc<>)); |
| 118 | } |
| 119 | |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 120 | bool RefLayerSupport::IsConstantSupported(const TensorInfo& output, |
| 121 | Optional<std::string&> reasonIfUnsupported) const |
| 122 | { |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 123 | return IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 124 | output.GetDataType(), |
| 125 | &TrueFunc<>, |
| 126 | &TrueFunc<>); |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 127 | } |
| 128 | |
| 129 | bool RefLayerSupport::IsConvertFp16ToFp32Supported(const TensorInfo& input, |
| 130 | const TensorInfo& output, |
| 131 | Optional<std::string&> reasonIfUnsupported) const |
| 132 | { |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 133 | return (IsSupportedForDataTypeGeneric(reasonIfUnsupported, |
| 134 | input.GetDataType(), |
| 135 | &TrueFunc<>, |
| 136 | &FalseInputFuncF32<>, |
| 137 | &FalseFuncU8<>) && |
| 138 | IsSupportedForDataTypeGeneric(reasonIfUnsupported, |
| 139 | output.GetDataType(), |
| 140 | &FalseOutputFuncF16<>, |
| 141 | &TrueFunc<>, |
| 142 | &FalseFuncU8<>)); |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 143 | } |
| 144 | |
| 145 | bool RefLayerSupport::IsConvertFp32ToFp16Supported(const TensorInfo& input, |
| 146 | const TensorInfo& output, |
| 147 | Optional<std::string&> reasonIfUnsupported) const |
| 148 | { |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 149 | return (IsSupportedForDataTypeGeneric(reasonIfUnsupported, |
| 150 | input.GetDataType(), |
| 151 | &FalseInputFuncF16<>, |
| 152 | &TrueFunc<>, |
| 153 | &FalseFuncU8<>) && |
| 154 | IsSupportedForDataTypeGeneric(reasonIfUnsupported, |
| 155 | output.GetDataType(), |
| 156 | &TrueFunc<>, |
| 157 | &FalseOutputFuncF32<>, |
| 158 | &FalseFuncU8<>)); |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 159 | } |
| 160 | |
| 161 | bool RefLayerSupport::IsConvolution2dSupported(const TensorInfo& input, |
| 162 | const TensorInfo& output, |
| 163 | const Convolution2dDescriptor& descriptor, |
| 164 | const TensorInfo& weights, |
| 165 | const Optional<TensorInfo>& biases, |
| 166 | Optional<std::string&> reasonIfUnsupported) const |
| 167 | { |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 168 | ignore_unused(output); |
| 169 | ignore_unused(descriptor); |
| 170 | ignore_unused(weights); |
| 171 | ignore_unused(biases); |
| 172 | return IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 173 | input.GetDataType(), |
| 174 | &TrueFunc<>, |
| 175 | &TrueFunc<>); |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 176 | } |
| 177 | |
| 178 | bool RefLayerSupport::IsDepthwiseConvolutionSupported(const TensorInfo& input, |
| 179 | const TensorInfo& output, |
| 180 | const DepthwiseConvolution2dDescriptor& descriptor, |
| 181 | const TensorInfo& weights, |
| 182 | const Optional<TensorInfo>& biases, |
| 183 | Optional<std::string&> reasonIfUnsupported) const |
| 184 | { |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 185 | ignore_unused(output); |
| 186 | ignore_unused(descriptor); |
| 187 | ignore_unused(weights); |
| 188 | ignore_unused(biases); |
| 189 | return IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 190 | input.GetDataType(), |
| 191 | &TrueFunc<>, |
| 192 | &TrueFunc<>); |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 193 | } |
| 194 | |
| 195 | bool RefLayerSupport::IsDivisionSupported(const TensorInfo& input0, |
| 196 | const TensorInfo& input1, |
| 197 | const TensorInfo& output, |
| 198 | Optional<std::string&> reasonIfUnsupported) const |
| 199 | { |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 200 | ignore_unused(input1); |
| 201 | ignore_unused(output); |
| 202 | return IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 203 | input0.GetDataType(), |
| 204 | &TrueFunc<>, |
| 205 | &TrueFunc<>); |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 206 | } |
| 207 | |
| 208 | bool RefLayerSupport::IsFakeQuantizationSupported(const TensorInfo& input, |
| 209 | const FakeQuantizationDescriptor& descriptor, |
| 210 | Optional<std::string&> reasonIfUnsupported) const |
| 211 | { |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 212 | ignore_unused(descriptor); |
| 213 | return IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 214 | input.GetDataType(), |
| 215 | &TrueFunc<>, |
| 216 | &FalseFuncU8<>); |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 217 | } |
| 218 | |
| 219 | bool RefLayerSupport::IsFloorSupported(const TensorInfo& input, |
| 220 | const TensorInfo& output, |
| 221 | Optional<std::string&> reasonIfUnsupported) const |
| 222 | { |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 223 | ignore_unused(output); |
| 224 | return IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 225 | input.GetDataType(), |
| 226 | &TrueFunc<>, |
| 227 | &FalseFuncU8<>); |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 228 | } |
| 229 | |
| 230 | bool RefLayerSupport::IsFullyConnectedSupported(const TensorInfo& input, |
| 231 | const TensorInfo& output, |
| 232 | const TensorInfo& weights, |
| 233 | const TensorInfo& biases, |
| 234 | const FullyConnectedDescriptor& descriptor, |
| 235 | Optional<std::string&> reasonIfUnsupported) const |
| 236 | { |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 237 | ignore_unused(output); |
| 238 | ignore_unused(weights); |
| 239 | ignore_unused(biases); |
| 240 | ignore_unused(descriptor); |
| 241 | return IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 242 | input.GetDataType(), |
| 243 | &TrueFunc<>, |
| 244 | &TrueFunc<>); |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 245 | } |
| 246 | |
| 247 | bool RefLayerSupport::IsInputSupported(const TensorInfo& input, |
| 248 | Optional<std::string&> reasonIfUnsupported) const |
| 249 | { |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 250 | return IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 251 | input.GetDataType(), |
| 252 | &TrueFunc<>, |
| 253 | &TrueFunc<>); |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 254 | } |
| 255 | |
| 256 | bool RefLayerSupport::IsL2NormalizationSupported(const TensorInfo& input, |
| 257 | const TensorInfo& output, |
| 258 | const L2NormalizationDescriptor& descriptor, |
| 259 | Optional<std::string&> reasonIfUnsupported) const |
| 260 | { |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 261 | ignore_unused(output); |
| 262 | ignore_unused(descriptor); |
| 263 | return IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 264 | input.GetDataType(), |
| 265 | &TrueFunc<>, |
| 266 | &FalseFuncU8<>); |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 267 | } |
| 268 | |
| 269 | bool RefLayerSupport::IsLstmSupported(const TensorInfo& input, |
| 270 | const TensorInfo& outputStateIn, |
| 271 | const TensorInfo& cellStateIn, |
| 272 | const TensorInfo& scratchBuffer, |
| 273 | const TensorInfo& outputStateOut, |
| 274 | const TensorInfo& cellStateOut, |
| 275 | const TensorInfo& output, |
| 276 | const LstmDescriptor& descriptor, |
| 277 | const TensorInfo& inputToForgetWeights, |
| 278 | const TensorInfo& inputToCellWeights, |
| 279 | const TensorInfo& inputToOutputWeights, |
| 280 | const TensorInfo& recurrentToForgetWeights, |
| 281 | const TensorInfo& recurrentToCellWeights, |
| 282 | const TensorInfo& recurrentToOutputWeights, |
| 283 | const TensorInfo& forgetGateBias, |
| 284 | const TensorInfo& cellBias, |
| 285 | const TensorInfo& outputGateBias, |
| 286 | const TensorInfo* inputToInputWeights, |
| 287 | const TensorInfo* recurrentToInputWeights, |
| 288 | const TensorInfo* cellToInputWeights, |
| 289 | const TensorInfo* inputGateBias, |
| 290 | const TensorInfo* projectionWeights, |
| 291 | const TensorInfo* projectionBias, |
| 292 | const TensorInfo* cellToForgetWeights, |
| 293 | const TensorInfo* cellToOutputWeights, |
| 294 | Optional<std::string&> reasonIfUnsupported) const |
| 295 | { |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 296 | ignore_unused(input); |
| 297 | ignore_unused(outputStateIn); |
| 298 | ignore_unused(cellStateIn); |
| 299 | ignore_unused(scratchBuffer); |
| 300 | ignore_unused(outputStateOut); |
| 301 | ignore_unused(cellStateOut); |
| 302 | ignore_unused(output); |
| 303 | ignore_unused(descriptor); |
| 304 | ignore_unused(inputToForgetWeights); |
| 305 | ignore_unused(inputToCellWeights); |
| 306 | ignore_unused(inputToOutputWeights); |
| 307 | ignore_unused(recurrentToForgetWeights); |
| 308 | ignore_unused(recurrentToCellWeights); |
| 309 | ignore_unused(recurrentToOutputWeights); |
| 310 | ignore_unused(forgetGateBias); |
| 311 | ignore_unused(cellBias); |
| 312 | ignore_unused(outputGateBias); |
| 313 | ignore_unused(inputToInputWeights); |
| 314 | ignore_unused(recurrentToInputWeights); |
| 315 | ignore_unused(cellToInputWeights); |
| 316 | ignore_unused(inputGateBias); |
| 317 | ignore_unused(projectionWeights); |
| 318 | ignore_unused(projectionBias); |
| 319 | ignore_unused(cellToForgetWeights); |
| 320 | ignore_unused(cellToOutputWeights); |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 321 | ignore_unused(reasonIfUnsupported); |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 322 | return false; |
| 323 | } |
| 324 | |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 325 | bool RefLayerSupport::IsMeanSupported(const TensorInfo& input, |
| 326 | const TensorInfo& output, |
| 327 | const MeanDescriptor& descriptor, |
| 328 | Optional<std::string&> reasonIfUnsupported) const |
narpra01 | 32b9046 | 2018-09-13 11:07:48 +0100 | [diff] [blame] | 329 | { |
narpra01 | 1e4c31d | 2018-09-28 11:07:51 +0100 | [diff] [blame] | 330 | ignore_unused(output); |
| 331 | ignore_unused(descriptor); |
| 332 | return IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 333 | input.GetDataType(), |
| 334 | &TrueFunc<>, |
| 335 | &TrueFunc<>); |
narpra01 | 32b9046 | 2018-09-13 11:07:48 +0100 | [diff] [blame] | 336 | } |
| 337 | |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 338 | bool RefLayerSupport::IsMergerSupported(const std::vector<const TensorInfo*> inputs, |
| 339 | const OriginsDescriptor& descriptor, |
| 340 | Optional<std::string&> reasonIfUnsupported) const |
| 341 | { |
| 342 | ignore_unused(descriptor); |
| 343 | return IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 344 | inputs[0]->GetDataType(), |
| 345 | &TrueFunc<>, |
| 346 | &TrueFunc<>); |
| 347 | } |
| 348 | |
| 349 | bool RefLayerSupport::IsMultiplicationSupported(const TensorInfo& input0, |
| 350 | const TensorInfo& input1, |
| 351 | const TensorInfo& output, |
| 352 | Optional<std::string&> reasonIfUnsupported) const |
| 353 | { |
| 354 | ignore_unused(input1); |
| 355 | ignore_unused(output); |
| 356 | return IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 357 | input0.GetDataType(), |
| 358 | &TrueFunc<>, |
| 359 | &TrueFunc<>); |
| 360 | } |
| 361 | |
| 362 | bool RefLayerSupport::IsNormalizationSupported(const TensorInfo& input, |
| 363 | const TensorInfo& output, |
| 364 | const NormalizationDescriptor& descriptor, |
| 365 | Optional<std::string&> reasonIfUnsupported) const |
Nina Drozd | 661dfa7 | 2018-10-02 11:14:17 +0100 | [diff] [blame] | 366 | { |
| 367 | ignore_unused(output); |
| 368 | ignore_unused(descriptor); |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 369 | return IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 370 | input.GetDataType(), |
| 371 | &TrueFunc<>, |
| 372 | &FalseFuncU8<>); |
| 373 | } |
| 374 | |
| 375 | bool RefLayerSupport::IsOutputSupported(const TensorInfo& output, |
| 376 | Optional<std::string&> reasonIfUnsupported) const |
| 377 | { |
| 378 | return IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 379 | output.GetDataType(), |
| 380 | &TrueFunc<>, |
| 381 | &TrueFunc<>); |
| 382 | } |
| 383 | |
| 384 | bool RefLayerSupport::IsPadSupported(const TensorInfo& input, |
| 385 | const TensorInfo& output, |
| 386 | const PadDescriptor& descriptor, |
| 387 | Optional<std::string&> reasonIfUnsupported) const |
| 388 | { |
| 389 | ignore_unused(input); |
| 390 | ignore_unused(output); |
| 391 | ignore_unused(descriptor); |
| 392 | ignore_unused(reasonIfUnsupported); |
Nina Drozd | 661dfa7 | 2018-10-02 11:14:17 +0100 | [diff] [blame] | 393 | return false; |
| 394 | } |
| 395 | |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 396 | bool RefLayerSupport::IsPermuteSupported(const TensorInfo& input, |
| 397 | const TensorInfo& output, |
| 398 | const PermuteDescriptor& descriptor, |
| 399 | Optional<std::string&> reasonIfUnsupported) const |
| 400 | { |
| 401 | ignore_unused(output); |
| 402 | ignore_unused(descriptor); |
| 403 | return IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 404 | input.GetDataType(), |
| 405 | &TrueFunc<>, |
| 406 | &TrueFunc<>); |
| 407 | } |
| 408 | |
| 409 | bool RefLayerSupport::IsPooling2dSupported(const TensorInfo& input, |
| 410 | const TensorInfo& output, |
| 411 | const Pooling2dDescriptor& descriptor, |
| 412 | Optional<std::string&> reasonIfUnsupported) const |
| 413 | { |
| 414 | ignore_unused(output); |
| 415 | ignore_unused(descriptor); |
| 416 | return IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 417 | input.GetDataType(), |
| 418 | &TrueFunc<>, |
| 419 | &TrueFunc<>); |
| 420 | } |
| 421 | |
| 422 | bool RefLayerSupport::IsReshapeSupported(const TensorInfo& input, |
| 423 | Optional<std::string&> reasonIfUnsupported) const |
| 424 | { |
| 425 | return IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 426 | input.GetDataType(), |
| 427 | &TrueFunc<>, |
| 428 | &TrueFunc<>); |
| 429 | } |
| 430 | |
| 431 | bool RefLayerSupport::IsResizeBilinearSupported(const TensorInfo& input, |
| 432 | Optional<std::string&> reasonIfUnsupported) const |
| 433 | { |
| 434 | return IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 435 | input.GetDataType(), |
| 436 | &TrueFunc<>, |
| 437 | &TrueFunc<>); |
| 438 | } |
| 439 | |
| 440 | bool RefLayerSupport::IsSoftmaxSupported(const TensorInfo& input, |
| 441 | const TensorInfo& output, |
| 442 | const SoftmaxDescriptor& descriptor, |
| 443 | Optional<std::string&> reasonIfUnsupported) const |
| 444 | { |
| 445 | ignore_unused(output); |
| 446 | ignore_unused(descriptor); |
| 447 | return IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 448 | input.GetDataType(), |
| 449 | &TrueFunc<>, |
| 450 | &TrueFunc<>); |
| 451 | } |
| 452 | |
Nattapat Chaimanowong | 3ea76d5 | 2018-11-09 14:10:38 +0000 | [diff] [blame] | 453 | bool RefLayerSupport::IsSpaceToBatchNdSupported(const TensorInfo& input, |
| 454 | const TensorInfo& output, |
| 455 | const SpaceToBatchNdDescriptor& descriptor, |
| 456 | Optional<std::string&> reasonIfUnsupported) const |
| 457 | { |
| 458 | ignore_unused(output); |
| 459 | ignore_unused(descriptor); |
| 460 | return IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 461 | input.GetDataType(), |
| 462 | &TrueFunc<>, |
| 463 | &TrueFunc<>); |
| 464 | } |
| 465 | |
Aron Virginas-Tar | b5acbb7 | 2018-10-15 11:11:51 +0100 | [diff] [blame] | 466 | bool RefLayerSupport::IsSplitterSupported(const TensorInfo& input, |
| 467 | const ViewsDescriptor& descriptor, |
| 468 | Optional<std::string&> reasonIfUnsupported) const |
| 469 | { |
| 470 | ignore_unused(descriptor); |
| 471 | return IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 472 | input.GetDataType(), |
| 473 | &TrueFunc<>, |
| 474 | &TrueFunc<>); |
| 475 | } |
| 476 | |
| 477 | bool RefLayerSupport::IsSubtractionSupported(const TensorInfo& input0, |
| 478 | const TensorInfo& input1, |
| 479 | const TensorInfo& output, |
| 480 | Optional<std::string&> reasonIfUnsupported) const |
| 481 | { |
| 482 | ignore_unused(input1); |
| 483 | ignore_unused(output); |
| 484 | return IsSupportedForDataTypeRef(reasonIfUnsupported, |
| 485 | input0.GetDataType(), |
| 486 | &TrueFunc<>, |
| 487 | &TrueFunc<>); |
| 488 | } |
| 489 | |
arovir01 | 1c7c81b | 2018-10-08 11:34:28 +0100 | [diff] [blame] | 490 | } // namespace armnn |