treelite
load_data_counts.cc
Go to the documentation of this file.
1 
7 #include <cmath>
8 #include "./builder.h"
9 
10 namespace treelite {
11 namespace compiler {
12 
13 DMLC_REGISTRY_FILE_TAG(load_data_counts);
14 
15 static void load_data_counts(ASTNode* node,
16  const std::vector<std::vector<size_t>>& counts) {
17  if (node->tree_id >= 0 && node->node_id >= 0) {
18  node->data_count = counts[node->tree_id][node->node_id];
19  }
20  for (ASTNode* child : node->children) {
21  load_data_counts(child, counts);
22  }
23 }
24 
25 void
26 ASTBuilder::LoadDataCounts(const std::vector<std::vector<size_t>>& counts) {
27  load_data_counts(this->main_node, counts);
28 }
29 
30 } // namespace compiler
31 } // namespace treelite
AST Builder class.