Implementation of the AdaptiveMeanPooling layer. More...
Public Member Functions | |
AdaptiveMeanPoolingType () | |
Create the AdaptiveMeanPooling object. More... | |
AdaptiveMeanPoolingType (const size_t outputWidth, const size_t outputHeight) | |
Create the AdaptiveMeanPooling object. More... | |
AdaptiveMeanPoolingType (const AdaptiveMeanPoolingType &other) | |
Copy the given AdaptiveMeanPoolingType. More... | |
AdaptiveMeanPoolingType (AdaptiveMeanPoolingType &&other) | |
Take ownership of the given AdaptiveMeanPoolingType. More... | |
virtual | ~AdaptiveMeanPoolingType () |
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... | |
AdaptiveMeanPoolingType * | Clone () const |
Clone the AdaptiveMeanPoolingType 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... | |
AdaptiveMeanPoolingType & | operator= (const AdaptiveMeanPoolingType &other) |
Copy the given AdaptiveMeanPoolingType. More... | |
AdaptiveMeanPoolingType & | operator= (AdaptiveMeanPoolingType &&other) |
Take ownership of the given AdaptiveMeanPoolingType. 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... | |
![]() | |
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 Layer & | operator= (const Layer &layer) |
Copy assignment operator. This is not responsible for copying weights! More... | |
virtual Layer & | operator= (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 | |
![]() | |
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... | |
Implementation of the AdaptiveMeanPooling layer.
The AdaptiveMeanPooling layer works similarly to MeanPooling layer, but it adaptively changes the size of the pooling region to minimize the amount of computation. In MeanPooling, we specifies the kernel and stride size whereas in AdaptiveMeanPooling, we specify the output size of the pooling region.
MatType | Matrix representation to accept as input and use for computation. |
Definition at line 36 of file adaptive_mean_pooling.hpp.
Create the AdaptiveMeanPooling object.
Referenced by AdaptiveMeanPoolingType< MatType >::Clone(), and AdaptiveMeanPoolingType< MatType >::~AdaptiveMeanPoolingType().
AdaptiveMeanPoolingType | ( | const size_t | outputWidth, |
const size_t | outputHeight | ||
) |
Create the AdaptiveMeanPooling object.
outputWidth | Width of the output. |
outputHeight | Height of the output. |
|
inlinevirtual |
Definition at line 52 of file adaptive_mean_pooling.hpp.
References AdaptiveMeanPoolingType< MatType >::AdaptiveMeanPoolingType(), and AdaptiveMeanPoolingType< MatType >::operator=().
AdaptiveMeanPoolingType | ( | const AdaptiveMeanPoolingType< MatType > & | other | ) |
Copy the given AdaptiveMeanPoolingType.
AdaptiveMeanPoolingType | ( | AdaptiveMeanPoolingType< MatType > && | other | ) |
Take ownership of the given AdaptiveMeanPoolingType.
|
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.
input | The propagated input activation. |
gy | The backpropagated error. |
g | The calculated gradient. |
Reimplemented from Layer< MatType >.
Referenced by AdaptiveMeanPoolingType< MatType >::Clone().
|
inlinevirtual |
Clone the AdaptiveMeanPoolingType object.
This handles polymorphism correctly.
Implements Layer< MatType >.
Definition at line 68 of file adaptive_mean_pooling.hpp.
References AdaptiveMeanPoolingType< MatType >::AdaptiveMeanPoolingType(), AdaptiveMeanPoolingType< MatType >::Backward(), and AdaptiveMeanPoolingType< MatType >::Forward().
|
virtual |
Compute the size of the output given InputDimensions()
.
Reimplemented from Layer< MatType >.
Referenced by AdaptiveMeanPoolingType< MatType >::OutputHeight().
|
virtual |
Ordinary feed forward pass of a neural network, evaluating the function f(x) by propagating the activity forward through f.
input | Input data used for evaluating the specified function. |
output | Resulting output activation. |
Reimplemented from Layer< MatType >.
Referenced by AdaptiveMeanPoolingType< MatType >::Clone().
AdaptiveMeanPoolingType& operator= | ( | const AdaptiveMeanPoolingType< MatType > & | other | ) |
Copy the given AdaptiveMeanPoolingType.
Referenced by AdaptiveMeanPoolingType< MatType >::~AdaptiveMeanPoolingType().
AdaptiveMeanPoolingType& operator= | ( | AdaptiveMeanPoolingType< MatType > && | other | ) |
Take ownership of the given AdaptiveMeanPoolingType.
|
inline |
Get the output height.
Definition at line 101 of file adaptive_mean_pooling.hpp.
|
inline |
Modify the output height.
Definition at line 103 of file adaptive_mean_pooling.hpp.
References AdaptiveMeanPoolingType< MatType >::ComputeOutputDimensions(), and AdaptiveMeanPoolingType< MatType >::serialize().
|
inline |
Get the output width.
Definition at line 96 of file adaptive_mean_pooling.hpp.
|
inline |
Modify the output width.
Definition at line 98 of file adaptive_mean_pooling.hpp.
void serialize | ( | Archive & | ar, |
const uint32_t | version | ||
) |
Serialize the layer.
Referenced by AdaptiveMeanPoolingType< MatType >::OutputHeight().