DiSMEC++
anonymous_namespace{weights.cpp} Namespace Reference

Functions

template<class F >
void save_weights (const Model &model, F &&weight_callback)
 Basic scaffold for saving weights. More...
 
template<class F >
void load_weights (Model &target, F &&read_callback)
 Basic scaffold for loading weights. More...
 

Function Documentation

◆ load_weights()

template<class F >
void anonymous_namespace{weights.cpp}::load_weights ( Model target,
F &&  read_callback 
)

Basic scaffold for loading weights.

This function handles the iteration over all the model weights, and inserts the weight vectors. The actual reading is delegated to read_callback.

Definition at line 37 of file weights.cpp.

References dismec::model::Model::labels_begin(), dismec::model::Model::labels_end(), dismec::model::Model::num_features(), and dismec::model::Model::set_weights_for_label().

Referenced by dismec::io::model::load_dense_weights_npy(), and dismec::io::model::load_dense_weights_txt().

◆ save_weights()

template<class F >
void anonymous_namespace{weights.cpp}::save_weights ( const Model model,
F &&  weight_callback 
)

Basic scaffold for saving weights.

This function handles the iteration over all the model weights, and extracts the weight vectors. The actual saving is delegated to weight_callback.

Definition at line 23 of file weights.cpp.

References dismec::model::Model::get_weights_for_label(), dismec::model::Model::labels_begin(), dismec::model::Model::labels_end(), and dismec::model::Model::num_features().

Referenced by dismec::io::model::save_as_sparse_weights_txt(), dismec::io::model::save_dense_weights_npy(), and dismec::io::model::save_dense_weights_txt().