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.
void Initialize(arma::Cube< eT > &W)
Initialize the elements of the specified weight 3rd order tensor with Lecun Normal initialization rul...
if(NOT R_FOUND OR NOT R_RCPP OR NOT R_RCPPARMADILLO OR NOT R_RCPPENSMALLEN OR NOT R_BH OR NOT R_ROXYGEN2 OR NOT R_TESTTHAT) if(NOT R_FOUND OR NOT R_RCPP OR NOT R_RCPPARMADILLO OR NOT R_RCPPENSMALLEN OR NOT R_BH OR NOT R_ROXYGEN2 OR NOT R_TESTTHAT) file(READ"$
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...