mlpack  3.4.2
c_relu.hpp
Go to the documentation of this file.
1 
12 #ifndef MLPACK_METHODS_ANN_LAYER_C_RELU_HPP
13 #define MLPACK_METHODS_ANN_LAYER_C_RELU_HPP
14 
15 #include <mlpack/prereqs.hpp>
16 
17 namespace mlpack {
18 namespace ann {
46 template <
47  typename InputDataType = arma::mat,
48  typename OutputDataType = arma::mat
49 >
50 class CReLU
51 {
52  public:
56  CReLU();
57 
66  template<typename InputType, typename OutputType>
67  void Forward(const InputType& input, OutputType& output);
68 
78  template<typename DataType>
79  void Backward(const DataType& input, const DataType& gy, DataType& g);
80 
82  OutputDataType const& OutputParameter() const { return outputParameter; }
84  OutputDataType& OutputParameter() { return outputParameter; }
85 
87  OutputDataType const& Delta() const { return delta; }
89  OutputDataType& Delta() { return delta; }
90 
94  template<typename Archive>
95  void serialize(Archive& /* ar */, const unsigned int /* version */);
96 
97  private:
99  OutputDataType delta;
100 
102  OutputDataType outputParameter;
103 }; // class CReLU
104 
105 } // namespace ann
106 } // namespace mlpack
107 
108 // Include implementation.
109 #include "c_relu_impl.hpp"
110 
111 #endif
prereqs.hpp
The core includes that mlpack expects; standard C++ includes and Armadillo.
mlpack::ann::CReLU::Delta
OutputDataType const & Delta() const
Get the delta.
Definition: c_relu.hpp:87
mlpack::ann::CReLU::Delta
OutputDataType & Delta()
Modify the delta.
Definition: c_relu.hpp:89
mlpack::ann::CReLU::Forward
void Forward(const InputType &input, OutputType &output)
Ordinary feed forward pass of a neural network, evaluating the function f(x) by propagating the activ...
mlpack::ann::CReLU
A concatenated ReLU has two outputs, one ReLU and one negative ReLU, concatenated together.
Definition: c_relu.hpp:51
mlpack
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: add_to_cli11.hpp:21
mlpack::ann::CReLU::CReLU
CReLU()
Create the CReLU object.
mlpack::ann::CReLU::serialize
void serialize(Archive &, const unsigned int)
Serialize the layer.
mlpack::ann::CReLU::OutputParameter
OutputDataType & OutputParameter()
Modify the output parameter.
Definition: c_relu.hpp:84
mlpack::ann::CReLU::Backward
void Backward(const DataType &input, const DataType &gy, DataType &g)
Ordinary feed backward pass of a neural network, calculating the function f(x) by propagating x backw...
mlpack::ann::CReLU::OutputParameter
OutputDataType const & OutputParameter() const
Get the output parameter.
Definition: c_relu.hpp:82