13 #ifndef MLPACK_METHODS_ANN_LAYER_CONCATENATE_IMPL_HPP 14 #define MLPACK_METHODS_ANN_LAYER_CONCATENATE_IMPL_HPP 22 template<
typename InputDataType,
typename OutputDataType>
29 template<
typename InputDataType,
typename OutputDataType>
33 weights(layer.weights),
40 template<
typename InputDataType,
typename OutputDataType>
43 weights(
std::move(layer.weights)),
44 delta(
std::move(layer.delta)),
45 concat(
std::move(layer.concat))
50 template<
typename InputDataType,
typename OutputDataType>
57 inRows = layer.inRows;
58 weights = layer.weights;
60 concat = layer.concat;
66 template<
typename InputDataType,
typename OutputDataType>
73 inRows = layer.inRows;
74 weights = std::move(layer.weights);
75 delta = std::move(layer.delta);
76 concat = std::move(layer.concat);
81 template<
typename InputDataType,
typename OutputDataType>
84 const arma::Mat<eT>& input, arma::Mat<eT>& output)
86 if (concat.is_empty())
87 Log::Warn <<
"The concat matrix has not been provided." << std::endl;
89 if (input.n_cols != concat.n_cols)
91 Log::Fatal <<
"The number of columns of the concat matrix should be equal " 92 <<
"to the number of columns of input matrix." << std::endl;
95 inRows = input.n_rows;
96 output = arma::join_cols(input, concat);
99 template<
typename InputDataType,
typename OutputDataType>
100 template<
typename eT>
102 const arma::Mat<eT>& ,
103 const arma::Mat<eT>& gy,
106 g = gy.submat(0, 0, inRows - 1, concat.n_cols - 1);
Implementation of the Concatenate module class.
Definition: concatenate.hpp:36
static MLPACK_EXPORT util::PrefixedOutStream Fatal
Prints fatal messages prefixed with [FATAL], then terminates the program.
Definition: log.hpp:90
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1
Definition: pointer_wrapper.hpp:23
Concatenate()
Create the Concatenate object using the specified number of output units.
Definition: concatenate_impl.hpp:23
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...
Definition: concatenate_impl.hpp:101
static MLPACK_EXPORT util::PrefixedOutStream Warn
Prints warning messages prefixed with [WARN ].
Definition: log.hpp:87
void Forward(const 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...
Definition: concatenate_impl.hpp:83
Concatenate & operator=(const Concatenate &layer)
Operator= copy constructor.
Definition: concatenate_impl.hpp:53