12 #ifndef MLPACK_METHODS_ANN_LAYER_CONCAT_HPP 13 #define MLPACK_METHODS_ANN_LAYER_CONCAT_HPP 17 #include "../visitor/delete_visitor.hpp" 18 #include "../visitor/delta_visitor.hpp" 19 #include "../visitor/output_parameter_visitor.hpp" 21 #include <boost/ptr_container/ptr_vector.hpp> 39 typename InputDataType = arma::mat,
40 typename OutputDataType = arma::mat
61 void Forward(arma::Mat<eT>&& input, arma::Mat<eT>&& output);
73 void Backward(
const arma::Mat<eT>&& ,
86 arma::Mat<eT>&& error,
94 template <
class LayerType,
class... Args>
95 void Add(Args... args) {
network.push_back(
new LayerType(args...)); }
142 template<
typename Archive>
143 void Serialize(Archive& ,
const unsigned int );
187 #include "concat_impl.hpp" DeleteVisitor executes the destructor of the instantiated object.
void Serialize(Archive &, const unsigned int)
Serialize the layer.
const arma::mat & Parameters() const
Return the initial point for the optimization.
arma::mat outputParameter
Locally-stored output parameter object.
bool same
If true merge the error in the backward pass.
Linear algebra utility functions, generally performed on matrices or vectors.
arma::mat parameters
Locally-stored model parameters.
DeltaVisitor deltaVisitor
Locally-stored delta visitor.
DeleteVisitor deleteVisitor
Locally-stored delete visitor.
The core includes that mlpack expects; standard C++ includes and Armadillo.
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.
void Add(LayerTypes layer)
std::vector< LayerTypes > & Model()
Return the model modules.
Concat(const bool model=true, const bool same=true)
Create the Concat object using the specified parameters.
Implementation of the Concat class.
arma::mat & Delta()
Modify the delta.
OutputParameterVisitor exposes the output parameter of the given module.
arma::mat & InputParameter()
Modify the input parameter.
arma::mat gradient
Locally-stored gradient object.
arma::mat const & InputParameter() const
boost::variant< Add< arma::mat, arma::mat > *, AddMerge< arma::mat, arma::mat > *, BaseLayer< LogisticFunction, arma::mat, arma::mat > *, BaseLayer< IdentityFunction, arma::mat, arma::mat > *, BaseLayer< TanhFunction, arma::mat, arma::mat > *, BaseLayer< RectifierFunction, arma::mat, arma::mat > *, Concat< arma::mat, arma::mat > *, ConcatPerformance< NegativeLogLikelihood< arma::mat, arma::mat >, arma::mat, arma::mat > *, Constant< arma::mat, arma::mat > *, Convolution< NaiveConvolution< ValidConvolution >, NaiveConvolution< FullConvolution >, NaiveConvolution< ValidConvolution >, arma::mat, arma::mat > *, DropConnect< arma::mat, arma::mat > *, Dropout< arma::mat, arma::mat > *, Glimpse< arma::mat, arma::mat > *, HardTanH< arma::mat, arma::mat > *, Join< arma::mat, arma::mat > *, LeakyReLU< arma::mat, arma::mat > *, Linear< arma::mat, arma::mat > *, LinearNoBias< arma::mat, arma::mat > *, LogSoftMax< arma::mat, arma::mat > *, Lookup< arma::mat, arma::mat > *, LSTM< arma::mat, arma::mat > *, MaxPooling< arma::mat, arma::mat > *, MeanPooling< arma::mat, arma::mat > *, MeanSquaredError< arma::mat, arma::mat > *, MultiplyConstant< arma::mat, arma::mat > *, NegativeLogLikelihood< arma::mat, arma::mat > *, PReLU< arma::mat, arma::mat > *, Recurrent< arma::mat, arma::mat > *, RecurrentAttention< arma::mat, arma::mat > *, ReinforceNormal< arma::mat, arma::mat > *, Select< arma::mat, arma::mat > *, Sequential< arma::mat, arma::mat > *, VRClassReward< arma::mat, arma::mat > * > LayerTypes
arma::mat inputParameter
Locally-stored input parameter object.
arma::mat const & OutputParameter() const
Get the output parameter.
bool model
Parameter which indicates if the modules should be exposed.
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 activ...
DeltaVisitor exposes the delta parameter of the given module.
arma::mat & OutputParameter()
Modify the output parameter.
arma::mat const & Delta() const
Get the delta.e.
std::vector< LayerTypes > empty
Locally-stored empty list of modules.
std::vector< LayerTypes > network
Locally-stored network modules.
arma::mat & Parameters()
Modify the initial point for the optimization.
arma::mat & Gradient()
Modify the gradient.
arma::mat const & Gradient() const
Get the gradient.
arma::mat delta
Locally-stored delta object.
OutputParameterVisitor outputParameterVisitor
Locally-stored output parameter visitor.