template for evaluation logic for folded code
More...
Go to the source code of this file.
|
const char * | eval_loop_template |
|
const char * | eval_loop_template_without_categorical_feature |
|
template for evaluation logic for folded code
Copyright (c) 2018 by Contributors
- Author
- Philip Cho
Definition in file code_folder_template.h.
◆ eval_loop_template
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.
◆ eval_loop_template_without_categorical_feature
const char* eval_loop_template_without_categorical_feature |
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 {{
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 34 of file code_folder_template.h.