mlpack  3.4.2
layer_types.hpp
Go to the documentation of this file.
1 
12 #ifndef MLPACK_METHODS_ANN_LAYER_LAYER_TYPES_HPP
13 #define MLPACK_METHODS_ANN_LAYER_LAYER_TYPES_HPP
14 
15 #include <boost/variant.hpp>
16 
17 // Layer modules.
57 
58 // Convolution modules.
62 
63 // Regularizers.
65 
66 // Loss function modules.
68 
69 namespace mlpack {
70 namespace ann {
71 
72 template<typename InputDataType, typename OutputDataType> class BatchNorm;
73 template<typename InputDataType, typename OutputDataType> class DropConnect;
74 template<typename InputDataType, typename OutputDataType> class Glimpse;
75 template<typename InputDataType, typename OutputDataType> class LayerNorm;
76 template<typename InputDataType, typename OutputDataType> class LSTM;
77 template<typename InputDataType, typename OutputDataType> class GRU;
78 template<typename InputDataType, typename OutputDataType> class FastLSTM;
79 template<typename InputDataType, typename OutputDataType> class VRClassReward;
80 template<typename InputDataType, typename OutputDataType> class Concatenate;
81 template<typename InputDataType, typename OutputDataType> class Padding;
82 
83 template<typename InputDataType,
84  typename OutputDataType,
85  typename RegularizerType>
86 class Linear;
87 
88 template<typename InputDataType,
89  typename OutputDataType,
90  typename Activation>
91 class RBF;
92 
93 template<typename InputDataType,
94  typename OutputDataType,
95  typename RegularizerType>
96 class LinearNoBias;
97 
98 template<typename InputDataType,
99  typename OutputDataType>
100 class NoisyLinear;
101 
102 template<typename InputDataType,
103  typename OutputDataType,
104  typename RegularizerType>
105 class Linear3D;
106 
107 template<typename InputDataType,
108  typename OutputDataType
109 >
110 class VirtualBatchNorm;
111 
112 template<typename InputDataType,
113  typename OutputDataType
114 >
115 class MiniBatchDiscrimination;
116 
117 template <typename InputDataType,
118  typename OutputDataType,
119  typename RegularizerType>
120 class MultiheadAttention;
121 
122 template<typename InputDataType,
123  typename OutputDataType
124 >
125 class Reparametrization;
126 
127 template<typename InputDataType,
128  typename OutputDataType,
129  typename... CustomLayers
130 >
131 class AddMerge;
132 
133 template<typename InputDataType,
134  typename OutputDataType,
135  bool residual,
136  typename... CustomLayers
137 >
138 class Sequential;
139 
140 template<typename InputDataType,
141  typename OutputDataType,
142  typename... CustomLayers
143 >
144 class Highway;
145 
146 template<typename InputDataType,
147  typename OutputDataType,
148  typename... CustomLayers
149 >
150 class Recurrent;
151 
152 template<typename InputDataType,
153  typename OutputDataType,
154  typename... CustomLayers
155 >
156 class Concat;
157 
158 template<
159  typename OutputLayerType,
160  typename InputDataType,
161  typename OutputDataType
162 >
163 class ConcatPerformance;
164 
165 template<
166  typename ForwardConvolutionRule,
167  typename BackwardConvolutionRule,
168  typename GradientConvolutionRule,
169  typename InputDataType,
170  typename OutputDataType
171 >
172 class Convolution;
173 
174 template<
175  typename ForwardConvolutionRule,
176  typename BackwardConvolutionRule,
177  typename GradientConvolutionRule,
178  typename InputDataType,
179  typename OutputDataType
180 >
181 class TransposedConvolution;
182 
183 template<
184  typename ForwardConvolutionRule,
185  typename BackwardConvolutionRule,
186  typename GradientConvolutionRule,
187  typename InputDataType,
188  typename OutputDataType
189 >
190 class AtrousConvolution;
191 
192 template<
193  typename InputDataType,
194  typename OutputDataType
195 >
196 class RecurrentAttention;
197 
198 template<typename InputDataType,
199  typename OutputDataType,
200  typename... CustomLayers
201 >
202 class MultiplyMerge;
203 
204 template <typename InputDataType,
205  typename OutputDataType,
206  typename... CustomLayers
207 >
208 class WeightNorm;
209 
210 template <typename InputDataType,
211  typename OutputDataType
212 >
213 class AdaptiveMaxPooling;
214 
215 template <typename InputDataType,
216  typename OutputDataType
217 >
218 class AdaptiveMeanPooling;
219 
220 using MoreTypes = boost::variant<
238 >;
239 
240 template <typename... CustomLayers>
241 using LayerTypes = boost::variant<
250  arma::mat, arma::mat>*,
262  arma::mat, arma::mat>*,
266  NaiveConvolution<ValidConvolution>, arma::mat, arma::mat>*,
296  NaiveConvolution<ValidConvolution>, arma::mat, arma::mat>*,
298  MoreTypes,
299  CustomLayers*...
300 >;
301 
302 } // namespace ann
303 } // namespace mlpack
304 
305 #endif
softshrink.hpp
mlpack::ann::MeanPooling< arma::mat, arma::mat >
mlpack::ann::Recurrent
Implementation of the RecurrentLayer class.
Definition: recurrent.hpp:45
mlpack::ann::ReinforceNormal
Implementation of the reinforce normal layer.
Definition: reinforce_normal.hpp:35
base_layer.hpp
negative_log_likelihood.hpp
mlpack::ann::Sequential
Implementation of the Sequential class.
Definition: sequential.hpp:73
max_pooling.hpp
mlpack::ann::LogSoftMax
Implementation of the log softmax layer.
Definition: log_softmax.hpp:37
naive_convolution.hpp
mlpack::ann::Dropout
The dropout layer is a regularizer that randomly with probability 'ratio' sets input values to zero a...
Definition: dropout.hpp:54
positional_encoding.hpp
mlpack::ann::BaseLayer
Implementation of the base layer.
Definition: base_layer.hpp:66
mlpack::ann::AddMerge
Implementation of the AddMerge module class.
Definition: add_merge.hpp:43
lookup.hpp
select.hpp
subview.hpp
mlpack::ann::WeightNorm
Declaration of the WeightNorm layer class.
Definition: weight_norm.hpp:62
leaky_relu.hpp
mlpack::ann::AdaptiveMeanPooling
Implementation of the AdaptiveMeanPooling.
Definition: adaptive_mean_pooling.hpp:35
noisylinear.hpp
mlpack::ann::LayerNorm
Declaration of the Layer Normalization class.
Definition: layer_norm.hpp:66
mlpack::ann::Concatenate
Implementation of the Concatenate module class.
Definition: concatenate.hpp:37
mlpack::ann::DropConnect
The DropConnect layer is a regularizer that randomly with probability ratio sets the connection value...
Definition: dropconnect.hpp:64
mlpack::ann::Add
Implementation of the Add module class.
Definition: add.hpp:35
radial_basis_function.hpp
reparametrization.hpp
mlpack::ann::NegativeLogLikelihood
Implementation of the negative log likelihood layer.
Definition: negative_log_likelihood.hpp:36
adaptive_max_pooling.hpp
multiply_constant.hpp
mlpack::ann::Select
The select module selects the specified column from a given input matrix.
Definition: select.hpp:33
bilinear_interpolation.hpp
linear_no_bias.hpp
mlpack::ann::Concat
Implementation of the Concat class.
Definition: concat.hpp:46
mlpack::ann::Glimpse
The glimpse layer returns a retina-like representation (down-scaled cropped images) of increasing sca...
Definition: glimpse.hpp:89
mlpack::ann::Highway
Implementation of the Highway layer.
Definition: highway.hpp:61
mlpack::ann::TransposedConvolution
Implementation of the Transposed Convolution class.
Definition: transposed_convolution.hpp:50
log_softmax.hpp
mlpack::ann::Lookup
The Lookup class stores word embeddings and retrieves them using tokens.
Definition: lookup.hpp:42
mlpack::ann::Softmax< arma::mat, arma::mat >
mlpack::ann::CReLU
A concatenated ReLU has two outputs, one ReLU and one negative ReLU, concatenated together.
Definition: c_relu.hpp:51
add.hpp
linear3d.hpp
adaptive_mean_pooling.hpp
mlpack::ann::Join
Implementation of the Join module class.
Definition: join.hpp:34
mlpack::ann::RecurrentAttention
This class implements the Recurrent Model for Visual Attention, using a variety of possible layer imp...
Definition: recurrent_attention.hpp:57
mlpack::ann::FastLSTM
An implementation of a faster version of the Fast LSTM network layer.
Definition: fast_lstm.hpp:67
hardshrink.hpp
mlpack
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: add_to_cli11.hpp:21
mlpack::ann::PReLU
The PReLU activation function, defined by (where alpha is trainable)
Definition: parametric_relu.hpp:46
mlpack::ann::MultiplyMerge
Implementation of the MultiplyMerge module class.
Definition: multiply_merge.hpp:43
mlpack::ann::LeakyReLU
The LeakyReLU activation function, defined by.
Definition: leaky_relu.hpp:45
c_relu.hpp
mlpack::ann::AlphaDropout
The alpha - dropout layer is a regularizer that randomly with probability 'ratio' sets input values t...
Definition: alpha_dropout.hpp:51
flexible_relu.hpp
spatial_dropout.hpp
mlpack::ann::NoisyLinear
Implementation of the NoisyLinear layer class.
Definition: noisylinear.hpp:34
mlpack::ann::BilinearInterpolation
Definition and Implementation of the Bilinear Interpolation Layer.
Definition: bilinear_interpolation.hpp:40
mlpack::ann::PositionalEncoding
Positional Encoding injects some information about the relative or absolute position of the tokens in...
Definition: positional_encoding.hpp:38
mlpack::ann::AdaptiveMaxPooling
Implementation of the AdaptiveMaxPooling layer.
Definition: adaptive_max_pooling.hpp:34
softmax.hpp
mlpack::ann::LSTM
Implementation of the LSTM module class.
Definition: lstm.hpp:63
mlpack::ann::MoreTypes
boost::variant< Linear3D< arma::mat, arma::mat, NoRegularizer > *, Glimpse< arma::mat, arma::mat > *, Highway< arma::mat, arma::mat > *, MultiheadAttention< arma::mat, arma::mat, NoRegularizer > *, Recurrent< arma::mat, arma::mat > *, RecurrentAttention< arma::mat, arma::mat > *, ReinforceNormal< arma::mat, arma::mat > *, Reparametrization< arma::mat, arma::mat > *, Select< arma::mat, arma::mat > *, Sequential< arma::mat, arma::mat, false > *, Sequential< arma::mat, arma::mat, true > *, Subview< arma::mat, arma::mat > *, VRClassReward< arma::mat, arma::mat > *, VirtualBatchNorm< arma::mat, arma::mat > *, RBF< arma::mat, arma::mat, GaussianFunction > *, BaseLayer< GaussianFunction, arma::mat, arma::mat > *, PositionalEncoding< arma::mat, arma::mat > * > MoreTypes
Definition: layer_types.hpp:238
mlpack::ann::Convolution
Implementation of the Convolution class.
Definition: convolution.hpp:49
fft_convolution.hpp
mlpack::ann::LayerTypes
boost::variant< AdaptiveMaxPooling< arma::mat, arma::mat > *, AdaptiveMeanPooling< arma::mat, arma::mat > *, Add< arma::mat, arma::mat > *, AddMerge< arma::mat, arma::mat > *, AlphaDropout< arma::mat, arma::mat > *, AtrousConvolution< NaiveConvolution< ValidConvolution >, NaiveConvolution< FullConvolution >, NaiveConvolution< ValidConvolution >, arma::mat, arma::mat > *, BaseLayer< LogisticFunction, arma::mat, arma::mat > *, BaseLayer< IdentityFunction, arma::mat, arma::mat > *, BaseLayer< TanhFunction, arma::mat, arma::mat > *, BaseLayer< SoftplusFunction, arma::mat, arma::mat > *, BaseLayer< RectifierFunction, arma::mat, arma::mat > *, BatchNorm< arma::mat, arma::mat > *, BilinearInterpolation< arma::mat, arma::mat > *, CELU< arma::mat, arma::mat > *, Concat< arma::mat, arma::mat > *, Concatenate< arma::mat, arma::mat > *, ConcatPerformance< NegativeLogLikelihood< arma::mat, arma::mat >, arma::mat, arma::mat > *, Constant< arma::mat, arma::mat > *, Convolution< NaiveConvolution< ValidConvolution >, NaiveConvolution< FullConvolution >, NaiveConvolution< ValidConvolution >, arma::mat, arma::mat > *, CReLU< arma::mat, arma::mat > *, DropConnect< arma::mat, arma::mat > *, Dropout< arma::mat, arma::mat > *, ELU< arma::mat, arma::mat > *, FastLSTM< arma::mat, arma::mat > *, FlexibleReLU< arma::mat, arma::mat > *, GRU< arma::mat, arma::mat > *, HardTanH< arma::mat, arma::mat > *, Join< arma::mat, arma::mat > *, LayerNorm< arma::mat, arma::mat > *, LeakyReLU< arma::mat, arma::mat > *, Linear< arma::mat, arma::mat, NoRegularizer > *, LinearNoBias< arma::mat, arma::mat, NoRegularizer > *, LogSoftMax< arma::mat, arma::mat > *, Lookup< arma::mat, arma::mat > *, LSTM< arma::mat, arma::mat > *, MaxPooling< arma::mat, arma::mat > *, MeanPooling< arma::mat, arma::mat > *, MiniBatchDiscrimination< arma::mat, arma::mat > *, MultiplyConstant< arma::mat, arma::mat > *, MultiplyMerge< arma::mat, arma::mat > *, NegativeLogLikelihood< arma::mat, arma::mat > *, NoisyLinear< arma::mat, arma::mat > *, Padding< arma::mat, arma::mat > *, PReLU< arma::mat, arma::mat > *, Softmax< arma::mat, arma::mat > *, SpatialDropout< arma::mat, arma::mat > *, TransposedConvolution< NaiveConvolution< ValidConvolution >, NaiveConvolution< ValidConvolution >, NaiveConvolution< ValidConvolution >, arma::mat, arma::mat > *, WeightNorm< arma::mat, arma::mat > *, MoreTypes, CustomLayers *... > LayerTypes
Definition: layer_types.hpp:300
mlpack::ann::SpatialDropout
Implementation of the SpatialDropout layer.
Definition: spatial_dropout.hpp:49
mlpack::ann::Linear3D
Implementation of the Linear3D layer class.
Definition: linear3d.hpp:41
mlpack::ann::MultiplyConstant
Implementation of the multiply constant layer.
Definition: multiply_constant.hpp:35
mlpack::ann::BatchNorm
Declaration of the Batch Normalization layer class.
Definition: batch_norm.hpp:57
mlpack::ann::Reparametrization
Implementation of the Reparametrization layer class.
Definition: reparametrization.hpp:57
reinforce_normal.hpp
no_regularizer.hpp
mlpack::ann::MiniBatchDiscrimination
Implementation of the MiniBatchDiscrimination layer.
Definition: minibatch_discrimination.hpp:54
elu.hpp
multihead_attention.hpp
mlpack::ann::GRU
An implementation of a gru network layer.
Definition: gru.hpp:59
dropout.hpp
mlpack::ann::Padding
Implementation of the Padding module class.
Definition: padding.hpp:35
join.hpp
alpha_dropout.hpp
mlpack::ann::MultiheadAttention
Multihead Attention allows the model to jointly attend to information from different representation s...
Definition: multihead_attention.hpp:63
hard_tanh.hpp
concatenate.hpp
mlpack::ann::HardTanH
The Hard Tanh activation function, defined by.
Definition: hard_tanh.hpp:50
mlpack::ann::NaiveConvolution
Computes the two-dimensional convolution.
Definition: naive_convolution.hpp:36
mlpack::ann::ELU
The ELU activation function, defined by.
Definition: elu.hpp:112
mlpack::ann::CELU
The CELU activation function, defined by.
Definition: celu.hpp:61
mlpack::ann::FlexibleReLU
The FlexibleReLU activation function, defined by.
Definition: flexible_relu.hpp:60
batch_norm.hpp
virtual_batch_norm.hpp
celu.hpp
mlpack::ann::RBF
Implementation of the Radial Basis Function layer.
Definition: radial_basis_function.hpp:54
mean_pooling.hpp
constant.hpp
mlpack::ann::VRClassReward
Implementation of the variance reduced classification reinforcement layer.
Definition: vr_class_reward.hpp:39
parametric_relu.hpp
mlpack::ann::LinearNoBias
Implementation of the LinearNoBias class.
Definition: linear_no_bias.hpp:39
mlpack::ann::ConcatPerformance
Implementation of the concat performance class.
Definition: concat_performance.hpp:40
mlpack::ann::Constant
Implementation of the constant layer.
Definition: constant.hpp:35
mlpack::ann::AtrousConvolution
Implementation of the Atrous Convolution class.
Definition: atrous_convolution.hpp:53
border_modes.hpp
mlpack::ann::MaxPooling< arma::mat, arma::mat >
mlpack::ann::Subview
Implementation of the subview layer.
Definition: subview.hpp:35
mlpack::ann::Linear
Implementation of the Linear layer class.
Definition: linear.hpp:39
mlpack::ann::VirtualBatchNorm
Declaration of the VirtualBatchNorm layer class.
Definition: virtual_batch_norm.hpp:47
layer_norm.hpp