mlpack  3.4.2
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)
68 // we can use with SFINAE to catch when a type has a Parameters() 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 Add() function.
73 HAS_MEM_FUNC(Add, HasAddCheck);
74 
75 // This gives us a HasModelCheck<T> type we can use with SFINAE to catch when
76 // a type has a function named Model.
77 HAS_ANY_METHOD_FORM(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 Reset() function.
85 HAS_MEM_FUNC(Reset, HasResetCheck);
86 
87 // This gives us a HasResetCheck<T, U> type (where U is a function pointer)
88 // we can use with SFINAE to catch when a type has a ResetCell() function.
89 HAS_MEM_FUNC(ResetCell, HasResetCellCheck);
90 
91 // This gives us a HasRewardCheck<T, U> type (where U is a function pointer) we
92 // can use with SFINAE to catch when a type has a Reward() function.
93 HAS_MEM_FUNC(Reward, HasRewardCheck);
94 
95 // This gives us a HasInputWidth<T, U> type (where U is a function pointer) we
96 // can use with SFINAE to catch when a type has a InputWidth() function.
97 HAS_MEM_FUNC(InputWidth, HasInputWidth);
98 
99 // This gives us a HasInputHeight<T, U> type (where U is a function pointer) we
100 // can use with SFINAE to catch when a type has a InputHeight() function.
101 HAS_MEM_FUNC(InputHeight, HasInputHeight);
102 
103 // This gives us a HasRho<T, U> type (where U is a function pointer) we
104 // can use with SFINAE to catch when a type has a Rho() function.
105 HAS_MEM_FUNC(Rho, HasRho);
106 
107 // This gives us a HasLoss<T, U> type (where U is a function pointer) we
108 // can use with SFINAE to catch when a type has a Loss() function.
109 HAS_MEM_FUNC(Loss, HasLoss);
110 
111 // This gives us a HasRunCheck<T, U> type (where U is a function pointer) we
112 // can use with SFINAE to catch when a type has a Run() function.
113 HAS_MEM_FUNC(Run, HasRunCheck);
114 
115 // This gives us a HasBiasCheck<T, U> type (where U is a function pointer) we
116 // can use with SFINAE to catch when a type has a Bias() function.
117 HAS_MEM_FUNC(Bias, HasBiasCheck);
118 
119 // This gives us a HasMaxIterationsC<T, U> type (where U is a function pointer)
120 // we can use with SFINAE to catch when a type has a MaxIterations() function.
121 HAS_MEM_FUNC(MaxIterations, HasMaxIterations);
122 
123 } // namespace ann
124 } // namespace mlpack
125 
126 #endif
Implementation of the Add module class.
Definition: add.hpp:35
This is a template class that can provide information about various layers.
static const bool IsOutputLayer
This is true if the layer is an output layer.
static const bool IsConnection
static const bool IsBiasLayer
This is true if the layer is a bias layer.
static const bool IsLSTMLayer
static const bool IsBinary
This is true if the layer is a binary layer.
HAS_ANY_METHOD_FORM(Model, HasModelCheck)
HAS_MEM_FUNC(Gradient, HasGradientCheck)
Linear algebra utility functions, generally performed on matrices or vectors.