14 #ifndef MLPACK_METHODS_ANN_LAYER_BATCHNORM_HPP 15 #define MLPACK_METHODS_ANN_LAYER_BATCHNORM_HPP 54 typename InputDataType = arma::mat,
55 typename OutputDataType = arma::mat
69 BatchNorm(
const size_t size,
const double eps = 1e-8);
85 void Forward(
const arma::Mat<eT>&& input, arma::Mat<eT>&& output);
95 void Backward(
const arma::Mat<eT>&& input,
106 template<
typename eT>
107 void Gradient(
const arma::Mat<eT>&& input,
108 arma::Mat<eT>&& error,
109 arma::Mat<eT>&& gradient);
127 OutputDataType
const&
Delta()
const {
return delta; }
129 OutputDataType&
Delta() {
return delta; }
132 OutputDataType
const&
Gradient()
const {
return gradient; }
150 template<
typename Archive>
151 void serialize(Archive& ar,
const unsigned int );
161 OutputDataType gamma;
167 OutputDataType weights;
179 OutputDataType variance;
182 arma::running_stat_vec<arma::colvec> stats;
185 OutputDataType gradient;
188 OutputDataType delta;
191 InputDataType inputParameter;
194 OutputDataType outputParameter;
197 OutputDataType normalized;
204 #include "batch_norm_impl.hpp" OutputDataType & Gradient()
Modify the gradient.
InputDataType const & InputParameter() const
Get the input parameter.
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.
InputDataType & InputParameter()
Modify the input parameter.
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.