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

Implementation of the MultiplyMerge module class. More...

#include <multiply_merge.hpp>

Public Member Functions

 MultiplyMerge (const bool model=false, const bool run=true)
 Create the MultiplyMerge object using the specified parameters. More...
 
 MultiplyMerge (const MultiplyMerge &layer)
 Copy Constructor.
 
 MultiplyMerge (MultiplyMerge &&layer)
 Move Constructor.
 
MultiplyMergeoperator= (const MultiplyMerge &layer)
 Copy assignment operator.
 
MultiplyMergeoperator= (MultiplyMerge &&layer)
 Move assignment operator.
 
 ~MultiplyMerge ()
 Destructor to release allocated memory.
 
template<typename InputType , typename OutputType >
void Forward (const InputType &, OutputType &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, calculating the function f(x) by propagating x backwards trough f, using the results from the feed forward pass. More...
 
template<typename eT >
void Gradient (const arma::Mat< eT > &input, const arma::Mat< eT > &error, arma::Mat< eT > &gradient)
 
template<class LayerType , class... Args>
void Add (Args... args)
 
void Add (LayerTypes< CustomLayers... > layer)
 
OutputDataType const & OutputParameter () const
 Get the output parameter.
 
OutputDataType & OutputParameter ()
 Modify the output parameter.
 
OutputDataType const & Delta () const
 Get the delta.
 
OutputDataType & Delta ()
 Modify the delta.
 
OutputDataType const & Gradient () const
 Get the gradient.
 
OutputDataType & Gradient ()
 Modify the gradient.
 
std::vector< LayerTypes< CustomLayers... > > & Model ()
 Return the model modules.
 
OutputDataType const & Parameters () const
 Get the parameters.
 
OutputDataType & Parameters ()
 Modify the parameters.
 
size_t WeightSize () const
 Get the size of the weights.
 
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::MultiplyMerge< InputDataType, OutputDataType, CustomLayers >

Implementation of the MultiplyMerge module class.

The MultiplyMerge class multiplies the output of various modules element-wise.

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 that can be added.

Constructor & Destructor Documentation

◆ MultiplyMerge()

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

Create the MultiplyMerge object using the specified parameters.

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

Member Function Documentation

◆ Backward()

template<typename InputDataType , typename OutputDataType , typename... CustomLayers>
template<typename eT >
void mlpack::ann::MultiplyMerge< 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, calculating the function f(x) by propagating x backwards trough f, using the results from the feed forward pass.

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

◆ Forward()

template<typename InputDataType , typename OutputDataType , typename... CustomLayers>
template<typename InputType , typename OutputType >
void mlpack::ann::MultiplyMerge< InputDataType, OutputDataType, CustomLayers >::Forward ( const InputType &  input,
OutputType &  output 
)

Ordinary feed forward pass of a neural network, evaluating the function f(x) by propagating the activity forward through f.

Parameters
*(input) Input data used for evaluating the specified function.
outputResulting output activation.

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