treelite
Variables
code_folder_template.h File Reference

template for evaluation logic for folded code More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Variables

const char * eval_loop_template
 
const char * code_folder_arrays_template
 
const char * code_folder_arrays_declaration_template
 

Detailed Description

template for evaluation logic for folded code

Copyright (c) 2018 by Contributors

Author
Philip Cho

Definition in file code_folder_template.h.

Variable Documentation

const char* code_folder_arrays_declaration_template
Initial value:
=
R"TREELITETEMPLATE(
extern const struct Node {node_array_name}[];
extern const uint64_t {cat_bitmap_name}[];
extern const size_t {cat_begin_name}[];
)TREELITETEMPLATE"

Definition at line 49 of file code_folder_template.h.

const char* code_folder_arrays_template
Initial value:
=
R"TREELITETEMPLATE(
const struct Node {node_array_name}[] = {{
{array_nodes}
}};
const uint64_t {cat_bitmap_name}[] = {{
{array_cat_bitmap}
}};
const size_t {cat_begin_name}[] = {{
{array_cat_begin}
}};
)TREELITETEMPLATE"

Definition at line 34 of file code_folder_template.h.

const char* eval_loop_template
Initial value:
=
R"TREELITETEMPLATE(
nid = 0;
while (nid >= 0) {{ /* negative nid implies leaf */
fid = {node_array_name}[nid].split_index;
if (data[fid].missing == -1) {{
cond = {node_array_name}[nid].default_left;
}} else if (is_categorical[fid]) {{
tmp = (unsigned int)data[fid].fvalue;
cond = ({cat_bitmap_name}[{cat_begin_name}[nid] + tmp / 64] >> (tmp % 64)) & 1;
}} else {{
cond = (data[fid].{data_field} {comp_op} {node_array_name}[nid].threshold);
}}
nid = cond ? {node_array_name}[nid].left_child : {node_array_name}[nid].right_child;
}}
{output_switch_statement}
)TREELITETEMPLATE"

Definition at line 15 of file code_folder_template.h.