Implementation of the MaxPooling layer. More...
Public Member Functions | |
MaxPoolingType () | |
Create the MaxPooling object. More... | |
MaxPoolingType (const size_t kernelWidth, const size_t kernelHeight, const size_t strideWidth=1, const size_t strideHeight=1, const bool floor=true) | |
Create the MaxPooling object using the specified number of units. More... | |
MaxPoolingType (const MaxPoolingType &other) | |
Copy the given MaxPoolingType. More... | |
MaxPoolingType (MaxPoolingType &&other) | |
Take ownership of the given MaxPoolingType. More... | |
virtual | ~MaxPoolingType () |
void | Backward (const MatType &, 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... | |
MaxPoolingType * | Clone () const |
Clone the MaxPoolingType 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... | |
MaxPoolingType & | operator= (const MaxPoolingType &other) |
Copy the given MaxPoolingType. More... | |
MaxPoolingType & | operator= (MaxPoolingType &&other) |
Take ownership of the given MaxPoolingType. 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... | |
![]() | |
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 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 MaxPooling layer.
MatType | Matrix representation to accept as input and use for computation. |
Definition at line 61 of file max_pooling.hpp.
MaxPoolingType | ( | ) |
Create the MaxPooling object.
MaxPoolingType | ( | const size_t | kernelWidth, |
const size_t | kernelHeight, | ||
const size_t | strideWidth = 1 , |
||
const size_t | strideHeight = 1 , |
||
const bool | floor = true |
||
) |
Create the MaxPooling object using the specified number of units.
kernelWidth | Width of the pooling window. |
kernelHeight | Height of the pooling window. |
strideWidth | Width of the stride operation. |
strideHeight | Width of the stride operation. |
floor | If true, then a pooling operation that would oly part of the input will be skipped. |
|
inlinevirtual |
Definition at line 84 of file max_pooling.hpp.
MaxPoolingType | ( | const MaxPoolingType< MatType > & | other | ) |
Copy the given MaxPoolingType.
MaxPoolingType | ( | MaxPoolingType< MatType > && | other | ) |
Take ownership of the given MaxPoolingType.
|
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 >.
|
inlinevirtual |
Clone the MaxPoolingType object. This handles polymorphism correctly.
Implements Layer< MatType >.
Definition at line 96 of file max_pooling.hpp.
|
virtual |
Compute the size of the output given InputDimensions()
.
Reimplemented from Layer< MatType >.
|
inline |
Get the value of the rounding operation.
Definition at line 141 of file max_pooling.hpp.
|
inline |
Modify the value of the rounding operation.
Definition at line 143 of file max_pooling.hpp.
|
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 >.
|
inline |
Get the kernel height.
Definition at line 126 of file max_pooling.hpp.
|
inline |
Modify the kernel height.
Definition at line 128 of file max_pooling.hpp.
|
inline |
Get the kernel width.
Definition at line 121 of file max_pooling.hpp.
|
inline |
Modify the kernel width.
Definition at line 123 of file max_pooling.hpp.
MaxPoolingType& operator= | ( | const MaxPoolingType< MatType > & | other | ) |
Copy the given MaxPoolingType.
MaxPoolingType& operator= | ( | MaxPoolingType< MatType > && | other | ) |
Take ownership of the given MaxPoolingType.
void serialize | ( | Archive & | ar, |
const uint32_t | |||
) |
Serialize the layer.
|
inline |
Get the stride height.
Definition at line 136 of file max_pooling.hpp.
|
inline |
Modify the stride height.
Definition at line 138 of file max_pooling.hpp.
|
inline |
Get the stride width.
Definition at line 131 of file max_pooling.hpp.
|
inline |
Modify the stride width.
Definition at line 133 of file max_pooling.hpp.