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
17namespace mlpack {
18namespace ann {
46template <
47 typename InputDataType = arma::mat,
48 typename OutputDataType = arma::mat
49>
50class CReLU
51{
52 public:
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
A concatenated ReLU has two outputs, one ReLU and one negative ReLU, concatenated together.
Definition: c_relu.hpp:51
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 & Delta() const
Get the delta.
Definition: c_relu.hpp:87
CReLU()
Create the CReLU object.
OutputDataType const & OutputParameter() const
Get the output parameter.
Definition: c_relu.hpp:82
void serialize(Archive &, const unsigned int)
Serialize the layer.
OutputDataType & OutputParameter()
Modify the output parameter.
Definition: c_relu.hpp:84
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: c_relu.hpp:89
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1
The core includes that mlpack expects; standard C++ includes and Armadillo.