Implementation of the Concat class. More...
Public Member Functions | |
Concat (const bool model=false, const bool run=true) | |
Create the Concat object using the specified parameters. More... | |
Concat (arma::Row< size_t > &inputSize, const size_t axis, const bool model=false, const bool run=true) | |
Create the Concat object using the specified parameters. More... | |
~Concat () | |
Destroy the layers held by the model. More... | |
template < typename LayerType > | |
void | Add (const LayerType &layer) |
template<class LayerType , class... Args> | |
void | Add (Args... args) |
void | Add (LayerTypes< CustomLayers... > 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... | |
template < typename eT > | |
void | Backward (const arma::Mat< eT > &&, arma::Mat< eT > &&gy, arma::Mat< eT > &&g, const size_t index) |
This is the overload of Backward() that runs only a specific layer with the given input. 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 > &&) |
template < typename eT > | |
void | Gradient (arma::Mat< eT > &&input, arma::Mat< eT > &&error, arma::Mat< eT > &&gradient, const size_t index) |
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< CustomLayers... > > & | 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... | |
bool | Run () const |
Get the value of run parameter. More... | |
bool & | Run () |
Modify the value of run parameter. More... | |
template < typename Archive > | |
void | serialize (Archive &, const unsigned int) |
Serialize the layer. 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). |
CustomLayers | Additional custom layers if required. |
Definition at line 45 of file concat.hpp.
Concat | ( | const bool | model = false , |
const bool | run = true |
||
) |
Create the Concat object using the specified parameters.
model | Expose all network modules. |
run | Call the Forward/Backward method before the output is merged. |
Concat | ( | arma::Row< size_t > & | inputSize, |
const size_t | axis, | ||
const bool | model = false , |
||
const bool | run = true |
||
) |
~Concat | ( | ) |
Destroy the layers held by the model.
|
inline |
Definition at line 147 of file concat.hpp.
|
inline |
Definition at line 155 of file concat.hpp.
|
inline |
Definition at line 162 of file concat.hpp.
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.
Using the results from the feed forward pass.
input | The propagated input activation. |
gy | The backpropagated error. |
g | The calculated gradient. |
void Backward | ( | const arma::Mat< eT > && | , |
arma::Mat< eT > && | gy, | ||
arma::Mat< eT > && | g, | ||
const size_t | index | ||
) |
This is the overload of Backward() that runs only a specific layer with the given input.
input | The propagated input activation. |
gy | The backpropagated error. |
g | The calculated gradient. |
The | index of the layer to run. |
|
inline |
Get the delta.e.
Definition at line 195 of file concat.hpp.
|
inline |
Modify the delta.
Definition at line 197 of file concat.hpp.
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.
input | Input data used for evaluating the specified function. |
output | Resulting output activation. |
void Gradient | ( | arma::Mat< eT > && | , |
arma::Mat< eT > && | error, | ||
arma::Mat< eT > && | |||
) |
void Gradient | ( | arma::Mat< eT > && | input, |
arma::Mat< eT > && | error, | ||
arma::Mat< eT > && | gradient, | ||
const size_t | index | ||
) |
|
inline |
Get the gradient.
Definition at line 200 of file concat.hpp.
|
inline |
Modify the gradient.
Definition at line 202 of file concat.hpp.
References Concat< InputDataType, OutputDataType, CustomLayers >::serialize().
|
inline |
Definition at line 185 of file concat.hpp.
|
inline |
Modify the input parameter.
Definition at line 187 of file concat.hpp.
|
inline |
Return the model modules.
Definition at line 165 of file concat.hpp.
|
inline |
Get the output parameter.
Definition at line 190 of file concat.hpp.
|
inline |
Modify the output parameter.
Definition at line 192 of file concat.hpp.
|
inline |
Return the initial point for the optimization.
Definition at line 176 of file concat.hpp.
|
inline |
Modify the initial point for the optimization.
Definition at line 178 of file concat.hpp.
|
inline |
Get the value of run parameter.
Definition at line 181 of file concat.hpp.
|
inline |
Modify the value of run parameter.
Definition at line 183 of file concat.hpp.
void serialize | ( | Archive & | , |
const unsigned | int | ||
) |
Serialize the layer.
Referenced by Concat< InputDataType, OutputDataType, CustomLayers >::Gradient().