Definition and Implementation of the Bilinear Interpolation Layer. More...
Public Member Functions | |
BilinearInterpolation () | |
Create the Bilinear Interpolation object. More... | |
BilinearInterpolation (const size_t inRowSize, const size_t inColSize, const size_t outRowSize, const size_t outColSize, const size_t depth) | |
The constructor for the Bilinear Interpolation. 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 & | Delta () const |
Get the delta. More... | |
OutputDataType & | Delta () |
Modify the delta. More... | |
template < typename eT > | |
void | Forward (const arma::Mat< eT > &input, arma::Mat< eT > &output) |
Forward pass through the layer. More... | |
size_t const & | InColSize () const |
Get the column size of the input. More... | |
size_t & | InColSize () |
Modify the column size of the input. More... | |
size_t const & | InDepth () const |
Get the depth of the input. More... | |
size_t & | InDepth () |
Modify the depth of the input. More... | |
size_t | InputShape () const |
Get the shape of the input. More... | |
size_t const & | InRowSize () const |
Get the row size of the input. More... | |
size_t & | InRowSize () |
Modify the row size of the input. More... | |
size_t const & | OutColSize () const |
Get the column size of the output. More... | |
size_t & | OutColSize () |
Modify the column size of the output. More... | |
OutputDataType const & | OutputParameter () const |
Get the output parameter. More... | |
OutputDataType & | OutputParameter () |
Modify the output parameter. More... | |
size_t const & | OutRowSize () const |
Get the row size of the output. More... | |
size_t & | OutRowSize () |
Modify the row size of the output. More... | |
template < typename Archive > | |
void | serialize (Archive &ar, const uint32_t) |
Serialize the layer. More... | |
Definition and Implementation of the Bilinear Interpolation Layer.
Bilinear Interpolation is an mathematical technique, primarily used for scaling purposes. It is an extension of linear interpolation, for interpolating functions of two variables on a rectangular grid. The key idea is to perform linear interpolation first in one direction (e.g., along x-axis), and then again in the other direction (i.e., y-axis), on four different known points in the grid. This way, we represent any arbitrary point, present within the grid, as a function of those four points.
InputDataType | Type of the input data (arma::colvec, arma::mat, arma::sp_mat or arma::cube). |
OutputDataType | Type of the output data (arma::colvec, arma::mat, arma::sp_mat or arma::cube). |
Definition at line 39 of file bilinear_interpolation.hpp.
Create the Bilinear Interpolation object.
BilinearInterpolation | ( | const size_t | inRowSize, |
const size_t | inColSize, | ||
const size_t | outRowSize, | ||
const size_t | outColSize, | ||
const size_t | depth | ||
) |
The constructor for the Bilinear Interpolation.
inRowSize | Number of input rows. |
inColSize | Number of input columns. |
outRowSize | Number of output rows. |
outColSize | Number of output columns. |
depth | Number of input slices. |
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.
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.
* | (input) The input matrix. |
gradient | The computed backward gradient. |
output | The resulting down-sampled output. |
|
inline |
Get the delta.
Definition at line 92 of file bilinear_interpolation.hpp.
|
inline |
Modify the delta.
Definition at line 94 of file bilinear_interpolation.hpp.
void Forward | ( | const arma::Mat< eT > & | input, |
arma::Mat< eT > & | output | ||
) |
Forward pass through the layer.
The layer interpolates the matrix using the given Bilinear Interpolation method.
input | The input matrix. |
output | The resulting interpolated output matrix. |
|
inline |
Get the column size of the input.
Definition at line 102 of file bilinear_interpolation.hpp.
|
inline |
Modify the column size of the input.
Definition at line 104 of file bilinear_interpolation.hpp.
|
inline |
Get the depth of the input.
Definition at line 117 of file bilinear_interpolation.hpp.
|
inline |
Modify the depth of the input.
Definition at line 119 of file bilinear_interpolation.hpp.
|
inline |
Get the shape of the input.
Definition at line 122 of file bilinear_interpolation.hpp.
References BilinearInterpolation< InputDataType, OutputDataType >::serialize().
|
inline |
Get the row size of the input.
Definition at line 97 of file bilinear_interpolation.hpp.
|
inline |
Modify the row size of the input.
Definition at line 99 of file bilinear_interpolation.hpp.
|
inline |
Get the column size of the output.
Definition at line 112 of file bilinear_interpolation.hpp.
|
inline |
Modify the column size of the output.
Definition at line 114 of file bilinear_interpolation.hpp.
|
inline |
Get the output parameter.
Definition at line 87 of file bilinear_interpolation.hpp.
|
inline |
Modify the output parameter.
Definition at line 89 of file bilinear_interpolation.hpp.
|
inline |
Get the row size of the output.
Definition at line 107 of file bilinear_interpolation.hpp.
|
inline |
Modify the row size of the output.
Definition at line 109 of file bilinear_interpolation.hpp.
void serialize | ( | Archive & | ar, |
const uint32_t | |||
) |
Serialize the layer.
Referenced by BilinearInterpolation< InputDataType, OutputDataType >::InputShape().