13 #ifndef MLPACK_METHODS_ANN_INIT_RULES_NETWORK_INIT_HPP 14 #define MLPACK_METHODS_ANN_INIT_RULES_NETWORK_INIT_HPP 28 template<
typename InitializationRuleType>
38 const InitializationRuleType& initializeRule = InitializationRuleType()) :
39 initializeRule(initializeRule)
52 template <
typename eT>
54 arma::Mat<eT>& parameters,
55 size_t parameterOffset = 0)
58 if (parameters.is_empty())
61 for (
size_t i = 0; i < network.size(); ++i)
62 weights += network[i]->WeightSize();
64 parameters.set_size(weights, 1);
70 for (
size_t i = 0, offset = parameterOffset; i < network.size(); ++i)
74 const size_t weight = network[i]->WeightSize();
75 arma::Mat<eT> tmp = arma::mat(parameters.memptr() + offset,
76 weight, 1,
false,
false);
77 initializeRule.Initialize(tmp, tmp.n_elem, 1);
85 initializeRule.Initialize(parameters, parameters.n_elem, 1);
92 InitializationRuleType initializeRule;
Linear algebra utility functions, generally performed on matrices or vectors.
The core includes that mlpack expects; standard C++ includes and Armadillo.
This is a template class that can provide information about various initialization methods...
NetworkInitialization(const InitializationRuleType &initializeRule=InitializationRuleType())
Use the given initialization rule to initialize the specified network.
A layer is an abstract class implementing common neural networks operations, such as convolution...
This class is used to initialize the network with the given initialization rule.
void Initialize(const std::vector< Layer< arma::Mat< eT >> *> &network, arma::Mat< eT > ¶meters, size_t parameterOffset=0)
Initialize the specified network and store the results in the given parameter.