12 #ifndef MLPACK_METHODS_ANN_LAYER_LAYERNORM_HPP 13 #define MLPACK_METHODS_ANN_LAYER_LAYERNORM_HPP 62 typename InputDataType = arma::mat,
63 typename OutputDataType = arma::mat
77 LayerNorm(
const size_t size,
const double eps = 1e-8);
93 void Forward(
const arma::Mat<eT>&& input, arma::Mat<eT>&& output);
102 template<
typename eT>
103 void Backward(
const arma::Mat<eT>&& input,
114 template<
typename eT>
115 void Gradient(
const arma::Mat<eT>&& input,
116 arma::Mat<eT>&& error,
117 arma::Mat<eT>&& gradient);
130 OutputDataType
const&
Delta()
const {
return delta; }
132 OutputDataType&
Delta() {
return delta; }
135 OutputDataType
const&
Gradient()
const {
return gradient; }
140 OutputDataType
Mean() {
return mean; }
148 template<
typename Archive>
149 void serialize(Archive& ar,
const unsigned int );
162 OutputDataType gamma;
168 OutputDataType weights;
174 OutputDataType variance;
177 OutputDataType gradient;
180 OutputDataType delta;
183 OutputDataType outputParameter;
186 OutputDataType normalized;
189 OutputDataType inputMean;
196 #include "layer_norm_impl.hpp" void Backward(const arma::Mat< eT > &&input, arma::Mat< eT > &&gy, arma::Mat< eT > &&g)
Backward pass through the layer.
OutputDataType Mean()
Get the mean across single training data.
OutputDataType const & OutputParameter() const
Get the output parameter.
The core includes that mlpack expects; standard C++ includes and Armadillo.
OutputDataType const & Delta() const
Get the delta.
OutputDataType & Parameters()
Modify the parameters.
LayerNorm()
Create the LayerNorm object.
OutputDataType & OutputParameter()
Modify the output parameter.
OutputDataType & Delta()
Modify the delta.
Declaration of the Layer Normalization class.
OutputDataType & Gradient()
Modify the gradient.
OutputDataType const & Parameters() const
Get the parameters.
OutputDataType Variance()
Get the variance across single training data.
void serialize(Archive &ar, const unsigned int)
Serialize the layer.
OutputDataType const & Gradient() const
Get the gradient.
void Forward(const arma::Mat< eT > &&input, arma::Mat< eT > &&output)
Forward pass of Layer Normalization.
void Reset()
Reset the layer parameters.