Implementation of the Concatenate module class. More...
Public Member Functions | |
ConcatenateType (const MatType &concat=MatType()) | |
Create the ConcatenateType object using the given constant matrix as the data to be concatenated to the output of the forward pass. More... | |
ConcatenateType (const ConcatenateType &other) | |
Copy the given ConcatenateType layer. More... | |
ConcatenateType (ConcatenateType &&other) | |
Take ownership of the given ConcatenateType layer. More... | |
virtual | ~ConcatenateType () |
void | Backward (const MatType &, const MatType &gy, MatType &g) |
Ordinary feed backward pass of a neural network, calculating the function f(x) by propagating x backwards trough f. More... | |
ConcatenateType * | Clone () const |
Clone the ConcatenateType object. This handles polymorphism correctly. More... | |
void | ComputeOutputDimensions () |
Compute the output dimensions of the layer based on InputDimensions() . More... | |
MatType const & | Concat () const |
Get the concat matrix. More... | |
MatType & | Concat () |
Modify the concat. 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... | |
ConcatenateType & | operator= (const ConcatenateType &other) |
Copy the given ConcatenateType layer. More... | |
ConcatenateType & | operator= (ConcatenateType &&other) |
Take ownership of the given ConcatenateType layer. More... | |
template < typename Archive > | |
void | serialize (Archive &ar, const uint32_t) |
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 | 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 Concatenate module class.
The Concatenate module concatenates a constant given matrix to the incoming data.
The Concat() function provides the concat matrix, or it can be passed to the constructor.
After this layer is applied, the shape of the data will be a vector.
MatType | Matrix representation to accept as input and use for computation. |
Definition at line 35 of file concatenate.hpp.
ConcatenateType | ( | const MatType & | concat = MatType() | ) |
Create the ConcatenateType object using the given constant matrix as the data to be concatenated to the output of the forward pass.
Referenced by ConcatenateType< MatType >::Clone(), and ConcatenateType< MatType >::~ConcatenateType().
|
inlinevirtual |
Definition at line 48 of file concatenate.hpp.
References ConcatenateType< MatType >::Backward(), ConcatenateType< MatType >::ConcatenateType(), ConcatenateType< MatType >::Forward(), and ConcatenateType< MatType >::operator=().
ConcatenateType | ( | const ConcatenateType< MatType > & | other | ) |
Copy the given ConcatenateType layer.
ConcatenateType | ( | ConcatenateType< MatType > && | other | ) |
Take ownership of the given ConcatenateType layer.
|
virtual |
Ordinary feed backward pass of a neural network, calculating the function f(x) by propagating x backwards trough 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 ConcatenateType< MatType >::~ConcatenateType().
|
inlinevirtual |
Clone the ConcatenateType object. This handles polymorphism correctly.
Implements Layer< MatType >.
Definition at line 45 of file concatenate.hpp.
References ConcatenateType< MatType >::ConcatenateType().
|
virtual |
Compute the output dimensions of the layer based on InputDimensions()
.
Reimplemented from Layer< MatType >.
Referenced by ConcatenateType< MatType >::Concat().
|
inline |
Get the concat matrix.
Definition at line 80 of file concatenate.hpp.
|
inline |
Modify the concat.
Definition at line 82 of file concatenate.hpp.
References ConcatenateType< MatType >::ComputeOutputDimensions(), and ConcatenateType< MatType >::serialize().
|
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 ConcatenateType< MatType >::~ConcatenateType().
ConcatenateType& operator= | ( | const ConcatenateType< MatType > & | other | ) |
Copy the given ConcatenateType layer.
Referenced by ConcatenateType< MatType >::~ConcatenateType().
ConcatenateType& operator= | ( | ConcatenateType< MatType > && | other | ) |
Take ownership of the given ConcatenateType layer.
void serialize | ( | Archive & | ar, |
const uint32_t | |||
) |
Serialize the layer.
Referenced by ConcatenateType< MatType >::Concat().