aboutsummaryrefslogtreecommitdiff
path: root/src/armnn/CompatibleTypes.hpp
blob: 4332f74b2397104e300e02eabaeb1891e81f594d (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
//
// Copyright © 2017 Arm Ltd. All rights reserved.
// SPDX-License-Identifier: MIT
//

#pragma once

#include "armnn/Types.hpp"
#include "Half.hpp"

namespace armnn
{

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

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

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

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

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

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

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

} //namespace armnn