13 #ifndef MLPACK_METHODS_ANN_LAYER_BATCHNORM_HPP 14 #define MLPACK_METHODS_ANN_LAYER_BATCHNORM_HPP 53 typename InputDataType = arma::mat,
54 typename OutputDataType = arma::mat
68 BatchNorm(
const size_t size,
const double eps = 1e-8);
84 void Forward(
const arma::Mat<eT>&& input, arma::Mat<eT>&& output);
94 void Backward(
const arma::Mat<eT>&& input,
105 template<
typename eT>
106 void Gradient(
const arma::Mat<eT>&& input,
107 arma::Mat<eT>&& error,
108 arma::Mat<eT>&& gradient);
121 OutputDataType
const&
Delta()
const {
return delta; }
123 OutputDataType&
Delta() {
return delta; }
126 OutputDataType
const&
Gradient()
const {
return gradient; }
144 template<
typename Archive>
145 void serialize(Archive& ar,
const unsigned int );
158 OutputDataType gamma;
164 OutputDataType weights;
179 OutputDataType variance;
182 OutputDataType runningMean;
185 OutputDataType runningVariance;
188 OutputDataType gradient;
191 OutputDataType delta;
194 OutputDataType outputParameter;
197 OutputDataType normalized;
200 OutputDataType inputMean;
207 #include "batch_norm_impl.hpp" OutputDataType & Gradient()
Modify the gradient.
void serialize(Archive &ar, const unsigned int)
Serialize the layer.
void Forward(const arma::Mat< eT > &&input, arma::Mat< eT > &&output)
Forward pass of the Batch Normalization layer.
The core includes that mlpack expects; standard C++ includes and Armadillo.
void Backward(const arma::Mat< eT > &&input, arma::Mat< eT > &&gy, arma::Mat< eT > &&g)
Backward pass through the layer.
OutputDataType & Delta()
Modify the delta.
OutputDataType TrainingMean()
Get the mean over the training data.
bool Deterministic() const
Get the value of deterministic parameter.
OutputDataType const & OutputParameter() const
Get the output parameter.
void Reset()
Reset the layer parameters.
OutputDataType & Parameters()
Modify the parameters.
bool & Deterministic()
Modify the value of deterministic parameter.
BatchNorm()
Create the BatchNorm object.
OutputDataType & OutputParameter()
Modify the output parameter.
OutputDataType const & Parameters() const
Get the parameters.
OutputDataType const & Gradient() const
Get the gradient.
Declaration of the Batch Normalization layer class.
OutputDataType TrainingVariance()
Get the variance over the training data.
OutputDataType const & Delta() const
Get the delta.