run_set_visitor.hpp
Go to the documentation of this file.
1 
14 #ifndef MLPACK_METHODS_ANN_VISITOR_RUN_SET_VISITOR_HPP
15 #define MLPACK_METHODS_ANN_VISITOR_RUN_SET_VISITOR_HPP
16 
18 
19 #include <boost/variant.hpp>
20 
21 namespace mlpack {
22 namespace ann {
23 
28 class RunSetVisitor : public boost::static_visitor<void>
29 {
30  public:
32  RunSetVisitor(const bool run = true);
33 
35  template<typename LayerType>
36  void operator()(LayerType* layer) const;
37 
38  void operator()(MoreTypes layer) const;
39 
40  private:
42  const bool run;
43 
46  template<typename T>
47  typename std::enable_if<
48  HasRunCheck<T, bool&(T::*)(void)>::value &&
49  HasModelCheck<T>::value, void>::type
50  LayerRun(T* layer) const;
51 
54  template<typename T>
55  typename std::enable_if<
56  !HasRunCheck<T, bool&(T::*)(void)>::value &&
57  HasModelCheck<T>::value, void>::type
58  LayerRun(T* layer) const;
59 
62  template<typename T>
63  typename std::enable_if<
64  HasRunCheck<T, bool&(T::*)(void)>::value &&
65  !HasModelCheck<T>::value, void>::type
66  LayerRun(T* layer) const;
67 
70  template<typename T>
71  typename std::enable_if<
72  !HasRunCheck<T, bool&(T::*)(void)>::value &&
73  !HasModelCheck<T>::value, void>::type
74  LayerRun(T* layer) const;
75 };
76 
77 } // namespace ann
78 } // namespace mlpack
79 
80 // Include implementation.
81 #include "run_set_visitor_impl.hpp"
82 
83 #endif
RunSetVisitor set the run parameter given the run value.
Linear algebra utility functions, generally performed on matrices or vectors.
void operator()(LayerType *layer) const
Set the run parameter.
RunSetVisitor(const bool run=true)
Set the run parameter given the current run value.
boost::variant< FlexibleReLU< arma::mat, arma::mat > *, Linear3D< arma::mat, arma::mat, NoRegularizer > *, LpPooling< arma::mat, arma::mat > *, PixelShuffle< arma::mat, arma::mat > *, ChannelShuffle< arma::mat, arma::mat > *, 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 > *, ReLU6< arma::mat, arma::mat > *, Reparametrization< arma::mat, arma::mat > *, Select< arma::mat, arma::mat > *, SpatialDropout< arma::mat, arma::mat > *, 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 > *, ISRLU< arma::mat, arma::mat > *, BicubicInterpolation< arma::mat, arma::mat > *, NearestInterpolation< arma::mat, arma::mat > *, GroupNorm< arma::mat, arma::mat > *> MoreTypes