aboutsummaryrefslogtreecommitdiff
path: root/src/armnn/CompatibleTypes.hpp
blob: bca092ca0c12aa0a8701e9c37ef3a86698d322df (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
//
// 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)
{
    return dataType == DataType::QSymmS8 || dataType == DataType::QuantizedSymm8PerAxis;
}

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