13 #ifndef MLPACK_METHODS_ANN_LAYER_SEQUENTIAL_HPP 14 #define MLPACK_METHODS_ANN_LAYER_SEQUENTIAL_HPP 18 #include <boost/ptr_container/ptr_vector.hpp> 20 #include "../visitor/delete_visitor.hpp" 21 #include "../visitor/delta_visitor.hpp" 22 #include "../visitor/output_height_visitor.hpp" 23 #include "../visitor/output_parameter_visitor.hpp" 24 #include "../visitor/output_width_visitor.hpp" 43 typename InputDataType = arma::mat,
44 typename OutputDataType = arma::mat
68 void Forward(arma::Mat<eT>&& input, arma::Mat<eT>&& output);
80 void Backward(
const arma::Mat<eT>&& ,
93 arma::Mat<eT>&& error,
101 template <
class LayerType,
class... Args>
102 void Add(Args... args) {
network.push_back(
new LayerType(args...)); }
149 template<
typename Archive>
150 void Serialize(Archive& ,
const unsigned int );
206 #include "sequential_impl.hpp" arma::mat inputParameter
Locally-stored input parameter object.
DeleteVisitor executes the destructor of the instantiated object.
arma::mat outputParameter
Locally-stored output parameter object.
OutputWidthVisitor exposes the OutputHeight() method of the given module.
bool model
Parameter which indicates if the modules should be exposed.
arma::mat const & OutputParameter() const
Get the output parameter.
bool reset
Indicator if we already initialized the model.
Linear algebra utility functions, generally performed on matrices or vectors.
void Serialize(Archive &, const unsigned int)
Serialize the layer.
arma::mat & InputParameter()
Modify the input parameter.
The core includes that mlpack expects; standard C++ includes and Armadillo.
arma::mat const & Gradient() const
Get the gradient.
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...
~Sequential()
Destroy the Sequential object.
arma::mat & Parameters()
Modify the initial point for the optimization.
arma::mat parameters
Locally-stored model parameters.
std::vector< LayerTypes > network
Locally-stored network modules.
arma::mat & Delta()
Modify the delta.
Sequential(const bool model=true)
Create the Sequential object using the specified parameters.
arma::mat & Gradient()
Modify the gradient.
OutputParameterVisitor exposes the output parameter of the given module.
arma::mat & OutputParameter()
Modify the output parameter.
size_t height
The input height.
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
const arma::mat & Parameters() const
Return the initial point for the optimization.
void Add(LayerTypes layer)
OutputWidthVisitor outputWidthVisitor
Locally-stored output width visitor.
DeleteVisitor deleteVisitor
Locally-stored delete visitor.
OutputParameterVisitor outputParameterVisitor
Locally-stored output parameter visitor.
std::vector< LayerTypes > empty
Locally-stored empty list of modules.
DeltaVisitor exposes the delta parameter of the given module.
arma::mat const & Delta() const
Get the delta.e.
arma::mat delta
Locally-stored delta object.
OutputWidthVisitor exposes the OutputWidth() method of the given module.
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.
DeltaVisitor deltaVisitor
Locally-stored delta visitor.
size_t width
The input width.
OutputHeightVisitor outputHeightVisitor
Locally-stored output height visitor.
arma::mat gradient
Locally-stored gradient object.
std::vector< LayerTypes > & Model()
Return the model modules.