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