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 
92  size_t WeightSize() const { return 0; }
93 
97  template<typename Archive>
98  void serialize(Archive& /* ar */, const uint32_t /* version */);
99 
100  private:
102  OutputDataType delta;
103 
105  OutputDataType outputParameter;
106 }; // class CReLU
107 
108 } // namespace ann
109 } // namespace mlpack
110 
111 // Include implementation.
112 #include "c_relu_impl.hpp"
113 
114 #endif
size_t WeightSize() const
Get size of weights.
Definition: c_relu.hpp:92
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 uint32_t)
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