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_global_bias(void);
22
{dllexport}const char* get_threshold_type(void);
23
{dllexport}const char* get_leaf_output_type(void);
24
)TREELITETEMPLATE";
25
26
const
char
*
const
header_template =
27
R
"TREELITETEMPLATE(
28
#include <stdio.h>
29
#include <stdlib.h>
30
#include <string.h>
31
#include <math.h>
32
#include <stdint.h>
33
34
#if defined(__clang__) || defined(__GNUC__)
35
#define LIKELY(x) __builtin_expect(!!(x), 1)
36
#define UNLIKELY(x) __builtin_expect(!!(x), 0)
37
#else
38
#define LIKELY(x) (x)
39
#define UNLIKELY(x) (x)
40
#endif
41
42
union Entry {{
43
int missing;
44
{threshold_type} fvalue;
45
int qvalue;
46
}};
47
48
struct Node {{
49
uint8_t default_left;
50
unsigned int split_index;
51
{threshold_type_Node} threshold;
52
int left_child;
53
int right_child;
54
}};
55
56
extern const unsigned char is_categorical[];
57
58
{query_functions_prototype}
59
{dllexport}{predict_function_signature};
60
)TREELITETEMPLATE";
61
62
}
// namespace native
63
}
// namespace compiler
64
}
// namespace treelite
65
#endif // TREELITE_COMPILER_NATIVE_HEADER_TEMPLATE_H_
treelite
Definition:
annotator.h:18
Generated by
1.8.13