15 #ifndef MLPACK_METHODS_ANN_INIT_RULES_LECUN_NORMAL_INIT_HPP
16 #define MLPACK_METHODS_ANN_INIT_RULES_LECUN_NORMAL_INIT_HPP
68 template <
typename eT>
76 const double variance = 1.0 / ((double) rows);
79 W.set_size(rows, cols);
83 W.imbue( [&]() {
return sqrt(variance) * arma::randn(); } );
92 template <
typename eT>
98 const double variance = 1.0 / (double) W.n_rows;
101 Log::Fatal <<
"Cannot initialize an empty matrix." << std::endl;
105 W.imbue( [&]() {
return sqrt(variance) * arma::randn(); } );
117 template <
typename eT>
124 W.set_size(rows, cols, slices);
126 for (
size_t i = 0; i < slices; ++i)
136 template <
typename eT>
140 Log::Fatal <<
"Cannot initialize an empty cube." << std::endl;
142 for (
size_t i = 0; i < W.n_slices; ++i)
void Initialize(arma::Cube< eT > &W, const size_t rows, const size_t cols, const size_t slices)
Initialize the elements of the specified weight 3rd order tensor with Lecun Normal initialization rul...
The core includes that mlpack expects; standard C++ includes and Armadillo.
This class is used to initialize weight matrix with the Lecun Normalization initialization rule...
static MLPACK_EXPORT util::PrefixedOutStream Fatal
Prints fatal messages prefixed with [FATAL], then terminates the program.
if(NOT PYTHON_EXECUTABLE OR NOT PY_DISTUTILS OR NOT PY_CYTHON OR NOT PY_NUMPY OR NOT PY_PANDAS) if(NOT PYTHON_EXECUTABLE OR NOT PY_DISTUTILS OR NOT PY_CYTHON OR NOT PY_NUMPY OR NOT PY_PANDAS) set(BINDING_SOURCES default_param.hpp default_param_impl.hpp generate_pyx.hpp generate_pyx.cpp get_arma_type.hpp get_cython_type.hpp get_numpy_type.hpp get_numpy_type_char.hpp get_param.hpp get_printable_param.hpp get_python_type.hpp import_decl.hpp print_class_defn.hpp print_defn.hpp print_doc.hpp print_doc_functions.hpp print_doc_functions_impl.hpp print_input_processing.hpp print_output_processing.hpp print_pyx.hpp print_pyx.cpp print_type_doc.hpp print_type_doc_impl.hpp py_option.hpp strip_type.hpp mlpack/arma_util.hpp setup.cfg copy_artifacts.py) set(CYTHON_SOURCES mlpack/arma_numpy.pxd mlpack/arma_numpy.pyx mlpack/arma.pxd mlpack/arma_util.hpp mlpack/io.pxd mlpack/io_util.hpp mlpack/matrix_utils.py mlpack/serialization.hpp mlpack/serialization.pxd) set(TEST_SOURCES tests/dataset_info_test.py tests/test_python_binding.py) get_property(CYTHON_INCLUDE_DIRECTORIES DIRECTORY $
void Initialize(arma::Cube< eT > &W)
Initialize the elements of the specified weight 3rd order tensor with Lecun Normal initialization rul...
void Initialize(arma::Mat< eT > &W, const size_t rows, const size_t cols)
Initialize the elements of the weight matrix with the Lecun Normal initialization rule...
LecunNormalInitialization()
Initialize the LecunNormalInitialization object.
Miscellaneous math random-related routines.
void Initialize(arma::Mat< eT > &W)
Initialize the elements of the weight matrix with the Lecun Normal initialization rule...