DiSMEC++
weights.cpp File Reference
#include "io/weights.h"
#include "io/common.h"
#include "model/model.h"
#include "spdlog/spdlog.h"
#include "io/numpy.h"
#include "utils/eigen_generic.h"
#include "doctest.h"
#include "model/dense.h"

Go to the source code of this file.

Namespaces

 anonymous_namespace{weights.cpp}
 

Functions

template<class F >
void anonymous_namespace{weights.cpp}::save_weights (const Model &model, F &&weight_callback)
 Basic scaffold for saving weights. More...
 
template<class F >
void anonymous_namespace{weights.cpp}::load_weights (Model &target, F &&read_callback)
 Basic scaffold for loading weights. More...
 
 TEST_CASE ("save/load weights as plain text")
 
 TEST_CASE ("save dense npy")
 

Function Documentation

◆ TEST_CASE() [1/2]

TEST_CASE ( "save dense npy"  )
Todo:
test cases for mismatch

Definition at line 228 of file weights.cpp.

References dismec::io::model::load_dense_weights_npy(), and dismec::io::model::save_dense_weights_npy().

◆ TEST_CASE() [2/2]

TEST_CASE ( "save/load weights as plain text"  )
Test:
In this test we check that weight matrices are saved correctly in dense and sparse txt formats. This also verifies that the partial model settings are used correctly, i.e. that we do not try to save weight vectors that are not actually present in the partial model. We then check that loading from the saved strings reproduces the original weights.

Definition at line 180 of file weights.cpp.

References dismec::io::model::load_dense_weights_txt(), dismec::io::model::load_sparse_weights_txt(), dismec::io::model::save_as_sparse_weights_txt(), and dismec::io::model::save_dense_weights_txt().