Implementation of the Reparametrization layer class. More...
Public Member Functions | |
| Reparametrization () | |
| Create the Reparametrization object. More... | |
| 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. More... | |
| Reparametrization (Reparametrization &&layer) | |
| Move Constructor. 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... | |
| double | Beta () const |
| Get the value of the beta hyperparameter. More... | |
| OutputDataType const & | Delta () const |
| Get the delta. More... | |
| OutputDataType & | Delta () |
| Modify the delta. More... | |
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... | |
| bool | IncludeKL () const |
| Get the value of the includeKl parameter. More... | |
| size_t | InputShape () const |
| double | Loss () |
| Get the KL divergence with standard normal. More... | |
| Reparametrization & | operator= (const Reparametrization &layer) |
| Copy assignment operator. More... | |
| Reparametrization & | operator= (Reparametrization &&layer) |
| Move assignment operator. More... | |
| OutputDataType const & | OutputParameter () const |
| Get the output parameter. More... | |
| OutputDataType & | OutputParameter () |
| Modify the output parameter. More... | |
| size_t const & | OutputSize () const |
| Get the output size. More... | |
| size_t & | OutputSize () |
| Modify the output size. More... | |
template < typename Archive > | |
| void | serialize (Archive &ar, const uint32_t) |
| Serialize the layer. More... | |
| bool | Stochastic () const |
| Get the value of the stochastic parameter. More... | |
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). |
Definition at line 134 of file layer_types.hpp.
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.
| 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. |
| Reparametrization | ( | const Reparametrization< InputDataType, OutputDataType > & | layer | ) |
Copy Constructor.
| Reparametrization | ( | Reparametrization< InputDataType, OutputDataType > && | layer | ) |
Move Constructor.
| 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.
Using the results from the feed forward pass.
| input | The propagated input activation. |
| gy | The backpropagated error. |
| g | The calculated gradient. |
|
inline |
Get the value of the beta hyperparameter.
Definition at line 143 of file reparametrization.hpp.
|
inline |
Get the delta.
Definition at line 117 of file reparametrization.hpp.
|
inline |
Modify the delta.
Definition at line 119 of file reparametrization.hpp.
| 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.
| input | Input data used for evaluating the specified function. |
| output | Resulting output activation. |
|
inline |
Get the value of the includeKl parameter.
Definition at line 140 of file reparametrization.hpp.
|
inline |
Definition at line 145 of file reparametrization.hpp.
References Reparametrization< InputDataType, OutputDataType >::serialize().
|
inline |
Get the KL divergence with standard normal.
Definition at line 127 of file reparametrization.hpp.
| Reparametrization& operator= | ( | const Reparametrization< InputDataType, OutputDataType > & | layer | ) |
Copy assignment operator.
| Reparametrization& operator= | ( | Reparametrization< InputDataType, OutputDataType > && | layer | ) |
Move assignment operator.
|
inline |
Get the output parameter.
Definition at line 112 of file reparametrization.hpp.
|
inline |
Modify the output parameter.
Definition at line 114 of file reparametrization.hpp.
|
inline |
Get the output size.
Definition at line 122 of file reparametrization.hpp.
|
inline |
Modify the output size.
Definition at line 124 of file reparametrization.hpp.
| void serialize | ( | Archive & | ar, |
| const uint32_t | |||
| ) |
Serialize the layer.
Referenced by Reparametrization< InputDataType, OutputDataType >::InputShape().
|
inline |
Get the value of the stochastic parameter.
Definition at line 137 of file reparametrization.hpp.