13 #ifndef MLPACK_METHODS_ANN_LAYER_ADD_IMPL_HPP 14 #define MLPACK_METHODS_ANN_LAYER_ADD_IMPL_HPP 22 template<
typename InputDataType,
typename OutputDataType>
29 template<
typename InputDataType,
typename OutputDataType>
32 const arma::Mat<eT>& input, arma::Mat<eT>& output)
35 output.each_col() += weights;
38 template<
typename InputDataType,
typename OutputDataType>
41 const arma::Mat<eT>& ,
42 const arma::Mat<eT>& gy,
48 template<
typename InputDataType,
typename OutputDataType>
51 const arma::Mat<eT>& ,
52 const arma::Mat<eT>& error,
53 arma::Mat<eT>& gradient)
58 template<
typename InputDataType,
typename OutputDataType>
59 template<
typename Archive>
61 Archive& ar,
const uint32_t )
63 ar(CEREAL_NVP(outSize));
65 if (cereal::is_loading<Archive>())
66 weights.set_size(outSize, 1);
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1
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: add_impl.hpp:40
OutputDataType const & Gradient() const
Get the gradient.
Definition: add.hpp:96
Add(const size_t outSize=0)
Create the Add object using the specified number of output units.
Definition: add_impl.hpp:23
size_t WeightSize() const
Get the size of weights.
Definition: add.hpp:104
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: add_impl.hpp:31
void serialize(Archive &ar, const uint32_t)
Serialize the layer.
Definition: add_impl.hpp:60