mlpack
master
|
Implementation of the Concat class. More...
Public Member Functions | |
Concat (const bool model=true, const bool same=true) | |
Create the Concat object using the specified parameters. More... | |
template<class LayerType , class... Args> | |
void | Add (Args...args) |
void | Add (LayerTypes layer) |
template<typename eT > | |
void | Backward (const arma::Mat< eT > &&, arma::Mat< eT > &&gy, arma::Mat< eT > &&g) |
Ordinary feed backward pass of a neural network, using 3rd-order tensors as input, calculating the function f(x) by propagating x backwards through f. More... | |
arma::mat const & | Delta () const |
Get the delta.e. More... | |
arma::mat & | Delta () |
Modify the delta. More... | |
template<typename eT > | |
void | Forward (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 | Gradient (arma::Mat< eT > &&, arma::Mat< eT > &&error, arma::Mat< eT > &&) |
arma::mat const & | Gradient () const |
Get the gradient. More... | |
arma::mat & | Gradient () |
Modify the gradient. More... | |
arma::mat const & | InputParameter () const |
arma::mat & | InputParameter () |
Modify the input parameter. More... | |
std::vector< LayerTypes > & | Model () |
Return the model modules. More... | |
arma::mat const & | OutputParameter () const |
Get the output parameter. More... | |
arma::mat & | OutputParameter () |
Modify the output parameter. More... | |
const arma::mat & | Parameters () const |
Return the initial point for the optimization. More... | |
arma::mat & | Parameters () |
Modify the initial point for the optimization. More... | |
template<typename Archive > | |
void | Serialize (Archive &, const unsigned int) |
Serialize the layer. More... | |
Private Attributes | |
DeleteVisitor | deleteVisitor |
Locally-stored delete visitor. More... | |
arma::mat | delta |
Locally-stored delta object. More... | |
DeltaVisitor | deltaVisitor |
Locally-stored delta visitor. More... | |
std::vector< LayerTypes > | empty |
Locally-stored empty list of modules. More... | |
arma::mat | gradient |
Locally-stored gradient object. More... | |
arma::mat | inputParameter |
Locally-stored input parameter object. More... | |
bool | model |
Parameter which indicates if the modules should be exposed. More... | |
std::vector< LayerTypes > | network |
Locally-stored network modules. More... | |
arma::mat | outputParameter |
Locally-stored output parameter object. More... | |
OutputParameterVisitor | outputParameterVisitor |
Locally-stored output parameter visitor. More... | |
arma::mat | parameters |
Locally-stored model parameters. More... | |
bool | same |
If true merge the error in the backward pass. More... | |
Implementation of the Concat class.
The Concat class works as a feed-forward fully connected network container which plugs various layers together.
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 42 of file concat.hpp.
mlpack::ann::Concat< InputDataType, OutputDataType >::Concat | ( | const bool | model = true , |
const bool | same = true |
||
) |
Create the Concat object using the specified parameters.
model | Expose all network modules. |
same | Merge the error in the backward pass. |
|
inline |
Definition at line 95 of file concat.hpp.
References mlpack::ann::Concat< InputDataType, OutputDataType >::network.
|
inline |
Definition at line 102 of file concat.hpp.
References mlpack::ann::Concat< InputDataType, OutputDataType >::network.
void mlpack::ann::Concat< InputDataType, OutputDataType >::Backward | ( | const arma::Mat< eT > && | , |
arma::Mat< eT > && | gy, | ||
arma::Mat< eT > && | g | ||
) |
Ordinary feed backward pass of a neural network, using 3rd-order tensors as input, calculating the function f(x) by propagating x backwards through 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 delta.e.
Definition at line 130 of file concat.hpp.
References mlpack::ann::Concat< InputDataType, OutputDataType >::delta.
|
inline |
Modify the delta.
Definition at line 132 of file concat.hpp.
References mlpack::ann::Concat< InputDataType, OutputDataType >::delta.
void mlpack::ann::Concat< InputDataType, OutputDataType >::Forward | ( | 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. |
void mlpack::ann::Concat< InputDataType, OutputDataType >::Gradient | ( | arma::Mat< eT > && | , |
arma::Mat< eT > && | error, | ||
arma::Mat< eT > && | |||
) |
|
inline |
Get the gradient.
Definition at line 135 of file concat.hpp.
References mlpack::ann::Concat< InputDataType, OutputDataType >::gradient.
|
inline |
Modify the gradient.
Definition at line 137 of file concat.hpp.
References mlpack::ann::Concat< InputDataType, OutputDataType >::gradient, and mlpack::ann::Concat< InputDataType, OutputDataType >::Serialize().
|
inline |
Definition at line 120 of file concat.hpp.
References mlpack::ann::Concat< InputDataType, OutputDataType >::inputParameter.
|
inline |
Modify the input parameter.
Definition at line 122 of file concat.hpp.
References mlpack::ann::Concat< InputDataType, OutputDataType >::inputParameter.
|
inline |
Return the model modules.
Definition at line 105 of file concat.hpp.
References mlpack::ann::Concat< InputDataType, OutputDataType >::empty, mlpack::ann::Concat< InputDataType, OutputDataType >::model, and mlpack::ann::Concat< InputDataType, OutputDataType >::network.
|
inline |
Get the output parameter.
Definition at line 125 of file concat.hpp.
References mlpack::ann::Concat< InputDataType, OutputDataType >::outputParameter.
|
inline |
Modify the output parameter.
Definition at line 127 of file concat.hpp.
References mlpack::ann::Concat< InputDataType, OutputDataType >::outputParameter.
|
inline |
Return the initial point for the optimization.
Definition at line 116 of file concat.hpp.
References mlpack::ann::Concat< InputDataType, OutputDataType >::parameters.
|
inline |
Modify the initial point for the optimization.
Definition at line 118 of file concat.hpp.
References mlpack::ann::Concat< InputDataType, OutputDataType >::parameters.
void mlpack::ann::Concat< InputDataType, OutputDataType >::Serialize | ( | Archive & | , |
const unsigned | int | ||
) |
Serialize the layer.
Referenced by mlpack::ann::Concat< InputDataType, OutputDataType >::Gradient().
|
private |
Locally-stored delete visitor.
Definition at line 165 of file concat.hpp.
|
private |
Locally-stored delta object.
Definition at line 171 of file concat.hpp.
Referenced by mlpack::ann::Concat< InputDataType, OutputDataType >::Delta().
|
private |
Locally-stored delta visitor.
Definition at line 159 of file concat.hpp.
|
private |
Locally-stored empty list of modules.
Definition at line 168 of file concat.hpp.
Referenced by mlpack::ann::Concat< InputDataType, OutputDataType >::Model().
|
private |
Locally-stored gradient object.
Definition at line 180 of file concat.hpp.
Referenced by mlpack::ann::Concat< InputDataType, OutputDataType >::Gradient().
|
private |
Locally-stored input parameter object.
Definition at line 174 of file concat.hpp.
Referenced by mlpack::ann::Concat< InputDataType, OutputDataType >::InputParameter().
|
private |
Parameter which indicates if the modules should be exposed.
Definition at line 147 of file concat.hpp.
Referenced by mlpack::ann::Concat< InputDataType, OutputDataType >::Model().
|
private |
Locally-stored network modules.
Definition at line 153 of file concat.hpp.
Referenced by mlpack::ann::Concat< InputDataType, OutputDataType >::Add(), and mlpack::ann::Concat< InputDataType, OutputDataType >::Model().
|
private |
Locally-stored output parameter object.
Definition at line 177 of file concat.hpp.
Referenced by mlpack::ann::Concat< InputDataType, OutputDataType >::OutputParameter().
|
private |
Locally-stored output parameter visitor.
Definition at line 162 of file concat.hpp.
|
private |
Locally-stored model parameters.
Definition at line 156 of file concat.hpp.
Referenced by mlpack::ann::Concat< InputDataType, OutputDataType >::Parameters().
|
private |
If true merge the error in the backward pass.
Definition at line 150 of file concat.hpp.