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(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>
128 OutputDataType
const&
Delta()
const {
return delta; }
130 OutputDataType&
Delta() {
return delta; }
135 template<
typename Archive>
138 ar & BOOST_SERIALIZATION_NVP(inSize);
139 ar & BOOST_SERIALIZATION_NVP(beginRow);
140 ar & BOOST_SERIALIZATION_NVP(endRow);
141 ar & BOOST_SERIALIZATION_NVP(beginCol);
142 ar & BOOST_SERIALIZATION_NVP(endCol);
162 OutputDataType delta;
165 OutputDataType outputParameter;