Declaration of the VirtualBatchNorm layer class. More...
Public Member Functions | |
VirtualBatchNorm () | |
Create the VirtualBatchNorm object. More... | |
template < typename eT > | |
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. More... | |
template < typename eT > | |
void | Backward (const arma::Mat< eT > &, const arma::Mat< eT > &gy, arma::Mat< eT > &g) |
Backward pass through the layer. More... | |
OutputDataType const & | Delta () const |
Get the delta. More... | |
OutputDataType & | Delta () |
Modify the delta. More... | |
double | Epsilon () const |
Get the epsilon value. More... | |
template < typename eT > | |
void | Forward (const arma::Mat< eT > &input, arma::Mat< eT > &output) |
Forward pass of the Virtual Batch Normalization layer. More... | |
template < typename eT > | |
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. More... | |
OutputDataType const & | Gradient () const |
Get the gradient. More... | |
OutputDataType & | Gradient () |
Modify the gradient. More... | |
size_t | InSize () const |
Get the number of input units. More... | |
OutputDataType const & | OutputParameter () const |
Get the output parameter. More... | |
OutputDataType & | OutputParameter () |
Modify the output parameter. More... | |
OutputDataType const & | Parameters () const |
Get the parameters. More... | |
OutputDataType & | Parameters () |
Modify the parameters. More... | |
void | Reset () |
Reset the layer parameters. More... | |
template < typename Archive > | |
void | serialize (Archive &ar, const uint32_t) |
Serialize the layer. More... | |
Declaration of the VirtualBatchNorm layer class.
Instead of using the batch statistics for normalizing on a mini-batch, it uses a reference subset of the data for calculating the normalization statistics.
For more information, refer to the following paper,
InputDataType | Type of the input data (arma::colvec, arma::mat, arma::sp_mat or arma::cube). |
OutputDataType | Type of the output data (arma::colvec, arma::mat, arma::sp_mat or arma::cube). |
Definition at line 119 of file layer_types.hpp.
VirtualBatchNorm | ( | ) |
Create the VirtualBatchNorm object.
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.
referenceBatch | The data from which the normalization statistics are computed. |
size | The number of input units / channels. |
eps | The epsilon added to variance to ensure numerical stability. |
void Backward | ( | const arma::Mat< eT > & | , |
const arma::Mat< eT > & | gy, | ||
arma::Mat< eT > & | g | ||
) |
Backward pass through the layer.
* | (input) The input activations. |
gy | The backpropagated error. |
g | The calculated gradient. |
|
inline |
Get the delta.
Definition at line 116 of file virtual_batch_norm.hpp.
|
inline |
Modify the delta.
Definition at line 118 of file virtual_batch_norm.hpp.
|
inline |
Get the epsilon value.
Definition at line 129 of file virtual_batch_norm.hpp.
References VirtualBatchNorm< InputDataType, OutputDataType >::serialize().
void Forward | ( | const arma::Mat< eT > & | input, |
arma::Mat< eT > & | output | ||
) |
Forward pass of the Virtual Batch Normalization layer.
Transforms the input data into zero mean and unit variance, scales the data by a factor gamma and shifts it by beta.
input | Input data for the layer. |
output | Resulting output activations. |
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.
* | (input) The input activations. |
error | The calculated error. |
gradient | The calculated gradient. |
|
inline |
Get the gradient.
Definition at line 121 of file virtual_batch_norm.hpp.
|
inline |
Modify the gradient.
Definition at line 123 of file virtual_batch_norm.hpp.
|
inline |
Get the number of input units.
Definition at line 126 of file virtual_batch_norm.hpp.
|
inline |
Get the output parameter.
Definition at line 111 of file virtual_batch_norm.hpp.
|
inline |
Modify the output parameter.
Definition at line 113 of file virtual_batch_norm.hpp.
|
inline |
Get the parameters.
Definition at line 106 of file virtual_batch_norm.hpp.
|
inline |
Modify the parameters.
Definition at line 108 of file virtual_batch_norm.hpp.
void Reset | ( | ) |
Reset the layer parameters.
void serialize | ( | Archive & | ar, |
const uint32_t | |||
) |
Serialize the layer.
Referenced by VirtualBatchNorm< InputDataType, OutputDataType >::Epsilon().