mlpack
Public Member Functions | List of all members
mlpack::ann::NearestInterpolation< InputDataType, OutputDataType > Class Template Reference

Definition and Implementation of the Nearest Interpolation Layer. More...

#include <nearest_interpolation.hpp>

Public Member Functions

 NearestInterpolation ()
 Create the NearestInterpolation object.
 
 NearestInterpolation (const size_t inRowSize, const size_t inColSize, const size_t outRowSize, const size_t outColSize, const size_t depth)
 The constructor for the NearestInterpolation. More...
 
template<typename eT >
void Forward (const arma::Mat< eT > &input, arma::Mat< eT > &output)
 Forward pass through the layer. More...
 
template<typename eT >
void Backward (const arma::Mat< eT > &, const arma::Mat< eT > &gradient, arma::Mat< eT > &output)
 Ordinary feed backward pass of a neural network, calculating the function f(x) by propagating x backwards through f. More...
 
OutputDataType const & OutputParameter () const
 Get the output parameter.
 
OutputDataType & OutputParameter ()
 Modify the output parameter.
 
OutputDataType const & Delta () const
 Get the delta.
 
OutputDataType & Delta ()
 Modify the delta.
 
size_t const & InRowSize () const
 Get the row size of the input.
 
size_t & InRowSize ()
 Modify the row size of the input.
 
size_t const & InColSize () const
 Get the column size of the input.
 
size_t & InColSize ()
 Modify the column size of the input.
 
size_t const & OutRowSize () const
 Get the row size of the output.
 
size_t & OutRowSize ()
 Modify the row size of the output.
 
size_t const & OutColSize () const
 Get the column size of the output.
 
size_t & OutColSize ()
 Modify the column size of the output.
 
size_t const & InDepth () const
 Get the depth of the input.
 
size_t & InDepth ()
 Modify the depth of the input.
 
size_t InputShape () const
 Get the shape of the input.
 
template<typename Archive >
void serialize (Archive &ar, const uint32_t)
 Serialize the layer.
 

Detailed Description

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
class mlpack::ann::NearestInterpolation< InputDataType, OutputDataType >

Definition and Implementation of the Nearest Interpolation Layer.

Nearest interpolation is an mathematical technique, primarily used for scaling purposes. The input should be a 2D matrix and it can have a number of channels/units.

Template Parameters
InputDataTypeType of the input data (arma::colvec, arma::mat, arma::sp_mat or arma::cube).
OutputDataTypeType of the output data (arma::colvec, arma::mat, arma::sp_mat or arma::cube).

Constructor & Destructor Documentation

◆ NearestInterpolation()

template<typename InputDataType , typename OutputDataType >
mlpack::ann::NearestInterpolation< InputDataType, OutputDataType >::NearestInterpolation ( const size_t  inRowSize,
const size_t  inColSize,
const size_t  outRowSize,
const size_t  outColSize,
const size_t  depth 
)

The constructor for the NearestInterpolation.

Parameters
inRowSizeNumber of input rows.
inColSizeNumber of input columns.
outRowSizeNumber of output rows.
outColSizeNumber of output columns.
depthNumber of input slices.

Member Function Documentation

◆ Backward()

template<typename InputDataType , typename OutputDataType >
template<typename eT >
void mlpack::ann::NearestInterpolation< InputDataType, OutputDataType >::Backward ( const arma::Mat< eT > &  ,
const arma::Mat< eT > &  gradient,
arma::Mat< eT > &  output 
)

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

Using the results from the feed forward pass. Since the layer does not have any learn-able parameters, we just have to down-sample the gradient to make its size compatible with the input size.

Parameters
*(input) The input matrix.
gradientThe computed backward gradient.
outputThe resulting down-sampled output.

◆ Forward()

template<typename InputDataType , typename OutputDataType >
template<typename eT >
void mlpack::ann::NearestInterpolation< InputDataType, OutputDataType >::Forward ( const arma::Mat< eT > &  input,
arma::Mat< eT > &  output 
)

Forward pass through the layer.

The layer interpolates the matrix using the given Nearest Interpolation method.

Parameters
inputThe input matrix.
outputThe resulting interpolated output matrix.

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