13 #ifndef MLPACK_METHODS_ANN_LAYER_CONSTANT_IMPL_HPP 14 #define MLPACK_METHODS_ANN_LAYER_CONSTANT_IMPL_HPP 22 template<
typename InputDataType,
typename OutputDataType>
25 const double scalar) :
29 constantOutput = OutputDataType(outSize, 1);
30 constantOutput.fill(scalar);
33 template<
typename InputDataType,
typename OutputDataType>
34 template<
typename InputType,
typename OutputType>
36 const InputType& input, OutputType& output)
40 inSize = input.n_elem;
43 output = constantOutput;
46 template<
typename InputDataType,
typename OutputDataType>
47 template<
typename DataType>
49 const DataType& ,
const DataType& , DataType& g)
51 g = arma::zeros<DataType>(inSize, 1);
54 template<
typename InputDataType,
typename OutputDataType>
55 template<
typename Archive>
57 Archive& ar,
const uint32_t )
59 ar(CEREAL_NVP(constantOutput));
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1
Constant(const size_t outSize=0, const double scalar=0.0)
Create the Constant object that outputs a given constant scalar value given any input value...
Definition: constant_impl.hpp:23
void Forward(const InputType &input, OutputType &output)
Ordinary feed forward pass of a neural network.
Definition: constant_impl.hpp:35
void Backward(const DataType &, const DataType &, DataType &g)
Ordinary feed backward pass of a neural network.
Definition: constant_impl.hpp:48
void serialize(Archive &ar, const uint32_t)
Serialize the layer.
Definition: constant_impl.hpp:56