mlpack  master
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,
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);
70  template<typename eT>
71  void Backward(const arma::Mat<eT>&& input,
72  const arma::Mat<eT>&& target,
73  arma::Mat<eT>&& output);
74 
76  InputDataType& InputParameter() const { return inputParameter; }
78  InputDataType& InputParameter() { return inputParameter; }
79 
81  OutputDataType& OutputParameter() const { return outputParameter; }
83  OutputDataType& OutputParameter() { return outputParameter; }
84 
86  OutputDataType& Delta() const { return delta; }
88  OutputDataType& Delta() { return delta; }
89 
93  template<typename Archive>
94  void Serialize(Archive& /* ar */, const unsigned int /* version */);
95 
96  private:
98  size_t inSize;
99 
101  OutputLayerType outputLayer;
102 
104  OutputDataType delta;
105 
107  InputDataType inputParameter;
108 
110  OutputDataType outputParameter;
111 }; // class ConcatPerformance
112 
113 } // namespace ann
114 } // namespace mlpack
115 
116 // Include implementation.
117 #include "concat_performance_impl.hpp"
118 
119 #endif
InputDataType & InputParameter() const
Get the input parameter.
size_t inSize
Locally-stored number of inputs.
OutputDataType delta
Locally-stored delta object.
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: binarize.hpp:18
The core includes that mlpack expects; standard C++ includes and Armadillo.
double Forward(const arma::Mat< eT > &&input, arma::Mat< eT > &&target)
OutputDataType & OutputParameter()
Modify the output parameter.
Implementation of the concat performance class.
InputDataType inputParameter
Locally-stored input parameter object.
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 unsigned int)
Serialize the layer.
OutputDataType & Delta()
Modify the delta.
OutputDataType outputParameter
Locally-stored output parameter object.
InputDataType & InputParameter()
Modify the input parameter.
OutputLayerType outputLayer
Instantiated outputlayer used to evaluate the network.
ConcatPerformance(const size_t inSize, OutputLayerType &&outputLayer=OutputLayerType())
Create the ConcatPerformance object.
OutputDataType & OutputParameter() const
Get the output parameter.
OutputDataType & Delta() const
Get the delta.