mlpack
Public Member Functions | List of all members
mlpack::ann::Concat< InputDataType, OutputDataType, CustomLayers > Class Template Reference

Implementation of the Concat class. More...

#include <concat.hpp>

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.
 
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 > &, const 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 > &, const 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...
 
template<typename eT >
void Gradient (const arma::Mat< eT > &, const arma::Mat< eT > &error, arma::Mat< eT > &)
 
template<typename eT >
void Gradient (const arma::Mat< eT > &input, const arma::Mat< eT > &error, arma::Mat< eT > &gradient, const size_t index)
 
template<class LayerType , class... Args>
void Add (Args... args)
 
void Add (LayerTypes< CustomLayers... > layer)
 
std::vector< LayerTypes< CustomLayers... > > & Model ()
 Return the model modules.
 
const arma::mat & Parameters () const
 Return the initial point for the optimization.
 
arma::mat & Parameters ()
 Modify the initial point for the optimization.
 
bool Run () const
 Get the value of run parameter.
 
bool & Run ()
 Modify the value of run parameter.
 
arma::mat const & InputParameter () const
 
arma::mat & InputParameter ()
 Modify the input parameter.
 
arma::mat const & OutputParameter () const
 Get the output parameter.
 
arma::mat & OutputParameter ()
 Modify the output parameter.
 
arma::mat const & Delta () const
 Get the delta.e.
 
arma::mat & Delta ()
 Modify the delta.
 
arma::mat const & Gradient () const
 Get the gradient.
 
arma::mat & Gradient ()
 Modify the gradient.
 
size_t const & ConcatAxis () const
 Get the axis of concatenation.
 
size_t WeightSize () const
 Get the size of the weight matrix.
 
template<typename Archive >
void serialize (Archive &ar, const uint32_t)
 Serialize the layer.
 

Detailed Description

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat, typename... CustomLayers>
class mlpack::ann::Concat< InputDataType, OutputDataType, CustomLayers >

Implementation of the Concat class.

The Concat class works as a feed-forward fully connected network container which plugs various layers together.

Template Parameters
InputDataTypeType of the input data (arma::colvec, arma::mat, arma::sp_mat or arma::cube).
OutputDataTypeType of the output data (arma::colvec, arma::mat, arma::sp_mat or arma::cube).
CustomLayersAdditional custom layers if required.

Constructor & Destructor Documentation

◆ Concat() [1/2]

template<typename InputDataType , typename OutputDataType , typename... CustomLayers>
mlpack::ann::Concat< InputDataType, OutputDataType, CustomLayers >::Concat ( const bool  model = false,
const bool  run = true 
)

Create the Concat object using the specified parameters.

Parameters
modelExpose all network modules.
runCall the Forward/Backward method before the output is merged.

◆ Concat() [2/2]

template<typename InputDataType , typename OutputDataType , typename... CustomLayers>
mlpack::ann::Concat< InputDataType, OutputDataType, CustomLayers >::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.

Parameters
inputSizeA vector denoting input size of each layer added.
axisConcat axis.
modelExpose all network modules.
runCall the Forward/Backward method before the output is merged.

Member Function Documentation

◆ Backward() [1/2]

template<typename InputDataType , typename OutputDataType , typename... CustomLayers>
template<typename eT >
void mlpack::ann::Concat< InputDataType, OutputDataType, CustomLayers >::Backward ( const arma::Mat< eT > &  ,
const 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.

Parameters
*(input) The propagated input activation.
gyThe backpropagated error.
gThe calculated gradient.

◆ Backward() [2/2]

template<typename InputDataType , typename OutputDataType , typename... CustomLayers>
template<typename eT >
void mlpack::ann::Concat< InputDataType, OutputDataType, CustomLayers >::Backward ( const arma::Mat< eT > &  ,
const 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.

Parameters
*(input) The propagated input activation.
gyThe backpropagated error.
gThe calculated gradient.
indexThe index of the layer to run.

◆ Forward()

template<typename InputDataType , typename OutputDataType , typename... CustomLayers>
template<typename eT >
void mlpack::ann::Concat< InputDataType, OutputDataType, CustomLayers >::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.

Parameters
inputInput data used for evaluating the specified function.
outputResulting output activation.

The documentation for this class was generated from the following files: