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 {
45 template <
46  typename InputDataType = arma::mat,
47  typename OutputDataType = arma::mat
48 >
49 class CReLU
50 {
51  public:
55  CReLU();
56 
65  template<typename InputType, typename OutputType>
66  void Forward(const InputType&& input, OutputType&& output);
67 
77  template<typename DataType>
78  void Backward(const DataType&& input, DataType&& gy, DataType&& g);
79 
81  OutputDataType const& OutputParameter() const { return outputParameter; }
83  OutputDataType& OutputParameter() { return outputParameter; }
84 
86  OutputDataType const& 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  OutputDataType delta;
99 
101  OutputDataType outputParameter;
102 }; // class CReLU
103 
104 } // namespace ann
105 } // namespace mlpack
106 
107 // Include implementation.
108 #include "c_relu_impl.hpp"
109 
110 #endif
CReLU()
Create the CReLU object.
.hpp
Definition: add_to_po.hpp:21
The core includes that mlpack expects; standard C++ includes and Armadillo.
void Forward(const InputType &&input, OutputType &&output)
Ordinary feed forward pass of a neural network, evaluating the function f(x) by propagating the activ...
void serialize(Archive &, const unsigned int)
Serialize the layer.
void Backward(const DataType &&input, 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:49
OutputDataType const & Delta() const
Get the delta.
Definition: c_relu.hpp:86
OutputDataType & OutputParameter()
Modify the output parameter.
Definition: c_relu.hpp:83
OutputDataType & Delta()
Modify the delta.
Definition: c_relu.hpp:88
OutputDataType const & OutputParameter() const
Get the output parameter.
Definition: c_relu.hpp:81