mlpack  master
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 
18 
19 #include <boost/variant.hpp>
20 
21 namespace mlpack {
22 namespace ann {
23 
28 class SetInputWidthVisitor : public boost::static_visitor<bool>
29 {
30  public:
32  SetInputWidthVisitor(const size_t inputWidth = 0, const bool reset = false);
33 
35  template<typename LayerType>
36  bool operator()(LayerType* layer) const;
37 
38  private:
40  size_t inputWidth;
41 
43  bool reset;
44 
47  template<typename T>
48  typename std::enable_if<
49  !HasInputWidth<T, size_t&(T::*)()>::value &&
50  !HasModelCheck<T, std::vector<LayerTypes>&(T::*)()>::value, bool>::type
51  LayerInputWidth(T* layer) const;
52 
54  template<typename T>
55  typename std::enable_if<
56  HasInputWidth<T, size_t&(T::*)()>::value &&
57  !HasModelCheck<T, std::vector<LayerTypes>&(T::*)()>::value, bool>::type
58  LayerInputWidth(T* layer) const;
59 
61  template<typename T>
62  typename std::enable_if<
63  !HasInputWidth<T, size_t&(T::*)()>::value &&
64  HasModelCheck<T, std::vector<LayerTypes>&(T::*)()>::value, bool>::type
65  LayerInputWidth(T* layer) const;
66 
69  template<typename T>
70  typename std::enable_if<
71  HasInputWidth<T, size_t&(T::*)()>::value &&
72  HasModelCheck<T, std::vector<LayerTypes>&(T::*)()>::value, bool>::type
73  LayerInputWidth(T* layer) const;
74 };
75 
76 } // namespace ann
77 } // namespace mlpack
78 
79 // Include implementation.
80 #include "set_input_width_visitor_impl.hpp"
81 
82 #endif
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: binarize.hpp:18
size_t inputWidth
The input width parameter.
bool reset
If set reset the height parameter if already set.
SetInputWidthVisitor updates the input width parameter with the given input width.
std::enable_if< !HasInputWidth< T, size_t &(T::*)()>::value &&!HasModelCheck< T, std::vector< LayerTypes > &(T::*)()>::value, bool >::type LayerInputWidth(T *layer) const
Do nothing if the module doesn&#39;t implement the InputWidth() or Model() function.
bool operator()(LayerType *layer) const
Update the input width parameter.
SetInputWidthVisitor(const size_t inputWidth=0, const bool reset=false)
Update the input width parameter with the given input width.