12#ifndef MLPACK_METHODS_ANN_LAYER_VIRTUALBATCHNORM_HPP
13#define MLPACK_METHODS_ANN_LAYER_VIRTUALBATCHNORM_HPP
43 typename InputDataType = arma::mat,
44 typename OutputDataType = arma::mat
63 const double eps = 1e-8);
79 void Forward(
const arma::Mat<eT>& input, arma::Mat<eT>& output);
90 const arma::Mat<eT>& gy,
100 template<
typename eT>
102 const arma::Mat<eT>& error,
103 arma::Mat<eT>& gradient);
116 OutputDataType
const&
Delta()
const {
return delta; }
118 OutputDataType&
Delta() {
return delta; }
121 OutputDataType
const&
Gradient()
const {
return gradient; }
134 template<
typename Archive>
148 OutputDataType gamma;
154 OutputDataType weights;
157 OutputDataType referenceBatchMean;
160 OutputDataType referenceBatchMeanSquared;
163 double oldCoefficient;
166 double newCoefficient;
172 OutputDataType variance;
175 OutputDataType gradient;
178 OutputDataType delta;
181 OutputDataType outputParameter;
184 OutputDataType inputParameter;
187 OutputDataType normalized;
190 OutputDataType inputSubMean;
197#include "virtual_batch_norm_impl.hpp"
Declaration of the VirtualBatchNorm layer class.
OutputDataType const & Delta() const
Get the delta.
OutputDataType const & Parameters() const
Get the parameters.
VirtualBatchNorm()
Create the VirtualBatchNorm object.
void Reset()
Reset the layer parameters.
void Forward(const arma::Mat< eT > &input, arma::Mat< eT > &output)
Forward pass of the Virtual Batch Normalization layer.
OutputDataType const & OutputParameter() const
Get the output parameter.
void Gradient(const arma::Mat< eT > &, const arma::Mat< eT > &error, arma::Mat< eT > &gradient)
Calculate the gradient using the output delta and the input activations.
OutputDataType const & Gradient() const
Get the gradient.
OutputDataType & Gradient()
Modify the gradient.
VirtualBatchNorm(const arma::Mat< eT > &referenceBatch, const size_t size, const double eps=1e-8)
Create the VirtualBatchNorm layer object for a specified number of input units.
void Backward(const arma::Mat< eT > &, const arma::Mat< eT > &gy, arma::Mat< eT > &g)
Backward pass through the layer.
OutputDataType & OutputParameter()
Modify the output parameter.
size_t InSize() const
Get the number of input units.
void serialize(Archive &ar, const unsigned int)
Serialize the layer.
OutputDataType & Parameters()
Modify the parameters.
double Epsilon() const
Get the epsilon value.
OutputDataType & Delta()
Modify the delta.
Linear algebra utility functions, generally performed on matrices or vectors.
The core includes that mlpack expects; standard C++ includes and Armadillo.