concat_performance.hpp
Go to the documentation of this file.
1 
12 #ifndef MLPACK_METHODS_ANN_LAYER_CONCAT_PERFORMANCE_HPP
13 #define MLPACK_METHODS_ANN_LAYER_CONCAT_PERFORMANCE_HPP
14 
15 #include <mlpack/prereqs.hpp>
16 
17 #include "layer_types.hpp"
18 
19 namespace mlpack {
20 namespace ann {
21 
32 template <
33  typename OutputLayerType = NegativeLogLikelihood<>,
34  typename InputDataType = arma::mat,
35  typename OutputDataType = arma::mat
36 >
38 {
39  public:
46  ConcatPerformance(const size_t inSize = 0,
47  OutputLayerType&& outputLayer = OutputLayerType());
48 
49  /*
50  * Computes the Negative log likelihood.
51  *
52  * @param input Input data used for evaluating the specified function.
53  * @param output Resulting output activation.
54  */
55  template<typename eT>
56  double Forward(const arma::Mat<eT>& input, arma::Mat<eT>& target);
57 
69  template<typename eT>
70  void Backward(const arma::Mat<eT>& input,
71  const arma::Mat<eT>& target,
72  arma::Mat<eT>& output);
73 
75  OutputDataType& OutputParameter() const { return outputParameter; }
77  OutputDataType& OutputParameter() { return outputParameter; }
78 
80  OutputDataType& Delta() const { return delta; }
82  OutputDataType& Delta() { return delta; }
83 
85  size_t InSize() const { return inSize; }
86 
90  template<typename Archive>
91  void serialize(Archive& /* ar */, const uint32_t /* version */);
92 
93  private:
95  size_t inSize;
96 
98  OutputLayerType outputLayer;
99 
101  OutputDataType delta;
102 
104  OutputDataType outputParameter;
105 }; // class ConcatPerformance
106 
107 } // namespace ann
108 } // namespace mlpack
109 
110 // Include implementation.
111 #include "concat_performance_impl.hpp"
112 
113 #endif
size_t InSize() const
Get the number of inputs.
Linear algebra utility functions, generally performed on matrices or vectors.
double Forward(const arma::Mat< eT > &input, arma::Mat< eT > &target)
The core includes that mlpack expects; standard C++ includes and Armadillo.
ConcatPerformance(const size_t inSize=0, OutputLayerType &&outputLayer=OutputLayerType())
Create the ConcatPerformance object.
OutputDataType & Delta() const
Get the delta.
Implementation of the concat performance class.
OutputDataType & Delta()
Modify the delta.
OutputDataType & OutputParameter()
Modify the output parameter.
void Backward(const arma::Mat< eT > &input, const arma::Mat< eT > &target, arma::Mat< eT > &output)
Ordinary feed backward pass of a neural network.
void serialize(Archive &, const uint32_t)
Serialize the layer.
OutputDataType & OutputParameter() const
Get the output parameter.