Classes | Public Member Functions | List of all members
ML::experimental::fil::treelite_importer< layout > Struct Template Reference

#include <treelite_importer.hpp>

Collaboration diagram for ML::experimental::fil::treelite_importer< layout >:
Collaboration graph

Classes

struct  treelite_node
 

Public Member Functions

template<typename tl_threshold_t , typename tl_output_t , typename lambda_t >
void node_for_each (treelite::Tree< tl_threshold_t, tl_output_t > const &tl_tree, lambda_t &&lambda)
 
template<typename tl_threshold_t , typename tl_output_t , typename iter_t , typename lambda_t >
void node_transform (treelite::Tree< tl_threshold_t, tl_output_t > const &tl_tree, iter_t output_iter, lambda_t &&lambda)
 
template<typename tl_threshold_t , typename tl_output_t , typename T , typename lambda_t >
auto node_accumulate (treelite::Tree< tl_threshold_t, tl_output_t > const &tl_tree, T init, lambda_t &&lambda)
 
template<typename tl_threshold_t , typename tl_output_t >
auto get_nodes (treelite::Tree< tl_threshold_t, tl_output_t > const &tl_tree)
 
template<typename tl_threshold_t , typename tl_output_t >
auto get_offsets (treelite::Tree< tl_threshold_t, tl_output_t > const &tl_tree)
 
template<typename lambda_t >
void tree_for_each (treelite::Model const &tl_model, lambda_t &&lambda)
 
template<typename iter_t , typename lambda_t >
void tree_transform (treelite::Model const &tl_model, iter_t output_iter, lambda_t &&lambda)
 
template<typename T , typename lambda_t >
auto tree_accumulate (treelite::Model const &tl_model, T init, lambda_t &&lambda)
 
auto num_trees (treelite::Model const &tl_model)
 
auto get_offsets (treelite::Model const &tl_model)
 
auto get_tree_sizes (treelite::Model const &tl_model)
 
auto get_num_class (treelite::Model const &tl_model)
 
auto get_num_feature (treelite::Model const &tl_model)
 
auto get_max_num_categories (treelite::Model const &tl_model)
 
auto get_num_categorical_nodes (treelite::Model const &tl_model)
 
auto get_num_leaf_vector_nodes (treelite::Model const &tl_model)
 
auto get_average_factor (treelite::Model const &tl_model)
 
auto get_bias (treelite::Model const &tl_model)
 
auto get_postproc_params (treelite::Model const &tl_model)
 
auto uses_double_thresholds (treelite::Model const &tl_model)
 
auto uses_double_outputs (treelite::Model const &tl_model)
 
auto uses_integer_outputs (treelite::Model const &tl_model)
 
template<index_type variant_index>
auto import_to_specific_variant (index_type target_variant_index, treelite::Model const &tl_model, index_type num_class, index_type num_feature, index_type max_num_categories, std::vector< std::vector< index_type >> const &offsets, index_type align_bytes=index_type{}, raft_proto::device_type mem_type=raft_proto::device_type::cpu, int device=0, raft_proto::cuda_stream stream=raft_proto::cuda_stream{})
 
auto import (treelite::Model const &tl_model, index_type align_bytes=index_type{}, std::optional< bool > use_double_precision=std::nullopt, raft_proto::device_type dev_type=raft_proto::device_type::cpu, int device=0, raft_proto::cuda_stream stream=raft_proto::cuda_stream{})
 

Detailed Description

template<tree_layout layout>
struct ML::experimental::fil::treelite_importer< layout >

Struct used to import a model from Treelite to FIL

Template Parameters
layoutThe in-memory layout for nodes to be loaded into FIL

Member Function Documentation

◆ get_average_factor()

template<tree_layout layout>
auto ML::experimental::fil::treelite_importer< layout >::get_average_factor ( treelite::Model const &  tl_model)
inline

◆ get_bias()

template<tree_layout layout>
auto ML::experimental::fil::treelite_importer< layout >::get_bias ( treelite::Model const &  tl_model)
inline

◆ get_max_num_categories()

template<tree_layout layout>
auto ML::experimental::fil::treelite_importer< layout >::get_max_num_categories ( treelite::Model const &  tl_model)
inline

◆ get_nodes()

template<tree_layout layout>
template<typename tl_threshold_t , typename tl_output_t >
auto ML::experimental::fil::treelite_importer< layout >::get_nodes ( treelite::Tree< tl_threshold_t, tl_output_t > const &  tl_tree)
inline

◆ get_num_categorical_nodes()

template<tree_layout layout>
auto ML::experimental::fil::treelite_importer< layout >::get_num_categorical_nodes ( treelite::Model const &  tl_model)
inline

◆ get_num_class()

template<tree_layout layout>
auto ML::experimental::fil::treelite_importer< layout >::get_num_class ( treelite::Model const &  tl_model)
inline

◆ get_num_feature()

template<tree_layout layout>
auto ML::experimental::fil::treelite_importer< layout >::get_num_feature ( treelite::Model const &  tl_model)
inline

◆ get_num_leaf_vector_nodes()

template<tree_layout layout>
auto ML::experimental::fil::treelite_importer< layout >::get_num_leaf_vector_nodes ( treelite::Model const &  tl_model)
inline

◆ get_offsets() [1/2]

