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,
95 const arma::Mat<eT>& gy,
105 template<
typename eT>
106 void Gradient(
const arma::Mat<eT>& input,
107 const 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; }
150 template<
typename Archive>
151 void serialize(Archive& ar,
const unsigned int );
164 OutputDataType gamma;
170 OutputDataType weights;
185 OutputDataType variance;
188 OutputDataType runningMean;
191 OutputDataType runningVariance;
194 OutputDataType gradient;
197 OutputDataType delta;
200 OutputDataType outputParameter;
203 OutputDataType normalized;
206 OutputDataType inputMean;
213 #include "batch_norm_impl.hpp" OutputDataType & Gradient()
Modify the gradient.
void serialize(Archive &ar, const unsigned int)
Serialize the layer.
Linear algebra utility functions, generally performed on matrices or vectors.
The core includes that mlpack expects; standard C++ includes and Armadillo.
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 Forward(const arma::Mat< eT > &input, arma::Mat< eT > &output)
Forward pass of the Batch Normalization layer.
void Reset()
Reset the layer parameters.
OutputDataType & Parameters()
Modify the parameters.
bool & Deterministic()
Modify the value of deterministic parameter.
BatchNorm()
Create the BatchNorm object.
void Backward(const arma::Mat< eT > &input, const arma::Mat< eT > &gy, arma::Mat< eT > &g)
Backward pass through the layer.
OutputDataType & OutputParameter()
Modify the output parameter.
OutputDataType const & Parameters() const
Get the parameters.
size_t InputSize() const
Get the number of input units.
OutputDataType const & Gradient() const
Get the gradient.
Declaration of the Batch Normalization layer class.
double Epsilon() const
Get the epsilon value.
OutputDataType TrainingVariance()
Get the variance over the training data.
OutputDataType const & Delta() const
Get the delta.