mlpack  master
zero_init.hpp
Go to the documentation of this file.
1 
13 #ifndef MLPACK_METHODS_ANN_INIT_RULES_ZERO_INIT_HPP
14 #define MLPACK_METHODS_ANN_INIT_RULES_ZERO_INIT_HPP
15 
16 #include <mlpack/prereqs.hpp>
17 
18 namespace mlpack {
19 namespace ann {
20 
25 {
26  public:
30  ZeroInitialization() { /* Nothing to do here */ }
31 
39  template<typename eT>
40  void Initialize(arma::Mat<eT>& W, const size_t rows, const size_t cols)
41  {
42  W = arma::zeros<arma::Mat<eT> >(rows, cols);
43  }
44 
52  template<typename eT>
53  void Initialize(arma::Cube<eT>& W,
54  const size_t rows,
55  const size_t cols,
56  const size_t slices)
57  {
58  W = arma::zeros<arma::Cube<eT> >(rows, cols, slices);
59  }
60 }; // class ZeroInitialization
61 
62 } // namespace ann
63 } // namespace mlpack
64 
65 #endif
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: binarize.hpp:18
The core includes that mlpack expects; standard C++ includes and Armadillo.
ZeroInitialization()
Create the ZeroInitialization object.
Definition: zero_init.hpp:30
This class is used to initialize randomly the weight matrix.
Definition: zero_init.hpp:24
void Initialize(arma::Mat< eT > &W, const size_t rows, const size_t cols)
Initialize the elements of the specified weight matrix.
Definition: zero_init.hpp:40
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).
Definition: zero_init.hpp:53