set_input_width_visitor.hpp
Go to the documentation of this file.
1 
13 #ifndef MLPACK_METHODS_ANN_VISITOR_SET_INPUT_WIDTH_VISITOR_HPP
14 #define MLPACK_METHODS_ANN_VISITOR_SET_INPUT_WIDTH_VISITOR_HPP
15 
17 
18 #include <boost/variant.hpp>
19 
20 namespace mlpack {
21 namespace ann {
22 
27 class SetInputWidthVisitor : public boost::static_visitor<bool>
28 {
29  public:
31  SetInputWidthVisitor(const size_t inputWidth = 0, const bool reset = false);
32 
34  template<typename LayerType>
35  bool operator()(LayerType* layer) const;
36 
37  private:
39  size_t inputWidth;
40 
42  bool reset;
43 
46  template<typename T>
47  typename std::enable_if<
48  !HasInputWidth<T, size_t&(T::*)()>::value &&
49  !HasModelCheck<T>::value, bool>::type
50  LayerInputWidth(T* layer) const;
51 
53  template<typename T>
54  typename std::enable_if<
55  HasInputWidth<T, size_t&(T::*)()>::value &&
56  !HasModelCheck<T>::value, bool>::type
57  LayerInputWidth(T* layer) const;
58 
60  template<typename T>
61  typename std::enable_if<
62  !HasInputWidth<T, size_t&(T::*)()>::value &&
63  HasModelCheck<T>::value, bool>::type
64  LayerInputWidth(T* layer) const;
65 
68  template<typename T>
69  typename std::enable_if<
70  HasInputWidth<T, size_t&(T::*)()>::value &&
71  HasModelCheck<T>::value, bool>::type
72  LayerInputWidth(T* layer) const;
73 };
74 
75 } // namespace ann
76 } // namespace mlpack
77 
78 // Include implementation.
79 #include "set_input_width_visitor_impl.hpp"
80 
81 #endif
SetInputWidthVisitor(const size_t inputWidth=0, const bool reset=false)
Update the input width parameter with the given input width.
.hpp
Definition: add_to_po.hpp:21
SetInputWidthVisitor updates the input width parameter with the given input width.
bool operator()(LayerType *layer) const
Update the input width parameter.