Concat< InputDataType, OutputDataType, CustomLayers > Class Template Reference

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<class LayerType , class... Args>
void Add (Args... args)
 
void Add (LayerTypes< CustomLayers... > layer)
 
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...

 
size_t const & ConcatAxis () const
 Get the axis of concatenation. More...

 
arma::mat const & Delta () const
 Get the delta.e. More...

 
arma::mat & 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...

 
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)
 
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 &ar, const uint32_t)
 Serialize the layer. More...

 
size_t WeightSize () const
 Get the size of the weight matrix. More...

 

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.

Definition at line 43 of file concat.hpp.

Constructor & Destructor Documentation

◆ Concat() [1/2]

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]

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.

◆ ~Concat()

~Concat ( )

Destroy the layers held by the model.

Member Function Documentation

◆ Add() [1/2]

◆ Add() [2/2]

void Add ( LayerTypes< CustomLayers... >  layer)
inline

Definition at line 152 of file concat.hpp.

◆ Backward() [1/2]

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.

Using the results from the feed forward pass.

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

◆ Backward() [2/2]

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.

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

◆ ConcatAxis()

size_t const& ConcatAxis ( ) const
inline

Get the axis of concatenation.

Definition at line 195 of file concat.hpp.

◆ Delta() [1/2]

arma::mat const& Delta ( ) const
inline

Get the delta.e.

Definition at line 185 of file concat.hpp.

◆ Delta() [2/2]

arma::mat& Delta ( )
inline

Modify the delta.

Definition at line 187 of file concat.hpp.

◆ Forward()

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.

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

◆ Gradient() [1/4]

void Gradient ( const arma::Mat< eT > &  ,
const arma::Mat< eT > &  error,
arma::Mat< eT > &   
)

◆ Gradient() [2/4]

void Gradient ( const arma::Mat< eT > &  input,
const arma::Mat< eT > &  error,
arma::Mat< eT > &  gradient,
const size_t  index 
)

◆ Gradient() [3/4]

arma::mat const& Gradient ( ) const
inline

Get the gradient.

Definition at line 190 of file concat.hpp.

◆ Gradient() [4/4]

arma::mat& Gradient ( )
inline

Modify the gradient.

Definition at line 192 of file concat.hpp.

◆ InputParameter() [1/2]

arma::mat const& InputParameter ( ) const
inline

Definition at line 175 of file concat.hpp.

◆ InputParameter() [2/2]

arma::mat& InputParameter ( )
inline

Modify the input parameter.

Definition at line 177 of file concat.hpp.

◆ Model()

std::vector<LayerTypes<CustomLayers...> >& Model ( )
inline

Return the model modules.

Definition at line 155 of file concat.hpp.

◆ OutputParameter() [1/2]

arma::mat const& OutputParameter ( ) const
inline

Get the output parameter.

Definition at line 180 of file concat.hpp.

◆ OutputParameter() [2/2]

arma::mat& OutputParameter ( )
inline

Modify the output parameter.

Definition at line 182 of file concat.hpp.

◆ Parameters() [1/2]

const arma::mat& Parameters ( ) const
inline

Return the initial point for the optimization.

Definition at line 166 of file concat.hpp.

◆ Parameters() [2/2]

arma::mat& Parameters ( )
inline

Modify the initial point for the optimization.

Definition at line 168 of file concat.hpp.

◆ Run() [1/2]

bool Run ( ) const
inline

Get the value of run parameter.

Definition at line 171 of file concat.hpp.

◆ Run() [2/2]

bool& Run ( )
inline

Modify the value of run parameter.

Definition at line 173 of file concat.hpp.

◆ serialize()

void serialize ( Archive &  ar,
const uint32_t   
)

◆ WeightSize()

size_t WeightSize ( ) const
inline

Get the size of the weight matrix.

Definition at line 198 of file concat.hpp.

References Concat< InputDataType, OutputDataType, CustomLayers >::serialize().


The documentation for this class was generated from the following file:
  • /home/jenkins-mlpack/mlpack.org/_src/mlpack-git/src/mlpack/methods/ann/layer/concat.hpp