mlpack
Public Member Functions | List of all members
mlpack::ann::CReLU< InputDataType, OutputDataType > Class Template Reference

A concatenated ReLU has two outputs, one ReLU and one negative ReLU, concatenated together. More...

#include <c_relu.hpp>

Public Member Functions

 CReLU ()
 Create the CReLU object.
 
template<typename InputType , typename OutputType >
void Forward (const InputType &input, OutputType &output)
 Ordinary feed forward pass of a neural network, evaluating the function f(x) by propagating the activity forward through f. More...
 
template<typename DataType >
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 backwards through f. More...
 
OutputDataType const & OutputParameter () const
 Get the output parameter.
 
OutputDataType & OutputParameter ()
 Modify the output parameter.
 
OutputDataType const & Delta () const
 Get the delta.
 
OutputDataType & Delta ()
 Modify the delta.
 
size_t WeightSize () const
 Get size of weights.
 
template<typename Archive >
void serialize (Archive &, const uint32_t)
 Serialize the layer.
 

Detailed Description

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
class mlpack::ann::CReLU< InputDataType, OutputDataType >

A concatenated ReLU has two outputs, one ReLU and one negative ReLU, concatenated together.

In other words, for positive x it produces [x, 0], and for negative x it produces [0, x]. Because it has two outputs, CReLU doubles the output dimension.

Note: The CReLU doubles the output size.

For more information, see the following.

@inproceedings{ICML2016,
title = {Understanding and Improving Convolutional Neural Networks
via Concatenated Rectified Linear Units},
author = {LWenling Shang, Kihyuk Sohn, Diogo Almeida, Honglak Lee},
year = {2016},
url = {https://arxiv.org/abs/1603.05201}
}
Template Parameters
InputDataTypeType of the input data (arma::colvec, arma::mat, arma::sp_mat or arma::cube).
OutputDataTypeType of the output data (arma::colvec, arma::mat, arma::sp_mat or arma::cube).

Member Function Documentation

◆ Backward()

template<typename InputDataType , typename OutputDataType >
template<typename DataType >
void mlpack::ann::CReLU< InputDataType, OutputDataType >::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 backwards through f.

Using the results from the feed forward pass.

Parameters
inputThe propagated input activation.
gyThe backpropagated error.
gThe calculated gradient.

◆ Forward()

template<typename InputDataType , typename OutputDataType >
template<typename InputType , typename OutputType >
void mlpack::ann::CReLU< InputDataType, OutputDataType >::Forward ( const InputType &  input,
OutputType &  output 
)

Ordinary feed forward pass of a neural network, evaluating the function f(x) by propagating the activity forward through f.

Works only for 2D Tensors.

Parameters
inputInput data used for evaluating the specified function.
outputResulting output activation.

The documentation for this class was generated from the following files: