mlpack
|
Implementation of the Reparametrization layer class. More...
#include <reparametrization.hpp>
Public Member Functions | |
Reparametrization () | |
Create the Reparametrization object. | |
Reparametrization (const size_t latentSize, const bool stochastic=true, const bool includeKl=true, const double beta=1) | |
Create the Reparametrization layer object using the specified sample vector size. More... | |
Reparametrization (const Reparametrization &layer) | |
Copy Constructor. | |
Reparametrization (Reparametrization &&layer) | |
Move Constructor. | |
Reparametrization & | operator= (const Reparametrization &layer) |
Copy assignment operator. | |
Reparametrization & | operator= (Reparametrization &&layer) |
Move assignment operator. | |
template<typename eT > | |
void | Forward (const arma::Mat< eT > &input, arma::Mat< eT > &output) |
Ordinary feed forward pass of a neural network, evaluating the function f(x) by propagating the activity forward through f. More... | |
template<typename eT > | |
void | Backward (const arma::Mat< eT > &input, const arma::Mat< eT > &gy, arma::Mat< eT > &g) |
Ordinary feed backward pass of a neural network, calculating the function f(x) by propagating x backwards trough f. More... | |
OutputDataType const & | OutputParameter () const |
Get the output parameter. | |
OutputDataType & | OutputParameter () |
Modify the output parameter. | |
OutputDataType const & | Delta () const |
Get the delta. | |
OutputDataType & | Delta () |
Modify the delta. | |
size_t const & | OutputSize () const |
Get the output size. | |
size_t & | OutputSize () |
Modify the output size. | |
double | Loss () |
Get the KL divergence with standard normal. | |
bool | Stochastic () const |
Get the value of the stochastic parameter. | |
bool | IncludeKL () const |
Get the value of the includeKl parameter. | |
double | Beta () const |
Get the value of the beta hyperparameter. | |
size_t | InputShape () const |
template<typename Archive > | |
void | serialize (Archive &ar, const uint32_t) |
Serialize the layer. | |
Implementation of the Reparametrization layer class.
This layer samples from the given parameters of a normal distribution.
This class also supports beta-VAE, a state-of-the-art framework for automated discovery of interpretable factorised latent representations from raw image data in a completely unsupervised manner.
For more information, refer 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). |
mlpack::ann::Reparametrization< InputDataType, OutputDataType >::Reparametrization | ( | const size_t | latentSize, |
const bool | stochastic = true , |
||
const bool | includeKl = true , |
||
const double | beta = 1 |
||
) |
Create the Reparametrization layer object using the specified sample vector size.
latentSize | The number of output latent units. |
stochastic | Whether we want random sample or constant. |
includeKl | Whether we want to include KL loss in backward function. |
beta | The beta (hyper)parameter for beta-VAE mentioned above. |
void mlpack::ann::Reparametrization< InputDataType, OutputDataType >::Backward | ( | const arma::Mat< eT > & | input, |
const arma::Mat< eT > & | gy, | ||
arma::Mat< eT > & | g | ||
) |
Ordinary feed backward pass of a neural network, calculating the function f(x) by propagating x backwards trough f.
Using the results from the feed forward pass.
input | The propagated input activation. |
gy | The backpropagated error. |
g | The calculated gradient. |
void mlpack::ann::Reparametrization< InputDataType, OutputDataType >::Forward | ( | const arma::Mat< eT > & | input, |
arma::Mat< eT > & | output | ||
) |
Ordinary feed forward pass of a neural network, evaluating the function f(x) by propagating the activity forward through f.
input | Input data used for evaluating the specified function. |
output | Resulting output activation. |