NoisyLinearType< MatType > Class Template Reference

Implementation of the NoisyLinear layer class. More...

Inheritance diagram for NoisyLinearType< MatType >:

Public Member Functions

 NoisyLinearType (const size_t outSize=0)
 Create the NoisyLinear layer object using the specified number of units. More...

 
 NoisyLinearType (const NoisyLinearType &other)
 Copy the given NoisyLinear layer (but not weights). More...

 
 NoisyLinearType (NoisyLinearType &&other)
 Take ownership of the given NoisyLinear layer (but not weights). More...

 
virtual ~NoisyLinearType ()
 
void Backward (const MatType &, const MatType &gy, MatType &g)
 Ordinary feed backward pass of a neural network, calculating the function f(x) by propagating x backwards trough f. More...

 
MatType & Bias ()
 Get the shape of the input. More...

 
NoisyLinearTypeClone () const
 Clone the NoisyLinearType object. This handles polymorphism correctly. More...

 
void ComputeOutputDimensions ()
 Compute the output dimensions of the layer given InputDimensions(). More...

 
void Forward (const MatType &input, MatType &output)
 Ordinary feed forward pass of a neural network, evaluating the function f(x) by propagating the activity forward through f. More...

 
void Gradient (const MatType &input, const MatType &error, MatType &gradient)
 Calculate the gradient using the output delta and the input activation. More...

 
NoisyLinearTypeoperator= (const NoisyLinearType &other)
 Copy the given NoisyLinear layer (but not weights). More...

 
NoisyLinearTypeoperator= (NoisyLinearType &&other)
 Take ownership of the given NoisyLinear layer (but not weights). More...

 
MatType const & Parameters () const
 Get the parameters. More...

 
MatType & Parameters ()
 Modify the parameters. More...

 
void ResetNoise ()
 Reset the noise parameters (epsilons). More...

 
void ResetParameters ()
 Reset the values of layer parameters (factorized gaussian noise). More...

 
template
<
typename
Archive
>
void serialize (Archive &ar, const uint32_t)
 Serialize the layer. More...

 
void SetWeights (typename MatType::elem_type *weightsPtr)
 Reset the layer parameter. More...

 
size_t WeightSize () const
 Compute the number of parameters in the layer. More...

 
- Public Member Functions inherited from Layer< MatType >
 Layer ()
 Default constructor. More...

 
 Layer (const Layer &layer)
 Copy constructor. This is not responsible for copying weights! More...

 
 Layer (Layer &&layer)
 Move constructor. This is not responsible for moving weights! More...

 
virtual ~Layer ()
 Default deconstructor. More...

 
virtual void CustomInitialize (MatType &, const size_t)
 Override the weight matrix of the layer. More...

 
virtual void Forward (const MatType &, const MatType &)
 Takes an input and output object, and computes the corresponding loss of the layer. More...

 
const std::vector< size_t > & InputDimensions () const
 Get the input dimensions. More...

 
std::vector< size_t > & InputDimensions ()
 Modify the input dimensions. More...

 
virtual double Loss ()
 Get the layer loss. More...

 
virtual Layeroperator= (const Layer &layer)
 Copy assignment operator. This is not responsible for copying weights! More...

 
virtual Layeroperator= (Layer &&layer)
 Move assignment operator. This is not responsible for moving weights! More...

 
const std::vector< size_t > & OutputDimensions ()
 Get the output dimensions. More...

 
virtual size_t OutputSize () final
 Get the number of elements in the output from this layer. More...

 
template
<
typename
Archive
>
void serialize (Archive &ar, const uint32_t)
 Serialize the layer. More...

 
virtual bool const & Training () const
 Get whether the layer is currently in training mode. More...

 
virtual bool & Training ()
 Modify whether the layer is currently in training mode. More...

 

Additional Inherited Members

- Protected Attributes inherited from Layer< MatType >
std::vector< size_t > inputDimensions
 Logical input dimensions of each point. More...

 
std::vector< size_t > outputDimensions
 Logical output dimensions of each point. More...

 
bool training
 If true, the layer is in training mode; otherwise, it is in testing mode. More...

 
bool validOutputDimensions
 This is true if ComputeOutputDimensions() has been called, and outputDimensions can be considered to be up-to-date. More...

 

Detailed Description


template
<
typename
MatType
=
arma::mat
>

class mlpack::ann::NoisyLinearType< MatType >

Implementation of the NoisyLinear layer class.

It represents a single layer of a neural network, with parametric noise added to its weights.

Template Parameters
MatTypeMatrix representation to accept as input and use for computation.

Definition at line 30 of file noisylinear.hpp.

