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 
18 
19 #include <boost/variant.hpp>
20 
21 namespace mlpack {
22 namespace ann {
23 
28 class DeterministicSetVisitor : public boost::static_visitor<void>
29 {
30  public:
32  DeterministicSetVisitor(const bool deterministic = true);
33 
35  template<typename LayerType>
36  void operator()(LayerType* layer) const;
37 
38  private:
40  const bool deterministic;
41 
44  template<typename T>
45  typename std::enable_if<
46  HasDeterministicCheck<T, bool&(T::*)(void)>::value &&
47  HasModelCheck<T>::value, void>::type
48  LayerDeterministic(T* layer) const;
49 
52  template<typename T>
53  typename std::enable_if<
54  !HasDeterministicCheck<T, bool&(T::*)(void)>::value &&
55  HasModelCheck<T>::value, void>::type
56  LayerDeterministic(T* layer) const;
57 
60  template<typename T>
61  typename std::enable_if<
62  HasDeterministicCheck<T, bool&(T::*)(void)>::value &&
63  !HasModelCheck<T>::value, void>::type
64  LayerDeterministic(T* layer) const;
65 
68  template<typename T>
69  typename std::enable_if<
70  !HasDeterministicCheck<T, bool&(T::*)(void)>::value &&
71  !HasModelCheck<T>::value, void>::type
72  LayerDeterministic(T* layer) const;
73 };
74 
75 } // namespace ann
76 } // namespace mlpack
77 
78 // Include implementation.
79 #include "deterministic_set_visitor_impl.hpp"
80 
81 #endif
DeterministicSetVisitor(const bool deterministic=true)
Set the deterministic parameter given the current deterministic value.
.hpp
Definition: add_to_po.hpp:21
DeterministicSetVisitor set the deterministic parameter given the deterministic value.
void operator()(LayerType *layer) const
Set the deterministic parameter.