14 #ifndef MLPACK_METHODS_ANN_INIT_RULES_GLOROT_INIT_HPP 15 #define MLPACK_METHODS_ANN_INIT_RULES_GLOROT_INIT_HPP 54 template<
bool Uniform = true>
74 void Initialize(arma::Mat<eT>& W,
84 void Initialize(arma::Mat<eT>& W);
96 void Initialize(arma::Cube<eT>& W,
107 template<
typename eT>
108 void Initialize(arma::Cube<eT>& W);
112 template<
typename eT>
118 W.set_size(rows, cols);
120 double var = 2.0 / double(rows + cols);
126 template<
typename eT>
130 Log::Fatal <<
"Cannot initialize and empty matrix." << std::endl;
132 double var = 2.0 / double(W.n_rows + W.n_cols);
138 template<
typename eT>
144 W.set_size(rows, cols);
147 double a = sqrt(6) / sqrt(rows + cols);
153 template<
typename eT>
157 Log::Fatal <<
"Cannot initialize an empty matrix." << std::endl;
160 double a = sqrt(6) / sqrt(W.n_rows + W.n_cols);
165 template <
bool Uniform>
166 template<
typename eT>
173 W.set_size(rows, cols, slices);
175 for (
size_t i = 0; i < slices; ++i)
176 Initialize(W.slice(i), rows, cols);
179 template <
bool Uniform>
180 template<
typename eT>
184 Log::Fatal <<
"Cannot initialize an empty matrix." << std::endl;
186 for (
size_t i = 0; i < W.n_slices; ++i)
187 Initialize(W.slice(i));
Linear algebra utility functions, generally performed on matrices or vectors.
void Initialize(arma::Mat< eT > &W, const size_t rows, const size_t cols)
Initialize the elements weight matrix using a Gaussian Distribution.
This class is used to initialize randomly the weight matrix.
The core includes that mlpack expects; standard C++ includes and Armadillo.
void Initialize(arma::Mat< eT > &W, const size_t rows, const size_t cols)
Initialize randomly the elements of the specified weight matrix.
static MLPACK_EXPORT util::PrefixedOutStream Fatal
Prints fatal messages prefixed with [FATAL], then terminates the program.
Miscellaneous math routines.
GlorotInitializationType()
Initialize the Glorot initialization object.
This class is used to initialize the weight matrix with the Glorot Initialization method...
This class is used to initialize weigth matrix with a gaussian.