mlpack 3.4.2
parameters_visitor.hpp
Go to the documentation of this file.
1
13#ifndef MLPACK_METHODS_ANN_VISITOR_PARAMETERS_VISITOR_HPP
14#define MLPACK_METHODS_ANN_VISITOR_PARAMETERS_VISITOR_HPP
15
18
19#include <boost/variant.hpp>
20
21namespace mlpack {
22namespace ann {
23
28class ParametersVisitor : public boost::static_visitor<void>
29{
30 public:
32 ParametersVisitor(arma::mat& parameters);
33
35 template<typename LayerType>
36 void operator()(LayerType* layer) const;
37
38 void operator()(MoreTypes layer) const;
39
40 private:
42 arma::mat& parameters;
43
46 template<typename T, typename P>
47 typename std::enable_if<
48 !HasParametersCheck<T, P&(T::*)()>::value, void>::type
49 LayerParameters(T* layer, P& output) const;
50
52 template<typename T, typename P>
53 typename std::enable_if<
54 HasParametersCheck<T, P&(T::*)()>::value, void>::type
55 LayerParameters(T* layer, P& output) const;
56};
57
58} // namespace ann
59} // namespace mlpack
60
61// Include implementation.
62#include "parameters_visitor_impl.hpp"
63
64#endif
ParametersVisitor exposes the parameters set of the given module and stores the parameters set into t...
void operator()(LayerType *layer) const
Set the parameters set.
ParametersVisitor(arma::mat &parameters)
Store the parameters set into the given parameters matrix.
void operator()(MoreTypes layer) const
boost::variant< Linear3D< arma::mat, arma::mat, NoRegularizer > *, Glimpse< arma::mat, arma::mat > *, Highway< arma::mat, arma::mat > *, MultiheadAttention< arma::mat, arma::mat, NoRegularizer > *, Recurrent< arma::mat, arma::mat > *, RecurrentAttention< arma::mat, arma::mat > *, ReinforceNormal< arma::mat, arma::mat > *, Reparametrization< arma::mat, arma::mat > *, Select< arma::mat, arma::mat > *, Sequential< arma::mat, arma::mat, false > *, Sequential< arma::mat, arma::mat, true > *, Subview< arma::mat, arma::mat > *, VRClassReward< arma::mat, arma::mat > *, VirtualBatchNorm< arma::mat, arma::mat > *, RBF< arma::mat, arma::mat, GaussianFunction > *, BaseLayer< GaussianFunction, arma::mat, arma::mat > *, PositionalEncoding< arma::mat, arma::mat > * > MoreTypes
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1