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
72 const double eps = 1e-8,
73 const bool average =
true,
74 const double momentum = 0.1);
90 void Forward(
const arma::Mat<eT>& input, arma::Mat<eT>& output);
100 void Backward(
const arma::Mat<eT>& input,
101 const arma::Mat<eT>& gy,
111 template<
typename eT>
112 void Gradient(
const arma::Mat<eT>& input,
113 const arma::Mat<eT>& error,
114 arma::Mat<eT>& gradient);
127 OutputDataType
const&
Delta()
const {
return delta; }
129 OutputDataType&
Delta() {
return delta; }
132 OutputDataType
const&
Gradient()
const {
return gradient; }
169 template<
typename Archive>
170 void serialize(Archive& ar,
const uint32_t );
190 OutputDataType gamma;
199 OutputDataType variance;
202 OutputDataType weights;
215 double averageFactor;
218 OutputDataType runningMean;
221 OutputDataType runningVariance;
224 OutputDataType gradient;
227 OutputDataType delta;
230 OutputDataType outputParameter;
233 arma::cube normalized;
236 arma::cube inputMean;
243 #include "batch_norm_impl.hpp" OutputDataType & Gradient()
Modify the gradient.
OutputDataType const & TrainingMean() const
Get the mean over the training data.
Linear algebra utility functions, generally performed on matrices or vectors.
OutputDataType & TrainingVariance()
Modify the variance over the training data.
The core includes that mlpack expects; standard C++ includes and Armadillo.
OutputDataType & Delta()
Modify the delta.
OutputDataType const & TrainingVariance() const
Get the variance over the training data.
bool Deterministic() const
Get the value of deterministic parameter.
bool Average() const
Get the average 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.
void serialize(Archive &ar, const uint32_t)
Serialize the layer.
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 / channels.
OutputDataType const & Gradient() const
Get the gradient.
Declaration of the Batch Normalization layer class.
double Momentum() const
Get the momentum value.
OutputDataType & TrainingMean()
Modify the mean over the training data.
double Epsilon() const
Get the epsilon value.
size_t WeightSize() const
Get size of weights.
OutputDataType const & Delta() const
Get the delta.