Sadik Armagan | 1342bed | 2021-11-17 15:01:00 +0000 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2021 Arm Ltd and Contributors. All rights reserved. |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | #include <armnn/Types.hpp> |
| 6 | #include <armnnUtils/CompatibleTypes.hpp> |
| 7 | |
| 8 | #include "BFloat16.hpp" |
| 9 | #include "Half.hpp" |
| 10 | |
| 11 | using namespace armnn; |
| 12 | |
| 13 | namespace armnnUtils |
| 14 | { |
| 15 | |
| 16 | template<typename T> |
| 17 | bool CompatibleTypes(DataType) |
| 18 | { |
| 19 | return false; |
| 20 | } |
| 21 | |
| 22 | template<> |
| 23 | bool CompatibleTypes<float>(DataType dataType) |
| 24 | { |
| 25 | return dataType == DataType::Float32; |
| 26 | } |
| 27 | |
| 28 | template<> |
| 29 | bool CompatibleTypes<Half>(DataType dataType) |
| 30 | { |
| 31 | return dataType == DataType::Float16; |
| 32 | } |
| 33 | |
| 34 | template<> |
| 35 | bool CompatibleTypes<BFloat16>(DataType dataType) |
| 36 | { |
| 37 | return dataType == DataType::BFloat16; |
| 38 | } |
| 39 | |
| 40 | template<> |
| 41 | bool CompatibleTypes<uint8_t>(DataType dataType) |
| 42 | { |
| 43 | return dataType == DataType::Boolean || dataType == DataType::QAsymmU8; |
| 44 | } |
| 45 | |
| 46 | template<> |
| 47 | bool CompatibleTypes<int8_t>(DataType dataType) |
| 48 | { |
| 49 | return dataType == DataType::QSymmS8 |
| 50 | || dataType == DataType::QAsymmS8; |
| 51 | } |
| 52 | |
| 53 | template<> |
| 54 | bool CompatibleTypes<int16_t>(DataType dataType) |
| 55 | { |
| 56 | return dataType == DataType::QSymmS16; |
| 57 | } |
| 58 | |
| 59 | template<> |
| 60 | bool CompatibleTypes<int32_t>(DataType dataType) |
| 61 | { |
| 62 | return dataType == DataType::Signed32; |
| 63 | } |
| 64 | |
| 65 | } //namespace armnnUtils |