relu6.hpp
Go to the documentation of this file.
1 
23 #ifndef MLPACK_METHODS_ANN_LAYER_RELU6_HPP
24 #define MLPACK_METHODS_ANN_LAYER_RELU6_HPP
25 
26 #include <mlpack/prereqs.hpp>
27 
28 namespace mlpack {
29 namespace ann {
30 
37 template<typename InputDataType = arma::mat,
38  typename OutputDataType = arma::mat>
39 class ReLU6
40 {
41  public:
42 
46  ReLU6();
47 
55  template<typename InputType, typename OutputType>
56  void Forward(const InputType& input, OutputType& output);
57 
67  template<typename DataType>
68  void Backward(const DataType& input, const DataType& gy, DataType& g);
69 
71  OutputDataType const& OutputParameter() const { return outputParameter; }
73  OutputDataType& OutputParameter() { return outputParameter; }
74 
76  OutputDataType const& Delta() const { return delta; }
78  OutputDataType& Delta() { return delta; }
79 
81  size_t WeightSize() const { return 0; }
82 
86  template<typename Archive>
87  void serialize(Archive& ar, const uint32_t /* version */);
88 
89  private:
91  OutputDataType outputParameter;
92 
94  OutputDataType delta;
95 }; // class ReLU6
96 
97 } // namespace ann
98 } // namespace mlpack
99 
100 // Include implementation.
101 #include "relu6_impl.hpp"
102 
103 #endif
OutputDataType const & Delta() const
Get the delta.
Definition: relu6.hpp:76
ReLU6()
Create the ReLU6 object.
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...
OutputDataType & Delta()
Modify the delta.
Definition: relu6.hpp:78
Linear algebra utility functions, generally performed on matrices or vectors.
void Forward(const InputType &input, OutputType &output)
Ordinary feed forward pass of a neural network, evaluating the function f(x) by propagating the activ...
The core includes that mlpack expects; standard C++ includes and Armadillo.
size_t WeightSize() const
Get size of weights.
Definition: relu6.hpp:81
OutputDataType & OutputParameter()
Modify the output parameter.
Definition: relu6.hpp:73
void serialize(Archive &ar, const uint32_t)
Serialize the layer.
OutputDataType const & OutputParameter() const
Get the output parameter.
Definition: relu6.hpp:71