AdaptiveMaxPoolingType< MatType > Class Template Reference

Implementation of the AdaptiveMaxPooling layer. More...

Inheritance diagram for AdaptiveMaxPoolingType< MatType >:

Public Member Functions

 AdaptiveMaxPoolingType ()
 Create the AdaptiveMaxPooling object. More...

 
 AdaptiveMaxPoolingType (const size_t outputWidth, const size_t outputHeight)
 Create the AdaptiveMaxPooling object. More...

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

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

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

 
AdaptiveMaxPoolingTypeClone () const
 Clone the AdaptiveMaxPoolingType object. More...

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

 
AdaptiveMaxPoolingTypeoperator= (const AdaptiveMaxPoolingType &other)
 Copy the given AdaptiveMaxPoolingType. More...

 
AdaptiveMaxPoolingTypeoperator= (AdaptiveMaxPoolingType &&other)
 Take ownership of the given AdaptiveMaxPoolingType. More...

 
size_t const & OutputHeight () const
 Get the output height. More...

 
size_t & OutputHeight ()
 Modify the output height. More...

 
size_t const & OutputWidth () const
 Get the output width. More...

 
size_t & OutputWidth ()
 Modify the output width. More...

 
template
<
typename
Archive
>
void serialize (Archive &ar, const uint32_t version)
 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 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::AdaptiveMaxPoolingType< MatType >

Implementation of the AdaptiveMaxPooling layer.

The AdaptiveMaxPooling layer works similarly to MaxPooling layer, but it adaptively changes the size of the pooling region to minimize the amount of computation. In MaxPooling, we specifies the kernel and stride size whereas in AdaptiveMaxPooling, we specify the output size of the pooling region.

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

Definition at line 35 of file adaptive_max_pooling.hpp.

Constructor & Destructor Documentation

◆ AdaptiveMaxPoolingType() [1/4]

◆ AdaptiveMaxPoolingType() [2/4]

AdaptiveMaxPoolingType ( const size_t  outputWidth,
const size_t  outputHeight 
)

Create the AdaptiveMaxPooling object.

Parameters
outputWidthWidth of the output.
outputHeightHeight of the output.

◆ ~AdaptiveMaxPoolingType()

◆ AdaptiveMaxPoolingType() [3/4]

AdaptiveMaxPoolingType ( const AdaptiveMaxPoolingType< MatType > &  other)

Copy the given AdaptiveMaxPoolingType.

◆ AdaptiveMaxPoolingType() [4/4]

Take ownership of the given AdaptiveMaxPoolingType.

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
inputThe propagated input activation.
gyThe backpropagated error.
gThe calculated gradient.

Reimplemented from Layer< MatType >.

Referenced by AdaptiveMaxPoolingType< MatType >::Clone().

◆ Clone()

◆ ComputeOutputDimensions()

void ComputeOutputDimensions ( )
virtual

Compute the size of the output given InputDimensions().

Reimplemented from Layer< MatType >.

Referenced by AdaptiveMaxPoolingType< MatType >::OutputHeight().

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

◆ operator=() [1/2]

◆ operator=() [2/2]

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

Take ownership of the given AdaptiveMaxPoolingType.

◆ OutputHeight() [1/2]

size_t const& OutputHeight ( ) const
inline

Get the output height.

Definition at line 100 of file adaptive_max_pooling.hpp.

◆ OutputHeight() [2/2]

size_t& OutputHeight ( )
inline

◆ OutputWidth() [1/2]

size_t const& OutputWidth ( ) const
inline

Get the output width.

Definition at line 95 of file adaptive_max_pooling.hpp.

◆ OutputWidth() [2/2]

size_t& OutputWidth ( )
inline

Modify the output width.

Definition at line 97 of file adaptive_max_pooling.hpp.

◆ serialize()

void serialize ( Archive &  ar,
const uint32_t  version 
)

Serialize the layer.

Referenced by AdaptiveMaxPoolingType< MatType >::OutputHeight().


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