mlpack 3.4.2
log_softmax.hpp
Go to the documentation of this file.
1
12#ifndef MLPACK_METHODS_ANN_LAYER_LOG_SOFTMAX_HPP
13#define MLPACK_METHODS_ANN_LAYER_LOG_SOFTMAX_HPP
14
15#include <mlpack/prereqs.hpp>
16
17namespace mlpack {
18namespace ann {
19
32template <
33 typename InputDataType = arma::mat,
34 typename OutputDataType = arma::mat
35>
37{
38 public:
43
51 template<typename InputType, typename OutputType>
52 void Forward(const InputType& input, OutputType& output);
53
63 template<typename eT>
64 void Backward(const arma::Mat<eT>& input,
65 const arma::Mat<eT>& gy,
66 arma::Mat<eT>& g);
67
69 OutputDataType& OutputParameter() const { return outputParameter; }
71 OutputDataType& OutputParameter() { return outputParameter; }
72
74 InputDataType& Delta() const { return delta; }
76 InputDataType& Delta() { return delta; }
77
81 template<typename Archive>
82 void serialize(Archive& /* ar */, const unsigned int /* version */);
83
84 private:
86 OutputDataType delta;
87
89 OutputDataType outputParameter;
90}; // class LogSoftmax
91
92} // namespace ann
93} // namespace mlpack
94
95// Include implementation.
96#include "log_softmax_impl.hpp"
97
98#endif
Implementation of the log softmax layer.
Definition: log_softmax.hpp:37
void Forward(const InputType &input, OutputType &output)
Ordinary feed forward pass of a neural network, evaluating the function f(x) by propagating the activ...
LogSoftMax()
Create the LogSoftmax object.
OutputDataType & OutputParameter() const
Get the output parameter.
Definition: log_softmax.hpp:69
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...
InputDataType & Delta()
Modify the delta.
Definition: log_softmax.hpp:76
void serialize(Archive &, const unsigned int)
Serialize the layer.
InputDataType & Delta() const
Get the delta.
Definition: log_softmax.hpp:74
OutputDataType & OutputParameter()
Modify the output parameter.
Definition: log_softmax.hpp:71
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.