Constructor & Destructor Documentation

◆ NoisyLinearType() [1/3]

NoisyLinearType ( const size_t  outSize = 0)

Create the NoisyLinear layer object using the specified number of units.

Parameters
outSizeThe number of output units.

Referenced by NoisyLinearType< MatType >::Clone(), and NoisyLinearType< MatType >::~NoisyLinearType().

◆ ~NoisyLinearType()

◆ NoisyLinearType() [2/3]

NoisyLinearType ( const NoisyLinearType< MatType > &  other)

Copy the given NoisyLinear layer (but not weights).

◆ NoisyLinearType() [3/3]

NoisyLinearType ( NoisyLinearType< MatType > &&  other)

Take ownership of the given NoisyLinear layer (but not weights).

Member Function Documentation

◆ Backward()

void Backward ( const MatType &  ,
const MatType &  gy,
MatType &  g 
)
virtual

Ordinary feed backward pass of a neural network, calculating the function f(x) by propagating x backwards trough f.

Using the results from the feed forward pass.

Parameters
*(input) The propagated input activation.
gyThe backpropagated error.
gThe calculated gradient.

Reimplemented from Layer< MatType >.

Referenced by NoisyLinearType< MatType >::~NoisyLinearType().

◆ Bias()

MatType& Bias ( )
inline

Get the shape of the input.

Modify the bias weights of the layer.

Definition at line 104 of file noisylinear.hpp.

◆ Clone()

NoisyLinearType* Clone ( ) const
inlinevirtual

Clone the NoisyLinearType object. This handles polymorphism correctly.

Implements Layer< MatType >.

Definition at line 41 of file noisylinear.hpp.

References NoisyLinearType< MatType >::NoisyLinearType().

◆ ComputeOutputDimensions()

void ComputeOutputDimensions ( )
virtual

Compute the output dimensions of the layer given InputDimensions().

Reimplemented from Layer< MatType >.

Referenced by NoisyLinearType< MatType >::WeightSize().

◆ Forward()

void Forward ( const MatType &  input,
MatType &  output 
)
virtual

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

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

Reimplemented from Layer< MatType >.

Referenced by NoisyLinearType< MatType >::~NoisyLinearType().

◆ Gradient()

void Gradient ( const MatType &  input,
const MatType &  error,
MatType &  gradient 
)
virtual

Calculate the gradient using the output delta and the input activation.

Parameters
inputThe input parameter used for calculating the gradient.
errorThe calculated error.
gradientThe calculated gradient.

Reimplemented from Layer< MatType >.

Referenced by NoisyLinearType< MatType >::~NoisyLinearType().

◆ operator=() [1/2]

NoisyLinearType& operator= ( const NoisyLinearType< MatType > &  other)

Copy the given NoisyLinear layer (but not weights).

Referenced by NoisyLinearType< MatType >::~NoisyLinearType().

◆ operator=() [2/2]

NoisyLinearType& operator= ( NoisyLinearType< MatType > &&  other)

Take ownership of the given NoisyLinear layer (but not weights).

◆ Parameters() [1/2]

MatType const& Parameters ( ) const
inlinevirtual

Get the parameters.

Reimplemented from Layer< MatType >.

Definition at line 98 of file noisylinear.hpp.

◆ Parameters() [2/2]

MatType& Parameters ( )
inlinevirtual

Modify the parameters.

Reimplemented from Layer< MatType >.

Definition at line 100 of file noisylinear.hpp.

◆ ResetNoise()

◆ ResetParameters()

void ResetParameters ( )

Reset the values of layer parameters (factorized gaussian noise).

Referenced by NoisyLinearType< MatType >::~NoisyLinearType().

◆ serialize()

void serialize ( Archive &  ar,
const uint32_t   
)

Serialize the layer.

Referenced by NoisyLinearType< MatType >::WeightSize().

◆ SetWeights()

void SetWeights ( typename MatType::elem_type *  weightsPtr)
virtual

Reset the layer parameter.

Reimplemented from Layer< MatType >.

Referenced by NoisyLinearType< MatType >::~NoisyLinearType().

◆ WeightSize()

size_t WeightSize ( ) const
inlinevirtual

Compute the number of parameters in the layer.

Reimplemented from Layer< MatType >.

Definition at line 107 of file noisylinear.hpp.

References NoisyLinearType< MatType >::ComputeOutputDimensions(), and NoisyLinearType< MatType >::serialize().


The documentation for this class was generated from the following file:
  • /home/jenkins-mlpack/mlpack.org/_src/mlpack-git/src/mlpack/methods/ann/layer/noisylinear.hpp