aboutsummaryrefslogtreecommitdiff
path: root/src/armnnUtils/CompatibleTypes.cpp
blob: 726051608d742d2e6acc70a57da80ee882d2b0be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
//
// Copyright © 2019-2021, 2024 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#include <armnn/Types.hpp>
#include <armnnUtils/CompatibleTypes.hpp>

#include "BFloat16.hpp"
#include "Half.hpp"

using namespace armnn;

namespace armnnUtils
{

template<typename T>
bool CompatibleTypes(DataType)
{
    return false;
}

template<>
bool CompatibleTypes<float>(DataType dataType)
{
    return dataType == DataType::Float32;
}

template<>
bool CompatibleTypes<Half>(DataType dataType)
{
    return dataType == DataType::Float16;
}

template<>
bool CompatibleTypes<BFloat16>(DataType dataType)
{
    return dataType == DataType::BFloat16;
}

template<>
bool CompatibleTypes<uint8_t>(DataType dataType)
{
    return dataType == DataType::Boolean || dataType == DataType::QAsymmU8;
}

template<>
bool CompatibleTypes<int8_t>(DataType dataType)
{
    return dataType == DataType::QSymmS8
        || dataType == DataType::QAsymmS8;
}

template<>
bool CompatibleTypes<int16_t>(DataType dataType)
{
    return dataType == DataType::QSymmS16;
}

template<>
bool CompatibleTypes<int32_t>(DataType dataType)
{
    return dataType == DataType::Signed32;
}

template<>
bool CompatibleTypes<int64_t>(DataType dataType)
{
    return dataType == DataType::Signed64;
}

} //namespace armnnUtils