template<tree_layout layout>
auto ML::experimental::fil::treelite_importer< layout >::get_offsets ( treelite::Model const &  tl_model)
inline

◆ get_offsets() [2/2]

template<tree_layout layout>
template<typename tl_threshold_t , typename tl_output_t >
auto ML::experimental::fil::treelite_importer< layout >::get_offsets ( treelite::Tree< tl_threshold_t, tl_output_t > const &  tl_tree)
inline

◆ get_postproc_params()

template<tree_layout layout>
auto ML::experimental::fil::treelite_importer< layout >::get_postproc_params ( treelite::Model const &  tl_model)
inline

◆ get_tree_sizes()

template<tree_layout layout>
auto ML::experimental::fil::treelite_importer< layout >::get_tree_sizes ( treelite::Model const &  tl_model)
inline

◆ import()

template<tree_layout layout>
auto ML::experimental::fil::treelite_importer< layout >::import ( treelite::Model const &  tl_model,
index_type  align_bytes = index_type{},
std::optional< bool >  use_double_precision = std::nullopt,
raft_proto::device_type  dev_type = raft_proto::device_type::cpu,
int  device = 0,
raft_proto::cuda_stream  stream = raft_proto::cuda_stream{} 
)
inline

Import a treelite model to FIL

Load a model from Treelite to a FIL forest_model. The model will be inspected to determine the correct underlying decision_forest variant to use within the forest_model object.

Parameters
tl_modelThe Treelite Model to load
align_bytesIf non-zero, ensure that each tree is stored in a multiple of this value of bytes by padding with empty nodes. This can be useful for increasing the likelihood that successive reads will take place within a single cache line. On GPU, a value of 128 can be used for this purpose. On CPU, a value of either 0 or 64 typically produces optimal performance.
use_double_precisionWhether or not to use 64 bit floats for model evaluation and 64 bit ints for applicable indexing
dev_typeWhich device type to use for inference (CPU or GPU)
deviceFor GPU execution, the device id for the device on which this model is to be loaded
streamThe CUDA stream to use for loading this model (can be omitted for CPU).

◆ import_to_specific_variant()

template<tree_layout layout>
template<index_type variant_index>
auto ML::experimental::fil::treelite_importer< layout >::import_to_specific_variant ( index_type  target_variant_index,
treelite::Model const &  tl_model,
index_type  num_class,
index_type  num_feature,
index_type  max_num_categories,
std::vector< std::vector< index_type >> const &  offsets,
index_type  align_bytes = index_type{},
raft_proto::device_type  mem_type = raft_proto::device_type::cpu,
int  device = 0,
raft_proto::cuda_stream  stream = raft_proto::cuda_stream{} 
)
inline

Assuming that the correct decision_forest variant has been identified, import to that variant

◆ node_accumulate()

template<tree_layout layout>
template<typename tl_threshold_t , typename tl_output_t , typename T , typename lambda_t >
auto ML::experimental::fil::treelite_importer< layout >::node_accumulate ( treelite::Tree< tl_threshold_t, tl_output_t > const &  tl_tree,
init,
lambda_t &&  lambda 
)
inline

◆ node_for_each()

template<tree_layout layout>
template<typename tl_threshold_t , typename tl_output_t , typename lambda_t >
void ML::experimental::fil::treelite_importer< layout >::node_for_each ( treelite::Tree< tl_threshold_t, tl_output_t > const &  tl_tree,
lambda_t &&  lambda 
)
inline

◆ node_transform()

template<tree_layout layout>
template<typename tl_threshold_t , typename tl_output_t , typename iter_t , typename lambda_t >
void ML::experimental::fil::treelite_importer< layout >::node_transform ( treelite::Tree< tl_threshold_t, tl_output_t > const &  tl_tree,
iter_t  output_iter,
lambda_t &&  lambda 
)
inline

◆ num_trees()

template<tree_layout layout>
auto ML::experimental::fil::treelite_importer< layout >::num_trees ( treelite::Model const &  tl_model)
inline

◆ tree_accumulate()

template<tree_layout layout>
template<typename T , typename lambda_t >
auto ML::experimental::fil::treelite_importer< layout >::tree_accumulate ( treelite::Model const &  tl_model,
init,
lambda_t &&  lambda 
)
inline

◆ tree_for_each()

template<tree_layout layout>
template<typename lambda_t >
void ML::experimental::fil::treelite_importer< layout >::tree_for_each ( treelite::Model const &  tl_model,
lambda_t &&  lambda 
)
inline

◆ tree_transform()

template<tree_layout layout>
template<typename iter_t , typename lambda_t >
void ML::experimental::fil::treelite_importer< layout >::tree_transform ( treelite::Model const &  tl_model,
iter_t  output_iter,
lambda_t &&  lambda 
)
inline

◆ uses_double_outputs()

template<tree_layout layout>
auto ML::experimental::fil::treelite_importer< layout >::uses_double_outputs ( treelite::Model const &  tl_model)
inline

◆ uses_double_thresholds()

template<tree_layout layout>
auto ML::experimental::fil::treelite_importer< layout >::uses_double_thresholds ( treelite::Model const &  tl_model)
inline

◆ uses_integer_outputs()

template<tree_layout layout>
auto ML::experimental::fil::treelite_importer< layout >::uses_integer_outputs ( treelite::Model const &  tl_model)
inline

The documentation for this struct was generated from the following file: