LinearNoBiasType< MatType, RegularizerType > Class Template Reference

Implementation of the LinearNoBias class. More...

Inheritance diagram for LinearNoBiasType< MatType, RegularizerType >:

Public Member Functions

 LinearNoBiasType ()
 Create the LinearNoBias object. More...

 
 LinearNoBiasType (const size_t outSize, RegularizerType regularizer=RegularizerType())
 Create the LinearNoBias object using the specified number of units. More...

 
 LinearNoBiasType (const LinearNoBiasType &layer)
 Copy constructor. More...

 
 LinearNoBiasType (LinearNoBiasType &&)
 Move constructor. More...

 
virtual ~LinearNoBiasType ()
 Virtual destructor. More...

 
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...

 
LinearNoBiasTypeClone () const
 Clone the LinearNoBiasType object. This handles polymorphism correctly. More...

 
void ComputeOutputDimensions ()
 Compute the output dimensions of the layer using 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...

 
LinearNoBiasTypeoperator= (const LinearNoBiasType &layer)
 Copy assignment operator. More...

 
LinearNoBiasTypeoperator= (LinearNoBiasType &&layer)
 Move assignment operator. More...

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

 
MatType & Parameters ()
 Modify the parameters. 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
 Get the number of weights 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 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
,
typename
RegularizerType
=
NoRegularizer
>

class mlpack::ann::LinearNoBiasType< MatType, RegularizerType >

Implementation of the LinearNoBias class.

The LinearNoBias class represents a single layer of a neural network.

Template Parameters
MatTypeMatrix representation to accept as input and use for computation.
RegularizerTypeType of the regularizer to be used (Default no regularizer).

Definition at line 37 of file linear_no_bias.hpp.

Constructor & Destructor Documentation

◆ LinearNoBiasType() [1/4]

Create the LinearNoBias object.

Referenced by LinearNoBiasType< MatType, RegularizerType >::Clone().

◆ LinearNoBiasType() [2/4]

LinearNoBiasType ( const size_t  outSize,
RegularizerType  regularizer = RegularizerType() 
)

Create the LinearNoBias object using the specified number of units.

Parameters
outSizeThe number of output units.
regularizerThe regularizer to use, optional.

◆ LinearNoBiasType() [3/4]

LinearNoBiasType ( const LinearNoBiasType< MatType, RegularizerType > &  layer)

Copy constructor.

◆ LinearNoBiasType() [4/4]

LinearNoBiasType ( LinearNoBiasType< MatType, RegularizerType > &&  )

Move constructor.

◆ ~LinearNoBiasType()

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 LinearNoBiasType< MatType, RegularizerType >::~LinearNoBiasType().

◆ Clone()

◆ ComputeOutputDimensions()

void ComputeOutputDimensions ( )
virtual

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

Reimplemented from Layer< MatType >.

Referenced by LinearNoBiasType< MatType, RegularizerType >::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 LinearNoBiasType< MatType, RegularizerType >::~LinearNoBiasType().

◆ 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 LinearNoBiasType< MatType, RegularizerType >::~LinearNoBiasType().

◆ operator=() [1/2]

LinearNoBiasType& operator= ( const LinearNoBiasType< MatType, RegularizerType > &  layer)

Copy assignment operator.

Referenced by LinearNoBiasType< MatType, RegularizerType >::Clone().

◆ operator=() [2/2]

LinearNoBiasType& operator= ( LinearNoBiasType< MatType, RegularizerType > &&  layer)

Move assignment operator.

◆ Parameters() [1/2]

const MatType& Parameters ( ) const
inlinevirtual

Get the parameters.

Reimplemented from Layer< MatType >.

Definition at line 107 of file linear_no_bias.hpp.

◆ Parameters() [2/2]

MatType& Parameters ( )
inlinevirtual

Modify the parameters.

Reimplemented from Layer< MatType >.

Definition at line 109 of file linear_no_bias.hpp.

◆ serialize()

void serialize ( Archive &  ar,
const uint32_t   
)

◆ SetWeights()

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

Reset the layer parameter.

Reimplemented from Layer< MatType >.

Referenced by LinearNoBiasType< MatType, RegularizerType >::Clone().

◆ WeightSize()

size_t WeightSize ( ) const
inlinevirtual

Get the number of weights in the layer.

Reimplemented from Layer< MatType >.

Definition at line 112 of file linear_no_bias.hpp.

References LinearNoBiasType< MatType, RegularizerType >::ComputeOutputDimensions(), and LinearNoBiasType< MatType, RegularizerType >::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/linear_no_bias.hpp