PaddingType< MatType > Class Template Reference

Implementation of the Padding module class. More...

Inheritance diagram for PaddingType< MatType >:

Public Member Functions

 PaddingType (const size_t padWLeft=0, const size_t padWRight=0, const size_t padHTop=0, const size_t padHBottom=0)
 Create the Padding object using the specified number of output units. More...

 
 PaddingType (const PaddingType &other)
 Copy the given PaddingType. More...

 
 PaddingType (PaddingType &&other)
 Take ownership of the given PaddingType. More...

 
virtual ~PaddingType ()
 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...

 
PaddingTypeClone () const
 Clone the PaddingType 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...

 
PaddingTypeoperator= (const PaddingType &other)
 Copy the given PaddingType. More...

 
PaddingTypeoperator= (PaddingType &&other)
 Take ownership of the given PaddingType. More...

 
size_t PadHBottom () const
 Get the bottom padding width. More...

 
size_t & PadHBottom ()
 Modify the bottom padding width. More...

 
size_t PadHTop () const
 Get the top padding width. More...

 
size_t & PadHTop ()
 Modify the top padding width. More...

 
size_t PadWLeft () const
 Get the left padding width. More...

 
size_t & PadWLeft ()
 Modify the left padding width. More...

 
size_t PadWRight () const
 Get the right padding width. More...

 
size_t & PadWRight ()
 Modify the right padding width. More...

 
template
<
typename
Archive
>
void serialize (Archive &ar, const uint32_t)
 Serialize 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...

 
virtual void Gradient (const MatType &, const MatType &, MatType &)
 Computing the gradient of the layer with respect to its own input. 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...

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

 
virtual MatType & Parameters ()
 Set the parameters. More...

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

 
virtual void SetWeights (typename MatType::elem_type *)
 Reset the layer parameter. 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...

 
virtual size_t WeightSize () const
 Get the total number of trainable weights in the layer. 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::PaddingType< MatType >

Implementation of the Padding module class.

The Padding module applies (zero-valued) padding on the input data.

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

Definition at line 29 of file padding.hpp.

Constructor & Destructor Documentation

◆ PaddingType() [1/3]

PaddingType ( const size_t  padWLeft = 0,
const size_t  padWRight = 0,
const size_t  padHTop = 0,
const size_t  padHBottom = 0 
)

Create the Padding object using the specified number of output units.

Parameters
padWLeftLeft padding width of the input.
padWRightRight padding width of the input.
padHTopTop padding height of the input.
padHBottomBottom padding height of the input.

Referenced by PaddingType< InputType, OutputType >::Clone(), and PaddingType< InputType, OutputType >::~PaddingType().

◆ ~PaddingType()

virtual ~PaddingType ( )
inlinevirtual

Virtual destructor.

Definition at line 49 of file padding.hpp.

◆ PaddingType() [2/3]

PaddingType ( const PaddingType< MatType > &  other)

Copy the given PaddingType.

◆ PaddingType() [3/3]

PaddingType ( PaddingType< MatType > &&  other)

Take ownership of the given PaddingType.

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 PaddingType< InputType, OutputType >::~PaddingType().

◆ Clone()

PaddingType* Clone ( ) const
inlinevirtual

Clone the PaddingType object. This handles polymorphism correctly.

Implements Layer< MatType >.

Definition at line 46 of file padding.hpp.

◆ ComputeOutputDimensions()

void ComputeOutputDimensions ( )
virtual

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

Reimplemented from Layer< MatType >.

Referenced by PaddingType< InputType, OutputType >::PadHBottom().

◆ 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 PaddingType< InputType, OutputType >::~PaddingType().

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

Take ownership of the given PaddingType.

◆ PadHBottom() [1/2]

size_t PadHBottom ( ) const
inline

Get the bottom padding width.

Definition at line 98 of file padding.hpp.

◆ PadHBottom() [2/2]

size_t& PadHBottom ( )
inline

Modify the bottom padding width.

Definition at line 100 of file padding.hpp.

◆ PadHTop() [1/2]

size_t PadHTop ( ) const
inline

Get the top padding width.

Definition at line 93 of file padding.hpp.

◆ PadHTop() [2/2]

size_t& PadHTop ( )
inline

Modify the top padding width.

Definition at line 95 of file padding.hpp.

◆ PadWLeft() [1/2]

size_t PadWLeft ( ) const
inline

Get the left padding width.

Definition at line 83 of file padding.hpp.

◆ PadWLeft() [2/2]

size_t& PadWLeft ( )
inline

Modify the left padding width.

Definition at line 85 of file padding.hpp.

◆ PadWRight() [1/2]

size_t PadWRight ( ) const
inline

Get the right padding width.

Definition at line 88 of file padding.hpp.

◆ PadWRight() [2/2]

size_t& PadWRight ( )
inline

Modify the right padding width.

Definition at line 90 of file padding.hpp.

◆ serialize()

void serialize ( Archive &  ar,
const uint32_t   
)

Serialize the layer.

Referenced by PaddingType< InputType, OutputType >::PadHBottom().


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