blob: 5b7feac387ee33d9c1b54b7cdff52f4bbd5f7efa (
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
|
//
// Copyright © 2017 Arm Ltd. All rights reserved.
// See LICENSE file in the project root for full license information.
//
#pragma once
#include <armnn/DescriptorsFwd.hpp>
#include <armnn/Types.hpp>
#include <armnn/Tensor.hpp>
namespace armnn
{
template<typename Float32Func, typename Uint8Func, typename ... Params>
bool IsSupportedForDataTypeGeneric(std::string* reasonIfUnsupported,
DataType dataType,
Float32Func floatFuncPtr,
Uint8Func uint8FuncPtr,
Params&&... params)
{
switch(dataType)
{
case DataType::Float32:
return floatFuncPtr(reasonIfUnsupported, std::forward<Params>(params)...);
case DataType::QuantisedAsymm8:
return uint8FuncPtr(reasonIfUnsupported, std::forward<Params>(params)...);
default:
return false;
}
}
template<typename ... Params>
bool TrueFunc(std::string* reasonIfUnsupported, Params&&... params)
{
return true;
}
template<typename ... Params>
bool FalseFunc(std::string* reasonIfUnsupported, Params&&... params)
{
return false;
}
template<typename ... Params>
bool FalseFuncF32(std::string* reasonIfUnsupported, Params&&... params)
{
if (reasonIfUnsupported)
{
*reasonIfUnsupported = "Layer is not supported with float32 data type";
}
return false;
}
template<typename ... Params>
bool FalseFuncU8(std::string* reasonIfUnsupported, Params&&... params)
{
if (reasonIfUnsupported)
{
*reasonIfUnsupported = "Layer is not supported with 8-bit data type";
}
return false;
}
}
|