12 #ifndef MLPACK_METHODS_ANN_LAYER_SUBVIEW_HPP    13 #define MLPACK_METHODS_ANN_LAYER_SUBVIEW_HPP    31     typename InputDataType = arma::mat,
    32     typename OutputDataType = arma::mat
    48           const size_t beginRow = 0,
    49           const size_t endRow = 0,
    50           const size_t beginCol = 0,
    51           const size_t endCol = 0) :
    68   template<
typename InputType, 
typename OutputType>
    69   void Forward(
const InputType& input, OutputType& output)
    71     size_t batchSize = input.n_cols / inSize;
    74     endRow = ((endRow < input.n_rows) && (endRow >= beginRow))?
    75         endRow : (input.n_rows - 1);
    76     endCol = ((endCol < inSize) && (endCol >= beginCol)) ?
    77         endCol : (inSize - 1);
    80         (endRow - beginRow + 1) * (endCol - beginCol + 1), batchSize);
    82     size_t batchBegin = beginCol;
    83     size_t batchEnd = endCol;
    86     if ((input.n_rows != ((endRow - beginRow + 1) *
    87         (endCol - beginCol + 1))) || (input.n_cols != batchSize))
    89       for (
size_t i = 0; i < batchSize; ++i)
    91         output.col(i) = arma::vectorise(
    92             input.submat(beginRow, batchBegin, endRow, batchEnd));
   114   template<
typename eT>
   116                 const arma::Mat<eT>& gy,
   128   OutputDataType 
const& 
Delta()
 const { 
return delta; }
   130   OutputDataType& 
Delta() { 
return delta; }
   136   size_t const& 
BeginRow()
 const { 
return beginRow; }
   141   size_t const& 
EndRow()
 const { 
return endRow; }
   146   size_t const& 
BeginCol()
 const { 
return beginCol; }
   151   size_t const& 
EndCol()
 const { 
return endCol; }
   158   template<
typename Archive>
   161     ar(CEREAL_NVP(inSize));
   162     ar(CEREAL_NVP(beginRow));
   163     ar(CEREAL_NVP(endRow));
   164     ar(CEREAL_NVP(beginCol));
   165     ar(CEREAL_NVP(endCol));
   185   OutputDataType delta;
   188   OutputDataType outputParameter;
 OutputDataType & OutputParameter()
Modify the output parameter. 
 
Linear algebra utility functions, generally performed on matrices or vectors. 
 
The core includes that mlpack expects; standard C++ includes and Armadillo. 
 
size_t const  & EndRow() const
Get the ending row index of subview vector or matrix. 
 
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 backw...
 
size_t InSize() const
Get the width of each sample. 
 
size_t const  & BeginRow() const
Get the starting row index of subview vector or matrix. 
 
size_t const  & BeginCol() const
Get the width of each sample. 
 
size_t const  & EndCol() const
Get the ending column index of subview vector or matrix. 
 
void Forward(const InputType &input, OutputType &output)
Ordinary feed forward pass of a neural network, evaluating the function f(x) by propagating the activ...
 
Implementation of the subview layer. 
 
OutputDataType & Delta()
Modify the delta. 
 
void serialize(Archive &ar, const uint32_t)
Serialize the layer. 
 
OutputDataType const  & Delta() const
Get the delta. 
 
size_t & EndCol()
Modify the width of each sample. 
 
size_t & EndRow()
Modify the width of each sample. 
 
size_t & BeginRow()
Modify the width of each sample. 
 
Subview(const size_t inSize=1, const size_t beginRow=0, const size_t endRow=0, const size_t beginCol=0, const size_t endCol=0)
Create the Subview layer object using the specified range of input to accept. 
 
OutputDataType const  & OutputParameter() const
Get the output parameter. 
 
size_t & BeginCol()
Modify the width of each sample.