Treelite
src
compiler
native
header_template.h
Go to the documentation of this file.
1
8
#ifndef TREELITE_COMPILER_NATIVE_HEADER_TEMPLATE_H_
9
#define TREELITE_COMPILER_NATIVE_HEADER_TEMPLATE_H_
10
11
namespace
treelite
{
12
namespace
compiler {
13
namespace
native {
14
15
const
char
*
const
query_functions_prototype_template =
16
R
"TREELITETEMPLATE(
17
{dllexport}size_t get_num_class(void);
18
{dllexport}size_t get_num_feature(void);
19
{dllexport}const char* get_pred_transform(void);
20
{dllexport}float get_sigmoid_alpha(void);
21
{dllexport}float get_ratio_c(void);
22
{dllexport}float get_global_bias(void);
23
{dllexport}const char* get_threshold_type(void);
24
{dllexport}const char* get_leaf_output_type(void);
25
)TREELITETEMPLATE";
26
27
const
char
*
const
header_template =
28
R
"TREELITETEMPLATE(
29
#include <stdio.h>
30
#include <stdlib.h>
31
#include <string.h>
32
#include <float.h>
33
#include <math.h>
34
#include <stdint.h>
35
36
#if defined(__clang__) || defined(__GNUC__)
37
#define LIKELY(x) __builtin_expect(!!(x), 1)
38
#define UNLIKELY(x) __builtin_expect(!!(x), 0)
39
#else
40
#define LIKELY(x) (x)
41
#define UNLIKELY(x) (x)
42
#endif
43
44
union Entry {{
45
int missing;
46
{threshold_type} fvalue;
47
int qvalue;
48
}};
49
50
struct Node {{
51
uint8_t default_left;
52
unsigned int split_index;
53
{threshold_type_Node} threshold;
54
int left_child;
55
int right_child;
56
}};
57
58
extern const unsigned char is_categorical[];
59
60
{query_functions_prototype}
61
{dllexport}{predict_function_signature};
62
)TREELITETEMPLATE";
63
64
}
// namespace native
65
}
// namespace compiler
66
}
// namespace treelite
67
#endif // TREELITE_COMPILER_NATIVE_HEADER_TEMPLATE_H_
treelite
Definition:
annotator.h:18
Generated by
1.8.13