MeanPoolingType< MatType > Class Template Reference

Implementation of the MeanPooling. More...

Inheritance diagram for MeanPoolingType< MatType >:

Public Member Functions

 MeanPoolingType ()
 Create the MeanPoolingType object. More...

 
 MeanPoolingType (const size_t kernelWidth, const size_t kernelHeight, const size_t strideWidth=1, const size_t strideHeight=1, const bool floor=true)
 Create the MeanPooling object using the specified number of units. More...

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

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

 
virtual ~MeanPoolingType ()
 
void Backward (const MatType &input, const MatType &gy, MatType &g)
 Ordinary feed backward pass of a neural network, using 3rd-order tensors as input, calculating the function f(x) by propagating x backwards through f. More...

 
MeanPoolingTypeClone () const
 Clone the MeanPoolingType object. This handles polymorphism correctly. More...

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

 
bool const & Floor () const
 Get the value of the rounding operation. More...

 
bool & Floor ()
 Modify the value of the rounding operation. 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...

 
size_t const & KernelHeight () const
 Get the kernel height. More...

 
size_t & KernelHeight ()
 Modify the kernel height. More...

 
size_t const & KernelWidth () const
 Get the kernel width. More...

 
size_t & KernelWidth ()
 Modify the kernel width. More...

 
MeanPoolingTypeoperator= (const MeanPoolingType &other)
 Copy the given MeanPoolingType. More...

 
MeanPoolingTypeoperator= (MeanPoolingType &&other)
 Take ownership of the given MeanPoolingType. More...

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

 
size_t const & StrideHeight () const
 Get the stride height. More...

 
size_t & StrideHeight ()
 Modify the stride height. More...

 
size_t const & StrideWidth () const
 Get the stride width. More...

 
size_t & StrideWidth ()
 Modify the stride width. 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::MeanPoolingType< MatType >

Implementation of the MeanPooling.

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

Definition at line 30 of file mean_pooling.hpp.

Constructor & Destructor Documentation

◆ MeanPoolingType() [1/4]

◆ MeanPoolingType() [2/4]

MeanPoolingType ( const size_t  kernelWidth,
const size_t  kernelHeight,
const size_t  strideWidth = 1,
const size_t  strideHeight = 1,
const bool  floor = true 
)

Create the MeanPooling object using the specified number of units.

Parameters
kernelWidthWidth of the pooling window.
kernelHeightHeight of the pooling window.
strideWidthWidth of the stride operation.
strideHeightWidth of the stride operation.
floorIf true, then a pooling operation that would oly part of the input will be skipped.

◆ ~MeanPoolingType()

virtual ~MeanPoolingType ( )
inlinevirtual

◆ MeanPoolingType() [3/4]

MeanPoolingType ( const MeanPoolingType< MatType > &  other)

Copy the given MeanPoolingType.

◆ MeanPoolingType() [4/4]

MeanPoolingType ( MeanPoolingType< MatType > &&  other)

Take ownership of the given MeanPoolingType.

Member Function Documentation

◆ Backward()

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

Ordinary feed backward pass of a neural network, using 3rd-order tensors as input, calculating the function f(x) by propagating x backwards through 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 MeanPoolingType< MatType >::Clone().

◆ Clone()

MeanPoolingType* Clone ( ) const
inlinevirtual

Clone the MeanPoolingType object. This handles polymorphism correctly.

Implements Layer< MatType >.

Definition at line 65 of file mean_pooling.hpp.

References MeanPoolingType< MatType >::Backward(), MeanPoolingType< MatType >::Forward(), and MeanPoolingType< MatType >::MeanPoolingType().

◆ ComputeOutputDimensions()

void ComputeOutputDimensions ( )
virtual

Compute the size of the output given InputDimensions().

Reimplemented from Layer< MatType >.

Referenced by MeanPoolingType< MatType >::Floor().

◆ Floor() [1/2]

bool const& Floor ( ) const
inline

Get the value of the rounding operation.

Definition at line 110 of file mean_pooling.hpp.

◆ Floor() [2/2]

bool& Floor ( )
inline

Modify the value of the rounding operation.

Definition at line 112 of file mean_pooling.hpp.

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

◆ 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 MeanPoolingType< MatType >::Clone().

◆ KernelHeight() [1/2]

size_t const& KernelHeight ( ) const
inline

Get the kernel height.

Definition at line 95 of file mean_pooling.hpp.

◆ KernelHeight() [2/2]

size_t& KernelHeight ( )
inline

Modify the kernel height.

Definition at line 97 of file mean_pooling.hpp.

◆ KernelWidth() [1/2]

size_t const& KernelWidth ( ) const
inline

Get the kernel width.

Definition at line 90 of file mean_pooling.hpp.

◆ KernelWidth() [2/2]

size_t& KernelWidth ( )
inline

Modify the kernel width.

Definition at line 92 of file mean_pooling.hpp.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

Take ownership of the given MeanPoolingType.

◆ serialize()

void serialize ( Archive &  ar,
const uint32_t   
)

Serialize the layer.

Referenced by MeanPoolingType< MatType >::Floor().

◆ StrideHeight() [1/2]

size_t const& StrideHeight ( ) const
inline

Get the stride height.

Definition at line 105 of file mean_pooling.hpp.

◆ StrideHeight() [2/2]

size_t& StrideHeight ( )
inline

Modify the stride height.

Definition at line 107 of file mean_pooling.hpp.

◆ StrideWidth() [1/2]

size_t const& StrideWidth ( ) const
inline

Get the stride width.

Definition at line 100 of file mean_pooling.hpp.

◆ StrideWidth() [2/2]

size_t& StrideWidth ( )
inline

Modify the stride width.

Definition at line 102 of file mean_pooling.hpp.


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