The DropConnect layer is a regularizer that randomly with probability ratio sets the connection values to zero and scales the remaining elements by factor 1 /(1 - ratio). More...
Public Member Functions | |
DropConnect () | |
Create the DropConnect object. More... | |
DropConnect (const size_t inSize, const size_t outSize, const double ratio=0.5) | |
Creates the DropConnect Layer as a Linear Object that takes input size, output size and ratio as parameter. 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 the DropConnect layer. More... | |
OutputDataType const & | Delta () const |
Get the delta. More... | |
OutputDataType & | Delta () |
Modify the delta. More... | |
bool | Deterministic () const |
The value of the deterministic parameter. More... | |
bool & | Deterministic () |
Modify the value of the deterministic parameter. More... | |
template < typename eT > | |
void | Forward (const arma::Mat< eT > &input, arma::Mat< eT > &output) |
Ordinary feed forward pass of the DropConnect layer. More... | |
template < typename eT > | |
void | Gradient (const arma::Mat< eT > &input, const arma::Mat< eT > &error, arma::Mat< eT > &) |
Calculate the gradient using the output delta and the input activation. More... | |
OutputDataType const & | Gradient () const |
Get the gradient. More... | |
OutputDataType & | Gradient () |
Modify the gradient. More... | |
std::vector< LayerTypes<> > & | Model () |
Get the model modules. 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... | |
double | Ratio () const |
The probability of setting a value to zero. More... | |
void | Ratio (const double r) |
Modify the probability of setting a value to zero. More... | |
template < typename Archive > | |
void | serialize (Archive &ar, const uint32_t) |
Serialize the layer. More... | |
size_t | WeightSize () const |
Return the size of the weight matrix. More... | |
The DropConnect layer is a regularizer that randomly with probability ratio sets the connection values to zero and scales the remaining elements by factor 1 /(1 - ratio).
The output is scaled with 1 / (1 - p) when deterministic is false. In the deterministic mode(during testing), the layer just computes the output. The output is computed according to the input layer. If no input layer is given, it will take a linear layer as default.
Note: During training you should set deterministic to false and during testing you should set deterministic to true.
For more information, see the following.
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 63 of file dropconnect.hpp.
DropConnect | ( | ) |
Create the DropConnect object.
DropConnect | ( | const size_t | inSize, |
const size_t | outSize, | ||
const double | ratio = 0.5 |
||
) |
Creates the DropConnect Layer as a Linear Object that takes input size, output size and ratio as parameter.
inSize | The number of input units. |
outSize | The number of output units. |
ratio | The probability of setting a value to zero. |
void Backward | ( | const arma::Mat< eT > & | input, |
const arma::Mat< eT > & | gy, | ||
arma::Mat< eT > & | g | ||
) |
Ordinary feed backward pass of the DropConnect layer.
input | The propagated input activation. |
gy | The backpropagated error. |
g | The calculated gradient. |
|
inline |
Get the delta.
Definition at line 128 of file dropconnect.hpp.
|
inline |
Modify the delta.
Definition at line 130 of file dropconnect.hpp.
|
inline |
The value of the deterministic parameter.
Definition at line 138 of file dropconnect.hpp.
|
inline |
Modify the value of the deterministic parameter.
Definition at line 141 of file dropconnect.hpp.
void Forward | ( | const arma::Mat< eT > & | input, |
arma::Mat< eT > & | output | ||
) |
Ordinary feed forward pass of the DropConnect layer.
input | Input data used for evaluating the specified function. |
output | Resulting output activation. |
void Gradient | ( | const arma::Mat< eT > & | input, |
const arma::Mat< eT > & | error, | ||
arma::Mat< eT > & | |||
) |
Calculate the gradient using the output delta and the input activation.
input | The propagated input. |
error | The calculated error. |
* | (gradient) The calculated gradient. |
|
inline |
Get the gradient.
Definition at line 133 of file dropconnect.hpp.
|
inline |
Modify the gradient.
Definition at line 135 of file dropconnect.hpp.
|
inline |
Get the model modules.
Definition at line 115 of file dropconnect.hpp.
|
inline |
Get the output parameter.
Definition at line 123 of file dropconnect.hpp.
|
inline |
Modify the output parameter.
Definition at line 125 of file dropconnect.hpp.
|
inline |
Get the parameters.
Definition at line 118 of file dropconnect.hpp.
|
inline |
Modify the parameters.
Definition at line 120 of file dropconnect.hpp.
|
inline |
The probability of setting a value to zero.
Definition at line 144 of file dropconnect.hpp.
|
inline |
Modify the probability of setting a value to zero.
Definition at line 147 of file dropconnect.hpp.
void serialize | ( | Archive & | ar, |
const uint32_t | |||
) |
Serialize the layer.
Referenced by DropConnect< InputDataType, OutputDataType >::WeightSize().
|
inline |
Return the size of the weight matrix.
Definition at line 154 of file dropconnect.hpp.
References DropConnect< InputDataType, OutputDataType >::serialize().