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
18namespace mlpack {
19namespace ann {
20
28template<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.
60HAS_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.
65HAS_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.
69HAS_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.
73HAS_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.
77HAS_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.
81HAS_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.
85HAS_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.
89HAS_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.
93HAS_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.
97HAS_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.
101HAS_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.
105HAS_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.
109HAS_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.
113HAS_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.
117HAS_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.
121HAS_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.
Definition: cv.hpp:1