mlpack  master
set_input_height_visitor.hpp
Go to the documentation of this file.
1 
13 #ifndef MLPACK_METHODS_ANN_VISITOR_SET_INPUT_HEIGHT_VISITOR_HPP
14 #define MLPACK_METHODS_ANN_VISITOR_SET_INPUT_HEIGHT_VISITOR_HPP
15 
18 
19 #include <boost/variant.hpp>
20 
21 namespace mlpack {
22 namespace ann {
23 
28 class SetInputHeightVisitor : public boost::static_visitor<bool>
29 {
30  public:
32  SetInputHeightVisitor(const size_t inputHeight = 0, const bool reset = false);
33 
35  template<typename LayerType>
36  bool operator()(LayerType* layer) const;
37 
38  private:
40  size_t inputHeight;
41 
43  bool reset;
44 
47  template<typename T>
48  typename std::enable_if<
49  !HasInputHeight<T, size_t&(T::*)()>::value &&
50  !HasModelCheck<T, std::vector<LayerTypes>&(T::*)()>::value, bool>::type
51  LayerInputHeight(T* layer) const;
52 
55  template<typename T>
56  typename std::enable_if<
57  HasInputHeight<T, size_t&(T::*)()>::value &&
58  !HasModelCheck<T, std::vector<LayerTypes>&(T::*)()>::value, bool>::type
59  LayerInputHeight(T* layer) const;
60 
62  template<typename T>
63  typename std::enable_if<
64  !HasInputHeight<T, size_t&(T::*)()>::value &&
65  HasModelCheck<T, std::vector<LayerTypes>&(T::*)()>::value, bool>::type
66  LayerInputHeight(T* layer) const;
67 
70  template<typename T>
71  typename std::enable_if<
72  HasInputHeight<T, size_t&(T::*)()>::value &&
73  HasModelCheck<T, std::vector<LayerTypes>&(T::*)()>::value, bool>::type
74  LayerInputHeight(T* layer) const;
75 };
76 
77 } // namespace ann
78 } // namespace mlpack
79 
80 // Include implementation.
81 #include "set_input_height_visitor_impl.hpp"
82 
83 #endif
SetInputHeightVisitor updates the input height parameter with the given input height.
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: binarize.hpp:18
bool operator()(LayerType *layer) const
Update the input height parameter.
size_t inputHeight
The input height parameter.
bool reset
If set reset the height parameter if already set.
SetInputHeightVisitor(const size_t inputHeight=0, const bool reset=false)
Update the input height parameter with the given input height.
std::enable_if< !HasInputHeight< T, size_t &(T::*)()>::value &&!HasModelCheck< T, std::vector< LayerTypes > &(T::*)()>::value, bool >::type LayerInputHeight(T *layer) const
Do nothing if the module doesn&#39;t implement the InputHeight() or Model() function. ...