mlpack  master
layer_traits.hpp
Go to the documentation of this file.
1 
13 #ifndef MLPACK_METHODS_ANN_LAYER_LAYER_TRAITS_HPP
14 #define MLPACK_METHODS_ANN_LAYER_LAYER_TRAITS_HPP
15 
17 
18 namespace mlpack {
19 namespace ann {
20 
28 template<typename LayerType>
30 {
31  public:
35  static const bool IsBinary = false;
36 
40  static const bool IsOutputLayer = false;
41 
45  static const bool IsBiasLayer = false;
46 
47  /*
48  * This is true if the layer is a LSTM layer.
49  **/
50  static const bool IsLSTMLayer = false;
51 
52  /*
53  * This is true if the layer is a connection layer.
54  **/
55  static const bool IsConnection = false;
56 };
57 
58 // This gives us a HasGradientCheck<T, U> type (where U is a function pointer)
59 // we can use with SFINAE to catch when a type has a Gradient(...) function.
60 HAS_MEM_FUNC(Gradient, HasGradientCheck);
61 
62 // This gives us a HasDeterministicCheck<T, U> type (where U is a function
63 // pointer) we can use with SFINAE to catch when a type has a Deterministic()
64 // function.
65 HAS_MEM_FUNC(Deterministic, HasDeterministicCheck);
66 
67 // This gives us a HasParametersCheck<T, U> type (where U is a function pointer) we
68 // can use with SFINAE to catch when a type has a Weights() function.
69 HAS_MEM_FUNC(Parameters, HasParametersCheck);
70 
71 // This gives us a HasAddCheck<T, U> type (where U is a function pointer) we
72 // can use with SFINAE to catch when a type has a Weights() function.
73 HAS_MEM_FUNC(Add, HasAddCheck);
74 
75 // This gives us a HasModelCheck<T, U> type (where U is a function pointer) we
76 // can use with SFINAE to catch when a type has a Weights() function.
77 HAS_MEM_FUNC(Model, HasModelCheck);
78 
79 // This gives us a HasLocationCheck<T, U> type (where U is a function pointer)
80 // we can use with SFINAE to catch when a type has a Location() function.
81 HAS_MEM_FUNC(Location, HasLocationCheck);
82 
83 // This gives us a HasResetCheck<T, U> type (where U is a function pointer)
84 // we can use with SFINAE to catch when a type has a Location() function.
85 HAS_MEM_FUNC(Reset, HasResetCheck);
86 
87 // This gives us a HasRewardCheck<T, U> type (where U is a function pointer) we
88 // can use with SFINAE to catch when a type has a Reward() function.
89 HAS_MEM_FUNC(Reward, HasRewardCheck);
90 
91 // This gives us a HasInputWidth<T, U> type (where U is a function pointer) we
92 // can use with SFINAE to catch when a type has a InputWidth() function.
93 HAS_MEM_FUNC(InputWidth, HasInputWidth);
94 
95 // This gives us a HasInputHeight<T, U> type (where U is a function pointer) we
96 // can use with SFINAE to catch when a type has a InputHeight() function.
97 HAS_MEM_FUNC(InputHeight, HasInputHeight);
98 
99 // This gives us a HasRho<T, U> type (where U is a function pointer) we
100 // can use with SFINAE to catch when a type has a Rho() function.
101 HAS_MEM_FUNC(InputHeight, HasRho);
102 
103 } // namespace ann
104 } // namespace mlpack
105 
106 #endif
Implementation of the Add module class.
Definition: add.hpp:34
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: binarize.hpp:18
static const bool IsBinary
This is true if the layer is a binary layer.
This is a template class that can provide information about various layers.
static const bool IsBiasLayer
This is true if the layer is a bias layer.
static const bool IsLSTMLayer
HAS_MEM_FUNC(Gradient, HasGradientCheck)
static const bool IsConnection
static const bool IsOutputLayer
This is true if the layer is an output layer.