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
CReLU()
Create the CReLU object.
Linear algebra utility functions, generally performed on matrices or vectors.
The core includes that mlpack expects; standard C++ includes and Armadillo.
void serialize(Archive &, const unsigned int)
Serialize the layer.
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...
A concatenated ReLU has two outputs, one ReLU and one negative ReLU, concatenated together...
Definition: c_relu.hpp:50
OutputDataType const & Delta() const
Get the delta.
Definition: c_relu.hpp:87
OutputDataType & OutputParameter()
Modify the output parameter.
Definition: c_relu.hpp:84
OutputDataType & Delta()
Modify the delta.
Definition: c_relu.hpp:89
void Forward(const InputType &input, OutputType &output)
Ordinary feed forward pass of a neural network, evaluating the function f(x) by propagating the activ...
OutputDataType const & OutputParameter() const
Get the output parameter.
Definition: c_relu.hpp:82