mlpack
softmin.hpp
Go to the documentation of this file.
1 
13 #ifndef MLPACK_METHODS_ANN_LAYER_SOFTMIN_HPP
14 #define MLPACK_METHODS_ANN_LAYER_SOFTMIN_HPP
15 
16 #include <mlpack/prereqs.hpp>
17 
18 namespace mlpack {
19 namespace ann {
20 
31 template <
32  typename InputDataType = arma::mat,
33  typename OutputDataType = arma::mat
34 >
35 class Softmin
36 {
37  public:
41  Softmin();
42 
50  template<typename InputType, typename OutputType>
51  void Forward(const InputType& input, OutputType& output);
52 
62  template<typename eT>
63  void Backward(const arma::Mat<eT>& input,
64  const arma::Mat<eT>& gy,
65  arma::Mat<eT>& g);
66 
68  OutputDataType& OutputParameter() const { return outputParameter; }
70  OutputDataType& OutputParameter() { return outputParameter; }
71 
73  InputDataType& Delta() const { return delta; }
75  InputDataType& Delta() { return delta; }
76 
80  template<typename Archive>
81  void serialize(Archive& /* ar */, const uint32_t /* version */);
82 
83  private:
85  OutputDataType delta;
86 
88  OutputDataType outputParameter;
89 }; // class Softmin
90 
91 } // namespace ann
92 } // namespace mlpack
93 
94 // Include implementation.
95 #include "softmin_impl.hpp"
96 
97 #endif
Implementation of the Softmin layer.
Definition: softmin.hpp:35
void serialize(Archive &, const uint32_t)
Serialize the layer.
Definition: softmin_impl.hpp:50
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1
The core includes that mlpack expects; standard C++ includes and Armadillo.
InputDataType & Delta()
Modify the delta.
Definition: softmin.hpp:75
void Forward(const InputType &input, OutputType &output)
Ordinary feed forward pass of a neural network, evaluating the function f(x) by propagating the activ...
Definition: softmin_impl.hpp:29
void Backward(const arma::Mat< eT > &input, 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: softmin_impl.hpp:40
InputDataType & Delta() const
Get the delta.
Definition: softmin.hpp:73
OutputDataType & OutputParameter()
Modify the output parameter.
Definition: softmin.hpp:70
Softmin()
Create the Softmin object.
Definition: softmin_impl.hpp:22
OutputDataType & OutputParameter() const
Get the output parameter.
Definition: softmin.hpp:68