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 <boost/ptr_container/ptr_vector.hpp>
18 
19 #include "layer_types.hpp"
20 
21 namespace mlpack {
22 namespace ann {
23 
34 template <
35  typename OutputLayerType = NegativeLogLikelihood<>,
36  typename InputDataType = arma::mat,
37  typename OutputDataType = arma::mat
38 >
40 {
41  public:
48  ConcatPerformance(const size_t inSize = 0,
49  OutputLayerType&& outputLayer = OutputLayerType());
50 
51  /*
52  * Computes the Negative log likelihood.
53  *
54  * @param input Input data used for evaluating the specified function.
55  * @param output Resulting output activation.
56  */
57  template<typename eT>
58  double Forward(const arma::Mat<eT>& input, arma::Mat<eT>& target);
59 
71  template<typename eT>
72  void Backward(const arma::Mat<eT>& input,
73  const arma::Mat<eT>& target,
74  arma::Mat<eT>& output);
75 
77  OutputDataType& OutputParameter() const { return outputParameter; }
79  OutputDataType& OutputParameter() { return outputParameter; }
80 
82  OutputDataType& Delta() const { return delta; }
84  OutputDataType& Delta() { return delta; }
85 
87  size_t InSize() const { return inSize; }
88 
92  template<typename Archive>
93  void serialize(Archive& /* ar */, const uint32_t /* version */);
94 
95  private:
97  size_t inSize;
98 
100  OutputLayerType outputLayer;
101 
103  OutputDataType delta;
104 
106  OutputDataType outputParameter;
107 }; // class ConcatPerformance
108 
109 } // namespace ann
110 } // namespace mlpack
111 
112 // Include implementation.
113 #include "concat_performance_impl.hpp"
114 
115 #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.