12 #ifndef MLPACK_METHODS_ANN_LAYER_CONCAT_PERFORMANCE_IMPL_HPP 13 #define MLPACK_METHODS_ANN_LAYER_CONCAT_PERFORMANCE_IMPL_HPP 22 typename OutputLayerType,
23 typename InputDataType,
24 typename OutputDataType
32 outputLayer(
std::move(outputLayer))
38 typename OutputLayerType,
39 typename InputDataType,
40 typename OutputDataType
47 >::Forward(
const arma::Mat<eT>& input, arma::Mat<eT>& target)
49 const size_t elements = input.n_elem / inSize;
52 for (
size_t i = 0; i < input.n_elem; i+= elements)
54 arma::mat subInput = input.submat(i, 0, i + elements - 1, 0);
55 output += outputLayer.Forward(subInput, target);
62 typename OutputLayerType,
63 typename InputDataType,
64 typename OutputDataType
72 const arma::Mat<eT>& input,
73 const arma::Mat<eT>& target,
74 arma::Mat<eT>& output)
76 const size_t elements = input.n_elem / inSize;
78 arma::mat subInput = input.submat(0, 0, elements - 1, 0);
81 outputLayer.Backward(subInput, target, subOutput);
83 output = arma::zeros(subOutput.n_elem, inSize);
84 output.col(0) = subOutput;
86 for (
size_t i = elements, j = 0; i < input.n_elem; i+= elements, ++j)
88 subInput = input.submat(i, 0, i + elements - 1, 0);
89 outputLayer.Backward(subInput, target, subOutput);
91 output.col(j) = subOutput;
96 typename OutputLayerType,
97 typename InputDataType,
98 typename OutputDataType
100 template<
typename Archive>
107 ar(CEREAL_NVP(inSize));
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1
Definition: pointer_wrapper.hpp:23