mlpack  master
deterministic_set_visitor.hpp
Go to the documentation of this file.
1 
14 #ifndef MLPACK_METHODS_ANN_VISITOR_DETERMINISTIC_SET_VISITOR_HPP
15 #define MLPACK_METHODS_ANN_VISITOR_DETERMINISTIC_SET_VISITOR_HPP
16 
19 
20 #include <boost/variant.hpp>
21 
22 namespace mlpack {
23 namespace ann {
24 
29 class DeterministicSetVisitor : public boost::static_visitor<void>
30 {
31  public:
33  DeterministicSetVisitor(const bool deterministic = true);
34 
36  template<typename LayerType>
37  void operator()(LayerType* layer) const;
38 
39  private:
41  const bool deterministic;
42 
45  template<typename T>
46  typename std::enable_if<
47  HasDeterministicCheck<T, bool&(T::*)(void)>::value &&
48  HasModelCheck<T, std::vector<LayerTypes>&(T::*)()>::value, void>::type
49  LayerDeterministic(T* layer) const;
50 
53  template<typename T>
54  typename std::enable_if<
55  !HasDeterministicCheck<T, bool&(T::*)(void)>::value &&
56  HasModelCheck<T, std::vector<LayerTypes>&(T::*)()>::value, void>::type
57  LayerDeterministic(T* layer) const;
58 
61  template<typename T>
62  typename std::enable_if<
63  HasDeterministicCheck<T, bool&(T::*)(void)>::value &&
64  !HasModelCheck<T, std::vector<LayerTypes>&(T::*)()>::value, void>::type
65  LayerDeterministic(T* layer) const;
66 
69  template<typename T>
70  typename std::enable_if<
71  !HasDeterministicCheck<T, bool&(T::*)(void)>::value &&
72  !HasModelCheck<T, std::vector<LayerTypes>&(T::*)()>::value, void>::type
73  LayerDeterministic(T* layer) const;
74 };
75 
76 } // namespace ann
77 } // namespace mlpack
78 
79 // Include implementation.
80 #include "deterministic_set_visitor_impl.hpp"
81 
82 #endif
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: binarize.hpp:18
DeterministicSetVisitor set the deterministic parameter given the deterministic value.
void operator()(LayerType *layer) const
Set the deterministic parameter.
DeterministicSetVisitor(const bool deterministic=true)
Set the deterministic parameter given the current deterministic value.
std::enable_if< HasDeterministicCheck< T, bool &(T::*)(void)>::value &&HasModelCheck< T, std::vector< LayerTypes > &(T::*)()>::value, void >::type LayerDeterministic(T *layer) const
Set the deterministic parameter if the module implements the Deterministic() and Model() function...
const bool deterministic
The deterministic parameter.