SubviewType< InputType, OutputType > Class Template Reference

Implementation of the subview layer. More...

Inheritance diagram for SubviewType< InputType, OutputType >:

Public Member Functions

 SubviewType (const size_t beginRow=0, const size_t endRow=0, const size_t beginCol=0, const size_t endCol=0)
 Create the Subview layer object using the specified range of input to accept. More...

 
void Backward (const InputType &, const OutputType &gy, OutputType &g)
 Ordinary feed backward pass of a neural network, calculating the function f(x) by propagating x backwards trough f. More...

 
size_t const & BeginCol () const
 Get the width of each sample. More...

 
size_t & BeginCol ()
 Modify the width of each sample. More...

 
size_t const & BeginRow () const
 Get the starting row index of subview vector or matrix. More...

 
size_t & BeginRow ()
 Modify the width of each sample. More...

 
SubviewTypeClone () const
 Clone the SubviewType object. This handles polymorphism correctly. More...

 
size_t const & EndCol () const
 Get the ending column index of subview vector or matrix. More...

 
size_t & EndCol ()
 Modify the width of each sample. More...

 
size_t const & EndRow () const
 Get the ending row index of subview vector or matrix. More...

 
size_t & EndRow ()
 Modify the width of each sample. More...

 
void Forward (const InputType &input, OutputType &output)
 Ordinary feed forward pass of a neural network, evaluating the function f(x) by propagating the activity forward through f. More...

 
const std::vector< size_t > OutputDimensions () const
 
template
<
typename
Archive
>
void serialize (Archive &ar, const uint32_t)
 Serialize the layer. More...

 
- Public Member Functions inherited from Layer< InputType, OutputType >
 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 Backward (const InputType &, const InputType &, InputType &)
 Performs a backpropagation step through the layer, with respect to the given input. More...

 
virtual void ComputeOutputDimensions ()
 Compute the output dimensions. More...

 
virtual void CustomInitialize (InputType &, const size_t)
 Override the weight matrix of the layer. More...

 
virtual void Forward (const InputType &, InputType &)
 Takes an input object, and computes the corresponding output of the layer. More...

 
virtual void Forward (const InputType &, const InputType &)
 Takes an input and output object, and computes the corresponding loss of the layer. More...

 
virtual void Gradient (const InputType &, const InputType &, InputType &)
 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 Layeroperator= (const Layer &layer)
 Copy assignment operator. This is not responsible for copying weights! More...

 
virtual Layeroperator= (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 InputType & Parameters () const
 Get the parameters. More...

 
virtual InputType & Parameters ()
 Set the parameters. More...

 
void serialize (Archive &ar, const uint32_t)
 Serialize the layer. More...

 
virtual void SetWeights (typename InputType ::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

- Protected Attributes inherited from Layer< InputType, OutputType >
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...

 

Detailed Description


template
<
typename
InputType
=
arma::mat
,
typename
OutputType
=
arma::mat
>

class mlpack::ann::SubviewType< InputType, OutputType >

Implementation of the subview layer.

The subview layer modifies the input to a submatrix of required size.

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

Definition at line 35 of file subview.hpp.

Constructor & Destructor Documentation

◆ SubviewType()

SubviewType ( const size_t  beginRow = 0,
const size_t  endRow = 0,
const size_t  beginCol = 0,
const size_t  endCol = 0 
)
inline

Create the Subview layer object using the specified range of input to accept.

Parameters
beginRowStarting row index.
endRowEnding row index.
beginColStarting column index.
endColEnding column index.

Definition at line 47 of file subview.hpp.

Referenced by SubviewType< InputType, OutputType >::Clone().

Member Function Documentation

◆ Backward()

void Backward ( const InputType &  ,
const OutputType &  gy,
OutputType &  g 
)
inline

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.

Parameters
*(input) The propagated input activation.
gyThe backpropagated error.
gThe calculated gradient.

Definition at line 116 of file subview.hpp.

◆ BeginCol() [1/2]

size_t const& BeginCol ( ) const
inline

Get the width of each sample.

Definition at line 134 of file subview.hpp.

◆ BeginCol() [2/2]

size_t& BeginCol ( )
inline

Modify the width of each sample.

Definition at line 136 of file subview.hpp.

◆ BeginRow() [1/2]

size_t const& BeginRow ( ) const
inline

Get the starting row index of subview vector or matrix.

Definition at line 124 of file subview.hpp.

◆ BeginRow() [2/2]

size_t& BeginRow ( )
inline

Modify the width of each sample.

Definition at line 126 of file subview.hpp.

◆ Clone()

SubviewType* Clone ( ) const
inlinevirtual

Clone the SubviewType object. This handles polymorphism correctly.

Implements Layer< InputType, OutputType >.

Definition at line 60 of file subview.hpp.

References SubviewType< InputType, OutputType >::SubviewType().

◆ EndCol() [1/2]

size_t const& EndCol ( ) const
inline

Get the ending column index of subview vector or matrix.

Definition at line 139 of file subview.hpp.

◆ EndCol() [2/2]

size_t& EndCol ( )
inline

Modify the width of each sample.

Definition at line 141 of file subview.hpp.

◆ EndRow() [1/2]

size_t const& EndRow ( ) const
inline

Get the ending row index of subview vector or matrix.

Definition at line 129 of file subview.hpp.

◆ EndRow() [2/2]

size_t& EndRow ( )
inline

Modify the width of each sample.

Definition at line 131 of file subview.hpp.

◆ Forward()

void Forward ( const InputType &  input,
OutputType &  output 
)
inline

Ordinary feed forward pass of a neural network, evaluating the function f(x) by propagating the activity forward through f.

Parameters
inputInput data used for evaluating the specified function.
outputResulting output activation.

Definition at line 69 of file subview.hpp.

References Layer< InputType, OutputType >::inputDimensions.

◆ OutputDimensions()

const std::vector<size_t> OutputDimensions ( ) const
inline

◆ serialize()

void serialize ( Archive &  ar,
const uint32_t   
)
inline

Serialize the layer.

Definition at line 166 of file subview.hpp.


The documentation for this class was generated from the following file:
  • /home/jenkins-mlpack/mlpack.org/_src/mlpack-git/src/mlpack/methods/ann/layer/not_adapted/subview.hpp